/***************************************************************************//** * @brief Main function. * * @return Returns 0. *******************************************************************************/ int main() { UINT32 StartCount; MajorRev = 1; MinorRev = 1; RcRev = 1; DriverEnable = TRUE; LastEnable = FALSE; Xil_ICacheEnable(); Xil_DCacheEnable(); #ifdef XPAR_AXI_IIC_0_BASEADDR HAL_PlatformInit(XPAR_AXI_IIC_0_BASEADDR, /* Perform any required platform init */ XPAR_SCUTIMER_DEVICE_ID, /* including hardware reset to HDMI devices */ XPAR_SCUGIC_SINGLE_DEVICE_ID, XPAR_SCUTIMER_INTR); #else HAL_PlatformInit(XPAR_AXI_IIC_MAIN_BASEADDR, /* Perform any required platform init */ XPAR_SCUTIMER_DEVICE_ID, /* including hardware reset to HDMI devices */ XPAR_SCUGIC_SINGLE_DEVICE_ID, XPAR_SCUTIMER_INTR); #endif Xil_ExceptionEnable(); SetVideoResolution(RESOLUTION_640x480); InitHdmiAudioPcore(); APP_PrintRevisions(); /* Display S/W and H/W revisions */ DBG_MSG("To change the video resolution press:\r\n"); DBG_MSG(" '0' - 640x480; '1' - 800x600; '2' - 1024x768; '3' - 1280x720 \r\n"); DBG_MSG(" '4' - 1360x768; '5' - 1600x900; '6' - 1920x1080.\r\n"); ADIAPI_TransmitterInit(); /* Initialize ADI repeater software and h/w */ ADIAPI_TransmitterSetPowerMode(REP_POWER_UP); StartCount = HAL_GetCurrentMsCount(); while(1) { if (ATV_GetElapsedMs (StartCount, NULL) >= HDMI_CALL_INTERVAL_MS) { StartCount = HAL_GetCurrentMsCount(); if (APP_DriverEnabled()) { ADIAPI_TransmitterMain(); } } APP_ChangeResolution(); } Xil_DCacheDisable(); Xil_ICacheDisable(); return(0); }
int zynqMP_r5_gic_initialize() { u32 Status; Xil_ExceptionDisable(); XScuGic_Config *IntcConfig; /* The configuration parameters of the interrupt controller */ /* * Initialize the interrupt controller driver */ IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID); if (NULL == IntcConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(&InterruptController, IntcConfig, IntcConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Register the interrupt handler to the hardware interrupt handling * logic in the ARM processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler) zynqMP_r5_irq_isr, &InterruptController); Xil_ExceptionEnable(); return 0; }
static void init_interrupt() { Xil_ExceptionInit(); if ((icconf = XScuGic_LookupConfig(XPAR_PS7_SCUGIC_0_DEVICE_ID)) == NULL) return; if (XScuGic_CfgInitialize(&ic, icconf, icconf->CpuBaseAddress) != XST_SUCCESS) return; Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler) XScuGic_InterruptHandler, &ic); if (XScuGic_Connect(&ic, PL_INT_ID, interrupt_handler, NULL) != XST_SUCCESS) return; XScuGic_SetPriorityTriggerType(&ic, PL_INT_ID, 0, /*highest priority*/ 3); /* 3 - rising edge, 1 - active high */ XScuGic_Enable(&ic, PL_INT_ID); Xil_ExceptionEnable(); }
int setup_interrupt() { //This functions sets up the interrupt on the ARM int result; XScuGic_Config *pCfg = XScuGic_LookupConfig(XPAR_SCUGIC_0_DEVICE_ID); if (pCfg == NULL){ print("Interrupt Configuration Lookup Failed\n\r"); return XST_FAILURE; } result = XScuGic_CfgInitialize(&ScuGic,pCfg,pCfg->CpuBaseAddress); if(result != XST_SUCCESS){ return result; } // self test result = XScuGic_SelfTest(&ScuGic); if(result != XST_SUCCESS){ return result; } // Initialize the exception handler Xil_ExceptionInit(); // Register the exception handler Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,(Xil_ExceptionHandler)XScuGic_InterruptHandler,&ScuGic); //Enable the exception handler Xil_ExceptionEnable(); // Connect the Voice Rec ISR to the exception table result = XScuGic_Connect(&ScuGic,XPAR_FABRIC_VOICEREC_0_INTERRUPT_INTR,(Xil_InterruptHandler)hls_voicerec_isr,&HlsVoiceRec); if(result != XST_SUCCESS){ return result; } // Enable the Voice Rec ISR XScuGic_Enable(&ScuGic,XPAR_FABRIC_VOICEREC_0_INTERRUPT_INTR); return XST_SUCCESS; }
XStatus InitInterruptController(INTC* intc) { int Status; // Start the interrupt controller #ifdef XPAR_INTC_0_DEVICE_ID // Initialize the driver instance RETURN_ON_FAILURE(XIntc_Initialize(intc, INTC_DEVICE_ID)); RETURN_ON_FAILURE(XIntc_Start(intc, XIN_REAL_MODE)); #else XScuGic_Config *GicConfig; GicConfig = XScuGic_LookupConfig(INTC_DEVICE_ID); XScuGic_CfgInitialize(intc, GicConfig, GicConfig->CpuBaseAddress); Status = XScuGic_SelfTest(intc); if (Status != XST_SUCCESS) { return XST_FAILURE; } #endif Xil_ExceptionInit(); /* * register the interrupt controller handler with the exception table. * This is in fact the ISR dispatch routine, calling our ISRs */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler) INTC_HANDLER, intc); Xil_ExceptionEnable(); return XST_SUCCESS; }
int SetUpInterruptSystem(XIntc *XIntcInstancePtr) { int Status; Status = XIntc_Connect(XIntcInstancePtr, INTC_DEVICE_INT_ID, (XInterruptHandler)DeviceDriverHandler, (void *)0); if (Status != XST_SUCCESS) { return XST_FAILURE; } Status = XIntc_Start(XIntcInstancePtr, XIN_SIMULATION_MODE); if (Status != XST_SUCCESS) { return XST_FAILURE; } XIntc_Enable(XIntcInstancePtr, INTC_DEVICE_INT_ID); Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XIntc_InterruptHandler, XIntcInstancePtr); Xil_ExceptionEnable(); return XST_SUCCESS; }
void platform_enable_interrupts() { /* * Enable non-critical exceptions. */ Xil_ExceptionEnable(); }
/* * * This function setups the interrupt system so interrupts can occur for the * DMA. This function assumes INTC component exists in the hardware system. * * @param AxiDmaPtr is a pointer to the instance of the DMA engine * @param ReadIntrId is the read channel Interrupt ID. * @param WriteIntrId is the write channel Interrupt ID. * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @note None. * ******************************************************************************/ static int SetupIntrSystem(XAxiVdma *AxiVdmaPtr, u16 ReadIntrId, u16 WriteIntrId) { int Status; XIntc *IntcInstancePtr =&Intc; /* Initialize the interrupt controller and connect the ISRs */ Status = XIntc_Initialize(IntcInstancePtr, XPAR_INTC_0_DEVICE_ID); if (Status != XST_SUCCESS) { xil_printf( "Failed init intc\r\n"); return XST_FAILURE; } Status = XIntc_Connect(IntcInstancePtr, ReadIntrId, (XInterruptHandler)XAxiVdma_ReadIntrHandler, AxiVdmaPtr); if (Status != XST_SUCCESS) { xil_printf("Failed read channel connect intc %d\r\n", Status); return XST_FAILURE; } Status = XIntc_Connect(IntcInstancePtr, WriteIntrId, (XInterruptHandler)XAxiVdma_WriteIntrHandler, AxiVdmaPtr); if (Status != XST_SUCCESS) { xil_printf("Failed write channel connect intc %d\r\n", Status); return XST_FAILURE; } /* Start the interrupt controller */ Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE); if (Status != XST_SUCCESS) { xil_printf( "Failed to start intc\r\n"); return XST_FAILURE; } /* Enable interrupts from the hardware */ XIntc_Enable(IntcInstancePtr, ReadIntrId); XIntc_Enable(IntcInstancePtr, WriteIntrId); Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XIntc_InterruptHandler, (void *)IntcInstancePtr); Xil_ExceptionEnable(); /* Register call-back functions */ XAxiVdma_SetCallBack(AxiVdmaPtr, XAXIVDMA_HANDLER_GENERAL, ReadCallBack, (void *)AxiVdmaPtr, XAXIVDMA_READ); XAxiVdma_SetCallBack(AxiVdmaPtr, XAXIVDMA_HANDLER_ERROR, ReadErrorCallBack, (void *)AxiVdmaPtr, XAXIVDMA_READ); XAxiVdma_SetCallBack(AxiVdmaPtr, XAXIVDMA_HANDLER_GENERAL, WriteCallBack, (void *)AxiVdmaPtr, XAXIVDMA_WRITE); XAxiVdma_SetCallBack(AxiVdmaPtr, XAXIVDMA_HANDLER_ERROR, WriteErrorCallBack, (void *)AxiVdmaPtr, XAXIVDMA_WRITE); return XST_SUCCESS; }
/* * This function enables interrupts and connects interrupt service routines declared in * an interrupt vector table */ void fnEnableInterrupts(intc *psIntc, const ivt_t *prgsIvt, unsigned int csIVectors) { unsigned int isIVector; Xil_AssertVoid(psIntc != NULL); Xil_AssertVoid(psIntc->IsReady == XIL_COMPONENT_IS_READY); /* Hook up interrupt service routines from IVT */ for (isIVector = 0; isIVector < csIVectors; isIVector++) { #ifdef __MICROBLAZE__ XIntc_Connect(psIntc, prgsIvt[isIVector].id, prgsIvt[isIVector].handler, prgsIvt[isIVector].pvCallbackRef); /* Enable the interrupt vector at the interrupt controller */ XIntc_Enable(psIntc, prgsIvt[isIVector].id); #else XScuGic_SetPriorityTriggerType(psIntc, prgsIvt[isIVector].id, 0xA0, 0x3); XScuGic_Connect(psIntc, prgsIvt[isIVector].id, prgsIvt[isIVector].handler, prgsIvt[isIVector].pvCallbackRef); XScuGic_Enable(psIntc, prgsIvt[isIVector].id); #endif } Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)INTC_HANDLER, psIntc); Xil_ExceptionEnable(); }
int zynqMP_r5_gic_initialize() { #ifndef USE_FREERTOS u32 Status; XScuGic_Config *IntcConfig; /* The configuration parameters of the interrupt controller */ /* * Initialize the interrupt controller driver */ IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID); if (NULL == IntcConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(&xInterruptController, IntcConfig, IntcConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Register the interrupt handler to the hardware interrupt handling * logic in the ARM processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler,&xInterruptController); Xil_ExceptionEnable(); #endif OpenAMPInstPtr.IntrID = VRING1_IPI_INTR_VECT; XScuGic_Connect(&xInterruptController, VRING1_IPI_INTR_VECT, (Xil_ExceptionHandler)zynqMP_r5_irq_isr, &OpenAMPInstPtr); return 0; }
/** * * This function setups the interrupt system for an Spi device. * This function is application specific since the actual system may or may not * have an interrupt controller. The Spi device could be directly connected to * a processor without an interrupt controller. The user should modify this * function to fit the application. * * @param IntcInstancePtr is a pointer to the instance of the Intc device. * @param SpiInstancePtr is a pointer to the instance of the Spi device. * @param SpiIntrId is the interrupt Id for an SPI device. * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @note None. * ******************************************************************************/ static int SpiSetupIntrSystem(XScuGic *IntcInstancePtr, XSpiPs *SpiInstancePtr, u16 SpiIntrId) { int Status; #ifndef TESTAPP_GEN XScuGic_Config *IntcConfig; /* Instance of the interrupt controller */ Xil_ExceptionInit(); /* * Initialize the interrupt controller driver so that it is ready to * use. */ IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID); if (NULL == IntcConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig, IntcConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Connect the interrupt controller interrupt handler to the hardware * interrupt handling logic in the processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler, IntcInstancePtr); #endif /* * Connect the device driver handler that will be called when an * interrupt for the device occurs, the handler defined above performs * the specific interrupt processing for the device. */ Status = XScuGic_Connect(IntcInstancePtr, SpiIntrId, (Xil_ExceptionHandler)XSpiPs_InterruptHandler, (void *)SpiInstancePtr); if (Status != XST_SUCCESS) { return Status; } /* * Enable the interrupt for the Spi device. */ XScuGic_Enable(IntcInstancePtr, SpiIntrId); #ifndef TESTAPP_GEN /* * Enable interrupts in the Processor. */ Xil_ExceptionEnable(); #endif return XST_SUCCESS; }
static int SetupIntrSystem(XScuGic * IntcInstancePtr, XAxiDma * AxiDmaPtr, u16 TxIntrId) { int Status; XScuGic_Config *IntcConfig; /* * Initialize the interrupt controller driver so that it is ready to * use. */ IntcConfig = XScuGic_LookupConfig(XPAR_SCUGIC_SINGLE_DEVICE_ID); if (NULL == IntcConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig,IntcConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } XScuGic_SetPriorityTriggerType(IntcInstancePtr, TxIntrId, 0xA0, 0x3); /* * Connect the device driver handler that will be called when an * interrupt for the device occurs, the handler defined above performs * the specific interrupt processing for the device. */ Status = XScuGic_Connect(IntcInstancePtr, TxIntrId,(Xil_InterruptHandler)TxIntrHandler,AxiDmaPtr); if (Status != XST_SUCCESS) { return Status; } XScuGic_Enable(IntcInstancePtr, TxIntrId); /* Enable interrupts from the hardware */ Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT,(Xil_ExceptionHandler)XScuGic_InterruptHandler,(void *)IntcInstancePtr); Xil_ExceptionEnable(); return XST_SUCCESS; }
/** * * This function setups the interrupt system such that interrupts can occur * for IIC. This function is application specific since the actual system may * or may not have an interrupt controller. The IIC device could be directly * connected to a processor without an interrupt controller. The user should * modify this function to fit the application. * * @param IicPtr contains a pointer to the instance of the IIC component * which is going to be connected to the interrupt controller. * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @notes None. * ****************************************************************************/ static int SetupInterruptSystem(XIic *IicPtr) { int Status; /* * Initialize the interrupt controller driver so that it's ready to use, * specify the device ID that is generated in xparameters.h */ Status = XIntc_Initialize(&InterruptController, INTC_DEVICE_ID); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Connect a device driver handler that will be called when an interrupt * for the device occurs, the device driver handler performs the * specific interrupt processing for the device */ Status = XIntc_Connect(&InterruptController, INTC_IIC_INTERRUPT_ID, XIic_InterruptHandler, IicPtr); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Start the interrupt controller such that interrupts are recognized * and handled by the processor. */ Status = XIntc_Start(&InterruptController, XIN_REAL_MODE); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Enable the interrupts for the IIC device. */ XIntc_Enable(&InterruptController, INTC_IIC_INTERRUPT_ID); /* * Initialize the exception table. */ Xil_ExceptionInit(); /* * Register the interrupt controller handler with the exception table. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler) XIntc_InterruptHandler, &InterruptController); /* * Enable non-critical exceptions. */ Xil_ExceptionEnable(); return XST_SUCCESS; }
/** * * This function sets up the interrupt system so interrupts can occur for the * Uart. This function is application-specific. The user should modify this * function to fit the application. * * @param IntcInstancePtr is a pointer to the instance of the INTC. * @param UartInstancePtr contains a pointer to the instance of the UART * driver which is going to be connected to the interrupt * controller. * @param UartIntrId is the interrupt Id and is typically * XPAR_<UARTPS_instance>_INTR value from xparameters.h. * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @note None. * ****************************************************************************/ static int SetupInterruptSystem(XScuGic *IntcInstancePtr, XUartPs *UartInstancePtr, u16 UartIntrId) { int Status; #ifndef TESTAPP_GEN XScuGic_Config *IntcConfig; /* Config for interrupt controller */ /* * Initialize the interrupt controller driver */ IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID); if (NULL == IntcConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(IntcInstancePtr, IntcConfig, IntcConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Connect the interrupt controller interrupt handler to the * hardware interrupt handling logic in the processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler) XScuGic_InterruptHandler, IntcInstancePtr); #endif /* * Connect a device driver handler that will be called when an * interrupt for the device occurs, the device driver handler * performs the specific interrupt processing for the device */ Status = XScuGic_Connect(IntcInstancePtr, UartIntrId, (Xil_ExceptionHandler) XUartPs_InterruptHandler, (void *) UartInstancePtr); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Enable the interrupt for the device */ XScuGic_Enable(IntcInstancePtr, UartIntrId); #ifndef TESTAPP_GEN /* * Enable interrupts */ Xil_ExceptionEnable(); #endif return XST_SUCCESS; }
/** * * This function sets up the interrupt system such that interrupts can occur * for the USB. This function is application specific since the actual * system may or may not have an interrupt controller. The USB could be * directly connected to a processor without an interrupt controller. The * user should modify this function to fit the application. * * @param InstancePtr contains a pointer to the instance of the USB * component, which is going to be connected to the interrupt * controller. * * @return * - XST_SUCCESS if successful. * - XST_FAILURE. if it fails. * * @note None * *******************************************************************************/ static int SetupInterruptSystem(XUsb * InstancePtr) { int Status; /* * Initialize the interrupt controller driver. */ Status = XIntc_Initialize(&InterruptController, INTC_DEVICE_ID); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Connect a device driver handler that will be called when an interrupt * for the USB device occurs. */ Status = XIntc_Connect(&InterruptController, USB_INTR, (XInterruptHandler) XUsb_IntrHandler, (void *) InstancePtr); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Start the interrupt controller such that interrupts are enabled for * all devices that cause interrupts, specific real mode so that * the USB can cause interrupts through the interrupt controller. */ Status = XIntc_Start(&InterruptController, XIN_REAL_MODE); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Enable the interrupt for the USB. */ XIntc_Enable(&InterruptController, USB_INTR); /* * Initialize the exception table */ Xil_ExceptionInit(); /* * Register the interrupt controller handler with the exception table */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XIntc_InterruptHandler, &InterruptController); /* * Enable non-critical exceptions */ Xil_ExceptionEnable(); return XST_SUCCESS; }
/***************************************************************************//** * @brief Main function. * * @return Returns 0. *******************************************************************************/ int main() { UINT32 StartCount; MajorRev = 1; MinorRev = 1; RcRev = 1; DriverEnable = TRUE; LastEnable = FALSE; Xil_ICacheEnable(); Xil_DCacheEnable(); HAL_PlatformInit(XPAR_AXI_IIC_0_BASEADDR, /* Perform any required platform init */ XPAR_SCUTIMER_DEVICE_ID, /* including hardware reset to HDMI devices */ XPAR_SCUGIC_SINGLE_DEVICE_ID, XPAR_SCUTIMER_INTR); Xil_ExceptionEnable(); /* Set the default values for 1080P 60Hz */ CLKGEN_SetRate(148500000, 200000000); InitHdmiVideoPcore(1920, 1080, 280, 45, 44, 5, 88, 4); InitHdmiAudioPcore(); APP_PrintRevisions(); /* Display S/W and H/W revisions */ ADIAPI_TransmitterInit(); /* Initialize ADI repeater software and h/w */ ADIAPI_TransmitterSetPowerMode(REP_POWER_UP); StartCount = HAL_GetCurrentMsCount(); while(1) { if (ATV_GetElapsedMs (StartCount, NULL) >= HDMI_CALL_INTERVAL_MS) { StartCount = HAL_GetCurrentMsCount(); if (APP_DriverEnabled()) { ADIAPI_TransmitterMain(); } } } Xil_DCacheDisable(); Xil_ICacheDisable(); return(0); }
/** * This function setups the interrupt system so interrupts can occur for the * IIC device. The function is application-specific since the actual system may * or may not have an interrupt controller. The IIC device could be directly * connected to a processor without an interrupt controller. The user should * modify this function to fit the application. * * @param IicInstPtr contains a pointer to the instance of the IIC device * which is going to be connected to the interrupt controller. * * @return XST_SUCCESS if successful else XST_FAILURE. * * @note None. * ******************************************************************************/ static int SetupInterruptSystem(XIIC_LIB *I2cLibPtr) { int Status; XIIC *I2cInstancePtr; INTC *IntcPtr; I2cInstancePtr = &I2cLibPtr->I2cInstance; IntcPtr = &I2cLibPtr->IntcInstance; XScuGic_Config *IntcConfig; /* * Initialize the interrupt controller driver so that it is ready to * use. */ IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID); if (NULL == IntcConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(IntcPtr, IntcConfig, IntcConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } XScuGic_SetPriorityTriggerType(IntcPtr, IIC_INTR_ID, 0xA0, 0x3); /* * Connect the interrupt handler that will be called when an * interrupt occurs for the device. */ Status = XScuGic_Connect(IntcPtr, IIC_INTR_ID, (Xil_InterruptHandler) XIicPs_MasterInterruptHandler, I2cInstancePtr); if (Status != XST_SUCCESS) { return Status; } /* * Enable the interrupt for the IIC device. */ XScuGic_Enable(IntcPtr, IIC_INTR_ID); /* * Initialize the exception table and register the interrupt * controller handler with the exception table */ Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler) INTC_HANDLER, IntcPtr); /* Enable non-critical exceptions */Xil_ExceptionEnable(); return XST_SUCCESS; }
/* * * This function setups the interrupt system so interrupts can occur for the * DMA. This function assumes INTC component exists in the hardware system. * * @param AxiDmaPtr is a pointer to the instance of the DMA engine * @param ReadIntrId is the read channel Interrupt ID. * @param WriteIntrId is the write channel Interrupt ID. * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @note None. * ******************************************************************************/ static int SetupIntrSystem(XAxiVdma *AxiVdmaPtr, u16 ReadIntrId, u16 WriteIntrId) { xil_printf("\r\nEnabling interrupts..."); int Status; XIntc *IntcInstancePtr = &Intc; /* Initialize the interrupt controller and connect the ISRs */ // Status = XIntc_Initialize(IntcInstancePtr, INTC_DEVICE_ID); // if (Status != XST_SUCCESS) { // // xil_printf( "Failed init intc\r\n"); // return XST_FAILURE; // } // Status = XIntc_Connect(IntcInstancePtr, ReadIntrId, // (XInterruptHandler)XAxiVdma_ReadIntrHandler, AxiVdmaPtr); // if (Status != XST_SUCCESS) { // // xil_printf( // "Failed read channel connect intc %d\r\n", Status); // return XST_FAILURE; // } Status = XIntc_Connect(IntcInstancePtr, WriteIntrId, (XInterruptHandler)XAxiVdma_WriteIntrHandler, AxiVdmaPtr); if (Status != XST_SUCCESS) { xil_printf( "Failed write channel connect intc %d\r\n", Status); return XST_FAILURE; } /* Start the interrupt controller */ Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE); if (Status != XST_SUCCESS) { xil_printf( "Failed to start intc\r\n"); return XST_FAILURE; } /* Enable interrupts from the hardware */ // XIntc_Enable(IntcInstancePtr, ReadIntrId); XIntc_Enable(IntcInstancePtr, WriteIntrId); Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XIntc_InterruptHandler, (void *)IntcInstancePtr); Xil_ExceptionEnable(); xil_printf("done"); return XST_SUCCESS; }
/** * * This function setups the interrupt system such that interrupts can occur * for the IIC. This function is application specific since the actual * system may or may not have an interrupt controller. The IIC could be * directly connected to a processor without an interrupt controller. The * user should modify this function to fit the application. * * @param IicPsPtr contains a pointer to the instance of the Iic * which is going to be connected to the interrupt controller. * * @return XST_SUCCESS if successful, otherwise XST_FAILURE. * * @note None. * *******************************************************************************/ static int SetupInterruptSystem(XIicPs *IicPsPtr) { int Status; XScuGic_Config *IntcConfig; /* Instance of the interrupt controller */ Xil_ExceptionInit(); /* * Initialize the interrupt controller driver so that it is ready to * use. */ IntcConfig = XScuGic_LookupConfig(INTC_DEVICE_ID); if (NULL == IntcConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(&InterruptController, IntcConfig, IntcConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Connect the interrupt controller interrupt handler to the hardware * interrupt handling logic in the processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler, &InterruptController); /* * Connect the device driver handler that will be called when an * interrupt for the device occurs, the handler defined above performs * the specific interrupt processing for the device. */ Status = XScuGic_Connect(&InterruptController, IIC_INT_VEC_ID, (Xil_InterruptHandler)XIicPs_MasterInterruptHandler, (void *)IicPsPtr); if (Status != XST_SUCCESS) { return Status; } /* * Enable the interrupt for the Iic device. */ XScuGic_Enable(&InterruptController, IIC_INT_VEC_ID); /* * Enable interrupts in the Processor. */ Xil_ExceptionEnable(); return XST_SUCCESS; }
/** * * This function connects the interrupt handler of the IO Module to the * processor. This function is separate to allow it to be customized for each * application. Each processor or RTOS may require unique processing to connect * the interrupt handler. * * @param None. * * @return None. * * @note None. * ****************************************************************************/ XStatus SetUpInterruptSystem(XIOModule *XIOModuleInstancePtr) { XStatus Status; /* * Connect a device driver handler that will be called when an interrupt * for the device occurs, the device driver handler performs the specific * interrupt processing for the device */ Status = XIOModule_Connect(XIOModuleInstancePtr, IOMODULE_DEVICE_ID, (XInterruptHandler) DeviceDriverHandler, (void *)0); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Start the IO Module such that interrupts are enabled for all devices * that cause interrupts. */ Status = XIOModule_Start(XIOModuleInstancePtr); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Enable interrupts for the device and then cause interrupts so the * handlers will be called. */ XIOModule_Enable(XIOModuleInstancePtr, IOMODULE_DEVICE_ID); /* * Initialize the exception table. */ Xil_ExceptionInit(); /* * Register the IO module interrupt handler with the exception table. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XIOModule_DeviceInterruptHandler, (void*) 0); /* * Enable exceptions. */ Xil_ExceptionEnable(); return XST_SUCCESS; }
/****************************************************************************** * @brief Enable External Interrupts * * @param None. * * @return None. ******************************************************************************/ void Ps7ExtIntrEnable(void) { /* Connect device driver handler to be called when interrupt occures */ XScuGic_Connect(&IntcInstance, XPS_FPGA11_INT_ID, (Xil_ExceptionHandler)Ps7ExtIntrHandler, (void *)0); XScuGic_Connect(&IntcInstance, XPS_FPGA12_INT_ID, (Xil_ExceptionHandler)Ps7ExtIntrHandler, (void *)0); /* Enable interrupts for the device */ XScuGic_Enable(&IntcInstance, XPS_FPGA11_INT_ID); XScuGic_Enable(&IntcInstance, XPS_FPGA12_INT_ID); /* Enable interrupts in the processor */ Xil_ExceptionEnable(); }
int InterruptSystemSetup(XScuGic *XScuGicInstancePtr) { // Register GIC interrupt handler Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler, XScuGicInstancePtr); Xil_ExceptionEnable(); return XST_SUCCESS; }
/** * This function sets up the interrupt system for the example. The processing * contained in this function assumes the hardware system was built with * and interrupt controller. * * @param None. * * @return A status indicating XST_SUCCESS or a value that is contained in * xstatus.h. * * @note None. * *****************************************************************************/ int zed_ali3_controller_demo_SetupInterruptSystem(zed_ali3_controller_demo_t *pDemo) { int Result; /* * Initialize the interrupt controller driver so that it is ready to * use. */ pDemo->pIntcConfig = XScuGic_LookupConfig(pDemo->uDeviceId_IRQ_Touch); if (NULL == pDemo->pIntcConfig) { return XST_FAILURE; } Result = XScuGic_CfgInitialize(&(pDemo->Intc), pDemo->pIntcConfig, pDemo->pIntcConfig->CpuBaseAddress); if (Result != XST_SUCCESS) { return XST_FAILURE; } XScuGic_SetPriorityTriggerType(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch, 0xA0, 0x3); /* * Connect the interrupt handler that will be called when an * interrupt occurs for the device. */ Result = XScuGic_Connect(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch, (Xil_ExceptionHandler)TouchIsr, pDemo); if (Result != XST_SUCCESS) { return Result; } /* * Enable the PS interrupts for the touch controller hardware device. */ XScuGic_Enable(&(pDemo->Intc), pDemo->uInterruptId_IRQ_Touch); /* * Initialize the exception table and register the interrupt * controller handler with the exception table */ Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler, &(pDemo->Intc)); /* Enable non-critical exceptions */ Xil_ExceptionEnable(); return XST_SUCCESS; }
/** * * This function is used by the TestAppGen generated application to setup * the interrupt controller. * * @param IntcInstancePtr is the reference to the Interrupt Controller * instance. * @param DeviceId is device ID of the Interrupt Controller Device, * typically XPAR_<INTC_instance>_DEVICE_ID value from * xparameters.h. * * @return XST_SUCCESS to indicate success, otherwise XST_FAILURE. * * @note None. * ******************************************************************************/ int IntcInterruptSetup(XIntc *IntcInstancePtr, u16 DeviceId) { int Status; /* * Initialize the interrupt controller driver so that it is * ready to use. */ Status = XIntc_Initialize(IntcInstancePtr, DeviceId); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Perform a self-test to ensure that the hardware was built correctly. */ Status = XIntc_SelfTest(IntcInstancePtr); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Initialize the exception table. */ Xil_ExceptionInit(); /* * Register the interrupt controller handler with the exception table. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XIntc_DeviceInterruptHandler, (void*) 0); /* * Enable exceptions. */ Xil_ExceptionEnable(); /* * Start the interrupt controller such that interrupts are enabled for * all devices that cause interrupts. */ Status = XIntc_Start(IntcInstancePtr, XIN_REAL_MODE); if (Status != XST_SUCCESS) { return XST_FAILURE; } return XST_SUCCESS; }
/** * * This function connects the interrupt handler of the interrupt controller to * the processor. This function is separate to allow it to be customized for * each application. Each processor or RTOS may require unique processing to * connect the interrupt handler. * * @param None. * * @return None. * * @note None. * ******************************************************************************/ void SetupInterruptSystem(void) { /* * Connect the interrupt controller interrupt handler to the hardware * interrupt handling logic in the ARM processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler) LowInterruptHandler, (void *)CPU_BASEADDR); /* * Enable interrupts in the ARM */ Xil_ExceptionEnable(); }
int InterruptSystemSetup(XScuGic *XScuGicInstancePtr) { // Enable interrupt XGpio_InterruptEnable(&SwitchInst, SWITCH_INT); XGpio_InterruptGlobalEnable(&SwitchInst); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler, XScuGicInstancePtr); Xil_ExceptionEnable(); return XST_SUCCESS; }
int SetUpInterruptSystem(XScuGic *XScuGicInstancePtr) { /* * Connect the interrupt controller interrupt handler to the hardware * interrupt handling logic in the ARM processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler) XScuGic_InterruptHandler, XScuGicInstancePtr); /* * Enable interrupts in the ARM */ Xil_ExceptionEnable(); return XST_SUCCESS; }
void SCREEN_Init(UINT32 resolution) { UINT32 StartCount; MajorRev = 1; MinorRev = 1; RcRev = 1; DriverEnable = TRUE; LastEnable = FALSE; Xil_ICacheEnable(); Xil_DCacheEnable(); #ifdef XPAR_AXI_IIC_0_BASEADDR HAL_PlatformInit(XPAR_AXI_IIC_0_BASEADDR, /* Perform any required platform init */ XPAR_SCUTIMER_DEVICE_ID, /* including hardware reset to HDMI devices */ XPAR_SCUGIC_SINGLE_DEVICE_ID, XPAR_SCUTIMER_INTR); #else HAL_PlatformInit(XPAR_AXI_IIC_MAIN_BASEADDR, /* Perform any required platform init */ XPAR_SCUTIMER_DEVICE_ID, /* including hardware reset to HDMI devices */ XPAR_SCUGIC_SINGLE_DEVICE_ID, XPAR_SCUTIMER_INTR); #endif Xil_ExceptionEnable(); SetVideoResolution( resolution); InitHdmiAudioPcore(); APP_PrintRevisions(); /* Display S/W and H/W revisions */ // DBG_MSG("To change the video resolution press:\r\n"); // DBG_MSG(" '0' - 640x480; '1' - 800x600; '2' - 1024x768; '3' - 1280x720 \r\n"); // DBG_MSG(" '4' - 1360x768; '5' - 1600x900; '6' - 1920x1080.\r\n"); ADIAPI_TransmitterInit(); /* Initialize ADI repeater software and h/w */ ADIAPI_TransmitterSetPowerMode(REP_POWER_UP); StartCount = HAL_GetCurrentMsCount(); }
int cortexa9_init(void) { Xil_ExceptionInit(); XScuGic_DeviceInitialize(0); /* * Connect the interrupt controller interrupt handler to the hardware * interrupt handling logic in the processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler)XScuGic_DeviceInterruptHandler, (void *)0); /* * Connect the device driver handler that will be called when an * interrupt for the device occurs, the handler defined above performs * the specific interrupt processing for the device. */ XScuGic_RegisterHandler(SCUGIC_CPU_BASEADDR, PROFILE_TIMER_INTR_ID, (Xil_ExceptionHandler)profile_intr_handler, (void *)0); /* * Enable the interrupt for scu timer. */ XScuGic_EnableIntr(SCUGIC_DIST_BASEADDR, PROFILE_TIMER_INTR_ID); /* * Enable interrupts in the Processor. */ Xil_ExceptionEnableMask(XIL_EXCEPTION_IRQ); /* * Initialize the timer with Timer Ticks */ scu_timer_init() ; Xil_ExceptionEnable(); return 0; }
/** * * This function is used by the TestAppGen generated application to setup * the interrupt controller. * * @param IntcInstancePtr is the reference to the Interrupt Controller * instance. * @param DeviceId is device ID of the Interrupt Controller Device, * typically XPAR_<INTC_instance>_DEVICE_ID value from * xparameters.h. * * @return XST_SUCCESS to indicate success, otherwise XST_FAILURE. * * @note None. * ******************************************************************************/ int ScuGicInterruptSetup(XScuGic *IntcInstancePtr, u16 DeviceId) { int Status; static XScuGic_Config *GicConfig; /* * Initialize the interrupt controller driver so that it is ready to * use. */ GicConfig = XScuGic_LookupConfig(DeviceId); if (NULL == GicConfig) { return XST_FAILURE; } Status = XScuGic_CfgInitialize(IntcInstancePtr, GicConfig, GicConfig->CpuBaseAddress); if (Status != XST_SUCCESS) { return XST_FAILURE; } /* * Initialize the exception table. */ Xil_ExceptionInit(); /* * Connect the interrupt controller interrupt handler to the hardware * interrupt handling logic in the processor. */ Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler, IntcInstancePtr); /* * Enable exceptions. */ Xil_ExceptionEnable(); return XST_SUCCESS; }