rtt更新
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2024-04-28 Shell Add new wait_flags() & wakeup_by_errno() API
|
||||
* 2024-10-24 yekai Add C++ support
|
||||
*/
|
||||
#ifndef COMPLETION_H_
|
||||
#define COMPLETION_H_
|
||||
@@ -14,9 +15,9 @@
|
||||
#include <rtconfig.h>
|
||||
|
||||
/**
|
||||
* Completion - A tiny & rapid IPC primitive for resource-constrained scenarios
|
||||
* RT-Completion - A Tiny(resource-constrained) & Rapid(lockless) IPC Primitive
|
||||
*
|
||||
* It's an IPC using one CPU word with the encoding:
|
||||
* It's an IPC using one pointer word with the encoding:
|
||||
*
|
||||
* BIT | MAX-1 ----------------- 1 | 0 |
|
||||
* CONTENT | suspended_thread & ~1 | completed flag |
|
||||
@@ -30,12 +31,25 @@ struct rt_completion
|
||||
|
||||
#define RT_COMPLETION_INIT(comp) {0}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void rt_completion_init(struct rt_completion *completion);
|
||||
rt_err_t rt_completion_wait(struct rt_completion *completion,
|
||||
rt_int32_t timeout);
|
||||
rt_err_t rt_completion_wait_noisr(struct rt_completion *completion,
|
||||
rt_int32_t timeout);
|
||||
rt_err_t rt_completion_wait_flags(struct rt_completion *completion,
|
||||
rt_int32_t timeout, int suspend_flag);
|
||||
rt_err_t rt_completion_wait_flags_noisr(struct rt_completion *completion,
|
||||
rt_int32_t timeout, int suspend_flag);
|
||||
void rt_completion_done(struct rt_completion *completion);
|
||||
rt_err_t rt_completion_wakeup(struct rt_completion *completion);
|
||||
rt_err_t rt_completion_wakeup_by_errno(struct rt_completion *completion, rt_err_t error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <rtdef.h>
|
||||
#include <rtconfig.h>
|
||||
#include "completion.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -42,6 +43,7 @@ struct rt_workqueue
|
||||
struct rt_semaphore sem;
|
||||
rt_thread_t work_thread;
|
||||
struct rt_spinlock spinlock;
|
||||
struct rt_completion wakeup_completion;
|
||||
};
|
||||
|
||||
struct rt_work
|
||||
@@ -52,7 +54,7 @@ struct rt_work
|
||||
void *work_data;
|
||||
rt_uint16_t flags;
|
||||
rt_uint16_t type;
|
||||
struct rt_timer timer;
|
||||
rt_tick_t timeout_tick;
|
||||
struct rt_workqueue *workqueue;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user