eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc_usb_cdc_transport.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 NXP
3  * All rights reserved.
4  *
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _EMBEDDED_RPC__USB_CDC_TRANSPORT_H_
10 #define _EMBEDDED_RPC__USB_CDC_TRANSPORT_H_
11 
12 #include "erpc_config_internal.h"
13 #include <cstdio>
14 #if !ERPC_THREADS_IS(NONE)
15 #include "erpc_threading.h"
16 #endif
17 
19 
20 extern "C" {
21 #include "fsl_component_serial_manager.h"
22 }
23 
30 // Classes
33 
34 namespace erpc {
41 {
42 public:
56  UsbCdcTransport(serial_handle_t serialHandle, serial_manager_config_t *serialConfig,
57  serial_port_usb_cdc_config_t *usbCdcConfig, uint8_t *usbRingBuffer, uint32_t usbRingBufferLength);
58 
62  virtual ~UsbCdcTransport(void);
63 
71  virtual erpc_status_t init(void);
72 
78  void rx_cb(void);
79 
85  void tx_cb(void);
86 
87 protected:
88 #if !ERPC_THREADS_IS(NONE)
91 #endif
92 private:
93  serial_handle_t m_serialHandle;
94  serial_manager_config_t *m_serialConfig;
95  serial_port_usb_cdc_config_t *m_usbCdcConfig;
96  uint8_t *m_usbRingBuffer;
97  uint32_t m_usbRingBufferLength;
98 
101 
111  virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size) override;
112 
121  virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size) override;
122 };
123 
124 } // namespace erpc
125 
128 #endif /* _EMBEDDED_RPC__USB_CDC_TRANSPORT_H_ */
Base class for framed transport layers.
Definition: erpc_framed_transport.hpp:56
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:85
Very basic transport to send/receive messages via virtual USB CDC port.
Definition: erpc_usb_cdc_transport.hpp:40
void tx_cb(void)
Function called from Serial Manager Tx Callback to unblock the send function.
Definition: erpc_usb_cdc_transport.cpp:66
virtual erpc_status_t underlyingReceive(MessageBuffer *message, uint32_t size, uint32_t offset)
Adds ability to framed transport to overwrite MessageBuffer when receiving data.
Definition: erpc_framed_transport.cpp:177
virtual erpc_status_t init(void)
Initialize USB CDC peripheral configuration structure with values specified in UsbCdcTransport constr...
Definition: erpc_usb_cdc_transport.cpp:106
Definition: erpc_arbitrated_client_manager.hpp:25
Semaphore m_rxSemaphore
Definition: erpc_usb_cdc_transport.hpp:89
virtual ~UsbCdcTransport(void)
Destructor.
Definition: erpc_usb_cdc_transport.cpp:98
UsbCdcTransport(serial_handle_t serialHandle, serial_manager_config_t *serialConfig, serial_port_usb_cdc_config_t *usbCdcConfig, uint8_t *usbRingBuffer, uint32_t usbRingBufferLength)
Constructor.
Definition: erpc_usb_cdc_transport.cpp:84
virtual erpc_status_t underlyingSend(MessageBuffer *message, uint32_t size, uint32_t offset)
Adds ability to framed transport to overwrite MessageBuffer when sending data.
Definition: erpc_framed_transport.cpp:170
Semaphore m_txSemaphore
Definition: erpc_usb_cdc_transport.hpp:90
Simple semaphore class.
Definition: erpc_threading.h:442
void rx_cb(void)
Function called from Serial Manager Rx Callback to unblock the receive function.
Definition: erpc_usb_cdc_transport.cpp:75