forked from RT-Thread/rt-thread
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlwp_ipc.h
70 lines (62 loc) · 2 KB
/
lwp_ipc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright (c) 2006-2020, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2019-10-12 Jesven first version
*/
#ifndef LWP_IPC_H__
#define LWP_IPC_H__
#ifdef __cplusplus
extern "C" {
#endif
enum
{
RT_CHANNEL_RAW,
RT_CHANNEL_BUFFER,
RT_CHANNEL_FD
};
struct rt_channel_msg
{
void *sender;
int type;
union
{
struct chbuf
{
void *buf;
size_t length;
} b;
struct chfd
{
void *file;
int fd;
} fd;
void* d;
} u;
};
typedef struct rt_channel_msg *rt_channel_msg_t;
int rt_channel_open(const char *name, int flags);
rt_err_t rt_channel_close(int fd);
rt_err_t rt_channel_send(int fd, rt_channel_msg_t data);
rt_err_t rt_channel_send_recv(int fd, rt_channel_msg_t data, rt_channel_msg_t data_ret);
rt_err_t rt_channel_send_recv_timeout(int fd, rt_channel_msg_t data, rt_channel_msg_t data_ret, rt_int32_t time);
rt_err_t rt_channel_reply(int fd, rt_channel_msg_t data);
rt_err_t rt_channel_recv(int fd, rt_channel_msg_t data);
rt_err_t rt_channel_recv_timeout(int fd, rt_channel_msg_t data, rt_int32_t time);
rt_err_t rt_channel_peek(int fd, rt_channel_msg_t data);
rt_channel_t rt_raw_channel_open(const char *name, int flags);
rt_err_t rt_raw_channel_close(rt_channel_t ch);
rt_err_t rt_raw_channel_send(rt_channel_t ch, rt_channel_msg_t data);
rt_err_t rt_raw_channel_send_recv(rt_channel_t ch, rt_channel_msg_t data, rt_channel_msg_t data_ret);
rt_err_t rt_raw_channel_send_recv_timeout(rt_channel_t ch, rt_channel_msg_t data, rt_channel_msg_t data_ret, rt_int32_t time);
rt_err_t rt_raw_channel_reply(rt_channel_t ch, rt_channel_msg_t data);
rt_err_t rt_raw_channel_recv(rt_channel_t ch, rt_channel_msg_t data);
rt_err_t rt_raw_channel_recv_timeout(rt_channel_t ch, rt_channel_msg_t data, rt_int32_t time);
rt_err_t rt_raw_channel_peek(rt_channel_t ch, rt_channel_msg_t data);
#ifdef __cplusplus
}
#endif
#endif