diff options
| author | Jackistang <[email protected]> | 2021-08-18 09:44:52 +0800 |
|---|---|---|
| committer | Jackistang <[email protected]> | 2021-08-18 09:44:52 +0800 |
| commit | 3de03a072e3145522546b46117e51e9e444e1b4e (patch) | |
| tree | e92896137a6712bba0f1369ac0ace7549fa5e4fa /components/drivers/src/ringbuffer.c | |
| parent | 6173c9d7d5933adbf2ed374034d34608bbdd3c58 (diff) | |
修改 ringbuffer 和 workqueue 注释的语法
Diffstat (limited to 'components/drivers/src/ringbuffer.c')
| -rw-r--r-- | components/drivers/src/ringbuffer.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/components/drivers/src/ringbuffer.c b/components/drivers/src/ringbuffer.c index 417982a1b7..a8233a7555 100644 --- a/components/drivers/src/ringbuffer.c +++ b/components/drivers/src/ringbuffer.c @@ -29,11 +29,11 @@ rt_inline enum rt_ringbuffer_state rt_ringbuffer_status(struct rt_ringbuffer *rb } /** - * @brief Initialize a ring buffer object with a given buffer. + * @brief Initialize the ring buffer object with the given buffer. * * @param rb A pointer to the ring buffer object. * @param pool A pointer to the buffer. - * @param size Size of the buffer in bytes. + * @param size The size of the buffer in bytes. */ void rt_ringbuffer_init(struct rt_ringbuffer *rb, rt_uint8_t *pool, @@ -53,13 +53,13 @@ void rt_ringbuffer_init(struct rt_ringbuffer *rb, RTM_EXPORT(rt_ringbuffer_init); /** - * @brief Put a block of data into the ring buffer. If the size of ring buffer is not enough, it will discard out-of-range data. + * @brief Put a block of data into the ring buffer. If the capacity of ring buffer is insufficient, it will discard out-of-range data. * * @param rb A pointer to the ring buffer object. * @param ptr A pointer to the data buffer. * @param length The size of data in bytes. * - * @return Return the size in bytes put into the ring buffer actually. + * @return Return the data size we put into the ring buffer. */ rt_size_t rt_ringbuffer_put(struct rt_ringbuffer *rb, const rt_uint8_t *ptr, @@ -106,13 +106,13 @@ rt_size_t rt_ringbuffer_put(struct rt_ringbuffer *rb, RTM_EXPORT(rt_ringbuffer_put); /** - * @brief Put a block of data into the ring buffer. If the size of ring buffer is not enough, it will overwrite the existing data in the ring buffer. + * @brief Put a block of data into the ring buffer. If the capacity of ring buffer is insufficient, it will overwrite the existing data in the ring buffer. * * @param rb A pointer to the ring buffer object. * @param ptr A pointer to the data buffer. * @param length The size of data in bytes. * - * @return Return the byte size of the data actually put into the ring buffer. + * @return Return the data size we put into the ring buffer. */ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb, const rt_uint8_t *ptr, @@ -171,9 +171,9 @@ RTM_EXPORT(rt_ringbuffer_put_force); * * @param rb A pointer to the ring buffer. * @param ptr A pointer to the data buffer. - * @param length The size of data we want to read from the ring buffer. + * @param length The size of the data we want to read from the ring buffer. * - * @return Return the data size that we read from the ring buffer. + * @return Return the data size we read from the ring buffer. */ rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb, rt_uint8_t *ptr, @@ -220,12 +220,14 @@ rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb, RTM_EXPORT(rt_ringbuffer_get); /** - * @brief Peak data from the ring buffer. + * @brief Get the first readable byte of the ring buffer. * * @param rb A pointer to the ringbuffer. * @param ptr When this function return, *ptr is a pointer to the first readable byte of the ring buffer. * - * @return Return the size of ring buffer. + * @note It is recommended to read only one byte, otherwise it may cause buffer overflow. + * + * @return Return the size of the ring buffer. */ rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr) { @@ -262,9 +264,9 @@ RTM_EXPORT(rt_ringbuffer_peak); * @brief Put a byte into the ring buffer. If ring buffer is full, this operation will fail. * * @param rb A pointer to the ring buffer object. - * @param ch A byte to be put into the ring buffer. + * @param ch A byte put into the ring buffer. * - * @return Return the size in bytes put into the ring buffer. The ring buffer is full if returns 0. Otherwise, it will return 1. + * @return Return the data size we put into the ring buffer. The ring buffer is full if returns 0. Otherwise, it will return 1. */ rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch) { @@ -292,12 +294,12 @@ rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch) RTM_EXPORT(rt_ringbuffer_putchar); /** - * @brief Put a byte into the ring buffer. If ring buffer is full, it will discard one old data and put into a new data. + * @brief Put a byte into the ring buffer. If ring buffer is full, it will discard an old data and put into a new data. * * @param rb A pointer to the ring buffer object. - * @param ch A byte to be put into the ring buffer. + * @param ch A byte put into the ring buffer. * - * @return Return the size in bytes put into the ring buffer. Always return 1. + * @return Return the data size we put into the ring buffer. Always return 1. */ rt_size_t rt_ringbuffer_putchar_force(struct rt_ringbuffer *rb, const rt_uint8_t ch) { @@ -334,10 +336,10 @@ RTM_EXPORT(rt_ringbuffer_putchar_force); /** * @brief Get a byte from the ring buffer. * - * @param rb The pointer to ring buffer object. - * @param ch The buffer to store byte read from ring buffer. + * @param rb The pointer to the ring buffer object. + * @param ch A pointer to the buffer, used to store one byte. * - * @return 0 ring buffer is empty. + * @return 0 The ring buffer is empty. * @return 1 Success */ rt_size_t rt_ringbuffer_getchar(struct rt_ringbuffer *rb, rt_uint8_t *ch) @@ -368,7 +370,7 @@ RTM_EXPORT(rt_ringbuffer_getchar); /** * @brief Get the size of data in the ring buffer in bytes. * - * @param rb The pointer to ring buffer object. + * @param rb The pointer to the ring buffer object. * * @return Return the size of data in the ring buffer in bytes. */ @@ -411,7 +413,7 @@ RTM_EXPORT(rt_ringbuffer_reset); /** * @brief Create a ring buffer object with a given size. * - * @param size Size of the buffer in bytes. + * @param size The size of the buffer in bytes. * * @return Return a pointer to ring buffer object. When the return value is RT_NULL, it means the creation failed. */ @@ -443,7 +445,7 @@ exit: RTM_EXPORT(rt_ringbuffer_create); /** - * @brief Destroy a ring buffer object, which is created by rt_ringbuffer_create() . + * @brief Destroy the ring buffer object, which is created by rt_ringbuffer_create() . * * @param rb A pointer to the ring buffer object. */ |
