esp_expression_with_stack: renamed macro and functions to have esp_ prefix

This commit is contained in:
Felipe Neves 2019-11-15 16:49:25 +08:00
parent 98b76617be
commit 7b90f34c5a
3 changed files with 13 additions and 13 deletions

View file

@ -10,16 +10,16 @@
* @param stack Pointer to user alocated stack, it must points to its top
* @param expression Expression or function to be executed using the stack
*/
#define EXECUTE_EXPRESSION_WITH_STACK(lock, stack, expression) \
#define ESP_EXECUTE_EXPRESSION_WITH_STACK(lock, stack, expression) \
({ \
if(lock) { \
uint32_t backup; \
xSemaphoreTake(lock, portMAX_DELAY); \
switch_stack_enter(stack, &backup); \
esp_switch_stack_enter(stack, &backup); \
{ \
expression; \
} \
switch_stack_exit(&backup); \
esp_switch_stack_exit(&backup); \
xSemaphoreGive(lock); \
} \
})
@ -29,7 +29,7 @@
* Should never be called directly, otherwise crashes could
* occur
*/
extern void switch_stack_enter(portSTACK_TYPE *stack, uint32_t *backup_stack);
extern void switch_stack_exit(uint32_t *backup_stack);
extern void esp_switch_stack_enter(portSTACK_TYPE *stack, uint32_t *backup_stack);
extern void esp_switch_stack_exit(uint32_t *backup_stack);
#endif

View file

@ -5,10 +5,10 @@
/**
* extern void switch_stack_enter(portSTACK_TYPE *stack, portSTACK_TYPE *backup_stack);
*/
.globl switch_stack_enter
.type switch_stack_enter,@function
.globl esp_switch_stack_enter
.type esp_switch_stack_enter,@function
.align 4
switch_stack_enter:
esp_switch_stack_enter:
entry sp, 0x10
mov a4, a1
s32i a4, a3, 0 /* on a3 there is a safe place to save the current stack */
@ -19,10 +19,10 @@ switch_stack_enter:
/**
* extern void switch_stack_exit(portSTACK_TYPE *backup_stack);
*/
.globl switch_stack_exit
.type switch_stack_exit,@function
.globl esp_switch_stack_exit
.type esp_switch_stack_exit,@function
.align 4
switch_stack_exit:
esp_switch_stack_exit:
entry sp, 0x10
l32i a4, a2, 0 /* recover the original task stack */
mov a1, a4 /* put it on sp register again */

View file

@ -26,7 +26,7 @@ TEST_CASE("test printf using shared buffer stack", "[newlib]")
TEST_ASSERT(shared_stack != NULL);
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
EXECUTE_EXPRESSION_WITH_STACK(printf_lock, ext_stack_top, printf("Executing this from external stack! \n"));
EXECUTE_EXPRESSION_WITH_STACK(printf_lock, ext_stack_top, check_stack(ext_stack_top, shared_stack));
ESP_EXECUTE_EXPRESSION_WITH_STACK(printf_lock, ext_stack_top, printf("Executing this from external stack! \n"));
ESP_EXECUTE_EXPRESSION_WITH_STACK(printf_lock, ext_stack_top, check_stack(ext_stack_top, shared_stack));
free(shared_stack);
}