2 * FreeRTOS Kernel V10.4.4
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
30 * Implementation of the wrapper functions used to raise the processor privilege
31 * before calling a standard FreeRTOS API function.
34 /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
35 * all the API functions to use the MPU wrappers. That should only be done when
36 * task.h is included from an application file. */
37 #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
39 /* Scheduler includes. */
44 #include "event_groups.h"
45 #include "stream_buffer.h"
46 #include "mpu_prototypes.h"
48 #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
51 * @brief Calls the port specific code to raise the privilege.
53 * @return pdFALSE if privilege was raised, pdTRUE otherwise.
55 BaseType_t xPortRaisePrivilege( void ) FREERTOS_SYSTEM_CALL;
58 * @brief If xRunningPrivileged is not pdTRUE, calls the port specific
59 * code to reset the privilege, otherwise does nothing.
61 void vPortResetPrivilege( BaseType_t xRunningPrivileged );
62 /*-----------------------------------------------------------*/
64 BaseType_t xPortRaisePrivilege( void ) /* FREERTOS_SYSTEM_CALL */
66 BaseType_t xRunningPrivileged;
68 /* Check whether the processor is already privileged. */
69 xRunningPrivileged = portIS_PRIVILEGED();
71 /* If the processor is not already privileged, raise privilege. */
72 if( xRunningPrivileged == pdFALSE )
74 portRAISE_PRIVILEGE();
77 return xRunningPrivileged;
79 /*-----------------------------------------------------------*/
81 void vPortResetPrivilege( BaseType_t xRunningPrivileged )
83 if( xRunningPrivileged == pdFALSE )
85 portRESET_PRIVILEGE();
88 /*-----------------------------------------------------------*/
90 #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
91 BaseType_t MPU_xTaskCreate( TaskFunction_t pvTaskCode,
92 const char * const pcName,
93 uint16_t usStackDepth,
95 UBaseType_t uxPriority,
96 TaskHandle_t * pxCreatedTask ) /* FREERTOS_SYSTEM_CALL */
99 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
101 xReturn = xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
102 vPortResetPrivilege( xRunningPrivileged );
105 #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
106 /*-----------------------------------------------------------*/
108 #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
109 TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
110 const char * const pcName,
111 const uint32_t ulStackDepth,
112 void * const pvParameters,
113 UBaseType_t uxPriority,
114 StackType_t * const puxStackBuffer,
115 StaticTask_t * const pxTaskBuffer ) /* FREERTOS_SYSTEM_CALL */
117 TaskHandle_t xReturn;
118 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
120 xReturn = xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
121 vPortResetPrivilege( xRunningPrivileged );
124 #endif /* configSUPPORT_STATIC_ALLOCATION */
125 /*-----------------------------------------------------------*/
127 #if ( INCLUDE_vTaskDelete == 1 )
128 void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete ) /* FREERTOS_SYSTEM_CALL */
130 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
132 vTaskDelete( pxTaskToDelete );
133 vPortResetPrivilege( xRunningPrivileged );
136 /*-----------------------------------------------------------*/
138 #if ( INCLUDE_xTaskDelayUntil == 1 )
139 BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
140 TickType_t xTimeIncrement ) /* FREERTOS_SYSTEM_CALL */
142 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
145 xReturn = xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement );
146 vPortResetPrivilege( xRunningPrivileged );
150 /*-----------------------------------------------------------*/
152 #if ( INCLUDE_xTaskAbortDelay == 1 )
153 BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */
156 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
158 xReturn = xTaskAbortDelay( xTask );
159 vPortResetPrivilege( xRunningPrivileged );
163 /*-----------------------------------------------------------*/
165 #if ( INCLUDE_vTaskDelay == 1 )
166 void MPU_vTaskDelay( TickType_t xTicksToDelay ) /* FREERTOS_SYSTEM_CALL */
168 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
170 vTaskDelay( xTicksToDelay );
171 vPortResetPrivilege( xRunningPrivileged );
174 /*-----------------------------------------------------------*/
176 #if ( INCLUDE_uxTaskPriorityGet == 1 )
177 UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t pxTask ) /* FREERTOS_SYSTEM_CALL */
179 UBaseType_t uxReturn;
180 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
182 uxReturn = uxTaskPriorityGet( pxTask );
183 vPortResetPrivilege( xRunningPrivileged );
187 /*-----------------------------------------------------------*/
189 #if ( INCLUDE_vTaskPrioritySet == 1 )
190 void MPU_vTaskPrioritySet( TaskHandle_t pxTask,
191 UBaseType_t uxNewPriority ) /* FREERTOS_SYSTEM_CALL */
193 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
195 vTaskPrioritySet( pxTask, uxNewPriority );
196 vPortResetPrivilege( xRunningPrivileged );
199 /*-----------------------------------------------------------*/
201 #if ( INCLUDE_eTaskGetState == 1 )
202 eTaskState MPU_eTaskGetState( TaskHandle_t pxTask ) /* FREERTOS_SYSTEM_CALL */
204 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
207 eReturn = eTaskGetState( pxTask );
208 vPortResetPrivilege( xRunningPrivileged );
212 /*-----------------------------------------------------------*/
214 #if ( configUSE_TRACE_FACILITY == 1 )
215 void MPU_vTaskGetInfo( TaskHandle_t xTask,
216 TaskStatus_t * pxTaskStatus,
217 BaseType_t xGetFreeStackSpace,
218 eTaskState eState ) /* FREERTOS_SYSTEM_CALL */
220 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
222 vTaskGetInfo( xTask, pxTaskStatus, xGetFreeStackSpace, eState );
223 vPortResetPrivilege( xRunningPrivileged );
225 #endif /* if ( configUSE_TRACE_FACILITY == 1 ) */
226 /*-----------------------------------------------------------*/
228 #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
229 TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */
231 TaskHandle_t xReturn;
232 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
234 xReturn = xTaskGetIdleTaskHandle();
235 vPortResetPrivilege( xRunningPrivileged );
239 /*-----------------------------------------------------------*/
241 #if ( INCLUDE_vTaskSuspend == 1 )
242 void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend ) /* FREERTOS_SYSTEM_CALL */
244 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
246 vTaskSuspend( pxTaskToSuspend );
247 vPortResetPrivilege( xRunningPrivileged );
250 /*-----------------------------------------------------------*/
252 #if ( INCLUDE_vTaskSuspend == 1 )
253 void MPU_vTaskResume( TaskHandle_t pxTaskToResume ) /* FREERTOS_SYSTEM_CALL */
255 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
257 vTaskResume( pxTaskToResume );
258 vPortResetPrivilege( xRunningPrivileged );
261 /*-----------------------------------------------------------*/
263 void MPU_vTaskSuspendAll( void ) /* FREERTOS_SYSTEM_CALL */
265 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
268 vPortResetPrivilege( xRunningPrivileged );
270 /*-----------------------------------------------------------*/
272 BaseType_t MPU_xTaskResumeAll( void ) /* FREERTOS_SYSTEM_CALL */
275 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
277 xReturn = xTaskResumeAll();
278 vPortResetPrivilege( xRunningPrivileged );
281 /*-----------------------------------------------------------*/
283 TickType_t MPU_xTaskGetTickCount( void ) /* FREERTOS_SYSTEM_CALL */
286 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
288 xReturn = xTaskGetTickCount();
289 vPortResetPrivilege( xRunningPrivileged );
292 /*-----------------------------------------------------------*/
294 UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) /* FREERTOS_SYSTEM_CALL */
296 UBaseType_t uxReturn;
297 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
299 uxReturn = uxTaskGetNumberOfTasks();
300 vPortResetPrivilege( xRunningPrivileged );
303 /*-----------------------------------------------------------*/
305 char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) /* FREERTOS_SYSTEM_CALL */
308 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
310 pcReturn = pcTaskGetName( xTaskToQuery );
311 vPortResetPrivilege( xRunningPrivileged );
314 /*-----------------------------------------------------------*/
316 #if ( INCLUDE_xTaskGetHandle == 1 )
317 TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) /* FREERTOS_SYSTEM_CALL */
319 TaskHandle_t xReturn;
320 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
322 xReturn = xTaskGetHandle( pcNameToQuery );
323 vPortResetPrivilege( xRunningPrivileged );
327 /*-----------------------------------------------------------*/
329 #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
330 void MPU_vTaskList( char * pcWriteBuffer ) /* FREERTOS_SYSTEM_CALL */
332 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
334 vTaskList( pcWriteBuffer );
335 vPortResetPrivilege( xRunningPrivileged );
338 /*-----------------------------------------------------------*/
340 #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
341 void MPU_vTaskGetRunTimeStats( char * pcWriteBuffer ) /* FREERTOS_SYSTEM_CALL */
343 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
345 vTaskGetRunTimeStats( pcWriteBuffer );
346 vPortResetPrivilege( xRunningPrivileged );
349 /*-----------------------------------------------------------*/
351 #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
352 uint32_t MPU_ulTaskGetIdleRunTimeCounter( void ) /* FREERTOS_SYSTEM_CALL */
355 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
357 xReturn = ulTaskGetIdleRunTimeCounter();
358 vPortResetPrivilege( xRunningPrivileged );
362 /*-----------------------------------------------------------*/
364 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
365 void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask,
366 TaskHookFunction_t pxTagValue ) /* FREERTOS_SYSTEM_CALL */
368 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
370 vTaskSetApplicationTaskTag( xTask, pxTagValue );
371 vPortResetPrivilege( xRunningPrivileged );
374 /*-----------------------------------------------------------*/
376 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
377 TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */
379 TaskHookFunction_t xReturn;
380 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
382 xReturn = xTaskGetApplicationTaskTag( xTask );
383 vPortResetPrivilege( xRunningPrivileged );
387 /*-----------------------------------------------------------*/
389 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
390 void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet,
392 void * pvValue ) /* FREERTOS_SYSTEM_CALL */
394 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
396 vTaskSetThreadLocalStoragePointer( xTaskToSet, xIndex, pvValue );
397 vPortResetPrivilege( xRunningPrivileged );
400 /*-----------------------------------------------------------*/
402 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
403 void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery,
404 BaseType_t xIndex ) /* FREERTOS_SYSTEM_CALL */
407 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
409 pvReturn = pvTaskGetThreadLocalStoragePointer( xTaskToQuery, xIndex );
410 vPortResetPrivilege( xRunningPrivileged );
413 #endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) */
414 /*-----------------------------------------------------------*/
416 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
417 BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask,
418 void * pvParameter ) /* FREERTOS_SYSTEM_CALL */
421 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
423 xReturn = xTaskCallApplicationTaskHook( xTask, pvParameter );
424 vPortResetPrivilege( xRunningPrivileged );
427 #endif /* if ( configUSE_APPLICATION_TASK_TAG == 1 ) */
428 /*-----------------------------------------------------------*/
430 #if ( configUSE_TRACE_FACILITY == 1 )
431 UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * pxTaskStatusArray,
432 UBaseType_t uxArraySize,
433 uint32_t * pulTotalRunTime ) /* FREERTOS_SYSTEM_CALL */
435 UBaseType_t uxReturn;
436 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
438 uxReturn = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime );
439 vPortResetPrivilege( xRunningPrivileged );
442 #endif /* if ( configUSE_TRACE_FACILITY == 1 ) */
443 /*-----------------------------------------------------------*/
445 BaseType_t MPU_xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) /* FREERTOS_SYSTEM_CALL */
448 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
450 xReturn = xTaskCatchUpTicks( xTicksToCatchUp );
451 vPortResetPrivilege( xRunningPrivileged );
454 /*-----------------------------------------------------------*/
456 #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )
457 UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */
459 UBaseType_t uxReturn;
460 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
462 uxReturn = uxTaskGetStackHighWaterMark( xTask );
463 vPortResetPrivilege( xRunningPrivileged );
467 /*-----------------------------------------------------------*/
469 #if ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 )
470 configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */
472 configSTACK_DEPTH_TYPE uxReturn;
473 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
475 uxReturn = uxTaskGetStackHighWaterMark2( xTask );
476 vPortResetPrivilege( xRunningPrivileged );
480 /*-----------------------------------------------------------*/
482 #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ))
483 TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */
485 TaskHandle_t xReturn;
486 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
488 xReturn = xTaskGetCurrentTaskHandle();
489 vPortResetPrivilege( xRunningPrivileged );
493 /*-----------------------------------------------------------*/
495 #if ( INCLUDE_xTaskGetSchedulerState == 1 )
496 BaseType_t MPU_xTaskGetSchedulerState( void ) /* FREERTOS_SYSTEM_CALL */
499 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
501 xReturn = xTaskGetSchedulerState();
502 vPortResetPrivilege( xRunningPrivileged );
506 /*-----------------------------------------------------------*/
508 void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) /* FREERTOS_SYSTEM_CALL */
510 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
512 vTaskSetTimeOutState( pxTimeOut );
513 vPortResetPrivilege( xRunningPrivileged );
515 /*-----------------------------------------------------------*/
517 BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
518 TickType_t * const pxTicksToWait ) /* FREERTOS_SYSTEM_CALL */
521 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
523 xReturn = xTaskCheckForTimeOut( pxTimeOut, pxTicksToWait );
524 vPortResetPrivilege( xRunningPrivileged );
527 /*-----------------------------------------------------------*/
529 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
530 BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify,
531 UBaseType_t uxIndexToNotify,
533 eNotifyAction eAction,
534 uint32_t * pulPreviousNotificationValue ) /* FREERTOS_SYSTEM_CALL */
537 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
539 xReturn = xTaskGenericNotify( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue );
540 vPortResetPrivilege( xRunningPrivileged );
543 #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
544 /*-----------------------------------------------------------*/
546 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
547 BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn,
548 uint32_t ulBitsToClearOnEntry,
549 uint32_t ulBitsToClearOnExit,
550 uint32_t * pulNotificationValue,
551 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
554 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
556 xReturn = xTaskGenericNotifyWait( uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait );
557 vPortResetPrivilege( xRunningPrivileged );
560 #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
561 /*-----------------------------------------------------------*/
563 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
564 uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn,
565 BaseType_t xClearCountOnExit,
566 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
569 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
571 ulReturn = ulTaskGenericNotifyTake( uxIndexToWaitOn, xClearCountOnExit, xTicksToWait );
572 vPortResetPrivilege( xRunningPrivileged );
575 #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
576 /*-----------------------------------------------------------*/
578 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
579 BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask,
580 UBaseType_t uxIndexToClear ) /* FREERTOS_SYSTEM_CALL */
583 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
585 xReturn = xTaskGenericNotifyStateClear( xTask, uxIndexToClear );
586 vPortResetPrivilege( xRunningPrivileged );
589 #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
590 /*-----------------------------------------------------------*/
592 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
593 uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask,
594 UBaseType_t uxIndexToClear,
595 uint32_t ulBitsToClear ) /* FREERTOS_SYSTEM_CALL */
598 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
600 ulReturn = ulTaskGenericNotifyValueClear( xTask, uxIndexToClear, ulBitsToClear );
601 vPortResetPrivilege( xRunningPrivileged );
604 #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
605 /*-----------------------------------------------------------*/
607 #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
608 QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength,
609 UBaseType_t uxItemSize,
610 uint8_t ucQueueType ) /* FREERTOS_SYSTEM_CALL */
612 QueueHandle_t xReturn;
613 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
615 xReturn = xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType );
616 vPortResetPrivilege( xRunningPrivileged );
619 #endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
620 /*-----------------------------------------------------------*/
622 #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
623 QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength,
624 const UBaseType_t uxItemSize,
625 uint8_t * pucQueueStorage,
626 StaticQueue_t * pxStaticQueue,
627 const uint8_t ucQueueType ) /* FREERTOS_SYSTEM_CALL */
629 QueueHandle_t xReturn;
630 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
632 xReturn = xQueueGenericCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, ucQueueType );
633 vPortResetPrivilege( xRunningPrivileged );
636 #endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
637 /*-----------------------------------------------------------*/
639 BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue,
640 BaseType_t xNewQueue ) /* FREERTOS_SYSTEM_CALL */
643 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
645 xReturn = xQueueGenericReset( pxQueue, xNewQueue );
646 vPortResetPrivilege( xRunningPrivileged );
649 /*-----------------------------------------------------------*/
651 BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue,
652 const void * const pvItemToQueue,
653 TickType_t xTicksToWait,
654 BaseType_t xCopyPosition ) /* FREERTOS_SYSTEM_CALL */
657 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
659 xReturn = xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
660 vPortResetPrivilege( xRunningPrivileged );
663 /*-----------------------------------------------------------*/
665 UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t pxQueue ) /* FREERTOS_SYSTEM_CALL */
667 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
668 UBaseType_t uxReturn;
670 uxReturn = uxQueueMessagesWaiting( pxQueue );
671 vPortResetPrivilege( xRunningPrivileged );
674 /*-----------------------------------------------------------*/
676 UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */
678 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
679 UBaseType_t uxReturn;
681 uxReturn = uxQueueSpacesAvailable( xQueue );
682 vPortResetPrivilege( xRunningPrivileged );
685 /*-----------------------------------------------------------*/
687 BaseType_t MPU_xQueueReceive( QueueHandle_t pxQueue,
688 void * const pvBuffer,
689 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
691 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
694 xReturn = xQueueReceive( pxQueue, pvBuffer, xTicksToWait );
695 vPortResetPrivilege( xRunningPrivileged );
698 /*-----------------------------------------------------------*/
700 BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue,
701 void * const pvBuffer,
702 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
704 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
707 xReturn = xQueuePeek( xQueue, pvBuffer, xTicksToWait );
708 vPortResetPrivilege( xRunningPrivileged );
711 /*-----------------------------------------------------------*/
713 BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue,
714 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
716 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
719 xReturn = xQueueSemaphoreTake( xQueue, xTicksToWait );
720 vPortResetPrivilege( xRunningPrivileged );
723 /*-----------------------------------------------------------*/
725 #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
726 TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) /* FREERTOS_SYSTEM_CALL */
728 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
731 xReturn = xQueueGetMutexHolder( xSemaphore );
732 vPortResetPrivilege( xRunningPrivileged );
736 /*-----------------------------------------------------------*/
738 #if ( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
739 QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) /* FREERTOS_SYSTEM_CALL */
741 QueueHandle_t xReturn;
742 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
744 xReturn = xQueueCreateMutex( ucQueueType );
745 vPortResetPrivilege( xRunningPrivileged );
749 /*-----------------------------------------------------------*/
751 #if ( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
752 QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType,
753 StaticQueue_t * pxStaticQueue ) /* FREERTOS_SYSTEM_CALL */
755 QueueHandle_t xReturn;
756 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
758 xReturn = xQueueCreateMutexStatic( ucQueueType, pxStaticQueue );
759 vPortResetPrivilege( xRunningPrivileged );
762 #endif /* if ( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) */
763 /*-----------------------------------------------------------*/
765 #if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
766 QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue,
767 UBaseType_t uxInitialCount ) /* FREERTOS_SYSTEM_CALL */
769 QueueHandle_t xReturn;
770 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
772 xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount );
773 vPortResetPrivilege( xRunningPrivileged );
776 #endif /* if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */
777 /*-----------------------------------------------------------*/
779 #if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
781 QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
782 const UBaseType_t uxInitialCount,
783 StaticQueue_t * pxStaticQueue ) /* FREERTOS_SYSTEM_CALL */
785 QueueHandle_t xReturn;
786 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
788 xReturn = xQueueCreateCountingSemaphoreStatic( uxMaxCount, uxInitialCount, pxStaticQueue );
789 vPortResetPrivilege( xRunningPrivileged );
792 #endif /* if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) */
793 /*-----------------------------------------------------------*/
795 #if ( configUSE_RECURSIVE_MUTEXES == 1 )
796 BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex,
797 TickType_t xBlockTime ) /* FREERTOS_SYSTEM_CALL */
800 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
802 xReturn = xQueueTakeMutexRecursive( xMutex, xBlockTime );
803 vPortResetPrivilege( xRunningPrivileged );
806 #endif /* if ( configUSE_RECURSIVE_MUTEXES == 1 ) */
807 /*-----------------------------------------------------------*/
809 #if ( configUSE_RECURSIVE_MUTEXES == 1 )
810 BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t xMutex ) /* FREERTOS_SYSTEM_CALL */
813 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
815 xReturn = xQueueGiveMutexRecursive( xMutex );
816 vPortResetPrivilege( xRunningPrivileged );
820 /*-----------------------------------------------------------*/
822 #if ( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
823 QueueSetHandle_t MPU_xQueueCreateSet( UBaseType_t uxEventQueueLength ) /* FREERTOS_SYSTEM_CALL */
825 QueueSetHandle_t xReturn;
826 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
828 xReturn = xQueueCreateSet( uxEventQueueLength );
829 vPortResetPrivilege( xRunningPrivileged );
833 /*-----------------------------------------------------------*/
835 #if ( configUSE_QUEUE_SETS == 1 )
836 QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet,
837 TickType_t xBlockTimeTicks ) /* FREERTOS_SYSTEM_CALL */
839 QueueSetMemberHandle_t xReturn;
840 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
842 xReturn = xQueueSelectFromSet( xQueueSet, xBlockTimeTicks );
843 vPortResetPrivilege( xRunningPrivileged );
846 #endif /* if ( configUSE_QUEUE_SETS == 1 ) */
847 /*-----------------------------------------------------------*/
849 #if ( configUSE_QUEUE_SETS == 1 )
850 BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
851 QueueSetHandle_t xQueueSet ) /* FREERTOS_SYSTEM_CALL */
854 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
856 xReturn = xQueueAddToSet( xQueueOrSemaphore, xQueueSet );
857 vPortResetPrivilege( xRunningPrivileged );
860 #endif /* if ( configUSE_QUEUE_SETS == 1 ) */
861 /*-----------------------------------------------------------*/
863 #if ( configUSE_QUEUE_SETS == 1 )
864 BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
865 QueueSetHandle_t xQueueSet ) /* FREERTOS_SYSTEM_CALL */
868 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
870 xReturn = xQueueRemoveFromSet( xQueueOrSemaphore, xQueueSet );
871 vPortResetPrivilege( xRunningPrivileged );
874 #endif /* if ( configUSE_QUEUE_SETS == 1 ) */
875 /*-----------------------------------------------------------*/
877 #if configQUEUE_REGISTRY_SIZE > 0
878 void MPU_vQueueAddToRegistry( QueueHandle_t xQueue,
879 const char * pcName ) /* FREERTOS_SYSTEM_CALL */
881 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
883 vQueueAddToRegistry( xQueue, pcName );
885 vPortResetPrivilege( xRunningPrivileged );
888 /*-----------------------------------------------------------*/
890 #if configQUEUE_REGISTRY_SIZE > 0
891 void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */
893 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
895 vQueueUnregisterQueue( xQueue );
897 vPortResetPrivilege( xRunningPrivileged );
900 /*-----------------------------------------------------------*/
902 #if configQUEUE_REGISTRY_SIZE > 0
903 const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */
905 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
906 const char * pcReturn;
908 pcReturn = pcQueueGetName( xQueue );
910 vPortResetPrivilege( xRunningPrivileged );
913 #endif /* if configQUEUE_REGISTRY_SIZE > 0 */
914 /*-----------------------------------------------------------*/
916 void MPU_vQueueDelete( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */
918 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
920 vQueueDelete( xQueue );
922 vPortResetPrivilege( xRunningPrivileged );
924 /*-----------------------------------------------------------*/
926 #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
927 void MPU_vPortInitialiseBlocks( void ) /* FREERTOS_SYSTEM_CALL */
929 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
931 vPortInitialiseBlocks();
933 vPortResetPrivilege( xRunningPrivileged );
935 #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
936 /*-----------------------------------------------------------*/
938 #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
939 size_t MPU_xPortGetFreeHeapSize( void ) /* FREERTOS_SYSTEM_CALL */
942 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
944 xReturn = xPortGetFreeHeapSize();
946 vPortResetPrivilege( xRunningPrivileged );
950 #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
951 /*-----------------------------------------------------------*/
953 #if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) )
954 TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName,
955 const TickType_t xTimerPeriodInTicks,
956 const UBaseType_t uxAutoReload,
957 void * const pvTimerID,
958 TimerCallbackFunction_t pxCallbackFunction ) /* FREERTOS_SYSTEM_CALL */
960 TimerHandle_t xReturn;
961 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
963 xReturn = xTimerCreate( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction );
964 vPortResetPrivilege( xRunningPrivileged );
968 #endif /* if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) ) */
969 /*-----------------------------------------------------------*/
971 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) )
972 TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName,
973 const TickType_t xTimerPeriodInTicks,
974 const UBaseType_t uxAutoReload,
975 void * const pvTimerID,
976 TimerCallbackFunction_t pxCallbackFunction,
977 StaticTimer_t * pxTimerBuffer ) /* FREERTOS_SYSTEM_CALL */
979 TimerHandle_t xReturn;
980 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
982 xReturn = xTimerCreateStatic( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxTimerBuffer );
983 vPortResetPrivilege( xRunningPrivileged );
987 #endif /* if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) ) */
988 /*-----------------------------------------------------------*/
990 #if ( configUSE_TIMERS == 1 )
991 void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
994 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
996 pvReturn = pvTimerGetTimerID( xTimer );
997 vPortResetPrivilege( xRunningPrivileged );
1001 #endif /* if ( configUSE_TIMERS == 1 ) */
1002 /*-----------------------------------------------------------*/
1004 #if ( configUSE_TIMERS == 1 )
1005 void MPU_vTimerSetTimerID( TimerHandle_t xTimer,
1006 void * pvNewID ) /* FREERTOS_SYSTEM_CALL */
1008 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1010 vTimerSetTimerID( xTimer, pvNewID );
1011 vPortResetPrivilege( xRunningPrivileged );
1014 /*-----------------------------------------------------------*/
1016 #if ( configUSE_TIMERS == 1 )
1017 BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
1020 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1022 xReturn = xTimerIsTimerActive( xTimer );
1023 vPortResetPrivilege( xRunningPrivileged );
1027 #endif /* if ( configUSE_TIMERS == 1 ) */
1028 /*-----------------------------------------------------------*/
1030 #if ( configUSE_TIMERS == 1 )
1031 TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */
1033 TaskHandle_t xReturn;
1034 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1036 xReturn = xTimerGetTimerDaemonTaskHandle();
1037 vPortResetPrivilege( xRunningPrivileged );
1041 #endif /* if ( configUSE_TIMERS == 1 ) */
1042 /*-----------------------------------------------------------*/
1044 #if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
1045 BaseType_t MPU_xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
1046 void * pvParameter1,
1047 uint32_t ulParameter2,
1048 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
1051 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1053 xReturn = xTimerPendFunctionCall( xFunctionToPend, pvParameter1, ulParameter2, xTicksToWait );
1054 vPortResetPrivilege( xRunningPrivileged );
1058 #endif /* if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
1059 /*-----------------------------------------------------------*/
1061 #if ( configUSE_TIMERS == 1 )
1062 void MPU_vTimerSetReloadMode( TimerHandle_t xTimer,
1063 const UBaseType_t uxAutoReload ) /* FREERTOS_SYSTEM_CALL */
1065 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1067 vTimerSetReloadMode( xTimer, uxAutoReload );
1068 vPortResetPrivilege( xRunningPrivileged );
1071 /*-----------------------------------------------------------*/
1073 #if ( configUSE_TIMERS == 1 )
1074 UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer )
1076 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1077 UBaseType_t uxReturn;
1079 uxReturn = uxTimerGetReloadMode( xTimer );
1080 vPortResetPrivilege( xRunningPrivileged );
1084 /*-----------------------------------------------------------*/
1086 #if ( configUSE_TIMERS == 1 )
1087 const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
1089 const char * pcReturn;
1090 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1092 pcReturn = pcTimerGetName( xTimer );
1093 vPortResetPrivilege( xRunningPrivileged );
1097 #endif /* if ( configUSE_TIMERS == 1 ) */
1098 /*-----------------------------------------------------------*/
1100 #if ( configUSE_TIMERS == 1 )
1101 TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
1104 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1106 xReturn = xTimerGetPeriod( xTimer );
1107 vPortResetPrivilege( xRunningPrivileged );
1111 #endif /* if ( configUSE_TIMERS == 1 ) */
1112 /*-----------------------------------------------------------*/
1114 #if ( configUSE_TIMERS == 1 )
1115 TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
1118 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1120 xReturn = xTimerGetExpiryTime( xTimer );
1121 vPortResetPrivilege( xRunningPrivileged );
1125 #endif /* if ( configUSE_TIMERS == 1 ) */
1126 /*-----------------------------------------------------------*/
1128 #if ( configUSE_TIMERS == 1 )
1129 BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
1130 const BaseType_t xCommandID,
1131 const TickType_t xOptionalValue,
1132 BaseType_t * const pxHigherPriorityTaskWoken,
1133 const TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
1136 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1138 xReturn = xTimerGenericCommand( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait );
1139 vPortResetPrivilege( xRunningPrivileged );
1143 #endif /* if ( configUSE_TIMERS == 1 ) */
1144 /*-----------------------------------------------------------*/
1146 #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
1147 EventGroupHandle_t MPU_xEventGroupCreate( void ) /* FREERTOS_SYSTEM_CALL */
1149 EventGroupHandle_t xReturn;
1150 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1152 xReturn = xEventGroupCreate();
1153 vPortResetPrivilege( xRunningPrivileged );
1157 #endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
1158 /*-----------------------------------------------------------*/
1160 #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
1161 EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) /* FREERTOS_SYSTEM_CALL */
1163 EventGroupHandle_t xReturn;
1164 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1166 xReturn = xEventGroupCreateStatic( pxEventGroupBuffer );
1167 vPortResetPrivilege( xRunningPrivileged );
1171 #endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
1172 /*-----------------------------------------------------------*/
1174 EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
1175 const EventBits_t uxBitsToWaitFor,
1176 const BaseType_t xClearOnExit,
1177 const BaseType_t xWaitForAllBits,
1178 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
1180 EventBits_t xReturn;
1181 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1183 xReturn = xEventGroupWaitBits( xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait );
1184 vPortResetPrivilege( xRunningPrivileged );
1188 /*-----------------------------------------------------------*/
1190 EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup,
1191 const EventBits_t uxBitsToClear ) /* FREERTOS_SYSTEM_CALL */
1193 EventBits_t xReturn;
1194 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1196 xReturn = xEventGroupClearBits( xEventGroup, uxBitsToClear );
1197 vPortResetPrivilege( xRunningPrivileged );
1201 /*-----------------------------------------------------------*/
1203 EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup,
1204 const EventBits_t uxBitsToSet ) /* FREERTOS_SYSTEM_CALL */
1206 EventBits_t xReturn;
1207 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1209 xReturn = xEventGroupSetBits( xEventGroup, uxBitsToSet );
1210 vPortResetPrivilege( xRunningPrivileged );
1214 /*-----------------------------------------------------------*/
1216 EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup,
1217 const EventBits_t uxBitsToSet,
1218 const EventBits_t uxBitsToWaitFor,
1219 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
1221 EventBits_t xReturn;
1222 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1224 xReturn = xEventGroupSync( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait );
1225 vPortResetPrivilege( xRunningPrivileged );
1229 /*-----------------------------------------------------------*/
1231 void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) /* FREERTOS_SYSTEM_CALL */
1233 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1235 vEventGroupDelete( xEventGroup );
1236 vPortResetPrivilege( xRunningPrivileged );
1238 /*-----------------------------------------------------------*/
1240 size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
1241 const void * pvTxData,
1242 size_t xDataLengthBytes,
1243 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
1246 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1248 xReturn = xStreamBufferSend( xStreamBuffer, pvTxData, xDataLengthBytes, xTicksToWait );
1249 vPortResetPrivilege( xRunningPrivileged );
1253 /*-----------------------------------------------------------*/
1255 size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
1258 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1260 xReturn = xStreamBufferNextMessageLengthBytes( xStreamBuffer );
1261 vPortResetPrivilege( xRunningPrivileged );
1265 /*-----------------------------------------------------------*/
1267 size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
1269 size_t xBufferLengthBytes,
1270 TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
1273 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1275 xReturn = xStreamBufferReceive( xStreamBuffer, pvRxData, xBufferLengthBytes, xTicksToWait );
1276 vPortResetPrivilege( xRunningPrivileged );
1280 /*-----------------------------------------------------------*/
1282 void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
1284 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1286 vStreamBufferDelete( xStreamBuffer );
1287 vPortResetPrivilege( xRunningPrivileged );
1289 /*-----------------------------------------------------------*/
1291 BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
1294 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1296 xReturn = xStreamBufferIsFull( xStreamBuffer );
1297 vPortResetPrivilege( xRunningPrivileged );
1301 /*-----------------------------------------------------------*/
1303 BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
1306 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1308 xReturn = xStreamBufferIsEmpty( xStreamBuffer );
1309 vPortResetPrivilege( xRunningPrivileged );
1313 /*-----------------------------------------------------------*/
1315 BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
1318 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1320 xReturn = xStreamBufferReset( xStreamBuffer );
1321 vPortResetPrivilege( xRunningPrivileged );
1325 /*-----------------------------------------------------------*/
1327 size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
1330 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1332 xReturn = xStreamBufferSpacesAvailable( xStreamBuffer );
1333 vPortResetPrivilege( xRunningPrivileged );
1337 /*-----------------------------------------------------------*/
1339 size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
1342 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1344 xReturn = xStreamBufferBytesAvailable( xStreamBuffer );
1345 vPortResetPrivilege( xRunningPrivileged );
1349 /*-----------------------------------------------------------*/
1351 BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer,
1352 size_t xTriggerLevel ) /* FREERTOS_SYSTEM_CALL */
1355 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1357 xReturn = xStreamBufferSetTriggerLevel( xStreamBuffer, xTriggerLevel );
1358 vPortResetPrivilege( xRunningPrivileged );
1362 /*-----------------------------------------------------------*/
1364 #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
1365 StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
1366 size_t xTriggerLevelBytes,
1367 BaseType_t xIsMessageBuffer ) /* FREERTOS_SYSTEM_CALL */
1369 StreamBufferHandle_t xReturn;
1370 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1372 xReturn = xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer );
1373 vPortResetPrivilege( xRunningPrivileged );
1377 #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
1378 /*-----------------------------------------------------------*/
1380 #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
1381 StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
1382 size_t xTriggerLevelBytes,
1383 BaseType_t xIsMessageBuffer,
1384 uint8_t * const pucStreamBufferStorageArea,
1385 StaticStreamBuffer_t * const pxStaticStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
1387 StreamBufferHandle_t xReturn;
1388 BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1390 xReturn = xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pucStreamBufferStorageArea, pxStaticStreamBuffer );
1391 vPortResetPrivilege( xRunningPrivileged );
1395 #endif /* configSUPPORT_STATIC_ALLOCATION */
1396 /*-----------------------------------------------------------*/
1399 /* Functions that the application writer wants to execute in privileged mode
1400 * can be defined in application_defined_privileged_functions.h. The functions
1401 * must take the same format as those above whereby the privilege state on exit
1402 * equals the privilege state on entry. For example:
1404 * void MPU_FunctionName( [parameters ] )
1406 * BaseType_t xRunningPrivileged = xPortRaisePrivilege();
1408 * FunctionName( [parameters ] );
1410 * vPortResetPrivilege( xRunningPrivileged );
1414 #if configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS == 1
1415 #include "application_defined_privileged_functions.h"