#define portOFFSET_TO_PC ( 6 )\r
\r
/* Set the privilege level to user mode if xRunningPrivileged is false. */\r
-#define portRESET_PRIVILEGE( xRunningPrivileged ) if( xRunningPrivileged != pdTRUE ) __asm volatile ( " mrs r0, control \n orr r0, #1 \n msr control, r0 " )\r
+#define portRESET_PRIVILEGE( xRunningPrivileged ) if( xRunningPrivileged != pdTRUE ) __asm volatile ( " mrs r0, control \n orr r0, #1 \n msr control, r0" :::"r0" )\r
\r
/* Each task maintains its own interrupt status in the critical nesting\r
variable. Note this is not saved as part of the task context as context\r
*/\r
static void prvSVCHandler( unsigned long *pulRegisters ) __attribute__(( noinline )) PRIVILEGED_FUNCTION;\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
\r
/*\r
case portSVC_YIELD : *(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;\r
break;\r
\r
- case portSVC_prvRaisePrivilege : __asm volatile \r
+ case portSVC_RAISE_PRIVILEGE : __asm volatile \r
(\r
" mrs r1, control \n" /* Obtain current control value. */\r
" bic r1, #1 \n" /* Set privilege bit. */\r
" svcne %0 \n" /* Switch to privileged. */\r
" moveq r0, #1 \n" /* CONTROL[0]==0, return true. */\r
" bx lr \n"\r
- :: "i" (portSVC_prvRaisePrivilege) : "r0" \r
+ :: "i" (portSVC_RAISE_PRIVILEGE) : "r0" \r
);\r
\r
return 0;\r
{\r
signed portBASE_TYPE xReturn;\r
tskTCB * pxNewTCB;\r
-portBASE_TYPE xRunPrivileged;\r
\r
/* Allocate the memory required by the TCB and stack for the new task,\r
checking that the allocation was successful. */\r
{\r
portSTACK_TYPE *pxTopOfStack;\r
\r
- /* Should the task be created in privileged mode? */\r
- if( ( uxPriority & portPRIVILEGE_BIT ) != 0x00 )\r
- {\r
- xRunPrivileged = pdTRUE;\r
- }\r
- else\r
- {\r
- xRunPrivileged = pdFALSE;\r
- }\r
- uxPriority &= ~portPRIVILEGE_BIT;\r
+ #if( portUSING_MPU_WRAPPERS == 1 )\r
+ /* Should the task be created in privileged mode? */\r
+ portBASE_TYPE xRunPrivileged;\r
+ if( ( uxPriority & portPRIVILEGE_BIT ) != 0x00 )\r
+ {\r
+ xRunPrivileged = pdTRUE;\r
+ }\r
+ else\r
+ {\r
+ xRunPrivileged = pdFALSE;\r
+ }\r
+ uxPriority &= ~portPRIVILEGE_BIT;\r
+ #endif /* portUSING_MPU_WRAPPERS == 1 */\r
\r
/* Calculate the top of stack address. This depends on whether the\r
stack grows from high memory to low (as per the 80x86) or visa versa.\r
#else\r
{\r
pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters );\r
- ( void ) xRunPrivileged;\r
}\r
#endif\r
\r