1 /*
2  * FreeRTOS Kernel V11.1.0
3  * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
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:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
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.
23  *
24  * https://www.FreeRTOS.org
25  * https://github.com/FreeRTOS
26  *
27  */
28 
29 /*
30  * When the MPU is used the standard (non MPU) API functions are mapped to
31  * equivalents that start "MPU_", the prototypes for which are defined in this
32  * header files.  This will cause the application code to call the MPU_ version
33  * which wraps the non-MPU version with privilege promoting then demoting code,
34  * so the kernel code always runs will full privileges.
35  */
36 
37 
38 #ifndef MPU_PROTOTYPES_H
39 #define MPU_PROTOTYPES_H
40 
41 typedef struct xTaskGenericNotifyParams
42 {
43     TaskHandle_t xTaskToNotify;
44     UBaseType_t uxIndexToNotify;
45     uint32_t ulValue;
46     eNotifyAction eAction;
47     uint32_t * pulPreviousNotificationValue;
48 } xTaskGenericNotifyParams_t;
49 
50 typedef struct xTaskGenericNotifyWaitParams
51 {
52     UBaseType_t uxIndexToWaitOn;
53     uint32_t ulBitsToClearOnEntry;
54     uint32_t ulBitsToClearOnExit;
55     uint32_t * pulNotificationValue;
56     TickType_t xTicksToWait;
57 } xTaskGenericNotifyWaitParams_t;
58 
59 typedef struct xTimerGenericCommandFromTaskParams
60 {
61     TimerHandle_t xTimer;
62     BaseType_t xCommandID;
63     TickType_t xOptionalValue;
64     BaseType_t * pxHigherPriorityTaskWoken;
65     TickType_t xTicksToWait;
66 } xTimerGenericCommandFromTaskParams_t;
67 
68 typedef struct xEventGroupWaitBitsParams
69 {
70     EventGroupHandle_t xEventGroup;
71     EventBits_t uxBitsToWaitFor;
72     BaseType_t xClearOnExit;
73     BaseType_t xWaitForAllBits;
74     TickType_t xTicksToWait;
75 } xEventGroupWaitBitsParams_t;
76 
77 /* MPU versions of task.h API functions. */
78 void MPU_vTaskDelay( const TickType_t xTicksToDelay ) FREERTOS_SYSTEM_CALL;
79 BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
80                                 const TickType_t xTimeIncrement ) FREERTOS_SYSTEM_CALL;
81 BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
82 UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
83 eTaskState MPU_eTaskGetState( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
84 void MPU_vTaskGetInfo( TaskHandle_t xTask,
85                        TaskStatus_t * pxTaskStatus,
86                        BaseType_t xGetFreeStackSpace,
87                        eTaskState eState ) FREERTOS_SYSTEM_CALL;
88 void MPU_vTaskSuspend( TaskHandle_t xTaskToSuspend ) FREERTOS_SYSTEM_CALL;
89 void MPU_vTaskResume( TaskHandle_t xTaskToResume ) FREERTOS_SYSTEM_CALL;
90 TickType_t MPU_xTaskGetTickCount( void ) FREERTOS_SYSTEM_CALL;
91 UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) FREERTOS_SYSTEM_CALL;
92 UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
93 configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
94 void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask,
95                                      TaskHookFunction_t pxHookFunction ) FREERTOS_SYSTEM_CALL;
96 TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
97 void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet,
98                                             BaseType_t xIndex,
99                                             void * pvValue ) FREERTOS_SYSTEM_CALL;
100 void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery,
101                                                BaseType_t xIndex ) FREERTOS_SYSTEM_CALL;
102 TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) FREERTOS_SYSTEM_CALL;
103 UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray,
104                                       const UBaseType_t uxArraySize,
105                                       configRUN_TIME_COUNTER_TYPE * const pulTotalRunTime ) FREERTOS_SYSTEM_CALL;
106 configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimeCounter( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
107 configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetRunTimePercent( const TaskHandle_t xTask ) FREERTOS_SYSTEM_CALL;
108 configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimeCounter( void ) FREERTOS_SYSTEM_CALL;
109 configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimePercent( void ) FREERTOS_SYSTEM_CALL;
110 BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify,
111                                    UBaseType_t uxIndexToNotify,
112                                    uint32_t ulValue,
113                                    eNotifyAction eAction,
114                                    uint32_t * pulPreviousNotificationValue ) FREERTOS_SYSTEM_CALL;
115 BaseType_t MPU_xTaskGenericNotifyEntry( const xTaskGenericNotifyParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
116 BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn,
117                                        uint32_t ulBitsToClearOnEntry,
118                                        uint32_t ulBitsToClearOnExit,
119                                        uint32_t * pulNotificationValue,
120                                        TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
121 BaseType_t MPU_xTaskGenericNotifyWaitEntry( const xTaskGenericNotifyWaitParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
122 uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn,
123                                       BaseType_t xClearCountOnExit,
124                                       TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
125 BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask,
126                                              UBaseType_t uxIndexToClear ) FREERTOS_SYSTEM_CALL;
127 uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask,
128                                             UBaseType_t uxIndexToClear,
129                                             uint32_t ulBitsToClear ) FREERTOS_SYSTEM_CALL;
130 void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) FREERTOS_SYSTEM_CALL;
131 BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
132                                      TickType_t * const pxTicksToWait ) FREERTOS_SYSTEM_CALL;
133 TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) FREERTOS_SYSTEM_CALL;
134 BaseType_t MPU_xTaskGetSchedulerState( void ) FREERTOS_SYSTEM_CALL;
135 
136 /* Privileged only wrappers for Task APIs. These are needed so that
137  * the application can use opaque handles maintained in mpu_wrappers.c
138  * with all the APIs. */
139 BaseType_t MPU_xTaskCreate( TaskFunction_t pxTaskCode,
140                             const char * const pcName,
141                             const configSTACK_DEPTH_TYPE uxStackDepth,
142                             void * const pvParameters,
143                             UBaseType_t uxPriority,
144                             TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
145 TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
146                                     const char * const pcName,
147                                     const configSTACK_DEPTH_TYPE uxStackDepth,
148                                     void * const pvParameters,
149                                     UBaseType_t uxPriority,
150                                     StackType_t * const puxStackBuffer,
151                                     StaticTask_t * const pxTaskBuffer ) PRIVILEGED_FUNCTION;
152 void MPU_vTaskDelete( TaskHandle_t xTaskToDelete ) PRIVILEGED_FUNCTION;
153 void MPU_vTaskPrioritySet( TaskHandle_t xTask,
154                            UBaseType_t uxNewPriority ) PRIVILEGED_FUNCTION;
155 TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION;
156 BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask,
157                                              void * pvParameter ) PRIVILEGED_FUNCTION;
158 char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION;
159 BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
160                                       TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
161 BaseType_t MPU_xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition,
162                                             TaskHandle_t * pxCreatedTask ) PRIVILEGED_FUNCTION;
163 void MPU_vTaskAllocateMPURegions( TaskHandle_t xTaskToModify,
164                                   const MemoryRegion_t * const xRegions ) PRIVILEGED_FUNCTION;
165 BaseType_t MPU_xTaskGetStaticBuffers( TaskHandle_t xTask,
166                                       StackType_t ** ppuxStackBuffer,
167                                       StaticTask_t ** ppxTaskBuffer ) PRIVILEGED_FUNCTION;
168 UBaseType_t MPU_uxTaskPriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
169 UBaseType_t MPU_uxTaskBasePriorityGet( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
170 UBaseType_t MPU_uxTaskBasePriorityGetFromISR( const TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
171 BaseType_t MPU_xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
172 TaskHookFunction_t MPU_xTaskGetApplicationTaskTagFromISR( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
173 BaseType_t MPU_xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify,
174                                           UBaseType_t uxIndexToNotify,
175                                           uint32_t ulValue,
176                                           eNotifyAction eAction,
177                                           uint32_t * pulPreviousNotificationValue,
178                                           BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
179 void MPU_vTaskGenericNotifyGiveFromISR( TaskHandle_t xTaskToNotify,
180                                         UBaseType_t uxIndexToNotify,
181                                         BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
182 
183 /* MPU versions of queue.h API functions. */
184 BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue,
185                                   const void * const pvItemToQueue,
186                                   TickType_t xTicksToWait,
187                                   const BaseType_t xCopyPosition ) FREERTOS_SYSTEM_CALL;
188 BaseType_t MPU_xQueueReceive( QueueHandle_t xQueue,
189                               void * const pvBuffer,
190                               TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
191 BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue,
192                            void * const pvBuffer,
193                            TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
194 BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue,
195                                     TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
196 UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
197 UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
198 TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) FREERTOS_SYSTEM_CALL;
199 BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex,
200                                          TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
201 BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) FREERTOS_SYSTEM_CALL;
202 void MPU_vQueueAddToRegistry( QueueHandle_t xQueue,
203                               const char * pcName ) FREERTOS_SYSTEM_CALL;
204 void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
205 const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
206 BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
207                                QueueSetHandle_t xQueueSet ) FREERTOS_SYSTEM_CALL;
208 QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet,
209                                                 const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
210 void MPU_vQueueSetQueueNumber( QueueHandle_t xQueue,
211                                UBaseType_t uxQueueNumber ) FREERTOS_SYSTEM_CALL;
212 UBaseType_t MPU_uxQueueGetQueueNumber( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
213 uint8_t MPU_ucQueueGetQueueType( QueueHandle_t xQueue ) FREERTOS_SYSTEM_CALL;
214 
215 /* Privileged only wrappers for Queue APIs. These are needed so that
216  * the application can use opaque handles maintained in mpu_wrappers.c
217  * with all the APIs. */
218 void MPU_vQueueDelete( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
219 QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
220 QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType,
221                                            StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
222 QueueHandle_t MPU_xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount,
223                                                  const UBaseType_t uxInitialCount ) PRIVILEGED_FUNCTION;
224 QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
225                                                        const UBaseType_t uxInitialCount,
226                                                        StaticQueue_t * pxStaticQueue ) PRIVILEGED_FUNCTION;
227 QueueHandle_t MPU_xQueueGenericCreate( const UBaseType_t uxQueueLength,
228                                        const UBaseType_t uxItemSize,
229                                        const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
230 QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength,
231                                              const UBaseType_t uxItemSize,
232                                              uint8_t * pucQueueStorage,
233                                              StaticQueue_t * pxStaticQueue,
234                                              const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
235 QueueSetHandle_t MPU_xQueueCreateSet( const UBaseType_t uxEventQueueLength ) PRIVILEGED_FUNCTION;
236 BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
237                                     QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
238 BaseType_t MPU_xQueueGenericReset( QueueHandle_t xQueue,
239                                    BaseType_t xNewQueue ) PRIVILEGED_FUNCTION;
240 BaseType_t MPU_xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
241                                               uint8_t ** ppucQueueStorage,
242                                               StaticQueue_t ** ppxStaticQueue ) PRIVILEGED_FUNCTION;
243 BaseType_t MPU_xQueueGenericSendFromISR( QueueHandle_t xQueue,
244                                          const void * const pvItemToQueue,
245                                          BaseType_t * const pxHigherPriorityTaskWoken,
246                                          const BaseType_t xCopyPosition ) PRIVILEGED_FUNCTION;
247 BaseType_t MPU_xQueueGiveFromISR( QueueHandle_t xQueue,
248                                   BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
249 BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t xQueue,
250                                   void * const pvBuffer ) PRIVILEGED_FUNCTION;
251 BaseType_t MPU_xQueueReceiveFromISR( QueueHandle_t xQueue,
252                                      void * const pvBuffer,
253                                      BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
254 BaseType_t MPU_xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
255 BaseType_t MPU_xQueueIsQueueFullFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
256 UBaseType_t MPU_uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
257 TaskHandle_t MPU_xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTION;
258 QueueSetMemberHandle_t MPU_xQueueSelectFromSetFromISR( QueueSetHandle_t xQueueSet ) PRIVILEGED_FUNCTION;
259 
260 /* MPU versions of timers.h API functions. */
261 void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
262 void MPU_vTimerSetTimerID( TimerHandle_t xTimer,
263                            void * pvNewID ) FREERTOS_SYSTEM_CALL;
264 BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
265 TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL;
266 BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
267                                              const BaseType_t xCommandID,
268                                              const TickType_t xOptionalValue,
269                                              BaseType_t * const pxHigherPriorityTaskWoken,
270                                              const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
271 BaseType_t MPU_xTimerGenericCommandFromTaskEntry( const xTimerGenericCommandFromTaskParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
272 const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
273 void MPU_vTimerSetReloadMode( TimerHandle_t xTimer,
274                               const BaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL;
275 BaseType_t MPU_xTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
276 UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
277 TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
278 TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
279 
280 /* Privileged only wrappers for Timer APIs. These are needed so that
281  * the application can use opaque handles maintained in mpu_wrappers.c
282  * with all the APIs. */
283 TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName,
284                                 const TickType_t xTimerPeriodInTicks,
285                                 const UBaseType_t uxAutoReload,
286                                 void * const pvTimerID,
287                                 TimerCallbackFunction_t pxCallbackFunction ) PRIVILEGED_FUNCTION;
288 TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName,
289                                       const TickType_t xTimerPeriodInTicks,
290                                       const UBaseType_t uxAutoReload,
291                                       void * const pvTimerID,
292                                       TimerCallbackFunction_t pxCallbackFunction,
293                                       StaticTimer_t * pxTimerBuffer ) PRIVILEGED_FUNCTION;
294 BaseType_t MPU_xTimerGetStaticBuffer( TimerHandle_t xTimer,
295                                       StaticTimer_t ** ppxTimerBuffer ) PRIVILEGED_FUNCTION;
296 BaseType_t MPU_xTimerGenericCommandFromISR( TimerHandle_t xTimer,
297                                             const BaseType_t xCommandID,
298                                             const TickType_t xOptionalValue,
299                                             BaseType_t * const pxHigherPriorityTaskWoken,
300                                             const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;
301 
302 /* MPU versions of event_group.h API functions. */
303 EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
304                                      const EventBits_t uxBitsToWaitFor,
305                                      const BaseType_t xClearOnExit,
306                                      const BaseType_t xWaitForAllBits,
307                                      TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
308 EventBits_t MPU_xEventGroupWaitBitsEntry( const xEventGroupWaitBitsParams_t * pxParams ) FREERTOS_SYSTEM_CALL;
309 EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup,
310                                       const EventBits_t uxBitsToClear ) FREERTOS_SYSTEM_CALL;
311 EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup,
312                                     const EventBits_t uxBitsToSet ) FREERTOS_SYSTEM_CALL;
313 EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup,
314                                  const EventBits_t uxBitsToSet,
315                                  const EventBits_t uxBitsToWaitFor,
316                                  TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
317 #if ( configUSE_TRACE_FACILITY == 1 )
318     UBaseType_t MPU_uxEventGroupGetNumber( void * xEventGroup ) FREERTOS_SYSTEM_CALL;
319     void MPU_vEventGroupSetNumber( void * xEventGroup,
320                                    UBaseType_t uxEventGroupNumber ) FREERTOS_SYSTEM_CALL;
321 #endif /* ( configUSE_TRACE_FACILITY == 1 )*/
322 
323 /* Privileged only wrappers for Event Group APIs. These are needed so that
324  * the application can use opaque handles maintained in mpu_wrappers.c
325  * with all the APIs. */
326 EventGroupHandle_t MPU_xEventGroupCreate( void ) PRIVILEGED_FUNCTION;
327 EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) PRIVILEGED_FUNCTION;
328 void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
329 BaseType_t MPU_xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
330                                            StaticEventGroup_t ** ppxEventGroupBuffer ) PRIVILEGED_FUNCTION;
331 BaseType_t MPU_xEventGroupClearBitsFromISR( EventGroupHandle_t xEventGroup,
332                                             const EventBits_t uxBitsToClear ) PRIVILEGED_FUNCTION;
333 BaseType_t MPU_xEventGroupSetBitsFromISR( EventGroupHandle_t xEventGroup,
334                                           const EventBits_t uxBitsToSet,
335                                           BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
336 EventBits_t MPU_xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
337 
338 /* MPU versions of message/stream_buffer.h API functions. */
339 size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
340                               const void * pvTxData,
341                               size_t xDataLengthBytes,
342                               TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
343 size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
344                                  void * pvRxData,
345                                  size_t xBufferLengthBytes,
346                                  TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
347 BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
348 BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
349 size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
350 size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
351 BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer,
352                                              size_t xTriggerLevel ) FREERTOS_SYSTEM_CALL;
353 size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) FREERTOS_SYSTEM_CALL;
354 
355 /* Privileged only wrappers for Stream Buffer APIs. These are needed so that
356  * the application can use opaque handles maintained in mpu_wrappers.c
357  * with all the APIs. */
358 StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
359                                                      size_t xTriggerLevelBytes,
360                                                      BaseType_t xStreamBufferType,
361                                                      StreamBufferCallbackFunction_t pxSendCompletedCallback,
362                                                      StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
363 StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
364                                                            size_t xTriggerLevelBytes,
365                                                            BaseType_t xStreamBufferType,
366                                                            uint8_t * const pucStreamBufferStorageArea,
367                                                            StaticStreamBuffer_t * const pxStaticStreamBuffer,
368                                                            StreamBufferCallbackFunction_t pxSendCompletedCallback,
369                                                            StreamBufferCallbackFunction_t pxReceiveCompletedCallback ) PRIVILEGED_FUNCTION;
370 void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
371 BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
372 BaseType_t MPU_xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffers,
373                                               uint8_t * ppucStreamBufferStorageArea,
374                                               StaticStreamBuffer_t * ppxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
375 size_t MPU_xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
376                                      const void * pvTxData,
377                                      size_t xDataLengthBytes,
378                                      BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
379 size_t MPU_xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
380                                         void * pvRxData,
381                                         size_t xBufferLengthBytes,
382                                         BaseType_t * const pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
383 BaseType_t MPU_xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
384                                                   BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
385 BaseType_t MPU_xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer,
386                                                      BaseType_t * pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
387 BaseType_t MPU_xStreamBufferResetFromISR( StreamBufferHandle_t xStreamBuffer ) PRIVILEGED_FUNCTION;
388 
389 #endif /* MPU_PROTOTYPES_H */
390