Minor updates to the queue.c and tasks.c core files required to support the new timers implementation.

This commit is contained in:
Richard Barry 2011-02-09 19:21:58 +00:00
parent 9d9b00b669
commit 559532329d
2 changed files with 47 additions and 1 deletions

View File

@ -1440,7 +1440,7 @@ signed portBASE_TYPE xReturn;
}
#endif
/*-----------------------------------------------------------*/
/*-----------------------------------------------------------*/
#if configQUEUE_REGISTRY_SIZE > 0
@ -1463,4 +1463,27 @@ signed portBASE_TYPE xReturn;
}
#endif
/*-----------------------------------------------------------*/
#if configUSE_TIMERS == 1
void vQueueWaitForMessageRestricted( xQueueHandle pxQueue, portTickType xTicksToWait )
{
/* This function should not be called by application code hence the
'Restricted' in its name. It is not part of the public API. It is designed
for use by kernel code, and has special calling requirements - it should be
called from a critical section, and then a yield performed after it is
called. Also, the call tree makes use of vListInsert() which should normally
not be called from a critical section - so an assumption is made that the list
being inserted into is empty and therefore the insertion will be fast. */
/* Only do anything if there are no message in the queue. */
if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0U )
{
/* There is nothing in the queue, block for the specified period. */
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToReceive ), xTicksToWait );
}
}
#endif

View File

@ -63,6 +63,7 @@ task.h is included from an application file. */
#include "FreeRTOS.h"
#include "task.h"
#include "timers.h"
#include "StackMacros.h"
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
@ -747,6 +748,19 @@ tskTCB * pxNewTCB;
#endif
/*-----------------------------------------------------------*/
void vTaskUnblockTask( xTaskHandle pxTask )
{
tskTCB *pxTCB = ( tskTCB * ) pxTask;
/* This function is not intended to be a public API function and definitely
is not for generic use as it assumes pxTask is not the running task and not
suspended, does not remove the task from any event lists it might be
blocked on, and does not take care of mutual exclusion. */
vListRemove( &( pxTCB->xGenericListItem ) );
prvAddTaskToReadyQueue( pxTCB );
}
/*-----------------------------------------------------------*/
#if ( INCLUDE_uxTaskPriorityGet == 1 )
unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle pxTask )
@ -1060,6 +1074,15 @@ portBASE_TYPE xReturn;
/* Add the idle task at the lowest priority. */
xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), ( xTaskHandle * ) NULL );
#if ( configUSE_TIMERS == 1 )
{
if( xReturn == pdPASS )
{
xReturn = xTimerCreateTimerTask();
}
}
#endif
if( xReturn == pdPASS )
{
/* Interrupts are turned off here, to ensure a tick does not occur