#define ESP_APPTRACE_PRINT_LOCK 0
-#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include "esp_log.h"
const static char *TAG = "esp_apptrace";
#define SEGGER_SYSVIEW_GET_INTERRUPT_ID() SEGGER_SYSVIEW_X_GetInterruptId() // Get the currently active interrupt Id from the user-provided function.
#endif
-void SEGGER_SYSVIEW_X_SysView_Lock();
-void SEGGER_SYSVIEW_X_SysView_Unlock();
-#define SEGGER_SYSVIEW_LOCK() SEGGER_SYSVIEW_X_SysView_Lock()
-#define SEGGER_SYSVIEW_UNLOCK() SEGGER_SYSVIEW_X_SysView_Unlock()
+unsigned SEGGER_SYSVIEW_X_SysView_Lock();
+void SEGGER_SYSVIEW_X_SysView_Unlock(unsigned int_state);
+// to be recursive save IRQ status on the stack of the caller
+#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
{
}
-void SEGGER_SYSVIEW_X_SysView_Lock()
+unsigned SEGGER_SYSVIEW_X_SysView_Lock()
{
esp_apptrace_tmo_t tmo;
esp_apptrace_tmo_init(&tmo, SEGGER_LOCK_WAIT_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);
}