+/*\r
+ FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.\r
+\r
+\r
+ ***************************************************************************\r
+ * *\r
+ * FreeRTOS tutorial books are available in pdf and paperback. *\r
+ * Complete, revised, and edited pdf reference manuals are also *\r
+ * available. *\r
+ * *\r
+ * Purchasing FreeRTOS documentation will not only help you, by *\r
+ * ensuring you get running as quickly as possible and with an *\r
+ * in-depth knowledge of how to use FreeRTOS, it will also help *\r
+ * the FreeRTOS project to continue with its mission of providing *\r
+ * professional grade, cross platform, de facto standard solutions *\r
+ * for microcontrollers - completely free of charge! *\r
+ * *\r
+ * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *\r
+ * *\r
+ * Thank you for using FreeRTOS, and thank you for your support! *\r
+ * *\r
+ ***************************************************************************\r
+\r
+\r
+ This file is part of the FreeRTOS distribution.\r
+\r
+ FreeRTOS is free software; you can redistribute it and/or modify it under\r
+ the terms of the GNU General Public License (version 2) as published by the\r
+ Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
+ >>>NOTE<<< The modification to the GPL is included to allow you to\r
+ distribute a combined work that includes FreeRTOS without being obliged to\r
+ provide the source code for proprietary components outside of the FreeRTOS\r
+ kernel. FreeRTOS is distributed in the hope that it will be useful, but\r
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
+ more details. You should have received a copy of the GNU General Public\r
+ License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+ can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
+ by writing to Richard Barry, contact details for whom are available on the\r
+ FreeRTOS WEB site.\r
+\r
+ 1 tab == 4 spaces!\r
+\r
+ http://www.FreeRTOS.org - Documentation, latest information, license and\r
+ contact details.\r
+\r
+ http://www.SafeRTOS.com - A version that is certified for use in safety\r
+ critical systems.\r
+\r
+ http://www.OpenRTOS.com - Commercial support, development, porting,\r
+ licensing and training services.\r
+*/\r
+\r
+/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining\r
+all the API functions to use the MPU wrappers. That should only be done when\r
+task.h is included from an application file. */\r
+#define MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
+\r
+#include "FreeRTOS.h"\r
+#include "task.h"\r
+#include "queue.h"\r
+\r
+#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
+\r
+#if configUSE_MPU == 1\r
+\r
+/* Function for raising the privilege of a task. */\r
+extern portBASE_TYPE xPortRaisePrivilege( void );\r
+\r
+/*\r
+ * Prototypes for all the MPU wrappers.\r
+ */\r
+signed portBASE_TYPE MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions );\r
+void MPU_vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const xRegions );\r
+void MPU_vTaskDelete( xTaskHandle pxTaskToDelete );\r
+void MPU_vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement );\r
+void MPU_vTaskDelay( portTickType xTicksToDelay );\r
+unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask );\r
+void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority );\r
+void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend );\r
+signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask );\r
+void MPU_vTaskResume( xTaskHandle pxTaskToResume );\r
+void MPU_vTaskSuspendAll( void );\r
+signed portBASE_TYPE MPU_xTaskResumeAll( void );\r
+portTickType MPU_xTaskGetTickCount( void );\r
+unsigned portBASE_TYPE MPU_uxTaskGetNumberOfTasks( void );\r
+void MPU_vTaskList( signed char *pcWriteBuffer );\r
+void MPU_vTaskGetRunTimeStats( signed char *pcWriteBuffer );\r
+void MPU_vTaskStartTrace( signed char * pcBuffer, unsigned long ulBufferSize );\r
+unsigned long MPU_ulTaskEndTrace( void );\r
+void MPU_vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxTagValue );\r
+pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( xTaskHandle xTask );\r
+portBASE_TYPE MPU_xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter );\r
+unsigned portBASE_TYPE MPU_uxTaskGetStackHighWaterMark( xTaskHandle xTask );\r
+xTaskHandle MPU_xTaskGetCurrentTaskHandle( void );\r
+portBASE_TYPE MPU_xTaskGetSchedulerState( void );\r
+xQueueHandle MPU_xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize );\r
+signed portBASE_TYPE MPU_xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );\r
+unsigned portBASE_TYPE MPU_uxQueueMessagesWaiting( const xQueueHandle pxQueue );\r
+signed portBASE_TYPE MPU_xQueueGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );\r
+xQueueHandle MPU_xQueueCreateMutex( void );\r
+xQueueHandle MPU_xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount );\r
+portBASE_TYPE MPU_xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime );\r
+portBASE_TYPE MPU_xQueueGiveMutexRecursive( xQueueHandle xMutex );\r
+signed portBASE_TYPE MPU_xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );\r
+signed portBASE_TYPE MPU_xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking );\r
+void MPU_vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName );\r
+void *MPU_pvPortMalloc( size_t xSize );\r
+void MPU_vPortFree( void *pv );\r
+void MPU_vPortInitialiseBlocks( void );\r
+size_t MPU_xPortGetFreeHeapSize( void );\r
+/*---------------------------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE MPU_xTaskGenericCreate( pdTASK_CODE pvTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions )\r
+{\r
+signed portBASE_TYPE xReturn;\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskGenericCreate( pvTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask, puxStackBuffer, xRegions );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void MPU_vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const xRegions )\r
+{\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskAllocateMPURegions( xTask, xRegions );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_vTaskDelete == 1 )\r
+ void MPU_vTaskDelete( xTaskHandle pxTaskToDelete )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskDelete( pxTaskToDelete );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_vTaskDelayUntil == 1 )\r
+ void MPU_vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_vTaskDelay == 1 )\r
+ void MPU_vTaskDelay( portTickType xTicksToDelay )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskDelay( xTicksToDelay );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_uxTaskPriorityGet == 1 )\r
+ unsigned portBASE_TYPE MPU_uxTaskPriorityGet( xTaskHandle pxTask )\r
+ {\r
+ unsigned portBASE_TYPE uxReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ uxReturn = uxTaskPriorityGet( pxTask );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return uxReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_vTaskPrioritySet == 1 )\r
+ void MPU_vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskPrioritySet( pxTask, uxNewPriority );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_vTaskSuspend == 1 )\r
+ void MPU_vTaskSuspend( xTaskHandle pxTaskToSuspend )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskSuspend( pxTaskToSuspend );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_vTaskSuspend == 1 )\r
+ signed portBASE_TYPE MPU_xTaskIsTaskSuspended( xTaskHandle xTask )\r
+ {\r
+ signed portBASE_TYPE xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskIsTaskSuspended( xTask );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_vTaskSuspend == 1 )\r
+ void MPU_vTaskResume( xTaskHandle pxTaskToResume )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskResume( pxTaskToResume );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+void MPU_vTaskSuspendAll( void )\r
+{\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskSuspendAll();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE MPU_xTaskResumeAll( void )\r
+{\r
+signed portBASE_TYPE xReturn;\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskResumeAll();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+portTickType MPU_xTaskGetTickCount( void )\r
+{\r
+portTickType xReturn;\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskGetTickCount();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+unsigned portBASE_TYPE MPU_uxTaskGetNumberOfTasks( void )\r
+{\r
+unsigned portBASE_TYPE uxReturn;\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ uxReturn = uxTaskGetNumberOfTasks();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return uxReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_TRACE_FACILITY == 1 )\r
+ void MPU_vTaskList( signed char *pcWriteBuffer )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskList( pcWriteBuffer );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configGENERATE_RUN_TIME_STATS == 1 )\r
+ void MPU_vTaskGetRunTimeStats( signed char *pcWriteBuffer )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskGetRunTimeStats( pcWriteBuffer );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_TRACE_FACILITY == 1 )\r
+ void MPU_vTaskStartTrace( signed char * pcBuffer, unsigned long ulBufferSize )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskStartTrace( pcBuffer, ulBufferSize );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_TRACE_FACILITY == 1 )\r
+ unsigned long MPU_ulTaskEndTrace( void )\r
+ {\r
+ unsigned long ulReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ ulReturn = ulTaskEndTrace();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return ulReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
+ void MPU_vTaskSetApplicationTaskTag( xTaskHandle xTask, pdTASK_HOOK_CODE pxTagValue )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskSetApplicationTaskTag( xTask, pxTagValue );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
+ pdTASK_HOOK_CODE MPU_xTaskGetApplicationTaskTag( xTaskHandle xTask )\r
+ {\r
+ pdTASK_HOOK_CODE xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskGetApplicationTaskTag( xTask );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_APPLICATION_TASK_TAG == 1 )\r
+ portBASE_TYPE MPU_xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter )\r
+ {\r
+ portBASE_TYPE xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskCallApplicationTaskHook( xTask, pvParameter );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 )\r
+ unsigned portBASE_TYPE MPU_uxTaskGetStackHighWaterMark( xTaskHandle xTask )\r
+ {\r
+ unsigned portBASE_TYPE uxReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ uxReturn = uxTaskGetStackHighWaterMark( xTask );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return uxReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_xTaskGetCurrentTaskHandle == 1 )\r
+ xTaskHandle MPU_xTaskGetCurrentTaskHandle( void )\r
+ {\r
+ xTaskHandle xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskGetCurrentTaskHandle();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( INCLUDE_xTaskGetSchedulerState == 1 )\r
+ portBASE_TYPE MPU_xTaskGetSchedulerState( void )\r
+ {\r
+ portBASE_TYPE xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xTaskGetSchedulerState();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+void MPU_vTaskEnterCritical( void )\r
+{\r
+extern void vTaskEnterCritical( void );\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskEnterCritical();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void MPU_vTaskExitCritical( void )\r
+{\r
+extern void vTaskExitCritical( void );\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vTaskExitCritical();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+xQueueHandle MPU_xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize )\r
+{\r
+xQueueHandle xReturn;\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xQueueCreate( uxQueueLength, uxItemSize );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE MPU_xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition )\r
+{\r
+signed portBASE_TYPE xReturn;\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, xCopyPosition );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+unsigned portBASE_TYPE MPU_uxQueueMessagesWaiting( const xQueueHandle pxQueue )\r
+{\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+unsigned portBASE_TYPE uxReturn;\r
+\r
+ uxReturn = uxQueueMessagesWaiting( pxQueue );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return uxReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+signed portBASE_TYPE MPU_xQueueGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )\r
+{\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+signed portBASE_TYPE xReturn;\r
+\r
+ xReturn = xQueueGenericReceive( pxQueue, pvBuffer, xTicksToWait, xJustPeeking );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_MUTEXES == 1 )\r
+ xQueueHandle MPU_xQueueCreateMutex( void )\r
+ {\r
+ xQueueHandle xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xQueueCreateMutex();\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if configUSE_COUNTING_SEMAPHORES == 1\r
+ xQueueHandle MPU_xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount )\r
+ {\r
+ xQueueHandle xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = (xQueueHandle) xQueueCreateCountingSemaphore( uxCountValue, uxInitialCount );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_MUTEXES == 1 )\r
+ portBASE_TYPE MPU_xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime )\r
+ {\r
+ portBASE_TYPE xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xQueueTakeMutexRecursive( xMutex, xBlockTime );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if ( configUSE_MUTEXES == 1 )\r
+ portBASE_TYPE MPU_xQueueGiveMutexRecursive( xQueueHandle xMutex )\r
+ {\r
+ portBASE_TYPE xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xQueueGiveMutexRecursive( xMutex );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if configUSE_ALTERNATIVE_API == 1\r
+ signed portBASE_TYPE MPU_xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition )\r
+ {\r
+ signed portBASE_TYPE xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = signed portBASE_TYPE xQueueAltGenericSend( pxQueue, pvItemToQueue, xTicksToWait, xCopyPosition );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if configUSE_ALTERNATIVE_API == 1\r
+ signed portBASE_TYPE MPU_xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )\r
+ {\r
+ signed portBASE_TYPE xReturn;\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xQueueAltGenericReceive( pxQueue, pvBuffer, xTicksToWait, xJustPeeking );\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ return xReturn;\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+#if configQUEUE_REGISTRY_SIZE > 0\r
+ void MPU_vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName )\r
+ {\r
+ portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vQueueAddToRegistry( xQueue, pcName );\r
+\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+ }\r
+#endif\r
+/*-----------------------------------------------------------*/\r
+\r
+void *MPU_pvPortMalloc( size_t xSize )\r
+{\r
+void *pvReturn;\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ pvReturn = pvPortMalloc( xSize );\r
+\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+\r
+ return pvReturn;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void MPU_vPortFree( void *pv )\r
+{\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vPortFree( pv );\r
+\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+size_t xPortGetFreeHeapSize( void )\r
+{\r
+ /* This just exists to keep the linker quiet. */\r
+extern unsigned long _lc_ub_heap[]; /* Heap */\r
+extern unsigned long _lc_ue_heap[]; /* Heap end */\r
+ return (size_t)( _lc_ue_heap - _lc_ub_heap );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vPortInitialiseBlocks( void )\r
+{\r
+ /* This just exists to keep the linker quiet. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void MPU_vPortInitialiseBlocks( void )\r
+{\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ vPortInitialiseBlocks();\r
+\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+size_t MPU_xPortGetFreeHeapSize( void )\r
+{\r
+size_t xReturn;\r
+portBASE_TYPE xRunningPrivileged = xPortRaisePrivilege();\r
+\r
+ xReturn = xPortGetFreeHeapSize();\r
+\r
+ portMPU_RESTORE_PRIORITY( xRunningPrivileged );\r
+\r
+ return xReturn;\r
+}\r
+\r
+#endif /* configUSE_MPU */\r