From 99de1a622003d100c29abc084669cfc1263b1614 Mon Sep 17 00:00:00 2001 From: Jackistang Date: Sat, 14 Aug 2021 14:32:58 +0800 Subject: [PATCH] format code --- components/drivers/include/ipc/ringbuffer.h | 4 +- components/drivers/include/ipc/workqueue.h | 2 +- components/drivers/src/ringbuffer.c | 44 ++++++++++----------- components/drivers/src/workqueue.c | 44 ++++++++++----------- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/components/drivers/include/ipc/ringbuffer.h b/components/drivers/include/ipc/ringbuffer.h index 324d87b9b9..a9d74b064d 100644 --- a/components/drivers/include/ipc/ringbuffer.h +++ b/components/drivers/include/ipc/ringbuffer.h @@ -83,9 +83,9 @@ void rt_ringbuffer_destroy(struct rt_ringbuffer *rb); /** * @brief Get buffer size of the ringbuffer object. - * + * * @param rb A pointer to the ringbuffer object. - * + * * @return Buffer size. */ rt_inline rt_uint16_t rt_ringbuffer_get_size(struct rt_ringbuffer *rb) diff --git a/components/drivers/include/ipc/workqueue.h b/components/drivers/include/ipc/workqueue.h index 31295c29be..d479d0ec95 100644 --- a/components/drivers/include/ipc/workqueue.h +++ b/components/drivers/include/ipc/workqueue.h @@ -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. - * + * * @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_data A user data passed to the callback function as it's second parameter. diff --git a/components/drivers/src/ringbuffer.c b/components/drivers/src/ringbuffer.c index 099d48691e..b42c2ecefc 100644 --- a/components/drivers/src/ringbuffer.c +++ b/components/drivers/src/ringbuffer.c @@ -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. - * + * * @param rb A pointer to the ringbuffer object. * @param pool A pointer to the buffer. * @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. - * + * * @param rb A pointer to the ringbuffer 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 ringbuffer actually. */ 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. - * + * * @param rb A pointer to the ringbuffer 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 ringbuffer actually. */ 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. - * + * * @param rb A pointer to the ringbuffer. * @param ptr A pointer to the data buffer. * @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. */ 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. - * + * * @param rb A pointer to the ringbuffer. * @param ptr When this function return, *ptr is a pointer to the first character of ringbuffer. - * + * * @return Return the size of ringbuffer. */ 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. - * + * * @param rb A pointer to the ringbuffer object. * @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. */ 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. - * + * * @param rb A pointer to the ringbuffer object. * @param ch A character to be put into the ringbuffer. - * + * * @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) @@ -341,10 +341,10 @@ RTM_EXPORT(rt_ringbuffer_putchar_force); /** * @brief Get a character from the ringbuffer. - * + * * @param rb The pointer to ringbuffer object. * @param ch The buffer to store character read from ringbuffer. - * + * * @return 0 Ringbuffer is empty. * @return 1 Success */ @@ -375,9 +375,9 @@ RTM_EXPORT(rt_ringbuffer_getchar); /** * @brief Get the size of data in the ringbuffer in bytes. - * + * * @param rb The pointer to ringbuffer object. - * + * * @return Return the size of data in the ringbuffer in bytes. */ 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. - * + * * @param rb A pointer to the ringbuffer object. */ 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. - * + * * @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. */ -struct rt_ringbuffer* rt_ringbuffer_create(rt_uint16_t size) +struct rt_ringbuffer *rt_ringbuffer_create(rt_uint16_t size) { struct rt_ringbuffer *rb; 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() . - * + * * @param rb A pointer to the ringbuffer object. */ void rt_ringbuffer_destroy(struct rt_ringbuffer *rb) diff --git a/components/drivers/src/workqueue.c b/components/drivers/src/workqueue.c index e37af37658..37733a1f65 100644 --- a/components/drivers/src/workqueue.c +++ b/components/drivers/src/workqueue.c @@ -212,11 +212,11 @@ static void _delayed_work_timeout_handler(void *parameter) /** * @brief Create a work queue, which contains a thread. - * + * * @param name The name for work queue thread. * @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. */ 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. - * + * * @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) { @@ -267,10 +267,10 @@ rt_err_t rt_workqueue_destroy(struct rt_workqueue *queue) /** * @brief Submit a work item to the work queue immediately. - * + * * @param queue A pointer to workqueue object. * @param work A pointer to work item object. - * + * * @return RT_EOK Success. * @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. - * + * * @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. - * + * * @return RT_EOK Success. * @return -RT_EBUSY This work item is been executing now. * @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. - * + * * @param queue A pointer to workqueue 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) { @@ -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. - * + * * @param queue A pointer to workqueue object. * @param work A pointer to work item object. - * + * * @return RT_EOK Success. * @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. - * + * * @param queue A pointer to workqueue object. * @param work A pointer to work item object. - * + * * @return RT_EOK Success. */ 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. - * + * * @param queue A pointer to workqueue object. - * + * * @return RT_EOK Success. */ 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. - * + * * @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. - * + * * @return RT_EOK Success. * @return -RT_EBUSY This work item is been executing now. * @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. - * + * * @param work A pointer to work item object. - * + * * @return RT_EOK Success. * @return -RT_EBUSY This work item is been executing now. */