| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- File List
- File Members

erpc_usb_cdc_transport.h
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 #if !ERPC_THREADS_IS(NONE)
14 #include "erpc_threading.h"
15 #endif
16
17 #include "erpc_framed_transport.h"
18
19 #include "fsl_component_serial_manager.h"
20
21 #include <stdlib.h>
22
29 // Classes
32
33 namespace erpc {
39 class UsbCdcTransport : public FramedTransport
40 {
41 public:
55 UsbCdcTransport(serial_handle_t serialHandle, serial_manager_config_t *serialConfig,
56 serial_port_usb_cdc_config_t *usbCdcConfig, uint8_t *usbRingBuffer, uint32_t usbRingBufferLength);
57
61 virtual ~UsbCdcTransport(void);
62
70 virtual erpc_status_t init(void);
71
77 void rx_cb(void);
78
84 void tx_cb(void);
85
86 protected:
87 #if !ERPC_THREADS_IS(NONE)
88 Semaphore m_rxSemaphore;
89 Semaphore m_txSemaphore;
90 #endif
91 private:
92 serial_handle_t m_serialHandle;
93 serial_manager_config_t *m_serialConfig;
94 serial_port_usb_cdc_config_t *m_usbCdcConfig;
95 uint8_t *m_usbRingBuffer;
96 uint32_t m_usbRingBufferLength;
97
107 virtual erpc_status_t underlyingReceive(uint8_t *data, uint32_t size);
108
117 virtual erpc_status_t underlyingSend(const uint8_t *data, uint32_t size);
118 };
119
120 } // namespace erpc
121
124 #endif /* _EMBEDDED_RPC__USB_CDC_TRANSPORT_H_ */
erpc::FramedTransport
Base class for framed transport layers.
Definition: erpc_framed_transport.h:56
erpc_status_t
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:87
erpc_framed_transport.h
erpc::UsbCdcTransport
Very basic transport to send/receive messages via virtual USB CDC port.
Definition: erpc_usb_cdc_transport.h:39
erpc::UsbCdcTransport::tx_cb
void tx_cb(void)
Function called from Serial Manager Tx Callback to unblock the send function.
Definition: erpc_usb_cdc_transport.cpp:66
erpc::UsbCdcTransport::init
virtual erpc_status_t init(void)
Initialize USB CDC peripheral configuration structure with values specified in UsbCdcTransport constr...
Definition: erpc_usb_cdc_transport.cpp:108
erpc
Definition: erpc_arbitrated_client_manager.h:25
erpc::UsbCdcTransport::m_rxSemaphore
Semaphore m_rxSemaphore
Definition: erpc_usb_cdc_transport.h:88
erpc_threading.h
erpc::UsbCdcTransport::~UsbCdcTransport
virtual ~UsbCdcTransport(void)
Destructor.
Definition: erpc_usb_cdc_transport.cpp:100
erpc::UsbCdcTransport::UsbCdcTransport
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
erpc::UsbCdcTransport::m_txSemaphore
Semaphore m_txSemaphore
Definition: erpc_usb_cdc_transport.h:89
erpc::Semaphore
Simple semaphore class.
Definition: erpc_threading.h:411
erpc::UsbCdcTransport::rx_cb
void rx_cb(void)
Function called from Serial Manager Rx Callback to unblock the receive function.
Definition: erpc_usb_cdc_transport.cpp:75