cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
wpmoorenasa
Observer
Observer
547 Views
Registered: ‎05-08-2019

install interrupt callback for "Core0_nIRQ"?

I see many examples online for using ZYNQ general purpose interrupt controller,  but what If I just want to install an interrupt callback function for when I connect only the "Core_nIRQ" signal from PL->ZYNQ.  Where can I find the broiler plate c-function just for installing this type of callback function?

0 Kudos
Reply
2 Replies
wpmoorenasa
Observer
Observer
529 Views
Registered: ‎05-08-2019

Hint: DeviceID for nIRQ is in XSDK header file "./<appname>_bsp/ps7_cortexa9_0/include/xparameters_ps.h":

...
#define XPS_IRQ_INT_ID 31U /* IRQ from FPGA fabric */ // <<=====
...
#define XPS_FIQ_INT_ID 28U /* FIQ from FPGA fabric */
...
0 Kudos
Reply
wpmoorenasa
Observer
Observer
520 Views
Registered: ‎05-08-2019

https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/scugic/examples/xscugic_example.c

#include <stdio.h>
#include "xparameters.h"
#include "Xscugic.h"
#include "Xil_exception.h"

typedef void fpga_irq_callback_t(void*);

void fpga_irq_callback(void *CallBackRef)
{
    xil_printf("FPGA Interrupt Event\n\r");
}

void fpga_irq_installer(fpga_irq_callback_t callback)
{
    static XScuGic   Intc;
    static u32       FPGA;
    XScuGic_Config*  IntcConfig; 
   
    Xil_ExceptionInit();

    IntcConfig = XScuGic_LookupConfig(XPAR_SCUGIC_SINGLE_DEVICE_ID);
   
    XScuGic_CfgInitialize(
        &Intc,
        IntcConfig,
        IntcConfig->CpuBaseAddress
    );

    Xil_ExceptionRegisterHandler(
        XIL_EXCEPTION_ID_INT,
        (Xil_ExceptionHandler)XScuGic_InterruptHandler,
        &Intc
    );

    XScuGic_Connect(
        &Intc,
        XPS_IRQ_INT_ID,
        (Xil_ExceptionHandler)callback,
        (void *)&FPGA
    );

    XScuGic_Enable(&Intc, XPS_IRQ_INT_ID);
    Xil_ExceptionEnableMask(XIL_EXCEPTION_IRQ);
    xil_printf("Interrupt Set Up\n\r");
}


int main()
{

    fpga_irq_installer(fpga_irq_callback);
   
    // Wait for Interrupts....
    printf("Waiting for Interrupts... \n\r");   
    while(1){}
   
    return 0;
}

 

 

 

0 Kudos
Reply