eRPC API Reference
Rev. 1.12.0
NXP Semiconductors
|
Base class for framed transport layers. More...
#include <erpc_framed_transport.hpp>
Classes | |
struct | Header |
Contents of the header that prefixes each message. More... | |
Public Member Functions | |
FramedTransport (void) | |
Constructor. | |
virtual | ~FramedTransport (void) |
FramedTransport destructor. | |
virtual uint8_t | reserveHeaderSize (void) override |
Size of data placed in MessageBuffer before serializing eRPC data. More... | |
virtual erpc_status_t | receive (MessageBuffer *message) override |
Receives an entire message. More... | |
virtual erpc_status_t | send (MessageBuffer *message) override |
Function to send prepared message. More... | |
virtual void | setCrc16 (Crc16 *crcImpl) override |
This functions sets the CRC-16 implementation. More... | |
virtual Crc16 * | getCrc16 (void) override |
This functions gets the CRC-16 object. More... | |
Public Member Functions inherited from erpc::Transport | |
Transport (void) | |
Constructor. | |
virtual | ~Transport (void) |
Transport destructor. | |
virtual bool | hasMessage (void) |
Poll for an incoming message. More... | |
Protected Member Functions | |
virtual erpc_status_t | underlyingSend (MessageBuffer *message, uint32_t size, uint32_t offset) |
Adds ability to framed transport to overwrite MessageBuffer when sending data. More... | |
virtual erpc_status_t | underlyingReceive (MessageBuffer *message, uint32_t size, uint32_t offset) |
Adds ability to framed transport to overwrite MessageBuffer when receiving data. More... | |
virtual erpc_status_t | underlyingSend (const uint8_t *data, uint32_t size)=0 |
Subclasses must implement this function to send data. More... | |
virtual erpc_status_t | underlyingReceive (uint8_t *data, uint32_t size)=0 |
Subclasses must implement this function to receive data. More... | |
Protected Attributes | |
Crc16 * | m_crcImpl |
Mutex | m_sendLock |
Mutex protecting send. | |
Mutex | m_receiveLock |
Mutex protecting receive. | |
Base class for framed transport layers.
This class adds simple framing to the data transmitted and received on the communications channel. This allows the transport to perform reads and writes of a size known in advance. Subclasses must implement the underlyingSend() and underlyingReceive() methods to actually transmit and receive data.
Frames have a maximum size of 64kB, as a 16-bit frame size is used.
The frame header includes a CRC-16 over the data for integrity checking. This class includes a default CRC-16 implementation that is optimized for code size, but is relatively slow. If a faster implementation is desired, you can pass the new CRC function to setCRCFunction().
struct erpc::FramedTransport::Header |
|
overridevirtual |
Size of data placed in MessageBuffer before serializing eRPC data.
Reimplemented from erpc::Transport.
|
overridevirtual |
Receives an entire message.
The frame header and message data are received. The CRC-16 in the frame header is compared with the computed CRC. If the received CRC is invalid, kErpcStatus_Fail will be returned.
The message is only filled with the message data, not the frame header.
This function is blocking.
[in] | message | Message buffer, to which will be stored incoming message. |
kErpcStatus_Success | When receiving was successful. |
kErpcStatus_CrcCheckFailed | When receiving failed. |
other | Subclass may return other errors from the underlyingReceive() method. |
Implements erpc::Transport.
|
overridevirtual |
Function to send prepared message.
[in] | message | Pass message buffer to send. |
kErpcStatus_Success | When sending was successful. |
other | Subclass may return other errors from the underlyingSend() method. |
Implements erpc::Transport.
|
overridevirtual |
This functions sets the CRC-16 implementation.
[in] | crcImpl | Object containing crc-16 compute function. |
Reimplemented from erpc::Transport.
|
overridevirtual |
This functions gets the CRC-16 object.
Reimplemented from erpc::Transport.
|
protectedvirtual |
Adds ability to framed transport to overwrite MessageBuffer when sending data.
Usually we don't want to do that.
message | MessageBuffer to send. |
size | size of message to send. |
offset | data start address offset |
Reimplemented in erpc::RPMsgTTYRTOSTransport.
|
protectedvirtual |
Adds ability to framed transport to overwrite MessageBuffer when receiving data.
Usually we don't want to do that.
message | MessageBuffer to send. |
size | size of message to send. |
offset | data start address offset |
Reimplemented in erpc::RPMsgTTYRTOSTransport.
|
protectedpure virtual |
Subclasses must implement this function to send data.
[in] | data | Buffer to send. |
[in] | size | Size of data to send. |
kErpcStatus_Success | When data was written successfully. |
kErpcStatus_Fail | When writing data ends with error. |
Implemented in erpc::RPMsgTTYRTOSTransport, and erpc::TCPTransport.
|
protectedpure virtual |
Subclasses must implement this function to receive data.
[in,out] | data | Preallocated buffer for receiving data. |
[in] | size | Size of data to read. |
kErpcStatus_Success | When data was read successfully. |
kErpcStatus_Fail | When reading data ends with error. |
Implemented in erpc::RPMsgTTYRTOSTransport, and erpc::TCPTransport.
|
protected |
CRC object.