USB: rename usb_mouse module in usbmouse
[bertos.git] / bertos / drv / usb_serial.c
index 3c3947be3b015eccc35e997a6e205502233c9388..be39fe69855c8d2da47037a1b1b27c3efa102a51 100644 (file)
@@ -67,7 +67,7 @@
 #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,
@@ -84,7 +84,7 @@ static usb_device_descriptor_t usb_serial_device_descriptor =
        .bNumConfigurations = 1,
 };
 
-static 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,
@@ -95,7 +95,7 @@ static usb_config_descriptor_t usb_serial_config_descriptor =
        .bMaxPower = 50, /* 100 mA */
 };
 
-static 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,
@@ -108,43 +108,43 @@ static usb_interface_descriptor_t usb_serial_interface_descriptor =
        .iInterface = 0,
 };
 
-static 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 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 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 usb_descriptor_header_t *usb_serial_config[] =
+static const UsbDescHeader *usb_serial_config[] =
 {
-       (usb_descriptor_header_t *)&usb_serial_config_descriptor,
-       (usb_descriptor_header_t *)&usb_serial_interface_descriptor,
-       (usb_descriptor_header_t *)&usb_serial_ep_report_descriptor,
-       (usb_descriptor_header_t *)&usb_serial_ep_in_descriptor,
-       (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,
 };
 
@@ -156,17 +156,17 @@ static DEFINE_USB_STRING(product_str,
 static DEFINE_USB_STRING(serial_str,
                USB_STRING("0", "0", "1"));
 
-static 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,
@@ -178,7 +178,7 @@ static int usb_serial_hw_init(void)
 #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;
@@ -197,7 +197,7 @@ static size_t usb_serial_write(struct KFile *fd,
        /* 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);
 }
 
@@ -213,7 +213,7 @@ static size_t usb_serial_read(struct KFile *fd, void *buf, size_t 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);
 }
 
@@ -293,7 +293,7 @@ static struct KFile *usb_serial_reopen(struct KFile *fd)
  *
  * \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));