Added xQueueSendToBack, xQueueSendToFront, xQueuePeek and xSemaphoreCreateMutex - along with GenQTest.c to demonstrate their usage.
diff --git a/Demo/Common/Full/BlockQ.c b/Demo/Common/Full/BlockQ.c index 6c96a79..e7688ae 100644 --- a/Demo/Common/Full/BlockQ.c +++ b/Demo/Common/Full/BlockQ.c
@@ -89,7 +89,7 @@ #include "BlockQ.h" #include "print.h" -#define blckqSTACK_SIZE ( ( unsigned portSHORT ) 128 ) +#define blckqSTACK_SIZE ( ( unsigned portSHORT ) configMINIMAL_STACK_SIZE ) #define blckqNUM_TASK_SETS ( 3 ) /* Structure used to pass parameters to the blocking queue tasks. */ @@ -215,7 +215,7 @@ for( ;; ) { - if( xQueueSend( pxQueueParameters->xQueue, ( void * ) &usValue, pxQueueParameters->xBlockTime ) != pdPASS ) + if( xQueueSendToBack( pxQueueParameters->xQueue, ( void * ) &usValue, pxQueueParameters->xBlockTime ) != pdPASS ) { vPrintDisplayMessage( &pcTaskErrorMsg ); sErrorEverOccurred = pdTRUE;
diff --git a/Demo/Common/Full/PollQ.c b/Demo/Common/Full/PollQ.c index dd6ac8b..cfd1cba 100644 --- a/Demo/Common/Full/PollQ.c +++ b/Demo/Common/Full/PollQ.c
@@ -78,7 +78,7 @@ /* Demo program include files. */ #include "PollQ.h" -#define pollqSTACK_SIZE ( ( unsigned portSHORT ) 128 ) +#define pollqSTACK_SIZE ( ( unsigned portSHORT ) configMINIMAL_STACK_SIZE ) /* The task that posts the incrementing number onto the queue. */ static void vPolledQueueProducer( void *pvParameters ); @@ -125,7 +125,7 @@ for( usLoop = 0; usLoop < usNumToProduce; ++usLoop ) { /* Send an incrementing number on the queue without blocking. */ - if( xQueueSend( *pxQueue, ( void * ) &usValue, ( portTickType ) 0 ) != pdPASS ) + if( xQueueSendToBack( *pxQueue, ( void * ) &usValue, ( portTickType ) 0 ) != pdPASS ) { /* We should never find the queue full - this is an error. */ vPrintDisplayMessage( &pcTaskErrorMsg );
diff --git a/Demo/Common/Full/dynamic.c b/Demo/Common/Full/dynamic.c index 128785d..454e752 100644 --- a/Demo/Common/Full/dynamic.c +++ b/Demo/Common/Full/dynamic.c
@@ -146,7 +146,7 @@ /* Demo task specific constants. */ -#define priSTACK_SIZE ( ( unsigned portSHORT ) 128 ) +#define priSTACK_SIZE ( ( unsigned portSHORT ) configMINIMAL_STACK_SIZE ) #define priSLEEP_TIME ( ( portTickType ) 50 ) #define priLOOPS ( 5 ) #define priMAX_COUNT ( ( unsigned portLONG ) 0xff ) @@ -193,7 +193,7 @@ xTaskCreate( vQueueSendWhenSuspendedTask, "SUSP_SEND", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); xTaskCreate( vQueueReceiveWhenSuspendedTask, "SUSP_RECV", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); xTaskCreate( prvChangePriorityWhenSuspendedTask, "1st_P_CHANGE", priSTACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL ); - xTaskCreate( prvChangePriorityHelperTask, "2nt_P_CHANGE", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, &xChangePriorityWhenSuspendedHandle ); + xTaskCreate( prvChangePriorityHelperTask, "2nd_P_CHANGE", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, &xChangePriorityWhenSuspendedHandle ); } /*-----------------------------------------------------------*/
diff --git a/Demo/Common/Full/events.c b/Demo/Common/Full/events.c index 630c110..ab39bac 100644 --- a/Demo/Common/Full/events.c +++ b/Demo/Common/Full/events.c
@@ -68,7 +68,7 @@ #include "print.h" /* Demo specific constants. */ -#define evtSTACK_SIZE ( ( unsigned portBASE_TYPE ) 128 ) +#define evtSTACK_SIZE ( ( unsigned portBASE_TYPE ) configMINIMAL_STACK_SIZE ) #define evtNUM_TASKS ( 4 ) #define evtQUEUE_LENGTH ( ( unsigned portBASE_TYPE ) 3 ) #define evtNO_DELAY 0
diff --git a/Demo/Common/Minimal/GenQTest.c b/Demo/Common/Minimal/GenQTest.c new file mode 100644 index 0000000..275b814 --- /dev/null +++ b/Demo/Common/Minimal/GenQTest.c
@@ -0,0 +1,536 @@ +/* + FreeRTOS.org V4.4.0 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along + with commercial development and support options. + *************************************************************************** +*/ + + +/* + * Tests the extra queue functionality introduced in FreeRTOS.org V4.5.0 - + * including xQueueSendToFront(), xQueueSendToBack(), xQueuePeek() and + * mutex behaviour. + * + * See the comments above the prvSendFrontAndBackTest() and + * prvLowPriorityMutexTask() prototypes below for more information. + */ + + +#include <stdlib.h> + +/* Scheduler include files. */ +#include "FreeRTOS.h" +#include "task.h" +#include "queue.h" +#include "semphr.h" + +/* Demo program include files. */ +#include "GenQTest.h" + +#define genqQUEUE_LENGTH ( 5 ) +#define genqNO_BLOCK ( 0 ) + +#define genqMUTEX_LOW_PRIORITY ( tskIDLE_PRIORITY ) +#define genqMUTEX_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define genqMUTEX_MEDIUM_PRIORITY ( tskIDLE_PRIORITY + 2 ) +#define genqMUTEX_HIGH_PRIORITY ( tskIDLE_PRIORITY + 3 ) + +/*-----------------------------------------------------------*/ + +/* + * Tests the behaviour of the xQueueSendToFront() and xQueueSendToBack() + * macros by using both to fill a queue, then reading from the queue to + * check the resultant queue order is as expected. Queue data is also + * peeked. + */ +static void prvSendFrontAndBackTest( void *pvParameters ); + +/* + * The following three tasks are used to demonstrate the mutex behaviour. + * Each task is given a different priority to demonstrate the priority + * inheritance mechanism. + * + * The low priority task obtains a mutex. After this a high priority task + * attempts to obtain the same mutex, causing its priority to be inherited + * by the low priority task. The task with the inherited high priority then + * resumes a medium priority task to ensure it is not blocked by the medium + * priority task while it holds the inherited high priority. Once the mutex + * is returned the task with the inherited priority returns to its original + * low priority, and is therefore immediately preempted by first the high + * priority task and then the medium prioroity task before it can continue. + */ +static void prvLowPriorityMutexTask( void *pvParameters ); +static void prvMediumPriorityMutexTask( void *pvParameters ); +static void prvHighPriorityMutexTask( void *pvParameters ); + +/*-----------------------------------------------------------*/ + +/* Flag that will be latched to pdTRUE should any unexpected behaviour be +detected in any of the tasks. */ +static portBASE_TYPE xErrorDetected = pdFALSE; + +/* Counters that are incremented on each cycle of a test. This is used to +detect a stalled task - a test that is no longer running. */ +static volatile unsigned portLONG ulLoopCounter = 0; +static volatile unsigned portLONG ulLoopCounter2 = 0; + +/* The variable that is guarded by the mutex in the mutex demo tasks. */ +static volatile unsigned portLONG ulGuardedVariable = 0; + +/* Handles used in the mutext test to suspend and resume the high and medium +priority mutex test tasks. */ +static xTaskHandle xHighPriorityMutexTask, xMediumPriorityMutexTask; + +/*-----------------------------------------------------------*/ + +void vStartGenericQueueTasks( unsigned portBASE_TYPE uxPriority ) +{ +xQueueHandle xQueue; +xSemaphoreHandle xMutex; + + /* Create the queue that we are going to use for the + prvSendFrontAndBackTest demo. */ + xQueue = xQueueCreate( genqQUEUE_LENGTH, sizeof( unsigned portLONG ) ); + + /* Create the demo task and pass it the queue just created. We are + passing the queue handle by value so it does not matter that it is + declared on the stack here. */ + xTaskCreate( prvSendFrontAndBackTest, "GenQ", configMINIMAL_STACK_SIZE, ( void * ) xQueue, uxPriority, NULL ); + + /* Create the mutex used by the prvMutexTest task. */ + xMutex = xSemaphoreCreateMutex(); + + /* Create the mutex demo tasks and pass it the mutex just created. We are + passing the mutex handle by value so it does not matter that it is declared + on the stack here. */ + xTaskCreate( prvLowPriorityMutexTask, "MuLow", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_LOW_PRIORITY, NULL ); + xTaskCreate( prvMediumPriorityMutexTask, "MuMed", configMINIMAL_STACK_SIZE, NULL, genqMUTEX_MEDIUM_PRIORITY, &xMediumPriorityMutexTask ); + xTaskCreate( prvHighPriorityMutexTask, "MuHigh", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_HIGH_PRIORITY, &xHighPriorityMutexTask ); +} +/*-----------------------------------------------------------*/ + +static void prvSendFrontAndBackTest( void *pvParameters ) +{ +unsigned portLONG ulData, ulData2; +xQueueHandle xQueue; + + #ifdef USE_STDIO + void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend ); + + const portCHAR * const pcTaskStartMsg = "Queue SendToFront/SendToBack/Peek test started.\r\n"; + + /* Queue a message for printing to say the task has started. */ + vPrintDisplayMessage( &pcTaskStartMsg ); + #endif + + xQueue = ( xQueueHandle ) pvParameters; + + for( ;; ) + { + /* The queue is empty, so sending an item to the back of the queue + should have the same efect as sending it to the front of the queue. + + First send to the front and check everything is as expected. */ + xQueueSendToFront( xQueue, ( void * ) &ulLoopCounter, genqNO_BLOCK ); + + if( uxQueueMessagesWaiting( xQueue ) != 1 ) + { + xErrorDetected = pdTRUE; + } + + if( xQueueReceive( xQueue, ( void * ) &ulData, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + /* The data we sent to the queue should equal the data we just received + from the queue. */ + if( ulLoopCounter != ulData ) + { + xErrorDetected = pdTRUE; + } + + /* Then do the same, sending the data to the back, checking everything + is as expected. */ + if( uxQueueMessagesWaiting( xQueue ) != 0 ) + { + xErrorDetected = pdTRUE; + } + + xQueueSendToBack( xQueue, ( void * ) &ulLoopCounter, genqNO_BLOCK ); + + if( uxQueueMessagesWaiting( xQueue ) != 1 ) + { + xErrorDetected = pdTRUE; + } + + if( xQueueReceive( xQueue, ( void * ) &ulData, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + if( uxQueueMessagesWaiting( xQueue ) != 0 ) + { + xErrorDetected = pdTRUE; + } + + /* The data we sent to the queue should equal the data we just received + from the queue. */ + if( ulLoopCounter != ulData ) + { + xErrorDetected = pdTRUE; + } + + #if configUSE_PREEMPTION == 0 + taskYIELD(); + #endif + + + + /* Place 2, 3, 4 into the queue, adding items to the back of the queue. */ + for( ulData = 2; ulData < 5; ulData++ ) + { + xQueueSendToBack( xQueue, ( void * ) &ulData, genqNO_BLOCK ); + } + + /* Now the order in the queue should be 2, 3, 4, with 2 being the first + thing to be read out. Now add 1 then 0 to the front of the queue. */ + if( uxQueueMessagesWaiting( xQueue ) != 3 ) + { + xErrorDetected = pdTRUE; + } + ulData = 1; + xQueueSendToFront( xQueue, ( void * ) &ulData, genqNO_BLOCK ); + ulData = 0; + xQueueSendToFront( xQueue, ( void * ) &ulData, genqNO_BLOCK ); + + /* Now the queue should be full, and when we read the data out we + should receive 0, 1, 2, 3, 4. */ + if( uxQueueMessagesWaiting( xQueue ) != 5 ) + { + xErrorDetected = pdTRUE; + } + + if( xQueueSendToFront( xQueue, ( void * ) &ulData, genqNO_BLOCK ) != errQUEUE_FULL ) + { + xErrorDetected = pdTRUE; + } + + if( xQueueSendToBack( xQueue, ( void * ) &ulData, genqNO_BLOCK ) != errQUEUE_FULL ) + { + xErrorDetected = pdTRUE; + } + + #if configUSE_PREEMPTION == 0 + taskYIELD(); + #endif + + /* Check the data we read out is in the expected order. */ + for( ulData = 0; ulData < genqQUEUE_LENGTH; ulData++ ) + { + /* Try peeking the data first. */ + if( xQueuePeek( xQueue, &ulData2, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + if( ulData != ulData2 ) + { + xErrorDetected = pdTRUE; + } + + + /* Now try receiving the data for real. The value should be the + same. Clobber the value first so we know we really received it. */ + ulData2 = ~ulData2; + if( xQueueReceive( xQueue, &ulData2, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + if( ulData != ulData2 ) + { + xErrorDetected = pdTRUE; + } + } + + /* The queue should now be empty again. */ + if( uxQueueMessagesWaiting( xQueue ) != 0 ) + { + xErrorDetected = pdTRUE; + } + + #if configUSE_PREEMPTION == 0 + taskYIELD(); + #endif + + + /* Our queue is empty once more, add 10, 11 to the back. */ + ulData = 10; + if( xQueueSend( xQueue, &ulData, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + ulData = 11; + if( xQueueSend( xQueue, &ulData, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + if( uxQueueMessagesWaiting( xQueue ) != 2 ) + { + xErrorDetected = pdTRUE; + } + + /* Now we should have 10, 11 in the queue. Add 7, 8, 9 to the + front. */ + for( ulData = 9; ulData >= 7; ulData-- ) + { + if( xQueueSendToFront( xQueue, ( void * ) &ulData, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + } + + /* Now check that the queue is full, and that receiving data provides + the expected sequence of 7, 8, 9, 10, 11. */ + if( uxQueueMessagesWaiting( xQueue ) != 5 ) + { + xErrorDetected = pdTRUE; + } + + if( xQueueSendToFront( xQueue, ( void * ) &ulData, genqNO_BLOCK ) != errQUEUE_FULL ) + { + xErrorDetected = pdTRUE; + } + + if( xQueueSendToBack( xQueue, ( void * ) &ulData, genqNO_BLOCK ) != errQUEUE_FULL ) + { + xErrorDetected = pdTRUE; + } + + #if configUSE_PREEMPTION == 0 + taskYIELD(); + #endif + + /* Check the data we read out is in the expected order. */ + for( ulData = 7; ulData < ( 7 + genqQUEUE_LENGTH ); ulData++ ) + { + if( xQueueReceive( xQueue, &ulData2, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + if( ulData != ulData2 ) + { + xErrorDetected = pdTRUE; + } + } + + if( uxQueueMessagesWaiting( xQueue ) != 0 ) + { + xErrorDetected = pdTRUE; + } + + ulLoopCounter++; + } +} +/*-----------------------------------------------------------*/ + +static void prvLowPriorityMutexTask( void *pvParameters ) +{ +xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters; + + #ifdef USE_STDIO + void vPrintDisplayMessage( const portCHAR * const * ppcMessageToSend ); + + const portCHAR * const pcTaskStartMsg = "Mutex with priority inheritance test started.\r\n"; + + /* Queue a message for printing to say the task has started. */ + vPrintDisplayMessage( &pcTaskStartMsg ); + #endif + + for( ;; ) + { + /* Take the mutex. It should be available now. */ + if( xSemaphoreTake( xMutex, genqNO_BLOCK ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + /* Set our guarded variable to a known start value. */ + ulGuardedVariable = 0; + + /* Our priority should be as per that assigned when the task was + created. */ + if( uxTaskPriorityGet( NULL ) != genqMUTEX_LOW_PRIORITY ) + { + xErrorDetected = pdTRUE; + } + + /* Now unsuspend the high priority task. This will attempt to take the + mutex, and block when it finds it cannot obtain it. */ + vTaskResume( xHighPriorityMutexTask ); + + /* We should now have inherited the prioritoy of the high priority task, + as by now it will have attempted to get the mutex. */ + if( uxTaskPriorityGet( NULL ) != genqMUTEX_HIGH_PRIORITY ) + { + xErrorDetected = pdTRUE; + } + + /* We can attempt to set our priority to the test priority - between the + idle priority and the medium/high test priorities, but our actual + prioroity should remain at the high priority. */ + vTaskPrioritySet( NULL, genqMUTEX_TEST_PRIORITY ); + if( uxTaskPriorityGet( NULL ) != genqMUTEX_HIGH_PRIORITY ) + { + xErrorDetected = pdTRUE; + } + + /* Now unsuspend the medium priority task. This should not run as our + inherited priority is above that of the medium priority task. */ + vTaskResume( xMediumPriorityMutexTask ); + + /* If the did run then it will have incremented our guarded variable. */ + if( ulGuardedVariable != 0 ) + { + xErrorDetected = pdTRUE; + } + + /* When we give back the semaphore our priority should be disinherited + back to the priority to which we attempted to set ourselves. This means + that when the high priority task next blocks, the medium priority task + should execute and increment the guarded variable. When we next run + both the high and medium priority tasks will have been suspended again. */ + if( xSemaphoreGive( xMutex ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + /* Check that the guarded variable did indeed increment... */ + if( ulGuardedVariable != 1 ) + { + xErrorDetected = pdTRUE; + } + + /* ... and that our priority has been disinherited to + genqMUTEX_TEST_PRIORITY. */ + if( uxTaskPriorityGet( NULL ) != genqMUTEX_TEST_PRIORITY ) + { + xErrorDetected = pdTRUE; + } + + /* Set our priority back to our original priority ready for the next + loop around this test. */ + vTaskPrioritySet( NULL, genqMUTEX_LOW_PRIORITY ); + + /* Just to show we are still running. */ + ulLoopCounter2++; + + #if configUSE_PREEMPTION == 0 + taskYIELD(); + #endif + } +} +/*-----------------------------------------------------------*/ + +static void prvMediumPriorityMutexTask( void *pvParameters ) +{ + for( ;; ) + { + /* The medium priority task starts by suspending itself. The low + priority task will unsuspend this task when required. */ + vTaskSuspend( NULL ); + + /* When this task unsuspends all it does is increment the guarded + variable, this is so the low priority task knows that it has + executed. */ + ulGuardedVariable++; + } +} +/*-----------------------------------------------------------*/ + +static void prvHighPriorityMutexTask( void *pvParameters ) +{ +xSemaphoreHandle xMutex = ( xSemaphoreHandle ) pvParameters; + + for( ;; ) + { + /* The high priority task starts by suspending itself. The low + priority task will unsuspend this task when required. */ + vTaskSuspend( NULL ); + + /* When this task unsuspends all it does is attempt to obtain + the mutex. It should find the mutex is not available so a + block time is specified. */ + if( xSemaphoreTake( xMutex, portMAX_DELAY ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + + /* When we eventually obtain the mutex we just give it back then + return to suspend ready for the next test. */ + if( xSemaphoreGive( xMutex ) != pdPASS ) + { + xErrorDetected = pdTRUE; + } + } +} +/*-----------------------------------------------------------*/ + +/* This is called to check that all the created tasks are still running. */ +portBASE_TYPE xAreGenericQueueTasksStillRunning( void ) +{ +static unsigned portLONG ulLastLoopCounter = 0, ulLastLoopCounter2 = 0; + + /* If the demo task is still running then we expect the loopcounters to + have incremented since this function was last called. */ + if( ulLastLoopCounter == ulLoopCounter ) + { + xErrorDetected = pdTRUE; + } + + if( ulLastLoopCounter2 == ulLoopCounter2 ) + { + xErrorDetected = pdTRUE; + } + + ulLastLoopCounter = ulLoopCounter; + ulLastLoopCounter2 = ulLoopCounter2; + + /* Errors detected in the task itself will have latched xErrorDetected + to true. */ + + return !xErrorDetected; +} + +
diff --git a/Demo/Common/include/GenQTest.h b/Demo/Common/include/GenQTest.h new file mode 100644 index 0000000..8adbb7b --- /dev/null +++ b/Demo/Common/include/GenQTest.h
@@ -0,0 +1,45 @@ +/* + FreeRTOS.org V4.4.0 - Copyright (C) 2003-2007 Richard Barry. + + This file is part of the FreeRTOS.org distribution. + + FreeRTOS.org is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + FreeRTOS.org is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FreeRTOS.org; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + A special exception to the GPL can be applied should you wish to distribute + a combined work that includes FreeRTOS.org, without being obliged to provide + the source code for any proprietary components. See the licensing section + of http://www.FreeRTOS.org for full details of how and when the exception + can be applied. + + *************************************************************************** + See http://www.FreeRTOS.org for documentation, latest information, license + and contact details. Please ensure to read the configuration and relevant + port sections of the online documentation. + + Also see http://www.SafeRTOS.com for an IEC 61508 compliant version along + with commercial development and support options. + *************************************************************************** +*/ + +#ifndef GEN_Q_TEST_H +#define GEN_Q_TEST_H + +void vStartGenericQueueTasks( unsigned portBASE_TYPE uxPriority ); +portBASE_TYPE xAreGenericQueueTasksStillRunning( void ); + +#endif /* GEN_Q_TEST_H */ + + +
diff --git a/Demo/PC/FreeRTOSConfig.h b/Demo/PC/FreeRTOSConfig.h index 0920a60..97eb232 100644 --- a/Demo/PC/FreeRTOSConfig.h +++ b/Demo/PC/FreeRTOSConfig.h
@@ -53,13 +53,14 @@ #define configUSE_IDLE_HOOK 1 #define configUSE_TICK_HOOK 1 #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 128 ) /* This can be made smaller if required. */ +#define configMINIMAL_STACK_SIZE ( ( unsigned portSHORT ) 256 ) /* This can be made smaller if required. */ #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 32 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 1 #define configIDLE_SHOULD_YIELD 1 #define configUSE_CO_ROUTINES 1 +#define configUSE_MUTEXES 1 #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 10 ) #define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
diff --git a/Demo/PC/main.c b/Demo/PC/main.c index 055095f..6811bbb 100644 --- a/Demo/PC/main.c +++ b/Demo/PC/main.c
@@ -119,6 +119,7 @@ #include "mevents.h" #include "crhook.h" #include "blocktim.h" +#include "GenQTest.h" /* Priority definitions for the tasks in the demo application. */ #define mainLED_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) @@ -128,6 +129,7 @@ #define mainQUEUE_BLOCK_PRIORITY ( tskIDLE_PRIORITY + 3 ) #define mainCOM_TEST_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define mainSEMAPHORE_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 ) +#define mainGENERIC_QUEUE_PRIORITY ( tskIDLE_PRIORITY ) #define mainPRINT_STACK_SIZE ( ( unsigned portSHORT ) 512 ) #define mainDEBUG_LOG_BUFFER_SIZE ( ( unsigned portSHORT ) 20480 ) @@ -176,7 +178,7 @@ vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY ); vStartBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY ); vCreateBlockTimeTasks(); - + vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY ); vStartSemaphoreTasks( mainSEMAPHORE_TASK_PRIORITY ); vStartDynamicPriorityTasks(); vStartMultiEventTasks(); @@ -391,6 +393,12 @@ sErrorHasOccurred = pdTRUE; } + if( xAreGenericQueueTasksStillRunning() != pdTRUE ) + { + vDisplayMessage( "Error in generic queue test task!\r\n" ); + sErrorHasOccurred = pdTRUE; + } + if( sErrorHasOccurred == pdFALSE ) { vDisplayMessage( "OK " );
diff --git a/Demo/PC/rtosdemo.tgt b/Demo/PC/rtosdemo.tgt index 7b5f2d6..5359514 100644 --- a/Demo/PC/rtosdemo.tgt +++ b/Demo/PC/rtosdemo.tgt
@@ -15,7 +15,7 @@ de6en 1 0 -0 +1 4 MCommand 0 @@ -75,7 +75,7 @@ 0 19 WPickList -50 +52 20 MItem 3 @@ -97,11 +97,11 @@ WString 25 d????Include directories: -1 +0 26 WString -97 -$(%watcom)\h;..\common\include;..\..\source\include;..\..\source\portable\owatcom\16bitdos\common +99 +$(%watcom)\h;..\common\include;..\..\source\include;..\..\source\portable\owatcom\16bitdos\common;. 0 27 MCState @@ -113,7 +113,7 @@ WString 26 ?????Force ANSI compliance -1 +0 1 30 MCState @@ -125,7 +125,7 @@ WString 33 ?????Disable stack depth checking -1 +0 1 33 MVState @@ -137,11 +137,11 @@ WString 23 ?????Macro definitions: -1 +0 36 WString -52 -OPEN_WATCOM_INDUSTRIAL_PC_PORT USE_STDIO DEBUG_BUILD +40 +OPEN_WATCOM_INDUSTRIAL_PC_PORT USE_STDIO 0 37 MCState @@ -153,7 +153,7 @@ WString 34 ?????Change char default to signed -1 +0 1 40 MRState @@ -163,10 +163,10 @@ WCC 42 WString -21 -?????Compiler default -1 +29 +?????No debugging information 0 +1 43 MRState 44 @@ -175,9 +175,9 @@ WCC 45 WString -21 -?????Compiler default -1 +28 +?????Line number information +0 0 46 MRState @@ -187,22 +187,22 @@ WCC 48 WString -25 -?????Floating-point calls -1 -1 +21 +?????Compiler default +0 +0 49 -MCState +MRState 50 WString 3 WCC 51 WString -31 -???e?SS not assumed equal to DS -1 -1 +21 +?????Compiler default +0 +0 52 MRState 53 @@ -211,114 +211,114 @@ WCC 54 WString -9 -??6??8086 -1 +25 +?????Floating-point calls 0 +1 55 -MRState +MCState 56 WString 3 WCC 57 WString -10 -??6??80186 -1 +31 +???e?SS not assumed equal to DS +0 1 58 -MVState +MRState 59 WString 3 WCC 60 WString -25 -d????Include directories: +9 +??6??8086 +0 0 61 -WString -99 -$(%watcom)\h;..\common\include;..\..\source\include;..\..\source\portable\owatcom\16bitdos\common;. -0 +MRState 62 -MCState +WString +3 +WCC 63 WString -3 -WCC -64 -WString -26 -?????Force ANSI compliance +10 +??6??80186 0 1 +64 +MVState 65 -MCState +WString +3 +WCC 66 WString -3 -WCC +25 +d????Include directories: +1 67 WString -33 -?????Disable stack depth checking +97 +$(%watcom)\h;..\common\include;..\..\source\include;..\..\source\portable\owatcom\16bitdos\common 0 -1 68 -MVState +MCState 69 WString 3 WCC 70 WString -23 -?????Macro definitions: -0 +26 +?????Force ANSI compliance +1 +1 71 -WString -40 -OPEN_WATCOM_INDUSTRIAL_PC_PORT USE_STDIO -0 +MVState 72 -MCState -73 WString 3 WCC +73 +WString +23 +?????Macro definitions: +1 74 WString -34 -?????Change char default to signed +52 +OPEN_WATCOM_INDUSTRIAL_PC_PORT USE_STDIO DEBUG_BUILD 0 -1 75 -MRState +MCState 76 WString 3 WCC 77 WString -29 -?????No debugging information -0 +34 +?????Change char default to signed +1 1 78 -MRState +MCState 79 WString 3 WCC 80 WString -28 -?????Line number information -0 -0 +33 +?????Disable stack depth checking +1 +1 81 MRState 82 @@ -329,7 +329,7 @@ WString 21 ?????Compiler default -0 +1 0 84 MRState @@ -341,7 +341,7 @@ WString 21 ?????Compiler default -0 +1 0 87 MRState @@ -353,7 +353,7 @@ WString 25 ?????Floating-point calls -0 +1 1 90 MCState @@ -365,7 +365,7 @@ WString 31 ???e?SS not assumed equal to DS -0 +1 1 93 MRState @@ -377,7 +377,7 @@ WString 9 ??6??8086 -0 +1 0 96 MRState @@ -389,7 +389,7 @@ WString 10 ??6??80186 -0 +1 1 99 WVList @@ -760,8 +760,8 @@ 0 180 MItem -15 -fileio\fileio.c +28 +..\COMMON\MINIMAL\GenQTest.c 181 WString 4 @@ -778,8 +778,8 @@ 0 184 MItem -6 -main.c +15 +fileio\fileio.c 185 WString 4 @@ -796,8 +796,8 @@ 0 188 MItem -17 -partest\partest.c +6 +main.c 189 WString 4 @@ -814,8 +814,8 @@ 0 192 MItem -15 -serial\serial.c +17 +partest\partest.c 193 WString 4 @@ -832,26 +832,26 @@ 0 196 MItem -3 -*.h +15 +serial\serial.c 197 WString -3 -NIL +4 +COBJ 198 WVList 0 199 WVList 0 --1 +20 1 -0 +1 0 200 MItem -31 -..\..\SOURCE\INCLUDE\croutine.h +3 +*.h 201 WString 3 @@ -862,14 +862,14 @@ 203 WVList 0 -196 +-1 1 -1 +0 0 204 MItem -27 -..\..\source\include\list.h +31 +..\..\SOURCE\INCLUDE\croutine.h 205 WString 3 @@ -880,14 +880,14 @@ 207 WVList 0 -196 +200 1 1 0 208 MItem -31 -..\..\source\include\portable.h +27 +..\..\source\include\list.h 209 WString 3 @@ -898,14 +898,14 @@ 211 WVList 0 -196 +200 1 1 0 212 MItem 31 -..\..\source\include\projdefs.h +..\..\source\include\portable.h 213 WString 3 @@ -916,14 +916,14 @@ 215 WVList 0 -196 +200 1 1 0 216 MItem -28 -..\..\source\include\queue.h +31 +..\..\source\include\projdefs.h 217 WString 3 @@ -934,14 +934,14 @@ 219 WVList 0 -196 +200 1 1 0 220 MItem -29 -..\..\source\include\semphr.h +28 +..\..\source\include\queue.h 221 WString 3 @@ -952,14 +952,14 @@ 223 WVList 0 -196 +200 1 1 0 224 MItem -27 -..\..\source\include\task.h +29 +..\..\source\include\semphr.h 225 WString 3 @@ -970,14 +970,14 @@ 227 WVList 0 -196 +200 1 1 0 228 MItem -55 -..\..\source\portable\owatcom\16bitdos\common\portasm.h +27 +..\..\source\include\task.h 229 WString 3 @@ -988,14 +988,14 @@ 231 WVList 0 -196 +200 1 1 0 232 MItem -53 -..\..\source\portable\owatcom\16bitdos\pc\portmacro.h +55 +..\..\source\portable\owatcom\16bitdos\common\portasm.h 233 WString 3 @@ -1006,14 +1006,14 @@ 235 WVList 0 -196 +200 1 1 0 236 MItem -26 -..\common\include\blockq.h +53 +..\..\source\portable\owatcom\16bitdos\pc\portmacro.h 237 WString 3 @@ -1024,14 +1024,14 @@ 239 WVList 0 -196 +200 1 1 0 240 MItem -28 -..\COMMON\INCLUDE\blocktim.h +26 +..\common\include\blockq.h 241 WString 3 @@ -1042,14 +1042,14 @@ 243 WVList 0 -196 +200 1 1 0 244 MItem -27 -..\common\include\comtest.h +28 +..\COMMON\INCLUDE\blocktim.h 245 WString 3 @@ -1060,14 +1060,14 @@ 247 WVList 0 -196 +200 1 1 0 248 MItem -26 -..\COMMON\INCLUDE\crhook.h +27 +..\common\include\comtest.h 249 WString 3 @@ -1078,14 +1078,14 @@ 251 WVList 0 -196 +200 1 1 0 252 MItem -25 -..\common\include\death.h +26 +..\COMMON\INCLUDE\crhook.h 253 WString 3 @@ -1096,14 +1096,14 @@ 255 WVList 0 -196 +200 1 1 0 256 MItem -27 -..\COMMON\INCLUDE\dynamic.h +25 +..\common\include\death.h 257 WString 3 @@ -1114,14 +1114,14 @@ 259 WVList 0 -196 +200 1 1 0 260 MItem -26 -..\common\include\fileio.h +27 +..\COMMON\INCLUDE\dynamic.h 261 WString 3 @@ -1132,14 +1132,14 @@ 263 WVList 0 -196 +200 1 1 0 264 MItem -25 -..\common\include\flash.h +26 +..\common\include\fileio.h 265 WString 3 @@ -1150,14 +1150,14 @@ 267 WVList 0 -196 +200 1 1 0 268 MItem -24 -..\common\include\flop.h +25 +..\common\include\flash.h 269 WString 3 @@ -1168,14 +1168,14 @@ 271 WVList 0 -196 +200 1 1 0 272 MItem -27 -..\common\include\partest.h +24 +..\common\include\flop.h 273 WString 3 @@ -1186,14 +1186,14 @@ 275 WVList 0 -196 +200 1 1 0 276 MItem -25 -..\common\include\pollq.h +28 +..\COMMON\INCLUDE\GenQTest.h 277 WString 3 @@ -1204,14 +1204,14 @@ 279 WVList 0 -196 +200 1 1 0 280 MItem -25 -..\common\include\print.h +27 +..\common\include\partest.h 281 WString 3 @@ -1222,14 +1222,14 @@ 283 WVList 0 -196 +200 1 1 0 284 MItem -27 -..\common\include\semtest.h +25 +..\common\include\pollq.h 285 WString 3 @@ -1240,14 +1240,14 @@ 287 WVList 0 -196 +200 1 1 0 288 MItem -26 -..\common\include\serial.h +25 +..\common\include\print.h 289 WString 3 @@ -1258,14 +1258,14 @@ 291 WVList 0 -196 +200 1 1 0 292 MItem -16 -FreeRTOSConfig.h +27 +..\common\include\semtest.h 293 WString 3 @@ -1276,7 +1276,43 @@ 295 WVList 0 -196 +200 +1 +1 +0 +296 +MItem +26 +..\common\include\serial.h +297 +WString +3 +NIL +298 +WVList +0 +299 +WVList +0 +200 +1 +1 +0 +300 +MItem +16 +FreeRTOSConfig.h +301 +WString +3 +NIL +302 +WVList +0 +303 +WVList +0 +200 1 1 0
diff --git a/Demo/PC/rtosdemo.wpj b/Demo/PC/rtosdemo.wpj index 1b02cfb..25dbb7d 100644 --- a/Demo/PC/rtosdemo.wpj +++ b/Demo/PC/rtosdemo.wpj
@@ -31,7 +31,7 @@ 0 0 7168 -7168 +8523 0 0 9 @@ -39,5 +39,5 @@ 12 rtosdemo.tgt 0 -25 +26 7
diff --git a/Demo/PC/serial/serial.c b/Demo/PC/serial/serial.c index 566530b..b8625d7 100644 --- a/Demo/PC/serial/serial.c +++ b/Demo/PC/serial/serial.c
@@ -500,6 +500,7 @@ portSHORT sInterruptID; portCHAR cIn, cOut; portBASE_TYPE xTaskWokenByPost = pdFALSE, xAnotherTaskWokenByPost = pdFALSE, xTaskWokenByTx = pdFALSE; +extern void vComTestUnsuspendTask( void ); portOUTPUT_BYTE( pxPort->us8259InterruptMaskReg, ( portINPUT_BYTE( pxPort->us8259InterruptMaskReg) | ~pxPort->ucInterruptEnableMast ) );