CuVoodoo STM32F1 firmware template
|
library for USB CDC ACM communication (code) More...
Go to the source code of this file.
Macros | |
#define | USB_DATA_TRANSFER_SIZE 64 |
maximum packet size for USB data transfer | |
Functions | |
struct { | |
struct usb_cdc_header_descriptor header | |
header | |
struct usb_cdc_call_management_descriptor call_mgmt | |
call management descriptor | |
struct usb_cdc_acm_descriptor acm | |
descriptor | |
struct usb_cdc_union_descriptor cdc_union | |
descriptor | |
} | __attribute__ ((packed)) |
USB CDC ACM functional descriptor. More... | |
static void | usb_disconnect (void) |
disconnect USB by pulling down D+ to for re-enumerate | |
static void | usb_reset (usbd_device *usbd_dev, struct usb_setup_data *req) |
disconnect USB and perform system reset More... | |
static void | usb_dfu_detach (usbd_device *usbd_dev, struct usb_setup_data *req) |
DFU detach (disconnect USB and perform core reset) More... | |
static void | usb_cdcacm_control_cb (usbd_device *usbd_dev, struct usb_setup_data *req) |
USB CDC ACM control callback. More... | |
static int | usb_cdcacm_control_request (usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t **buf, uint16_t *len, void(**complete)(usbd_device *usbd_dev, struct usb_setup_data *req)) |
incoming USB CDC ACM control request More... | |
static void | usb_cdcacm_data_rx_cb (usbd_device *usbd_dev, uint8_t ep) |
USB CDC ACM data received callback. More... | |
static void | usb_cdcacm_data_tx_cb (usbd_device *usbd_dev, uint8_t ep) |
USB CDC ACM data transmitted callback. More... | |
static void | usb_cdcacm_set_config (usbd_device *usbd_dev, uint16_t wValue) |
set USB CDC ACM configuration More... | |
void | usb_cdcacm_setup (void) |
setup USB CDC ACM peripheral | |
void | usb_cdcacm_putchar (char c) |
send character over USB (non-blocking) More... | |
void | usb_lp_can_rx0_isr (void) |
USB interrupt service routine called when data is received. | |
Variables | |
volatile bool | usb_cdcacm_connecting = false |
flag set to true when user is connected to USB CDC ACM port (e.g. More... | |
static uint8_t | usbd_control_buffer [128] = {0} |
buffer to be used for control requests | |
static usbd_device * | usb_device = NULL |
structure holding all the info related to the USB device | |
static volatile bool | usb_tx_ongoing = false |
if USB transmission is already ongoing | |
static volatile bool | first_connection = false |
used to detect when the first connection occurred | |
static uint8_t | tx_buffer [512] = {0} |
ring buffer for data to transmit | |
static volatile uint16_t | tx_i = 0 |
current position if transmitted data | |
static volatile uint16_t | tx_used = 0 |
how much data needs to be transmitted | |
static volatile bool | tx_lock = false |
if the transmit buffer is currently being written | |
static const struct usb_device_descriptor | usb_cdcacm_device_descriptor |
USB CDC ACM device descriptor. More... | |
static const struct usb_endpoint_descriptor | usb_cdcacm_data_endpoints [] |
USB CDC ACM data endpoints. More... | |
static const struct usb_endpoint_descriptor | usb_cdcacm_communication_endpoints [] |
USB CDC ACM communication endpoints. More... | |
static const struct usb_interface_descriptor | usb_cdcacm_communication_interface |
USB CDC interface descriptor. More... | |
static const struct usb_interface_descriptor | usb_cdcacm_data_interface |
USB CDC ACM data class interface descriptor. More... | |
static const struct usb_dfu_descriptor | usb_dfu_functional |
USB DFU functional descriptor. More... | |
static const struct usb_interface_descriptor | usb_dfu_interface |
USB DFU interface descriptor. More... | |
static const struct usb_interface | usb_cdcacm_interfaces [] |
USB CDC ACM interface descriptor. More... | |
static const struct usb_config_descriptor | usb_cdcacm_configuration_descriptor |
USB CDC ACM configuration descriptor. More... | |
static const char * | usb_strings [] |
USB string table. More... | |
|
static |
USB CDC ACM functional descriptor.
< descriptor length
< descriptor type
< descriptor subtype
< CDC value
< descriptor length
< descriptor type
< descriptor subtype
< capabilities
< data interface
< descriptor length
< descriptor type
< descriptor subtype
< capabilities
< descriptor length
< descriptor type
< descriptor subtype
< control interface
< subordinate interface
Definition at line 115 of file usb_cdcacm.c.
|
static |
USB CDC ACM control callback.
[in] | usbd_dev | USB device descriptor |
[in] | req | control request information |
Definition at line 301 of file usb_cdcacm.c.
|
static |
incoming USB CDC ACM control request
[in] | usbd_dev | USB device descriptor |
[in] | req | control request information |
[in] | buf | control request data |
[in] | len | control request data length |
[in] | complete | function to run after request completed |
Definition at line 318 of file usb_cdcacm.c.
|
static |
USB CDC ACM data received callback.
[in] | usbd_dev | USB device descriptor |
[in] | ep | endpoint where data came in |
Definition at line 386 of file usb_cdcacm.c.
|
static |
USB CDC ACM data transmitted callback.
[in] | usbd_dev | USB device descriptor |
[in] | ep | endpoint where data came in |
Definition at line 407 of file usb_cdcacm.c.
void usb_cdcacm_putchar | ( | char | c | ) |
send character over USB (non-blocking)
[in] | c | character to send |
Definition at line 463 of file usb_cdcacm.c.
|
static |
set USB CDC ACM configuration
[in] | usbd_dev | USB device descriptor |
[in] | wValue | not used |
Definition at line 432 of file usb_cdcacm.c.
|
static |
DFU detach (disconnect USB and perform core reset)
[in] | usbd_dev | USB device (unused) |
[in] | req | USB request (unused) |
Definition at line 286 of file usb_cdcacm.c.
|
static |
disconnect USB and perform system reset
[in] | usbd_dev | USB device (unused) |
[in] | req | USB request (unused) |
Definition at line 272 of file usb_cdcacm.c.
|
static |
USB CDC ACM communication endpoints.
Definition at line 97 of file usb_cdcacm.c.
|
static |
USB CDC interface descriptor.
Definition at line 147 of file usb_cdcacm.c.
|
static |
USB CDC ACM configuration descriptor.
Definition at line 224 of file usb_cdcacm.c.
volatile bool usb_cdcacm_connecting = false |
flag set to true when user is connected to USB CDC ACM port (e.g.
when a terminal is opened)
Definition at line 42 of file usb_cdcacm.c.
|
static |
USB CDC ACM data endpoints.
Definition at line 78 of file usb_cdcacm.c.
|
static |
USB CDC ACM data class interface descriptor.
Definition at line 167 of file usb_cdcacm.c.
|
static |
USB CDC ACM device descriptor.
Definition at line 58 of file usb_cdcacm.c.
|
static |
USB CDC ACM interface descriptor.
Definition at line 212 of file usb_cdcacm.c.
|
static |
USB DFU functional descriptor.
Definition at line 184 of file usb_cdcacm.c.
|
static |
USB DFU interface descriptor.
Definition at line 196 of file usb_cdcacm.c.
|
static |
USB string table.
Definition at line 240 of file usb_cdcacm.c.