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
STACKSIZE, XPAR
PS7SCUGIC
0DEVICE
ID,
tskIDLEPRIORITY, NULL);
~~~
Interrupt Enable Function:
~~~
XScuGic InterruptController;
static XScuGic
Config *GicConfig;
xSemaphoreHandle DMATransfertrigger = 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!!rn");
vTaskDelete(NULL); //delete InitAXIDMA itself
}
Status = XScuGic_CfgInitialize(&InterruptController, GicConfig,
GicConfig->CpuBaseAddress);
if (Status != XST_SUCCESS) {
xil_printf("Interrupt Initialization FAILED!!rn");
vTaskDelete(NULL); //delete InitAXIDMA itself
}
Status = SetUpInterruptSystem(&InterruptController);
if (Status != XST_SUCCESS) {
xil_printf("Interrupt Initialization FAILED!!rn");
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!!rn");
vTaskDelete(NULL); //delete InitAXIDMA itself
}
XScuGic_Enable(&InterruptController,
XPAR_FABRIC_AXI_DMA_0_S2MM_INTROUT_INTR);
ifdef DEBUG
xil_printf("Interrupt Initialization Completern");
endif
vTaskDelete(NULL); //delete InitAXIDMA itself
}
}
~~~
In the interrupt Handler:
~~~
void InterruptHandler(void) {
u32 tmpValue;
//xil
printf(“Interrupt acknowledged…nr);
//clear interrupt just perform a write bit to no 12 ofS2MMDMASR
tmpValue = Xil
In32(XPARAXI
DMA0
BASEADDR + 0x34);
tmpValue = tmpValue | 0x1000;
XilOut32( XPAR
AXIDMA
0BASEADDR + 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!