how5877 wrote on Friday, July 22, 2016:
I am using freeRTOS in Zedboard. I am able to enable the PL-PS interrupt in bare-metal program. I couldn’t really find any documentation/tutorial on how to link the FreeRTOS and the PL interrupt system. I am currently migrating my software to freeRTOS but I am not sure how to “connect” the interrupt between the freeRTOS and the PL interrupt. Here is what I have done and I am sure it is totally wrong.
In the main:
xTaskCreate(InitInterrupt, (const char * )"Init Interrupt",
configMINIMAL_STACK_SIZE, XPAR_PS7_SCUGIC_0_DEVICE_ID,
tskIDLE_PRIORITY, NULL);
Interrupt Enable Function:
XScuGic InterruptController;
static XScuGic_Config *GicConfig;
xSemaphoreHandle DMATransfer_trigger = 0;
int SetUpInterruptSystem(XScuGic *XScuGicInstancePtr) {
Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,
(Xil_ExceptionHandler) XScuGic_InterruptHandler,
XScuGicInstancePtr);
Xil_ExceptionEnable();
//enable interrupt in ARM
return XST_SUCCESS;
}
static void InitInterrupt( deviceID) {
while (1) {
int Status;
GicConfig = XScuGic_LookupConfig(deviceID);
if (NULL == GicConfig) {
xil_printf("Interrupt Initialization FAILED!!\r\n");
vTaskDelete(NULL); //delete InitAXIDMA itself
}
Status = XScuGic_CfgInitialize(&InterruptController, GicConfig,
GicConfig->CpuBaseAddress);
if (Status != XST_SUCCESS) {
xil_printf("Interrupt Initialization FAILED!!\r\n");
vTaskDelete(NULL); //delete InitAXIDMA itself
}
Status = SetUpInterruptSystem(&InterruptController);
if (Status != XST_SUCCESS) {
xil_printf("Interrupt Initialization FAILED!!\r\n");
vTaskDelete(NULL); //delete InitAXIDMA itself
}
Status = XScuGic_Connect(&InterruptController,
XPAR_FABRIC_AXI_DMA_0_S2MM_INTROUT_INTR,
(Xil_ExceptionHandler) InterruptHandler,
NULL);
if (Status != XST_SUCCESS) {
xil_printf("Interrupt Initialization FAILED!!\r\n");
vTaskDelete(NULL); //delete InitAXIDMA itself
}
XScuGic_Enable(&InterruptController,
XPAR_FABRIC_AXI_DMA_0_S2MM_INTROUT_INTR);
#ifdef DEBUG
xil_printf("Interrupt Initialization Complete\r\n");
#endif
vTaskDelete(NULL); //delete InitAXIDMA itself
}
}
In the interrupt Handler:
void InterruptHandler(void) {
u32 tmpValue;
//xil_printf("Interrupt acknowledged...\n\r);
//clear interrupt just perform a write bit to no 12 ofS2MM_DMASR
tmpValue = Xil_In32(XPAR_AXI_DMA_0_BASEADDR + 0x34);
tmpValue = tmpValue | 0x1000;
Xil_Out32( XPAR_AXI_DMA_0_BASEADDR + 0x34, tmpValue);
//Process Data Here!!
//initialize another transfer
xSemaphoreGive(DMATransfer_trigger);
}
The interrupt source is from the AXI DMA Controller IP. This is what I have tried but it doesn’t work. Can anyone please give me some guide on how to modify the code to handle and setup FreeRTOS interrupt from the PL. Thank you!