xiaoxiang781216 commented on code in PR #7841: URL: https://github.com/apache/nuttx/pull/7841#discussion_r1050303127
########## include/nuttx/note/note_driver.h: ########## @@ -35,6 +39,72 @@ * Public Types ****************************************************************************/ +struct note_driver_s; + +struct note_driver_ops_s +{ + CODE void (*write)(FAR struct note_driver_s *drv, FAR const void *note, + size_t notelen); + CODE void (*start)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*stop)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH + CODE void (*suspend)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*resume)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SMP + CODE void (*cpu_start)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_started)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); + CODE void (*cpu_pause)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_paused)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); + CODE void (*cpu_resume)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_resumed)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); +#endif +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION + CODE void (*premption)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, bool locked); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_CSECTION + CODE void (*csection)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, bool enter); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS + CODE void (*spinlock)(FAR struct note_driver_s *drv, FAR void *tcb, Review Comment: ```suggestion CODE void (*spinlock)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb, ``` ########## include/nuttx/note/note_driver.h: ########## @@ -35,6 +39,72 @@ * Public Types ****************************************************************************/ +struct note_driver_s; + +struct note_driver_ops_s +{ + CODE void (*write)(FAR struct note_driver_s *drv, FAR const void *note, + size_t notelen); + CODE void (*start)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*stop)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH + CODE void (*suspend)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*resume)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SMP + CODE void (*cpu_start)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_started)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); + CODE void (*cpu_pause)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_paused)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); + CODE void (*cpu_resume)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_resumed)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); +#endif +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION + CODE void (*premption)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, bool locked); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_CSECTION + CODE void (*csection)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, bool enter); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS + CODE void (*spinlock)(FAR struct note_driver_s *drv, FAR void *tcb, + FAR volatile void *spinlock, int type); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL + CODE void (*syscall_enter)(FAR struct note_driver_s *drv, int nr); + CODE void (*syscall_leave)(FAR struct note_driver_s *drv, int nr); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER + CODE void (*irqhandler)(FAR struct note_driver_s *drv, int irq, + FAR void *handler, bool enter); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP + CODE void (*string)(FAR struct note_driver_s *drv, + uintptr_t ip, FAR const char *buf); Review Comment: ```suggestion uintptr_t ip, FAR const char *buf); ``` and all the following lines ########## drivers/note/noteram_driver.c: ########## @@ -790,7 +803,7 @@ static int noteram_ioctl(struct file *filep, int cmd, unsigned long arg) * ****************************************************************************/ -void sched_note_add(FAR const void *note, size_t notelen) +static void sched_noteram_add(FAR const void *note, size_t notelen) Review Comment: ```suggestion static void noteram_add(FAR struct note_driver_s *drv, FAR const void *note, size_t notelen) ``` and remove line 893-902 ########## include/nuttx/note/note_driver.h: ########## @@ -35,6 +39,72 @@ * Public Types ****************************************************************************/ +struct note_driver_s; + +struct note_driver_ops_s +{ + CODE void (*write)(FAR struct note_driver_s *drv, FAR const void *note, Review Comment: ```suggestion CODE void (*add)(FAR struct note_driver_s *drv, FAR const void *note, size_t notelen); ``` ########## include/nuttx/note/note_driver.h: ########## @@ -35,6 +39,72 @@ * Public Types ****************************************************************************/ +struct note_driver_s; + +struct note_driver_ops_s +{ + CODE void (*write)(FAR struct note_driver_s *drv, FAR const void *note, + size_t notelen); + CODE void (*start)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*stop)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH + CODE void (*suspend)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*resume)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SMP + CODE void (*cpu_start)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_started)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); + CODE void (*cpu_pause)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_paused)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); + CODE void (*cpu_resume)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_resumed)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); +#endif +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION + CODE void (*premption)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, bool locked); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_CSECTION + CODE void (*csection)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, bool enter); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS + CODE void (*spinlock)(FAR struct note_driver_s *drv, FAR void *tcb, + FAR volatile void *spinlock, int type); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL + CODE void (*syscall_enter)(FAR struct note_driver_s *drv, int nr); + CODE void (*syscall_leave)(FAR struct note_driver_s *drv, int nr); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER + CODE void (*irqhandler)(FAR struct note_driver_s *drv, int irq, + FAR void *handler, bool enter); +#endif +#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP + CODE void (*string)(FAR struct note_driver_s *drv, + uintptr_t ip, FAR const char *buf); + CODE void (*dump)(FAR struct note_driver_s *drv, + uintptr_t ip, uint8_t event, + FAR const void *buf, size_t len); + CODE void (*vprintf)(FAR struct note_driver_s *drv, + uintptr_t ip, FAR const char *fmt, + va_list va); Review Comment: ```suggestion va_list va) printflike(4, 0); ``` and vbprintf ########## drivers/note/Kconfig: ########## @@ -10,6 +10,12 @@ menuconfig DRIVER_NOTE if DRIVER_NOTE +config DRIVER_NOTE_MAX + int "Maximum number of sched_note drivers" + default 5 Review Comment: 1 ########## include/nuttx/note/note_driver.h: ########## @@ -35,6 +39,72 @@ * Public Types ****************************************************************************/ +struct note_driver_s; + +struct note_driver_ops_s +{ + CODE void (*write)(FAR struct note_driver_s *drv, FAR const void *note, + size_t notelen); + CODE void (*start)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*stop)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH + CODE void (*suspend)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*resume)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SMP Review Comment: ```suggestion # ifdef CONFIG_SMP ``` ########## include/nuttx/note/note_driver.h: ########## @@ -35,6 +39,72 @@ * Public Types ****************************************************************************/ +struct note_driver_s; + +struct note_driver_ops_s +{ + CODE void (*write)(FAR struct note_driver_s *drv, FAR const void *note, + size_t notelen); + CODE void (*start)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*stop)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH + CODE void (*suspend)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); + CODE void (*resume)(FAR struct note_driver_s *drv, FAR struct tcb_s *tcb); +#ifdef CONFIG_SMP + CODE void (*cpu_start)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_started)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); + CODE void (*cpu_pause)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_paused)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); + CODE void (*cpu_resume)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb, int cpu); + CODE void (*cpu_resumed)(FAR struct note_driver_s *drv, + FAR struct tcb_s *tcb); +#endif Review Comment: ```suggestion # endif ``` -- 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