* Include the generic headers required for the FreeRTOS port being used.\r
*/\r
#include <stddef.h>\r
-#include <stdint.h>\r
+\r
+/*\r
+ * If stdint.h cannot be located then:\r
+ * + If using GCC ensure the -nostdint options is *not* being used.\r
+ * + Ensure the project's include path includes the directory in which your\r
+ * compiler stores stdint.h.\r
+ * + Set any compiler options necessary for it to support C99, as technically\r
+ * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any\r
+ * other way).\r
+ * + The FreeRTOS download includes a simple stdint.h definition that can be\r
+ * used in cases where none is provided by the compiler. The files only\r
+ * contains the typedefs required to build FreeRTOS. Read the instructions\r
+ * in FreeRTOS/source/stdint.readme for more information.\r
+ */\r
+#include <stdint.h> /* READ COMMENT ABOVE. */\r
\r
#ifdef __cplusplus\r
extern "C" {\r
#endif\r
\r
-/* Check stdint.h was included. */\r
-#ifndef UINT32_MAX\r
- /* Check if the FreeRTOS stdint subset has been included. */\r
- #ifndef FREERTOS_STDINT\r
- #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).\r
- #endif /* FREERTOS_STDINT */\r
-#endif /* UINT32_MAX */\r
-\r
/* Basic FreeRTOS definitions. */\r
#include "projdefs.h"\r
\r
#ifndef PROJDEFS_H\r
#define PROJDEFS_H\r
\r
-/* \r
+/*\r
* Defines the prototype to which task functions must conform. Defined in this\r
* file to ensure the type is known before portable.h is included.\r
*/\r
\r
/* IDs for commands that can be sent/received on the timer queue. These are to\r
be used solely through the macros that make up the public software timer API,\r
-as defined below. */\r
+as defined below. The commands that are sent from interrupts must use the\r
+highest numbers as tmrFIRST_FROM_ISR_COMMAND is used to determine if the task\r
+or interrupt version of the queue send function should be used. */\r
#define tmrCOMMAND_EXECUTE_CALLBACK ( ( BaseType_t ) -1 )\r
#define tmrCOMMAND_START ( ( BaseType_t ) 0 )\r
-#define tmrCOMMAND_STOP ( ( BaseType_t ) 1 )\r
-#define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 2 )\r
-#define tmrCOMMAND_DELETE ( ( BaseType_t ) 3 )\r
+#define tmrCOMMAND_START_DONT_TRACE ( ( BaseType_t ) 1 )\r
+#define tmrCOMMAND_RESET ( ( BaseType_t ) 2 )\r
+#define tmrCOMMAND_STOP ( ( BaseType_t ) 3 )\r
+#define tmrCOMMAND_CHANGE_PERIOD ( ( BaseType_t ) 4 )\r
+#define tmrCOMMAND_DELETE ( ( BaseType_t ) 5 )\r
+\r
+#define tmrFIRST_FROM_ISR_COMMAND ( ( BaseType_t ) 6 )\r
+#define tmrCOMMAND_START_FROM_ISR ( ( BaseType_t ) 7 )\r
+#define tmrCOMMAND_RESET_FROM_ISR ( ( BaseType_t ) 8 )\r
+#define tmrCOMMAND_STOP_FROM_ISR ( ( BaseType_t ) 9 )\r
+\r
\r
/**\r
* Type by which software timers are referenced. For example, a call to\r
* }\r
* @endverbatim\r
*/\r
-#define xTimerReset( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) )\r
+#define xTimerReset( xTimer, xBlockTime ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET, ( xTaskGetTickCount() ), NULL, ( xBlockTime ) )\r
\r
/**\r
* BaseType_t xTimerStartFromISR( TimerHandle_t xTimer,\r
* }\r
* @endverbatim\r
*/\r
-#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )\r
+#define xTimerStartFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )\r
\r
/**\r
* BaseType_t xTimerStopFromISR( TimerHandle_t xTimer,\r
* }\r
* @endverbatim\r
*/\r
-#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP, 0, ( pxHigherPriorityTaskWoken ), 0U )\r
+#define xTimerStopFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_STOP_FROM_ISR, 0, ( pxHigherPriorityTaskWoken ), 0U )\r
\r
/**\r
* BaseType_t xTimerChangePeriodFromISR( TimerHandle_t xTimer,\r
* }\r
* @endverbatim\r
*/\r
-#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_START, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )\r
+#define xTimerResetFromISR( xTimer, pxHigherPriorityTaskWoken ) xTimerGenericCommand( ( xTimer ), tmrCOMMAND_RESET_FROM_ISR, ( xTaskGetTickCountFromISR() ), ( pxHigherPriorityTaskWoken ), 0U )\r
\r
\r
/**\r
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. */\r
void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */\r
TimerCallbackFunction_t pxCallbackFunction; /*<< The function that will be called when the timer expires. */\r
+ #if( configUSE_TRACE_FACILITY == 1 )\r
+ UBaseType_t uxTimerNumber; /*<< An ID assigned by trace tools such as FreeRTOS+Trace */\r
+ #endif\r
} Timer_t;\r
\r
/* The definition of messages that can be sent and received on the timer queue.\r
xMessage.u.xTimerParameters.xMessageValue = xOptionalValue;\r
xMessage.u.xTimerParameters.pxTimer = ( Timer_t * ) xTimer;\r
\r
- if( pxHigherPriorityTaskWoken == NULL )\r
+ if( xCommandID < tmrFIRST_FROM_ISR_COMMAND )\r
{\r
if( xTaskGetSchedulerState() == taskSCHEDULER_RUNNING )\r
{\r
{\r
/* The timer expired before it was added to the active timer\r
list. Reload it now. */\r
- xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );\r
+ xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xNextExpireTime, NULL, tmrNO_DELAY );\r
configASSERT( xResult );\r
( void ) xResult;\r
}\r
switch( xMessage.xMessageID )\r
{\r
case tmrCOMMAND_START :\r
+ case tmrCOMMAND_START_FROM_ISR :\r
+ case tmrCOMMAND_RESET :\r
+ case tmrCOMMAND_RESET_FROM_ISR :\r
+ case tmrCOMMAND_START_DONT_TRACE :\r
/* Start or restart a timer. */\r
if( prvInsertTimerInActiveList( pxTimer, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, xTimeNow, xMessage.u.xTimerParameters.xMessageValue ) == pdTRUE )\r
{\r
\r
if( pxTimer->uxAutoReload == ( UBaseType_t ) pdTRUE )\r
{\r
- xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY );\r
+ xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xMessage.u.xTimerParameters.xMessageValue + pxTimer->xTimerPeriodInTicks, NULL, tmrNO_DELAY );\r
configASSERT( xResult );\r
( void ) xResult;\r
}\r
break;\r
\r
case tmrCOMMAND_STOP :\r
+ case tmrCOMMAND_STOP_FROM_ISR :\r
/* The timer has already been removed from the active list.\r
There is nothing to do here. */\r
break;\r
}\r
else\r
{\r
- xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );\r
+ xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xNextExpireTime, NULL, tmrNO_DELAY );\r
configASSERT( xResult );\r
( void ) xResult;\r
}\r