mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
esp_expression_with_stack: renamed macro and functions to have esp_ prefix
This commit is contained in:
parent
98b76617be
commit
7b90f34c5a
@ -10,16 +10,16 @@
|
|||||||
* @param stack Pointer to user alocated stack, it must points to its top
|
* @param stack Pointer to user alocated stack, it must points to its top
|
||||||
* @param expression Expression or function to be executed using the stack
|
* @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) { \
|
if(lock) { \
|
||||||
uint32_t backup; \
|
uint32_t backup; \
|
||||||
xSemaphoreTake(lock, portMAX_DELAY); \
|
xSemaphoreTake(lock, portMAX_DELAY); \
|
||||||
switch_stack_enter(stack, &backup); \
|
esp_switch_stack_enter(stack, &backup); \
|
||||||
{ \
|
{ \
|
||||||
expression; \
|
expression; \
|
||||||
} \
|
} \
|
||||||
switch_stack_exit(&backup); \
|
esp_switch_stack_exit(&backup); \
|
||||||
xSemaphoreGive(lock); \
|
xSemaphoreGive(lock); \
|
||||||
} \
|
} \
|
||||||
})
|
})
|
||||||
@ -29,7 +29,7 @@
|
|||||||
* Should never be called directly, otherwise crashes could
|
* Should never be called directly, otherwise crashes could
|
||||||
* occur
|
* occur
|
||||||
*/
|
*/
|
||||||
extern void switch_stack_enter(portSTACK_TYPE *stack, uint32_t *backup_stack);
|
extern void esp_switch_stack_enter(portSTACK_TYPE *stack, uint32_t *backup_stack);
|
||||||
extern void switch_stack_exit(uint32_t *backup_stack);
|
extern void esp_switch_stack_exit(uint32_t *backup_stack);
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -5,10 +5,10 @@
|
|||||||
/**
|
/**
|
||||||
* extern void switch_stack_enter(portSTACK_TYPE *stack, portSTACK_TYPE *backup_stack);
|
* extern void switch_stack_enter(portSTACK_TYPE *stack, portSTACK_TYPE *backup_stack);
|
||||||
*/
|
*/
|
||||||
.globl switch_stack_enter
|
.globl esp_switch_stack_enter
|
||||||
.type switch_stack_enter,@function
|
.type esp_switch_stack_enter,@function
|
||||||
.align 4
|
.align 4
|
||||||
switch_stack_enter:
|
esp_switch_stack_enter:
|
||||||
entry sp, 0x10
|
entry sp, 0x10
|
||||||
mov a4, a1
|
mov a4, a1
|
||||||
s32i a4, a3, 0 /* on a3 there is a safe place to save the current stack */
|
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);
|
* extern void switch_stack_exit(portSTACK_TYPE *backup_stack);
|
||||||
*/
|
*/
|
||||||
.globl switch_stack_exit
|
.globl esp_switch_stack_exit
|
||||||
.type switch_stack_exit,@function
|
.type esp_switch_stack_exit,@function
|
||||||
.align 4
|
.align 4
|
||||||
switch_stack_exit:
|
esp_switch_stack_exit:
|
||||||
entry sp, 0x10
|
entry sp, 0x10
|
||||||
l32i a4, a2, 0 /* recover the original task stack */
|
l32i a4, a2, 0 /* recover the original task stack */
|
||||||
mov a1, a4 /* put it on sp register again */
|
mov a1, a4 /* put it on sp register again */
|
||||||
|
@ -26,7 +26,7 @@ TEST_CASE("test printf using shared buffer stack", "[newlib]")
|
|||||||
TEST_ASSERT(shared_stack != NULL);
|
TEST_ASSERT(shared_stack != NULL);
|
||||||
|
|
||||||
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
|
SemaphoreHandle_t printf_lock = xSemaphoreCreateMutex();
|
||||||
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, 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, check_stack(ext_stack_top, shared_stack));
|
||||||
free(shared_stack);
|
free(shared_stack);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user