From f3d611928249889c969c963a450c5a9faad790ed Mon Sep 17 00:00:00 2001 From: xuxingliang Date: Tue, 9 Jul 2024 18:05:53 +0800 Subject: [PATCH] sched/note: add wdog note for segger sysview Signed-off-by: xuxingliang --- drivers/segger/note_sysview.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/segger/note_sysview.c b/drivers/segger/note_sysview.c index a00dcbe8e1..a783925fde 100644 --- a/drivers/segger/note_sysview.c +++ b/drivers/segger/note_sysview.c @@ -79,6 +79,10 @@ static void note_sysview_heap(FAR struct note_driver_s *drv, uint8_t event, FAR void *heap, FAR void *mem, size_t size, size_t curused); #endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_WDOG +static void note_sysview_wdog(FAR struct note_driver_s *drv, uint8_t event, + FAR void *handler, FAR const void *arg); +#endif /**************************************************************************** * Private Data @@ -120,7 +124,7 @@ static const struct note_driver_ops_s g_note_sysview_ops = note_sysview_irqhandler, /* irqhandler */ #endif #ifdef CONFIG_SCHED_INSTRUMENTATION_WDOG - NULL, /* wdog */ + note_sysview_wdog, /* wdog */ #endif #ifdef CONFIG_SCHED_INSTRUMENTATION_HEAP note_sysview_heap, /* heap */ @@ -389,6 +393,21 @@ static void note_sysview_heap(FAR struct note_driver_s *drv, } #endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_WDOG +static void note_sysview_wdog(FAR struct note_driver_s *drv, uint8_t event, + FAR void *handler, FAR const void *arg) +{ + if (event == NOTE_WDOG_ENTER) + { + SEGGER_SYSVIEW_RecordEnterTimer((uintptr_t)handler); + } + else if (event == NOTE_WDOG_LEAVE) + { + SEGGER_SYSVIEW_RecordExitTimer(); + } +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/