mpu_wrappers.c 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
  1. /*
  2. * FreeRTOS Kernel V10.0.0
  3. * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  6. * this software and associated documentation files (the "Software"), to deal in
  7. * the Software without restriction, including without limitation the rights to
  8. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  9. * the Software, and to permit persons to whom the Software is furnished to do so,
  10. * subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in all
  13. * copies or substantial portions of the Software. If you wish to use our Amazon
  14. * FreeRTOS name, please do so in a fair use way that does not cause confusion.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22. *
  23. * http://www.FreeRTOS.org
  24. * http://aws.amazon.com/freertos
  25. *
  26. * 1 tab == 4 spaces!
  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. * Checks to see if being called from the context of an unprivileged task, and
  47. * if so raises the privilege level and returns false - otherwise does nothing
  48. * other than return true.
  49. */
  50. extern BaseType_t xPortRaisePrivilege( void );
  51. /*-----------------------------------------------------------*/
  52. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  53. BaseType_t MPU_xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask )
  54. {
  55. BaseType_t xReturn;
  56. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  57. xReturn = xTaskCreateRestricted( pxTaskDefinition, pxCreatedTask );
  58. vPortResetPrivilege( xRunningPrivileged );
  59. return xReturn;
  60. }
  61. #endif /* conifgSUPPORT_DYNAMIC_ALLOCATION */
  62. /*-----------------------------------------------------------*/
  63. #if( configSUPPORT_STATIC_ALLOCATION == 1 )
  64. BaseType_t MPU_xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition, TaskHandle_t *pxCreatedTask )
  65. {
  66. BaseType_t xReturn;
  67. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  68. xReturn = xTaskCreateRestrictedStatic( pxTaskDefinition, pxCreatedTask );
  69. vPortResetPrivilege( xRunningPrivileged );
  70. return xReturn;
  71. }
  72. #endif /* conifgSUPPORT_DYNAMIC_ALLOCATION */
  73. /*-----------------------------------------------------------*/
  74. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  75. BaseType_t MPU_xTaskCreate( TaskFunction_t pvTaskCode, const char * const pcName, uint16_t usStackDepth, void *pvParameters, UBaseType_t uxPriority, TaskHandle_t *pxCreatedTask )
  76. {
  77. BaseType_t xReturn;
  78. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  79. xReturn = xTaskCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
  80. vPortResetPrivilege( xRunningPrivileged );
  81. return xReturn;
  82. }
  83. #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
  84. /*-----------------------------------------------------------*/
  85. #if( configSUPPORT_STATIC_ALLOCATION == 1 )
  86. TaskHandle_t MPU_xTaskCreateStatic( TaskFunction_t pxTaskCode, const char * const pcName, const uint32_t ulStackDepth, void * const pvParameters, UBaseType_t uxPriority, StackType_t * const puxStackBuffer, StaticTask_t * const pxTaskBuffer )
  87. {
  88. TaskHandle_t xReturn;
  89. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  90. xReturn = xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
  91. vPortResetPrivilege( xRunningPrivileged );
  92. return xReturn;
  93. }
  94. #endif /* configSUPPORT_STATIC_ALLOCATION */
  95. /*-----------------------------------------------------------*/
  96. void MPU_vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const xRegions )
  97. {
  98. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  99. vTaskAllocateMPURegions( xTask, xRegions );
  100. vPortResetPrivilege( xRunningPrivileged );
  101. }
  102. /*-----------------------------------------------------------*/
  103. #if ( INCLUDE_vTaskDelete == 1 )
  104. void MPU_vTaskDelete( TaskHandle_t pxTaskToDelete )
  105. {
  106. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  107. vTaskDelete( pxTaskToDelete );
  108. vPortResetPrivilege( xRunningPrivileged );
  109. }
  110. #endif
  111. /*-----------------------------------------------------------*/
  112. #if ( INCLUDE_vTaskDelayUntil == 1 )
  113. void MPU_vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, TickType_t xTimeIncrement )
  114. {
  115. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  116. vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement );
  117. vPortResetPrivilege( xRunningPrivileged );
  118. }
  119. #endif
  120. /*-----------------------------------------------------------*/
  121. #if ( INCLUDE_xTaskAbortDelay == 1 )
  122. BaseType_t MPU_xTaskAbortDelay( TaskHandle_t xTask )
  123. {
  124. BaseType_t xReturn;
  125. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  126. xReturn = xTaskAbortDelay( xTask );
  127. vPortResetPrivilege( xRunningPrivileged );
  128. return xReturn;
  129. }
  130. #endif
  131. /*-----------------------------------------------------------*/
  132. #if ( INCLUDE_vTaskDelay == 1 )
  133. void MPU_vTaskDelay( TickType_t xTicksToDelay )
  134. {
  135. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  136. vTaskDelay( xTicksToDelay );
  137. vPortResetPrivilege( xRunningPrivileged );
  138. }
  139. #endif
  140. /*-----------------------------------------------------------*/
  141. #if ( INCLUDE_uxTaskPriorityGet == 1 )
  142. UBaseType_t MPU_uxTaskPriorityGet( TaskHandle_t pxTask )
  143. {
  144. UBaseType_t uxReturn;
  145. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  146. uxReturn = uxTaskPriorityGet( pxTask );
  147. vPortResetPrivilege( xRunningPrivileged );
  148. return uxReturn;
  149. }
  150. #endif
  151. /*-----------------------------------------------------------*/
  152. #if ( INCLUDE_vTaskPrioritySet == 1 )
  153. void MPU_vTaskPrioritySet( TaskHandle_t pxTask, UBaseType_t uxNewPriority )
  154. {
  155. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  156. vTaskPrioritySet( pxTask, uxNewPriority );
  157. vPortResetPrivilege( xRunningPrivileged );
  158. }
  159. #endif
  160. /*-----------------------------------------------------------*/
  161. #if ( INCLUDE_eTaskGetState == 1 )
  162. eTaskState MPU_eTaskGetState( TaskHandle_t pxTask )
  163. {
  164. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  165. eTaskState eReturn;
  166. eReturn = eTaskGetState( pxTask );
  167. vPortResetPrivilege( xRunningPrivileged );
  168. return eReturn;
  169. }
  170. #endif
  171. /*-----------------------------------------------------------*/
  172. #if( configUSE_TRACE_FACILITY == 1 )
  173. void MPU_vTaskGetInfo( TaskHandle_t xTask, TaskStatus_t *pxTaskStatus, BaseType_t xGetFreeStackSpace, eTaskState eState )
  174. {
  175. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  176. vTaskGetInfo( xTask, pxTaskStatus, xGetFreeStackSpace, eState );
  177. vPortResetPrivilege( xRunningPrivileged );
  178. }
  179. #endif
  180. /*-----------------------------------------------------------*/
  181. #if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
  182. TaskHandle_t MPU_xTaskGetIdleTaskHandle( void )
  183. {
  184. TaskHandle_t xReturn;
  185. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  186. xReturn = xTaskGetIdleTaskHandle();
  187. vPortResetPrivilege( xRunningPrivileged );
  188. return xReturn;
  189. }
  190. #endif
  191. /*-----------------------------------------------------------*/
  192. #if ( INCLUDE_vTaskSuspend == 1 )
  193. void MPU_vTaskSuspend( TaskHandle_t pxTaskToSuspend )
  194. {
  195. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  196. vTaskSuspend( pxTaskToSuspend );
  197. vPortResetPrivilege( xRunningPrivileged );
  198. }
  199. #endif
  200. /*-----------------------------------------------------------*/
  201. #if ( INCLUDE_vTaskSuspend == 1 )
  202. void MPU_vTaskResume( TaskHandle_t pxTaskToResume )
  203. {
  204. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  205. vTaskResume( pxTaskToResume );
  206. vPortResetPrivilege( xRunningPrivileged );
  207. }
  208. #endif
  209. /*-----------------------------------------------------------*/
  210. void MPU_vTaskSuspendAll( void )
  211. {
  212. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  213. vTaskSuspendAll();
  214. vPortResetPrivilege( xRunningPrivileged );
  215. }
  216. /*-----------------------------------------------------------*/
  217. BaseType_t MPU_xTaskResumeAll( void )
  218. {
  219. BaseType_t xReturn;
  220. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  221. xReturn = xTaskResumeAll();
  222. vPortResetPrivilege( xRunningPrivileged );
  223. return xReturn;
  224. }
  225. /*-----------------------------------------------------------*/
  226. TickType_t MPU_xTaskGetTickCount( void )
  227. {
  228. TickType_t xReturn;
  229. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  230. xReturn = xTaskGetTickCount();
  231. vPortResetPrivilege( xRunningPrivileged );
  232. return xReturn;
  233. }
  234. /*-----------------------------------------------------------*/
  235. UBaseType_t MPU_uxTaskGetNumberOfTasks( void )
  236. {
  237. UBaseType_t uxReturn;
  238. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  239. uxReturn = uxTaskGetNumberOfTasks();
  240. vPortResetPrivilege( xRunningPrivileged );
  241. return uxReturn;
  242. }
  243. /*-----------------------------------------------------------*/
  244. char * MPU_pcTaskGetName( TaskHandle_t xTaskToQuery )
  245. {
  246. char *pcReturn;
  247. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  248. pcReturn = pcTaskGetName( xTaskToQuery );
  249. vPortResetPrivilege( xRunningPrivileged );
  250. return pcReturn;
  251. }
  252. /*-----------------------------------------------------------*/
  253. #if ( INCLUDE_xTaskGetHandle == 1 )
  254. TaskHandle_t MPU_xTaskGetHandle( const char *pcNameToQuery )
  255. {
  256. TaskHandle_t xReturn;
  257. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  258. xReturn = xTaskGetHandle( pcNameToQuery );
  259. vPortResetPrivilege( xRunningPrivileged );
  260. return xReturn;
  261. }
  262. #endif
  263. /*-----------------------------------------------------------*/
  264. #if ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  265. void MPU_vTaskList( char *pcWriteBuffer )
  266. {
  267. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  268. vTaskList( pcWriteBuffer );
  269. vPortResetPrivilege( xRunningPrivileged );
  270. }
  271. #endif
  272. /*-----------------------------------------------------------*/
  273. #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  274. void MPU_vTaskGetRunTimeStats( char *pcWriteBuffer )
  275. {
  276. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  277. vTaskGetRunTimeStats( pcWriteBuffer );
  278. vPortResetPrivilege( xRunningPrivileged );
  279. }
  280. #endif
  281. /*-----------------------------------------------------------*/
  282. #if ( configUSE_APPLICATION_TASK_TAG == 1 )
  283. void MPU_vTaskSetApplicationTaskTag( TaskHandle_t xTask, TaskHookFunction_t pxTagValue )
  284. {
  285. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  286. vTaskSetApplicationTaskTag( xTask, pxTagValue );
  287. vPortResetPrivilege( xRunningPrivileged );
  288. }
  289. #endif
  290. /*-----------------------------------------------------------*/
  291. #if ( configUSE_APPLICATION_TASK_TAG == 1 )
  292. TaskHookFunction_t MPU_xTaskGetApplicationTaskTag( TaskHandle_t xTask )
  293. {
  294. TaskHookFunction_t xReturn;
  295. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  296. xReturn = xTaskGetApplicationTaskTag( xTask );
  297. vPortResetPrivilege( xRunningPrivileged );
  298. return xReturn;
  299. }
  300. #endif
  301. /*-----------------------------------------------------------*/
  302. #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
  303. void MPU_vTaskSetThreadLocalStoragePointer( TaskHandle_t xTaskToSet, BaseType_t xIndex, void *pvValue )
  304. {
  305. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  306. vTaskSetThreadLocalStoragePointer( xTaskToSet, xIndex, pvValue );
  307. vPortResetPrivilege( xRunningPrivileged );
  308. }
  309. #endif
  310. /*-----------------------------------------------------------*/
  311. #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS != 0 )
  312. void *MPU_pvTaskGetThreadLocalStoragePointer( TaskHandle_t xTaskToQuery, BaseType_t xIndex )
  313. {
  314. void *pvReturn;
  315. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  316. pvReturn = pvTaskGetThreadLocalStoragePointer( xTaskToQuery, xIndex );
  317. vPortResetPrivilege( xRunningPrivileged );
  318. return pvReturn;
  319. }
  320. #endif
  321. /*-----------------------------------------------------------*/
  322. #if ( configUSE_APPLICATION_TASK_TAG == 1 )
  323. BaseType_t MPU_xTaskCallApplicationTaskHook( TaskHandle_t xTask, void *pvParameter )
  324. {
  325. BaseType_t xReturn;
  326. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  327. xReturn = xTaskCallApplicationTaskHook( xTask, pvParameter );
  328. vPortResetPrivilege( xRunningPrivileged );
  329. return xReturn;
  330. }
  331. #endif
  332. /*-----------------------------------------------------------*/
  333. #if ( configUSE_TRACE_FACILITY == 1 )
  334. UBaseType_t MPU_uxTaskGetSystemState( TaskStatus_t *pxTaskStatusArray, UBaseType_t uxArraySize, uint32_t *pulTotalRunTime )
  335. {
  336. UBaseType_t uxReturn;
  337. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  338. uxReturn = uxTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime );
  339. vPortResetPrivilege( xRunningPrivileged );
  340. return uxReturn;
  341. }
  342. #endif
  343. /*-----------------------------------------------------------*/
  344. #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )
  345. UBaseType_t MPU_uxTaskGetStackHighWaterMark( TaskHandle_t xTask )
  346. {
  347. UBaseType_t uxReturn;
  348. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  349. uxReturn = uxTaskGetStackHighWaterMark( xTask );
  350. vPortResetPrivilege( xRunningPrivileged );
  351. return uxReturn;
  352. }
  353. #endif
  354. /*-----------------------------------------------------------*/
  355. #if ( INCLUDE_xTaskGetCurrentTaskHandle == 1 )
  356. TaskHandle_t MPU_xTaskGetCurrentTaskHandle( void )
  357. {
  358. TaskHandle_t xReturn;
  359. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  360. xReturn = xTaskGetCurrentTaskHandle();
  361. vPortResetPrivilege( xRunningPrivileged );
  362. return xReturn;
  363. }
  364. #endif
  365. /*-----------------------------------------------------------*/
  366. #if ( INCLUDE_xTaskGetSchedulerState == 1 )
  367. BaseType_t MPU_xTaskGetSchedulerState( void )
  368. {
  369. BaseType_t xReturn;
  370. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  371. xReturn = xTaskGetSchedulerState();
  372. vPortResetPrivilege( xRunningPrivileged );
  373. return xReturn;
  374. }
  375. #endif
  376. /*-----------------------------------------------------------*/
  377. void MPU_vTaskSetTimeOutState( TimeOut_t * const pxTimeOut )
  378. {
  379. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  380. vTaskSetTimeOutState( pxTimeOut );
  381. vPortResetPrivilege( xRunningPrivileged );
  382. }
  383. /*-----------------------------------------------------------*/
  384. BaseType_t MPU_xTaskCheckForTimeOut( TimeOut_t * const pxTimeOut, TickType_t * const pxTicksToWait )
  385. {
  386. BaseType_t xReturn;
  387. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  388. xReturn = xTaskCheckForTimeOut( pxTimeOut, pxTicksToWait );
  389. vPortResetPrivilege( xRunningPrivileged );
  390. return xReturn;
  391. }
  392. /*-----------------------------------------------------------*/
  393. #if( configUSE_TASK_NOTIFICATIONS == 1 )
  394. BaseType_t MPU_xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue )
  395. {
  396. BaseType_t xReturn;
  397. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  398. xReturn = xTaskGenericNotify( xTaskToNotify, ulValue, eAction, pulPreviousNotificationValue );
  399. vPortResetPrivilege( xRunningPrivileged );
  400. return xReturn;
  401. }
  402. #endif
  403. /*-----------------------------------------------------------*/
  404. #if( configUSE_TASK_NOTIFICATIONS == 1 )
  405. BaseType_t MPU_xTaskNotifyWait( uint32_t ulBitsToClearOnEntry, uint32_t ulBitsToClearOnExit, uint32_t *pulNotificationValue, TickType_t xTicksToWait )
  406. {
  407. BaseType_t xReturn;
  408. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  409. xReturn = xTaskNotifyWait( ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait );
  410. vPortResetPrivilege( xRunningPrivileged );
  411. return xReturn;
  412. }
  413. #endif
  414. /*-----------------------------------------------------------*/
  415. #if( configUSE_TASK_NOTIFICATIONS == 1 )
  416. uint32_t MPU_ulTaskNotifyTake( BaseType_t xClearCountOnExit, TickType_t xTicksToWait )
  417. {
  418. uint32_t ulReturn;
  419. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  420. ulReturn = ulTaskNotifyTake( xClearCountOnExit, xTicksToWait );
  421. vPortResetPrivilege( xRunningPrivileged );
  422. return ulReturn;
  423. }
  424. #endif
  425. /*-----------------------------------------------------------*/
  426. #if( configUSE_TASK_NOTIFICATIONS == 1 )
  427. BaseType_t MPU_xTaskNotifyStateClear( TaskHandle_t xTask )
  428. {
  429. BaseType_t xReturn;
  430. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  431. xReturn = xTaskNotifyStateClear( xTask );
  432. vPortResetPrivilege( xRunningPrivileged );
  433. return xReturn;
  434. }
  435. #endif
  436. /*-----------------------------------------------------------*/
  437. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  438. QueueHandle_t MPU_xQueueGenericCreate( UBaseType_t uxQueueLength, UBaseType_t uxItemSize, uint8_t ucQueueType )
  439. {
  440. QueueHandle_t xReturn;
  441. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  442. xReturn = xQueueGenericCreate( uxQueueLength, uxItemSize, ucQueueType );
  443. vPortResetPrivilege( xRunningPrivileged );
  444. return xReturn;
  445. }
  446. #endif
  447. /*-----------------------------------------------------------*/
  448. #if( configSUPPORT_STATIC_ALLOCATION == 1 )
  449. QueueHandle_t MPU_xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType )
  450. {
  451. QueueHandle_t xReturn;
  452. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  453. xReturn = xQueueGenericCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxStaticQueue, ucQueueType );
  454. vPortResetPrivilege( xRunningPrivileged );
  455. return xReturn;
  456. }
  457. #endif
  458. /*-----------------------------------------------------------*/
  459. BaseType_t MPU_xQueueGenericReset( QueueHandle_t pxQueue, BaseType_t xNewQueue )
  460. {
  461. BaseType_t xReturn;
  462. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  463. xReturn = xQueueGenericReset( pxQueue, xNewQueue );
  464. vPortResetPrivilege( xRunningPrivileged );
  465. return xReturn;
  466. }
  467. /*-----------------------------------------------------------*/
  468. BaseType_t MPU_xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQueue, TickType_t xTicksToWait, BaseType_t xCopyPosition )
  469. {
  470. BaseType_t xReturn;
  471. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  472. xReturn = xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition );
  473. vPortResetPrivilege( xRunningPrivileged );
  474. return xReturn;
  475. }
  476. /*-----------------------------------------------------------*/
  477. UBaseType_t MPU_uxQueueMessagesWaiting( const QueueHandle_t pxQueue )
  478. {
  479. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  480. UBaseType_t uxReturn;
  481. uxReturn = uxQueueMessagesWaiting( pxQueue );
  482. vPortResetPrivilege( xRunningPrivileged );
  483. return uxReturn;
  484. }
  485. /*-----------------------------------------------------------*/
  486. UBaseType_t MPU_uxQueueSpacesAvailable( const QueueHandle_t xQueue )
  487. {
  488. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  489. UBaseType_t uxReturn;
  490. uxReturn = uxQueueSpacesAvailable( xQueue );
  491. vPortResetPrivilege( xRunningPrivileged );
  492. return uxReturn;
  493. }
  494. /*-----------------------------------------------------------*/
  495. BaseType_t MPU_xQueueReceive( QueueHandle_t pxQueue, void * const pvBuffer, TickType_t xTicksToWait )
  496. {
  497. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  498. BaseType_t xReturn;
  499. xReturn = xQueueReceive( pxQueue, pvBuffer, xTicksToWait );
  500. vPortResetPrivilege( xRunningPrivileged );
  501. return xReturn;
  502. }
  503. /*-----------------------------------------------------------*/
  504. BaseType_t MPU_xQueuePeek( QueueHandle_t xQueue, void * const pvBuffer, TickType_t xTicksToWait )
  505. {
  506. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  507. BaseType_t xReturn;
  508. xReturn = xQueuePeek( xQueue, pvBuffer, xTicksToWait );
  509. vPortResetPrivilege( xRunningPrivileged );
  510. return xReturn;
  511. }
  512. /*-----------------------------------------------------------*/
  513. BaseType_t MPU_xQueueSemaphoreTake( QueueHandle_t xQueue, TickType_t xTicksToWait )
  514. {
  515. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  516. BaseType_t xReturn;
  517. xReturn = xQueueSemaphoreTake( xQueue, xTicksToWait );
  518. vPortResetPrivilege( xRunningPrivileged );
  519. return xReturn;
  520. }
  521. /*-----------------------------------------------------------*/
  522. BaseType_t MPU_xQueuePeekFromISR( QueueHandle_t pxQueue, void * const pvBuffer )
  523. {
  524. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  525. BaseType_t xReturn;
  526. xReturn = xQueuePeekFromISR( pxQueue, pvBuffer );
  527. vPortResetPrivilege( xRunningPrivileged );
  528. return xReturn;
  529. }
  530. /*-----------------------------------------------------------*/
  531. void* MPU_xQueueGetMutexHolder( QueueHandle_t xSemaphore )
  532. {
  533. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  534. void * xReturn;
  535. xReturn = ( void * ) xQueueGetMutexHolder( xSemaphore );
  536. vPortResetPrivilege( xRunningPrivileged );
  537. return xReturn;
  538. }
  539. /*-----------------------------------------------------------*/
  540. #if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  541. QueueHandle_t MPU_xQueueCreateMutex( const uint8_t ucQueueType )
  542. {
  543. QueueHandle_t xReturn;
  544. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  545. xReturn = xQueueCreateMutex( ucQueueType );
  546. vPortResetPrivilege( xRunningPrivileged );
  547. return xReturn;
  548. }
  549. #endif
  550. /*-----------------------------------------------------------*/
  551. #if( ( configUSE_MUTEXES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
  552. QueueHandle_t MPU_xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue )
  553. {
  554. QueueHandle_t xReturn;
  555. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  556. xReturn = xQueueCreateMutexStatic( ucQueueType, pxStaticQueue );
  557. vPortResetPrivilege( xRunningPrivileged );
  558. return xReturn;
  559. }
  560. #endif
  561. /*-----------------------------------------------------------*/
  562. #if( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  563. QueueHandle_t MPU_xQueueCreateCountingSemaphore( UBaseType_t uxCountValue, UBaseType_t uxInitialCount )
  564. {
  565. QueueHandle_t xReturn;
  566. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  567. xReturn = xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount );
  568. vPortResetPrivilege( xRunningPrivileged );
  569. return xReturn;
  570. }
  571. #endif
  572. /*-----------------------------------------------------------*/
  573. #if( ( configUSE_COUNTING_SEMAPHORES == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
  574. QueueHandle_t MPU_xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount, const UBaseType_t uxInitialCount, StaticQueue_t *pxStaticQueue )
  575. {
  576. QueueHandle_t xReturn;
  577. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  578. xReturn = xQueueCreateCountingSemaphoreStatic( uxMaxCount, uxInitialCount, pxStaticQueue );
  579. vPortResetPrivilege( xRunningPrivileged );
  580. return xReturn;
  581. }
  582. #endif
  583. /*-----------------------------------------------------------*/
  584. #if ( configUSE_MUTEXES == 1 )
  585. BaseType_t MPU_xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xBlockTime )
  586. {
  587. BaseType_t xReturn;
  588. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  589. xReturn = xQueueTakeMutexRecursive( xMutex, xBlockTime );
  590. vPortResetPrivilege( xRunningPrivileged );
  591. return xReturn;
  592. }
  593. #endif
  594. /*-----------------------------------------------------------*/
  595. #if ( configUSE_MUTEXES == 1 )
  596. BaseType_t MPU_xQueueGiveMutexRecursive( QueueHandle_t xMutex )
  597. {
  598. BaseType_t xReturn;
  599. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  600. xReturn = xQueueGiveMutexRecursive( xMutex );
  601. vPortResetPrivilege( xRunningPrivileged );
  602. return xReturn;
  603. }
  604. #endif
  605. /*-----------------------------------------------------------*/
  606. #if( ( configUSE_QUEUE_SETS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  607. QueueSetHandle_t MPU_xQueueCreateSet( UBaseType_t uxEventQueueLength )
  608. {
  609. QueueSetHandle_t xReturn;
  610. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  611. xReturn = xQueueCreateSet( uxEventQueueLength );
  612. vPortResetPrivilege( xRunningPrivileged );
  613. return xReturn;
  614. }
  615. #endif
  616. /*-----------------------------------------------------------*/
  617. #if ( configUSE_QUEUE_SETS == 1 )
  618. QueueSetMemberHandle_t MPU_xQueueSelectFromSet( QueueSetHandle_t xQueueSet, TickType_t xBlockTimeTicks )
  619. {
  620. QueueSetMemberHandle_t xReturn;
  621. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  622. xReturn = xQueueSelectFromSet( xQueueSet, xBlockTimeTicks );
  623. vPortResetPrivilege( xRunningPrivileged );
  624. return xReturn;
  625. }
  626. #endif
  627. /*-----------------------------------------------------------*/
  628. #if ( configUSE_QUEUE_SETS == 1 )
  629. BaseType_t MPU_xQueueAddToSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet )
  630. {
  631. BaseType_t xReturn;
  632. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  633. xReturn = xQueueAddToSet( xQueueOrSemaphore, xQueueSet );
  634. vPortResetPrivilege( xRunningPrivileged );
  635. return xReturn;
  636. }
  637. #endif
  638. /*-----------------------------------------------------------*/
  639. #if ( configUSE_QUEUE_SETS == 1 )
  640. BaseType_t MPU_xQueueRemoveFromSet( QueueSetMemberHandle_t xQueueOrSemaphore, QueueSetHandle_t xQueueSet )
  641. {
  642. BaseType_t xReturn;
  643. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  644. xReturn = xQueueRemoveFromSet( xQueueOrSemaphore, xQueueSet );
  645. vPortResetPrivilege( xRunningPrivileged );
  646. return xReturn;
  647. }
  648. #endif
  649. /*-----------------------------------------------------------*/
  650. #if configQUEUE_REGISTRY_SIZE > 0
  651. void MPU_vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcName )
  652. {
  653. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  654. vQueueAddToRegistry( xQueue, pcName );
  655. vPortResetPrivilege( xRunningPrivileged );
  656. }
  657. #endif
  658. /*-----------------------------------------------------------*/
  659. #if configQUEUE_REGISTRY_SIZE > 0
  660. void MPU_vQueueUnregisterQueue( QueueHandle_t xQueue )
  661. {
  662. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  663. vQueueUnregisterQueue( xQueue );
  664. vPortResetPrivilege( xRunningPrivileged );
  665. }
  666. #endif
  667. /*-----------------------------------------------------------*/
  668. #if configQUEUE_REGISTRY_SIZE > 0
  669. const char *MPU_pcQueueGetName( QueueHandle_t xQueue )
  670. {
  671. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  672. const char *pcReturn;
  673. pcReturn = pcQueueGetName( xQueue );
  674. vPortResetPrivilege( xRunningPrivileged );
  675. return pcReturn;
  676. }
  677. #endif
  678. /*-----------------------------------------------------------*/
  679. void MPU_vQueueDelete( QueueHandle_t xQueue )
  680. {
  681. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  682. vQueueDelete( xQueue );
  683. vPortResetPrivilege( xRunningPrivileged );
  684. }
  685. /*-----------------------------------------------------------*/
  686. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  687. void *MPU_pvPortMalloc( size_t xSize )
  688. {
  689. void *pvReturn;
  690. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  691. pvReturn = pvPortMalloc( xSize );
  692. vPortResetPrivilege( xRunningPrivileged );
  693. return pvReturn;
  694. }
  695. #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
  696. /*-----------------------------------------------------------*/
  697. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  698. void MPU_vPortFree( void *pv )
  699. {
  700. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  701. vPortFree( pv );
  702. vPortResetPrivilege( xRunningPrivileged );
  703. }
  704. #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
  705. /*-----------------------------------------------------------*/
  706. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  707. void MPU_vPortInitialiseBlocks( void )
  708. {
  709. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  710. vPortInitialiseBlocks();
  711. vPortResetPrivilege( xRunningPrivileged );
  712. }
  713. #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
  714. /*-----------------------------------------------------------*/
  715. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  716. size_t MPU_xPortGetFreeHeapSize( void )
  717. {
  718. size_t xReturn;
  719. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  720. xReturn = xPortGetFreeHeapSize();
  721. vPortResetPrivilege( xRunningPrivileged );
  722. return xReturn;
  723. }
  724. #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
  725. /*-----------------------------------------------------------*/
  726. #if( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) )
  727. TimerHandle_t MPU_xTimerCreate( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction )
  728. {
  729. TimerHandle_t xReturn;
  730. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  731. xReturn = xTimerCreate( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction );
  732. vPortResetPrivilege( xRunningPrivileged );
  733. return xReturn;
  734. }
  735. #endif
  736. /*-----------------------------------------------------------*/
  737. #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_TIMERS == 1 ) )
  738. TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName, const TickType_t xTimerPeriodInTicks, const UBaseType_t uxAutoReload, void * const pvTimerID, TimerCallbackFunction_t pxCallbackFunction, StaticTimer_t *pxTimerBuffer )
  739. {
  740. TimerHandle_t xReturn;
  741. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  742. xReturn = xTimerCreateStatic( pcTimerName, xTimerPeriodInTicks, uxAutoReload, pvTimerID, pxCallbackFunction, pxTimerBuffer );
  743. vPortResetPrivilege( xRunningPrivileged );
  744. return xReturn;
  745. }
  746. #endif
  747. /*-----------------------------------------------------------*/
  748. #if( configUSE_TIMERS == 1 )
  749. void *MPU_pvTimerGetTimerID( const TimerHandle_t xTimer )
  750. {
  751. void * pvReturn;
  752. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  753. pvReturn = pvTimerGetTimerID( xTimer );
  754. vPortResetPrivilege( xRunningPrivileged );
  755. return pvReturn;
  756. }
  757. #endif
  758. /*-----------------------------------------------------------*/
  759. #if( configUSE_TIMERS == 1 )
  760. void MPU_vTimerSetTimerID( TimerHandle_t xTimer, void *pvNewID )
  761. {
  762. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  763. vTimerSetTimerID( xTimer, pvNewID );
  764. vPortResetPrivilege( xRunningPrivileged );
  765. }
  766. #endif
  767. /*-----------------------------------------------------------*/
  768. #if( configUSE_TIMERS == 1 )
  769. BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer )
  770. {
  771. BaseType_t xReturn;
  772. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  773. xReturn = xTimerIsTimerActive( xTimer );
  774. vPortResetPrivilege( xRunningPrivileged );
  775. return xReturn;
  776. }
  777. #endif
  778. /*-----------------------------------------------------------*/
  779. #if( configUSE_TIMERS == 1 )
  780. TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void )
  781. {
  782. TaskHandle_t xReturn;
  783. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  784. xReturn = xTimerGetTimerDaemonTaskHandle();
  785. vPortResetPrivilege( xRunningPrivileged );
  786. return xReturn;
  787. }
  788. #endif
  789. /*-----------------------------------------------------------*/
  790. #if( ( INCLUDE_xTimerPendFunctionCall == 1 ) && ( configUSE_TIMERS == 1 ) )
  791. BaseType_t MPU_xTimerPendFunctionCall( PendedFunction_t xFunctionToPend, void *pvParameter1, uint32_t ulParameter2, TickType_t xTicksToWait )
  792. {
  793. BaseType_t xReturn;
  794. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  795. xReturn = xTimerPendFunctionCall( xFunctionToPend, pvParameter1, ulParameter2, xTicksToWait );
  796. vPortResetPrivilege( xRunningPrivileged );
  797. return xReturn;
  798. }
  799. #endif
  800. /*-----------------------------------------------------------*/
  801. #if( configUSE_TIMERS == 1 )
  802. const char * MPU_pcTimerGetName( TimerHandle_t xTimer )
  803. {
  804. const char * pcReturn;
  805. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  806. pcReturn = pcTimerGetName( xTimer );
  807. vPortResetPrivilege( xRunningPrivileged );
  808. return pcReturn;
  809. }
  810. #endif
  811. /*-----------------------------------------------------------*/
  812. #if( configUSE_TIMERS == 1 )
  813. TickType_t MPU_xTimerGetPeriod( TimerHandle_t xTimer )
  814. {
  815. TickType_t xReturn;
  816. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  817. xReturn = xTimerGetPeriod( xTimer );
  818. vPortResetPrivilege( xRunningPrivileged );
  819. return xReturn;
  820. }
  821. #endif
  822. /*-----------------------------------------------------------*/
  823. #if( configUSE_TIMERS == 1 )
  824. TickType_t MPU_xTimerGetExpiryTime( TimerHandle_t xTimer )
  825. {
  826. TickType_t xReturn;
  827. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  828. xReturn = xTimerGetExpiryTime( xTimer );
  829. vPortResetPrivilege( xRunningPrivileged );
  830. return xReturn;
  831. }
  832. #endif
  833. /*-----------------------------------------------------------*/
  834. #if( configUSE_TIMERS == 1 )
  835. BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer, const BaseType_t xCommandID, const TickType_t xOptionalValue, BaseType_t * const pxHigherPriorityTaskWoken, const TickType_t xTicksToWait )
  836. {
  837. BaseType_t xReturn;
  838. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  839. xReturn = xTimerGenericCommand( xTimer, xCommandID, xOptionalValue, pxHigherPriorityTaskWoken, xTicksToWait );
  840. vPortResetPrivilege( xRunningPrivileged );
  841. return xReturn;
  842. }
  843. #endif
  844. /*-----------------------------------------------------------*/
  845. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  846. EventGroupHandle_t MPU_xEventGroupCreate( void )
  847. {
  848. EventGroupHandle_t xReturn;
  849. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  850. xReturn = xEventGroupCreate();
  851. vPortResetPrivilege( xRunningPrivileged );
  852. return xReturn;
  853. }
  854. #endif
  855. /*-----------------------------------------------------------*/
  856. #if( configSUPPORT_STATIC_ALLOCATION == 1 )
  857. EventGroupHandle_t MPU_xEventGroupCreateStatic( StaticEventGroup_t *pxEventGroupBuffer )
  858. {
  859. EventGroupHandle_t xReturn;
  860. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  861. xReturn = xEventGroupCreateStatic( pxEventGroupBuffer );
  862. vPortResetPrivilege( xRunningPrivileged );
  863. return xReturn;
  864. }
  865. #endif
  866. /*-----------------------------------------------------------*/
  867. EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToWaitFor, const BaseType_t xClearOnExit, const BaseType_t xWaitForAllBits, TickType_t xTicksToWait )
  868. {
  869. EventBits_t xReturn;
  870. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  871. xReturn = xEventGroupWaitBits( xEventGroup, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait );
  872. vPortResetPrivilege( xRunningPrivileged );
  873. return xReturn;
  874. }
  875. /*-----------------------------------------------------------*/
  876. EventBits_t MPU_xEventGroupClearBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToClear )
  877. {
  878. EventBits_t xReturn;
  879. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  880. xReturn = xEventGroupClearBits( xEventGroup, uxBitsToClear );
  881. vPortResetPrivilege( xRunningPrivileged );
  882. return xReturn;
  883. }
  884. /*-----------------------------------------------------------*/
  885. EventBits_t MPU_xEventGroupSetBits( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet )
  886. {
  887. EventBits_t xReturn;
  888. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  889. xReturn = xEventGroupSetBits( xEventGroup, uxBitsToSet );
  890. vPortResetPrivilege( xRunningPrivileged );
  891. return xReturn;
  892. }
  893. /*-----------------------------------------------------------*/
  894. EventBits_t MPU_xEventGroupSync( EventGroupHandle_t xEventGroup, const EventBits_t uxBitsToSet, const EventBits_t uxBitsToWaitFor, TickType_t xTicksToWait )
  895. {
  896. EventBits_t xReturn;
  897. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  898. xReturn = xEventGroupSync( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTicksToWait );
  899. vPortResetPrivilege( xRunningPrivileged );
  900. return xReturn;
  901. }
  902. /*-----------------------------------------------------------*/
  903. void MPU_vEventGroupDelete( EventGroupHandle_t xEventGroup )
  904. {
  905. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  906. vEventGroupDelete( xEventGroup );
  907. vPortResetPrivilege( xRunningPrivileged );
  908. }
  909. /*-----------------------------------------------------------*/
  910. size_t MPU_xStreamBufferSend( StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, TickType_t xTicksToWait )
  911. {
  912. size_t xReturn;
  913. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  914. xReturn = xStreamBufferSend( xStreamBuffer, pvTxData, xDataLengthBytes, xTicksToWait );
  915. vPortResetPrivilege( xRunningPrivileged );
  916. return xReturn;
  917. }
  918. /*-----------------------------------------------------------*/
  919. size_t MPU_xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer, const void *pvTxData, size_t xDataLengthBytes, BaseType_t * const pxHigherPriorityTaskWoken )
  920. {
  921. size_t xReturn;
  922. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  923. xReturn = xStreamBufferSendFromISR( xStreamBuffer, pvTxData, xDataLengthBytes, pxHigherPriorityTaskWoken );
  924. vPortResetPrivilege( xRunningPrivileged );
  925. return xReturn;
  926. }
  927. /*-----------------------------------------------------------*/
  928. size_t MPU_xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, TickType_t xTicksToWait )
  929. {
  930. size_t xReturn;
  931. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  932. xReturn = xStreamBufferReceive( xStreamBuffer, pvRxData, xBufferLengthBytes, xTicksToWait );
  933. vPortResetPrivilege( xRunningPrivileged );
  934. return xReturn;
  935. }
  936. /*-----------------------------------------------------------*/
  937. size_t MPU_xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer, void *pvRxData, size_t xBufferLengthBytes, BaseType_t * const pxHigherPriorityTaskWoken )
  938. {
  939. size_t xReturn;
  940. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  941. xReturn = xStreamBufferReceiveFromISR( xStreamBuffer, pvRxData, xBufferLengthBytes, pxHigherPriorityTaskWoken );
  942. vPortResetPrivilege( xRunningPrivileged );
  943. return xReturn;
  944. }
  945. /*-----------------------------------------------------------*/
  946. void MPU_vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer )
  947. {
  948. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  949. vStreamBufferDelete( xStreamBuffer );
  950. vPortResetPrivilege( xRunningPrivileged );
  951. }
  952. /*-----------------------------------------------------------*/
  953. BaseType_t MPU_xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer )
  954. {
  955. BaseType_t xReturn;
  956. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  957. xReturn = xStreamBufferIsFull( xStreamBuffer );
  958. vPortResetPrivilege( xRunningPrivileged );
  959. return xReturn;
  960. }
  961. /*-----------------------------------------------------------*/
  962. BaseType_t MPU_xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer )
  963. {
  964. BaseType_t xReturn;
  965. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  966. xReturn = xStreamBufferIsEmpty( xStreamBuffer );
  967. vPortResetPrivilege( xRunningPrivileged );
  968. return xReturn;
  969. }
  970. /*-----------------------------------------------------------*/
  971. BaseType_t MPU_xStreamBufferReset( StreamBufferHandle_t xStreamBuffer )
  972. {
  973. BaseType_t xReturn;
  974. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  975. xReturn = xStreamBufferReset( xStreamBuffer );
  976. vPortResetPrivilege( xRunningPrivileged );
  977. return xReturn;
  978. }
  979. /*-----------------------------------------------------------*/
  980. size_t MPU_xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer )
  981. {
  982. size_t xReturn;
  983. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  984. xReturn = xStreamBufferSpacesAvailable( xStreamBuffer );
  985. vPortResetPrivilege( xRunningPrivileged );
  986. return xReturn;
  987. }
  988. /*-----------------------------------------------------------*/
  989. size_t MPU_xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer )
  990. {
  991. size_t xReturn;
  992. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  993. xReturn = xStreamBufferBytesAvailable( xStreamBuffer );
  994. vPortResetPrivilege( xRunningPrivileged );
  995. return xReturn;
  996. }
  997. /*-----------------------------------------------------------*/
  998. BaseType_t MPU_xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel )
  999. {
  1000. BaseType_t xReturn;
  1001. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  1002. xReturn = xStreamBufferSetTriggerLevel( xStreamBuffer, xTriggerLevel );
  1003. vPortResetPrivilege( xRunningPrivileged );
  1004. return xReturn;
  1005. }
  1006. /*-----------------------------------------------------------*/
  1007. #if( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  1008. StreamBufferHandle_t MPU_xStreamBufferGenericCreate( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer )
  1009. {
  1010. StreamBufferHandle_t xReturn;
  1011. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  1012. xReturn = xStreamBufferGenericCreate( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer );
  1013. vPortResetPrivilege( xRunningPrivileged );
  1014. return xReturn;
  1015. }
  1016. #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
  1017. /*-----------------------------------------------------------*/
  1018. #if( configSUPPORT_STATIC_ALLOCATION == 1 )
  1019. StreamBufferHandle_t MPU_xStreamBufferGenericCreateStatic( size_t xBufferSizeBytes, size_t xTriggerLevelBytes, BaseType_t xIsMessageBuffer, uint8_t * const pucStreamBufferStorageArea, StaticStreamBuffer_t * const pxStaticStreamBuffer )
  1020. {
  1021. StreamBufferHandle_t xReturn;
  1022. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  1023. xReturn = xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, xIsMessageBuffer, pucStreamBufferStorageArea, pxStaticStreamBuffer );
  1024. vPortResetPrivilege( xRunningPrivileged );
  1025. return xReturn;
  1026. }
  1027. #endif /* configSUPPORT_STATIC_ALLOCATION */
  1028. /*-----------------------------------------------------------*/
  1029. /* Functions that the application writer wants to execute in privileged mode
  1030. can be defined in application_defined_privileged_functions.h. The functions
  1031. must take the same format as those above whereby the privilege state on exit
  1032. equals the privilege state on entry. For example:
  1033. void MPU_FunctionName( [parameters ] )
  1034. {
  1035. BaseType_t xRunningPrivileged = xPortRaisePrivilege();
  1036. FunctionName( [parameters ] );
  1037. vPortResetPrivilege( xRunningPrivileged );
  1038. }
  1039. */
  1040. #if configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS == 1
  1041. #include "application_defined_privileged_functions.h"
  1042. #endif