From 2439232c8a81a906bc119f12ed86bada0ed4df42 Mon Sep 17 00:00:00 2001 From: arminker Date: Tue, 20 Jul 2021 15:47:03 +0800 Subject: bugfix:write_index bug in rt_ringbuffer_put_force --- components/drivers/src/ringbuffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'components/drivers/src') diff --git a/components/drivers/src/ringbuffer.c b/components/drivers/src/ringbuffer.c index 29de20b087..f01a594609 100644 --- a/components/drivers/src/ringbuffer.c +++ b/components/drivers/src/ringbuffer.c @@ -8,6 +8,7 @@ * 2012-09-30 Bernard first version. * 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 */ #include @@ -138,7 +139,8 @@ rt_size_t rt_ringbuffer_put_force(struct rt_ringbuffer *rb, if (length > space_length) { - rb->read_mirror = ~rb->read_mirror; + if (rb->write_index <= rb->read_index) + rb->read_mirror = ~rb->read_mirror; rb->read_index = rb->write_index; } -- cgit v1.3.1 From a8ed7b776995598c7d4443735ed7dbdcb8bd967e Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Thu, 22 Jul 2021 17:00:21 +0800 Subject: [workqueue] 将rt_work_sys_workqueue_init函数私有化 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/drivers/include/ipc/workqueue.h | 5 ++--- components/drivers/src/workqueue.c | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'components/drivers/src') diff --git a/components/drivers/include/ipc/workqueue.h b/components/drivers/include/ipc/workqueue.h index 03d38b2f4d..a156145641 100644 --- a/components/drivers/include/ipc/workqueue.h +++ b/components/drivers/include/ipc/workqueue.h @@ -69,7 +69,7 @@ rt_err_t rt_workqueue_critical_work(struct rt_workqueue *queue, struct rt_work * #ifdef RT_USING_SYSTEM_WORKQUEUE rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t time); rt_err_t rt_work_cancel(struct rt_work *work); -#endif +#endif /* RT_USING_SYSTEM_WORKQUEUE */ rt_inline void rt_work_init(struct rt_work *work, void (*work_func)(struct rt_work *work, void *work_data), void *work_data) @@ -85,7 +85,6 @@ rt_inline void rt_work_init(struct rt_work *work, void (*work_func)(struct rt_wo void rt_delayed_work_init(struct rt_delayed_work *work, void (*work_func)(struct rt_work *work, void *work_data), void *work_data); -int rt_work_sys_workqueue_init(void); -#endif +#endif /* RT_USING_HEAP */ #endif diff --git a/components/drivers/src/workqueue.c b/components/drivers/src/workqueue.c index f195dad927..065c505015 100644 --- a/components/drivers/src/workqueue.c +++ b/components/drivers/src/workqueue.c @@ -358,7 +358,7 @@ rt_err_t rt_work_cancel(struct rt_work *work) return rt_workqueue_cancel_work(sys_workq, work); } -int rt_work_sys_workqueue_init(void) +static int rt_work_sys_workqueue_init(void) { if (sys_workq != RT_NULL) return RT_EOK; @@ -370,5 +370,5 @@ int rt_work_sys_workqueue_init(void) return RT_EOK; } INIT_PREV_EXPORT(rt_work_sys_workqueue_init); -#endif -#endif +#endif /* RT_USING_SYSTEM_WORKQUEUE */ +#endif /* RT_USING_HEAP */ -- cgit v1.3.1