fix comments error in ringbuffer and workqueue.

This commit is contained in:
Jackistang 2021-08-17 22:44:29 +08:00
parent a454422bd2
commit 6173c9d7d5
4 changed files with 53 additions and 61 deletions

View File

@ -5,7 +5,7 @@
*
* Change Logs:
* Date Author Notes
* 2021-08-14 Jackistang add commets for function inferface.
* 2021-08-14 Jackistang add comments for function interface.
*/
#ifndef RINGBUFFER_H__
#define RINGBUFFER_H__

View File

@ -6,7 +6,7 @@
* Change Logs:
* Date Author Notes
* 2021-08-01 Meco Man remove rt_delayed_work_init() and rt_delayed_work structure
* 2021-08-14 Jackistang add commets for rt_work_init()
* 2021-08-14 Jackistang add comments for rt_work_init()
*/
#ifndef WORKQUEUE_H__
#define WORKQUEUE_H__
@ -69,10 +69,10 @@ rt_err_t rt_work_cancel(struct rt_work *work);
#endif /* RT_USING_SYSTEM_WORKQUEUE */
/**
* @brief Init a work item, and bind it with a callback function.
* @brief Initialize a work item, binding with a callback function.
*
* @param work A pointer to work item object.
* @param work_func A callback function will be called when this work item is being executed.
* @param work A pointer to the work item object.
* @param work_func A callback function will be called when this work item is executed.
* @param work_data A user data passed to the callback function as it's second parameter.
*/
rt_inline void rt_work_init(struct rt_work *work, void (*work_func)(struct rt_work *work, void *work_data),

View File

@ -9,7 +9,7 @@
* 2013-05-08 Grissiom reimplement
* 2016-08-18 heyuanjie add interface
* 2021-07-20 arminker fix write_index bug in function rt_ringbuffer_put_force
* 2021-08-14 Jackistang add commets for function inferface.
* 2021-08-14 Jackistang add comments for function interface.
*/
#include <rtthread.h>
@ -29,7 +29,7 @@ rt_inline enum rt_ringbuffer_state rt_ringbuffer_status(struct rt_ringbuffer *rb
}
/**
* @brief Init a ringbuffer object with a given buffer.
* @brief Initialize a ring buffer object with a given buffer.
*
* @param rb A pointer to the ring buffer object.
* @param pool A pointer to the buffer.
@ -112,7 +112,7 @@ RTM_EXPORT(rt_ringbuffer_put);
* @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 ringbuffer actually.
* @return Return the byte size of the data actually put into the ring buffer.
*/
rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
const rt_uint8_t *ptr,
@ -167,13 +167,13 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
RTM_EXPORT(rt_ringbuffer_put_force);
/**
* @brief Get a block of data from the ringbuffer.
* @brief Get data from the ring buffer.
*
* @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.
*
* @return Return the size of data we read from the ringbuffer actually.
* @return Return the data size that we read from the ring buffer.
*/
rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb,
rt_uint8_t *ptr,
@ -219,15 +219,11 @@ rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb,
}
RTM_EXPORT(rt_ringbuffer_get);
/**
* peak data from ring buffer
*/
/**
* @brief Peak data from the ring buffer.
*
* @param rb A pointer to the ringbuffer.
* @param ptr When this function return, *ptr is a pointer to the first character of 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.
*/
@ -263,12 +259,12 @@ rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr)
RTM_EXPORT(rt_ringbuffer_peak);
/**
* @brief Put a character into the ringbuffer. If ringbuffer is full, This operation will fail.
* @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 character to be put into the ringbuffer.
* @param ch A byte to be put into the ring buffer.
*
* @return Return the size in bytes put into the ringbuffer. If return 0, it means the ringbuffer if full. If return 1, it means success.
* @return Return the size in bytes 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)
{
@ -296,10 +292,10 @@ rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch)
RTM_EXPORT(rt_ringbuffer_putchar);
/**
* @brief Put a character into the ringbuffer. If ringbuffer 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 one old data and put into a new data.
*
* @param rb A pointer to the ring buffer object.
* @param ch A character to be put into the ringbuffer.
* @param ch A byte to be put into the ring buffer.
*
* @return Return the size in bytes put into the ring buffer. Always return 1.
*/
@ -336,16 +332,12 @@ rt_size_t rt_ringbuffer_putchar_force(struct rt_ringbuffer *rb, const rt_uint8_t
RTM_EXPORT(rt_ringbuffer_putchar_force);
/**
* get a character from a ringbuffer
*/
/**
* @brief Get a character from the ringbuffer.
* @brief Get a byte from the ring buffer.
*
* @param rb The pointer to ring buffer object.
* @param ch The buffer to store character read from ringbuffer.
* @param ch The buffer to store byte read from ring buffer.
*
* @return 0 Ringbuffer is empty.
* @return 0 ring buffer is empty.
* @return 1 Success
*/
rt_size_t rt_ringbuffer_getchar(struct rt_ringbuffer *rb, rt_uint8_t *ch)
@ -356,7 +348,7 @@ rt_size_t rt_ringbuffer_getchar(struct rt_ringbuffer *rb, rt_uint8_t *ch)
if (!rt_ringbuffer_data_len(rb))
return 0;
/* put character */
/* put byte */
*ch = rb->buffer_ptr[rb->read_index];
if (rb->read_index == rb->buffer_size-1)

View File

@ -7,7 +7,7 @@
* Date Author Notes
* 2017-02-27 Bernard fix the re-work issue.
* 2021-08-01 Meco Man remove rt_delayed_work_init()
* 2021-08-14 Jackistang add commets for function interface.
* 2021-08-14 Jackistang add comments for function interface.
*/
#include <rthw.h>
@ -217,7 +217,7 @@ static void _delayed_work_timeout_handler(void *parameter)
* @param stack_size The stack size for work queue thread.
* @param priority The priority for work queue thread.
*
* @return Return a pointer to workqueue object. When the return value is RT_NULL, it means the creation failed.
* @return Return a pointer to workqueue object. It will return RT_NULL if failed.
*/
struct rt_workqueue *rt_workqueue_create(const char *name, rt_uint16_t stack_size, rt_uint8_t priority)
{
@ -272,7 +272,7 @@ rt_err_t rt_workqueue_destroy(struct rt_workqueue *queue)
* @param work A pointer to work item object.
*
* @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now.
* @return -RT_EBUSY This work item is executing.
*/
rt_err_t rt_workqueue_dowork(struct rt_workqueue *queue, struct rt_work *work)
{
@ -287,10 +287,10 @@ rt_err_t rt_workqueue_dowork(struct rt_workqueue *queue, struct rt_work *work)
*
* @param queue A pointer to workqueue object.
* @param work A pointer to work item object.
* @param time This work item will be delayed by time (unit: an OS tick) before it's been submitted to the work queue.
* @param time This work item will be delayed by time (unit: an OS ticks) before it's been submitted to the work queue.
*
* @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now.
* @return -RT_EBUSY This work item is executing.
* @return -RT_ERROR Time is invalid.
*/
rt_err_t rt_workqueue_submit_work(struct rt_workqueue *queue, struct rt_work *work, rt_tick_t time)
@ -343,7 +343,7 @@ rt_err_t rt_workqueue_critical_work(struct rt_workqueue *queue, struct rt_work *
* @param work A pointer to work item object.
*
* @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now.
* @return -RT_EBUSY This work item is executing.
*/
rt_err_t rt_workqueue_cancel_work(struct rt_workqueue *queue, struct rt_work *work)
{
@ -419,7 +419,7 @@ static struct rt_workqueue *sys_workq;
* @param time This work item will be delayed by time (unit: an OS tick) before it's been submitted to system work queue.
*
* @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now.
* @return -RT_EBUSY This work item is executing.
* @return -RT_ERROR Time is invalid.
*/
rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t time)
@ -433,7 +433,7 @@ rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t time)
* @param work A pointer to work item object.
*
* @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now.
* @return -RT_EBUSY This work item is executing.
*/
rt_err_t rt_work_cancel(struct rt_work *work)
{