1
2
3
4
5
6
7
8
9
10
11
12#ifndef __RPMSG_INTERNAL_H__
13#define __RPMSG_INTERNAL_H__
14
15#include <linux/rpmsg.h>
16#include <linux/poll.h>
17
18#define to_rpmsg_device(d) container_of(d, struct rpmsg_device, dev)
19#define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv)
20
21
22
23
24
25
26
27
28
29
30
31
32
33struct rpmsg_device_ops {
34 struct rpmsg_device *(*create_channel)(struct rpmsg_device *rpdev,
35 struct rpmsg_channel_info *chinfo);
36 int (*release_channel)(struct rpmsg_device *rpdev,
37 struct rpmsg_channel_info *chinfo);
38 struct rpmsg_endpoint *(*create_ept)(struct rpmsg_device *rpdev,
39 rpmsg_rx_cb_t cb, void *priv,
40 struct rpmsg_channel_info chinfo);
41
42 int (*announce_create)(struct rpmsg_device *ept);
43 int (*announce_destroy)(struct rpmsg_device *ept);
44};
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61struct rpmsg_endpoint_ops {
62 void (*destroy_ept)(struct rpmsg_endpoint *ept);
63
64 int (*send)(struct rpmsg_endpoint *ept, void *data, int len);
65 int (*sendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
66 int (*send_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
67 void *data, int len);
68
69 int (*trysend)(struct rpmsg_endpoint *ept, void *data, int len);
70 int (*trysendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
71 int (*trysend_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
72 void *data, int len);
73 __poll_t (*poll)(struct rpmsg_endpoint *ept, struct file *filp,
74 poll_table *wait);
75};
76
77struct device *rpmsg_find_device(struct device *parent,
78 struct rpmsg_channel_info *chinfo);
79
80struct rpmsg_device *rpmsg_create_channel(struct rpmsg_device *rpdev,
81 struct rpmsg_channel_info *chinfo);
82int rpmsg_release_channel(struct rpmsg_device *rpdev,
83 struct rpmsg_channel_info *chinfo);
84
85
86
87
88
89
90
91static inline int rpmsg_chrdev_register_device(struct rpmsg_device *rpdev)
92{
93 strcpy(rpdev->id.name, "rpmsg_chrdev");
94 rpdev->driver_override = "rpmsg_chrdev";
95
96 return rpmsg_register_device(rpdev);
97}
98
99#endif
100