URL: http://www.freertos.org/Interactive_Frames/Open_Frames.html?http://interactive.freertos.org/forums
*****************************************************************************************************************************************************************************************
Hi, We write a code below to use FPGA interrupt instead of timer interrupt set up by FreeRTOS. The prototype of vApplicationSetupHardware() is defined in portmacro.h and its implemented can be in main.c. It will execute in xPortStartScheduler() that will enable timer interrupt by FreeRTOS porting. So in this function it will disable/disconnect timer interrupt first, then it will connect vTickISR and your own interrupt ID. Any comments for this will be very useful for us, thank you.
Code:
void vApplicationSetupHardware( void )
{
// ********************************************************
// NOTE:
// This function is executed in xPortStartScheduler( void )
// ********************************************************
extern void vTickISR (void);
XScuGic *pObj;
U32 time = 44400; // time = 888us / 0.02us
// Get interrupt controller pointer from FreeRTOS
pObj = prvGetInterruptControllerInstance();
// Disable and disconnect timer interrupt generated from FreeRTOS
XScuGic_Disable( pObj, XPAR_SCUTIMER_INTR );
XScuGic_Disconnect( pObj, XPAR_SCUTIMER_INTR );
// Setup FPGA register to generate interrupt
Xil_Out32( 0x41200000, time | 0x80000000 );
// Enable FPGA interrupt
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT,
(Xil_ExceptionHandler) XScuGic_InterruptHandler,
(void *) pObj);
XScuGic_Connect( pObj, 61, (Xil_ExceptionHandler)vTickISR, (void *)pObj );
XScuGic_Enable( pObj, 61 );
Xil_ExceptionEnable();
XScuGic_SetPriorityTriggerType( pObj, 61, 0xa0, 3);
}
*****************************************************************************************************************************************************************************************
Note in the official Zynq demo the timer interrupt is configured in an application callback anyway. http://www.freertos.org/RTOS-Xilinx-Zynq.html
*****************************************************************************************************************************************************************************************
In the application vApplicationSetupHardware(), you need to call just the initialization for all the interrupt handler. Place this code into some function named e.g. FPGA_Interrupt_init and call this function from the vApplicationSetupHardware(). Are u receiving interrupt in your program or not? One more thing you do not need "Disable and disconnect timer interrupt generated from FreeRTOS" line. Follow the following sequence
1. Get Interrupt controller Instance
2. Lookup for specific device
3. Initialize the device _CfgInitilization( ).
4. connect the device interrupt with the interrupt controller XScuGic_Connect()
5. Enable interrupt in the interrupt controller XScuGic_Enable
6. set some other setting for the specific device etc.