X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Fusbser.c;h=04eb3d82b1526b84ecb23b7107ef939b83761d33;hb=024bf80e5f29e4de00d0813d23a4d3b67245ead7;hp=b6c7161fda4af59b7bbdc766b7e5101873c8939a;hpb=2bb3aef3132932713ad7e588ad250a4e24769796;p=bertos.git diff --git a/bertos/drv/usbser.c b/bertos/drv/usbser.c index b6c7161f..04eb3d82 100644 --- a/bertos/drv/usbser.c +++ b/bertos/drv/usbser.c @@ -36,6 +36,8 @@ * */ +#include "usbser.h" + #include "cfg/cfg_usbser.h" #define LOG_LEVEL USB_SERIAL_LOG_LEVEL @@ -52,13 +54,10 @@ #include /* cpu_relax() */ #include +#include #include /* memcpy() */ -#include "drv/usbser.h" - -#define USB_SERIAL_VENDOR_ID 0x05f9 -#define USB_SERIAL_PRODUCT_ID 0xffff #define USB_SERIAL_INTERFACES 1 #define USB_SERIAL_ENDPOINTS 3 @@ -112,7 +111,7 @@ static const UsbEndpointDesc usb_serial_ep_report_descriptor = { .bLength = sizeof(usb_serial_ep_report_descriptor), .bDescriptorType = USB_DT_ENDPOINT, - .bEndpointAddress = USB_DIR_IN | 1, + .bEndpointAddress = USB_DIR_IN | USB_SERIAL_EP_REPORT, .bmAttributes = USB_ENDPOINT_XFER_INT, .wMaxPacketSize = usb_cpu_to_le16((uint16_t)8), .bInterval = 1, @@ -122,7 +121,7 @@ static const UsbEndpointDesc usb_serial_ep_in_descriptor = { .bLength = sizeof(usb_serial_ep_in_descriptor), .bDescriptorType = USB_DT_ENDPOINT, - .bEndpointAddress = USB_DIR_IN | 3, + .bEndpointAddress = USB_DIR_IN | USB_SERIAL_EP_IN, .bmAttributes = USB_ENDPOINT_XFER_BULK, .wMaxPacketSize = usb_cpu_to_le16((uint16_t)64), .bInterval = 0, @@ -132,7 +131,7 @@ static const UsbEndpointDesc usb_serial_ep_out_descriptor = { .bLength = sizeof(usb_serial_ep_in_descriptor), .bDescriptorType = USB_DT_ENDPOINT, - .bEndpointAddress = USB_DIR_OUT | 2, + .bEndpointAddress = USB_DIR_OUT | USB_SERIAL_EP_OUT, .bmAttributes = USB_ENDPOINT_XFER_BULK, .wMaxPacketSize = usb_cpu_to_le16((uint16_t)64), .bInterval = 0, @@ -148,20 +147,20 @@ static const UsbDescHeader *usb_serial_config[] = NULL, }; -static DEFINE_USB_STRING(language_str, "\x09\x04"); // Language ID: en_US -static DEFINE_USB_STRING(manufacturer_str, +static const DEFINE_USB_STRING(language_str, "\x09\x04"); // Language ID: en_US +static const DEFINE_USB_STRING(manufacturer_str, USB_STRING("B", "e", "R", "T", "O", "S")); -static DEFINE_USB_STRING(product_str, +static const DEFINE_USB_STRING(product_str, USB_STRING("U", "S", "B", "-", "s", "e", "r", "i", "a", "l")); -static DEFINE_USB_STRING(serial_str, +static const DEFINE_USB_STRING(serial_str, USB_STRING("0", "0", "1")); static const UsbStringDesc *usb_serial_strings[] = { - (UsbStringDesc *)&language_str, - (UsbStringDesc *)&manufacturer_str, - (UsbStringDesc *)&product_str, - (UsbStringDesc *)&serial_str, + (const UsbStringDesc *)&language_str, + (const UsbStringDesc *)&manufacturer_str, + (const UsbStringDesc *)&product_str, + (const UsbStringDesc *)&serial_str, NULL, };