eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc::MUTransport Class Reference

Transport that uses Messaging Unit (MU) for interprocessor messaging. More...

#include <erpc_mu_transport.hpp>

+ Inheritance diagram for erpc::MUTransport:
+ Collaboration diagram for erpc::MUTransport:

Public Member Functions

 MUTransport (void)
 Constructor of MU transport. More...
 
virtual ~MUTransport (void)
 Destructor of MU transport.
 
virtual erpc_status_t init (MU_Type *muBase)
 Initialization of MU transport layer. More...
 
virtual erpc_status_t receive (MessageBuffer *message) override
 Start receiving data and stores it to passed message buffer. More...
 
virtual erpc_status_t send (MessageBuffer *message) override
 Function to send prepared message. More...
 
virtual bool hasMessage (void) override
 Function to check if is new message to receive. More...
 
- Public Member Functions inherited from erpc::Transport
 Transport (void)
 Constructor.
 
virtual ~Transport (void)
 Transport destructor.
 
virtual uint8_t reserveHeaderSize (void)
 Size of data placed in MessageBuffer before serializing eRPC data. More...
 
virtual void setCrc16 (Crc16 *crcImpl)
 This functions sets the CRC-16 implementation. More...
 
virtual Crc16getCrc16 (void)
 This functions gets the CRC-16 object. More...
 

Static Public Member Functions

static void mu_irq_callback (void)
 Callback function called from MU IRQ. More...
 

Protected Member Functions

void rx_cb (void)
 Function called from MU IRQ when the MU RX full flag is asserted and the IRQ is enabled. More...
 
void tx_cb (void)
 Function called from MU IRQ when the MU TX empty flag is asserted and the IRQ is enabled. More...
 

Protected Attributes

volatile bool m_newMessage
 
volatile uint32_t m_rxMsgSize
 
uint32_t m_rxCntBytes
 
uint32_t *volatile m_rxBuffer
 
volatile uint32_t m_txMsgSize
 
uint32_t m_txCntBytes
 
uint32_t *volatile m_txBuffer
 
Semaphore m_rxSemaphore
 
Semaphore m_txSemaphore
 
Mutex m_sendLock
 
Mutex m_receiveLock
 
MU_Type * m_muBase
 

Detailed Description

Transport that uses Messaging Unit (MU) for interprocessor messaging.

This transport layer use the Messaging Unit (MU), which enables two processors within the SoC to communicate and coordinate by passing messages (e.g. data, status and control) through the MU interface. The MU has four transmit and four receive registers used for communication between cores, the transport layer use count of registers defined by macro MU_REG_COUNT (default setting is use all MU registers). The communication uses the interrupt from the MU, to be possible use this transport layer on different platform must be specified this macros: MU_IRQ_HANDLER - name of the MU irq handler MU_IRQ - name of MU irq to be possible enable it by passing it as argument to function EnableIRQ() MU_IRQ_PRIORITY - number of priority passed as argument to function NVIC_SetPriority()

Constructor & Destructor Documentation

MUTransport::MUTransport ( void  )

Constructor of MU transport.

This function initializes object attributes.

Member Function Documentation

erpc_status_t MUTransport::init ( MU_Type *  muBase)
virtual

Initialization of MU transport layer.

Initialize MU peripheral and enable MU interrupt in NVIC.

Parameters
[in]Baseaddress of MU peripheral
Return values
kErpcStatus_SuccessWhen init function was executed successfully.
kErpcStatus_InitFailedWhen init function wasn't executed successfully.
erpc_status_t MUTransport::receive ( MessageBuffer message)
overridevirtual

Start receiving data and stores it to passed message buffer.

Initialize receiving of message, it is blocking until doesn't receive complete message.

Parameters
[in]messageMessage buffer, which will be filled by incoming message.
Returns
kErpcStatus_Success

Implements erpc::Transport.

erpc_status_t MUTransport::send ( MessageBuffer message)
overridevirtual

Function to send prepared message.

Parameters
[in]messagePass message buffer to send.
Return values
kErpcStatus_SendFailedFailed to send message buffer.
kErpcStatus_SuccessSuccessfully sent all data.

Implements erpc::Transport.

bool MUTransport::hasMessage ( void  )
overridevirtual

Function to check if is new message to receive.

This function should be called before blocking function receive() to avoid waiting for new message.

Returns
True if exist new message, else false.

Reimplemented from erpc::Transport.

void MUTransport::mu_irq_callback ( void  )
static

Callback function called from MU IRQ.

This function reads status flags of MU and base on the evnet which cause the irq calls function rx_cb() to handle rx full irq or tx_cb() to handle tx empty irq for the particular instance of the MUTransport

void MUTransport::rx_cb ( void  )
protected

Function called from MU IRQ when the MU RX full flag is asserted and the IRQ is enabled.

When is this function invoked prior receive function (bare metal case) the m_newMessage flag is set and the MU rx full interrupt is disabled. When is this function invoked after receive function the data from MU registers is copied to this receiving buffer passed in receive function. When is received whole message unblock the receive function.

void MUTransport::tx_cb ( void  )
protected

Function called from MU IRQ when the MU TX empty flag is asserted and the IRQ is enabled.

Write data from the buffer passed in send function to MU registers. When is sent whole message unblock the send function.

Member Data Documentation

volatile bool erpc::MUTransport::m_newMessage
protected

Flag used in function hasMessage() to inform server by polling function that message is ready for receiving

volatile uint32_t erpc::MUTransport::m_rxMsgSize
protected

Size of received message - count of bytes to must be received to complete currently received message

uint32_t erpc::MUTransport::m_rxCntBytes
protected

Count of currently received bytes of message

uint32_t* volatile erpc::MUTransport::m_rxBuffer
protected

Pointer to buffer to which is copied data from MU registers during receiving

volatile uint32_t erpc::MUTransport::m_txMsgSize
protected

Size of transmitted message - count of bytes to must be transmitted to send complete message

uint32_t erpc::MUTransport::m_txCntBytes
protected

Count of currently received bytes of message

uint32_t* volatile erpc::MUTransport::m_txBuffer
protected

Pointer to buffer from which is copied data to MU registers during sending

Semaphore erpc::MUTransport::m_rxSemaphore
protected

Semaphore used by RTOS to block task until the receiving is not complete

Semaphore erpc::MUTransport::m_txSemaphore
protected

Semaphore used by RTOS to block task until the sending is not complete

Mutex erpc::MUTransport::m_sendLock
protected

Mutex protecting send.

Mutex erpc::MUTransport::m_receiveLock
protected

Mutex protecting receive.

MU_Type* erpc::MUTransport::m_muBase
protected

Base address of MU peripheral


The documentation for this class was generated from the following files: