0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef __RPMSG_INTERNAL_H__
0013 #define __RPMSG_INTERNAL_H__
0014
0015 #include <linux/rpmsg.h>
0016 #include <linux/poll.h>
0017
0018 #define to_rpmsg_device(d) container_of(d, struct rpmsg_device, dev)
0019 #define to_rpmsg_driver(d) container_of(d, struct rpmsg_driver, drv)
0020
0021 extern struct class *rpmsg_class;
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 struct rpmsg_device_ops {
0036 struct rpmsg_device *(*create_channel)(struct rpmsg_device *rpdev,
0037 struct rpmsg_channel_info *chinfo);
0038 int (*release_channel)(struct rpmsg_device *rpdev,
0039 struct rpmsg_channel_info *chinfo);
0040 struct rpmsg_endpoint *(*create_ept)(struct rpmsg_device *rpdev,
0041 rpmsg_rx_cb_t cb, void *priv,
0042 struct rpmsg_channel_info chinfo);
0043
0044 int (*announce_create)(struct rpmsg_device *rpdev);
0045 int (*announce_destroy)(struct rpmsg_device *rpdev);
0046 };
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064 struct rpmsg_endpoint_ops {
0065 void (*destroy_ept)(struct rpmsg_endpoint *ept);
0066
0067 int (*send)(struct rpmsg_endpoint *ept, void *data, int len);
0068 int (*sendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
0069 int (*send_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
0070 void *data, int len);
0071
0072 int (*trysend)(struct rpmsg_endpoint *ept, void *data, int len);
0073 int (*trysendto)(struct rpmsg_endpoint *ept, void *data, int len, u32 dst);
0074 int (*trysend_offchannel)(struct rpmsg_endpoint *ept, u32 src, u32 dst,
0075 void *data, int len);
0076 __poll_t (*poll)(struct rpmsg_endpoint *ept, struct file *filp,
0077 poll_table *wait);
0078 ssize_t (*get_mtu)(struct rpmsg_endpoint *ept);
0079 };
0080
0081 struct device *rpmsg_find_device(struct device *parent,
0082 struct rpmsg_channel_info *chinfo);
0083
0084 struct rpmsg_device *rpmsg_create_channel(struct rpmsg_device *rpdev,
0085 struct rpmsg_channel_info *chinfo);
0086 int rpmsg_release_channel(struct rpmsg_device *rpdev,
0087 struct rpmsg_channel_info *chinfo);
0088
0089
0090
0091
0092
0093
0094
0095 static inline int rpmsg_ctrldev_register_device(struct rpmsg_device *rpdev)
0096 {
0097 return rpmsg_register_device_override(rpdev, "rpmsg_ctrl");
0098 }
0099
0100 #endif