File UsbCdcLink.cpp
FileList > demo-projets > stm32 > src > UsbCdcLink.cpp
Go to the source code of this file.
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "Bsp.hpp"
#include "CdcUartTunnel.hpp"
#include "Esp32Manager.hpp"
#include "UsbCdcLink.h"
#include "usb_cdc.h"
#include "utils/Debug.hpp"
Classes
Public Types
Type |
Name |
enum |
@0 Implements USB CDC using libusb_stm. |
enum |
@1
|
Public Attributes
Public Static Attributes
Type |
Name |
constexpr size_t |
DebugDescriptorsSize = = sizeof(__debug_descriptors)
|
struct usb_cdc_line_coding |
cdc_line_debug = = { |
.dwDTERate = 115200, |
|
.bCharFormat = USB_CDC_1_STOP_BITS, |
|
.bParityType = USB_CDC_NO_PARITY, |
|
.bDataBits = 8, |
|
}
|
|
struct usb_cdc_line_coding |
cdc_line_tunnel = = { |
.dwDTERate = 115200, |
|
.bCharFormat = USB_CDC_1_STOP_BITS, |
|
.bParityType = USB_CDC_NO_PARITY, |
|
.bDataBits = 8, |
|
}
|
|
struct cdc_config |
config_desc
|
const struct usb_device_descriptor |
device_desc = = { |
.bLength = sizeof(struct usb_device_descriptor), |
|
.bDescriptorType = USB_DTYPE_DEVICE, |
|
.bcdUSB = VERSION_BCD(2, 0, 0), |
|
.bDeviceClass = USB_CLASS_IAD, |
|
.bDeviceSubClass = USB_SUBCLASS_IAD, |
|
.bDeviceProtocol = USB_PROTO_IAD, |
|
.bMaxPacketSize0 = CDC_EP0_SIZE, |
|
.idVendor = 0x0483, |
|
.idProduct = 0x5740, |
|
.bcdDevice = VERSION_BCD(1, 0, 0), |
|
.iManufacturer = STRDESC_MANUFACTURER, |
|
.iProduct = STRDESC_PRODUCT, |
|
.iSerialNumber = STRDESC_SERIAL, |
|
.bNumConfigurations = 1, |
|
}
|
|
const struct usb_string_descriptor *const |
dtable = = { |
&lang_desc, |
|
&manuf_desc_en, |
|
&prod_desc_en, |
|
&cdc_iface_desc_en, |
|
&debug_iface_desc_en, |
|
&serial_number_desc_en, |
|
}
|
|
bool |
enableDebugEp = = false
|
uint32_t |
ubuf
|
Public Functions
Public Static Functions
Macros
Public Types Documentation
enum @0
enum @0 {
STRDESC_LANG,
STRDESC_MANUFACTURER,
STRDESC_PRODUCT,
STRDESC_CDC_IFACE,
STRDESC_DEBUG_IFACE,
STRDESC_SERIAL,
STRDESC_MAX
};
enum @1
enum @1 {
INTERFACE_TUNNEL_COMM,
INTERFACE_TUNNEL_DATA,
INTERFACE_DEBUG_COMM,
INTERFACE_DEBUG_DATA,
INTERFACE_COUNT_ALL,
INTERFACE_COUNT_NODEBUG = INTERFACE_DEBUG_COMM
};
Public Attributes Documentation
variable cdc_iface_desc_en
const struct usb_string_descriptor cdc_iface_desc_en;
variable config
struct usb_config_descriptor config;
variable debug_iface_desc_en
const struct usb_string_descriptor debug_iface_desc_en;
variable lang_desc
const struct usb_string_descriptor lang_desc;
variable manuf_desc_en
const struct usb_string_descriptor manuf_desc_en;
variable prod_desc_en
const struct usb_string_descriptor prod_desc_en;
variable serial_number_desc_en
struct usb_string_descriptor serial_number_desc_en;
variable tunnel_cdc_acm
struct usb_cdc_acm_desc tunnel_cdc_acm;
variable tunnel_cdc_hdr
struct usb_cdc_header_desc tunnel_cdc_hdr;
variable tunnel_cdc_mgmt
struct usb_cdc_call_mgmt_desc tunnel_cdc_mgmt;
variable tunnel_cdc_union
struct usb_cdc_union_desc tunnel_cdc_union;
variable tunnel_comm
struct usb_interface_descriptor tunnel_comm;
variable tunnel_comm_ep
struct usb_endpoint_descriptor tunnel_comm_ep;
variable tunnel_comm_iad
struct usb_iad_descriptor tunnel_comm_iad;
variable tunnel_data
struct usb_interface_descriptor tunnel_data;
variable tunnel_data_eprx
struct usb_endpoint_descriptor tunnel_data_eprx;
variable tunnel_data_eptx
struct usb_endpoint_descriptor tunnel_data_eptx;
variable udev
Public Static Attributes Documentation
constexpr size_t DebugDescriptorsSize;
variable cdc_line_debug
struct usb_cdc_line_coding cdc_line_debug;
variable cdc_line_tunnel
struct usb_cdc_line_coding cdc_line_tunnel;
variable config_desc
struct cdc_config config_desc;
variable device_desc
const struct usb_device_descriptor device_desc;
variable dtable
const struct usb_string_descriptor* const dtable[STRDESC_MAX];
variable enableDebugEp
variable ubuf
Public Functions Documentation
function USB_LP_IRQ_HANDLER
void USB_LP_IRQ_HANDLER (
void
)
function __attribute__
struct __debug_descriptors __attribute__ (
(packed)
)
function cdcLinkInit
function cdcLinkIsDebugEpEnabled
bool cdcLinkIsDebugEpEnabled ()
Public Static Functions Documentation
function cdc_control
static usbd_respond cdc_control (
usbd_device * dev,
usbd_ctlreq * req,
usbd_rqc_callback * callback
)
function cdc_control_debug
static usbd_respond cdc_control_debug (
usbd_device * dev,
usbd_ctlreq * req
)
function cdc_control_tunnel
static usbd_respond cdc_control_tunnel (
usbd_device * dev,
usbd_ctlreq * req
)
function cdc_getdesc
static usbd_respond cdc_getdesc (
usbd_ctlreq * req,
void ** address,
uint16_t * length
)
function cdc_setconf
static usbd_respond cdc_setconf (
usbd_device * dev,
uint8_t cfg
)
function tunnel_check_for_dfu_request
static void tunnel_check_for_dfu_request (
const struct usb_cdc_line_coding * coding
)
Macro Definition Documentation
define DEBUG_DESCRIPTORS
#define DEBUG_DESCRIPTORS struct usb_iad_descriptor debug_comm_iad; \
struct usb_interface_descriptor debug_comm; \
struct usb_cdc_header_desc debug_cdc_hdr; \
struct usb_cdc_call_mgmt_desc debug_cdc_mgmt; \
struct usb_cdc_acm_desc debug_cdc_acm; \
struct usb_cdc_union_desc debug_cdc_union; \
struct usb_endpoint_descriptor debug_comm_ep; \
struct usb_interface_descriptor debug_data; \
struct usb_endpoint_descriptor debug_data_eprx; \
struct usb_endpoint_descriptor debug_data_eptx;
The documentation for this class was generated from the following file demo-projets/stm32/src/UsbCdcLink.cpp