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.
This commit is contained in:
Richard Barry 2014-01-23 14:51:53 +00:00
parent d0323e67ae
commit 1e26b1875f
4 changed files with 46 additions and 22 deletions

View file

@ -70,20 +70,26 @@
* Include the generic headers required for the FreeRTOS port being used. * Include the generic headers required for the FreeRTOS port being used.
*/ */
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
/*
* 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 <stdint.h> /* READ COMMENT ABOVE. */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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. */ /* Basic FreeRTOS definitions. */
#include "projdefs.h" #include "projdefs.h"

View file

@ -86,12 +86,22 @@ extern "C" {
/* IDs for commands that can be sent/received on the timer queue. These are to /* 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, 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_EXECUTE_CALLBACK ( ( BaseType_t ) -1 )
#define tmrCOMMAND_START ( ( BaseType_t ) 0 ) #define tmrCOMMAND_START ( ( BaseType_t ) 0 )
#define tmrCOMMAND_STOP ( ( BaseType_t ) 1 ) #define tmrCOMMAND_START_DONT_TRACE ( ( BaseType_t ) 1 )
#define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 2 ) #define tmrCOMMAND_RESET ( ( BaseType_t ) 2 )
#define tmrCOMMAND_DELETE ( ( BaseType_t ) 3 ) #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 * Type by which software timers are referenced. For example, a call to
@ -647,7 +657,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
* } * }
* @endverbatim * @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, * BaseType_t xTimerStartFromISR( TimerHandle_t xTimer,
@ -733,7 +743,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
* } * }
* @endverbatim * @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, * BaseType_t xTimerStopFromISR( TimerHandle_t xTimer,
@ -796,7 +806,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
* } * }
* @endverbatim * @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, * BaseType_t xTimerChangePeriodFromISR( TimerHandle_t xTimer,
@ -955,7 +965,7 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void );
* } * }
* @endverbatim * @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 )
/** /**

View file

@ -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. */ 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. */ 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. */ 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; } Timer_t;
/* The definition of messages that can be sent and received on the timer queue. /* 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.xMessageValue = xOptionalValue;
xMessage.u.xTimerParameters.pxTimer = ( Timer_t * ) xTimer; xMessage.u.xTimerParameters.pxTimer = ( Timer_t * ) xTimer;
if( pxHigherPriorityTaskWoken == NULL ) if( xCommandID < tmrFIRST_FROM_ISR_COMMAND )
{ {
if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING ) 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 /* The timer expired before it was added to the active timer
list. Reload it now. */ 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 ); configASSERT( xResult );
( void ) xResult; ( void ) xResult;
} }
@ -621,6 +624,10 @@ TickType_t xTimeNow;
switch( xMessage.xMessageID ) switch( xMessage.xMessageID )
{ {
case tmrCOMMAND_START : 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. */ /* Start or restart a timer. */
if( prvInsertTimerInActiveList( pxTimer, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, xTimeNow, xMessage.u.xTimerParameters.xMessageValue ) == pdTRUE ) 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 ) 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 ); configASSERT( xResult );
( void ) xResult; ( void ) xResult;
} }
@ -647,6 +654,7 @@ TickType_t xTimeNow;
break; break;
case tmrCOMMAND_STOP : case tmrCOMMAND_STOP :
case tmrCOMMAND_STOP_FROM_ISR :
/* The timer has already been removed from the active list. /* The timer has already been removed from the active list.
There is nothing to do here. */ There is nothing to do here. */
break; break;
@ -721,7 +729,7 @@ BaseType_t xResult;
} }
else else
{ {
xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY ); xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xNextExpireTime, NULL, tmrNO_DELAY );
configASSERT( xResult ); configASSERT( xResult );
( void ) xResult; ( void ) xResult;
} }