| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- File List
- File Members

erpc_mu_transport.h
Go to the documentation of this file.
1 /*
2 * Copyright 2017-2020 NXP
3 * All rights reserved.
4 *
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8
9 #ifndef _EMBEDDED_RPC__MU_TRANSPORT_H_
10 #define _EMBEDDED_RPC__MU_TRANSPORT_H_
11
12 #include "erpc_config_internal.h"
13 #if !ERPC_THREADS_IS(NONE)
14 #include "erpc_threading.h"
15 #endif
16 #include "erpc_message_buffer.h"
17 #include "erpc_transport.h"
18
19 #include "fsl_device_registers.h"
20 #include "fsl_mu.h"
21
28 // Definitions
31 #if ERPC_TRANSPORT_MU_USE_MCMGR
32
34 #define MU_REG_COUNT (MU_RR_COUNT - 1U)
35 #define MU_LAST_REG_IDX 2
36
37 #define MU_RX_Interrupt_Handler(x) MU_RX_Interrupt(x)
38 #define MU_RX_Interrupt(number) MU_Rx##number##FullFlagISR
39 #define MU_RxFullFlagISRCallback MU_RX_Interrupt_Handler(MU_LAST_REG_IDX)
40
41 #define MU_TX_Interrupt_Handler(x) MU_TX_Interrupt(x)
42 #define MU_TX_Interrupt(number) MU_Tx##number##EmptyFlagISR
43 #define MU_TxEmptyFlagISRCallback MU_TX_Interrupt_Handler(MU_LAST_REG_IDX)
44
45 #else
46 #define MU_REG_COUNT (MU_RR_COUNT)
47 #endif /* ERPC_TRANSPORT_MU_USE_MCMGR */
48 // Classes
51
52 namespace erpc {
71 class MUTransport : public Transport
72 {
73 public:
79 MUTransport(void);
80
84 virtual ~MUTransport(void);
85
96 virtual erpc_status_t init(MU_Type *muBase);
97
107 virtual erpc_status_t receive(MessageBuffer *message);
108
117 virtual erpc_status_t send(MessageBuffer *message);
118
126 virtual bool hasMessage(void) { return m_newMessage; }
127
128 #if ERPC_TRANSPORT_MU_USE_MCMGR
129
137 static void mu_tx_empty_irq_callback(void);
145 static void mu_rx_full_irq_callback(void);
146 #else
147
154 static void mu_irq_callback(void);
155 #endif /* ERPC_TRANSPORT_MU_USE_MCMGR */
156
157 protected:
167 void rx_cb(void);
168
175 void tx_cb(void);
176
177 volatile bool m_newMessage;
179 uint32_t m_rxMsgSize;
181 uint32_t m_rxCntBytes;
182 uint32_t *volatile m_rxBuffer;
183 uint32_t m_txMsgSize;
185 uint32_t m_txCntBytes;
186 uint32_t *volatile m_txBuffer;
188 #if !ERPC_THREADS_IS(NONE)
189 Semaphore m_rxSemaphore;
190 Semaphore m_txSemaphore;
192 Mutex m_sendLock;
193 Mutex m_receiveLock;
194 #endif
195
196 MU_Type *m_muBase;
197 };
198
199 } // namespace erpc
200
203 #endif // _EMBEDDED_RPC__MU_TRANSPORT_H_
erpc::Transport
Abstract interface for transport layer.
Definition: erpc_transport.h:36
erpc::MUTransport::m_txMsgSize
uint32_t m_txMsgSize
Definition: erpc_mu_transport.h:183
erpc::MUTransport::receive
virtual erpc_status_t receive(MessageBuffer *message)
Start receiving data and stores it to passed message buffer.
Definition: erpc_mu_transport.cpp:193
erpc::MUTransport::~MUTransport
virtual ~MUTransport(void)
Destructor of MU transport.
Definition: erpc_mu_transport.cpp:96
erpc::MUTransport::MUTransport
MUTransport(void)
Constructor of MU transport.
Definition: erpc_mu_transport.cpp:76
erpc_status_t
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:87
erpc::MUTransport::m_txSemaphore
Semaphore m_txSemaphore
Definition: erpc_mu_transport.h:190
erpc::MUTransport::hasMessage
virtual bool hasMessage(void)
Function to check if is new message to receive.
Definition: erpc_mu_transport.h:126
erpc::MUTransport::m_muBase
MU_Type * m_muBase
Definition: erpc_mu_transport.h:196
erpc::MUTransport::m_rxMsgSize
uint32_t m_rxMsgSize
Definition: erpc_mu_transport.h:179
erpc::MUTransport::m_rxSemaphore
Semaphore m_rxSemaphore
Definition: erpc_mu_transport.h:189
erpc::MUTransport::m_sendLock
Mutex m_sendLock
Definition: erpc_mu_transport.h:192
erpc_transport.h
erpc::MUTransport::init
virtual erpc_status_t init(MU_Type *muBase)
Initialization of MU transport layer.
Definition: erpc_mu_transport.cpp:98
erpc::MessageBuffer
Represents a memory buffer containing a message.
Definition: erpc_message_buffer.h:37
erpc::MUTransport::m_rxCntBytes
uint32_t m_rxCntBytes
Definition: erpc_mu_transport.h:181
erpc
Definition: erpc_arbitrated_client_manager.h:25
erpc::MUTransport::m_txBuffer
uint32_t *volatile m_txBuffer
Definition: erpc_mu_transport.h:186
erpc::MUTransport::send
virtual erpc_status_t send(MessageBuffer *message)
Function to send prepared message.
Definition: erpc_mu_transport.cpp:231
erpc_threading.h
erpc::MUTransport
Transport that uses Messaging Unit (MU) for interprocessor messaging.
Definition: erpc_mu_transport.h:71
erpc_message_buffer.h
erpc::MUTransport::m_rxBuffer
uint32_t *volatile m_rxBuffer
Definition: erpc_mu_transport.h:182
erpc::MUTransport::tx_cb
void tx_cb(void)
Function called from MU IRQ when the MU TX empty flag is asserted and the IRQ is enabled.
Definition: erpc_mu_transport.cpp:161
erpc::MUTransport::m_receiveLock
Mutex m_receiveLock
Definition: erpc_mu_transport.h:193
erpc::MUTransport::m_newMessage
volatile bool m_newMessage
Definition: erpc_mu_transport.h:177
erpc::MUTransport::m_txCntBytes
uint32_t m_txCntBytes
Definition: erpc_mu_transport.h:185
erpc::MUTransport::mu_irq_callback
static void mu_irq_callback(void)
Callback function called from MU IRQ.
Definition: erpc_mu_transport.cpp:45
erpc::Mutex
Mutex.
Definition: erpc_threading.h:307
erpc::Semaphore
Simple semaphore class.
Definition: erpc_threading.h:411
erpc::MUTransport::rx_cb
void rx_cb(void)
Function called from MU IRQ when the MU RX full flag is asserted and the IRQ is enabled.
Definition: erpc_mu_transport.cpp:116