*/\r
void AST_ALARM_Handler(void);\r
\r
+/* \r
+ * Functions that disable and enable the AST respectively, not returning until\r
+ * the operation is known to have taken effect.\r
+ */\r
+static void prvDisableAST( void );\r
+static void prvEnableAST( void );\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* Calculate how many clock increments make up a single tick period. */\r
following variable offsets the AST counter alarm value by the number of AST\r
counts that would typically be missed while the counter was stopped to compensate\r
for the lost time. _RB_ Value needs calculating correctly. */\r
-static uint32_t ulStoppedTimerCompensation = 10 / ( configCPU_CLOCK_HZ / configSYSTICK_CLOCK_HZ );\r
+static uint32_t ulStoppedTimerCompensation = 2 / ( configCPU_CLOCK_HZ / configSYSTICK_CLOCK_HZ );\r
\r
/*-----------------------------------------------------------*/\r
\r
/*-----------------------------------------------------------*/\r
\r
/* Override the default definition of vPortSetupTimerInterrupt() that is weakly\r
-defined in the FreeRTOS Cortex-M3 port layer layer with a version that\r
-configures the asynchronous timer (AST) to generate the tick interrupt. */\r
+defined in the FreeRTOS Cortex-M3 port layer with a version that configures the\r
+asynchronous timer (AST) to generate the tick interrupt. */\r
void vPortSetupTimerInterrupt( void )\r
{\r
struct ast_config ast_conf;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void prvDisableAST( void )\r
+static void prvDisableAST( void )\r
{\r
while( ast_is_busy( AST ) )\r
{\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void prvEnableAST( void )\r
+static void prvEnableAST( void )\r
{\r
while( ast_is_busy( AST ) )\r
{\r
/*-----------------------------------------------------------*/\r
\r
/* Override the default definition of vPortSuppressTicksAndSleep() that is weakly\r
-defined in the FreeRTOS Cortex-M3 port layer layer with a version that manages\r
-the asynchronous timer (AST), as the tick is generated from the low power AST\r
-and not the SysTick as would normally be the case on a Cortex-M. */\r
+defined in the FreeRTOS Cortex-M3 port layet with a version that manages the \r
+asynchronous timer (AST), as the tick is generated from the low power AST and \r
+not the SysTick as would normally be the case on a Cortex-M. */\r
void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime )\r
{\r
uint32_t ulAlarmValue, ulCompleteTickPeriods;\r
}\r
\r
/* Calculate the reload value required to wait xExpectedIdleTime tick\r
- periods. -1 is used because this code will execute part way through one of\r
- the tick periods, and the fraction of a tick period is accounted for\r
- later. */\r
- ulAlarmValue = ( ulAlarmValueForOneTick * ( xExpectedIdleTime - 1UL ) );\r
+ periods. */\r
+ ulAlarmValue = ulAlarmValueForOneTick * xExpectedIdleTime;\r
if( ulAlarmValue > ulStoppedTimerCompensation )\r
{\r
/* Compensate for the fact that the AST is going to be stopped\r