From 159790a3ea64ef78a18ebe6307ddebab29d708f4 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Sat, 13 Jul 2013 19:37:35 +0000 Subject: [PATCH] Update Cortex-M MPU version to include new API functions. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1976 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/include/mpu_wrappers.h | 2 ++ FreeRTOS/Source/include/queue.h | 2 +- .../Source/portable/GCC/ARM_CM3_MPU/port.c | 29 ++++++++++++++++++- FreeRTOS/Source/tasks.c | 4 +-- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/FreeRTOS/Source/include/mpu_wrappers.h b/FreeRTOS/Source/include/mpu_wrappers.h index 02ecad7d1..e663d4ef0 100644 --- a/FreeRTOS/Source/include/mpu_wrappers.h +++ b/FreeRTOS/Source/include/mpu_wrappers.h @@ -108,6 +108,7 @@ only for ports that are using the MPU. */ #define xTaskGetCurrentTaskHandle MPU_xTaskGetCurrentTaskHandle #define xTaskGetSchedulerState MPU_xTaskGetSchedulerState #define xTaskGetIdleTaskHandle MPU_xTaskGetIdleTaskHandle + #define xTaskGetSystemState MPU_xTaskGetSystemState #define xQueueGenericCreate MPU_xQueueGenericCreate #define xQueueCreateMutex MPU_xQueueCreateMutex @@ -125,6 +126,7 @@ only for ports that are using the MPU. */ #define xQueueSelectFromSet MPU_xQueueSelectFromSet #define xQueueAddToSet MPU_xQueueAddToSet #define xQueueRemoveFromSet MPU_xQueueRemoveFromSet + #define xQueuePeekFromISR MPU_xQueuePeekFromISR #define pvPortMalloc MPU_pvPortMalloc #define vPortFree MPU_vPortFree diff --git a/FreeRTOS/Source/include/queue.h b/FreeRTOS/Source/include/queue.h index 315b67e25..84cdf1afb 100644 --- a/FreeRTOS/Source/include/queue.h +++ b/FreeRTOS/Source/include/queue.h @@ -724,7 +724,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const * \defgroup xQueuePeekFromISR xQueuePeekFromISR * \ingroup QueueManagement */ -signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ); +signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION; /** * queue. h diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c index 7488f5ee7..2c8e78adb 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c @@ -203,6 +203,7 @@ unsigned portBASE_TYPE MPU_uxTaskGetStackHighWaterMark( xTaskHandle xTask ); xTaskHandle MPU_xTaskGetCurrentTaskHandle( void ); portBASE_TYPE MPU_xTaskGetSchedulerState( void ); xTaskHandle MPU_xTaskGetIdleTaskHandle( void ); +unsigned portBASE_TYPE MPU_xTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime ); xQueueHandle MPU_xQueueGenericCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize, unsigned char ucQueueType ); signed portBASE_TYPE MPU_xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ); portBASE_TYPE MPU_xQueueGenericReset( xQueueHandle pxQueue, portBASE_TYPE xNewQueue ); @@ -224,6 +225,7 @@ xQueueSetHandle MPU_xQueueCreateSet( unsigned portBASE_TYPE uxEventQueueLength ) xQueueSetMemberHandle MPU_xQueueSelectFromSet( xQueueSetHandle xQueueSet, portTickType xBlockTimeTicks ); portBASE_TYPE MPU_xQueueAddToSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ); portBASE_TYPE MPU_xQueueRemoveFromSet( xQueueSetMemberHandle xQueueOrSemaphore, xQueueSetHandle xQueueSet ); +signed portBASE_TYPE MPU_xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ); /*-----------------------------------------------------------*/ @@ -917,6 +919,19 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); #endif /*-----------------------------------------------------------*/ +#if ( configUSE_TRACE_FACILITY == 1 ) + unsigned portBASE_TYPE MPU_xTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, unsigned portBASE_TYPE uxArraySize, unsigned long *pulTotalRunTime ) + { + unsigned portBASE_TYPE uxReturn; + portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + + uxReturn = xTaskGetSystemState( pxTaskStatusArray, uxArraySize, pulTotalRunTime ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; + } +#endif +/*-----------------------------------------------------------*/ + #if ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) unsigned portBASE_TYPE MPU_uxTaskGetStackHighWaterMark( xTaskHandle xTask ) { @@ -1011,6 +1026,17 @@ signed portBASE_TYPE xReturn; } /*-----------------------------------------------------------*/ +signed portBASE_TYPE MPU_xQueuePeekFromISR( xQueueHandle pxQueue, void * const pvBuffer ) +{ +portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); +signed portBASE_TYPE xReturn; + + xReturn = xQueuePeekFromISR( pxQueue, pvBuffer ); + portRESET_PRIVILEGE( xRunningPrivileged ); + return xReturn; +} +/*-----------------------------------------------------------*/ + #if ( configUSE_MUTEXES == 1 ) xQueueHandle MPU_xQueueCreateMutex( void ) { @@ -1225,4 +1251,5 @@ portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); #if configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS == 1 #include "application_defined_privileged_functions.h" -#endif \ No newline at end of file +#endif + diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index 5bf1ae756..403125724 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -175,7 +175,7 @@ PRIVILEGED_DATA tskTCB * volatile pxCurrentTCB = NULL; PRIVILEGED_DATA static xList pxReadyTasksLists[ configMAX_PRIORITIES ]; /*< Prioritised ready tasks. */ PRIVILEGED_DATA static xList xDelayedTaskList1; /*< Delayed tasks. */ PRIVILEGED_DATA static xList xDelayedTaskList2; /*< Delayed tasks (two lists are used - one for delays that have overflowed the current tick count. */ -PRIVILEGED_DATA static xList * volatile pxDelayedTaskList ; /*< Points to the delayed task list currently being used. */ +PRIVILEGED_DATA static xList * volatile pxDelayedTaskList; /*< Points to the delayed task list currently being used. */ PRIVILEGED_DATA static xList * volatile pxOverflowDelayedTaskList; /*< Points to the delayed task list currently being used to hold tasks that have overflowed the current tick count. */ PRIVILEGED_DATA static xList xPendingReadyList; /*< Tasks that have been readied while the scheduler was suspended. They will be moved to the ready list when the scheduler is resumed. */ @@ -198,7 +198,7 @@ PRIVILEGED_DATA static xList xPendingReadyList; /*< Tasks that have been r #endif -/* File private variables. --------------------------------*/ +/* Other file private variables. --------------------------------*/ PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxCurrentNumberOfTasks = ( unsigned portBASE_TYPE ) 0U; PRIVILEGED_DATA static volatile portTickType xTickCount = ( portTickType ) 0U; PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTopReadyPriority = tskIDLE_PRIORITY; -- 2.39.5