eRPC API Reference  Rev. 1.7.0
NXP Semiconductors
erpc_inter_thread_buffer_transport.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2014, Freescale Semiconductor, Inc.
4  * Copyright 2016 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__INTER_THREAD_BUFFER_TRANSPORT_H_
37 #define _EMBEDDED_RPC__INTER_THREAD_BUFFER_TRANSPORT_H_
38 
39 #include "erpc_message_buffer.h"
40 #include "erpc_threading.h"
41 #include "erpc_transport.h"
42 
49 // Classes
52 
53 namespace erpc {
71 {
72 public:
74  : Transport()
75  , m_state(NULL)
76  , m_peer(NULL)
77  , m_inSem()
78  , m_outSem(1)
79  , m_inBuffer(NULL)
80  {
81  }
82  virtual ~InterThreadBufferTransport(void);
83 
84  void linkWithPeer(InterThreadBufferTransport *peer);
85 
86  virtual erpc_status_t receive(MessageBuffer *message);
87  virtual erpc_status_t send(const MessageBuffer *message);
88 
89  virtual int32_t getAvailable(void) const { return 0; }
90 
91 protected:
92  struct SharedState
93  {
94  Mutex m_mutex;
95  };
96 
97  SharedState *m_state;
99  Semaphore m_inSem;
100  Semaphore m_outSem;
101  MessageBuffer *m_inBuffer;
102 };
103 
104 } // namespace erpc
105 
108 #endif // _EMBEDDED_RPC__INTER_THREAD_BUFFER_TRANSPORT_H_
Abstract interface for transport layer.
Definition: erpc_transport.h:61
Definition: erpc_inter_thread_buffer_transport.h:92
virtual erpc_status_t receive(MessageBuffer *message)
Prototype for receiving message.
Definition: erpc_inter_thread_buffer_transport.cpp:66
int32_t erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:112
Transport(void)
Constructor.
Definition: erpc_transport.h:67
Represents a memory buffer containing a message.
Definition: erpc_message_buffer.h:62
Definition: erpc_arbitrated_client_manager.h:51
Very basic transport to send/receive messages between threads.
Definition: erpc_inter_thread_buffer_transport.h:70
Mutex.
Definition: erpc_threading.h:285
Simple semaphore class.
Definition: erpc_threading.h:385