/* * USB Driver structure. */ static SerialUSBDriver SDU1; /* * USB Device Descriptor. */ static const uint8_t vcom_device_descriptor_data[18] = { USB_DESC_DEVICE (0x0110, /* bcdUSB (1.1). */ 0x02, /* bDeviceClass (CDC). */ 0x00, /* bDeviceSubClass. */ 0x00, /* bDeviceProtocol. */ 0x40, /* bMaxPacketSize. */ 0x0483, /* idVendor (ST). */ 0x5740, /* idProduct. */ 0x0200, /* bcdDevice. */ 1, /* iManufacturer. */ 2, /* iProduct. */ 3, /* iSerialNumber. */ 1) /* bNumConfigurations. */ }; /* * Device Descriptor wrapper. */ static const USBDescriptor vcom_device_descriptor = { sizeof vcom_device_descriptor_data, vcom_device_descriptor_data };
/* * USB Device Descriptor. */ static const uint8_t vcom_device_descriptor_data[18] = { USB_DESC_DEVICE(0x0110, /* bcdUSB (1.1). */ 0x02, /* bDeviceClass (CDC). */ 0x00, /* bDeviceSubClass. */ 0x00, /* bDeviceProtocol. */ 0x40, /* bMaxPacketSize. */ 0x0179, /* idVendor. */ #if defined(TEENSY30) || defined(TEENSY32) || defined(TEENSYLC) 0x0002, /* idProduct. */ #elif defined(MCHCK) 0x0003, /* idProduct. */ #elif defined(F042) 0x0004, /* idProduct. */ #elif defined(KL27Z) || defined(KL25Z) 0x0005, /* idProduct. */ #else 0x0001, /* idProduct. */ #endif 0x0200, /* bcdDevice. */ 1, /* iManufacturer. */ 2, /* iProduct. */ 3, /* iSerialNumber. */ 1) /* bNumConfigurations. */ }; /* * Device Descriptor wrapper. */
*===========================================================================*/ /*=========================================================================== * USB Descriptors *===========================================================================*/ /* USB Device Descriptor */ static const uint8_t usb_device_descriptor_data[] = { USB_DESC_DEVICE(0x0200, /* bcdUSB (1.1) */ 0, /* bDeviceClass (defined in later in interface) */ 0, /* bDeviceSubClass */ 0, /* bDeviceProtocol */ 64, /* bMaxPacketSize (64 bytes) (the driver didn't work with 32) */ VENDOR_ID, /* idVendor */ PRODUCT_ID, /* idProduct */ 0x0100, /* bcdDevice */ 1, /* iManufacturer */ 2, /* iProduct */ 3, /* iSerialNumber */ 1) /* bNumConfigurations */ }; /* Device Descriptor wrapper */ static const USBDescriptor usb_device_descriptor = { sizeof usb_device_descriptor_data, usb_device_descriptor_data }; /* * HID Report Descriptor
#endif #if USB_CDC_INTERRUPT_REQUEST_EP == USB_MS_DATA_EP # error "CDC and MSD Endpoints must be different" #endif /* * USB Device Descriptor. */ static const uint8_t msd_device_descriptor_data[18] = { USB_DESC_DEVICE (0x0200, /* bcdUSB (2.0). */ MULTI_FUNCTION_DEVICE_CLASS, /* bDeviceClass (None). */ MULTI_FUNCTION_SUB_CLASS, /* bDeviceSubClass. */ MULTI_FUNCTION_DEVICE_PROTOCOL, /* bDeviceProtocol. */ 0x40, /* Control Endpoint Size. */ VENDOR_ID, /* idVendor */ PRODUCT_ID, /* idProduct. */ 0x0100, /* bcdDevice. */ 1, /* iManufacturer. */ 2, /* iProduct. */ 3, /* iSerialNumber. */ 1) /* bNumConfigurations. */ }; /* * Device Descriptor wrapper. */ const USBDescriptor msd_device_descriptor = { sizeof(msd_device_descriptor_data), msd_device_descriptor_data };
/* endpoint index */ #define USB_MS_DATA_EP 1 // cortex_m4 specific #define MCU_RESTART() {*((unsigned long *)0x0E000ED0C) = 0x05FA0004;} /* USB device descriptor */ static const uint8_t deviceDescriptorData[] = { USB_DESC_DEVICE ( 0x0200, /* supported USB version (2.0) */ 0x00, /* device class (none, specified in interface) */ 0x00, /* device sub-class (none, specified in interface) */ 0x00, /* device protocol (none, specified in interface) */ 64, /* max packet size of control end-point */ 0x0483, /* vendor ID (STMicroelectronics!) */ 0x5740, /* product ID (STM32F407) */ 0x0100, /* device release number */ 1, /* index of manufacturer string descriptor */ 2, /* index of product string descriptor */ 3, /* index of serial number string descriptor */ 1 /* number of possible configurations */ ) }; static const USBDescriptor deviceDescriptor = { sizeof(deviceDescriptorData), deviceDescriptorData }; /* configuration descriptor */
#define USB_CDC_CIF_NUM0 0 #define USB_CDC_DIF_NUM0 1 #define USB_CDC_CIF_NUM1 2 #define USB_CDC_DIF_NUM1 3 /* * USB Device Descriptor. */ static const uint8_t vcom_device_descriptor_data[] = { USB_DESC_DEVICE( 0x0200, /* bcdUSB (1.1). */ 0xEF, /* bDeviceClass (misc). */ 0x02, /* bDeviceSubClass (common). */ 0x01, /* bDeviceProtocol (IAD). */ USB_DATA_SIZE, /* bMaxPacketSize. */ USB_DEVICE_VID, /* idVendor. */ USB_DEVICE_PID, /* idProduct. */ 0x0200, /* bcdDevice. */ 1, /* iManufacturer. */ 2, /* iProduct. */ 3, /* iSerialNumber. */ 1) /* bNumConfigurations. */ }; /* * Device Descriptor wrapper. */ static const USBDescriptor vcom_device_descriptor = { sizeof vcom_device_descriptor_data, vcom_device_descriptor_data };