| RPMsg-Lite User's Guide Rev. 3.1.2 NXP Semiconductors

- Main Page
- API Reference

rpmsg_ns.h
1 /*
2 * Copyright (c) 2014, Mentor Graphics Corporation
3 * Copyright (c) 2015 Xilinx, Inc.
4 * Copyright (c) 2016 Freescale Semiconductor, Inc.
5 * Copyright 2016 NXP
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright notice,
12 * this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 * 3. Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from this
18 * software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33 #ifndef RPMSG_NS_H_
34 #define RPMSG_NS_H_
35
36 #include "rpmsg_lite.h"
37
40
41 #define RL_NS_EPT_ADDR (0x35u)
42
43 /* Up to 32 flags available */
44 enum rpmsg_ns_flags
45 {
46 RL_NS_CREATE = 0,
47 RL_NS_DESTROY = 1,
48 };
49
53 typedef void (*rpmsg_ns_new_ept_cb)(uint32_t new_ept, const char *new_ept_name, uint32_t flags, void *user_data);
54
55 struct rpmsg_ns_callback_data
56 {
57 rpmsg_ns_new_ept_cb cb;
58 void *user_data;
59 };
60
61 struct rpmsg_ns_context
62 {
63 struct rpmsg_lite_endpoint *ept;
64 struct rpmsg_ns_callback_data *cb_ctxt;
65 };
66
67 typedef struct rpmsg_ns_context *rpmsg_ns_handle;
68
69 struct rpmsg_ns_static_context_container
70 {
71 struct rpmsg_lite_ept_static_context ept_ctxt;
72 struct rpmsg_ns_callback_data cb_ctxt;
73 struct rpmsg_ns_context ns_ctxt;
74 };
75
76 typedef struct rpmsg_ns_static_context_container rpmsg_ns_static_context;
77
78 #if defined(__cplusplus)
79 extern "C" {
80 #endif
81
82 /*******************************************************************************
83 * API
84 ******************************************************************************/
85
86 /* Exported API functions */
87
98 #if defined(RL_USE_STATIC_API) && (RL_USE_STATIC_API == 1)
99 rpmsg_ns_handle rpmsg_ns_bind(struct rpmsg_lite_instance *rpmsg_lite_dev,
100 rpmsg_ns_new_ept_cb app_cb,
101 void *user_data,
102 rpmsg_ns_static_context *ns_ept_ctxt);
103 #else
104 rpmsg_ns_handle rpmsg_ns_bind(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_ns_new_ept_cb app_cb, void *user_data);
105 #endif /* RL_USE_STATIC_API */
106
116 int32_t rpmsg_ns_unbind(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_ns_handle handle);
117
129 int32_t rpmsg_ns_announce(struct rpmsg_lite_instance *rpmsg_lite_dev,
130 struct rpmsg_lite_endpoint *new_ept,
131 const char *ept_name,
132 uint32_t flags);
133
135
136 #if defined(__cplusplus)
137 }
138 #endif
139
140 #endif /* RPMSG_NS_H_ */
rpmsg_lite_instance
Definition: rpmsg_lite.h:122
rpmsg_ns_static_context_container
Definition: rpmsg_ns.h:69
rpmsg_lite_ept_static_context
Definition: rpmsg_lite.h:110
rpmsg_ns_new_ept_cb
void(* rpmsg_ns_new_ept_cb)(uint32_t new_ept, const char *new_ept_name, uint32_t flags, void *user_data)
New endpoint NS callback function type.
Definition: rpmsg_ns.h:53
rpmsg_ns_context
Definition: rpmsg_ns.h:61
rpmsg_ns_announce
int32_t rpmsg_ns_announce(struct rpmsg_lite_instance *rpmsg_lite_dev, struct rpmsg_lite_endpoint *new_ept, const char *ept_name, uint32_t flags)
Sends name service announcement to remote device.
rpmsg_ns_bind
rpmsg_ns_handle rpmsg_ns_bind(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_ns_new_ept_cb app_cb, void *user_data)
Registers application nameservice callback.
rpmsg_ns_callback_data
Definition: rpmsg_ns.h:55
rpmsg_lite_endpoint
Definition: rpmsg_lite.h:98
rpmsg_ns_unbind
int32_t rpmsg_ns_unbind(struct rpmsg_lite_instance *rpmsg_lite_dev, rpmsg_ns_handle handle)
Unregisters application nameservice callback and cleans up.