]> granicus.if.org Git - esp-idf/commitdiff
esp32: Fixes SystemView lock's IRQ state restore
authorAlexey Gerenkov <alexey@espressif.com>
Thu, 18 Oct 2018 16:10:33 +0000 (19:10 +0300)
committerbot <bot@espressif.com>
Tue, 20 Nov 2018 04:09:39 +0000 (04:09 +0000)
components/app_trace/app_trace.c
components/app_trace/sys_view/Config/SEGGER_SYSVIEW_Conf.h
components/app_trace/sys_view/Sample/Config/SEGGER_SYSVIEW_Config_FreeRTOS.c

index 5552fe5e2a1c6e3fc192df52d37a7fba96be2276..20871b44dc5d8b215107441fada5e9138460e510 100644 (file)
 
 #define ESP_APPTRACE_PRINT_LOCK                 0
 
-#define LOG_LOCAL_LEVEL CONFIG_LOG_DEFAULT_LEVEL
 #include "esp_log.h"
 const static char *TAG = "esp_apptrace";
 
index 787237a00b8accc7211bc5a0f5f8c964b58128f2..2968c6e02180686f3643d7e834eea7aa7a2d2a94 100644 (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.
 #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
 
index 08e85678efd7b6aeff32e871002359554ff1931c..2df7ee0c12374e0e851c9de57c58f84991029b0d 100644 (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_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);
 }