From ae554f7f123e5725f7c19eb991e19521f88c0176 Mon Sep 17 00:00:00 2001 From: rtel Date: Thu, 23 Jan 2014 14:51:53 +0000 Subject: [PATCH] Remove #error that attempted to catch stdint.h not being included. Split the previously overloaded trmCOMMAND_nnn definitions into individual definitions to enable better logging. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2175 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/include/FreeRTOS.h | 24 +++++++++++++++--------- FreeRTOS/Source/include/projdefs.h | 2 +- FreeRTOS/Source/include/timers.h | 26 ++++++++++++++++++-------- FreeRTOS/Source/timers.c | 16 ++++++++++++---- 4 files changed, 46 insertions(+), 22 deletions(-) diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h index a069658aa..43d7f7191 100644 --- a/FreeRTOS/Source/include/FreeRTOS.h +++ b/FreeRTOS/Source/include/FreeRTOS.h @@ -70,20 +70,26 @@ * Include the generic headers required for the FreeRTOS port being used. */ #include -#include + +/* + * If stdint.h cannot be located then: + * + If using GCC ensure the -nostdint options is *not* being used. + * + Ensure the project's include path includes the directory in which your + * compiler stores stdint.h. + * + Set any compiler options necessary for it to support C99, as technically + * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any + * other way). + * + The FreeRTOS download includes a simple stdint.h definition that can be + * used in cases where none is provided by the compiler. The files only + * contains the typedefs required to build FreeRTOS. Read the instructions + * in FreeRTOS/source/stdint.readme for more information. + */ +#include /* READ COMMENT ABOVE. */ #ifdef __cplusplus extern "C" { #endif -/* Check stdint.h was included. */ -#ifndef UINT32_MAX - /* Check if the FreeRTOS stdint subset has been included. */ - #ifndef FREERTOS_STDINT - #error Read the instructions in FreeRTOS/source/stdint.readme if stdint.h is not provided with your compiler or you are building with standard libraries excluded (for example, with -nostdint in GCC). - #endif /* FREERTOS_STDINT */ -#endif /* UINT32_MAX */ - /* Basic FreeRTOS definitions. */ #include "projdefs.h" diff --git a/FreeRTOS/Source/include/projdefs.h b/FreeRTOS/Source/include/projdefs.h index 93c53b876..f4058e3bf 100644 --- a/FreeRTOS/Source/include/projdefs.h +++ b/FreeRTOS/Source/include/projdefs.h @@ -66,7 +66,7 @@ #ifndef PROJDEFS_H #define PROJDEFS_H -/* +/* * Defines the prototype to which task functions must conform. Defined in this * file to ensure the type is known before portable.h is included. */ diff --git a/FreeRTOS/Source/include/timers.h b/FreeRTOS/Source/include/timers.h index 7c8a9cd7b..2b9698d36 100644 --- a/FreeRTOS/Source/include/timers.h +++ b/FreeRTOS/Source/include/timers.h @@ -86,12 +86,22 @@ extern "C" { /* IDs for commands that can be sent/received on the timer queue. These are to be used solely through the macros that make up the public software timer API, -as defined below. */ +as defined below. The commands that are sent from interrupts must use the +highest numbers as tmrFIRST_FROM_ISR_COMMAND is used to determine if the task +or interrupt version of the queue send function should be used. */ #define tmrCOMMAND_EXECUTE_CALLBACK ( ( BaseType_t ) -1 ) #define tmrCOMMAND_START ( ( BaseType_t ) 0 ) -#define tmrCOMMAND_STOP ( ( BaseType_t ) 1 ) -#define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 2 ) -#define tmrCOMMAND_DELETE ( ( BaseType_t ) 3 ) +#define tmrCOMMAND_START_DONT_TRACE ( ( BaseType_t ) 1 ) +#define tmrCOMMAND_RESET ( ( BaseType_t ) 2 ) +#define tmrCOMMAND_STOP ( ( BaseType_t ) 3 ) +#define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 4 ) +#define tmrCOMMAND_DELETE ( ( BaseType_t ) 5 ) + +#define tmrFIRST_FROM_ISR_COMMAND ( ( BaseType_t ) 6 ) +#define tmrCOMMAND_START_FROM_ISR ( ( BaseType_t ) 7 ) +#define tmrCOMMAND_RESET_FROM_ISR ( ( BaseType_t ) 8 ) +#define tmrCOMMAND_STOP_FROM_ISR ( ( BaseType_t ) 9 ) + /** * Type by which software timers are referenced. For example, a call to @@ -647,7 +657,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); * } * @endverbatim */ -#define xTimerReset( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) ) +#define xTimerReset( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) ) /** * BaseType_t xTimerStartFromISR( TimerHandle_t xTimer, @@ -733,7 +743,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); * } * @endverbatim */ -#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U ) +#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U ) /** * BaseType_t xTimerStopFromISR( TimerHandle_t xTimer, @@ -796,7 +806,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); * } * @endverbatim */ -#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0, ( pxHigherPriorityTaskWoken ), 0U ) +#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP_FROM_ISR, 0, ( pxHigherPriorityTaskWoken ), 0U ) /** * BaseType_t xTimerChangePeriodFromISR( TimerHandle_t xTimer, @@ -955,7 +965,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void ); * } * @endverbatim */ -#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U ) +#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U ) /** diff --git a/FreeRTOS/Source/timers.c b/FreeRTOS/Source/timers.c index fe0591a10..26f537d72 100644 --- a/FreeRTOS/Source/timers.c +++ b/FreeRTOS/Source/timers.c @@ -105,6 +105,9 @@ typedef struct tmrTimerControl UBaseType_t uxAutoReload; /*<< Set to pdTRUE if the timer should be automatically restarted once expired. Set to pdFALSE if the timer is, in effect, a one-shot timer. */ void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */ TimerCallbackFunction_t pxCallbackFunction; /*<< The function that will be called when the timer expires. */ + #if( configUSE_TRACE_FACILITY == 1 ) + UBaseType_t uxTimerNumber; /*<< An ID assigned by trace tools such as FreeRTOS+Trace */ + #endif } Timer_t; /* The definition of messages that can be sent and received on the timer queue. @@ -316,7 +319,7 @@ DaemonTaskMessage_t xMessage; xMessage.u.xTimerParameters.xMessageValue = xOptionalValue; xMessage.u.xTimerParameters.pxTimer = ( Timer_t * ) xTimer; - if( pxHigherPriorityTaskWoken == NULL ) + if( xCommandID < tmrFIRST_FROM_ISR_COMMAND ) { if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING ) { @@ -377,7 +380,7 @@ Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTi { /* The timer expired before it was added to the active timer list. Reload it now. */ - xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY ); + xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xNextExpireTime, NULL, tmrNO_DELAY ); configASSERT( xResult ); ( void ) xResult; } @@ -621,6 +624,10 @@ TickType_t xTimeNow; switch( xMessage.xMessageID ) { case tmrCOMMAND_START : + case tmrCOMMAND_START_FROM_ISR : + case tmrCOMMAND_RESET : + case tmrCOMMAND_RESET_FROM_ISR : + case tmrCOMMAND_START_DONT_TRACE : /* Start or restart a timer. */ if( prvInsertTimerInActiveList( pxTimer, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, xTimeNow, xMessage.u.xTimerParameters.xMessageValue ) == pdTRUE ) { @@ -631,7 +638,7 @@ TickType_t xTimeNow; if( pxTimer->uxAutoReload == ( UBaseType_t ) pdTRUE ) { - xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY ); + xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY ); configASSERT( xResult ); ( void ) xResult; } @@ -647,6 +654,7 @@ TickType_t xTimeNow; break; case tmrCOMMAND_STOP : + case tmrCOMMAND_STOP_FROM_ISR : /* The timer has already been removed from the active list. There is nothing to do here. */ break; @@ -721,7 +729,7 @@ BaseType_t xResult; } else { - xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY ); + xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xNextExpireTime, NULL, tmrNO_DELAY ); configASSERT( xResult ); ( void ) xResult; } -- 2.39.2