YuuichiNakamura commented on a change in pull request #1377: URL: https://github.com/apache/incubator-nuttx/pull/1377#discussion_r452558692
########## File path: include/nuttx/sched_note.h ########## @@ -391,27 +423,62 @@ ssize_t sched_note_get(FAR uint8_t *buffer, size_t buflen); ssize_t sched_note_size(void); #endif +/**************************************************************************** + * Name: sched_note_buffer_clear + * + * Description: + * Clear all contents of the circular buffer. + * + * Input Parameters: + * oneshot - Oneshot mode flag. If true, the buffer put operation stops + * when whole buffer is used. + * + * Returned Value: + * None. + * + ****************************************************************************/ +#ifdef NOTE_FEATURE_BUFFER_REWINDABLE +void sched_note_buffer_clear(int oneshot); Review comment: It is because the function is in sched_note_buffer.c because it manages the note buffer, but the trace start/stop function in sched_note.c need it. The reason of sched_note_buffer_rewind() is same, too. (I also think it is not good design...) The another idea for it is: - Provide the struct which inherits lib_outstream_s. It contains the function pointers to manage the buffer (clear/rewind). - sched_note_buffer.c sets the function pointer of sched_note_buffer_clear/rewind() to the new struct. - sched_note.c calls the function if the pointer is not NULL. ########## File path: include/nuttx/sched_note.h ########## @@ -391,27 +423,62 @@ ssize_t sched_note_get(FAR uint8_t *buffer, size_t buflen); ssize_t sched_note_size(void); #endif +/**************************************************************************** + * Name: sched_note_buffer_clear + * + * Description: + * Clear all contents of the circular buffer. + * + * Input Parameters: + * oneshot - Oneshot mode flag. If true, the buffer put operation stops + * when whole buffer is used. + * + * Returned Value: + * None. + * + ****************************************************************************/ +#ifdef NOTE_FEATURE_BUFFER_REWINDABLE +void sched_note_buffer_clear(int oneshot); +#endif + +/**************************************************************************** + * Name: sched_note_buffer_rewind + * + * Description: + * Rewind the read pointer of the circular buffer. + * + * Input Parameters: + * None. + * + * Returned Value: + * None. + * + ****************************************************************************/ +#ifdef NOTE_FEATURE_BUFFER_REWINDABLE +void sched_note_buffer_rewind(void); +#endif + /**************************************************************************** * Name: note_register * * Description: * Register a serial driver at /dev/note that can be used by an - * application to read data from the circular not buffer. + * application to read data from the circular note buffer. * * Input Parameters: * None. * * Returned Value: - * Zero is returned if the circular buffer is empty. Otherwise, a negated - * errno value is returned. + * Zero on succress. A negated errno value is returned on a failure. * ****************************************************************************/ -#if defined(CONFIG_SCHED_INSTRUMENTATION_BUFFER) && \ - defined(CONFIG_DRIVER_NOTE) +#ifdef CONFIG_DRIVER_NOTE int note_register(void); Review comment: I got it. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org