summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorLim-LinYuanbo <[email protected]>2021-09-08 22:45:31 +0800
committerGitHub <[email protected]>2021-09-08 22:45:31 +0800
commitb404f69f851817c62697074ffb363294b91585c6 (patch)
treef5f31152993843a5e07559a6b7b0caddcc9ebd0a /components/drivers/include
parent49fcf9f4cd436d30d2df8c4e24b751194c32f43b (diff)
parent7fa1c819ee852937705d948a58f0218c422ea6b1 (diff)
Merge branch 'master' into master
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/ipc/ringblk_buf.h5
-rw-r--r--components/drivers/include/ipc/ringbuffer.h8
-rw-r--r--components/drivers/include/ipc/workqueue.h8
3 files changed, 20 insertions, 1 deletions
diff --git a/components/drivers/include/ipc/ringblk_buf.h b/components/drivers/include/ipc/ringblk_buf.h
index 5b2971b800..df05659f3e 100644
--- a/components/drivers/include/ipc/ringblk_buf.h
+++ b/components/drivers/include/ipc/ringblk_buf.h
@@ -76,9 +76,12 @@ typedef struct rt_rbb *rt_rbb_t;
/* rbb (ring block buffer) API */
void rt_rbb_init(rt_rbb_t rbb, rt_uint8_t *buf, rt_size_t buf_size, rt_rbb_blk_t block_set, rt_size_t blk_max_num);
+rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb);
+
+#ifdef RT_USING_HEAP
rt_rbb_t rt_rbb_create(rt_size_t buf_size, rt_size_t blk_max_num);
void rt_rbb_destroy(rt_rbb_t rbb);
-rt_size_t rt_rbb_get_buf_size(rt_rbb_t rbb);
+#endif
/* rbb block API */
rt_rbb_blk_t rt_rbb_blk_alloc(rt_rbb_t rbb, rt_size_t blk_size);
diff --git a/components/drivers/include/ipc/ringbuffer.h b/components/drivers/include/ipc/ringbuffer.h
index 71c4801253..7da50225b3 100644
--- a/components/drivers/include/ipc/ringbuffer.h
+++ b/components/drivers/include/ipc/ringbuffer.h
@@ -5,6 +5,7 @@
*
* Change Logs:
* Date Author Notes
+ * 2021-08-14 Jackistang add comments for function interface.
*/
#ifndef RINGBUFFER_H__
#define RINGBUFFER_H__
@@ -80,6 +81,13 @@ struct rt_ringbuffer* rt_ringbuffer_create(rt_uint16_t length);
void rt_ringbuffer_destroy(struct rt_ringbuffer *rb);
#endif
+/**
+ * @brief Get the buffer size of the ring buffer object.
+ *
+ * @param rb A pointer to the ring buffer object.
+ *
+ * @return Buffer size.
+ */
rt_inline rt_uint16_t rt_ringbuffer_get_size(struct rt_ringbuffer *rb)
{
RT_ASSERT(rb != RT_NULL);
diff --git a/components/drivers/include/ipc/workqueue.h b/components/drivers/include/ipc/workqueue.h
index 03904d852e..776709a8ab 100644
--- a/components/drivers/include/ipc/workqueue.h
+++ b/components/drivers/include/ipc/workqueue.h
@@ -6,6 +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 comments for rt_work_init()
*/
#ifndef WORKQUEUE_H__
#define WORKQUEUE_H__
@@ -67,6 +68,13 @@ 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 /* RT_USING_SYSTEM_WORKQUEUE */
+/**
+ * @brief Initialize a work item, binding with a callback function.
+ *
+ * @param work A pointer to the work item object.
+ * @param work_func A callback function that will be called when this work item is executed.
+ * @param work_data A user data passed to the callback function as the second parameter.
+ */
rt_inline void rt_work_init(struct rt_work *work, void (*work_func)(struct rt_work *work, void *work_data),
void *work_data)
{