From: richardbarry Date: Tue, 22 Nov 2011 13:24:32 +0000 (+0000) Subject: Fix compiler warning in timers.c/h that are only seen when the file is compiled on... X-Git-Tag: V7.1.0~23 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=36f74cc8f9410bf2dfda7288a9b89459dec9c0fc;p=freertos 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). git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1637 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Source/include/timers.h b/Source/include/timers.h index 02515f5a7..e3e7aa787 100644 --- a/Source/include/timers.h +++ b/Source/include/timers.h @@ -92,7 +92,7 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); /** * xTimerHandle xTimerCreate( const signed char *pcTimerName, - * portTickType xTimerPeriod, + * portTickType xTimerPeriodInTicks, * unsigned portBASE_TYPE uxAutoReload, * void * pvTimerID, * tmrTIMER_CALLBACK pxCallbackFunction ); @@ -110,15 +110,15 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); * 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 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); * * Example usage: * - * * #define NUM_TIMERS 5 * * // An array to hold handles to the created timers. @@ -929,7 +928,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * 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 2d405c586..cf19d34af 100644 --- a/Source/tasks.c +++ b/Source/tasks.c @@ -1048,29 +1048,34 @@ tskTCB * pxNewTCB; { 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( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE ) + if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE ) { - 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 ) ); + 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 ) ); + } } } + portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ); return xYieldRequired; } diff --git a/Source/timers.c b/Source/timers.c index 95ee47bcc..69e2238be 100644 --- a/Source/timers.c +++ b/Source/timers.c @@ -241,7 +241,7 @@ xTIMER *pxNewTimer; } /*-----------------------------------------------------------*/ -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;