eRPC API Reference  Rev. 1.7.0
NXP Semiconductors
erpc_rpmsg_lite_transport.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
4  * Copyright 2016-2017 NXP
5  * All rights reserved.
6  *
7  *
8  * Redistribution and use in source and binary forms, with or without modification,
9  * are permitted (subject to the limitations in the disclaimer below) provided
10  * that the following conditions are met:
11  *
12  * o Redistributions of source code must retain the above copyright notice, this list
13  * of conditions and the following disclaimer.
14  *
15  * o Redistributions in binary form must reproduce the above copyright notice, this
16  * list of conditions and the following disclaimer in the documentation and/or
17  * other materials provided with the distribution.
18  *
19  * o Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
28  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef _EMBEDDED_RPC__RPMSG_LITE_TRANSPORT_H_
37 #define _EMBEDDED_RPC__RPMSG_LITE_TRANSPORT_H_
38 
39 #include "erpc_config_internal.h"
40 #include "erpc_message_buffer.h"
42 #include "erpc_static_queue.h"
43 #include "rpmsg_lite.h"
44 
51 // Definitions
54 
56 // Classes
58 
59 namespace erpc {
66 {
67 public:
73  RPMsgTransport(void);
74 
78  virtual ~RPMsgTransport(void);
79 
94  virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, unsigned long length,
95  int rpmsg_link_id);
96 
113  virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, int rpmsg_link_id,
114  void (*ready_cb)(void), char *nameservice_name);
115 
125  virtual erpc_status_t receive(MessageBuffer *message);
126 
135  virtual erpc_status_t send(MessageBuffer *message);
136 
144  virtual bool hasMessage(void) { return m_messageQueue.size(); }
145 
146 protected:
160  static int rpmsg_read_cb(void *payload, int payload_len, unsigned long src, void *priv);
161 
165  unsigned long m_dst_addr;
166  struct rpmsg_lite_ept_static_context m_rpmsg_ept_context;
167  struct rpmsg_lite_endpoint *m_rpmsg_ept;
169  static struct rpmsg_lite_instance s_rpmsg_ctxt;
170 };
171 
172 } // namespace erpc
173 
176 #endif // _EMBEDDED_RPC__RPMSG_LITE_TRANSPORT_H_
int32_t erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:112
virtual erpc_status_t init(unsigned long src_addr, unsigned long dst_addr, void *base_address, unsigned long length, int rpmsg_link_id)
Initialization of RPMsgTransport layer - as RPMsg master.
Definition: erpc_rpmsg_lite_transport.cpp:74
virtual ~RPMsgTransport(void)
Codec destructor.
Definition: erpc_rpmsg_lite_transport.cpp:72
static int rpmsg_read_cb(void *payload, int payload_len, unsigned long src, void *priv)
RPMSG callback for receiving data.
Definition: erpc_rpmsg_lite_transport.cpp:52
struct rpmsg_lite_endpoint * m_rpmsg_ept
Definition: erpc_rpmsg_lite_transport.h:167
RPMsgTransport(void)
Constructor.
Definition: erpc_rpmsg_lite_transport.cpp:64
unsigned long m_dst_addr
Definition: erpc_rpmsg_lite_transport.h:165
virtual bool hasMessage(void)
Function to check if is message in receive queue and wait for processing.
Definition: erpc_rpmsg_lite_transport.h:144
struct rpmsg_lite_ept_static_context m_rpmsg_ept_context
Definition: erpc_rpmsg_lite_transport.h:166
StaticQueue< MessageBuffer, ERPC_DEFAULT_BUFFERS_COUNT > m_messageQueue
Definition: erpc_rpmsg_lite_transport.h:163
virtual erpc_status_t receive(MessageBuffer *message)
Set message to first received message.
Definition: erpc_rpmsg_lite_transport.cpp:125
Represents a memory buffer containing a message.
Definition: erpc_message_buffer.h:62
Definition: erpc_arbitrated_client_manager.h:51
Transport that uses RPMsg zero copy API for interprocessor messaging.
Definition: erpc_rpmsg_lite_transport.h:65
static struct rpmsg_lite_instance s_rpmsg_ctxt
Definition: erpc_rpmsg_lite_transport.h:169
Transport that other RPMsg transports inherits.
Definition: erpc_rpmsg_lite_base_transport.h:64
virtual erpc_status_t send(MessageBuffer *message)
Function to send prepared message.
Definition: erpc_rpmsg_lite_transport.cpp:134
Template class which implements static queue as ring buffer.
Definition: erpc_static_queue.h:58