mpu_wrappers.c 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482
  1. /*
  2. * FreeRTOS Kernel V10.4.6
  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. * Implementation of the wrapper functions used to raise the processor privilege
  30. * before calling a standard FreeRTOS API function.
  31. */
  32. /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining
  33. * all the API functions to use the MPU wrappers. That should only be done when
  34. * task.h is included from an application file. */
  35. #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
  36. /* Scheduler includes. */
  37. #include "FreeRTOS.h"
  38. #include "task.h"
  39. #include "queue.h"
  40. #include "timers.h"
  41. #include "event_groups.h"
  42. #include "stream_buffer.h"
  43. #include "mpu_prototypes.h"
  44. #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
  45. /*-----------------------------------------------------------*/
  46. #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  47. BaseType_t MPU_xTaskCreate( TaskFunction_t pvTaskCode,
  48. const char * const pcName,
  49. uint16_t usStackDepth,
  50. void * pvParameters,
  51. UBaseType_t uxPriority,
  52. TaskHandle_t * pxCreatedTask ) /* FREERTOS_SYSTEM_CALL */
  53. {
  54. BaseType_t xReturn, xRunningPrivileged;
  55. xPortRaisePrivilege( xRunningPrivileged );
  56. xReturn = xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
  57. vPortResetPrivilege( xRunningPrivileged );
  58. return xReturn;
  59. }
  60. #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
  61. /*-----------------------------------------------------------*/
  62. #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
  63. TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode,
  64. const char * const pcName,
  65. const uint32_t ulStackDepth,
  66. void * const pvParameters,
  67. UBaseType_t uxPriority,
  68. StackType_t * const puxStackBuffer,
  69. StaticTask_t * const pxTaskBuffer ) /* FREERTOS_SYSTEM_CALL */
  70. {
  71. TaskHandle_t xReturn;
  72. BaseType_t xRunningPrivileged;
  73. xPortRaisePrivilege( xRunningPrivileged );
  74. xReturn = xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
  75. vPortResetPrivilege( xRunningPrivileged );
  76. return xReturn;
  77. }
  78. #endif /* configSUPPORT_STATIC_ALLOCATION */
  79. /*-----------------------------------------------------------*/
  80. #if ( INCLUDE_vTaskDelete == 1 )
  81. void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete ) /* FREERTOS_SYSTEM_CALL */
  82. {
  83. BaseType_t xRunningPrivileged;
  84. xPortRaisePrivilege( xRunningPrivileged );
  85. vTaskDelete( pxTaskToDelete );
  86. vPortResetPrivilege( xRunningPrivileged );
  87. }
  88. #endif
  89. /*-----------------------------------------------------------*/
  90. #if ( INCLUDE_xTaskDelayUntil == 1 )
  91. BaseType_t MPU_xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
  92. TickType_t xTimeIncrement ) /* FREERTOS_SYSTEM_CALL */
  93. {
  94. BaseType_t xRunningPrivileged, xReturn;
  95. xPortRaisePrivilege( xRunningPrivileged );
  96. xReturn = xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement );
  97. vPortResetPrivilege( xRunningPrivileged );
  98. return xReturn;
  99. }
  100. #endif /* if ( INCLUDE_xTaskDelayUntil == 1 ) */
  101. /*-----------------------------------------------------------*/
  102. #if ( INCLUDE_xTaskAbortDelay == 1 )
  103. BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */
  104. {
  105. BaseType_t xReturn, xRunningPrivileged;
  106. xPortRaisePrivilege( xRunningPrivileged );
  107. xReturn = xTaskAbortDelay( xTask );
  108. vPortResetPrivilege( xRunningPrivileged );
  109. return xReturn;
  110. }
  111. #endif /* if ( INCLUDE_xTaskAbortDelay == 1 ) */
  112. /*-----------------------------------------------------------*/
  113. #if ( INCLUDE_vTaskDelay == 1 )
  114. void MPU_vTaskDelay( TickType_t xTicksToDelay ) /* FREERTOS_SYSTEM_CALL */
  115. {
  116. BaseType_t xRunningPrivileged;
  117. xPortRaisePrivilege( xRunningPrivileged );
  118. vTaskDelay( xTicksToDelay );
  119. vPortResetPrivilege( xRunningPrivileged );
  120. }
  121. #endif
  122. /*-----------------------------------------------------------*/
  123. #if ( INCLUDE_uxTaskPriorityGet == 1 )
  124. UBaseType_t MPU_uxTaskPriorityGet( const TaskHandle_t pxTask ) /* FREERTOS_SYSTEM_CALL */
  125. {
  126. UBaseType_t uxReturn;
  127. BaseType_t xRunningPrivileged;
  128. xPortRaisePrivilege( xRunningPrivileged );
  129. uxReturn = uxTaskPriorityGet( pxTask );
  130. vPortResetPrivilege( xRunningPrivileged );
  131. return uxReturn;
  132. }
  133. #endif /* if ( INCLUDE_uxTaskPriorityGet == 1 ) */
  134. /*-----------------------------------------------------------*/
  135. #if ( INCLUDE_vTaskPrioritySet == 1 )
  136. void MPU_vTaskPrioritySet( TaskHandle_t pxTask,
  137. UBaseType_t uxNewPriority ) /* FREERTOS_SYSTEM_CALL */
  138. {
  139. BaseType_t xRunningPrivileged;
  140. xPortRaisePrivilege( xRunningPrivileged );
  141. vTaskPrioritySet( pxTask, uxNewPriority );
  142. vPortResetPrivilege( xRunningPrivileged );
  143. }
  144. #endif /* if ( INCLUDE_vTaskPrioritySet == 1 ) */
  145. /*-----------------------------------------------------------*/
  146. #if ( INCLUDE_eTaskGetState == 1 )
  147. eTaskState MPU_eTaskGetState( TaskHandle_t pxTask ) /* FREERTOS_SYSTEM_CALL */
  148. {
  149. eTaskState eReturn;
  150. BaseType_t xRunningPrivileged;
  151. xPortRaisePrivilege( xRunningPrivileged );
  152. eReturn = eTaskGetState( pxTask );
  153. vPortResetPrivilege( xRunningPrivileged );
  154. return eReturn;
  155. }
  156. #endif /* if ( INCLUDE_eTaskGetState == 1 ) */
  157. /*-----------------------------------------------------------*/
  158. #if ( configUSE_TRACE_FACILITY == 1 )
  159. void MPU_vTaskGetInfo( TaskHandle_t xTask,
  160. TaskStatus_t * pxTaskStatus,
  161. BaseType_t xGetFreeStackSpace,
  162. eTaskState eState ) /* FREERTOS_SYSTEM_CALL */
  163. {
  164. BaseType_t xRunningPrivileged;
  165. xPortRaisePrivilege( xRunningPrivileged );
  166. vTaskGetInfo( xTask, pxTaskStatus, xGetFreeStackSpace, eState );
  167. vPortResetPrivilege( xRunningPrivileged );
  168. }
  169. #endif /* if ( configUSE_TRACE_FACILITY == 1 ) */
  170. /*-----------------------------------------------------------*/
  171. #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
  172. TaskHandle_t MPU_xTaskGetIdleTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */
  173. {
  174. TaskHandle_t xReturn;
  175. BaseType_t xRunningPrivileged;
  176. xPortRaisePrivilege( xRunningPrivileged );
  177. xReturn = xTaskGetIdleTaskHandle();
  178. vPortResetPrivilege( xRunningPrivileged );
  179. return xReturn;
  180. }
  181. #endif /* if ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) */
  182. /*-----------------------------------------------------------*/
  183. #if ( INCLUDE_vTaskSuspend == 1 )
  184. void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend ) /* FREERTOS_SYSTEM_CALL */
  185. {
  186. BaseType_t xRunningPrivileged;
  187. xPortRaisePrivilege( xRunningPrivileged );
  188. vTaskSuspend( pxTaskToSuspend );
  189. vPortResetPrivilege( xRunningPrivileged );
  190. }
  191. #endif
  192. /*-----------------------------------------------------------*/
  193. #if ( INCLUDE_vTaskSuspend == 1 )
  194. void MPU_vTaskResume( TaskHandle_t pxTaskToResume ) /* FREERTOS_SYSTEM_CALL */
  195. {
  196. BaseType_t xRunningPrivileged;
  197. xPortRaisePrivilege( xRunningPrivileged );
  198. vTaskResume( pxTaskToResume );
  199. vPortResetPrivilege( xRunningPrivileged );
  200. }
  201. #endif
  202. /*-----------------------------------------------------------*/
  203. void MPU_vTaskSuspendAll( void ) /* FREERTOS_SYSTEM_CALL */
  204. {
  205. BaseType_t xRunningPrivileged;
  206. xPortRaisePrivilege( xRunningPrivileged );
  207. vTaskSuspendAll();
  208. vPortResetPrivilege( xRunningPrivileged );
  209. }
  210. /*-----------------------------------------------------------*/
  211. BaseType_t MPU_xTaskResumeAll( void ) /* FREERTOS_SYSTEM_CALL */
  212. {
  213. BaseType_t xReturn, xRunningPrivileged;
  214. xPortRaisePrivilege( xRunningPrivileged );
  215. xReturn = xTaskResumeAll();
  216. vPortResetPrivilege( xRunningPrivileged );
  217. return xReturn;
  218. }
  219. /*-----------------------------------------------------------*/
  220. TickType_t MPU_xTaskGetTickCount( void ) /* FREERTOS_SYSTEM_CALL */
  221. {
  222. TickType_t xReturn;
  223. BaseType_t xRunningPrivileged;
  224. xPortRaisePrivilege( xRunningPrivileged );
  225. xReturn = xTaskGetTickCount();
  226. vPortResetPrivilege( xRunningPrivileged );
  227. return xReturn;
  228. }
  229. /*-----------------------------------------------------------*/
  230. UBaseType_t MPU_uxTaskGetNumberOfTasks( void ) /* FREERTOS_SYSTEM_CALL */
  231. {
  232. UBaseType_t uxReturn;
  233. BaseType_t xRunningPrivileged;
  234. xPortRaisePrivilege( xRunningPrivileged );
  235. uxReturn = uxTaskGetNumberOfTasks();
  236. vPortResetPrivilege( xRunningPrivileged );
  237. return uxReturn;
  238. }
  239. /*-----------------------------------------------------------*/
  240. char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery ) /* FREERTOS_SYSTEM_CALL */
  241. {
  242. char * pcReturn;
  243. BaseType_t xRunningPrivileged;
  244. xPortRaisePrivilege( xRunningPrivileged );
  245. pcReturn = pcTaskGetName( xTaskToQuery );
  246. vPortResetPrivilege( xRunningPrivileged );
  247. return pcReturn;
  248. }
  249. /*-----------------------------------------------------------*/
  250. #if ( INCLUDE_xTaskGetHandle == 1 )
  251. TaskHandle_t MPU_xTaskGetHandle( const char * pcNameToQuery ) /* FREERTOS_SYSTEM_CALL */
  252. {
  253. TaskHandle_t xReturn;
  254. BaseType_t xRunningPrivileged;
  255. xPortRaisePrivilege( xRunningPrivileged );
  256. xReturn = xTaskGetHandle( pcNameToQuery );
  257. vPortResetPrivilege( xRunningPrivileged );
  258. return xReturn;
  259. }
  260. #endif /* if ( INCLUDE_xTaskGetHandle == 1 ) */
  261. /*-----------------------------------------------------------*/
  262. #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  263. void MPU_vTaskList( char * pcWriteBuffer ) /* FREERTOS_SYSTEM_CALL */
  264. {
  265. BaseType_t xRunningPrivileged;
  266. xPortRaisePrivilege( xRunningPrivileged );
  267. vTaskList( pcWriteBuffer );
  268. vPortResetPrivilege( xRunningPrivileged );
  269. }
  270. #endif
  271. /*-----------------------------------------------------------*/
  272. #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  273. void MPU_vTaskGetRunTimeStats( char * pcWriteBuffer ) /* FREERTOS_SYSTEM_CALL */
  274. {
  275. BaseType_t xRunningPrivileged;
  276. xPortRaisePrivilege( xRunningPrivileged );
  277. vTaskGetRunTimeStats( pcWriteBuffer );
  278. vPortResetPrivilege( xRunningPrivileged );
  279. }
  280. #endif
  281. /*-----------------------------------------------------------*/
  282. #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
  283. configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimePercent( void ) /* FREERTOS_SYSTEM_CALL */
  284. {
  285. configRUN_TIME_COUNTER_TYPE xReturn;
  286. BaseType_t xRunningPrivileged;
  287. xPortRaisePrivilege( xRunningPrivileged );
  288. xReturn = ulTaskGetIdleRunTimePercent();
  289. vPortResetPrivilege( xRunningPrivileged );
  290. return xReturn;
  291. }
  292. #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
  293. /*-----------------------------------------------------------*/
  294. #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) )
  295. configRUN_TIME_COUNTER_TYPE MPU_ulTaskGetIdleRunTimeCounter( void ) /* FREERTOS_SYSTEM_CALL */
  296. {
  297. configRUN_TIME_COUNTER_TYPE xReturn;
  298. BaseType_t xRunningPrivileged;
  299. xPortRaisePrivilege( xRunningPrivileged );
  300. xReturn = ulTaskGetIdleRunTimeCounter();
  301. vPortResetPrivilege( xRunningPrivileged );
  302. return xReturn;
  303. }
  304. #endif /* if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( INCLUDE_xTaskGetIdleTaskHandle == 1 ) ) */
  305. /*-----------------------------------------------------------*/
  306. #if ( configUSE_APPLICATION_TASK_TAG == 1 )
  307. void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask,
  308. TaskHookFunction_t pxTagValue ) /* FREERTOS_SYSTEM_CALL */
  309. {
  310. BaseType_t xRunningPrivileged;
  311. xPortRaisePrivilege( xRunningPrivileged );
  312. vTaskSetApplicationTaskTag( xTask, pxTagValue );
  313. vPortResetPrivilege( xRunningPrivileged );
  314. }
  315. #endif /* if ( configUSE_APPLICATION_TASK_TAG == 1 ) */
  316. /*-----------------------------------------------------------*/
  317. #if ( configUSE_APPLICATION_TASK_TAG == 1 )
  318. TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */
  319. {
  320. TaskHookFunction_t xReturn;
  321. BaseType_t xRunningPrivileged;
  322. xPortRaisePrivilege( xRunningPrivileged );
  323. xReturn = xTaskGetApplicationTaskTag( xTask );
  324. vPortResetPrivilege( xRunningPrivileged );
  325. return xReturn;
  326. }
  327. #endif /* if ( configUSE_APPLICATION_TASK_TAG == 1 ) */
  328. /*-----------------------------------------------------------*/
  329. #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
  330. void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet,
  331. BaseType_t xIndex,
  332. void * pvValue ) /* FREERTOS_SYSTEM_CALL */
  333. {
  334. BaseType_t xRunningPrivileged;
  335. xPortRaisePrivilege( xRunningPrivileged );
  336. vTaskSetThreadLocalStoragePointer( xTaskToSet, xIndex, pvValue );
  337. vPortResetPrivilege( xRunningPrivileged );
  338. }
  339. #endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) */
  340. /*-----------------------------------------------------------*/
  341. #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
  342. void * MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery,
  343. BaseType_t xIndex ) /* FREERTOS_SYSTEM_CALL */
  344. {
  345. void * pvReturn;
  346. BaseType_t xRunningPrivileged;
  347. xPortRaisePrivilege( xRunningPrivileged );
  348. pvReturn = pvTaskGetThreadLocalStoragePointer( xTaskToQuery, xIndex );
  349. vPortResetPrivilege( xRunningPrivileged );
  350. return pvReturn;
  351. }
  352. #endif /* if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 ) */
  353. /*-----------------------------------------------------------*/
  354. #if ( configUSE_APPLICATION_TASK_TAG == 1 )
  355. BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask,
  356. void * pvParameter ) /* FREERTOS_SYSTEM_CALL */
  357. {
  358. BaseType_t xReturn, xRunningPrivileged;
  359. xPortRaisePrivilege( xRunningPrivileged );
  360. xReturn = xTaskCallApplicationTaskHook( xTask, pvParameter );
  361. vPortResetPrivilege( xRunningPrivileged );
  362. return xReturn;
  363. }
  364. #endif /* if ( configUSE_APPLICATION_TASK_TAG == 1 ) */
  365. /*-----------------------------------------------------------*/
  366. #if ( configUSE_TRACE_FACILITY == 1 )
  367. UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t * pxTaskStatusArray,
  368. UBaseType_t uxArraySize,
  369. configRUN_TIME_COUNTER_TYPE * pulTotalRunTime ) /* FREERTOS_SYSTEM_CALL */
  370. {
  371. UBaseType_t uxReturn;
  372. BaseType_t xRunningPrivileged;
  373. xPortRaisePrivilege( xRunningPrivileged );
  374. uxReturn = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime );
  375. vPortResetPrivilege( xRunningPrivileged );
  376. return uxReturn;
  377. }
  378. #endif /* if ( configUSE_TRACE_FACILITY == 1 ) */
  379. /*-----------------------------------------------------------*/
  380. BaseType_t MPU_xTaskCatchUpTicks( TickType_t xTicksToCatchUp ) /* FREERTOS_SYSTEM_CALL */
  381. {
  382. BaseType_t xReturn, xRunningPrivileged;
  383. xPortRaisePrivilege( xRunningPrivileged );
  384. xReturn = xTaskCatchUpTicks( xTicksToCatchUp );
  385. vPortResetPrivilege( xRunningPrivileged );
  386. return xReturn;
  387. }
  388. /*-----------------------------------------------------------*/
  389. #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )
  390. UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */
  391. {
  392. UBaseType_t uxReturn;
  393. BaseType_t xRunningPrivileged;
  394. xPortRaisePrivilege( xRunningPrivileged );
  395. uxReturn = uxTaskGetStackHighWaterMark( xTask );
  396. vPortResetPrivilege( xRunningPrivileged );
  397. return uxReturn;
  398. }
  399. #endif /* if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) */
  400. /*-----------------------------------------------------------*/
  401. #if ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 )
  402. configSTACK_DEPTH_TYPE MPU_uxTaskGetStackHighWaterMark2( TaskHandle_t xTask ) /* FREERTOS_SYSTEM_CALL */
  403. {
  404. configSTACK_DEPTH_TYPE uxReturn;
  405. BaseType_t xRunningPrivileged;
  406. xPortRaisePrivilege( xRunningPrivileged );
  407. uxReturn = uxTaskGetStackHighWaterMark2( xTask );
  408. vPortResetPrivilege( xRunningPrivileged );
  409. return uxReturn;
  410. }
  411. #endif /* if ( INCLUDE_uxTaskGetStackHighWaterMark2 == 1 ) */
  412. /*-----------------------------------------------------------*/
  413. #if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) )
  414. TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */
  415. {
  416. TaskHandle_t xReturn;
  417. BaseType_t xRunningPrivileged;
  418. xPortRaisePrivilege( xRunningPrivileged );
  419. xReturn = xTaskGetCurrentTaskHandle();
  420. vPortResetPrivilege( xRunningPrivileged );
  421. return xReturn;
  422. }
  423. #endif /* if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) */
  424. /*-----------------------------------------------------------*/
  425. #if ( INCLUDE_xTaskGetSchedulerState == 1 )
  426. BaseType_t MPU_xTaskGetSchedulerState( void ) /* FREERTOS_SYSTEM_CALL */
  427. {
  428. BaseType_t xReturn, xRunningPrivileged;
  429. xPortRaisePrivilege( xRunningPrivileged );
  430. xReturn = xTaskGetSchedulerState();
  431. vPortResetPrivilege( xRunningPrivileged );
  432. return xReturn;
  433. }
  434. #endif /* if ( INCLUDE_xTaskGetSchedulerState == 1 ) */
  435. /*-----------------------------------------------------------*/
  436. void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut ) /* FREERTOS_SYSTEM_CALL */
  437. {
  438. BaseType_t xRunningPrivileged;
  439. xPortRaisePrivilege( xRunningPrivileged );
  440. vTaskSetTimeOutState( pxTimeOut );
  441. vPortResetPrivilege( xRunningPrivileged );
  442. }
  443. /*-----------------------------------------------------------*/
  444. BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut,
  445. TickType_t * const pxTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  446. {
  447. BaseType_t xReturn, xRunningPrivileged;
  448. xPortRaisePrivilege( xRunningPrivileged );
  449. xReturn = xTaskCheckForTimeOut( pxTimeOut, pxTicksToWait );
  450. vPortResetPrivilege( xRunningPrivileged );
  451. return xReturn;
  452. }
  453. /*-----------------------------------------------------------*/
  454. #if ( configUSE_TASK_NOTIFICATIONS == 1 )
  455. BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify,
  456. UBaseType_t uxIndexToNotify,
  457. uint32_t ulValue,
  458. eNotifyAction eAction,
  459. uint32_t * pulPreviousNotificationValue ) /* FREERTOS_SYSTEM_CALL */
  460. {
  461. BaseType_t xReturn, xRunningPrivileged;
  462. xPortRaisePrivilege( xRunningPrivileged );
  463. xReturn = xTaskGenericNotify( xTaskToNotify, uxIndexToNotify, ulValue, eAction, pulPreviousNotificationValue );
  464. vPortResetPrivilege( xRunningPrivileged );
  465. return xReturn;
  466. }
  467. #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
  468. /*-----------------------------------------------------------*/
  469. #if ( configUSE_TASK_NOTIFICATIONS == 1 )
  470. BaseType_t MPU_xTaskGenericNotifyWait( UBaseType_t uxIndexToWaitOn,
  471. uint32_t ulBitsToClearOnEntry,
  472. uint32_t ulBitsToClearOnExit,
  473. uint32_t * pulNotificationValue,
  474. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  475. {
  476. BaseType_t xReturn, xRunningPrivileged;
  477. xPortRaisePrivilege( xRunningPrivileged );
  478. xReturn = xTaskGenericNotifyWait( uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait );
  479. vPortResetPrivilege( xRunningPrivileged );
  480. return xReturn;
  481. }
  482. #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
  483. /*-----------------------------------------------------------*/
  484. #if ( configUSE_TASK_NOTIFICATIONS == 1 )
  485. uint32_t MPU_ulTaskGenericNotifyTake( UBaseType_t uxIndexToWaitOn,
  486. BaseType_t xClearCountOnExit,
  487. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  488. {
  489. uint32_t ulReturn;
  490. BaseType_t xRunningPrivileged;
  491. xPortRaisePrivilege( xRunningPrivileged );
  492. ulReturn = ulTaskGenericNotifyTake( uxIndexToWaitOn, xClearCountOnExit, xTicksToWait );
  493. vPortResetPrivilege( xRunningPrivileged );
  494. return ulReturn;
  495. }
  496. #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
  497. /*-----------------------------------------------------------*/
  498. #if ( configUSE_TASK_NOTIFICATIONS == 1 )
  499. BaseType_t MPU_xTaskGenericNotifyStateClear( TaskHandle_t xTask,
  500. UBaseType_t uxIndexToClear ) /* FREERTOS_SYSTEM_CALL */
  501. {
  502. BaseType_t xReturn, xRunningPrivileged;
  503. xPortRaisePrivilege( xRunningPrivileged );
  504. xReturn = xTaskGenericNotifyStateClear( xTask, uxIndexToClear );
  505. vPortResetPrivilege( xRunningPrivileged );
  506. return xReturn;
  507. }
  508. #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
  509. /*-----------------------------------------------------------*/
  510. #if ( configUSE_TASK_NOTIFICATIONS == 1 )
  511. uint32_t MPU_ulTaskGenericNotifyValueClear( TaskHandle_t xTask,
  512. UBaseType_t uxIndexToClear,
  513. uint32_t ulBitsToClear ) /* FREERTOS_SYSTEM_CALL */
  514. {
  515. uint32_t ulReturn;
  516. BaseType_t xRunningPrivileged;
  517. xPortRaisePrivilege( xRunningPrivileged );
  518. ulReturn = ulTaskGenericNotifyValueClear( xTask, uxIndexToClear, ulBitsToClear );
  519. vPortResetPrivilege( xRunningPrivileged );
  520. return ulReturn;
  521. }
  522. #endif /* if ( configUSE_TASK_NOTIFICATIONS == 1 ) */
  523. /*-----------------------------------------------------------*/
  524. #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  525. QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength,
  526. UBaseType_t uxItemSize,
  527. uint8_t ucQueueType ) /* FREERTOS_SYSTEM_CALL */
  528. {
  529. QueueHandle_t xReturn;
  530. BaseType_t xRunningPrivileged;
  531. xPortRaisePrivilege( xRunningPrivileged );
  532. xReturn = xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType );
  533. vPortResetPrivilege( xRunningPrivileged );
  534. return xReturn;
  535. }
  536. #endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
  537. /*-----------------------------------------------------------*/
  538. #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
  539. QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength,
  540. const UBaseType_t uxItemSize,
  541. uint8_t * pucQueueStorage,
  542. StaticQueue_t * pxStaticQueue,
  543. const uint8_t ucQueueType ) /* FREERTOS_SYSTEM_CALL */
  544. {
  545. QueueHandle_t xReturn;
  546. BaseType_t xRunningPrivileged;
  547. xPortRaisePrivilege( xRunningPrivileged );
  548. xReturn = xQueueGenericCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, ucQueueType );
  549. vPortResetPrivilege( xRunningPrivileged );
  550. return xReturn;
  551. }
  552. #endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
  553. /*-----------------------------------------------------------*/
  554. BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue,
  555. BaseType_t xNewQueue ) /* FREERTOS_SYSTEM_CALL */
  556. {
  557. BaseType_t xReturn, xRunningPrivileged;
  558. xPortRaisePrivilege( xRunningPrivileged );
  559. xReturn = xQueueGenericReset( pxQueue, xNewQueue );
  560. vPortResetPrivilege( xRunningPrivileged );
  561. return xReturn;
  562. }
  563. /*-----------------------------------------------------------*/
  564. BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue,
  565. const void * const pvItemToQueue,
  566. TickType_t xTicksToWait,
  567. BaseType_t xCopyPosition ) /* FREERTOS_SYSTEM_CALL */
  568. {
  569. BaseType_t xReturn, xRunningPrivileged;
  570. xPortRaisePrivilege( xRunningPrivileged );
  571. xReturn = xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
  572. vPortResetPrivilege( xRunningPrivileged );
  573. return xReturn;
  574. }
  575. /*-----------------------------------------------------------*/
  576. UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t pxQueue ) /* FREERTOS_SYSTEM_CALL */
  577. {
  578. UBaseType_t uxReturn;
  579. BaseType_t xRunningPrivileged;
  580. xPortRaisePrivilege( xRunningPrivileged );
  581. uxReturn = uxQueueMessagesWaiting( pxQueue );
  582. vPortResetPrivilege( xRunningPrivileged );
  583. return uxReturn;
  584. }
  585. /*-----------------------------------------------------------*/
  586. UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */
  587. {
  588. UBaseType_t uxReturn;
  589. BaseType_t xRunningPrivileged;
  590. xPortRaisePrivilege( xRunningPrivileged );
  591. uxReturn = uxQueueSpacesAvailable( xQueue );
  592. vPortResetPrivilege( xRunningPrivileged );
  593. return uxReturn;
  594. }
  595. /*-----------------------------------------------------------*/
  596. BaseType_t MPU_xQueueReceive( QueueHandle_t pxQueue,
  597. void * const pvBuffer,
  598. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  599. {
  600. BaseType_t xReturn, xRunningPrivileged;
  601. xPortRaisePrivilege( xRunningPrivileged );
  602. xReturn = xQueueReceive( pxQueue, pvBuffer, xTicksToWait );
  603. vPortResetPrivilege( xRunningPrivileged );
  604. return xReturn;
  605. }
  606. /*-----------------------------------------------------------*/
  607. BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue,
  608. void * const pvBuffer,
  609. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  610. {
  611. BaseType_t xReturn, xRunningPrivileged;
  612. xPortRaisePrivilege( xRunningPrivileged );
  613. xReturn = xQueuePeek( xQueue, pvBuffer, xTicksToWait );
  614. vPortResetPrivilege( xRunningPrivileged );
  615. return xReturn;
  616. }
  617. /*-----------------------------------------------------------*/
  618. BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue,
  619. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  620. {
  621. BaseType_t xReturn, xRunningPrivileged;
  622. xPortRaisePrivilege( xRunningPrivileged );
  623. xReturn = xQueueSemaphoreTake( xQueue, xTicksToWait );
  624. vPortResetPrivilege( xRunningPrivileged );
  625. return xReturn;
  626. }
  627. /*-----------------------------------------------------------*/
  628. #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
  629. TaskHandle_t MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore ) /* FREERTOS_SYSTEM_CALL */
  630. {
  631. void * xReturn;
  632. BaseType_t xRunningPrivileged;
  633. xPortRaisePrivilege( xRunningPrivileged );
  634. xReturn = xQueueGetMutexHolder( xSemaphore );
  635. vPortResetPrivilege( xRunningPrivileged );
  636. return xReturn;
  637. }
  638. #endif /* if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) ) */
  639. /*-----------------------------------------------------------*/
  640. #if ( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  641. QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType ) /* FREERTOS_SYSTEM_CALL */
  642. {
  643. QueueHandle_t xReturn;
  644. BaseType_t xRunningPrivileged;
  645. xPortRaisePrivilege( xRunningPrivileged );
  646. xReturn = xQueueCreateMutex( ucQueueType );
  647. vPortResetPrivilege( xRunningPrivileged );
  648. return xReturn;
  649. }
  650. #endif /* if ( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */
  651. /*-----------------------------------------------------------*/
  652. #if ( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
  653. QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType,
  654. StaticQueue_t * pxStaticQueue ) /* FREERTOS_SYSTEM_CALL */
  655. {
  656. QueueHandle_t xReturn;
  657. BaseType_t xRunningPrivileged;
  658. xPortRaisePrivilege( xRunningPrivileged );
  659. xReturn = xQueueCreateMutexStatic( ucQueueType, pxStaticQueue );
  660. vPortResetPrivilege( xRunningPrivileged );
  661. return xReturn;
  662. }
  663. #endif /* if ( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) */
  664. /*-----------------------------------------------------------*/
  665. #if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  666. QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue,
  667. UBaseType_t uxInitialCount ) /* FREERTOS_SYSTEM_CALL */
  668. {
  669. QueueHandle_t xReturn;
  670. BaseType_t xRunningPrivileged;
  671. xPortRaisePrivilege( xRunningPrivileged );
  672. xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount );
  673. vPortResetPrivilege( xRunningPrivileged );
  674. return xReturn;
  675. }
  676. #endif /* if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */
  677. /*-----------------------------------------------------------*/
  678. #if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
  679. QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
  680. const UBaseType_t uxInitialCount,
  681. StaticQueue_t * pxStaticQueue ) /* FREERTOS_SYSTEM_CALL */
  682. {
  683. QueueHandle_t xReturn;
  684. BaseType_t xRunningPrivileged;
  685. xPortRaisePrivilege( xRunningPrivileged );
  686. xReturn = xQueueCreateCountingSemaphoreStatic( uxMaxCount, uxInitialCount, pxStaticQueue );
  687. vPortResetPrivilege( xRunningPrivileged );
  688. return xReturn;
  689. }
  690. #endif /* if ( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) */
  691. /*-----------------------------------------------------------*/
  692. #if ( configUSE_RECURSIVE_MUTEXES == 1 )
  693. BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex,
  694. TickType_t xBlockTime ) /* FREERTOS_SYSTEM_CALL */
  695. {
  696. BaseType_t xReturn, xRunningPrivileged;
  697. xPortRaisePrivilege( xRunningPrivileged );
  698. xReturn = xQueueTakeMutexRecursive( xMutex, xBlockTime );
  699. vPortResetPrivilege( xRunningPrivileged );
  700. return xReturn;
  701. }
  702. #endif /* if ( configUSE_RECURSIVE_MUTEXES == 1 ) */
  703. /*-----------------------------------------------------------*/
  704. #if ( configUSE_RECURSIVE_MUTEXES == 1 )
  705. BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t xMutex ) /* FREERTOS_SYSTEM_CALL */
  706. {
  707. BaseType_t xReturn, xRunningPrivileged;
  708. xPortRaisePrivilege( xRunningPrivileged );
  709. xReturn = xQueueGiveMutexRecursive( xMutex );
  710. vPortResetPrivilege( xRunningPrivileged );
  711. return xReturn;
  712. }
  713. #endif /* if ( configUSE_RECURSIVE_MUTEXES == 1 ) */
  714. /*-----------------------------------------------------------*/
  715. #if ( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  716. QueueSetHandle_t MPU_xQueueCreateSet( UBaseType_t uxEventQueueLength ) /* FREERTOS_SYSTEM_CALL */
  717. {
  718. QueueSetHandle_t xReturn;
  719. BaseType_t xRunningPrivileged;
  720. xPortRaisePrivilege( xRunningPrivileged );
  721. xReturn = xQueueCreateSet( uxEventQueueLength );
  722. vPortResetPrivilege( xRunningPrivileged );
  723. return xReturn;
  724. }
  725. #endif /* if ( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */
  726. /*-----------------------------------------------------------*/
  727. #if ( configUSE_QUEUE_SETS == 1 )
  728. QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet,
  729. TickType_t xBlockTimeTicks ) /* FREERTOS_SYSTEM_CALL */
  730. {
  731. QueueSetMemberHandle_t xReturn;
  732. BaseType_t xRunningPrivileged;
  733. xPortRaisePrivilege( xRunningPrivileged );
  734. xReturn = xQueueSelectFromSet( xQueueSet, xBlockTimeTicks );
  735. vPortResetPrivilege( xRunningPrivileged );
  736. return xReturn;
  737. }
  738. #endif /* if ( configUSE_QUEUE_SETS == 1 ) */
  739. /*-----------------------------------------------------------*/
  740. #if ( configUSE_QUEUE_SETS == 1 )
  741. BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore,
  742. QueueSetHandle_t xQueueSet ) /* FREERTOS_SYSTEM_CALL */
  743. {
  744. BaseType_t xReturn, xRunningPrivileged;
  745. xPortRaisePrivilege( xRunningPrivileged );
  746. xReturn = xQueueAddToSet( xQueueOrSemaphore, xQueueSet );
  747. vPortResetPrivilege( xRunningPrivileged );
  748. return xReturn;
  749. }
  750. #endif /* if ( configUSE_QUEUE_SETS == 1 ) */
  751. /*-----------------------------------------------------------*/
  752. #if ( configUSE_QUEUE_SETS == 1 )
  753. BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore,
  754. QueueSetHandle_t xQueueSet ) /* FREERTOS_SYSTEM_CALL */
  755. {
  756. BaseType_t xReturn, xRunningPrivileged;
  757. xPortRaisePrivilege( xRunningPrivileged );
  758. xReturn = xQueueRemoveFromSet( xQueueOrSemaphore, xQueueSet );
  759. vPortResetPrivilege( xRunningPrivileged );
  760. return xReturn;
  761. }
  762. #endif /* if ( configUSE_QUEUE_SETS == 1 ) */
  763. /*-----------------------------------------------------------*/
  764. #if configQUEUE_REGISTRY_SIZE > 0
  765. void MPU_vQueueAddToRegistry( QueueHandle_t xQueue,
  766. const char * pcName ) /* FREERTOS_SYSTEM_CALL */
  767. {
  768. BaseType_t xRunningPrivileged;
  769. xPortRaisePrivilege( xRunningPrivileged );
  770. vQueueAddToRegistry( xQueue, pcName );
  771. vPortResetPrivilege( xRunningPrivileged );
  772. }
  773. #endif /* if configQUEUE_REGISTRY_SIZE > 0 */
  774. /*-----------------------------------------------------------*/
  775. #if configQUEUE_REGISTRY_SIZE > 0
  776. void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */
  777. {
  778. BaseType_t xRunningPrivileged;
  779. xPortRaisePrivilege( xRunningPrivileged );
  780. vQueueUnregisterQueue( xQueue );
  781. vPortResetPrivilege( xRunningPrivileged );
  782. }
  783. #endif /* if configQUEUE_REGISTRY_SIZE > 0 */
  784. /*-----------------------------------------------------------*/
  785. #if configQUEUE_REGISTRY_SIZE > 0
  786. const char * MPU_pcQueueGetName( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */
  787. {
  788. const char * pcReturn;
  789. BaseType_t xRunningPrivileged;
  790. xPortRaisePrivilege( xRunningPrivileged );
  791. pcReturn = pcQueueGetName( xQueue );
  792. vPortResetPrivilege( xRunningPrivileged );
  793. return pcReturn;
  794. }
  795. #endif /* if configQUEUE_REGISTRY_SIZE > 0 */
  796. /*-----------------------------------------------------------*/
  797. void MPU_vQueueDelete( QueueHandle_t xQueue ) /* FREERTOS_SYSTEM_CALL */
  798. {
  799. BaseType_t xRunningPrivileged;
  800. xPortRaisePrivilege( xRunningPrivileged );
  801. vQueueDelete( xQueue );
  802. vPortResetPrivilege( xRunningPrivileged );
  803. }
  804. /*-----------------------------------------------------------*/
  805. #if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) )
  806. TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName,
  807. const TickType_t xTimerPeriodInTicks,
  808. const UBaseType_t uxAutoReload,
  809. void * const pvTimerID,
  810. TimerCallbackFunction_t pxCallbackFunction ) /* FREERTOS_SYSTEM_CALL */
  811. {
  812. TimerHandle_t xReturn;
  813. BaseType_t xRunningPrivileged;
  814. xPortRaisePrivilege( xRunningPrivileged );
  815. xReturn = xTimerCreate( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction );
  816. vPortResetPrivilege( xRunningPrivileged );
  817. return xReturn;
  818. }
  819. #endif /* if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) ) */
  820. /*-----------------------------------------------------------*/
  821. #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) )
  822. TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName,
  823. const TickType_t xTimerPeriodInTicks,
  824. const UBaseType_t uxAutoReload,
  825. void * const pvTimerID,
  826. TimerCallbackFunction_t pxCallbackFunction,
  827. StaticTimer_t * pxTimerBuffer ) /* FREERTOS_SYSTEM_CALL */
  828. {
  829. TimerHandle_t xReturn;
  830. BaseType_t xRunningPrivileged;
  831. xPortRaisePrivilege( xRunningPrivileged );
  832. xReturn = xTimerCreateStatic( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxTimerBuffer );
  833. vPortResetPrivilege( xRunningPrivileged );
  834. return xReturn;
  835. }
  836. #endif /* if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) ) */
  837. /*-----------------------------------------------------------*/
  838. #if ( configUSE_TIMERS == 1 )
  839. void * MPU_pvTimerGetTimerID( const TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
  840. {
  841. void * pvReturn;
  842. BaseType_t xRunningPrivileged;
  843. xPortRaisePrivilege( xRunningPrivileged );
  844. pvReturn = pvTimerGetTimerID( xTimer );
  845. vPortResetPrivilege( xRunningPrivileged );
  846. return pvReturn;
  847. }
  848. #endif /* if ( configUSE_TIMERS == 1 ) */
  849. /*-----------------------------------------------------------*/
  850. #if ( configUSE_TIMERS == 1 )
  851. void MPU_vTimerSetTimerID( TimerHandle_t xTimer,
  852. void * pvNewID ) /* FREERTOS_SYSTEM_CALL */
  853. {
  854. BaseType_t xRunningPrivileged;
  855. xPortRaisePrivilege( xRunningPrivileged );
  856. vTimerSetTimerID( xTimer, pvNewID );
  857. vPortResetPrivilege( xRunningPrivileged );
  858. }
  859. #endif /* if ( configUSE_TIMERS == 1 ) */
  860. /*-----------------------------------------------------------*/
  861. #if ( configUSE_TIMERS == 1 )
  862. BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
  863. {
  864. BaseType_t xReturn, xRunningPrivileged;
  865. xPortRaisePrivilege( xRunningPrivileged );
  866. xReturn = xTimerIsTimerActive( xTimer );
  867. vPortResetPrivilege( xRunningPrivileged );
  868. return xReturn;
  869. }
  870. #endif /* if ( configUSE_TIMERS == 1 ) */
  871. /*-----------------------------------------------------------*/
  872. #if ( configUSE_TIMERS == 1 )
  873. TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) /* FREERTOS_SYSTEM_CALL */
  874. {
  875. TaskHandle_t xReturn;
  876. BaseType_t xRunningPrivileged;
  877. xPortRaisePrivilege( xRunningPrivileged );
  878. xReturn = xTimerGetTimerDaemonTaskHandle();
  879. vPortResetPrivilege( xRunningPrivileged );
  880. return xReturn;
  881. }
  882. #endif /* if ( configUSE_TIMERS == 1 ) */
  883. /*-----------------------------------------------------------*/
  884. #if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
  885. BaseType_t MPU_xTimerPendFunctionCall( PendedFunction_t xFunctionToPend,
  886. void * pvParameter1,
  887. uint32_t ulParameter2,
  888. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  889. {
  890. BaseType_t xReturn, xRunningPrivileged;
  891. xPortRaisePrivilege( xRunningPrivileged );
  892. xReturn = xTimerPendFunctionCall( xFunctionToPend, pvParameter1, ulParameter2, xTicksToWait );
  893. vPortResetPrivilege( xRunningPrivileged );
  894. return xReturn;
  895. }
  896. #endif /* if ( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) ) */
  897. /*-----------------------------------------------------------*/
  898. #if ( configUSE_TIMERS == 1 )
  899. void MPU_vTimerSetReloadMode( TimerHandle_t xTimer,
  900. const UBaseType_t uxAutoReload ) /* FREERTOS_SYSTEM_CALL */
  901. {
  902. BaseType_t xRunningPrivileged;
  903. xPortRaisePrivilege( xRunningPrivileged );
  904. vTimerSetReloadMode( xTimer, uxAutoReload );
  905. vPortResetPrivilege( xRunningPrivileged );
  906. }
  907. #endif /* if ( configUSE_TIMERS == 1 ) */
  908. /*-----------------------------------------------------------*/
  909. #if ( configUSE_TIMERS == 1 )
  910. UBaseType_t MPU_uxTimerGetReloadMode( TimerHandle_t xTimer )
  911. {
  912. UBaseType_t uxReturn;
  913. BaseType_t xRunningPrivileged;
  914. xPortRaisePrivilege( xRunningPrivileged );
  915. uxReturn = uxTimerGetReloadMode( xTimer );
  916. vPortResetPrivilege( xRunningPrivileged );
  917. return uxReturn;
  918. }
  919. #endif /* if ( configUSE_TIMERS == 1 ) */
  920. /*-----------------------------------------------------------*/
  921. #if ( configUSE_TIMERS == 1 )
  922. const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
  923. {
  924. const char * pcReturn;
  925. BaseType_t xRunningPrivileged;
  926. xPortRaisePrivilege( xRunningPrivileged );
  927. pcReturn = pcTimerGetName( xTimer );
  928. vPortResetPrivilege( xRunningPrivileged );
  929. return pcReturn;
  930. }
  931. #endif /* if ( configUSE_TIMERS == 1 ) */
  932. /*-----------------------------------------------------------*/
  933. #if ( configUSE_TIMERS == 1 )
  934. TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
  935. {
  936. TickType_t xReturn;
  937. BaseType_t xRunningPrivileged;
  938. xPortRaisePrivilege( xRunningPrivileged );
  939. xReturn = xTimerGetPeriod( xTimer );
  940. vPortResetPrivilege( xRunningPrivileged );
  941. return xReturn;
  942. }
  943. #endif /* if ( configUSE_TIMERS == 1 ) */
  944. /*-----------------------------------------------------------*/
  945. #if ( configUSE_TIMERS == 1 )
  946. TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer ) /* FREERTOS_SYSTEM_CALL */
  947. {
  948. TickType_t xReturn;
  949. BaseType_t xRunningPrivileged;
  950. xPortRaisePrivilege( xRunningPrivileged );
  951. xReturn = xTimerGetExpiryTime( xTimer );
  952. vPortResetPrivilege( xRunningPrivileged );
  953. return xReturn;
  954. }
  955. #endif /* if ( configUSE_TIMERS == 1 ) */
  956. /*-----------------------------------------------------------*/
  957. #if ( configUSE_TIMERS == 1 )
  958. BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
  959. const BaseType_t xCommandID,
  960. const TickType_t xOptionalValue,
  961. BaseType_t * const pxHigherPriorityTaskWoken,
  962. const TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  963. {
  964. BaseType_t xReturn;
  965. BaseType_t xRunningPrivileged;
  966. xPortRaisePrivilege( xRunningPrivileged );
  967. xReturn = xTimerGenericCommand( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait );
  968. vPortResetPrivilege( xRunningPrivileged );
  969. return xReturn;
  970. }
  971. #endif /* if ( configUSE_TIMERS == 1 ) */
  972. /*-----------------------------------------------------------*/
  973. #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  974. EventGroupHandle_t MPU_xEventGroupCreate( void ) /* FREERTOS_SYSTEM_CALL */
  975. {
  976. EventGroupHandle_t xReturn;
  977. BaseType_t xRunningPrivileged;
  978. xPortRaisePrivilege( xRunningPrivileged );
  979. xReturn = xEventGroupCreate();
  980. vPortResetPrivilege( xRunningPrivileged );
  981. return xReturn;
  982. }
  983. #endif /* if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
  984. /*-----------------------------------------------------------*/
  985. #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
  986. EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t * pxEventGroupBuffer ) /* FREERTOS_SYSTEM_CALL */
  987. {
  988. EventGroupHandle_t xReturn;
  989. BaseType_t xRunningPrivileged;
  990. xPortRaisePrivilege( xRunningPrivileged );
  991. xReturn = xEventGroupCreateStatic( pxEventGroupBuffer );
  992. vPortResetPrivilege( xRunningPrivileged );
  993. return xReturn;
  994. }
  995. #endif /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
  996. /*-----------------------------------------------------------*/
  997. EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
  998. const EventBits_t uxBitsToWaitFor,
  999. const BaseType_t xClearOnExit,
  1000. const BaseType_t xWaitForAllBits,
  1001. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  1002. {
  1003. EventBits_t xReturn;
  1004. BaseType_t xRunningPrivileged;
  1005. xPortRaisePrivilege( xRunningPrivileged );
  1006. xReturn = xEventGroupWaitBits( xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait );
  1007. vPortResetPrivilege( xRunningPrivileged );
  1008. return xReturn;
  1009. }
  1010. /*-----------------------------------------------------------*/
  1011. EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup,
  1012. const EventBits_t uxBitsToClear ) /* FREERTOS_SYSTEM_CALL */
  1013. {
  1014. EventBits_t xReturn;
  1015. BaseType_t xRunningPrivileged;
  1016. xPortRaisePrivilege( xRunningPrivileged );
  1017. xReturn = xEventGroupClearBits( xEventGroup, uxBitsToClear );
  1018. vPortResetPrivilege( xRunningPrivileged );
  1019. return xReturn;
  1020. }
  1021. /*-----------------------------------------------------------*/
  1022. EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup,
  1023. const EventBits_t uxBitsToSet ) /* FREERTOS_SYSTEM_CALL */
  1024. {
  1025. EventBits_t xReturn;
  1026. BaseType_t xRunningPrivileged;
  1027. xPortRaisePrivilege( xRunningPrivileged );
  1028. xReturn = xEventGroupSetBits( xEventGroup, uxBitsToSet );
  1029. vPortResetPrivilege( xRunningPrivileged );
  1030. return xReturn;
  1031. }
  1032. /*-----------------------------------------------------------*/
  1033. EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup,
  1034. const EventBits_t uxBitsToSet,
  1035. const EventBits_t uxBitsToWaitFor,
  1036. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  1037. {
  1038. EventBits_t xReturn;
  1039. BaseType_t xRunningPrivileged;
  1040. xPortRaisePrivilege( xRunningPrivileged );
  1041. xReturn = xEventGroupSync( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait );
  1042. vPortResetPrivilege( xRunningPrivileged );
  1043. return xReturn;
  1044. }
  1045. /*-----------------------------------------------------------*/
  1046. void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup ) /* FREERTOS_SYSTEM_CALL */
  1047. {
  1048. BaseType_t xRunningPrivileged;
  1049. xPortRaisePrivilege( xRunningPrivileged );
  1050. vEventGroupDelete( xEventGroup );
  1051. vPortResetPrivilege( xRunningPrivileged );
  1052. }
  1053. /*-----------------------------------------------------------*/
  1054. size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
  1055. const void * pvTxData,
  1056. size_t xDataLengthBytes,
  1057. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  1058. {
  1059. size_t xReturn;
  1060. BaseType_t xRunningPrivileged;
  1061. xPortRaisePrivilege( xRunningPrivileged );
  1062. xReturn = xStreamBufferSend( xStreamBuffer, pvTxData, xDataLengthBytes, xTicksToWait );
  1063. vPortResetPrivilege( xRunningPrivileged );
  1064. return xReturn;
  1065. }
  1066. /*-----------------------------------------------------------*/
  1067. size_t MPU_xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
  1068. {
  1069. size_t xReturn;
  1070. BaseType_t xRunningPrivileged;
  1071. xPortRaisePrivilege( xRunningPrivileged );
  1072. xReturn = xStreamBufferNextMessageLengthBytes( xStreamBuffer );
  1073. vPortResetPrivilege( xRunningPrivileged );
  1074. return xReturn;
  1075. }
  1076. /*-----------------------------------------------------------*/
  1077. size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
  1078. void * pvRxData,
  1079. size_t xBufferLengthBytes,
  1080. TickType_t xTicksToWait ) /* FREERTOS_SYSTEM_CALL */
  1081. {
  1082. size_t xReturn;
  1083. BaseType_t xRunningPrivileged;
  1084. xPortRaisePrivilege( xRunningPrivileged );
  1085. xReturn = xStreamBufferReceive( xStreamBuffer, pvRxData, xBufferLengthBytes, xTicksToWait );
  1086. vPortResetPrivilege( xRunningPrivileged );
  1087. return xReturn;
  1088. }
  1089. /*-----------------------------------------------------------*/
  1090. void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
  1091. {
  1092. BaseType_t xRunningPrivileged;
  1093. xPortRaisePrivilege( xRunningPrivileged );
  1094. vStreamBufferDelete( xStreamBuffer );
  1095. vPortResetPrivilege( xRunningPrivileged );
  1096. }
  1097. /*-----------------------------------------------------------*/
  1098. BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
  1099. {
  1100. BaseType_t xReturn, xRunningPrivileged;
  1101. xPortRaisePrivilege( xRunningPrivileged );
  1102. xReturn = xStreamBufferIsFull( xStreamBuffer );
  1103. vPortResetPrivilege( xRunningPrivileged );
  1104. return xReturn;
  1105. }
  1106. /*-----------------------------------------------------------*/
  1107. BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
  1108. {
  1109. BaseType_t xReturn, xRunningPrivileged;
  1110. xPortRaisePrivilege( xRunningPrivileged );
  1111. xReturn = xStreamBufferIsEmpty( xStreamBuffer );
  1112. vPortResetPrivilege( xRunningPrivileged );
  1113. return xReturn;
  1114. }
  1115. /*-----------------------------------------------------------*/
  1116. BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
  1117. {
  1118. BaseType_t xReturn, xRunningPrivileged;
  1119. xPortRaisePrivilege( xRunningPrivileged );
  1120. xReturn = xStreamBufferReset( xStreamBuffer );
  1121. vPortResetPrivilege( xRunningPrivileged );
  1122. return xReturn;
  1123. }
  1124. /*-----------------------------------------------------------*/
  1125. size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
  1126. {
  1127. size_t xReturn;
  1128. BaseType_t xRunningPrivileged;
  1129. xPortRaisePrivilege( xRunningPrivileged );
  1130. xReturn = xStreamBufferSpacesAvailable( xStreamBuffer );
  1131. vPortResetPrivilege( xRunningPrivileged );
  1132. return xReturn;
  1133. }
  1134. /*-----------------------------------------------------------*/
  1135. size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
  1136. {
  1137. size_t xReturn;
  1138. BaseType_t xRunningPrivileged;
  1139. xPortRaisePrivilege( xRunningPrivileged );
  1140. xReturn = xStreamBufferBytesAvailable( xStreamBuffer );
  1141. vPortResetPrivilege( xRunningPrivileged );
  1142. return xReturn;
  1143. }
  1144. /*-----------------------------------------------------------*/
  1145. BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer,
  1146. size_t xTriggerLevel ) /* FREERTOS_SYSTEM_CALL */
  1147. {
  1148. BaseType_t xReturn, xRunningPrivileged;
  1149. xPortRaisePrivilege( xRunningPrivileged );
  1150. xReturn = xStreamBufferSetTriggerLevel( xStreamBuffer, xTriggerLevel );
  1151. vPortResetPrivilege( xRunningPrivileged );
  1152. return xReturn;
  1153. }
  1154. /*-----------------------------------------------------------*/
  1155. #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  1156. StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes,
  1157. size_t xTriggerLevelBytes,
  1158. BaseType_t xIsMessageBuffer ) /* FREERTOS_SYSTEM_CALL */
  1159. {
  1160. StreamBufferHandle_t xReturn;
  1161. BaseType_t xRunningPrivileged;
  1162. xPortRaisePrivilege( xRunningPrivileged );
  1163. xReturn = xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer );
  1164. vPortResetPrivilege( xRunningPrivileged );
  1165. return xReturn;
  1166. }
  1167. #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
  1168. /*-----------------------------------------------------------*/
  1169. #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
  1170. StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes,
  1171. size_t xTriggerLevelBytes,
  1172. BaseType_t xIsMessageBuffer,
  1173. uint8_t * const pucStreamBufferStorageArea,
  1174. StaticStreamBuffer_t * const pxStaticStreamBuffer ) /* FREERTOS_SYSTEM_CALL */
  1175. {
  1176. StreamBufferHandle_t xReturn;
  1177. BaseType_t xRunningPrivileged;
  1178. xPortRaisePrivilege( xRunningPrivileged );
  1179. xReturn = xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pucStreamBufferStorageArea, pxStaticStreamBuffer );
  1180. vPortResetPrivilege( xRunningPrivileged );
  1181. return xReturn;
  1182. }
  1183. #endif /* configSUPPORT_STATIC_ALLOCATION */
  1184. /*-----------------------------------------------------------*/
  1185. /* Functions that the application writer wants to execute in privileged mode
  1186. * can be defined in application_defined_privileged_functions.h. The functions
  1187. * must take the same format as those above whereby the privilege state on exit
  1188. * equals the privilege state on entry. For example:
  1189. *
  1190. * void MPU_FunctionName( [parameters ] ) FREERTOS_SYSTEM_CALL;
  1191. * void MPU_FunctionName( [parameters ] )
  1192. * {
  1193. * BaseType_t xRunningPrivileged;
  1194. *
  1195. * xPortRaisePrivilege( xRunningPrivileged );
  1196. * FunctionName( [parameters ] );
  1197. * vPortResetPrivilege( xRunningPrivileged );
  1198. * }
  1199. */
  1200. #if configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS == 1
  1201. #include "application_defined_privileged_functions.h"
  1202. #endif