mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Allow mutex type semaphores to be given from an interrupt (not a normal thing to do - use a binary semaphore!).
Allow FreeRTOS+CLI commands to have spaces at the end without it being taken as a parameter.
This commit is contained in:
parent
c0de8c984c
commit
48a307ff5f
|
@ -152,7 +152,7 @@ size_t xCommandStringLength;
|
||||||
pcRegisteredCommandString = pxCommand->pxCommandLineDefinition->pcCommand;
|
pcRegisteredCommandString = pxCommand->pxCommandLineDefinition->pcCommand;
|
||||||
xCommandStringLength = strlen( ( const char * ) pcRegisteredCommandString );
|
xCommandStringLength = strlen( ( const char * ) pcRegisteredCommandString );
|
||||||
|
|
||||||
/* To ensure the string lengths match exactly, so as not to pick up
|
/* To ensure the string lengths match exactly, so as not to pick up
|
||||||
a sub-string of a longer command, check the byte after the expected
|
a sub-string of a longer command, check the byte after the expected
|
||||||
end of the string is either the end of the string or a space before
|
end of the string is either the end of the string or a space before
|
||||||
a parameter. */
|
a parameter. */
|
||||||
|
@ -253,6 +253,11 @@ const int8_t *pcReturn = NULL;
|
||||||
pcCommandString++;
|
pcCommandString++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( *pxParameterStringLength == 0 )
|
||||||
|
{
|
||||||
|
pcReturn = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -874,7 +874,9 @@ xTimeOutType xTimeOut;
|
||||||
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
|
if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )
|
||||||
{
|
{
|
||||||
portENTER_CRITICAL();
|
portENTER_CRITICAL();
|
||||||
|
{
|
||||||
vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder );
|
vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder );
|
||||||
|
}
|
||||||
portEXIT_CRITICAL();
|
portEXIT_CRITICAL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2382,30 +2382,33 @@ tskTCB *pxNewTCB;
|
||||||
{
|
{
|
||||||
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;
|
tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;
|
||||||
|
|
||||||
configASSERT( pxMutexHolder );
|
/* If the mutex was given back by an interrupt while the queue was
|
||||||
|
locked then the mutex holder might now be NULL. */
|
||||||
if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )
|
if( pxMutexHolder != NULL )
|
||||||
{
|
{
|
||||||
/* Adjust the mutex holder state to account for its new priority. */
|
if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )
|
||||||
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority );
|
|
||||||
|
|
||||||
/* If the task being modified is in the ready state it will need to
|
|
||||||
be moved in to a new list. */
|
|
||||||
if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )
|
|
||||||
{
|
{
|
||||||
vListRemove( &( pxTCB->xGenericListItem ) );
|
/* Adjust the mutex holder state to account for its new priority. */
|
||||||
|
listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority );
|
||||||
|
|
||||||
/* Inherit the priority before being moved into the new list. */
|
/* If the task being modified is in the ready state it will need to
|
||||||
pxTCB->uxPriority = pxCurrentTCB->uxPriority;
|
be moved in to a new list. */
|
||||||
prvAddTaskToReadyQueue( pxTCB );
|
if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )
|
||||||
}
|
{
|
||||||
else
|
vListRemove( &( pxTCB->xGenericListItem ) );
|
||||||
{
|
|
||||||
/* Just inherit the priority. */
|
|
||||||
pxTCB->uxPriority = pxCurrentTCB->uxPriority;
|
|
||||||
}
|
|
||||||
|
|
||||||
traceTASK_PRIORITY_INHERIT( pxTCB, pxCurrentTCB->uxPriority );
|
/* Inherit the priority before being moved into the new list. */
|
||||||
|
pxTCB->uxPriority = pxCurrentTCB->uxPriority;
|
||||||
|
prvAddTaskToReadyQueue( pxTCB );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Just inherit the priority. */
|
||||||
|
pxTCB->uxPriority = pxCurrentTCB->uxPriority;
|
||||||
|
}
|
||||||
|
|
||||||
|
traceTASK_PRIORITY_INHERIT( pxTCB, pxCurrentTCB->uxPriority );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue