xiaoxiang781216 commented on code in PR #7984:
URL: https://github.com/apache/nuttx/pull/7984#discussion_r1058511873


##########
drivers/segger/sysview.c:
##########
@@ -54,10 +53,64 @@ struct sysview_s
 #endif
 };
 
+static void sysview_start(FAR struct note_driver_s *drv,
+                          FAR struct tcb_s *tcb);
+static void sysview_stop(FAR struct note_driver_s *drv,
+                         FAR struct tcb_s *tcb);
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
+static void sysview_suspend(FAR struct note_driver_s *drv,
+                            FAR struct tcb_s *tcb);
+static void sysview_resume(FAR struct note_driver_s *drv,
+                           FAR struct tcb_s *tcb);
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+static void sysview_irqhandler(FAR struct note_driver_s *drv, int irq,
+                               FAR void *handler, bool enter);
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+static void sysview_syscall_enter(FAR struct note_driver_s *drv, int nr);
+static void sysview_syscall_leave(FAR struct note_driver_s *drv, int nr);
+#endif
+
 /****************************************************************************
  * Private Data
  ****************************************************************************/
 
+static struct note_driver_ops_s g_sysview_ops =
+{
+  NULL,                  /* add */
+  sysview_start,         /* start */
+  sysview_stop,          /* stop */
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
+  sysview_suspend,       /* suspend */
+  sysview_resume,        /* resume */
+#  ifdef CONFIG_SMP
+  NULL,                  /* cpu_start */
+  NULL,                  /* cpu_started */
+  NULL,                  /* cpu_pause */
+  NULL,                  /* cpu_paused */
+  NULL,                  /* cpu_resume */
+  NULL,                  /* cpu_resumed */
+#  endif
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
+  NULL,                  /* premption */
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_CSECTION
+  NULL,                  /* csection */
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS
+  NULL,                  /* spinlock */
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+  sysview_syscall_enter, /* syscall_enter */
+  sysview_syscall_leave, /* syscall_leave */
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+  sysview_irqhandler,    /* irqhandler */
+#endif
+};
+
 static struct sysview_s g_sysview =

Review Comment:
   remove g_sysview too



##########
include/nuttx/note/note_driver.h:
##########
@@ -103,6 +103,12 @@ struct note_driver_s
   FAR const struct note_driver_ops_s *ops;
 };
 
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+extern struct note_driver_s g_sysview_driver;

Review Comment:
   why not put into include/nuttx/segger/sysview.h
   



##########
drivers/segger/sysview.c:
##########
@@ -406,7 +420,7 @@ void sched_note_syscall_enter(int nr, int argc, ...)
   SEGGER_SYSVIEW_MarkStart(nr);
 }
 
-void sched_note_syscall_leave(int nr, uintptr_t result)
+static void sysview_syscall_leave(FAR struct note_driver_s *drv, int nr)
 {
   nr -= CONFIG_SYS_RESERVED;
 

Review Comment:
   remove sysview_isenabled_syscall and NOTE_FILTER_SYSCALLMASK_ISSET, already 
check in common code



##########
drivers/segger/sysview.c:
##########
@@ -311,7 +323,8 @@ void sched_note_suspend(FAR struct tcb_s *tcb)
     }
 }
 
-void sched_note_resume(FAR struct tcb_s *tcb)
+static void sysview_resume(FAR struct note_driver_s *drv,
+                           FAR struct tcb_s *tcb)
 {
   if (!sysview_isenabled())

Review Comment:
   remove



##########
drivers/segger/sysview.c:
##########
@@ -276,7 +285,8 @@ static inline int sysview_isenabled_syscall(int nr)
  *
  ****************************************************************************/
 
-void sched_note_start(FAR struct tcb_s *tcb)
+static void sysview_start(FAR struct note_driver_s *drv,
+                          FAR struct tcb_s *tcb)
 {
   if (!sysview_isenabled())

Review Comment:
   remove



##########
drivers/segger/sysview.c:
##########
@@ -287,7 +297,8 @@ void sched_note_start(FAR struct tcb_s *tcb)
   sysview_send_taskinfo(tcb);
 }
 
-void sched_note_stop(FAR struct tcb_s *tcb)
+static void sysview_stop(FAR struct note_driver_s *drv,
+                         FAR struct tcb_s *tcb)
 {
   if (!sysview_isenabled())

Review Comment:
   remove



##########
drivers/segger/sysview.c:
##########
@@ -333,7 +346,8 @@ void sched_note_resume(FAR struct tcb_s *tcb)
 #endif
 
 #ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
-void sched_note_irqhandler(int irq, FAR void *handler, bool enter)
+static void sysview_irqhandler(FAR struct note_driver_s *drv, int irq,
+                               FAR void *handler, bool enter)
 {
   if (!sysview_isenabled_irq(irq, enter))

Review Comment:
   remove, already check in common code



##########
drivers/segger/sysview.c:
##########
@@ -298,7 +309,8 @@ void sched_note_stop(FAR struct tcb_s *tcb)
 }
 
 #ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
-void sched_note_suspend(FAR struct tcb_s *tcb)
+static void sysview_suspend(FAR struct note_driver_s *drv,
+                            FAR struct tcb_s *tcb)
 {
   if (!sysview_isenabled())

Review Comment:
   remove



##########
drivers/segger/sysview.c:
##########
@@ -371,7 +385,7 @@ void sched_note_irqhandler(int irq, FAR void *handler, bool 
enter)
 #endif
 
 #ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
-void sched_note_syscall_enter(int nr, int argc, ...)
+static void sysview_syscall_enter(FAR struct note_driver_s *drv, int nr)
 {
   nr -= CONFIG_SYS_RESERVED;
 

Review Comment:
   remove sysview_isenabled_syscall and NOTE_FILTER_SYSCALLMASK_ISSET, already 
check in common code



##########
drivers/segger/sysview.c:
##########
@@ -54,10 +53,64 @@ struct sysview_s
 #endif

Review Comment:
   remove mode, irq_mask and syscall_mask



##########
drivers/segger/sysview.c:
##########
@@ -54,10 +53,64 @@ struct sysview_s
 #endif

Review Comment:
   sysview_s->note_sysview_driver_s



##########
drivers/segger/sysview.c:
##########
@@ -71,6 +124,15 @@ static struct sysview_s g_sysview =
 #endif
 };
 
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+struct note_driver_s g_sysview_driver =

Review Comment:
   embed into sysview_s



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to