Skip to content

Commit

Permalink
Update MPU wrapper for xTimerGenericCommand API (#734)
Browse files Browse the repository at this point in the history
* Update xTimerGenericCommand API as per SMP branch

Signed-off-by: kar-rahul-aws <karahulx@amazon.com>

* Fix formatting

* Code review changes

Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>

* Fix Formatting

---------

Signed-off-by: kar-rahul-aws <karahulx@amazon.com>
Signed-off-by: Gaurav Aggarwal <aggarg@amazon.com>
Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
  • Loading branch information
kar-rahul-aws and aggarg authored Aug 1, 2023
1 parent 0066c28 commit b51a373
Show file tree
Hide file tree
Showing 36 changed files with 758 additions and 864 deletions.
15 changes: 10 additions & 5 deletions include/mpu_prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,11 @@ void MPU_vTimerSetTimerID( TimerHandle_t xTimer,
void * pvNewID ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerIsTimerActive( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) FREERTOS_SYSTEM_CALL;
const char * MPU_pcTimerGetName( TimerHandle_t xTimer ) FREERTOS_SYSTEM_CALL;
void MPU_vTimerSetReloadMode( TimerHandle_t xTimer,
const UBaseType_t uxAutoReload ) FREERTOS_SYSTEM_CALL;
Expand All @@ -252,6 +252,11 @@ TimerHandle_t MPU_xTimerCreateStatic( const char * const pcTimerName,
StaticTimer_t * pxTimerBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xTimerGetStaticBuffer( TimerHandle_t xTimer,
StaticTimer_t ** ppxTimerBuffer ) PRIVILEGED_FUNCTION;
BaseType_t MPU_xTimerGenericCommandFromISR( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;

/* MPU versions of event_group.h API functions. */
EventBits_t MPU_xEventGroupWaitBits( EventGroupHandle_t xEventGroup,
Expand Down
11 changes: 6 additions & 5 deletions include/mpu_wrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
#define vTimerSetTimerID MPU_vTimerSetTimerID
#define xTimerIsTimerActive MPU_xTimerIsTimerActive
#define xTimerGetTimerDaemonTaskHandle MPU_xTimerGetTimerDaemonTaskHandle
#define xTimerGenericCommand MPU_xTimerGenericCommand
#define xTimerGenericCommandFromTask MPU_xTimerGenericCommandFromTask
#define pcTimerGetName MPU_pcTimerGetName
#define vTimerSetReloadMode MPU_vTimerSetReloadMode
#define uxTimerGetReloadMode MPU_uxTimerGetReloadMode
Expand All @@ -167,10 +167,11 @@
* the application can use opaque handles maintained in mpu_wrappers.c
* with all the APIs. */
#if ( configUSE_MPU_WRAPPERS_V1 == 0 )
#define xTimerGetReloadMode MPU_xTimerGetReloadMode
#define xTimerCreate MPU_xTimerCreate
#define xTimerCreateStatic MPU_xTimerCreateStatic
#define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer
#define xTimerGetReloadMode MPU_xTimerGetReloadMode
#define xTimerCreate MPU_xTimerCreate
#define xTimerCreateStatic MPU_xTimerCreateStatic
#define xTimerGetStaticBuffer MPU_xTimerGetStaticBuffer
#define xTimerGenericCommandFromISR MPU_xTimerGenericCommandFromISR
#endif /* #if ( configUSE_MPU_WRAPPERS_V1 == 0 ) */

/* Map standard event_group.h API functions to the MPU equivalents. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1726,41 +1726,38 @@ TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) /* __attribute__ (( nake

#if ( configUSE_TIMERS == 1 )

BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_xTimerGenericCommandImpl \n"
" \n"
" push {r0, r1} \n"
" mrs r0, ipsr \n"
" cmp r0, #0 \n"
" bne MPU_xTimerGenericCommand_Priv \n"
" mrs r0, control \n"
" movs r1, #1 \n"
" tst r0, r1 \n"
" beq MPU_xTimerGenericCommand_Priv \n"
" MPU_xTimerGenericCommand_Unpriv: \n"
" pop {r0, r1} \n"
" svc %0 \n"
" bl MPU_xTimerGenericCommandImpl \n"
" svc %1 \n"
" bx lr \n"
" MPU_xTimerGenericCommand_Priv: \n"
" pop {r0, r1} \n"
" b MPU_xTimerGenericCommandImpl \n"
" \n"
BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_xTimerGenericCommandFromTaskImpl \n"
" \n"
" push {r0, r1} \n"
" mrs r0, control \n"
" movs r1, #1 \n"
" tst r0, r1 \n"
" bne MPU_xTimerGenericCommandFromTask_Unpriv \n"
" MPU_xTimerGenericCommandFromTask_Priv: \n"
" pop {r0, r1} \n"
" b MPU_xTimerGenericCommandFromTaskImpl \n"
" MPU_xTimerGenericCommandFromTask_Unpriv: \n"
" pop {r0, r1} \n"
" svc %0 \n"
" bl MPU_xTimerGenericCommandFromTaskImpl \n"
" svc %1 \n"
" bx lr \n"
" \n"
: : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1726,41 +1726,38 @@ TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) /* __attribute__ (( nake

#if ( configUSE_TIMERS == 1 )

BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_xTimerGenericCommandImpl \n"
" \n"
" push {r0, r1} \n"
" mrs r0, ipsr \n"
" cmp r0, #0 \n"
" bne MPU_xTimerGenericCommand_Priv \n"
" mrs r0, control \n"
" movs r1, #1 \n"
" tst r0, r1 \n"
" beq MPU_xTimerGenericCommand_Priv \n"
" MPU_xTimerGenericCommand_Unpriv: \n"
" pop {r0, r1} \n"
" svc %0 \n"
" bl MPU_xTimerGenericCommandImpl \n"
" svc %1 \n"
" bx lr \n"
" MPU_xTimerGenericCommand_Priv: \n"
" pop {r0, r1} \n"
" b MPU_xTimerGenericCommandImpl \n"
" \n"
BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_xTimerGenericCommandFromTaskImpl \n"
" \n"
" push {r0, r1} \n"
" mrs r0, control \n"
" movs r1, #1 \n"
" tst r0, r1 \n"
" bne MPU_xTimerGenericCommandFromTask_Unpriv \n"
" MPU_xTimerGenericCommandFromTask_Priv: \n"
" pop {r0, r1} \n"
" b MPU_xTimerGenericCommandFromTaskImpl \n"
" MPU_xTimerGenericCommandFromTask_Unpriv: \n"
" pop {r0, r1} \n"
" svc %0 \n"
" bl MPU_xTimerGenericCommandFromTaskImpl \n"
" svc %1 \n"
" bx lr \n"
" \n"
: : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1676,41 +1676,37 @@ TaskHandle_t MPU_xTimerGetTimerDaemonTaskHandle( void ) /* __attribute__ (( nake

#if ( configUSE_TIMERS == 1 )

BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

BaseType_t MPU_xTimerGenericCommand( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_xTimerGenericCommandImpl \n"
" \n"
" push {r0} \n"
" mrs r0, ipsr \n"
" cmp r0, #0 \n"
" bne MPU_xTimerGenericCommand_Priv \n"
" mrs r0, control \n"
" tst r0, #1 \n"
" beq MPU_xTimerGenericCommand_Priv \n"
" MPU_xTimerGenericCommand_Unpriv: \n"
" pop {r0} \n"
" svc %0 \n"
" bl MPU_xTimerGenericCommandImpl \n"
" svc %1 \n"
" bx lr \n"
" MPU_xTimerGenericCommand_Priv: \n"
" pop {r0} \n"
" b MPU_xTimerGenericCommandImpl \n"
" \n"
" \n"
BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) __attribute__ (( naked )) FREERTOS_SYSTEM_CALL;

BaseType_t MPU_xTimerGenericCommandFromTask( TimerHandle_t xTimer,
const BaseType_t xCommandID,
const TickType_t xOptionalValue,
BaseType_t * const pxHigherPriorityTaskWoken,
const TickType_t xTicksToWait ) /* __attribute__ (( naked )) FREERTOS_SYSTEM_CALL */
{
__asm volatile
(
" .syntax unified \n"
" .extern MPU_xTimerGenericCommandFromTaskImpl \n"
" \n"
" push {r0} \n"
" mrs r0, control \n"
" tst r0, #1 \n"
" bne MPU_xTimerGenericCommandFromTask_Unpriv \n"
" MPU_xTimerGenericCommandFromTask_Priv: \n"
" pop {r0} \n"
" b MPU_xTimerGenericCommandFromTaskImpl \n"
" MPU_xTimerGenericCommandFromTask_Unpriv: \n"
" pop {r0} \n"
" svc %0 \n"
" bl MPU_xTimerGenericCommandFromTaskImpl \n"
" svc %1 \n"
" bx lr \n"
" \n"
: : "i" ( portSVC_SYSTEM_CALL_ENTER_1 ), "i" ( portSVC_SYSTEM_CALL_EXIT ) : "memory"
);
}
Expand Down
Loading

0 comments on commit b51a373

Please sign in to comment.