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