2 FreeRTOS V9.0.0rc1 - Copyright (C) 2016 Real Time Engineers Ltd.
\r
5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
7 This file is part of the FreeRTOS distribution.
\r
9 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
10 the terms of the GNU General Public License (version 2) as published by the
\r
11 Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
\r
13 ***************************************************************************
\r
14 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
15 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
16 >>! obliged to provide the source code for proprietary components !<<
\r
17 >>! outside of the FreeRTOS kernel. !<<
\r
18 ***************************************************************************
\r
20 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
22 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
23 link: http://www.freertos.org/a00114.html
\r
25 ***************************************************************************
\r
27 * FreeRTOS provides completely free yet professionally developed, *
\r
28 * robust, strictly quality controlled, supported, and cross *
\r
29 * platform software that is more than just the market leader, it *
\r
30 * is the industry's de facto standard. *
\r
32 * Help yourself get started quickly while simultaneously helping *
\r
33 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
34 * tutorial book, reference manual, or both: *
\r
35 * http://www.FreeRTOS.org/Documentation *
\r
37 ***************************************************************************
\r
39 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
\r
40 the FAQ page "My application does not run, what could be wrong?". Have you
\r
41 defined configASSERT()?
\r
43 http://www.FreeRTOS.org/support - In return for receiving this top quality
\r
44 embedded software for free we request you assist our global community by
\r
45 participating in the support forum.
\r
47 http://www.FreeRTOS.org/training - Investing in training allows your team to
\r
48 be as productive as possible as early as possible. Now you can receive
\r
49 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
\r
50 Ltd, and the world's leading authority on the world's leading RTOS.
\r
52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
54 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
56 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
57 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
59 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
\r
60 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
61 licenses offer ticketed support, indemnification and commercial middleware.
\r
63 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
64 engineered and independently SIL3 certified version for use in safety and
\r
65 mission critical applications that require provable dependability.
\r
71 *******************************************************************************
\r
72 * NOTE 1: The Win32 port is a simulation (or is that emulation?) only! Do not
\r
73 * expect to get real time behaviour from the Win32 port or this demo
\r
74 * application. It is provided as a convenient development and demonstration
\r
75 * test bed only. This was tested using Windows XP on a dual core laptop.
\r
77 * Windows will not be running the FreeRTOS simulator threads continuously, so
\r
78 * the timing information in the FreeRTOS+Trace logs have no meaningful units.
\r
79 * See the documentation page for the Windows simulator for an explanation of
\r
81 * http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html
\r
82 * - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -
\r
84 * NOTE 2: This project provides two demo applications. A simple blinky style
\r
85 * project, and a more comprehensive test and demo application. The
\r
86 * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
\r
87 * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
\r
88 * in main.c. This file implements the comprehensive test and demo version.
\r
90 * NOTE 3: This file only contains the source code that is specific to the
\r
91 * basic demo. Generic functions, such FreeRTOS hook functions, are defined in
\r
93 *******************************************************************************
\r
95 * main() creates all the demo application tasks, then starts the scheduler.
\r
96 * The web documentation provides more details of the standard demo application
\r
97 * tasks, which provide no particular functionality but do provide a good
\r
98 * example of how to use the FreeRTOS API.
\r
100 * In addition to the standard demo tasks, the following tasks and tests are
\r
101 * defined and/or created within this file:
\r
103 * "Check" task - This only executes every five seconds but has a high priority
\r
104 * to ensure it gets processor time. Its main function is to check that all the
\r
105 * standard demo tasks are still operational. While no errors have been
\r
106 * discovered the check task will print out "OK" and the current simulated tick
\r
107 * time. If an error is discovered in the execution of a task then the check
\r
108 * task will print out an appropriate error message.
\r
113 /* Standard includes. */
\r
115 #include <stdlib.h>
\r
117 /* Kernel includes. */
\r
118 #include <FreeRTOS.h>
\r
121 #include "timers.h"
\r
122 #include "semphr.h"
\r
124 /* Standard demo includes. */
\r
125 #include "BlockQ.h"
\r
126 #include "integer.h"
\r
127 #include "semtest.h"
\r
129 #include "GenQTest.h"
\r
131 #include "recmutex.h"
\r
133 #include "TimerDemo.h"
\r
134 #include "countsem.h"
\r
136 #include "dynamic.h"
\r
137 #include "QueueSet.h"
\r
138 #include "QueueOverwrite.h"
\r
139 #include "EventGroupsDemo.h"
\r
140 #include "IntSemTest.h"
\r
141 #include "TaskNotify.h"
\r
142 #include "QueueSetPolling.h"
\r
143 #include "blocktim.h"
\r
144 #include "AbortDelay.h"
\r
146 /* Priorities at which the tasks are created. */
\r
147 #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )
\r
148 #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
149 #define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
150 #define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
151 #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
\r
152 #define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
153 #define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
154 #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
155 #define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
156 #define mainQUEUE_OVERWRITE_PRIORITY ( tskIDLE_PRIORITY )
\r
158 #define mainTIMER_TEST_PERIOD ( 50 )
\r
160 /* Task function prototypes. */
\r
161 static void prvCheckTask( void *pvParameters );
\r
163 /* A task that is created from the idle task to test the functionality of
\r
164 eTaskStateGet(). */
\r
165 static void prvTestTask( void *pvParameters );
\r
168 * Called from the idle task hook function to demonstrate a few utility
\r
169 * functions that are not demonstrated by any of the standard demo tasks.
\r
171 static void prvDemonstrateTaskStateAndHandleGetFunctions( void );
\r
174 * Called from the idle task hook function to demonstrate the use of
\r
175 * xTimerPendFunctionCall() as xTimerPendFunctionCall() is not demonstrated by
\r
176 * any of the standard demo tasks.
\r
178 static void prvDemonstratePendingFunctionCall( void );
\r
181 * The function that is pended by prvDemonstratePendingFunctionCall().
\r
183 static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 );
\r
186 * A task to demonstrate the use of the xQueueSpacesAvailable() function.
\r
188 static void prvDemoQueueSpaceFunctions( void *pvParameters );
\r
190 /*-----------------------------------------------------------*/
\r
192 /* The variable into which error messages are latched. */
\r
193 static char *pcStatusMessage = "OK";
\r
195 /* This semaphore is created purely to test using the vSemaphoreDelete() and
\r
196 semaphore tracing API functions. It has no other purpose. */
\r
197 static SemaphoreHandle_t xMutexToDelete = NULL;
\r
199 /*-----------------------------------------------------------*/
\r
201 int main_full( void )
\r
203 /* Start the check task as described at the top of this file. */
\r
204 xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
\r
206 /* Create the standard demo tasks. */
\r
207 vStartTaskNotifyTask();
\r
208 vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
\r
209 vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
\r
210 vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
\r
211 vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
\r
212 vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
\r
213 vStartQueuePeekTasks();
\r
214 vStartMathTasks( mainFLOP_TASK_PRIORITY );
\r
215 vStartRecursiveMutexTasks();
\r
216 vStartCountingSemaphoreTasks();
\r
217 vStartDynamicPriorityTasks();
\r
218 vStartQueueSetTasks();
\r
219 vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );
\r
220 xTaskCreate( prvDemoQueueSpaceFunctions, "QSpace", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
\r
221 vStartEventGroupTasks();
\r
222 vStartInterruptSemaphoreTasks();
\r
223 vStartQueueSetPollingTask();
\r
224 vCreateBlockTimeTasks();
\r
225 vCreateAbortDelayTasks();
\r
227 #if( configUSE_PREEMPTION != 0 )
\r
229 /* Don't expect these tasks to pass when preemption is not used. */
\r
230 vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
\r
234 /* The suicide tasks must be created last as they need to know how many
\r
235 tasks were running prior to their creation. This then allows them to
\r
236 ascertain whether or not the correct/expected number of tasks are running at
\r
238 vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
\r
240 /* Create the semaphore that will be deleted in the idle task hook. This
\r
241 is done purely to test the use of vSemaphoreDelete(). */
\r
242 xMutexToDelete = xSemaphoreCreateMutex();
\r
244 /* Start the scheduler itself. */
\r
245 vTaskStartScheduler();
\r
247 /* Should never get here unless there was not enough heap space to create
\r
248 the idle and other system tasks. */
\r
251 /*-----------------------------------------------------------*/
\r
253 static void prvCheckTask( void *pvParameters )
\r
255 TickType_t xNextWakeTime;
\r
256 const TickType_t xCycleFrequency = pdMS_TO_TICKS( 2500UL );
\r
258 /* Just to remove compiler warning. */
\r
259 ( void ) pvParameters;
\r
261 /* Initialise xNextWakeTime - this only needs to be done once. */
\r
262 xNextWakeTime = xTaskGetTickCount();
\r
266 /* Place this task in the blocked state until it is time to run again. */
\r
267 vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );
\r
269 /* Check the standard demo tasks are running without error. */
\r
270 #if( configUSE_PREEMPTION != 0 )
\r
272 /* These tasks are only created when preemption is used. */
\r
273 if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )
\r
275 pcStatusMessage = "Error: TimerDemo";
\r
280 if( xAreTaskNotificationTasksStillRunning() != pdTRUE )
\r
282 pcStatusMessage = "Error: Notification";
\r
285 if( xAreInterruptSemaphoreTasksStillRunning() != pdTRUE )
\r
287 pcStatusMessage = "Error: IntSem";
\r
289 else if( xAreEventGroupTasksStillRunning() != pdTRUE )
\r
291 pcStatusMessage = "Error: EventGroup";
\r
293 else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
\r
295 pcStatusMessage = "Error: IntMath";
\r
297 else if( xAreGenericQueueTasksStillRunning() != pdTRUE )
\r
299 pcStatusMessage = "Error: GenQueue";
\r
301 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
\r
303 pcStatusMessage = "Error: QueuePeek";
\r
305 else if( xAreBlockingQueuesStillRunning() != pdTRUE )
\r
307 pcStatusMessage = "Error: BlockQueue";
\r
309 else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
\r
311 pcStatusMessage = "Error: SemTest";
\r
313 else if( xArePollingQueuesStillRunning() != pdTRUE )
\r
315 pcStatusMessage = "Error: PollQueue";
\r
317 else if( xAreMathsTaskStillRunning() != pdPASS )
\r
319 pcStatusMessage = "Error: Flop";
\r
321 else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
\r
323 pcStatusMessage = "Error: RecMutex";
\r
325 else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
\r
327 pcStatusMessage = "Error: CountSem";
\r
329 else if( xIsCreateTaskStillRunning() != pdTRUE )
\r
331 pcStatusMessage = "Error: Death";
\r
333 else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )
\r
335 pcStatusMessage = "Error: Dynamic";
\r
337 else if( xAreQueueSetTasksStillRunning() != pdPASS )
\r
339 pcStatusMessage = "Error: Queue set";
\r
341 else if( xIsQueueOverwriteTaskStillRunning() != pdPASS )
\r
343 pcStatusMessage = "Error: Queue overwrite";
\r
345 else if( xAreQueueSetPollTasksStillRunning() != pdPASS )
\r
347 pcStatusMessage = "Error: Queue set polling";
\r
349 else if( xAreBlockTimeTestTasksStillRunning() != pdPASS )
\r
351 pcStatusMessage = "Error: Block time";
\r
353 else if( xAreAbortDelayTestTasksStillRunning() != pdPASS )
\r
355 pcStatusMessage = "Error: Abort delay";
\r
358 /* This is the only task that uses stdout so its ok to call printf()
\r
360 printf( ( char * ) "%s - %u\r\n", pcStatusMessage, ( unsigned int ) xTaskGetTickCount() );
\r
364 /*-----------------------------------------------------------*/
\r
366 static void prvTestTask( void *pvParameters )
\r
368 const unsigned long ulMSToSleep = 5;
\r
370 /* Just to remove compiler warnings. */
\r
371 ( void ) pvParameters;
\r
373 /* This task is just used to test the eTaskStateGet() function. It
\r
374 does not have anything to do. */
\r
377 /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are
\r
378 tasks waiting to be terminated by the idle task. */
\r
379 Sleep( ulMSToSleep );
\r
382 /*-----------------------------------------------------------*/
\r
384 /* Called from vApplicationIdleHook(), which is defined in main.c. */
\r
385 void vFullDemoIdleFunction( void )
\r
387 const unsigned long ulMSToSleep = 15;
\r
390 /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are
\r
391 tasks waiting to be terminated by the idle task. */
\r
392 Sleep( ulMSToSleep );
\r
394 /* Demonstrate a few utility functions that are not demonstrated by any of
\r
395 the standard demo tasks. */
\r
396 prvDemonstrateTaskStateAndHandleGetFunctions();
\r
398 /* Demonstrate the use of xTimerPendFunctionCall(), which is not
\r
399 demonstrated by any of the standard demo tasks. */
\r
400 prvDemonstratePendingFunctionCall();
\r
402 /* If xMutexToDelete has not already been deleted, then delete it now.
\r
403 This is done purely to demonstrate the use of, and test, the
\r
404 vSemaphoreDelete() macro. Care must be taken not to delete a semaphore
\r
405 that has tasks blocked on it. */
\r
406 if( xMutexToDelete != NULL )
\r
408 vSemaphoreDelete( xMutexToDelete );
\r
409 xMutexToDelete = NULL;
\r
412 /* Exercise heap_5 a bit. The malloc failed hook will trap failed
\r
413 allocations so there is no need to test here. */
\r
414 pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );
\r
415 vPortFree( pvAllocated );
\r
417 /*-----------------------------------------------------------*/
\r
419 /* Called by vApplicationTickHook(), which is defined in main.c. */
\r
420 void vFullDemoTickHookFunction( void )
\r
422 /* Call the periodic timer test, which tests the timer API functions that
\r
423 can be called from an ISR. */
\r
424 #if( configUSE_PREEMPTION != 0 )
\r
426 /* Only created when preemption is used. */
\r
427 vTimerPeriodicISRTests();
\r
431 /* Call the periodic queue overwrite from ISR demo. */
\r
432 vQueueOverwritePeriodicISRDemo();
\r
434 /* Write to a queue that is in use as part of the queue set demo to
\r
435 demonstrate using queue sets from an ISR. */
\r
436 vQueueSetAccessQueueSetFromISR();
\r
437 vQueueSetPollingInterruptAccess();
\r
439 /* Exercise event groups from interrupts. */
\r
440 vPeriodicEventGroupsProcessing();
\r
442 /* Exercise giving mutexes from an interrupt. */
\r
443 vInterruptSemaphorePeriodicTest();
\r
445 /* Exercise using task notifications from an interrupt. */
\r
446 xNotifyTaskFromISR();
\r
448 /*-----------------------------------------------------------*/
\r
450 static void prvPendedFunction( void *pvParameter1, uint32_t ulParameter2 )
\r
452 static uint32_t ulLastParameter1 = 1000UL, ulLastParameter2 = 0UL;
\r
453 uint32_t ulParameter1;
\r
455 ulParameter1 = ( uint32_t ) pvParameter1;
\r
457 /* Ensure the parameters are as expected. */
\r
458 configASSERT( ulParameter1 == ( ulLastParameter1 + 1 ) );
\r
459 configASSERT( ulParameter2 == ( ulLastParameter2 + 1 ) );
\r
461 /* Remember the parameters for the next time the function is called. */
\r
462 ulLastParameter1 = ulParameter1;
\r
463 ulLastParameter2 = ulParameter2;
\r
465 /*-----------------------------------------------------------*/
\r
467 static void prvDemonstratePendingFunctionCall( void )
\r
469 static uint32_t ulParameter1 = 1000UL, ulParameter2 = 0UL;
\r
470 const TickType_t xDontBlock = 0; /* This is called from the idle task so must *not* attempt to block. */
\r
472 /* prvPendedFunction() just expects the parameters to be incremented by one
\r
473 each time it is called. */
\r
477 /* Pend the function call, sending the parameters. */
\r
478 xTimerPendFunctionCall( prvPendedFunction, ( void * ) ulParameter1, ulParameter2, xDontBlock );
\r
480 /*-----------------------------------------------------------*/
\r
482 static void prvDemonstrateTaskStateAndHandleGetFunctions( void )
\r
484 TaskHandle_t xIdleTaskHandle, xTimerTaskHandle;
\r
486 static portBASE_TYPE xPerformedOneShotTests = pdFALSE;
\r
487 TaskHandle_t xTestTask;
\r
489 /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and
\r
490 xTaskGetIdleTaskHandle() functions. Also try using the function that sets
\r
491 the task number. */
\r
492 xIdleTaskHandle = xTaskGetIdleTaskHandle();
\r
493 xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle();
\r
495 /* This is the idle hook, so the current task handle should equal the
\r
496 returned idle task handle. */
\r
497 if( xTaskGetCurrentTaskHandle() != xIdleTaskHandle )
\r
499 pcStatusMessage = "Error: Returned idle task handle was incorrect";
\r
502 /* Check the timer task handle was returned correctly. */
\r
503 pcTaskName = pcTaskGetName( xTimerTaskHandle );
\r
504 if( strcmp( pcTaskName, "Tmr Svc" ) != 0 )
\r
506 pcStatusMessage = "Error: Returned timer task handle was incorrect";
\r
509 /* This task is running, make sure it's state is returned as running. */
\r
510 if( eTaskStateGet( xIdleTaskHandle ) != eRunning )
\r
512 pcStatusMessage = "Error: Returned idle task state was incorrect";
\r
515 /* If this task is running, then the timer task must be blocked. */
\r
516 if( eTaskStateGet( xTimerTaskHandle ) != eBlocked )
\r
518 pcStatusMessage = "Error: Returned timer task state was incorrect";
\r
521 /* Other tests that should only be performed once follow. The test task
\r
522 is not created on each iteration because to do so would cause the death
\r
523 task to report an error (too many tasks running). */
\r
524 if( xPerformedOneShotTests == pdFALSE )
\r
526 /* Don't run this part of the test again. */
\r
527 xPerformedOneShotTests = pdTRUE;
\r
529 /* Create a test task to use to test other eTaskStateGet() return values. */
\r
530 if( xTaskCreate( prvTestTask, "Test", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, &xTestTask ) == pdPASS )
\r
532 /* If this task is running, the test task must be in the ready state. */
\r
533 if( eTaskStateGet( xTestTask ) != eReady )
\r
535 pcStatusMessage = "Error: Returned test task state was incorrect 1";
\r
538 /* Now suspend the test task and check its state is reported correctly. */
\r
539 vTaskSuspend( xTestTask );
\r
540 if( eTaskStateGet( xTestTask ) != eSuspended )
\r
542 pcStatusMessage = "Error: Returned test task state was incorrect 2";
\r
545 /* Now delete the task and check its state is reported correctly. */
\r
546 vTaskDelete( xTestTask );
\r
547 if( eTaskStateGet( xTestTask ) != eDeleted )
\r
549 pcStatusMessage = "Error: Returned test task state was incorrect 3";
\r
554 /*-----------------------------------------------------------*/
\r
556 static void prvDemoQueueSpaceFunctions( void *pvParameters )
\r
558 QueueHandle_t xQueue = NULL;
\r
559 const unsigned portBASE_TYPE uxQueueLength = 10;
\r
560 unsigned portBASE_TYPE uxReturn, x;
\r
562 /* Remove compiler warnings. */
\r
563 ( void ) pvParameters;
\r
565 /* Create the queue that will be used. Nothing is actually going to be
\r
566 sent or received so the queue item size is set to 0. */
\r
567 xQueue = xQueueCreate( uxQueueLength, 0 );
\r
568 configASSERT( xQueue );
\r
572 for( x = 0; x < uxQueueLength; x++ )
\r
574 /* Ask how many messages are available... */
\r
575 uxReturn = uxQueueMessagesWaiting( xQueue );
\r
577 /* Check the number of messages being reported as being available
\r
578 is as expected, and force an assert if not. */
\r
579 if( uxReturn != x )
\r
581 /* xQueue cannot be NULL so this is deliberately causing an
\r
582 assert to be triggered as there is an error. */
\r
583 configASSERT( xQueue == NULL );
\r
586 /* Ask how many spaces remain in the queue... */
\r
587 uxReturn = uxQueueSpacesAvailable( xQueue );
\r
589 /* Check the number of spaces being reported as being available
\r
590 is as expected, and force an assert if not. */
\r
591 if( uxReturn != ( uxQueueLength - x ) )
\r
593 /* xQueue cannot be NULL so this is deliberately causing an
\r
594 assert to be triggered as there is an error. */
\r
595 configASSERT( xQueue == NULL );
\r
598 /* Fill one more space in the queue. */
\r
599 xQueueSendToBack( xQueue, NULL, 0 );
\r
602 /* Perform the same check while the queue is full. */
\r
603 uxReturn = uxQueueMessagesWaiting( xQueue );
\r
604 if( uxReturn != uxQueueLength )
\r
606 configASSERT( xQueue == NULL );
\r
609 uxReturn = uxQueueSpacesAvailable( xQueue );
\r
611 if( uxReturn != 0 )
\r
613 configASSERT( xQueue == NULL );
\r
616 /* The queue is full, start again. */
\r
617 xQueueReset( xQueue );
\r
619 #if( configUSE_PREEMPTION == 0 )
\r