From 63fc65d84e37e5c08c43c3507dbc6e3ded802f20 Mon Sep 17 00:00:00 2001 From: hujun5 Date: Thu, 9 Jan 2025 16:45:44 +0800 Subject: [PATCH] segger: rm spin_lock_irqsave(NULL) in drivers/segger/config/SEGGER_RTT_Conf.h Signed-off-by: hujun5 --- drivers/segger/config/SEGGER_RTT_Conf.h | 12 ++++++++++-- drivers/segger/note_sysview.c | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/segger/config/SEGGER_RTT_Conf.h b/drivers/segger/config/SEGGER_RTT_Conf.h index bfab44081f098..aa19a89390be8 100644 --- a/drivers/segger/config/SEGGER_RTT_Conf.h +++ b/drivers/segger/config/SEGGER_RTT_Conf.h @@ -33,6 +33,14 @@ # include #endif +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +extern spinlock_t g_segger_lock; +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -81,11 +89,11 @@ /* 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) */ -#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 */ diff --git a/drivers/segger/note_sysview.c b/drivers/segger/note_sysview.c index 17424c4bd5104..7872287822679 100644 --- a/drivers/segger/note_sysview.c +++ b/drivers/segger/note_sysview.c @@ -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 ****************************************************************************/