ThirdParty/bsp/freertos10_xilinx/src/Source/portable/GCC/MicroBlazeV9/portmicroblaze.c
void vApplicationSetupTimerInterrupt( void )
		{
		portBASE_TYPE xStatus;
		const unsigned char ucTickTimerCounterNumber = ( unsigned char ) 0U;
		const unsigned char ucRunTimeStatsCounterNumber = ( unsigned char ) 1U;
		const unsigned long ulCounterValue = ( ( XPAR_TMRCTR_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL );
		extern void vPortTickISR( void *pvUnused );

			/* Initialise the timer/counter. */
			xStatus = XTmrCtr_Initialize( &xTickTimerInstance, XPAR_TMRCTR_0_DEVICE_ID );

			if( xStatus == XST_SUCCESS )
			{
				/* Install the tick interrupt handler as the timer ISR.
				*NOTE* The xPortInstallInterruptHandler() API function must be used for
				this purpose. */
				xStatus = xPortInstallInterruptHandler( XPAR_INTC_0_TMRCTR_0_VEC_ID, vPortTickISR, NULL );
			}

			if( xStatus == pdPASS )
			{
				#if XPAR_XINTC_HAS_ILR == 1
					xil_printf("WARNING: Nested interrupts are enabled for AXI INTC in HW design. FreeRTOS Microblaze port \
								does not support nested interrupts, enabling nested interrupts in HW design might end \
								up in incorrect behavior, update HW design to disable nested interrupts\n");
				#endif
				/* Enable the timer interrupt in the interrupt controller.
				*NOTE* The vPortEnableInterrupt() API function must be used for this
				purpose. */
				vPortEnableInterrupt( XPAR_INTC_0_TMRCTR_0_VEC_ID );

				/* Configure the timer interrupt handler.  This installs the handler
				directly, rather than through the Xilinx driver.  This is done for
				efficiency. */
				XTmrCtr_SetHandler( &xTickTimerInstance, ( void * ) vPortTickISR, NULL );

				/* Set the correct period for the timer. */
				XTmrCtr_SetResetValue( &xTickTimerInstance, ucTickTimerCounterNumber, ulCounterValue );

				/* Enable the interrupts.  Auto-reload mode is used to generate a
				periodic tick.  Note that interrupts are disabled when this function is
				called, so interrupts will not start to be processed until the first
				task has started to run. */
				XTmrCtr_SetOptions( &xTickTimerInstance, ucTickTimerCounterNumber, ( XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION | XTC_DOWN_COUNT_OPTION ) );

				/* Start the timer. */
				XTmrCtr_Start( &xTickTimerInstance, ucTickTimerCounterNumber );




				/* The second timer is used as the time base for the run time stats.
				Auto-reload mode is used to ensure the timer does not stop. */
				XTmrCtr_SetOptions( &xTickTimerInstance, ucRunTimeStatsCounterNumber, XTC_AUTO_RELOAD_OPTION );

				/* Start the timer. */
				XTmrCtr_Start( &xTickTimerInstance, ucRunTimeStatsCounterNumber );
			}

			/* Sanity check that the function executed as expected. */
			configASSERT( ( xStatus == pdPASS ) );
		}
/* This is a default implementation of what is otherwise an application defined
		callback function used to install the tick interrupt handler.  It is provided as
		an application callback because the kernel will run on lots of different
		MicroBlaze and FPGA configurations - not all of which will have the same timer
		peripherals defined or available.  vApplicationSetupTimerInterrupt() is declared
		as a weak symbol, allowing the application writer to provide their own
		implementation, if this default implementation is not suitable. */
This is a default implementation of what is otherwise an application defined
callback function used to install the tick interrupt handler.  It is provided as
an application callback because the kernel will run on lots of different
MicroBlaze and FPGA configurations - not all of which will have the same timer
peripherals defined or available.  vApplicationSetupTimerInterrupt() is declared
as a weak symbol, allowing the application writer to provide their own
implementation, if this default implementation is not suitable.
This is a default implementation of what is otherwise an application defined callback function used to install the tick interrupt handler . It is provided as an application callback because the kernel will run on lots of different MicroBlaze and FPGA configurations - not all of which will have the same timer peripherals defined or available . vApplicationSetupTimerInterrupt () is declared as a weak symbol allowing the application writer to provide their own implementation if this default implementation is not suitable .
void vApplicationSetupTimerInterrupt( void )
		{
		portBASE_TYPE xStatus;
		const unsigned char ucTickTimerCounterNumber = ( unsigned char ) 0U;
		const unsigned char ucRunTimeStatsCounterNumber = ( unsigned char ) 1U;
		const unsigned long ulCounterValue = ( ( XPAR_TMRCTR_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL );
		extern void vPortTickISR( void *pvUnused );
			xStatus = XTmrCtr_Initialize( &xTickTimerInstance, XPAR_TMRCTR_0_DEVICE_ID );
			if( xStatus == XST_SUCCESS )
			{
				xStatus = xPortInstallInterruptHandler( XPAR_INTC_0_TMRCTR_0_VEC_ID, vPortTickISR, NULL );
			}
			if( xStatus == pdPASS )
			{
				#if XPAR_XINTC_HAS_ILR == 1
					xil_printf("WARNING: Nested interrupts are enabled for AXI INTC in HW design. FreeRTOS Microblaze port \
								does not support nested interrupts, enabling nested interrupts in HW design might end \
								up in incorrect behavior, update HW design to disable nested interrupts\n");
				#endif
				vPortEnableInterrupt( XPAR_INTC_0_TMRCTR_0_VEC_ID );
				XTmrCtr_SetHandler( &xTickTimerInstance, ( void * ) vPortTickISR, NULL );
				XTmrCtr_SetResetValue( &xTickTimerInstance, ucTickTimerCounterNumber, ulCounterValue );
				XTmrCtr_SetOptions( &xTickTimerInstance, ucTickTimerCounterNumber, ( XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION | XTC_DOWN_COUNT_OPTION ) );
				XTmrCtr_Start( &xTickTimerInstance, ucTickTimerCounterNumber );
				XTmrCtr_SetOptions( &xTickTimerInstance, ucRunTimeStatsCounterNumber, XTC_AUTO_RELOAD_OPTION );
				XTmrCtr_Start( &xTickTimerInstance, ucRunTimeStatsCounterNumber );
			}
			configASSERT( ( xStatus == pdPASS ) );
		}
void vApplicationSetupTimerInterrupt ( void ) { portBASE_TYPE xStatus ; const unsigned char ucTickTimerCounterNumber = ( unsigned char ) 0U ; const unsigned char ucRunTimeStatsCounterNumber = ( unsigned char ) 1U ; const unsigned long ulCounterValue = ( ( XPAR_TMRCTR_0_CLOCK_FREQ_HZ / configTICK_RATE_HZ ) - 1UL ) ; extern void vPortTickISR ( void * pvUnused ) ; xStatus = XTmrCtr_Initialize ( & xTickTimerInstance , XPAR_TMRCTR_0_DEVICE_ID ) ; if ( xStatus == XST_SUCCESS ) { xStatus = xPortInstallInterruptHandler ( XPAR_INTC_0_TMRCTR_0_VEC_ID , vPortTickISR , NULL ) ; } if ( xStatus == pdPASS ) { #if XPAR_XINTC_HAS_ILR == 1 xil_printf ( " \
 \
 \n " ) ; #endif vPortEnableInterrupt ( XPAR_INTC_0_TMRCTR_0_VEC_ID ) ; XTmrCtr_SetHandler ( & xTickTimerInstance , ( void * ) vPortTickISR , NULL ) ; XTmrCtr_SetResetValue ( & xTickTimerInstance , ucTickTimerCounterNumber , ulCounterValue ) ; XTmrCtr_SetOptions ( & xTickTimerInstance , ucTickTimerCounterNumber , ( XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION | XTC_DOWN_COUNT_OPTION ) ) ; XTmrCtr_Start ( & xTickTimerInstance , ucTickTimerCounterNumber ) ; XTmrCtr_SetOptions ( & xTickTimerInstance , ucRunTimeStatsCounterNumber , XTC_AUTO_RELOAD_OPTION ) ; XTmrCtr_Start ( & xTickTimerInstance , ucRunTimeStatsCounterNumber ) ; } configASSERT ( ( xStatus == pdPASS ) ) ; }
This is a default implementation of what is otherwise an application defined
callback function used to install the tick interrupt handler.
This is a default implementation of what is otherwise an application defined callback function used to install the tick interrupt handler .
/* Initialise the timer/counter. */ /* Install the tick interrupt handler as the timer ISR.
				*NOTE* The xPortInstallInterruptHandler() API function must be used for
				this purpose. */ /* Enable the timer interrupt in the interrupt controller.
				*NOTE* The vPortEnableInterrupt() API function must be used for this
				purpose. */ /* Configure the timer interrupt handler.  This installs the handler
				directly, rather than through the Xilinx driver.  This is done for
				efficiency. */ /* Set the correct period for the timer. */ /* Enable the interrupts.  Auto-reload mode is used to generate a
				periodic tick.  Note that interrupts are disabled when this function is
				called, so interrupts will not start to be processed until the first
				task has started to run. */ /* Start the timer. */ /* The second timer is used as the time base for the run time stats.
				Auto-reload mode is used to ensure the timer does not stop. */ /* Start the timer. */ /* Sanity check that the function executed as expected. */