]> git.sur5r.net Git - freertos/commitdiff
Allow mutex type semaphores to be given from an interrupt (not a normal thing to...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 5 Sep 2012 14:02:16 +0000 (14:02 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 5 Sep 2012 14:02:16 +0000 (14:02 +0000)
Allow FreeRTOS+CLI commands to have spaces at the end without it being taken as a parameter.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1778 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS-Plus/FreeRTOS-Plus-CLI/FreeRTOS_CLI.c
FreeRTOS/Source/queue.c
FreeRTOS/Source/tasks.c

index 05737f03e8986195b258e95f6225a2383146d588..13f584d72de34fa1163f560e2ba1080d8397fde0 100644 (file)
@@ -152,7 +152,7 @@ size_t xCommandStringLength;
                        pcRegisteredCommandString = pxCommand->pxCommandLineDefinition->pcCommand;\r
                        xCommandStringLength = strlen( ( const char * ) pcRegisteredCommandString );\r
 \r
-                       /* To ensure the string lengths match exactly, so as not to pick up \r
+                       /* To ensure the string lengths match exactly, so as not to pick up\r
                        a sub-string of a longer command, check the byte after the expected\r
                        end of the string is either the end of the string or a space before\r
                        a parameter. */\r
@@ -253,6 +253,11 @@ const int8_t *pcReturn = NULL;
                                        pcCommandString++;\r
                                }\r
 \r
+                               if( *pxParameterStringLength == 0 )\r
+                               {\r
+                                       pcReturn = NULL;\r
+                               }\r
+\r
                                break;\r
                        }\r
                }\r
index 4748860db8a03d8464852aa257074a295a5d1a30..090028d32caf0454fe9390b7e5feafa527b9fc07 100644 (file)
@@ -874,7 +874,9 @@ xTimeOutType xTimeOut;
                                                        if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX )\r
                                                        {\r
                                                                portENTER_CRITICAL();\r
+                                                               {\r
                                                                        vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder );\r
+                                                               }\r
                                                                portEXIT_CRITICAL();\r
                                                        }\r
                                                }\r
index 0c43e63d6c8d8188c009ee02b644772483e8960e..cb123c528a8143e4013f74c1459d59116ee2321f 100644 (file)
@@ -2382,30 +2382,33 @@ tskTCB *pxNewTCB;
        {\r
        tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;\r
 \r
-               configASSERT( pxMutexHolder );\r
-\r
-               if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )\r
+               /* If the mutex was given back by an interrupt while the queue was\r
+               locked then the mutex holder might now be NULL. */\r
+               if( pxMutexHolder != NULL )\r
                {\r
-                       /* Adjust the mutex holder state to account for its new priority. */\r
-                       listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority );\r
-\r
-                       /* If the task being modified is in the ready state it will need to\r
-                       be moved in to a new list. */\r
-                       if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
+                       if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )\r
                        {\r
-                               vListRemove( &( pxTCB->xGenericListItem ) );\r
+                               /* Adjust the mutex holder state to account for its new priority. */\r
+                               listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority );\r
 \r
-                               /* Inherit the priority before being moved into the new list. */\r
-                               pxTCB->uxPriority = pxCurrentTCB->uxPriority;\r
-                               prvAddTaskToReadyQueue( pxTCB );\r
-                       }\r
-                       else\r
-                       {\r
-                               /* Just inherit the priority. */\r
-                               pxTCB->uxPriority = pxCurrentTCB->uxPriority;\r
-                       }\r
+                               /* If the task being modified is in the ready state it will need to\r
+                               be moved in to a new list. */\r
+                               if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
+                               {\r
+                                       vListRemove( &( pxTCB->xGenericListItem ) );\r
 \r
-                       traceTASK_PRIORITY_INHERIT( pxTCB, pxCurrentTCB->uxPriority );\r
+                                       /* Inherit the priority before being moved into the new list. */\r
+                                       pxTCB->uxPriority = pxCurrentTCB->uxPriority;\r
+                                       prvAddTaskToReadyQueue( pxTCB );\r
+                               }\r
+                               else\r
+                               {\r
+                                       /* Just inherit the priority. */\r
+                                       pxTCB->uxPriority = pxCurrentTCB->uxPriority;\r
+                               }\r
+\r
+                               traceTASK_PRIORITY_INHERIT( pxTCB, pxCurrentTCB->uxPriority );\r
+                       }\r
                }\r
        }\r
 \r