9 #ifndef _EMBEDDED_RPC__MU_TRANSPORT_H_ 10 #define _EMBEDDED_RPC__MU_TRANSPORT_H_ 12 #include "erpc_config_internal.h" 13 #if !ERPC_THREADS_IS(NONE) 20 #include "fsl_device_registers.h" 33 #if ERPC_TRANSPORT_MU_USE_MCMGR 36 #define MU_REG_COUNT (MU_RR_COUNT - 1U) 37 #define MU_LAST_REG_IDX 2 39 #define MU_RX_Interrupt_Handler(x) MU_RX_Interrupt(x) 40 #define MU_RX_Interrupt(number) MU_Rx##number##FullFlagISR 41 #define MU_RxFullFlagISRCallback MU_RX_Interrupt_Handler(MU_LAST_REG_IDX) 43 #define MU_TX_Interrupt_Handler(x) MU_TX_Interrupt(x) 44 #define MU_TX_Interrupt(number) MU_Tx##number##EmptyFlagISR 45 #define MU_TxEmptyFlagISRCallback MU_TX_Interrupt_Handler(MU_LAST_REG_IDX) 48 #define MU_REG_COUNT (MU_RR_COUNT) 51 #if (defined(MIMXRT1187_cm7_SERIES) || defined(MIMXRT1187_cm33_SERIES) || defined(MIMXRT1189_cm7_SERIES) || \ 52 defined(MIMXRT1189_cm33_SERIES)) 53 #define MU_TX_SHIFT (1UL << (MU_REG_COUNT - 1U)) 54 #define MU_RX_SHIFT (1UL << (MU_REG_COUNT - 1U)) 55 #define MU_RX_INTR_MASK (MU_RX_INTR(MU_RX_SHIFT)) 56 #define MU_TX_INTR_MASK (MU_TX_INTR(MU_TX_SHIFT)) 57 #define MU_IS_TX_EMPTY_FLAG_SET (0U != (transport->m_muBase->TCR & MU_TX_SHIFT)) 58 #define MU_IS_RX_FULL_FLAG_SET (0U != (transport->m_muBase->RCR & MU_RX_SHIFT)) 59 #define MU_SR_TX_MASK (1UL << (20U + (MU_REG_COUNT - 1U))) 60 #define MU_SR_RX_MASK (1UL << (24U + (MU_REG_COUNT - 1U))) 62 #define MU_TX_SHIFT (1UL << (MU_CR_TIEn_SHIFT + MU_TR_COUNT - MU_REG_COUNT)) 63 #define MU_RX_SHIFT (1UL << (MU_CR_RIEn_SHIFT + MU_RR_COUNT - MU_REG_COUNT)) 64 #define MU_RX_INTR_MASK (MU_RX_SHIFT) 65 #define MU_TX_INTR_MASK (MU_TX_SHIFT) 66 #define MU_IS_TX_EMPTY_FLAG_SET (0U != (transport->m_muBase->CR & MU_TX_SHIFT)) 67 #define MU_IS_RX_FULL_FLAG_SET (0U != (transport->m_muBase->CR & MU_RX_SHIFT)) 68 #define MU_SR_TX_MASK (1UL << (MU_SR_TEn_SHIFT + MU_TR_COUNT - MU_REG_COUNT)) 69 #define MU_SR_RX_MASK (1UL << (MU_SR_RFn_SHIFT + MU_RR_COUNT - MU_REG_COUNT)) 151 #if ERPC_TRANSPORT_MU_USE_MCMGR 160 static void mu_tx_empty_irq_callback(
void);
168 static void mu_rx_full_irq_callback(
void);
211 #if !ERPC_THREADS_IS(NONE) 226 #endif // _EMBEDDED_RPC__MU_TRANSPORT_H_ Abstract interface for transport layer.
Definition: erpc_transport.hpp:36
volatile uint32_t m_rxMsgSize
Definition: erpc_mu_transport.hpp:202
virtual ~MUTransport(void)
Destructor of MU transport.
Definition: erpc_mu_transport.cpp:92
MUTransport(void)
Constructor of MU transport.
Definition: erpc_mu_transport.cpp:79
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:85
Semaphore m_txSemaphore
Definition: erpc_mu_transport.hpp:213
MU_Type * m_muBase
Definition: erpc_mu_transport.hpp:219
Semaphore m_rxSemaphore
Definition: erpc_mu_transport.hpp:212
Mutex m_sendLock
Definition: erpc_mu_transport.hpp:215
virtual erpc_status_t init(MU_Type *muBase)
Initialization of MU transport layer.
Definition: erpc_mu_transport.cpp:94
Represents a memory buffer containing a message.
Definition: erpc_message_buffer.hpp:37
uint32_t m_rxCntBytes
Definition: erpc_mu_transport.hpp:204
Definition: erpc_arbitrated_client_manager.hpp:25
uint32_t *volatile m_txBuffer
Definition: erpc_mu_transport.hpp:209
virtual erpc_status_t send(MessageBuffer *message) override
Function to send prepared message.
Definition: erpc_mu_transport.cpp:228
Transport that uses Messaging Unit (MU) for interprocessor messaging.
Definition: erpc_mu_transport.hpp:94
uint32_t *volatile m_rxBuffer
Definition: erpc_mu_transport.hpp:205
virtual erpc_status_t receive(MessageBuffer *message) override
Start receiving data and stores it to passed message buffer.
Definition: erpc_mu_transport.cpp:190
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:158
volatile uint32_t m_txMsgSize
Definition: erpc_mu_transport.hpp:206
Mutex m_receiveLock
Definition: erpc_mu_transport.hpp:216
volatile bool m_newMessage
Definition: erpc_mu_transport.hpp:200
uint32_t m_txCntBytes
Definition: erpc_mu_transport.hpp:208
static void mu_irq_callback(void)
Callback function called from MU IRQ.
Definition: erpc_mu_transport.cpp:58
Mutex.
Definition: erpc_threading.h:339
virtual bool hasMessage(void) override
Function to check if is new message to receive.
Definition: erpc_mu_transport.cpp:283
Simple semaphore class.
Definition: erpc_threading.h:442
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:112