]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/timers.c
Added uxTimerGetReloadMode() API function.
[freertos] / FreeRTOS / Source / timers.c
index 80c8d9b2d2029b75dee1c7381e1345870ac8470d..12a2f4e9b6a6213d1befd75a5a3fa61d6e076390 100644 (file)
@@ -182,7 +182,7 @@ static BaseType_t prvInsertTimerInActiveList( Timer_t * const pxTimer, const Tic
 \r
 /*\r
  * An active timer has reached its expire time.  Reload the timer if it is an\r
- * auto reload timer, then call its callback.\r
+ * auto-reload timer, then call its callback.\r
  */\r
 static void prvProcessExpiredTimer( const TickType_t xNextExpireTime, const TickType_t xTimeNow ) PRIVILEGED_FUNCTION;\r
 \r
@@ -292,7 +292,7 @@ BaseType_t xReturn = pdFAIL;
                if( pxNewTimer != NULL )\r
                {\r
                        /* Status is thus far zero as the timer is not created statically\r
-                       and has not been started.  The autoreload bit may get set in\r
+                       and has not been started.  The auto-reload bit may get set in\r
                        prvInitialiseNewTimer. */\r
                        pxNewTimer->ucStatus = 0x00;\r
                        prvInitialiseNewTimer( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxNewTimer );\r
@@ -334,7 +334,7 @@ BaseType_t xReturn = pdFAIL;
                {\r
                        /* Timers can be created statically or dynamically so note this\r
                        timer was created statically in case it is later deleted.  The\r
-                       autoreload bit may get set in prvInitialiseNewTimer(). */\r
+                       auto-reload bit may get set in prvInitialiseNewTimer(). */\r
                        pxNewTimer->ucStatus = tmrSTATUS_IS_STATICALLY_ALLOCATED;\r
 \r
                        prvInitialiseNewTimer( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxNewTimer );\r
@@ -459,6 +459,31 @@ Timer_t * pxTimer =  xTimer;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+UBaseType_t uxTimerGetReloadMode( TimerHandle_t xTimer )\r
+{\r
+Timer_t * pxTimer =  xTimer;\r
+UBaseType_t uxReturn;\r
+\r
+       configASSERT( xTimer );\r
+       taskENTER_CRITICAL();\r
+       {\r
+               if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) == 0 )\r
+               {\r
+                       /* Not an auto-reload timer. */\r
+                       uxReturn = ( UBaseType_t ) pdFALSE;\r
+               }\r
+               else\r
+               {\r
+                       /* Is an auto-reload timer. */\r
+                       uxReturn = ( UBaseType_t ) pdTRUE;\r
+               }\r
+       }\r
+       taskEXIT_CRITICAL();\r
+\r
+       return uxReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer )\r
 {\r
 Timer_t * pxTimer =  xTimer;\r
@@ -489,7 +514,7 @@ Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTi
        ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
        traceTIMER_EXPIRED( pxTimer );\r
 \r
-       /* If the timer is an auto reload timer then calculate the next\r
+       /* If the timer is an auto-reload timer then calculate the next\r
        expiry time and re-insert the timer in the list of active timers. */\r
        if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) != 0 )\r
        {\r