From 2da8f94490e882f9f10279f1daffcb15fd4c58eb Mon Sep 17 00:00:00 2001 From: rtel Date: Sun, 8 Dec 2013 06:32:38 +0000 Subject: [PATCH] Minor change to SAM4L_low_power_tick_management.c to ensure the alarm value cannot be set to zero. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2120 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../FreeRTOS_Demo.cproj | 12 ++++++------ .../src/SAM4L_low_power_tick_management.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/FreeRTOS_Demo.cproj b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/FreeRTOS_Demo.cproj index afaf06514..44f28a52d 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/FreeRTOS_Demo.cproj +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/FreeRTOS_Demo.cproj @@ -208,7 +208,7 @@ -fdata-sections True True - -std=gnu99 -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ + -std=gnu99 -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ arm_cortexM4l_math @@ -223,7 +223,7 @@ True -T../src/asf/sam/utils/linker_scripts/sam4l/sam4l4/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb - -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ + -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ ../src/asf/sam/utils/preprocessor @@ -252,7 +252,7 @@ %24(ToolchainDir)\..\..\CMSIS_Atmel\Device\ATMEL\sam4l\include - -DARM_MATH_CM4=true -DBOARD=SAM4L_EK -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ + -DARM_MATH_CM4=true -DBOARD=SAM4L_EK -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ ../src/asf/sam/utils/preprocessor @@ -332,7 +332,7 @@ True Maximum (-g3) True - -std=gnu99 -Wmissing-field-initializers -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ + -std=gnu99 -Wmissing-field-initializers -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ libm @@ -346,7 +346,7 @@ True -T../src/asf/sam/utils/linker_scripts/sam4l/sam4l4/gcc/flash.ld -Wl,--cref -Wl,--entry=Reset_Handler -mthumb - -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ + -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ ../src/asf/sam/utils/preprocessor @@ -376,7 +376,7 @@ Default (-g) - -DARM_MATH_CM4=true -DBOARD=SAM4L_EK -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ + -DARM_MATH_CM4=true -DBOARD=SAM4L_EK -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ -D__ATSAM4LC4C__ ../src/asf/sam/utils/preprocessor diff --git a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/SAM4L_low_power_tick_management.c b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/SAM4L_low_power_tick_management.c index 694b73d2b..0f76945a4 100644 --- a/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/SAM4L_low_power_tick_management.c +++ b/FreeRTOS/Demo/CORTEX_M4_ATSAM4L_Atmel_Studio/src/SAM4L_low_power_tick_management.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -248,7 +248,7 @@ static void prvEnableAST( void ) /*-----------------------------------------------------------*/ /* Override the default definition of vPortSuppressTicksAndSleep() that is weakly -defined in the FreeRTOS Cortex-M3 port layet with a version that manages the +defined in the FreeRTOS Cortex-M3 port layer with a version that manages the asynchronous timer (AST), as the tick is generated from the low power AST and not the SysTick as would normally be the case on a Cortex-M. */ void vPortSuppressTicksAndSleep( portTickType xExpectedIdleTime ) @@ -372,6 +372,12 @@ enum sleepmgr_mode xSleepMode; /* The alarm value is set to whatever fraction of a single tick period remains. */ ulAlarmValue = ast_read_counter_value( AST ) - ( ulCompleteTickPeriods * ulAlarmValueForOneTick ); + if( ulAlarmValue == 0 ) + { + /* There is no fraction remaining. */ + ulAlarmValue = ulAlarmValueForOneTick; + ulCompleteTickPeriods++; + } ast_write_alarm0_value( AST, ulAlarmValue ); } -- 2.39.5