format code

This commit is contained in:
Jackistang 2021-08-14 14:32:58 +08:00
parent 1b7468979f
commit 99de1a6220
4 changed files with 47 additions and 47 deletions

View File

@ -83,9 +83,9 @@ void rt_ringbuffer_destroy(struct rt_ringbuffer *rb);
/** /**
* @brief Get buffer size of the ringbuffer object. * @brief Get buffer size of the ringbuffer object.
* *
* @param rb A pointer to the ringbuffer object. * @param rb A pointer to the ringbuffer object.
* *
* @return Buffer size. * @return Buffer size.
*/ */
rt_inline rt_uint16_t rt_ringbuffer_get_size(struct rt_ringbuffer *rb) rt_inline rt_uint16_t rt_ringbuffer_get_size(struct rt_ringbuffer *rb)

View File

@ -70,7 +70,7 @@ rt_err_t rt_work_cancel(struct rt_work *work);
/** /**
* @brief Init a work item, and bind it with a callback function. * @brief Init a work item, and bind it with a callback function.
* *
* @param work A pointer to work item object. * @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_func A callback function will be called when this work item is being executed.
* @param work_data A user data passed to the callback function as it's second parameter. * @param work_data A user data passed to the callback function as it's second parameter.

View File

@ -30,7 +30,7 @@ rt_inline enum rt_ringbuffer_state rt_ringbuffer_status(struct rt_ringbuffer *rb
/** /**
* @brief Init a ringbuffer object with a given buffer. * @brief Init a ringbuffer object with a given buffer.
* *
* @param rb A pointer to the ringbuffer object. * @param rb A pointer to the ringbuffer object.
* @param pool A pointer to the buffer. * @param pool A pointer to the buffer.
* @param size Size of the buffer in bytes. * @param size Size of the buffer in bytes.
@ -54,11 +54,11 @@ RTM_EXPORT(rt_ringbuffer_init);
/** /**
* @brief Put a block of data into the ringbuffer. If the size of ringbuffer is not enough, it will discard out-of-range data. * @brief Put a block of data into the ringbuffer. If the size of ringbuffer is not enough, it will discard out-of-range data.
* *
* @param rb A pointer to the ringbuffer object. * @param rb A pointer to the ringbuffer object.
* @param ptr A pointer to the data buffer. * @param ptr A pointer to the data buffer.
* @param length The size of data in bytes. * @param length The size of data in bytes.
* *
* @return Return the size in bytes put into the ringbuffer actually. * @return Return the size in bytes put into the ringbuffer actually.
*/ */
rt_size_t rt_ringbuffer_put(struct rt_ringbuffer *rb, rt_size_t rt_ringbuffer_put(struct rt_ringbuffer *rb,
@ -107,11 +107,11 @@ RTM_EXPORT(rt_ringbuffer_put);
/** /**
* @brief Put a block of data into the ringbuffer. If the size of ringbuffer is not enough, it will overwrite the existing data in the ringbuffer. * @brief Put a block of data into the ringbuffer. If the size of ringbuffer is not enough, it will overwrite the existing data in the ringbuffer.
* *
* @param rb A pointer to the ringbuffer object. * @param rb A pointer to the ringbuffer object.
* @param ptr A pointer to the data buffer. * @param ptr A pointer to the data buffer.
* @param length The size of data in bytes. * @param length The size of data in bytes.
* *
* @return Return the size in bytes put into the ringbuffer actually. * @return Return the size in bytes put into the ringbuffer actually.
*/ */
rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb, rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb,
@ -168,11 +168,11 @@ RTM_EXPORT(rt_ringbuffer_put_force);
/** /**
* @brief Get a block of data from the ringbuffer. * @brief Get a block of data from the ringbuffer.
* *
* @param rb A pointer to the ringbuffer. * @param rb A pointer to the ringbuffer.
* @param ptr A pointer to the data buffer. * @param ptr A pointer to the data buffer.
* @param length The size of data we want to read from the ringbuffer. * @param length The size of data we want to read from the ringbuffer.
* *
* @return Return the size of data we read from the ringbuffer actually. * @return Return the size of data we read from the ringbuffer actually.
*/ */
rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb, rt_size_t rt_ringbuffer_get(struct rt_ringbuffer *rb,
@ -225,10 +225,10 @@ RTM_EXPORT(rt_ringbuffer_get);
/** /**
* @brief Peak data from the ringbuffer. * @brief Peak data from the ringbuffer.
* *
* @param rb A pointer to the ringbuffer. * @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 character of ringbuffer.
* *
* @return Return the size of ringbuffer. * @return Return the size of ringbuffer.
*/ */
rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr) rt_size_t rt_ringbuffer_peak(struct rt_ringbuffer *rb, rt_uint8_t **ptr)
@ -264,10 +264,10 @@ RTM_EXPORT(rt_ringbuffer_peak);
/** /**
* @brief Put a character into the ringbuffer. If ringbuffer is full, This operation will fail. * @brief Put a character into the ringbuffer. If ringbuffer is full, This operation will fail.
* *
* @param rb A pointer to the ringbuffer object. * @param rb A pointer to the ringbuffer object.
* @param ch A character to be put into the ringbuffer. * @param ch A character to be put into the ringbuffer.
* *
* @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 ringbuffer. If return 0, it means the ringbuffer if full. If return 1, it means success.
*/ */
rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch) rt_size_t rt_ringbuffer_putchar(struct rt_ringbuffer *rb, const rt_uint8_t ch)
@ -297,10 +297,10 @@ 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 character into the ringbuffer. If ringbuffer is full, it will discard one old data and put into a new data.
* *
* @param rb A pointer to the ringbuffer object. * @param rb A pointer to the ringbuffer object.
* @param ch A character to be put into the ringbuffer. * @param ch A character to be put into the ringbuffer.
* *
* @return Return the size in bytes put into the ringbuffer. Always return 1. * @return Return the size in bytes put into the ringbuffer. Always return 1.
*/ */
rt_size_t rt_ringbuffer_putchar_force(struct rt_ringbuffer *rb, const rt_uint8_t ch) rt_size_t rt_ringbuffer_putchar_force(struct rt_ringbuffer *rb, const rt_uint8_t ch)
@ -341,10 +341,10 @@ RTM_EXPORT(rt_ringbuffer_putchar_force);
/** /**
* @brief Get a character from the ringbuffer. * @brief Get a character from the ringbuffer.
* *
* @param rb The pointer to ringbuffer object. * @param rb The pointer to ringbuffer object.
* @param ch The buffer to store character read from ringbuffer. * @param ch The buffer to store character read from ringbuffer.
* *
* @return 0 Ringbuffer is empty. * @return 0 Ringbuffer is empty.
* @return 1 Success * @return 1 Success
*/ */
@ -375,9 +375,9 @@ RTM_EXPORT(rt_ringbuffer_getchar);
/** /**
* @brief Get the size of data in the ringbuffer in bytes. * @brief Get the size of data in the ringbuffer in bytes.
* *
* @param rb The pointer to ringbuffer object. * @param rb The pointer to ringbuffer object.
* *
* @return Return the size of data in the ringbuffer in bytes. * @return Return the size of data in the ringbuffer in bytes.
*/ */
rt_size_t rt_ringbuffer_data_len(struct rt_ringbuffer *rb) rt_size_t rt_ringbuffer_data_len(struct rt_ringbuffer *rb)
@ -400,7 +400,7 @@ RTM_EXPORT(rt_ringbuffer_data_len);
/** /**
* @brief Reset the ringbuffer object, and clear all contents in the buffer. * @brief Reset the ringbuffer object, and clear all contents in the buffer.
* *
* @param rb A pointer to the ringbuffer object. * @param rb A pointer to the ringbuffer object.
*/ */
void rt_ringbuffer_reset(struct rt_ringbuffer *rb) void rt_ringbuffer_reset(struct rt_ringbuffer *rb)
@ -418,12 +418,12 @@ RTM_EXPORT(rt_ringbuffer_reset);
/** /**
* @brief Create a ringbuffer object with a given size. * @brief Create a ringbuffer object with a given size.
* *
* @param size Size of the buffer in bytes. * @param size Size of the buffer in bytes.
* *
* @return Return a pointer to ringbuffer object. When the return value is RT_NULL, it means the creation failed. * @return Return a pointer to ringbuffer object. When the return value is RT_NULL, it means the creation failed.
*/ */
struct rt_ringbuffer* rt_ringbuffer_create(rt_uint16_t size) struct rt_ringbuffer *rt_ringbuffer_create(rt_uint16_t size)
{ {
struct rt_ringbuffer *rb; struct rt_ringbuffer *rb;
rt_uint8_t *pool; rt_uint8_t *pool;
@ -452,7 +452,7 @@ RTM_EXPORT(rt_ringbuffer_create);
/** /**
* @brief Destroy a ringbuffer object, which is created by rt_ringbuffer_create() . * @brief Destroy a ringbuffer object, which is created by rt_ringbuffer_create() .
* *
* @param rb A pointer to the ringbuffer object. * @param rb A pointer to the ringbuffer object.
*/ */
void rt_ringbuffer_destroy(struct rt_ringbuffer *rb) void rt_ringbuffer_destroy(struct rt_ringbuffer *rb)

View File

@ -212,11 +212,11 @@ static void _delayed_work_timeout_handler(void *parameter)
/** /**
* @brief Create a work queue, which contains a thread. * @brief Create a work queue, which contains a thread.
* *
* @param name The name for work queue thread. * @param name The name for work queue thread.
* @param stack_size The stack size for work queue thread. * @param stack_size The stack size for work queue thread.
* @param priority The priority 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. When the return value is RT_NULL, it means the creation failed.
*/ */
struct rt_workqueue *rt_workqueue_create(const char *name, rt_uint16_t stack_size, rt_uint8_t priority) struct rt_workqueue *rt_workqueue_create(const char *name, rt_uint16_t stack_size, rt_uint8_t priority)
@ -248,10 +248,10 @@ struct rt_workqueue *rt_workqueue_create(const char *name, rt_uint16_t stack_siz
/** /**
* @brief Destroy a work queue. * @brief Destroy a work queue.
* *
* @param queue A pointer to workqueue object. * @param queue A pointer to workqueue object.
* *
* @return RT_EOK Success. * @return RT_EOK Success.
*/ */
rt_err_t rt_workqueue_destroy(struct rt_workqueue *queue) rt_err_t rt_workqueue_destroy(struct rt_workqueue *queue)
{ {
@ -267,10 +267,10 @@ rt_err_t rt_workqueue_destroy(struct rt_workqueue *queue)
/** /**
* @brief Submit a work item to the work queue immediately. * @brief Submit a work item to the work queue immediately.
* *
* @param queue A pointer to workqueue object. * @param queue A pointer to workqueue object.
* @param work A pointer to work item object. * @param work A pointer to work item object.
* *
* @return RT_EOK Success. * @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now. * @return -RT_EBUSY This work item is been executing now.
*/ */
@ -284,11 +284,11 @@ rt_err_t rt_workqueue_dowork(struct rt_workqueue *queue, struct rt_work *work)
/** /**
* @brief Submit a work item to the work queue with a delay of time. * @brief Submit a work item to the work queue with a delay of time.
* *
* @param queue A pointer to workqueue object. * @param queue A pointer to workqueue object.
* @param work A pointer to work item 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 tick) before it's been submitted to the work queue.
* *
* @return RT_EOK Success. * @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now. * @return -RT_EBUSY This work item is been executing now.
* @return -RT_ERROR Time is invalid. * @return -RT_ERROR Time is invalid.
@ -303,11 +303,11 @@ rt_err_t rt_workqueue_submit_work(struct rt_workqueue *queue, struct rt_work *wo
/** /**
* @brief This function submit a work item to the work queue. This work item will be executed immediately after the current work item is executed. * @brief This function submit a work item to the work queue. This work item will be executed immediately after the current work item is executed.
* *
* @param queue A pointer to workqueue object. * @param queue A pointer to workqueue object.
* @param work A pointer to work item object. * @param work A pointer to work item object.
* *
* @return RT_EOK Success. * @return RT_EOK Success.
*/ */
rt_err_t rt_workqueue_critical_work(struct rt_workqueue *queue, struct rt_work *work) rt_err_t rt_workqueue_critical_work(struct rt_workqueue *queue, struct rt_work *work)
{ {
@ -338,10 +338,10 @@ rt_err_t rt_workqueue_critical_work(struct rt_workqueue *queue, struct rt_work *
/** /**
* @brief Cancel a work item in the work queue. * @brief Cancel a work item in the work queue.
* *
* @param queue A pointer to workqueue object. * @param queue A pointer to workqueue object.
* @param work A pointer to work item object. * @param work A pointer to work item object.
* *
* @return RT_EOK Success. * @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now. * @return -RT_EBUSY This work item is been executing now.
*/ */
@ -354,10 +354,10 @@ rt_err_t rt_workqueue_cancel_work(struct rt_workqueue *queue, struct rt_work *wo
/** /**
* @brief Cancel a work item in the work queue. If the work item is been executing now, this function will block until it is done. * @brief Cancel a work item in the work queue. If the work item is been executing now, this function will block until it is done.
* *
* @param queue A pointer to workqueue object. * @param queue A pointer to workqueue object.
* @param work A pointer to work item object. * @param work A pointer to work item object.
* *
* @return RT_EOK Success. * @return RT_EOK Success.
*/ */
rt_err_t rt_workqueue_cancel_work_sync(struct rt_workqueue *queue, struct rt_work *work) rt_err_t rt_workqueue_cancel_work_sync(struct rt_workqueue *queue, struct rt_work *work)
@ -380,9 +380,9 @@ rt_err_t rt_workqueue_cancel_work_sync(struct rt_workqueue *queue, struct rt_wor
/** /**
* @brief This function will cancel all work item in work queue. * @brief This function will cancel all work item in work queue.
* *
* @param queue A pointer to workqueue object. * @param queue A pointer to workqueue object.
* *
* @return RT_EOK Success. * @return RT_EOK Success.
*/ */
rt_err_t rt_workqueue_cancel_all_work(struct rt_workqueue *queue) rt_err_t rt_workqueue_cancel_all_work(struct rt_workqueue *queue)
@ -414,10 +414,10 @@ static struct rt_workqueue *sys_workq;
/** /**
* @brief Submit a work item to the system work queue with a delay of time. * @brief Submit a work item to the system work queue with a delay of time.
* *
* @param work A pointer to work item 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 system work queue. * @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_EOK Success.
* @return -RT_EBUSY This work item is been executing now. * @return -RT_EBUSY This work item is been executing now.
* @return -RT_ERROR Time is invalid. * @return -RT_ERROR Time is invalid.
@ -429,9 +429,9 @@ rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t time)
/** /**
* @brief Cancel a work item in system work queue. * @brief Cancel a work item in system work queue.
* *
* @param work A pointer to work item object. * @param work A pointer to work item object.
* *
* @return RT_EOK Success. * @return RT_EOK Success.
* @return -RT_EBUSY This work item is been executing now. * @return -RT_EBUSY This work item is been executing now.
*/ */