esp32: Fixes SystemView lock's IRQ state restore

This commit is contained in:
Alexey Gerenkov
2018-10-18 19:10:33 +03:00
committed by bot
parent 4c881708dc
commit 3eaba1c8ce
3 changed files with 10 additions and 7 deletions

View File

@@ -172,7 +172,6 @@
#define ESP_APPTRACE_PRINT_LOCK 0 #define ESP_APPTRACE_PRINT_LOCK 0
#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include "esp_log.h" #include "esp_log.h"
const static char *TAG = "esp_apptrace"; const static char *TAG = "esp_apptrace";

View File

@@ -166,10 +166,11 @@ Revision: $Rev: 5927 $
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function. #define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function.
#endif #endif
void SEGGER_SYSVIEW_X_SysView_Lock(); unsigned SEGGER_SYSVIEW_X_SysView_Lock();
void SEGGER_SYSVIEW_X_SysView_Unlock(); void SEGGER_SYSVIEW_X_SysView_Unlock(unsigned int_state);
#define SEGGER_SYSVIEW_LOCK() SEGGER_SYSVIEW_X_SysView_Lock() // to be recursive save IRQ status on the stack of the caller
#define SEGGER_SYSVIEW_UNLOCK() SEGGER_SYSVIEW_X_SysView_Unlock() #define SEGGER_SYSVIEW_LOCK() unsigned _SYSVIEW_int_state = SEGGER_SYSVIEW_X_SysView_Lock()
#define SEGGER_SYSVIEW_UNLOCK() SEGGER_SYSVIEW_X_SysView_Unlock(_SYSVIEW_int_state)
#endif // SEGGER_SYSVIEW_CONF_H #endif // SEGGER_SYSVIEW_CONF_H

View File

@@ -337,15 +337,18 @@ void SEGGER_SYSVIEW_X_RTT_Unlock()
{ {
} }
void SEGGER_SYSVIEW_X_SysView_Lock() unsigned SEGGER_SYSVIEW_X_SysView_Lock()
{ {
esp_apptrace_tmo_t tmo; esp_apptrace_tmo_t tmo;
esp_apptrace_tmo_init(&tmo, SEGGER_LOCK_WAIT_TMO); esp_apptrace_tmo_init(&tmo, SEGGER_LOCK_WAIT_TMO);
esp_apptrace_lock_take(&s_sys_view_lock, &tmo); esp_apptrace_lock_take(&s_sys_view_lock, &tmo);
// to be recursive save IRQ status on the stack of the caller to keep it from overwriting
return s_sys_view_lock.int_state;
} }
void SEGGER_SYSVIEW_X_SysView_Unlock() void SEGGER_SYSVIEW_X_SysView_Unlock(unsigned int_state)
{ {
s_sys_view_lock.int_state = int_state;
esp_apptrace_lock_give(&s_sys_view_lock); esp_apptrace_lock_give(&s_sys_view_lock);
} }