Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wwsmg1
rt-thread
提交
6173c9d7
R
rt-thread
项目概览
wwsmg1
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6173c9d7
编写于
8月 17, 2021
作者:
J
Jackistang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix comments error in ringbuffer and workqueue.
上级
a454422b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
53 addition
and
61 deletion
+53
-61
components/drivers/include/ipc/ringbuffer.h
components/drivers/include/ipc/ringbuffer.h
+3
-3
components/drivers/include/ipc/workqueue.h
components/drivers/include/ipc/workqueue.h
+4
-4
components/drivers/src/ringbuffer.c
components/drivers/src/ringbuffer.c
+38
-46
components/drivers/src/workqueue.c
components/drivers/src/workqueue.c
+8
-8
未找到文件。
components/drivers/include/ipc/ringbuffer.h
浏览文件 @
6173c9d7
...
...
@@ -5,7 +5,7 @@
*
* Change Logs:
* Date Author Notes
* 2021-08-14 Jackistang add comme
ts for function inf
erface.
* 2021-08-14 Jackistang add comme
nts for function int
erface.
*/
#ifndef RINGBUFFER_H__
#define RINGBUFFER_H__
...
...
@@ -82,9 +82,9 @@ void rt_ringbuffer_destroy(struct rt_ringbuffer *rb);
#endif
/**
* @brief Get buffer size of the ringbuffer object.
* @brief Get buffer size of the ring
buffer object.
*
* @param rb A pointer to the ringbuffer object.
* @param rb A pointer to the ring
buffer object.
*
* @return Buffer size.
*/
...
...
components/drivers/include/ipc/workqueue.h
浏览文件 @
6173c9d7
...
...
@@ -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 comme
n
ts 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 Init
ialize 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
),
...
...
components/drivers/src/ringbuffer.c
浏览文件 @
6173c9d7
...
...
@@ -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 comme
ts for function inf
erface.
* 2021-08-14 Jackistang add comme
nts for function int
erface.
*/
#include <rtthread.h>
...
...
@@ -29,9 +29,9 @@ rt_inline enum rt_ringbuffer_state rt_ringbuffer_status(struct rt_ringbuffer *rb
}
/**
* @brief Init
a ring
buffer object with a given buffer.
* @brief Init
ialize a ring
buffer object with a given buffer.
*
* @param rb A pointer to the ringbuffer object.
* @param rb A pointer to the ring
buffer object.
* @param pool A pointer to the buffer.
* @param size Size of the buffer in bytes.
*/
...
...
@@ -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 size of ring
buffer is not enough, it will discard out-of-range data.
*
* @param rb A pointer to the ringbuffer object.
* @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 ringbuffer actually.
* @return Return the size in bytes put into the ring
buffer actually.
*/
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 ringbuffer 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 size of ring buffer is not enough, it will overwrite the existing data in the ring
buffer.
*
* @param rb A pointer to the ringbuffer object.
* @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 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 ring
buffer.
* @brief Get
data from the ring
buffer.
*
* @param rb A pointer to the ringbuffer.
* @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 ringbuffer.
* @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
,
...
...
@@ -220,16 +220,12 @@ 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 ringbuffer.
* @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 ring
buffer.
* @param ptr When this function return, *ptr is a pointer to the first
readable byte of the ring
buffer.
*
* @return Return the size of ringbuffer.
* @return Return the size of ring
buffer.
*/
rt_size_t
rt_ringbuffer_peak
(
struct
rt_ringbuffer
*
rb
,
rt_uint8_t
**
ptr
)
{
...
...
@@ -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, T
his operation will fail.
* @brief Put a
byte into the ring buffer. If ring buffer is full, t
his operation will fail.
*
* @param rb A pointer to the ringbuffer object.
* @param ch A
character to be put into the ring
buffer.
* @param rb A pointer to the ring
buffer object.
* @param ch A
byte to be put into the ring
buffer.
*
* @return Return the size in bytes put into the ring
buffer. 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,12 +292,12 @@ 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 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 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 ring
buffer.
* @param rb A pointer to the ring
buffer object.
* @param ch A
byte to be put into the ring
buffer.
*
* @return Return the size in bytes put into the ringbuffer. Always return 1.
* @return Return the size in bytes put into the ring
buffer. Always return 1.
*/
rt_size_t
rt_ringbuffer_putchar_force
(
struct
rt_ringbuffer
*
rb
,
const
rt_uint8_t
ch
)
{
...
...
@@ -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 ringbuffer object.
* @param ch The buffer to store
character read from ring
buffer.
* @param rb The pointer to ring
buffer object.
* @param ch The buffer to store
byte read from ring
buffer.
*
* @return 0
Ring
buffer 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
)
...
...
@@ -374,11 +366,11 @@ rt_size_t rt_ringbuffer_getchar(struct rt_ringbuffer *rb, rt_uint8_t *ch)
RTM_EXPORT
(
rt_ringbuffer_getchar
);
/**
* @brief Get the size of data in the ringbuffer in bytes.
* @brief Get the size of data in the ring
buffer in bytes.
*
* @param rb The pointer to ringbuffer object.
* @param rb The pointer to ring
buffer object.
*
* @return Return the size of data in the ringbuffer in bytes.
* @return Return the size of data in the ring
buffer in bytes.
*/
rt_size_t
rt_ringbuffer_data_len
(
struct
rt_ringbuffer
*
rb
)
{
...
...
@@ -399,9 +391,9 @@ rt_size_t rt_ringbuffer_data_len(struct rt_ringbuffer *rb)
RTM_EXPORT
(
rt_ringbuffer_data_len
);
/**
* @brief Reset the ringbuffer object, and clear all contents in the buffer.
* @brief Reset the ring
buffer object, and clear all contents in the buffer.
*
* @param rb A pointer to the ringbuffer object.
* @param rb A pointer to the ring
buffer object.
*/
void
rt_ringbuffer_reset
(
struct
rt_ringbuffer
*
rb
)
{
...
...
@@ -417,11 +409,11 @@ RTM_EXPORT(rt_ringbuffer_reset);
#ifdef RT_USING_HEAP
/**
* @brief Create a ringbuffer object with a given size.
* @brief Create a ring
buffer 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.
* @return Return a pointer to ring
buffer object. When the return value is RT_NULL, it means the creation failed.
*/
struct
rt_ringbuffer
*
rt_ringbuffer_create
(
rt_uint16_t
size
)
{
...
...
@@ -451,9 +443,9 @@ exit:
RTM_EXPORT
(
rt_ringbuffer_create
);
/**
* @brief Destroy a ringbuffer object, which is created by rt_ringbuffer_create() .
* @brief Destroy a ring
buffer object, which is created by rt_ringbuffer_create() .
*
* @param rb A pointer to the ringbuffer object.
* @param rb A pointer to the ring
buffer object.
*/
void
rt_ringbuffer_destroy
(
struct
rt_ringbuffer
*
rb
)
{
...
...
components/drivers/src/workqueue.c
浏览文件 @
6173c9d7
...
...
@@ -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 comme
n
ts 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 tick
s
) 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
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录