}\r
}\r
\r
+ configASSERT( xReturn );\r
+\r
return xReturn;\r
}\r
/*-----------------------------------------------------------*/\r
traceCREATE_MUTEX_FAILED();\r
}\r
\r
+ configASSERT( pxNewQueue );\r
return pxNewQueue;\r
}\r
\r
{\r
portBASE_TYPE xReturn;\r
\r
+ configASSERT( pxMutex );\r
+\r
/* If this is the task that holds the mutex then pxMutexHolder will not\r
change outside of this task. If this task does not hold the mutex then\r
pxMutexHolder can never coincidentally equal the tasks handle, and as\r
{\r
portBASE_TYPE xReturn;\r
\r
+ configASSERT( pxMutex );\r
+\r
/* Comments regarding mutual exclusion as per those within\r
xQueueGiveMutexRecursive(). */\r
\r
traceCREATE_COUNTING_SEMAPHORE_FAILED();\r
}\r
\r
+ configASSERT( pxHandle );\r
return pxHandle;\r
}\r
\r
signed portBASE_TYPE xEntryTimeSet = pdFALSE;\r
xTimeOutType xTimeOut;\r
\r
+ configASSERT( pxQueue );\r
+ configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );\r
+\r
/* This function relaxes the coding standard somewhat to allow return\r
statements within the function itself. This is done in the interest\r
of execution time efficiency. */\r
signed portBASE_TYPE xEntryTimeSet = pdFALSE;\r
xTimeOutType xTimeOut;\r
\r
+ configASSERT( pxQueue );\r
+ configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );\r
+\r
for( ;; )\r
{\r
taskENTER_CRITICAL();\r
xTimeOutType xTimeOut;\r
signed char *pcOriginalReadPosition;\r
\r
+ configASSERT( pxQueue );\r
+ configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );\r
+\r
for( ;; )\r
{\r
taskENTER_CRITICAL();\r
signed portBASE_TYPE xReturn;\r
unsigned portBASE_TYPE uxSavedInterruptStatus;\r
\r
+ configASSERT( pxQueue );\r
+ configASSERT( pxHigherPriorityTaskWoken );\r
+ configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );\r
+\r
/* Similar to xQueueGenericSend, except we don't block if there is no room\r
in the queue. Also we don't directly wake a task that was blocked on a\r
queue read, instead we return a flag to say whether a context switch is\r
xTimeOutType xTimeOut;\r
signed char *pcOriginalReadPosition;\r
\r
+ configASSERT( pxQueue );\r
+ configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );\r
+\r
/* This function relaxes the coding standard somewhat to allow return\r
statements within the function itself. This is done in the interest\r
of execution time efficiency. */\r
signed portBASE_TYPE xReturn;\r
unsigned portBASE_TYPE uxSavedInterruptStatus;\r
\r
+ configASSERT( pxQueue );\r
+ configASSERT( pxTaskWoken );\r
+ configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( unsigned portBASE_TYPE ) 0U ) ) );\r
+\r
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
{\r
/* We cannot block from an ISR, so check there is data available. */\r
{\r
unsigned portBASE_TYPE uxReturn;\r
\r
+ configASSERT( pxQueue );\r
+\r
taskENTER_CRITICAL();\r
uxReturn = pxQueue->uxMessagesWaiting;\r
taskEXIT_CRITICAL();\r
{\r
unsigned portBASE_TYPE uxReturn;\r
\r
+ configASSERT( pxQueue );\r
+\r
uxReturn = pxQueue->uxMessagesWaiting;\r
\r
return uxReturn;\r
\r
void vQueueDelete( xQueueHandle pxQueue )\r
{\r
+ configASSERT( pxQueue );\r
+\r
traceQUEUE_DELETE( pxQueue );\r
vQueueUnregisterQueue( pxQueue );\r
vPortFree( pxQueue->pcHead );\r
{\r
signed portBASE_TYPE xReturn;\r
\r
+ configASSERT( pxQueue );\r
xReturn = ( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 );\r
\r
return xReturn;\r
{\r
signed portBASE_TYPE xReturn;\r
\r
+ configASSERT( pxQueue );\r
xReturn = ( pxQueue->uxMessagesWaiting == pxQueue->uxLength );\r
\r
return xReturn;\r
signed portBASE_TYPE xReturn;\r
tskTCB * pxNewTCB;\r
\r
+ configASSERT( pxTaskCode );\r
+ configASSERT( ( uxPriority < configMAX_PRIORITIES ) );\r
+\r
/* Allocate the memory required by the TCB and stack for the new task,\r
checking that the allocation was successful. */\r
pxNewTCB = prvAllocateTCBAndStack( usStackDepth, puxStackBuffer );\r
uxPriority &= ~portPRIVILEGE_BIT;\r
#endif /* portUSING_MPU_WRAPPERS == 1 */\r
\r
+ /* Check the alignment of the stack buffer is correct. */\r
+ configASSERT( !( ( unsigned long ) pxNewTCB->pxStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) );\r
+\r
/* Calculate the top of stack address. This depends on whether the\r
stack grows from high memory to low (as per the 80x86) or visa versa.\r
portSTACK_GROWTH is used to make the result positive or negative as\r
{\r
pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 );\r
pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( unsigned long ) pxTopOfStack ) & ( ( unsigned long ) ~portBYTE_ALIGNMENT_MASK ) );\r
+\r
+ /* Check the alignment of the calculated top of stack is correct. */\r
+ configASSERT( !( ( unsigned long ) pxTopOfStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) );\r
}\r
#else\r
{\r
}\r
#endif\r
\r
+ /* Check the alignment of the initialised stack. */\r
+ configASSERT( !( ( unsigned long ) pxNewTCB->pxTopOfStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) );\r
+\r
if( ( void * ) pxCreatedTask != NULL )\r
{\r
/* Pass the TCB out - in an anonymous way. The calling function/\r
portTickType xTimeToWake;\r
portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE;\r
\r
+ configASSERT( pxPreviousWakeTime );\r
+ configASSERT( ( xTimeIncrement > 0 ) );\r
+\r
vTaskSuspendAll();\r
{\r
/* Generate the tick time at which the task wants to wake. */\r
#endif\r
/*-----------------------------------------------------------*/\r
\r
-void vTaskUnblockTask( xTaskHandle pxTask )\r
-{\r
-tskTCB *pxTCB = ( tskTCB * ) pxTask;\r
-\r
- /* This function is not intended to be a public API function and definitely\r
- is not for generic use as it assumes pxTask is not the running task and not\r
- suspended, does not remove the task from any event lists it might be\r
- blocked on, and does not take care of mutual exclusion. */\r
- vListRemove( &( pxTCB->xGenericListItem ) );\r
- prvAddTaskToReadyQueue( pxTCB );\r
-}\r
-/*-----------------------------------------------------------*/\r
-\r
#if ( INCLUDE_uxTaskPriorityGet == 1 )\r
\r
unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle pxTask )\r
unsigned portBASE_TYPE uxCurrentPriority;\r
portBASE_TYPE xYieldRequired = pdFALSE;\r
\r
+ configASSERT( ( uxNewPriority < configMAX_PRIORITIES ) );\r
+\r
/* Ensure the new priority is valid. */\r
if( uxNewPriority >= configMAX_PRIORITIES )\r
{\r
portBASE_TYPE xReturn = pdFALSE;\r
const tskTCB * const pxTCB = ( tskTCB * ) xTask;\r
\r
+ /* It does not make sense to check if the calling task is suspended. */\r
+ configASSERT( xTask );\r
+\r
/* Is the task we are attempting to resume actually in the\r
suspended list? */\r
if( listIS_CONTAINED_WITHIN( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
{\r
tskTCB *pxTCB;\r
\r
+ /* It does not make sense to resume the calling task. */\r
+ configASSERT( pxTaskToResume );\r
+\r
/* Remove the task from whichever list it is currently in, and place\r
it in the ready list. */\r
pxTCB = ( tskTCB * ) pxTaskToResume;\r
portBASE_TYPE xYieldRequired = pdFALSE;\r
tskTCB *pxTCB;\r
\r
+ configASSERT( pxTaskToResume );\r
+\r
pxTCB = ( tskTCB * ) pxTaskToResume;\r
\r
if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )\r
/* Should only reach here if a task calls xTaskEndScheduler(). */\r
}\r
}\r
+\r
+ /* This line will only be reached if the kernel could not be started. */\r
+ configASSERT( xReturn );\r
}\r
/*-----------------------------------------------------------*/\r
\r
register tskTCB *pxTCB;\r
signed portBASE_TYPE xAlreadyYielded = pdFALSE;\r
\r
+ /* If uxSchedulerSuspended is zero then this function does not match a\r
+ previous call to vTaskSuspendAll(). */\r
+ configASSERT( uxSchedulerSuspended );\r
+\r
/* It is possible that an ISR caused a task to be removed from an event\r
list while the scheduler was suspended. If this was the case then the\r
removed task will have been added to the xPendingReadyList. Once the\r
\r
portTickType xTaskGetTickCountFromISR( void )\r
{\r
- return xTickCount;\r
+portTickType xReturn;\r
+unsigned portBASE_TYPE uxSavedInterruptStatus;\r
+\r
+ uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();\r
+ xReturn = xTickCount;\r
+ portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus );\r
+\r
+ return xReturn;\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
void vTaskStartTrace( signed char * pcBuffer, unsigned long ulBufferSize )\r
{\r
+ configASSERT( pcBuffer );\r
+ configASSERT( ulBufferSize );\r
+\r
taskENTER_CRITICAL();\r
{\r
pcTraceBuffer = ( signed char * )pcBuffer;\r
/* Find the highest priority queue that contains ready tasks. */\r
while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )\r
{\r
+ configASSERT( uxTopReadyPriority );\r
--uxTopReadyPriority;\r
}\r
\r
{\r
portTickType xTimeToWake;\r
\r
+ configASSERT( pxEventList );\r
+\r
/* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED OR THE\r
SCHEDULER SUSPENDED. */\r
\r
{\r
portTickType xTimeToWake;\r
\r
+ configASSERT( pxEventList );\r
+\r
/* This function should not be called by application code hence the\r
'Restricted' in its name. It is not part of the public API. It is\r
designed for use by kernel code, and has special calling requirements -\r
This function assumes that a check has already been made to ensure that\r
pxEventList is not empty. */\r
pxUnblockedTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );\r
+ configASSERT( pxUnblockedTCB );\r
vListRemove( &( pxUnblockedTCB->xEventListItem ) );\r
\r
if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
\r
void vTaskSetTimeOutState( xTimeOutType * const pxTimeOut )\r
{\r
+ configASSERT( pxTimeOut );\r
pxTimeOut->xOverflowCount = xNumOfOverflows;\r
pxTimeOut->xTimeOnEntering = xTickCount;\r
}\r
{\r
portBASE_TYPE xReturn;\r
\r
+ configASSERT( pxTimeOut );\r
+ configASSERT( pxTicksToWait );\r
+\r
taskENTER_CRITICAL();\r
{\r
#if ( INCLUDE_vTaskSuspend == 1 )\r
{\r
tskTCB *pxTCB;\r
\r
+ configASSERT( xRegions );\r
+\r
if( xTaskToModify == pxCurrentTCB )\r
{\r
xTaskToModify = NULL;\r
{\r
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;\r
\r
+ configASSERT( pxMutexHolder );\r
+\r
if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )\r
{\r
/* Adjust the mutex holder state to account for its new priority. */\r