15 #include "../STM32_USB_Driver/usb_bsp.h" 16 #include "../STM32_USB_Driver/usb_regs.h" 17 #include "../STM32_USB_Driver/usbd_conf.h" 18 #include "../STM32_USB_Driver/usbd_usr.h" 19 #include "../STM32_USB_Driver/usbd_desc.h" 20 #include "../STM32_USB_Driver/usbd_cdc_core.h" 21 #include "../STM32_USB_Driver/usbd_ioreq.h" 22 #include "../STM32_USB_Driver/usbd_req.h" 23 #include "../STM32_USB_Driver/usbd_core.h" 25 #include "../STM32_USB_Driver/ring_buff.h" 26 #include "../STM32_USB_Driver/min_max.h" 34 #define USBD_MANUFACTURER_STRING "RevoMini" 35 #define USBD_PRODUCT_FS_STRING "3DR Virtual COM" 36 #define USBD_SERIALNUMBER_FS_STRING "00000000050C" 37 #define USBD_CONFIGURATION_FS_STRING "VCP Config" 38 #define USBD_INTERFACE_FS_STRING "VCP Interface" 40 #define USBD_VID 0x26ac 41 #define USBD_PID 0x0011 42 #define USBD_LANGID_STRING 0x409 44 #define USB_RXFIFO_SIZE 256 45 #define USB_TXFIFO_SIZE 256 49 #define USB_IRQ OTG_FS_IRQn 50 #define USB_AF GPIO_AF_OTG1_FS 51 #define USB_CLOCK RCC_AHB2Periph_OTG_FS 55 #define DM_PIN_PORT _GPIOA //PA11 57 #define DP_PIN_PORT _GPIOA //PA12 58 #define DP_PIN_PIN 12 //PA12 88 #define I_USB_CONNECTED 2 89 #define I_USB_GETATTR 3 90 #define I_USB_SETATTR 4 103 int usb_read(
void * buf,
unsigned int nbytes);
116 int usb_write(
const uint8_t *buf,
unsigned int nbytes);
117 int usb_read(
void * buf,
unsigned int nbytes);
157 #define DEFAULT_CONFIG 0 158 #define OTHER_CONFIG 1 180 unsigned VCP_Get(
void* buff,
unsigned max_len);
181 unsigned VCP_Put(
void const* buff,
unsigned len);
208 #define USB_DESCRIPTOR_TYPE_DEVICE 0x01 209 #define USB_DESCRIPTOR_TYPE_CONFIGURATION 0x02 210 #define USB_DESCRIPTOR_TYPE_STRING 0x03 211 #define USB_DESCRIPTOR_TYPE_INTERFACE 0x04 212 #define USB_DESCRIPTOR_TYPE_ENDPOINT 0x05 216 #define USB_DESCRIPTOR_STRING_LEN(x) (2 + (x << 1)) 218 #define USB_DESCRIPTOR_STRING(len) \ 221 uint8_t bDescriptorType; \ 222 uint16_t bString[len]; \ 282 #define USB_CONFIG_ATTR_BUSPOWERED 0b10000000 283 #define USB_CONFIG_ATTR_SELF_POWERED 0b11000000 285 #define USB_EP_TYPE_INTERRUPT 0x03 286 #define USB_EP_TYPE_BULK 0x02 288 #define USB_DESCRIPTOR_ENDPOINT_IN 0x80 289 #define USB_DESCRIPTOR_ENDPOINT_OUT 0x00 297 #define USB_ISR_MSK 0xBF00
unsigned VCP_Get(void *buff, unsigned max_len)
uint8_t bInterfaceSubClass
void VCP_SetUSBTxBlocking(uint8_t Mode)
struct usb_descriptor_device usb_descriptor_device
unsigned VCP_PutContig(void const *buff, unsigned len)
USB_OTG_CORE_HANDLE USB_OTG_dev
struct usb_descriptor_config_header usb_descriptor_config_header
struct usb_descriptor_endpoint usb_descriptor_endpoint
uint8_t bAlternateSetting
void USB_OTG_BSP_mDelay(const uint32_t msec)
void usb_default_attr(usb_attr_t *attr)
static uint8_t usb_getc(void)
unsigned VCP_GetContig(void *buff, unsigned max_len)
uint16_t usb_tx_pending(void)
uint16_t usb_tx_space(void)
static void usb_disconnect()
static uint8_t * VCP_SpacePtr(void)
int usb_periphcfg(FunctionalState state)
void usb_setParams(usb_attr_t *attr)
unsigned VCP_SpaceAvail(void)
void OTG_FS_IRQHandler(void)
struct usb_descriptor_interface usb_descriptor_interface
struct _USB_OTG_DCTL_TypeDef::@66 b
void USB_OTG_BSP_uDelay(const uint32_t usec)
unsigned VCP_Put(void const *buff, unsigned len)
unsigned VCP_DataAvail(void)
unsigned VCP_SpaceAvailContig(void)
void USB_OTG_BSP_DisableInterrupt()
uint8_t is_usb_connected(usb_attr_t *attr)
uint32_t usb_data_available(void)
void VCP_MarkRead(unsigned sz)
void VCP_MarkWritten(unsigned sz)
struct usb_descriptor_string usb_descriptor_string
uint32_t USB_Rx_buff_tail
static uint8_t const * VCP_DataPtr(void)
uint8_t bNumConfigurations
int usb_write(const uint8_t *buf, unsigned int nbytes)
uint8_t bInterfaceProtocol
const gpio_dev * present_port
int usb_ioctl(int request, void *ctl)
int usb_configure(usb_attr_t *attr)
int usb_read(void *buf, unsigned int nbytes)
static uint8_t usb_putc(uint8_t b)
unsigned VCP_DataAvailContig(void)
uint32_t USB_Tx_buff_head