]> begriffs open source - cmsis-freertos/blob - Demo/Common/Full/dynamic.c
Update cmsis_os2.c
[cmsis-freertos] / Demo / Common / Full / dynamic.c
1 /*
2     FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
3     All rights reserved
4
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6
7     This file is part of the FreeRTOS distribution.
8
9     FreeRTOS is free software; you can redistribute it and/or modify it under
10     the terms of the GNU General Public License (version 2) as published by the
11     Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
12
13     ***************************************************************************
14     >>!   NOTE: The modification to the GPL is included to allow you to     !<<
15     >>!   distribute a combined work that includes FreeRTOS without being   !<<
16     >>!   obliged to provide the source code for proprietary components     !<<
17     >>!   outside of the FreeRTOS kernel.                                   !<<
18     ***************************************************************************
19
20     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
21     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22     FOR A PARTICULAR PURPOSE.  Full license text is available on the following
23     link: http://www.freertos.org/a00114.html
24
25     ***************************************************************************
26      *                                                                       *
27      *    FreeRTOS provides completely free yet professionally developed,    *
28      *    robust, strictly quality controlled, supported, and cross          *
29      *    platform software that is more than just the market leader, it     *
30      *    is the industry's de facto standard.                               *
31      *                                                                       *
32      *    Help yourself get started quickly while simultaneously helping     *
33      *    to support the FreeRTOS project by purchasing a FreeRTOS           *
34      *    tutorial book, reference manual, or both:                          *
35      *    http://www.FreeRTOS.org/Documentation                              *
36      *                                                                       *
37     ***************************************************************************
38
39     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading
40     the FAQ page "My application does not run, what could be wrong?".  Have you
41     defined configASSERT()?
42
43     http://www.FreeRTOS.org/support - In return for receiving this top quality
44     embedded software for free we request you assist our global community by
45     participating in the support forum.
46
47     http://www.FreeRTOS.org/training - Investing in training allows your team to
48     be as productive as possible as early as possible.  Now you can receive
49     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
50     Ltd, and the world's leading authority on the world's leading RTOS.
51
52     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
53     including FreeRTOS+Trace - an indispensable productivity tool, a DOS
54     compatible FAT file system, and our tiny thread aware UDP/IP stack.
55
56     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
57     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
58
59     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
60     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS
61     licenses offer ticketed support, indemnification and commercial middleware.
62
63     http://www.SafeRTOS.com - High Integrity Systems also provide a safety
64     engineered and independently SIL3 certified version for use in safety and
65     mission critical applications that require provable dependability.
66
67     1 tab == 4 spaces!
68 */
69
70 /**
71  * The first test creates three tasks - two counter tasks (one continuous count 
72  * and one limited count) and one controller.  A "count" variable is shared 
73  * between all three tasks.  The two counter tasks should never be in a "ready" 
74  * state at the same time.  The controller task runs at the same priority as 
75  * the continuous count task, and at a lower priority than the limited count 
76  * task.
77  *
78  * One counter task loops indefinitely, incrementing the shared count variable
79  * on each iteration.  To ensure it has exclusive access to the variable it
80  * raises it's priority above that of the controller task before each 
81  * increment, lowering it again to it's original priority before starting the
82  * next iteration.
83  *
84  * The other counter task increments the shared count variable on each
85  * iteration of it's loop until the count has reached a limit of 0xff - at
86  * which point it suspends itself.  It will not start a new loop until the 
87  * controller task has made it "ready" again by calling vTaskResume ().  
88  * This second counter task operates at a higher priority than controller 
89  * task so does not need to worry about mutual exclusion of the counter 
90  * variable.
91  *
92  * The controller task is in two sections.  The first section controls and
93  * monitors the continuous count task.  When this section is operational the 
94  * limited count task is suspended.  Likewise, the second section controls 
95  * and monitors the limited count task.  When this section is operational the 
96  * continuous count task is suspended.
97  *
98  * In the first section the controller task first takes a copy of the shared
99  * count variable.  To ensure mutual exclusion on the count variable it
100  * suspends the continuous count task, resuming it again when the copy has been
101  * taken.  The controller task then sleeps for a fixed period - during which
102  * the continuous count task will execute and increment the shared variable.
103  * When the controller task wakes it checks that the continuous count task
104  * has executed by comparing the copy of the shared variable with its current
105  * value.  This time, to ensure mutual exclusion, the scheduler itself is 
106  * suspended with a call to vTaskSuspendAll ().  This is for demonstration 
107  * purposes only and is not a recommended technique due to its inefficiency.
108  *
109  * After a fixed number of iterations the controller task suspends the 
110  * continuous count task, and moves on to its second section.
111  *
112  * At the start of the second section the shared variable is cleared to zero.
113  * The limited count task is then woken from it's suspension by a call to
114  * vTaskResume ().  As this counter task operates at a higher priority than
115  * the controller task the controller task should not run again until the
116  * shared variable has been counted up to the limited value causing the counter
117  * task to suspend itself.  The next line after vTaskResume () is therefore
118  * a check on the shared variable to ensure everything is as expected.
119  *
120  *
121  * The second test consists of a couple of very simple tasks that post onto a 
122  * queue while the scheduler is suspended.  This test was added to test parts
123  * of the scheduler not exercised by the first test.
124  *
125  *
126  * The final set of two tasks implements a third test.  This simply raises the
127  * priority of a task while the scheduler is suspended.  Again this test was
128  * added to exercise parts of the code not covered by the first test.
129  *
130  * \page Priorities dynamic.c
131  * \ingroup DemoFiles
132  * <HR>
133  */
134
135 /*
136 Changes from V2.0.0
137
138         + Delay periods are now specified using variables and constants of
139           TickType_t rather than unsigned long.
140         + Added a second, simple test that uses the functions 
141           vQueueReceiveWhenSuspendedTask() and vQueueSendWhenSuspendedTask().
142
143 Changes from V3.1.1
144
145         + Added a third simple test that uses the vTaskPrioritySet() function
146           while the scheduler is suspended.
147         + Modified the controller task slightly to test the calling of 
148           vTaskResumeAll() while the scheduler is suspended.
149 */
150
151 #include <stdlib.h>
152
153 /* Scheduler include files. */
154 #include "FreeRTOS.h"
155 #include "task.h"
156 #include "semphr.h"
157
158 /* Demo app include files. */
159 #include "dynamic.h"
160 #include "print.h"
161
162 /* Function that implements the "limited count" task as described above. */
163 static void vLimitedIncrementTask( void * pvParameters );
164
165 /* Function that implements the "continuous count" task as described above. */
166 static void vContinuousIncrementTask( void * pvParameters );
167
168 /* Function that implements the controller task as described above. */
169 static void vCounterControlTask( void * pvParameters );
170
171 /* The simple test functions that check sending and receiving while the
172 scheduler is suspended. */
173 static void vQueueReceiveWhenSuspendedTask( void *pvParameters );
174 static void vQueueSendWhenSuspendedTask( void *pvParameters );
175
176 /* The simple test functions that check raising and lowering of task priorities
177 while the scheduler is suspended. */
178 static void prvChangePriorityWhenSuspendedTask( void *pvParameters );
179 static void prvChangePriorityHelperTask( void *pvParameters );
180
181
182 /* Demo task specific constants. */
183 #define priSTACK_SIZE                           ( ( unsigned short ) configMINIMAL_STACK_SIZE )
184 #define priSLEEP_TIME                           ( ( TickType_t ) 50 )
185 #define priLOOPS                                        ( 5 )
186 #define priMAX_COUNT                            ( ( unsigned long ) 0xff )
187 #define priNO_BLOCK                                     ( ( TickType_t ) 0 )
188 #define priSUSPENDED_QUEUE_LENGTH       ( 1 )
189
190 /*-----------------------------------------------------------*/
191
192 /* Handles to the two counter tasks.  These could be passed in as parameters
193 to the controller task to prevent them having to be file scope. */
194 static TaskHandle_t xContinuousIncrementHandle, xLimitedIncrementHandle, xChangePriorityWhenSuspendedHandle;
195
196 /* The shared counter variable.  This is passed in as a parameter to the two 
197 counter variables for demonstration purposes. */
198 static unsigned long ulCounter;
199
200 /* Variable used in a similar way by the test that checks the raising and
201 lowering of task priorities while the scheduler is suspended. */
202 static unsigned long ulPrioritySetCounter;
203
204 /* Variables used to check that the tasks are still operating without error.
205 Each complete iteration of the controller task increments this variable
206 provided no errors have been found.  The variable maintaining the same value
207 is therefore indication of an error. */
208 static unsigned short usCheckVariable = ( unsigned short ) 0;
209 static portBASE_TYPE xSuspendedQueueSendError = pdFALSE;
210 static portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
211 static portBASE_TYPE xPriorityRaiseWhenSuspendedError = pdFALSE;
212
213 /* Queue used by the second test. */
214 QueueHandle_t xSuspendedTestQueue;
215
216 /*-----------------------------------------------------------*/
217 /*
218  * Start the seven tasks as described at the top of the file.
219  * Note that the limited count task is given a higher priority.
220  */
221 void vStartDynamicPriorityTasks( void )
222 {
223         xSuspendedTestQueue = xQueueCreate( priSUSPENDED_QUEUE_LENGTH, sizeof( unsigned long ) );
224         xTaskCreate( vContinuousIncrementTask, "CONT_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY, &xContinuousIncrementHandle );
225         xTaskCreate( vLimitedIncrementTask, "LIM_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY + 1, &xLimitedIncrementHandle );
226         xTaskCreate( vCounterControlTask, "C_CTRL", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
227         xTaskCreate( vQueueSendWhenSuspendedTask, "SUSP_SEND", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
228         xTaskCreate( vQueueReceiveWhenSuspendedTask, "SUSP_RECV", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
229         xTaskCreate( prvChangePriorityWhenSuspendedTask, "1st_P_CHANGE", priSTACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL );
230         xTaskCreate( prvChangePriorityHelperTask, "2nd_P_CHANGE", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, &xChangePriorityWhenSuspendedHandle );
231 }
232 /*-----------------------------------------------------------*/
233
234 /*
235  * Just loops around incrementing the shared variable until the limit has been
236  * reached.  Once the limit has been reached it suspends itself. 
237  */
238 static void vLimitedIncrementTask( void * pvParameters )
239 {
240 unsigned long *pulCounter;
241
242         /* Take a pointer to the shared variable from the parameters passed into
243         the task. */
244         pulCounter = ( unsigned long * ) pvParameters;
245
246         /* This will run before the control task, so the first thing it does is
247         suspend - the control task will resume it when ready. */
248         vTaskSuspend( NULL );
249
250         for( ;; )
251         {
252                 /* Just count up to a value then suspend. */
253                 ( *pulCounter )++;      
254                 
255                 if( *pulCounter >= priMAX_COUNT )
256                 {
257                         vTaskSuspend( NULL );
258                 }       
259         }
260 }
261 /*-----------------------------------------------------------*/
262
263 /*
264  * Just keep counting the shared variable up.  The control task will suspend
265  * this task when it wants.
266  */
267 static void vContinuousIncrementTask( void * pvParameters )
268 {
269 unsigned long *pulCounter;
270 unsigned portBASE_TYPE uxOurPriority;
271
272         /* Take a pointer to the shared variable from the parameters passed into
273         the task. */
274         pulCounter = ( unsigned long * ) pvParameters;
275
276         /* Query our priority so we can raise it when exclusive access to the 
277         shared variable is required. */
278         uxOurPriority = uxTaskPriorityGet( NULL );
279
280         for( ;; )
281         {
282                 /* Raise our priority above the controller task to ensure a context
283                 switch does not occur while we are accessing this variable. */
284                 vTaskPrioritySet( NULL, uxOurPriority + 1 );
285                         ( *pulCounter )++;              
286                 vTaskPrioritySet( NULL, uxOurPriority );
287
288                 #if configUSE_PREEMPTION == 0
289                         taskYIELD();
290                 #endif
291         }
292 }
293 /*-----------------------------------------------------------*/
294
295 /*
296  * Controller task as described above.
297  */
298 static void vCounterControlTask( void * pvParameters )
299 {
300 unsigned long ulLastCounter;
301 short sLoops;
302 short sError = pdFALSE;
303 const char * const pcTaskStartMsg = "Priority manipulation tasks started.\r\n";
304 const char * const pcTaskFailMsg = "Priority manipulation Task Failed\r\n";
305
306         /* Just to stop warning messages. */
307         ( void ) pvParameters;
308
309         /* Queue a message for printing to say the task has started. */
310         vPrintDisplayMessage( &pcTaskStartMsg );
311
312         for( ;; )
313         {
314                 /* Start with the counter at zero. */
315                 ulCounter = ( unsigned long ) 0;
316
317                 /* First section : */
318
319                 /* Check the continuous count task is running. */
320                 for( sLoops = 0; sLoops < priLOOPS; sLoops++ )
321                 {
322                         /* Suspend the continuous count task so we can take a mirror of the
323                         shared variable without risk of corruption. */
324                         vTaskSuspend( xContinuousIncrementHandle );
325                                 ulLastCounter = ulCounter;
326                         vTaskResume( xContinuousIncrementHandle );
327                         
328                         /* Now delay to ensure the other task has processor time. */
329                         vTaskDelay( priSLEEP_TIME );
330
331                         /* Check the shared variable again.  This time to ensure mutual 
332                         exclusion the whole scheduler will be locked.  This is just for
333                         demo purposes! */
334                         vTaskSuspendAll();
335                         {
336                                 if( ulLastCounter == ulCounter )
337                                 {
338                                         /* The shared variable has not changed.  There is a problem
339                                         with the continuous count task so flag an error. */
340                                         sError = pdTRUE;
341                                         xTaskResumeAll();
342                                                 vPrintDisplayMessage( &pcTaskFailMsg );
343                                         vTaskSuspendAll();
344                                 }
345                         }
346                         xTaskResumeAll();
347                 }
348
349
350                 /* Second section: */
351
352                 /* Suspend the continuous counter task so it stops accessing the shared variable. */
353                 vTaskSuspend( xContinuousIncrementHandle );
354
355                 /* Reset the variable. */
356                 ulCounter = ( unsigned long ) 0;
357
358                 /* Resume the limited count task which has a higher priority than us.
359                 We should therefore not return from this call until the limited count
360                 task has suspended itself with a known value in the counter variable. 
361                 The scheduler suspension is not necessary but is included for test
362                 purposes. */
363                 vTaskSuspendAll();
364                         vTaskResume( xLimitedIncrementHandle );
365                 xTaskResumeAll();
366
367                 /* Does the counter variable have the expected value? */
368                 if( ulCounter != priMAX_COUNT )
369                 {
370                         sError = pdTRUE;
371                         vPrintDisplayMessage( &pcTaskFailMsg );
372                 }
373
374                 if( sError == pdFALSE )
375                 {
376                         /* If no errors have occurred then increment the check variable. */
377                         portENTER_CRITICAL();
378                                 usCheckVariable++;
379                         portEXIT_CRITICAL();
380                 }
381
382                 #if configUSE_PREEMPTION == 0
383                         taskYIELD();
384                 #endif
385
386                 /* Resume the continuous count task and do it all again. */
387                 vTaskResume( xContinuousIncrementHandle );
388         }
389 }
390 /*-----------------------------------------------------------*/
391
392 static void vQueueSendWhenSuspendedTask( void *pvParameters )
393 {
394 static unsigned long ulValueToSend = ( unsigned long ) 0;
395 const char * const pcTaskStartMsg = "Queue send while suspended task started.\r\n";
396 const char * const pcTaskFailMsg = "Queue send while suspended failed.\r\n";
397
398         /* Just to stop warning messages. */
399         ( void ) pvParameters;
400
401         /* Queue a message for printing to say the task has started. */
402         vPrintDisplayMessage( &pcTaskStartMsg );
403
404         for( ;; )
405         {
406                 vTaskSuspendAll();
407                 {
408                         /* We must not block while the scheduler is suspended! */
409                         if( xQueueSend( xSuspendedTestQueue, ( void * ) &ulValueToSend, priNO_BLOCK ) != pdTRUE )
410                         {
411                                 if( xSuspendedQueueSendError == pdFALSE )
412                                 {
413                                         xTaskResumeAll();
414                                                 vPrintDisplayMessage( &pcTaskFailMsg );
415                                         vTaskSuspendAll();
416                                 }
417
418                                 xSuspendedQueueSendError = pdTRUE;
419                         }
420                 }
421                 xTaskResumeAll();
422
423                 vTaskDelay( priSLEEP_TIME );
424
425                 ++ulValueToSend;
426         }
427 }
428 /*-----------------------------------------------------------*/
429
430 static void vQueueReceiveWhenSuspendedTask( void *pvParameters )
431 {
432 static unsigned long ulExpectedValue = ( unsigned long ) 0, ulReceivedValue;
433 const char * const pcTaskStartMsg = "Queue receive while suspended task started.\r\n";
434 const char * const pcTaskFailMsg = "Queue receive while suspended failed.\r\n";
435 portBASE_TYPE xGotValue;
436
437         /* Just to stop warning messages. */
438         ( void ) pvParameters;
439
440         /* Queue a message for printing to say the task has started. */
441         vPrintDisplayMessage( &pcTaskStartMsg );
442
443         for( ;; )
444         {
445                 do
446                 {
447                         /* Suspending the scheduler here is fairly pointless and 
448                         undesirable for a normal application.  It is done here purely
449                         to test the scheduler.  The inner xTaskResumeAll() should
450                         never return pdTRUE as the scheduler is still locked by the
451                         outer call. */
452                         vTaskSuspendAll();
453                         {
454                                 vTaskSuspendAll();
455                                 {
456                                         xGotValue = xQueueReceive( xSuspendedTestQueue, ( void * ) &ulReceivedValue, priNO_BLOCK );
457                                 }
458                                 if( xTaskResumeAll() )
459                                 {
460                                         xSuspendedQueueReceiveError = pdTRUE;
461                                 }
462                         }
463                         xTaskResumeAll();
464
465                         #if configUSE_PREEMPTION == 0
466                                 taskYIELD();
467                         #endif
468
469                 } while( xGotValue == pdFALSE );
470
471                 if( ulReceivedValue != ulExpectedValue )
472                 {
473                         if( xSuspendedQueueReceiveError == pdFALSE )
474                         {
475                                 vPrintDisplayMessage( &pcTaskFailMsg );
476                         }
477                         xSuspendedQueueReceiveError = pdTRUE;
478                 }
479
480                 ++ulExpectedValue;
481         }
482 }
483 /*-----------------------------------------------------------*/
484
485 static void prvChangePriorityWhenSuspendedTask( void *pvParameters )
486 {
487 const char * const pcTaskStartMsg = "Priority change when suspended task started.\r\n";
488 const char * const pcTaskFailMsg = "Priority change when suspended task failed.\r\n";
489
490         /* Just to stop warning messages. */
491         ( void ) pvParameters;
492
493         /* Queue a message for printing to say the task has started. */
494         vPrintDisplayMessage( &pcTaskStartMsg );        
495         
496         for( ;; )
497         {
498                 /* Start with the counter at 0 so we know what the counter should be
499                 when we check it next. */
500                 ulPrioritySetCounter = ( unsigned long ) 0;
501
502                 /* Resume the helper task.  At this time it has a priority lower than
503                 ours so no context switch should occur. */
504                 vTaskResume( xChangePriorityWhenSuspendedHandle );
505
506                 /* Check to ensure the task just resumed has not executed. */
507                 portENTER_CRITICAL();
508                 {
509                         if( ulPrioritySetCounter != ( unsigned long ) 0 )
510                         {
511                                 xPriorityRaiseWhenSuspendedError = pdTRUE;
512                                 vPrintDisplayMessage( &pcTaskFailMsg );
513                         }
514                 }
515                 portEXIT_CRITICAL();
516
517                 /* Now try raising the priority while the scheduler is suspended. */
518                 vTaskSuspendAll();
519                 {
520                         vTaskPrioritySet( xChangePriorityWhenSuspendedHandle, ( configMAX_PRIORITIES - 1 ) );
521
522                         /* Again, even though the helper task has a priority greater than 
523                         ours, it should not have executed yet because the scheduler is
524                         suspended. */
525                         portENTER_CRITICAL();
526                         {
527                                 if( ulPrioritySetCounter != ( unsigned long ) 0 )
528                                 {
529                                         xPriorityRaiseWhenSuspendedError = pdTRUE;
530                                         vPrintDisplayMessage( &pcTaskFailMsg );
531                                 }
532                         }
533                         portEXIT_CRITICAL();
534                 }
535                 xTaskResumeAll();
536                 
537                 /* Now the scheduler has been resumed the helper task should 
538                 immediately preempt us and execute.  When it executes it will increment
539                 the ulPrioritySetCounter exactly once before suspending itself.
540
541                 We should now always find the counter set to 1. */
542                 portENTER_CRITICAL();
543                 {
544                         if( ulPrioritySetCounter != ( unsigned long ) 1 )
545                         {
546                                 xPriorityRaiseWhenSuspendedError = pdTRUE;
547                                 vPrintDisplayMessage( &pcTaskFailMsg );
548                         }
549                 }
550                 portEXIT_CRITICAL();
551
552                 /* Delay until we try this again. */            
553                 vTaskDelay( priSLEEP_TIME * 2 );
554                 
555                 /* Set the priority of the helper task back ready for the next 
556                 execution of this task. */
557                 vTaskSuspendAll();
558                         vTaskPrioritySet( xChangePriorityWhenSuspendedHandle, tskIDLE_PRIORITY );                               
559                 xTaskResumeAll();                               
560         }
561 }
562 /*-----------------------------------------------------------*/
563
564 static void prvChangePriorityHelperTask( void *pvParameters )
565 {
566         /* Just to stop warning messages. */
567         ( void ) pvParameters;
568
569         for( ;; )
570         {
571                 /* This is the helper task for prvChangePriorityWhenSuspendedTask().
572                 It has it's priority raised and lowered.  When it runs it simply 
573                 increments the counter then suspends itself again.  This allows
574                 prvChangePriorityWhenSuspendedTask() to know how many times it has
575                 executed. */
576                 ulPrioritySetCounter++;
577                 vTaskSuspend( NULL );
578         }
579 }
580 /*-----------------------------------------------------------*/
581
582 /* Called to check that all the created tasks are still running without error. */
583 portBASE_TYPE xAreDynamicPriorityTasksStillRunning( void )
584 {
585 /* Keep a history of the check variables so we know if it has been incremented 
586 since the last call. */
587 static unsigned short usLastTaskCheck = ( unsigned short ) 0;
588 portBASE_TYPE xReturn = pdTRUE;
589
590         /* Check the tasks are still running by ensuring the check variable
591         is still incrementing. */
592
593         if( usCheckVariable == usLastTaskCheck )
594         {
595                 /* The check has not incremented so an error exists. */
596                 xReturn = pdFALSE;
597         }
598
599         if( xSuspendedQueueSendError == pdTRUE )
600         {
601                 xReturn = pdFALSE;
602         }
603
604         if( xSuspendedQueueReceiveError == pdTRUE )
605         {
606                 xReturn = pdFALSE;
607         }
608
609         if( xPriorityRaiseWhenSuspendedError == pdTRUE )
610         {
611                 xReturn = pdFALSE;
612         }
613
614         usLastTaskCheck = usCheckVariable;
615         return xReturn;
616 }
617
618
619
620