int ppc_dec_init( void ) { // 1. Register Profile_intr_handler as Interrupt handler // 2. Set DEC Timer Interrupt and Enable it. Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_DEC_INT, (Xil_ExceptionHandler)profile_intr_handler,(void *)0); XTime_DECSetInterval( timer_clk_ticks ) ; XTime_DECEnableAutoReload() ; return 0; }
/* * Hardware initialisation to generate the RTOS tick. */ static void prvSetupTimerInterrupt( void ) { const uint32_t ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL ); XTime_DECClearInterrupt(); XTime_FITClearInterrupt(); XTime_WDTClearInterrupt(); XTime_WDTDisableInterrupt(); XTime_FITDisableInterrupt(); XExc_RegisterHandler( XEXC_ID_DEC_INT, ( XExceptionHandler ) vPortTickISR, ( void * ) 0 ); XTime_DECEnableAutoReload(); XTime_DECSetInterval( ulInterval ); XTime_DECEnableInterrupt(); }
void platform_setup_timer() { #ifdef XPAR_CPU_PPC440_CORE_CLOCK_FREQ_HZ XExc_RegisterHandler(XEXC_ID_DEC_INT, (XExceptionHandler)xadapter_timer_handler, NULL); /* Set DEC to interrupt every 250 mseconds */ XTime_DECSetInterval(PIT_INTERVAL); XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL); XTime_DECEnableAutoReload(); #else XExc_RegisterHandler(XEXC_ID_PIT_INT, (XExceptionHandler)xadapter_timer_handler, NULL); /* Set PIT to interrupt every 250 mseconds */ XTime_PITSetInterval(PIT_INTERVAL); XTime_TSRClearStatusBits(XREG_TSR_CLEAR_ALL); XTime_PITEnableAutoReload(); XTime_PITEnableInterrupt(); #endif }