static int32_t prvInitialiseInterruptController( void ) { int32_t lStatus; lStatus = XIntc_Initialize( &xInterruptControllerInstance, configINTERRUPT_CONTROLLER_TO_USE ); if( lStatus == XST_SUCCESS ) { /* Initialise the exception table. */ Xil_ExceptionInit(); /* Service all pending interrupts each time the handler is entered. */ XIntc_SetIntrSvcOption( xInterruptControllerInstance.BaseAddress, XIN_SVC_ALL_ISRS_OPTION ); /* Install exception handlers if the MicroBlaze is configured to handle exceptions, and the application defined constant configINSTALL_EXCEPTION_HANDLERS is set to 1. */ #if ( MICROBLAZE_EXCEPTIONS_ENABLED == 1 ) && ( configINSTALL_EXCEPTION_HANDLERS == 1 ) { vPortExceptionsInstallHandlers(); } #endif /* MICROBLAZE_EXCEPTIONS_ENABLED */ /* Start the interrupt controller. Interrupts are enabled when the scheduler starts. */ lStatus = XIntc_Start( &xInterruptControllerInstance, XIN_REAL_MODE ); if( lStatus == XST_SUCCESS ) { lStatus = pdPASS; } else { lStatus = pdFAIL; } } configASSERT( lStatus == pdPASS ); return lStatus; }
//-------------------------------------------------------------------- // PowerPC Timer Initialization functions. // For PowerPC, DEC and opb_timer can be used for Profiling. This // is selected by the user in standalone BSP // //-------------------------------------------------------------------- int powerpc405_init(void) { Xil_ExceptionInit(); Xil_ExceptionDisableMask( XIL_EXCEPTION_NON_CRITICAL ) ; // Initialize the Timer. // 1. If PowerPC DEC Timer has to be used, initialize DEC timer. // 2. Else use opb_timer. It can be directly connected or thru intc to PowerPC #ifdef PPC_PIT_INTERRUPT ppc_dec_init(); #else #ifdef TIMER_CONNECT_INTC Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_NON_CRITICAL_INT, (Xil_ExceptionHandler)XIntc_DeviceInterruptHandler,(void *)0); XIntc_RegisterHandler( INTC_BASEADDR, PROFILE_TIMER_INTR_ID, (XInterruptHandler)profile_intr_handler,(void*)0); #else Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_NON_CRITICAL_INT, (Xil_ExceptionHandler)profile_intr_handler,(void *)0); Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_NON_CRITICAL_INT, (Xil_ExceptionHandler)profile_intr_handler,(void *)0); #endif // Initialize the timer with Timer Ticks opb_timer_init() ; #endif // Enable Interrupts in the System, if Profile Timer is the only Interrupt // in the System. #ifdef ENABLE_SYS_INTR #ifdef PPC_PIT_INTERRUPT XTime_DECEnableInterrupt() ; #elif TIMER_CONNECT_INTC XIntc_MasterEnable( INTC_BASEADDR ); XIntc_SetIntrSvcOption( INTC_BASEADDR, XIN_SVC_ALL_ISRS_OPTION); XIntc_EnableIntr( INTC_BASEADDR, PROFILE_TIMER_INTR_MASK ); #endif Xil_ExceptionEnableMask( XEXC_NON_CRITICAL ) ; #endif return 0; }
//-------------------------------------------------------------------- // Initialize the Profile Timer for MicroBlaze Target. // For MicroBlaze, opb_timer is used. The opb_timer can be directly // connected to MicroBlaze or connected through Interrupt Controller. // //-------------------------------------------------------------------- int microblaze_init(void) { // Register profile_intr_handler // 1. If timer is connected to Interrupt Controller, register the handler // to Interrupt Controllers vector table. // 2. If timer is directly connected to MicroBlaze, register the handler // as Interrupt handler Xil_ExceptionInit(); #ifdef TIMER_CONNECT_INTC XIntc_RegisterHandler( INTC_BASEADDR, PROFILE_TIMER_INTR_ID, (XInterruptHandler)profile_intr_handler,(void*)0); #else Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)profile_intr_handler, (void *)0) ; #endif // Initialize the timer with Timer Ticks opb_timer_init() ; // Enable Interrupts in the System, if Profile Timer is the only Interrupt // in the System. #ifdef ENABLE_SYS_INTR #ifdef TIMER_CONNECT_INTC XIntc_MasterEnable( INTC_BASEADDR ); XIntc_SetIntrSvcOption( INTC_BASEADDR, XIN_SVC_ALL_ISRS_OPTION); XIntc_EnableIntr( INTC_BASEADDR, PROFILE_TIMER_INTR_MASK ); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XIntc_DeviceInterruptHandler,(void *)0); #endif #endif Xil_ExceptionEnable(); return 0; }
//----------------------------------------------------------------------------------------------------// // @func - int_system_init //! @desc //! Initialize PPC405 interrupt handling system in the prescence of an interrupt controller. //! @param //! - none //! @return //! - nothing //! @note //! - none //----------------------------------------------------------------------------------------------------// void int_system_init (void) { XStatus status; status = XIntc_Initialize (&sys_intc, SYSINTC_DEVICE_ID); if (status != XST_SUCCESS) { DBG_PRINT ("XMK: init_int_system: XIntc_Initialize failed.\r\n"); return; } XIntc_SetIntrSvcOption(SYSINTC_BASEADDR, XIN_SVC_ALL_ISRS_OPTION); // IntC ISR should service all interrupts Xil_ExceptionRegisterHandler (XIL_EXCEPTION_ID_NON_CRITICAL_INT, // Now tie the INTC's interrupt handler to the PPC Non-Critical Interrupt Handler (Xil_ExceptionHandler)XIntc_DeviceInterruptHandler, (void*)SYSINTC_DEVICE_ID); status = XIntc_Start (&sys_intc, XIN_REAL_MODE); // Start the interrupt controller if (status != XST_SUCCESS) { DBG_PRINT ("XMK: init_int_system: XIntc_Start failed.\r\n"); return; } }