Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * The application must provide a function that configures a peripheral to
- * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT()
- * in FreeRTOSConfig.h to call the function. This file contains a function
- * that is suitable for use on the Zynq SoC.
- */
- void vConfigureTickInterrupt( void )
- {
- static XScuGic xInterruptController; /* Interrupt controller instance */
- BaseType_t xStatus;
- extern void FreeRTOS_Tick_Handler( void );
- XScuTimer_Config *pxTimerConfig;
- XScuGic_Config *pxGICConfig;
- const uint8_t ucRisingEdge = 3;
- /* This function is called with the IRQ interrupt disabled, and the IRQ
- interrupt should be left disabled. It is enabled automatically when the
- scheduler is started. */
- /* Ensure XScuGic_CfgInitialize() has been called. In this demo it has
- already been called from prvSetupHardware() in main(). */
- pxGICConfig = XScuGic_LookupConfig( XPAR_SCUGIC_SINGLE_DEVICE_ID );
- xStatus = XScuGic_CfgInitialize( &xInterruptController, pxGICConfig, pxGICConfig->CpuBaseAddress );
- configASSERT( xStatus == XST_SUCCESS );
- ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */
- /* The priority must be the lowest possible. */
- XScuGic_SetPriorityTriggerType( &xInterruptController, XPAR_SCUTIMER_INTR, portLOWEST_USABLE_INTERRUPT_PRIORITY << portPRIORITY_SHIFT, ucRisingEdge );
- /* Install the FreeRTOS tick handler. */
- xStatus = XScuGic_Connect( &xInterruptController, XPAR_SCUTIMER_INTR, (Xil_ExceptionHandler) FreeRTOS_Tick_Handler, ( void * ) &xTimer );
- configASSERT( xStatus == XST_SUCCESS );
- ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */
- /* Initialise the timer. */
- pxTimerConfig = XScuTimer_LookupConfig( XPAR_SCUTIMER_DEVICE_ID );
- xStatus = XScuTimer_CfgInitialize( &xTimer, pxTimerConfig, pxTimerConfig->BaseAddr );
- configASSERT( xStatus == XST_SUCCESS );
- ( void ) xStatus; /* Remove compiler warning if configASSERT() is not defined. */
- /* Enable Auto reload mode. */
- XScuTimer_EnableAutoReload( &xTimer );
- /* Load the timer counter register. */
- XScuTimer_LoadTimer( &xTimer, XSCUTIMER_CLOCK_HZ / configTICK_RATE_HZ );
- /* Start the timer counter and then wait for it to timeout a number of
- times. */
- XScuTimer_Start( &xTimer );
- /* Enable the interrupt for the xTimer in the interrupt controller. */
- XScuGic_Enable( &xInterruptController, XPAR_SCUTIMER_INTR );
- /* Enable the interrupt in the xTimer itself. */
- vClearTickInterrupt();
- XScuTimer_EnableInterrupt( &xTimer );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement