]> git.sur5r.net Git - freertos/commitdiff
Fix compiler warning in timers.c/h that are only seen when the file is compiled on...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 22 Nov 2011 13:24:32 +0000 (13:24 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 22 Nov 2011 13:24:32 +0000 (13:24 +0000)
Update example source code in timers.h so the parameter names match those in timers.c.
Fix "known issue" bug in xTaskResumeFromISR() (which was missing a critical section).

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1637 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/include/timers.h
Source/tasks.c
Source/timers.c

index 02515f5a718eca906a5ff09c08c3df6e836eb905..e3e7aa787641c5c1244f587edbc0cb878c1396c5 100644 (file)
@@ -92,7 +92,7 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
 \r
 /**\r
  * xTimerHandle xTimerCreate(  const signed char *pcTimerName,\r
- *                                                             portTickType xTimerPeriod,\r
+ *                                                             portTickType xTimerPeriodInTicks,\r
  *                                                             unsigned portBASE_TYPE uxAutoReload,\r
  *                                                             void * pvTimerID,\r
  *                                                             tmrTIMER_CALLBACK pxCallbackFunction );\r
@@ -110,15 +110,15 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
  * purely to assist debugging.  The kernel itself only ever references a timer by\r
  * its handle, and never by its name.\r
  *\r
- * @param xTimerPeriod The timer period.  The time is defined in tick periods so\r
+ * @param xTimerPeriodInTicks The timer period.  The time is defined in tick periods so\r
  * the constant portTICK_RATE_MS can be used to convert a time that has been\r
  * specified in milliseconds.  For example, if the timer must expire after 100\r
- * ticks, then xTimerPeriod should be set to 100.  Alternatively, if the timer\r
+ * ticks, then xTimerPeriodInTicks should be set to 100.  Alternatively, if the timer\r
  * must expire after 500ms, then xPeriod can be set to ( 500 / portTICK_RATE_MS )\r
  * provided configTICK_RATE_HZ is less than or equal to 1000.\r
  *\r
  * @param uxAutoReload If uxAutoReload is set to pdTRUE then the timer will\r
- * expire repeatedly with a frequency set by the xTimerPeriod parameter.  If\r
+ * expire repeatedly with a frequency set by the xTimerPeriodInTicks parameter.  If\r
  * uxAutoReload is set to pdFALSE then the timer will be a one-shot timer and\r
  * enter the dormant state after it expires.\r
  *\r
@@ -138,7 +138,6 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer );
  *\r
  * Example usage:\r
  *\r
- *\r
  * #define NUM_TIMERS 5\r
  *\r
  * // An array to hold handles to the created timers.\r
@@ -929,7 +928,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void );
  * for use by the kernel only.\r
  */\r
 portBASE_TYPE xTimerCreateTimerTask( void ) PRIVILEGED_FUNCTION;\r
-portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime ) PRIVILEGED_FUNCTION;\r
+portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime ) PRIVILEGED_FUNCTION;\r
 \r
 #ifdef __cplusplus\r
 }\r
index 2d405c5868adc21e6c9f9190123771e751be973b..cf19d34afa88f2f21053b0e2107be69e142ff340 100644 (file)
@@ -1048,29 +1048,34 @@ tskTCB * pxNewTCB;
        {\r
        portBASE_TYPE xYieldRequired = pdFALSE;\r
        tskTCB *pxTCB;\r
+       unsigned portBASE_TYPE uxSavedInterruptStatus;\r
 \r
                configASSERT( pxTaskToResume );\r
 \r
                pxTCB = ( tskTCB * ) pxTaskToResume;\r
 \r
-               if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )\r
+               uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
                {\r
-                       traceTASK_RESUME_FROM_ISR( pxTCB );\r
-\r
-                       if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
+                       if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )\r
                        {\r
-                               xYieldRequired = ( pxTCB->uxPriority >= pxCurrentTCB->uxPriority );\r
-                               vListRemove(  &( pxTCB->xGenericListItem ) );\r
-                               prvAddTaskToReadyQueue( pxTCB );\r
-                       }\r
-                       else\r
-                       {\r
-                               /* We cannot access the delayed or ready lists, so will hold this\r
-                               task pending until the scheduler is resumed, at which point a\r
-                               yield will be performed if necessary. */\r
-                               vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxTCB->xEventListItem ) );\r
+                               traceTASK_RESUME_FROM_ISR( pxTCB );\r
+\r
+                               if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
+                               {\r
+                                       xYieldRequired = ( pxTCB->uxPriority >= pxCurrentTCB->uxPriority );\r
+                                       vListRemove(  &( pxTCB->xGenericListItem ) );\r
+                                       prvAddTaskToReadyQueue( pxTCB );\r
+                               }\r
+                               else\r
+                               {\r
+                                       /* We cannot access the delayed or ready lists, so will hold this\r
+                                       task pending until the scheduler is resumed, at which point a\r
+                                       yield will be performed if necessary. */\r
+                                       vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxTCB->xEventListItem ) );\r
+                               }\r
                        }\r
                }\r
+               portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );\r
 \r
                return xYieldRequired;\r
        }\r
index 95ee47bccffd55f0830b2ed628f79514936088d9..69e2238be81c6bbd2f28ebf6ddb2b6013d2292c4 100644 (file)
@@ -241,7 +241,7 @@ xTIMER *pxNewTimer;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime )\r
+portBASE_TYPE xTimerGenericCommand( xTimerHandle xTimer, portBASE_TYPE xCommandID, portTickType xOptionalValue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portTickType xBlockTime )\r
 {\r
 portBASE_TYPE xReturn = pdFAIL;\r
 xTIMER_MESSAGE xMessage;\r