#endif\r
\r
/*\r
- * Setup the timer to generate the tick interrupts.\r
+ * Setup the timer to generate the tick interrupts. The implementation in this\r
+ * file is weak to allow application writers to change the timer used to\r
+ * generate the tick interrupt.\r
*/\r
-static void prvSetupTimerInterrupt( void );\r
+void vPortSetupTimerInterrupt( void );\r
\r
/*\r
* Exception handlers.\r
\r
/* Start the timer that generates the tick ISR. Interrupts are disabled\r
here already. */\r
- prvSetupTimerInterrupt();\r
+ vPortSetupTimerInterrupt();\r
\r
/* Initialise the critical nesting count ready for the first task. */\r
uxCriticalNesting = 0;\r
* Setup the systick timer to generate the tick interrupts at the required\r
* frequency.\r
*/\r
-void prvSetupTimerInterrupt( void )\r
+__attribute__(( weak )) void vPortSetupTimerInterrupt( void )\r
{\r
/* Calculate the constants required to configure the tick interrupt. */\r
#if( configUSE_TICKLESS_IDLE == 1 )\r
#endif /* configUSE_TICKLESS_IDLE */\r
\r
/*\r
- * Setup the timer to generate the tick interrupts.\r
+ * Setup the timer to generate the tick interrupts. The implementation in this\r
+ * file is weak to allow application writers to change the timer used to\r
+ * generate the tick interrupt.\r
*/\r
-static void prvSetupTimerInterrupt( void );\r
+void vPortSetupTimerInterrupt( void );\r
\r
/*\r
* Exception handlers.\r
\r
/* Start the timer that generates the tick ISR. Interrupts are disabled\r
here already. */\r
- prvSetupTimerInterrupt();\r
+ vPortSetupTimerInterrupt();\r
\r
/* Initialise the critical nesting count ready for the first task. */\r
uxCriticalNesting = 0;\r
* Setup the systick timer to generate the tick interrupts at the required\r
* frequency.\r
*/\r
-static void prvSetupTimerInterrupt( void )\r
+__weak void vPortSetupTimerInterrupt( void )\r
{\r
/* Calculate the constants required to configure the tick interrupt. */\r
#if( configUSE_TICKLESS_IDLE == 1 )\r
ulStoppedTimerCompensation = portMISSED_COUNTS_FACTOR;\r
}\r
#endif /* configUSE_TICKLESS_IDLE */\r
- \r
+\r
/* Stop and reset the SysTick. */\r
portNVIC_SYSTICK_CTRL_REG = 0UL;\r
portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL;\r
__DSB();\r
__ISB();\r
\r
- /* Disable the SysTick clock without reading the \r
+ /* Disable the SysTick clock without reading the\r
portNVIC_SYSTICK_CTRL_REG register to ensure the\r
- portNVIC_SYSTICK_COUNT_FLAG_BIT is not cleared if it is set. Again, \r
- the time the SysTick is stopped for is accounted for as best it can \r
- be, but using the tickless mode will inevitably result in some tiny \r
- drift of the time maintained by the kernel with respect to calendar \r
+ portNVIC_SYSTICK_COUNT_FLAG_BIT is not cleared if it is set. Again,\r
+ the time the SysTick is stopped for is accounted for as best it can\r
+ be, but using the tickless mode will inevitably result in some tiny\r
+ drift of the time maintained by the kernel with respect to calendar\r
time*/\r
portNVIC_SYSTICK_CTRL_REG = ( portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT );\r
\r
/* Constants used with memory barrier intrinsics. */\r
#define portSY_FULL_READ_WRITE ( 15 )\r
\r
+/* Legacy macro for backward compatibility only. This macro used to be used to\r
+replace the function that configures the clock used to generate the tick\r
+interrupt (prvSetupTimerInterrupt()), but now the function is declared weak so\r
+the application writer can override it by simply defining a function of the\r
+same name (vApplicationSetupTickInterrupt()). */\r
+#ifndef configOVERRIDE_DEFAULT_TICK_CONFIGURATION\r
+ #define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 0\r
+#endif\r
+\r
/* Each task maintains its own interrupt status in the critical nesting\r
variable. */\r
static UBaseType_t uxCriticalNesting = 0xaaaaaaaa;\r
#endif /* configUSE_TICKLESS_IDLE */\r
\r
/*\r
- * Setup the timer to generate the tick interrupts.\r
+ * Setup the timer to generate the tick interrupts. The implementation in this\r
+ * file is weak to allow application writers to change the timer used to\r
+ * generate the tick interrupt.\r
*/\r
-static void prvSetupTimerInterrupt( void );\r
+void vPortSetupTimerInterrupt( void );\r
\r
/*\r
* Exception handlers.\r
\r
/* Start the timer that generates the tick ISR. Interrupts are disabled\r
here already. */\r
- prvSetupTimerInterrupt();\r
+ vPortSetupTimerInterrupt();\r
\r
/* Initialise the critical nesting count ready for the first task. */\r
uxCriticalNesting = 0;\r
* Setup the systick timer to generate the tick interrupts at the required\r
* frequency.\r
*/\r
-void prvSetupTimerInterrupt( void )\r
-{\r
- /* Calculate the constants required to configure the tick interrupt. */\r
- #if( configUSE_TICKLESS_IDLE == 1 )\r
- ulTimerCountsForOneTick = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ );\r
- xMaximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER / ulTimerCountsForOneTick;\r
- ulStoppedTimerCompensation = portMISSED_COUNTS_FACTOR;\r
- #endif /* configUSE_TICKLESS_IDLE */\r
-\r
- /* Stop and reset the SysTick. */\r
- portNVIC_SYSTICK_CTRL_REG = 0UL;\r
- portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL;\r
-\r
- /* Configure SysTick to interrupt at the requested rate. */\r
- portNVIC_SYSTICK_LOAD_REG = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;\r
- portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;\r
-}\r
+#if( configOVERRIDE_DEFAULT_TICK_CONFIGURATION == 0 )\r
+\r
+ __weak void vPortSetupTimerInterrupt( void )\r
+ {\r
+ /* Calculate the constants required to configure the tick interrupt. */\r
+ #if( configUSE_TICKLESS_IDLE == 1 )\r
+ ulTimerCountsForOneTick = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ );\r
+ xMaximumPossibleSuppressedTicks = portMAX_24_BIT_NUMBER / ulTimerCountsForOneTick;\r
+ ulStoppedTimerCompensation = portMISSED_COUNTS_FACTOR;\r
+ #endif /* configUSE_TICKLESS_IDLE */\r
+\r
+ /* Stop and reset the SysTick. */\r
+ portNVIC_SYSTICK_CTRL_REG = 0UL;\r
+ portNVIC_SYSTICK_CURRENT_VALUE_REG = 0UL;\r
+\r
+ /* Configure SysTick to interrupt at the requested rate. */\r
+ portNVIC_SYSTICK_LOAD_REG = ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL;\r
+ portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT;\r
+ }\r
+\r
+#endif /* configOVERRIDE_DEFAULT_TICK_CONFIGURATION */\r
/*-----------------------------------------------------------*/\r
\r
#if( configUSE_TICKLESS_IDLE == 1 )\r
#define portNVIC_SYSTICK_CLK_BIT ( 0 )\r
#endif\r
\r
-/* The __weak attribute does not work as you might expect with the Keil tools\r
-so the configOVERRIDE_DEFAULT_TICK_CONFIGURATION constant must be set to 1 if\r
-the application writer wants to provide their own implementation of\r
-vPortSetupTimerInterrupt(). Ensure configOVERRIDE_DEFAULT_TICK_CONFIGURATION\r
-is defined. */\r
+/* Legacy macro for backward compatibility only. This macro used to be used to\r
+replace the function that configures the clock used to generate the tick\r
+interrupt (prvSetupTimerInterrupt()), but now the function is declared weak so\r
+the application writer can override it by simply defining a function of the\r
+same name (vApplicationSetupTickInterrupt()). */\r
#ifndef configOVERRIDE_DEFAULT_TICK_CONFIGURATION\r
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 0\r
#endif\r
__disable_irq();\r
__dsb( portSY_FULL_READ_WRITE );\r
__isb( portSY_FULL_READ_WRITE );\r
- \r
- /* Disable the SysTick clock without reading the \r
+\r
+ /* Disable the SysTick clock without reading the\r
portNVIC_SYSTICK_CTRL_REG register to ensure the\r
- portNVIC_SYSTICK_COUNT_FLAG_BIT is not cleared if it is set. Again, \r
- the time the SysTick is stopped for is accounted for as best it can \r
- be, but using the tickless mode will inevitably result in some tiny \r
- drift of the time maintained by the kernel with respect to calendar \r
+ portNVIC_SYSTICK_COUNT_FLAG_BIT is not cleared if it is set. Again,\r
+ the time the SysTick is stopped for is accounted for as best it can\r
+ be, but using the tickless mode will inevitably result in some tiny\r
+ drift of the time maintained by the kernel with respect to calendar\r
time*/\r
portNVIC_SYSTICK_CTRL_REG = ( portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT );\r
\r
#define portNVIC_SYSTICK_CLK_BIT ( 0 )\r
#endif\r
\r
-/* The __weak attribute does not work as you might expect with the Keil tools\r
-so the configOVERRIDE_DEFAULT_TICK_CONFIGURATION constant must be set to 1 if\r
-the application writer wants to provide their own implementation of\r
-vPortSetupTimerInterrupt(). Ensure configOVERRIDE_DEFAULT_TICK_CONFIGURATION\r
-is defined. */\r
+/* Legacy macro for backward compatibility only. This macro used to be used to\r
+replace the function that configures the clock used to generate the tick\r
+interrupt (prvSetupTimerInterrupt()), but now the function is declared weak so\r
+the application writer can override it by simply defining a function of the\r
+same name (vApplicationSetupTickInterrupt()). */\r
#ifndef configOVERRIDE_DEFAULT_TICK_CONFIGURATION\r
#define configOVERRIDE_DEFAULT_TICK_CONFIGURATION 0\r
#endif\r
*/\r
#if( configOVERRIDE_DEFAULT_TICK_CONFIGURATION == 0 )\r
\r
- void vPortSetupTimerInterrupt( void )\r
+ __weak void vPortSetupTimerInterrupt( void )\r
{\r
/* Calculate the constants required to configure the tick interrupt. */\r
#if( configUSE_TICKLESS_IDLE == 1 )\r