diff options
| author | Shell <[email protected]> | 2024-03-28 23:42:56 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-28 23:42:56 +0800 |
| commit | 83e95bdff4c48c661b50e1eec56d5fd293b28fbb (patch) | |
| tree | 9e0c2065950f0804e5009da71c8e0f590224cade /components/drivers/include/ipc | |
| parent | 40e26f4909fa61ada775ba86b44d8300aaf5d250 (diff) | |
sync smart & dfs (#8672)
Signed-off-by: xqyjlj <[email protected]>
Signed-off-by: Shell <[email protected]>
Co-authored-by: xqyjlj <[email protected]>
Diffstat (limited to 'components/drivers/include/ipc')
| -rw-r--r-- | components/drivers/include/ipc/completion.h | 1 | ||||
| -rw-r--r-- | components/drivers/include/ipc/condvar.h | 38 | ||||
| -rw-r--r-- | components/drivers/include/ipc/pipe.h | 2 | ||||
| -rw-r--r-- | components/drivers/include/ipc/waitqueue.h | 1 |
4 files changed, 42 insertions, 0 deletions
diff --git a/components/drivers/include/ipc/completion.h b/components/drivers/include/ipc/completion.h index efa2b7840d..266ddd281e 100644 --- a/components/drivers/include/ipc/completion.h +++ b/components/drivers/include/ipc/completion.h @@ -33,5 +33,6 @@ void rt_completion_init(struct rt_completion *completion); rt_err_t rt_completion_wait(struct rt_completion *completion, rt_int32_t timeout); void rt_completion_done(struct rt_completion *completion); +rt_err_t rt_completion_wakeup(struct rt_completion *completion); #endif diff --git a/components/drivers/include/ipc/condvar.h b/components/drivers/include/ipc/condvar.h new file mode 100644 index 0000000000..1211df420d --- /dev/null +++ b/components/drivers/include/ipc/condvar.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2006-2023, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2023-11-20 Shell Add cond var API in kernel + */ + +#ifndef __LWP_TERMINAL_CONDVAR_H__ +#define __LWP_TERMINAL_CONDVAR_H__ + +#include <rtthread.h> + +typedef struct rt_condvar +{ +#ifdef USING_RT_OBJECT + struct rt_object parent; +#endif + rt_atomic_t waiters_cnt; + rt_atomic_t waiting_mtx; + struct rt_wqueue event; +} *rt_condvar_t; + +void rt_condvar_init(rt_condvar_t cv, char *name); +int rt_condvar_timedwait(rt_condvar_t cv, rt_mutex_t mtx, int suspend_flag, + rt_tick_t timeout); +int rt_condvar_signal(rt_condvar_t cv); +int rt_condvar_broadcast(rt_condvar_t cv); + +rt_inline void rt_condvar_detach(rt_condvar_t cv) +{ + RT_UNUSED(cv); + return ; +} + +#endif /* __LWP_TERMINAL_CONDVAR_H__ */ diff --git a/components/drivers/include/ipc/pipe.h b/components/drivers/include/ipc/pipe.h index 94ac10f635..fdba84a57e 100644 --- a/components/drivers/include/ipc/pipe.h +++ b/components/drivers/include/ipc/pipe.h @@ -12,6 +12,7 @@ #include <rtdef.h> #include <rtconfig.h> +#include "condvar.h" /** * Pipe Device @@ -34,6 +35,7 @@ struct rt_pipe_device int writer; int reader; + struct rt_condvar waitfor_parter; struct rt_mutex lock; }; typedef struct rt_pipe_device rt_pipe_t; diff --git a/components/drivers/include/ipc/waitqueue.h b/components/drivers/include/ipc/waitqueue.h index 073300a72e..dcc01ceff9 100644 --- a/components/drivers/include/ipc/waitqueue.h +++ b/components/drivers/include/ipc/waitqueue.h @@ -49,6 +49,7 @@ int rt_wqueue_wait(rt_wqueue_t *queue, int condition, int timeout); int rt_wqueue_wait_killable(rt_wqueue_t *queue, int condition, int timeout); int rt_wqueue_wait_interruptible(rt_wqueue_t *queue, int condition, int timeout); void rt_wqueue_wakeup(rt_wqueue_t *queue, void *key); +void rt_wqueue_wakeup_all(rt_wqueue_t *queue, void *key); #define DEFINE_WAIT_FUNC(name, function) \ struct rt_wqueue_node name = { \ |
