Gary-Hobson commented on code in PR #7841:
URL: https://github.com/apache/nuttx/pull/7841#discussion_r1050460441


##########
drivers/note/note_driver.c:
##########
@@ -35,11 +35,71 @@
 #include <nuttx/irq.h>
 #include <nuttx/sched.h>
 #include <nuttx/clock.h>
+#include <nuttx/note/note_driver.h>
+#include <nuttx/note/noteram_driver.h>
 #include <nuttx/spinlock.h>
 #include <nuttx/sched_note.h>
 
 #include "sched/sched.h"
 
+#define note_add(driver, note, notelen)                                     \
+  ((driver)->ops->add && ((driver)->ops->add(driver, note, notelen), true))
+#define note_start(driver, tcb)                                             \
+  ((driver)->ops->start && ((driver)->ops->start(driver, tcb), true))
+#define note_stop(driver, tcb)                                              \
+  ((driver)->ops->stop && ((driver)->ops->stop(driver, tcb), true))
+#define note_suspend(driver, tcb)                                           \
+  ((driver)->ops->suspend && ((driver)->ops->suspend(driver, tcb), true))
+#define note_resume(driver, tcb)                                            \
+  ((driver)->ops->resume && ((driver)->ops->resume(driver, tcb), true))
+#define note_cpu_start(driver, tcb, cpu)                                    \
+  ((driver)->ops->cpu_start                                                 \
+   && ((driver)->ops->cpu_start(driver, tcb, cpu), true))

Review Comment:
   done



##########
drivers/note/note_driver.c:
##########
@@ -401,22 +468,36 @@ static void note_spincommon(FAR struct tcb_s *tcb,
                             int type)
 {
   struct note_spinlock_s note;
+  FAR struct note_driver_s **driver = g_note_drivers;
+  bool formatted = false;
 
   if (!note_isenabled())
     {
       return;
     }
 
-  /* Format the note */
+  for (; *driver; driver++)
+    {
+      if (note_spinlock(*driver, tcb, spinlock, type))
+        {
+          continue;
+        }
 
-  note_common(tcb, &note.nsp_cmn, sizeof(struct note_spinlock_s), type);
+      /* Format the note */
 
-  sched_note_flatten(note.nsp_spinlock, &spinlock, sizeof(spinlock));
-  note.nsp_value = *(FAR uint8_t *)spinlock;
+      if (!formatted)
+        {
+          formatted = true;
+          note_common(tcb, &note.nsp_cmn, sizeof(struct note_spinlock_s),
+                      type);
+          sched_note_flatten(note.nsp_spinlock, &spinlock, sizeof(spinlock));
+          note.nsp_value = *(FAR uint8_t *)spinlock;
+        }
 
-  /* Add the note to circular buffer */
+      /* Write the note to driver */

Review Comment:
   done



##########
drivers/note/note_driver.c:
##########
@@ -469,190 +553,290 @@ void sched_note_start(FAR struct tcb_s *tcb)
   length = SIZEOF_NOTE_START(0);
 #endif
 
-  /* Finish formatting the note */
-
-  note_common(tcb, &note.nsa_cmn, length, NOTE_START);
+  for (; *driver; driver++)

Review Comment:
   done



-- 
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: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to