segger: rm spin_lock_irqsave(NULL) in drivers/segger/config/SEGGER_RTT_Conf.h

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2025-01-09 16:45:44 +08:00 committed by Xiang Xiao
parent cfd0cc0d1a
commit 8fd4bea2ba
2 changed files with 16 additions and 2 deletions

View file

@ -33,6 +33,14 @@
# include <nuttx/spinlock.h> # include <nuttx/spinlock.h>
#endif #endif
/****************************************************************************
* Public Data
****************************************************************************/
#ifndef __ASSEMBLY__
extern spinlock_t g_segger_lock;
#endif
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
@ -81,11 +89,11 @@
/* Lock RTT (nestable) (i.e. disable interrupts) */ /* Lock RTT (nestable) (i.e. disable interrupts) */
#define SEGGER_RTT_LOCK() irqstate_t __flags = spin_lock_irqsave(NULL) #define SEGGER_RTT_LOCK() irqstate_t __flags = spin_lock_irqsave_wo_note(&g_segger_lock)
/* Unlock RTT (nestable) (i.e. enable previous interrupt lock state) */ /* Unlock RTT (nestable) (i.e. enable previous interrupt lock state) */
#define SEGGER_RTT_UNLOCK() spin_unlock_irqrestore(NULL, __flags) #define SEGGER_RTT_UNLOCK() spin_unlock_irqrestore_wo_note(&g_segger_lock, __flags)
/* Disable RTT SEGGER_RTT_WriteSkipNoLock */ /* Disable RTT SEGGER_RTT_WriteSkipNoLock */

View file

@ -158,6 +158,12 @@ static struct note_sysview_driver_s g_note_sysview_driver =
} }
}; };
/****************************************************************************
* Public Data
****************************************************************************/
spinlock_t g_segger_lock = SP_UNLOCKED;
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/