OpenAMP Library  353
rpmsg_retarget.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, Mentor Graphics Corporation
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef RPMSG_RETARGET_H
9 #define RPMSG_RETARGET_H
10 
11 #include <metal/mutex.h>
12 #include <openamp/open_amp.h>
13 #include <stdint.h>
14 
15 #if defined __cplusplus
16 extern "C" {
17 #endif
18 
19 /* File Operations System call definitions */
20 #define OPEN_SYSCALL_ID 0x1UL
21 #define CLOSE_SYSCALL_ID 0x2UL
22 #define WRITE_SYSCALL_ID 0x3UL
23 #define READ_SYSCALL_ID 0x4UL
24 #define ACK_STATUS_ID 0x5UL
25 
26 #define TERM_SYSCALL_ID 0x6UL
27 
28 #define DEFAULT_PROXY_ENDPOINT 0xFFUL
29 
30 struct rpmsg_rpc_data;
31 
32 typedef int (*rpmsg_rpc_poll)(void *arg);
33 typedef void (*rpmsg_rpc_shutdown_cb)(struct rpmsg_rpc_data *rpc);
34 
36  int32_t int_field1;
37  int32_t int_field2;
38  uint32_t data_len;
39 };
40 
42  uint32_t id;
44 };
45 
47  struct rpmsg_endpoint ept;
49  atomic_flag nacked;
50  void *respbuf;
51  size_t respbuf_len;
53  void *poll_arg;
55  metal_mutex_t lock;
56  struct metal_spinlock buflock;
57 };
58 
79 int rpmsg_rpc_init(struct rpmsg_rpc_data *rpc,
80  struct rpmsg_device *rdev,
81  const char *ept_name, uint32_t ept_addr,
82  uint32_t ept_raddr,
83  void *poll_arg, rpmsg_rpc_poll poll,
84  rpmsg_rpc_shutdown_cb shutdown_cb);
85 
96 void rpmsg_rpc_release(struct rpmsg_rpc_data *rpc);
97 
114 int rpmsg_rpc_send(struct rpmsg_rpc_data *rpc,
115  void *req, size_t len,
116  void *resp, size_t resp_len);
117 
128 void rpmsg_set_default_rpc(struct rpmsg_rpc_data *rpc);
129 
130 #if defined __cplusplus
131 }
132 #endif
133 
134 #endif /* RPMSG_RETARGET_H */
void(* rpmsg_rpc_shutdown_cb)(struct rpmsg_rpc_data *rpc)
Definition: rpmsg_retarget.h:33
void rpmsg_set_default_rpc(struct rpmsg_rpc_data *rpc)
Definition: rpmsg_retarget.c:144
int(* rpmsg_rpc_poll)(void *arg)
Definition: rpmsg_retarget.h:32
int rpmsg_rpc_init(struct rpmsg_rpc_data *rpc, struct rpmsg_device *rdev, const char *ept_name, uint32_t ept_addr, uint32_t ept_raddr, void *poll_arg, rpmsg_rpc_poll poll, rpmsg_rpc_shutdown_cb shutdown_cb)
Definition: rpmsg_retarget.c:69
void rpmsg_rpc_release(struct rpmsg_rpc_data *rpc)
Definition: rpmsg_retarget.c:104
int rpmsg_rpc_send(struct rpmsg_rpc_data *rpc, void *req, size_t len, void *resp, size_t resp_len)
Definition: rpmsg_retarget.c:119
Representation of a RPMsg device.
Definition: rpmsg.h:133
Structure that binds a local RPMsg address to its user.
Definition: rpmsg.h:65
Definition: rpmsg_retarget.h:46
struct metal_spinlock buflock
Definition: rpmsg_retarget.h:56
rpmsg_rpc_shutdown_cb shutdown_cb
Definition: rpmsg_retarget.h:54
size_t respbuf_len
Definition: rpmsg_retarget.h:51
struct rpmsg_endpoint ept
Definition: rpmsg_retarget.h:47
atomic_flag nacked
Definition: rpmsg_retarget.h:49
metal_mutex_t lock
Definition: rpmsg_retarget.h:55
int ept_destroyed
Definition: rpmsg_retarget.h:48
void * poll_arg
Definition: rpmsg_retarget.h:53
rpmsg_rpc_poll poll
Definition: rpmsg_retarget.h:52
void * respbuf
Definition: rpmsg_retarget.h:50
Definition: rpmsg_retarget.h:35
int32_t int_field1
Definition: rpmsg_retarget.h:36
int32_t int_field2
Definition: rpmsg_retarget.h:37
uint32_t data_len
Definition: rpmsg_retarget.h:38
Definition: rpmsg_retarget.h:41
struct rpmsg_rpc_syscall_header args
Definition: rpmsg_retarget.h:43
uint32_t id
Definition: rpmsg_retarget.h:42