#define USB_STRING_PRODUCT 2
#define USB_STRING_SERIAL 3
-static usb_device_descriptor_t usb_serial_device_descriptor =
+static UsbDeviceDesc usb_serial_device_descriptor =
{
.bLength = sizeof(usb_serial_device_descriptor),
.bDescriptorType = USB_DT_DEVICE,
.bNumConfigurations = 1,
};
-static const usb_config_descriptor_t usb_serial_config_descriptor =
+static const UsbConfigDesc usb_serial_config_descriptor =
{
.bLength = sizeof(usb_serial_config_descriptor),
.bDescriptorType = USB_DT_CONFIG,
.bMaxPower = 50, /* 100 mA */
};
-static const usb_interface_descriptor_t usb_serial_interface_descriptor =
+static const UsbInterfaceDesc usb_serial_interface_descriptor =
{
.bLength = sizeof(usb_serial_interface_descriptor),
.bDescriptorType = USB_DT_INTERFACE,
.iInterface = 0,
};
-static const usb_endpoint_descriptor_t usb_serial_ep_report_descriptor =
+static const UsbEndpointDesc usb_serial_ep_report_descriptor =
{
.bLength = sizeof(usb_serial_ep_report_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN | 1,
.bmAttributes = USB_ENDPOINT_XFER_INT,
- .wMaxPacketSize = usb_cpu_to_le16(8),
+ .wMaxPacketSize = usb_cpu_to_le16((uint16_t)8),
.bInterval = 1,
};
-static const usb_endpoint_descriptor_t usb_serial_ep_in_descriptor =
+static const UsbEndpointDesc usb_serial_ep_in_descriptor =
{
.bLength = sizeof(usb_serial_ep_in_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_IN | 3,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
- .wMaxPacketSize = usb_cpu_to_le16(64),
+ .wMaxPacketSize = usb_cpu_to_le16((uint16_t)64),
.bInterval = 0,
};
-static const usb_endpoint_descriptor_t usb_serial_ep_out_descriptor =
+static const UsbEndpointDesc usb_serial_ep_out_descriptor =
{
.bLength = sizeof(usb_serial_ep_in_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bEndpointAddress = USB_DIR_OUT | 2,
.bmAttributes = USB_ENDPOINT_XFER_BULK,
- .wMaxPacketSize = usb_cpu_to_le16(64),
+ .wMaxPacketSize = usb_cpu_to_le16((uint16_t)64),
.bInterval = 0,
};
-static const usb_descriptor_header_t *usb_serial_config[] =
+static const UsbDescHeader *usb_serial_config[] =
{
- (const usb_descriptor_header_t *)&usb_serial_config_descriptor,
- (const usb_descriptor_header_t *)&usb_serial_interface_descriptor,
- (const usb_descriptor_header_t *)&usb_serial_ep_report_descriptor,
- (const usb_descriptor_header_t *)&usb_serial_ep_in_descriptor,
- (const usb_descriptor_header_t *)&usb_serial_ep_out_descriptor,
+ (const UsbDescHeader *)&usb_serial_config_descriptor,
+ (const UsbDescHeader *)&usb_serial_interface_descriptor,
+ (const UsbDescHeader *)&usb_serial_ep_report_descriptor,
+ (const UsbDescHeader *)&usb_serial_ep_in_descriptor,
+ (const UsbDescHeader *)&usb_serial_ep_out_descriptor,
NULL,
};
static DEFINE_USB_STRING(serial_str,
USB_STRING("0", "0", "1"));
-static const usb_string_descriptor_t *usb_serial_strings[] =
+static const UsbStringDesc *usb_serial_strings[] =
{
- (usb_string_descriptor_t *)&language_str,
- (usb_string_descriptor_t *)&manufacturer_str,
- (usb_string_descriptor_t *)&product_str,
- (usb_string_descriptor_t *)&serial_str,
+ (UsbStringDesc *)&language_str,
+ (UsbStringDesc *)&manufacturer_str,
+ (UsbStringDesc *)&product_str,
+ (UsbStringDesc *)&serial_str,
NULL,
};
/* Global usb-serial descriptor that identifies the usb-serial device */
-static struct usb_device usb_serial = {
+static UsbDevice usb_serial = {
.device = &usb_serial_device_descriptor,
.config = usb_serial_config,
.strings = usb_serial_strings,
#if CONFIG_KERN
MOD_CHECK(proc);
#endif
- if (usb_device_register(&usb_serial) < 0)
+ if (usb_deviceRegister(&usb_serial) < 0)
return -1;
LOG_INFO("usb-serial: registered new USB interface driver\n");
return 0;
/* Silent compiler warnings if _DEBUG is not enabled */
(void)fd;
ASSERT(fds->is_open);
- return usb_ep_write(usb_serial_ep_in_descriptor.bEndpointAddress,
+ return usb_endpointWrite(usb_serial_ep_in_descriptor.bEndpointAddress,
buf, size);
}
/* Silent compiler warnings if _DEBUG is not enabled */
(void)fd;
ASSERT(fds->is_open);
- return usb_ep_read(usb_serial_ep_out_descriptor.bEndpointAddress,
+ return usb_endpointRead(usb_serial_ep_out_descriptor.bEndpointAddress,
buf, size);
}
*
* \return 0 if OK, a negative value in case of error.
*/
-int usb_serial_init(struct USBSerial *fds, int unit)
+int usb_serialInit(struct USBSerial *fds, int unit)
{
memset(fds, 0, sizeof(*fds));