Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ihbai
rt-thread
提交
99de1a62
R
rt-thread
项目概览
ihbai
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
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,发现更多精彩内容 >>
提交
99de1a62
编写于
8月 14, 2021
作者:
J
Jackistang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
format code
上级
1b746897
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
47 deletion
+47
-47
components/drivers/include/ipc/ringbuffer.h
components/drivers/include/ipc/ringbuffer.h
+2
-2
components/drivers/include/ipc/workqueue.h
components/drivers/include/ipc/workqueue.h
+1
-1
components/drivers/src/ringbuffer.c
components/drivers/src/ringbuffer.c
+22
-22
components/drivers/src/workqueue.c
components/drivers/src/workqueue.c
+22
-22
未找到文件。
components/drivers/include/ipc/ringbuffer.h
浏览文件 @
99de1a62
...
...
@@ -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
)
...
...
components/drivers/include/ipc/workqueue.h
浏览文件 @
99de1a62
...
...
@@ -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.
...
...
components/drivers/src/ringbuffer.c
浏览文件 @
99de1a62
...
...
@@ -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
)
...
...
components/drivers/src/workqueue.c
浏览文件 @
99de1a62
...
...
@@ -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.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录