]> git.sur5r.net Git - freertos/commitdiff
Correct byte alignment on CM3 port layers.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 15 Nov 2009 15:01:59 +0000 (15:01 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 15 Nov 2009 15:01:59 +0000 (15:01 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@934 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/GCC/ARM_CM3_MPU/port.c
Source/portable/GCC/ARM_CM3_MPU/portmacro.h
Source/tasks.c

index 7b2d7254a521d426662b53cc8d7b7d3cdc09b79d..d9530ddc7abfc038f78a023cb2c7d0d4e7d47d7c 100644 (file)
@@ -106,7 +106,7 @@ task.h is included from an application file. */
 #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
@@ -155,6 +155,49 @@ static void prvRestoreContextOfFirstTask( void ) __attribute__(( naked )) PRIVIL
  */\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
@@ -226,7 +269,7 @@ unsigned char ucSVCNumber;
                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
@@ -498,7 +541,7 @@ static portBASE_TYPE prvRaisePrivilege( void )
                "       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
index 35c978a5577f4db29f858839dc313af8c175f946..55c4b1d63f0098d4308481dcbf761b2c71be350c 100644 (file)
@@ -131,7 +131,7 @@ typedef struct MPU_SETTINGS
 /* SVC numbers for various services. */\r
 #define portSVC_START_SCHEDULER                                0\r
 #define portSVC_YIELD                                          1\r
-#define portSVC_prvRaisePrivilege                      2\r
+#define portSVC_RAISE_PRIVILEGE                                2\r
 \r
 /* Scheduler utilities. */\r
 \r
index c0e851c1429bc00e235e022ae8c1a0f786d70776..184d78ad2e60e1e9ae7f31b12cabcd989d3fc973 100644 (file)
@@ -389,7 +389,6 @@ signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed ch
 {\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
@@ -399,16 +398,19 @@ portBASE_TYPE xRunPrivileged;
        {\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
@@ -444,7 +446,6 @@ portBASE_TYPE xRunPrivileged;
                #else\r
                {\r
                        pxNewTCB->pxTopOfStack = pxPortInitialiseStack( pxTopOfStack, pxTaskCode, pvParameters );\r
-                       ( void ) xRunPrivileged;\r
                }\r
                #endif\r
 \r