From: arighi <arighi@38d2e660-2303-0410-9eaa-f027e97ec537>
Date: Thu, 23 Sep 2010 17:12:31 +0000 (+0000)
Subject: USB: coding style fixes (structure naming)
X-Git-Tag: 2.6.0~126
X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=493d98f6f007571506feb2d6b4250b63e2edc7e1;p=bertos.git

USB: coding style fixes (structure naming)

git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4275 38d2e660-2303-0410-9eaa-f027e97ec537
---

diff --git a/bertos/cpu/cortex-m3/drv/usb_stm32.c b/bertos/cpu/cortex-m3/drv/usb_stm32.c
index f2135493..55e27788 100644
--- a/bertos/cpu/cortex-m3/drv/usb_stm32.c
+++ b/bertos/cpu/cortex-m3/drv/usb_stm32.c
@@ -87,7 +87,7 @@ static struct stm32_usb *usb = (struct stm32_usb *)USB_BASE_ADDR;
 static stm32_usb_ep_t ep_cnfg[ENP_MAX_NUMB];
 
 /* USB EP0 control descriptor */
-static const usb_endpoint_descriptor_t USB_CtrlEpDescr0 =
+static const UsbEndpointDesc USB_CtrlEpDescr0 =
 {
 	.bLength = sizeof(USB_CtrlEpDescr0),
 	.bDescriptorType = USB_DT_ENDPOINT,
@@ -98,7 +98,7 @@ static const usb_endpoint_descriptor_t USB_CtrlEpDescr0 =
 };
 
 /* USB EP1 control descriptor */
-static const usb_endpoint_descriptor_t USB_CtrlEpDescr1 =
+static const UsbEndpointDesc USB_CtrlEpDescr1 =
 {
 	.bLength = sizeof(USB_CtrlEpDescr1),
 	.bDescriptorType = USB_DT_ENDPOINT,
@@ -109,7 +109,7 @@ static const usb_endpoint_descriptor_t USB_CtrlEpDescr1 =
 };
 
 /* USB setup packet */
-static usb_ctrlrequest_t setup_packet;
+static UsbCtrlRequest setup_packet;
 
 /* USB device controller: max supported interfaces */
 #define USB_MAX_INTERFACE	1
@@ -123,7 +123,7 @@ typedef struct stm32_udc
 {
 	uint8_t state;
 	uint32_t cfg_id;
-	const usb_config_descriptor_t *cfg;
+	const UsbConfigDesc *cfg;
 	uint32_t interfaces;
 	uint32_t alt[USB_MAX_INTERFACE];
 	uint32_t address;
@@ -134,7 +134,7 @@ typedef struct stm32_udc
 static stm32_udc_t udc;
 
 /* Generic USB Device Controller structure */
-static struct usb_device *usb_dev;
+static UsbDevice *usb_dev;
 
 /* USB packet memory management: list of allocated chunks */
 static pack_mem_slot_t *pPacketMemUse;
@@ -740,7 +740,7 @@ static void usb_ep_low_level_config(int ep, uint16_t offset, uint16_t size)
 }
 
 /* Enable/Disable an endpoint */
-static int usb_ep_configure(const usb_endpoint_descriptor_t *epd, bool enable)
+static int usb_ep_configure(const UsbEndpointDesc *epd, bool enable)
 {
 	int EP;
 	stm32_usb_ep_t *ep_hw;
@@ -767,7 +767,7 @@ static int usb_ep_configure(const usb_endpoint_descriptor_t *epd, bool enable)
 		ep_hw->flags = 0;
 
 		/* Set endpoint type */
-		ep_hw->type = usb_endpoint_type(epd);
+		ep_hw->type = usb_endpointType(epd);
 		/* Init EP max packet size */
 		ep_hw->max_size = epd->wMaxPacketSize;
 
@@ -929,13 +929,13 @@ static void USB_StallCtrlEP(void)
  */
 static int usb_find_interface(uint32_t num, uint32_t alt)
 {
-	const usb_interface_descriptor_t *id;
+	const UsbInterfaceDesc *id;
 	int i;
 
 	for (i = 0; ; i++)
 	{
 		/* TODO: support more than one configuration per device */
-		id = (const usb_interface_descriptor_t *)usb_dev->config[i];
+		id = (const UsbInterfaceDesc *)usb_dev->config[i];
 		if (id == NULL)
 			break;
 		if (id->bDescriptorType != USB_DT_INTERFACE)
@@ -953,7 +953,7 @@ static int usb_find_interface(uint32_t num, uint32_t alt)
 static void
 usb_configure_ep_interface(unsigned int num, unsigned int alt, bool enable)
 {
-	const usb_endpoint_descriptor_t *epd;
+	const UsbEndpointDesc *epd;
 	int i, start;
 
 	/*
@@ -976,7 +976,7 @@ usb_configure_ep_interface(unsigned int num, unsigned int alt, bool enable)
 	 */
 	for (i = start + 1; ; i++)
 	{
-		epd = (const usb_endpoint_descriptor_t *)usb_dev->config[i];
+		epd = (const UsbEndpointDesc *)usb_dev->config[i];
 		if ((epd == NULL) || (epd->bDescriptorType == USB_DT_INTERFACE))
 			break;
 		if (epd->bDescriptorType != USB_DT_ENDPOINT)
@@ -1311,8 +1311,8 @@ static uint8_t usb_cfg_buffer[USB_BUFSIZE];
 
 static int usb_get_configuration_descriptor(int id)
 {
-	const usb_config_descriptor_t **config =
-			(const usb_config_descriptor_t **)usb_dev->config;
+	const UsbConfigDesc **config =
+			(const UsbConfigDesc **)usb_dev->config;
 	uint8_t *p = usb_cfg_buffer;
 	int i;
 
@@ -1331,7 +1331,7 @@ static int usb_get_configuration_descriptor(int id)
 			return -USB_BUF_OVERFLOW;
 		}
 	}
-	((usb_config_descriptor_t *)usb_cfg_buffer)->wTotalLength =
+	((UsbConfigDesc *)usb_cfg_buffer)->wTotalLength =
 					usb_cpu_to_le16(p - usb_cfg_buffer);
 	__usb_ep_write(CTRL_ENP_IN,
 			usb_cfg_buffer,
@@ -1343,7 +1343,7 @@ static int usb_get_configuration_descriptor(int id)
 
 static int usb_get_string_descriptor(unsigned int id)
 {
-	const usb_string_descriptor_t *lang_str;
+	const UsbStringDesc *lang_str;
 	unsigned int lang_id, str_id;
 	uint16_t w_index_lo = usb_le16_to_cpu(setup_packet.wIndex) & 0x00ff;
 	uint16_t w_index_hi = (usb_le16_to_cpu(setup_packet.wIndex) &
@@ -1358,7 +1358,7 @@ static int usb_get_string_descriptor(unsigned int id)
 		/* Find Language index */
 		for (lang_id = 0; ; lang_id++)
 		{
-			const usb_string_descriptor_t *str =
+			const UsbStringDesc *str =
 						usb_dev->strings[lang_id];
 			if (UNLIKELY(str == NULL))
 				return -USB_NODEV_ERROR;
@@ -1423,7 +1423,7 @@ static void UsbGetDescriptor(void)
 }
 
 /* USB setup packet: class/vendor request handler */
-static void usb_event_handler(struct usb_device *dev)
+static void usb_event_handler(UsbDevice *dev)
 {
 	/*
 	 * TODO: get the appropriate usb_dev in function of the endpoint
@@ -1484,14 +1484,14 @@ static void USB_GetConfigurationHandler(void)
 		ep_cnfg[CTRL_ENP_OUT].status = STALLED;
 }
 
-static const usb_config_descriptor_t *usb_find_configuration(int num)
+static const UsbConfigDesc *usb_find_configuration(int num)
 {
-	const usb_config_descriptor_t *cfg;
+	const UsbConfigDesc *cfg;
 	int i;
 
 	for (i = 0; ; i++)
 	{
-		cfg = (const usb_config_descriptor_t *)usb_dev->config[i];
+		cfg = (const UsbConfigDesc *)usb_dev->config[i];
 		if (cfg == NULL)
 			break;
 		if (cfg->bDescriptorType != USB_DT_CONFIG)
@@ -1504,7 +1504,7 @@ static const usb_config_descriptor_t *usb_find_configuration(int num)
 
 static int UsbSetConfigurationState(uint32_t Configuration)
 {
-	const usb_config_descriptor_t *pCnfg;
+	const UsbConfigDesc *pCnfg;
 	unsigned int i;
 
 	if (Configuration)
@@ -1861,7 +1861,7 @@ static void usb_init(void)
 }
 
 /* Register an upper layer USB device into the driver */
-int usb_device_register(struct usb_device *dev)
+int usb_device_register(UsbDevice *dev)
 {
 #if CONFIG_KERN
 	MOD_CHECK(proc);
diff --git a/bertos/drv/usb.h b/bertos/drv/usb.h
index d686c63e..58e5c317 100644
--- a/bertos/drv/usb.h
+++ b/bertos/drv/usb.h
@@ -152,24 +152,24 @@ enum usb_device_state {
  *
  * It matches the different fields of the USB 2.0 spec. section 9.3, table 9-2.
  */
-typedef struct usb_ctrlrequest
+typedef struct UsbCtrlRequest
 {
 	uint8_t mRequestType;
 	uint8_t bRequest;
 	uint16_t wValue;
 	uint16_t wIndex;
 	uint16_t wLength;
-} PACKED usb_ctrlrequest_t;
+} PACKED UsbCtrlRequest;
 
 /* All standard descriptors have these 2 fields at the beginning */
-typedef struct usb_descriptor_header
+typedef struct UsbDescHeader
 {
 	uint8_t bLength;
 	uint8_t bDescriptorType;
-} PACKED usb_descriptor_header_t;
+} PACKED UsbDescHeader;
 
 /* Device descriptor */
-typedef struct usb_device_descriptor
+typedef struct UsbDeviceDesc
 {
 	uint8_t bLength;
 	uint8_t bDescriptorType;
@@ -185,15 +185,15 @@ typedef struct usb_device_descriptor
 	uint8_t iProduct;
 	uint8_t iSerialNumber;
 	uint8_t bNumConfigurations;
-} PACKED usb_device_descriptor_t;
+} PACKED UsbDeviceDesc;
 
 /* USB string descriptor */
-typedef struct usb_string_descriptor
+typedef struct UsbStringDesc
 {
 	uint8_t bLength;
 	uint8_t bDescriptorType;
 	uint8_t data[0];
-} PACKED usb_string_descriptor_t;
+} PACKED UsbStringDesc;
 
 /*
  * Macros to define USB strings
@@ -221,7 +221,7 @@ typedef struct usb_string_descriptor
 
 #define DEFINE_USB_STRING(__name, __text)			\
 	struct {						\
-		usb_descriptor_header_t __header;		\
+		UsbDescHeader __header;		\
 		uint8_t __body[sizeof(__text)];			\
 	} PACKED __name = {					\
 		.__header = {					\
@@ -264,7 +264,7 @@ typedef struct usb_string_descriptor
 #define USB_CDC_SUBCLASS_NCM                    0x0d
 
 /* Device configuration descriptor */
-typedef struct usb_config_descriptor
+typedef struct UsbConfigDesc
 {
 	uint8_t bLength;
 	uint8_t bDescriptorType;
@@ -274,7 +274,7 @@ typedef struct usb_config_descriptor
 	uint8_t iConfiguration;
 	uint8_t bmAttributes;
 	uint8_t bMaxPower;
-} PACKED usb_config_descriptor_t;
+} PACKED UsbConfigDesc;
 
 /* from config descriptor bmAttributes */
 #define USB_CONFIG_ATT_ONE		(1 << 7)	/* must be set */
@@ -283,7 +283,7 @@ typedef struct usb_config_descriptor
 #define USB_CONFIG_ATT_BATTERY		(1 << 4)	/* battery powered */
 
 /* Device interface descriptor */
-typedef struct usb_interface_descriptor
+typedef struct UsbInterfaceDesc
 {
 	uint8_t bLength;
 	uint8_t bDescriptorType;
@@ -294,10 +294,10 @@ typedef struct usb_interface_descriptor
 	uint8_t bInterfaceSubClass;
 	uint8_t bInterfaceProtocol;
 	uint8_t iInterface;
-} PACKED usb_interface_descriptor_t;
+} PACKED UsbInterfaceDesc;
 
 /* Endpoint descriptor */
-typedef struct usb_endpoint_descriptor
+typedef struct UsbEndpointDesc
 {
 	uint8_t bLength;
 	uint8_t bDescriptorType;
@@ -305,7 +305,7 @@ typedef struct usb_endpoint_descriptor
 	uint8_t bmAttributes;
 	uint16_t wMaxPacketSize;
 	uint8_t bInterval;
-} PACKED usb_endpoint_descriptor_t;
+} PACKED UsbEndpointDesc;
 
 /*
  * Endpoints
@@ -327,133 +327,133 @@ typedef struct usb_endpoint_descriptor
 #define USB_ENDPOINT_MAX_ADJUSTABLE	0x80
 
 /* USB: generic device descriptor */
-struct usb_device
+typedef struct UsbDevice
 {
-	usb_device_descriptor_t *device;
-	const usb_descriptor_header_t **config;
-	const usb_string_descriptor_t **strings;
+	UsbDeviceDesc *device;
+	const UsbDescHeader **config;
+	const UsbStringDesc **strings;
 
 	/* Callbacks */
-	void (*event_cb)(usb_ctrlrequest_t *);
+	void (*event_cb)(UsbCtrlRequest *);
 
 	/* Private data */
 	bool configured;
-};
+} UsbDevice;
 
 /*
- * usb_endpoint_num - get the endpoint's number
+ * usb_endpointNum - get the endpoint's number
  */
-INLINE int usb_endpoint_num(const usb_endpoint_descriptor_t *epd)
+INLINE int usb_endpointNum(const UsbEndpointDesc *epd)
 {
 	return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
 }
 
 /*
- * usb_endpoint_type - get the endpoint's transfer type
+ * usb_endpointType - get the endpoint's transfer type
  */
-INLINE int usb_endpoint_type(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointType(const struct UsbEndpointDesc *epd)
 {
 	return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
 }
 
 /*
- * usb_endpoint_dir_in - check if the endpoint has IN direction
+ * usb_endpointDirIn - check if the endpoint has IN direction
  */
-INLINE int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointDirIn(const struct UsbEndpointDesc *epd)
 {
 	return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN);
 }
 
 /*
- * usb_endpoint_dir_out - check if the endpoint has OUT direction
+ * usb_endpointDirOut - check if the endpoint has OUT direction
  */
-INLINE int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointDirOut(const struct UsbEndpointDesc *epd)
 {
 	return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
 }
 
 /*
- * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type
+ * usb_endpointXferBulk - check if the endpoint has bulk transfer type
  */
-INLINE int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointXferBulk(const struct UsbEndpointDesc *epd)
 {
 	return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
 		USB_ENDPOINT_XFER_BULK);
 }
 
 /*
- * usb_endpoint_xfer_control - check if the endpoint has control transfer type
+ * usb_endpointXferControl - check if the endpoint has control transfer type
  */
-INLINE int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointXferControl(const struct UsbEndpointDesc *epd)
 {
 	return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
 		USB_ENDPOINT_XFER_CONTROL);
 }
 
 /*
- * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type
+ * usb_endpointXferInt - check if the endpoint has interrupt transfer type
  */
-INLINE int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointXferInt(const struct UsbEndpointDesc *epd)
 {
 	return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
 		USB_ENDPOINT_XFER_INT);
 }
 
 /*
- * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type
+ * usb_endpointXferIsoc - check if the endpoint has isochronous transfer type
  */
-INLINE int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointXferIsoc(const struct UsbEndpointDesc *epd)
 {
 	return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
 		USB_ENDPOINT_XFER_ISOC);
 }
 
 /*
- * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN
+ * usb_endpointIsBulkIn - check if the endpoint is bulk IN
  */
-INLINE int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointIsBulkIn(const struct UsbEndpointDesc *epd)
 {
-	return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd);
+	return usb_endpointXferBulk(epd) && usb_endpointDirIn(epd);
 }
 
 /*
- * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT
+ * usb_endpointIsBulkOut - check if the endpoint is bulk OUT
  */
-INLINE int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointIsBulkOut(const struct UsbEndpointDesc *epd)
 {
-	return usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd);
+	return usb_endpointXferBulk(epd) && usb_endpointDirOut(epd);
 }
 
 /*
- * usb_endpoint_is_int_in - check if the endpoint is interrupt IN
+ * usb_endpointIsIntIn - check if the endpoint is interrupt IN
  */
-INLINE int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointIsIntIn(const struct UsbEndpointDesc *epd)
 {
-	return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd);
+	return usb_endpointXferInt(epd) && usb_endpointDirIn(epd);
 }
 
 /*
- * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT
+ * usb_endpointIsIntOut - check if the endpoint is interrupt OUT
  */
-INLINE int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointIsIntOut(const struct UsbEndpointDesc *epd)
 {
-	return usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd);
+	return usb_endpointXferInt(epd) && usb_endpointDirOut(epd);
 }
 
 /*
- * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN
+ * usb_endpointIsIsocIn - check if the endpoint is isochronous IN
  */
-INLINE int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointIsIsocIn(const struct UsbEndpointDesc *epd)
 {
-	return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd);
+	return usb_endpointXferIsoc(epd) && usb_endpointDirIn(epd);
 }
 
 /*
- * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT
+ * usb_endpointIsIsocOut - check if the endpoint is isochronous OUT
  */
-INLINE int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd)
+INLINE int usb_endpointIsIsocOut(const struct UsbEndpointDesc *epd)
 {
-	return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
+	return usb_endpointXferIsoc(epd) && usb_endpointDirOut(epd);
 }
 
 /*
@@ -469,6 +469,6 @@ ssize_t usb_ep_write(int ep, const void *buffer, ssize_t size);
 /*
  * usb_device_register - register a generic USB device driver
  */
-int usb_device_register(struct usb_device *dev);
+int usb_device_register(UsbDevice *dev);
 
 #endif /* USB_H */
diff --git a/bertos/drv/usb_keyboard.c b/bertos/drv/usb_keyboard.c
index 46607f4a..fca0eb5e 100644
--- a/bertos/drv/usb_keyboard.c
+++ b/bertos/drv/usb_keyboard.c
@@ -68,7 +68,7 @@
 
 #define USB_HID_REPORT_EP	(USB_DIR_IN | 1)
 
-static usb_device_descriptor_t usb_hid_device_descriptor =
+static UsbDeviceDesc usb_hid_device_descriptor =
 {
 	.bLength = sizeof(usb_hid_device_descriptor),
 	.bDescriptorType = USB_DT_DEVICE,
@@ -85,7 +85,7 @@ static usb_device_descriptor_t usb_hid_device_descriptor =
 	.bNumConfigurations = 1,
 };
 
-static const usb_config_descriptor_t usb_hid_config_descriptor =
+static const UsbConfigDesc usb_hid_config_descriptor =
 {
 	.bLength = sizeof(usb_hid_config_descriptor),
 	.bDescriptorType = USB_DT_CONFIG,
@@ -96,7 +96,7 @@ static const usb_config_descriptor_t usb_hid_config_descriptor =
 	.bMaxPower = 50, /* 100 mA */
 };
 
-static const usb_interface_descriptor_t usb_hid_interface_descriptor =
+static const UsbInterfaceDesc usb_hid_interface_descriptor =
 {
 	.bLength = sizeof(usb_hid_interface_descriptor),
 	.bDescriptorType = USB_DT_INTERFACE,
@@ -162,7 +162,7 @@ static const usb_hid_descriptor_t usb_hid_descriptor =
 	.wDescriptorLength = usb_cpu_to_le16(sizeof(hid_report_descriptor)),
 };
 
-static const usb_endpoint_descriptor_t usb_hid_ep_descriptor =
+static const UsbEndpointDesc usb_hid_ep_descriptor =
 {
 	.bLength = sizeof(usb_hid_ep_descriptor),
 	.bDescriptorType = USB_DT_ENDPOINT,
@@ -172,12 +172,12 @@ static const usb_endpoint_descriptor_t usb_hid_ep_descriptor =
 	.bInterval = 10, /* resolution in ms */
 };
 
-static const usb_descriptor_header_t *usb_hid_config[] =
+static const UsbDescHeader *usb_hid_config[] =
 {
-	(const usb_descriptor_header_t *)&usb_hid_config_descriptor,
-	(const usb_descriptor_header_t *)&usb_hid_interface_descriptor,
-	(const usb_descriptor_header_t *)&usb_hid_descriptor,
-	(const usb_descriptor_header_t *)&usb_hid_ep_descriptor,
+	(const UsbDescHeader *)&usb_hid_config_descriptor,
+	(const UsbDescHeader *)&usb_hid_interface_descriptor,
+	(const UsbDescHeader *)&usb_hid_descriptor,
+	(const UsbDescHeader *)&usb_hid_ep_descriptor,
 	NULL,
 };
 
@@ -188,11 +188,11 @@ static DEFINE_USB_STRING(product_str,
 		USB_STRING("U", "S", "B", " ",
 				"K", "e", "y", "b", "o", "a", "r", "d"));
 
-static const usb_string_descriptor_t *usb_hid_strings[] =
+static const UsbStringDesc *usb_hid_strings[] =
 {
-	(usb_string_descriptor_t *)&language_str,
-	(usb_string_descriptor_t *)&manufacturer_str,
-	(usb_string_descriptor_t *)&product_str,
+	(UsbStringDesc *)&language_str,
+	(UsbStringDesc *)&manufacturer_str,
+	(UsbStringDesc *)&product_str,
 	NULL,
 };
 
@@ -200,7 +200,7 @@ static uint8_t report[8];
 
 static bool hid_keyboard_configured;
 
-static void usb_hid_event_cb(usb_ctrlrequest_t *ctrl)
+static void usb_hid_event_cb(UsbCtrlRequest *ctrl)
 {
 	uint16_t value = usb_le16_to_cpu(ctrl->wValue);
 	uint16_t index = usb_le16_to_cpu(ctrl->wIndex);
@@ -261,7 +261,7 @@ static void usb_hid_event_cb(usb_ctrlrequest_t *ctrl)
 }
 
 /* Global usb-keyboard descriptor that identifies the usb-keyboard device */
-static struct usb_device usb_keyboard = {
+static UsbDevice usb_keyboard = {
 	.device = &usb_hid_device_descriptor,
 	.config = usb_hid_config,
 	.strings = usb_hid_strings,
diff --git a/bertos/drv/usb_mouse.c b/bertos/drv/usb_mouse.c
index abf44f4a..f8e62855 100644
--- a/bertos/drv/usb_mouse.c
+++ b/bertos/drv/usb_mouse.c
@@ -68,7 +68,7 @@
 
 #define USB_HID_REPORT_EP	(USB_DIR_IN | 1)
 
-static usb_device_descriptor_t usb_hid_device_descriptor =
+static UsbDeviceDesc usb_hid_device_descriptor =
 {
 	.bLength = sizeof(usb_hid_device_descriptor),
 	.bDescriptorType = USB_DT_DEVICE,
@@ -85,7 +85,7 @@ static usb_device_descriptor_t usb_hid_device_descriptor =
 	.bNumConfigurations = 1,
 };
 
-static const usb_config_descriptor_t usb_hid_config_descriptor =
+static const UsbConfigDesc usb_hid_config_descriptor =
 {
 	.bLength = sizeof(usb_hid_config_descriptor),
 	.bDescriptorType = USB_DT_CONFIG,
@@ -96,7 +96,7 @@ static const usb_config_descriptor_t usb_hid_config_descriptor =
 	.bMaxPower = 50, /* 100 mA */
 };
 
-static const usb_interface_descriptor_t usb_hid_interface_descriptor =
+static const UsbInterfaceDesc usb_hid_interface_descriptor =
 {
 	.bLength = sizeof(usb_hid_interface_descriptor),
 	.bDescriptorType = USB_DT_INTERFACE,
@@ -151,7 +151,7 @@ static const usb_hid_descriptor_t usb_hid_descriptor =
 	.wDescriptorLength = usb_cpu_to_le16(sizeof(hid_report_descriptor)),
 };
 
-static const usb_endpoint_descriptor_t usb_hid_ep_descriptor =
+static const UsbEndpointDesc usb_hid_ep_descriptor =
 {
 	.bLength = sizeof(usb_hid_ep_descriptor),
 	.bDescriptorType = USB_DT_ENDPOINT,
@@ -161,12 +161,12 @@ static const usb_endpoint_descriptor_t usb_hid_ep_descriptor =
 	.bInterval = 10, /* resolution in ms */
 };
 
-static const usb_descriptor_header_t *usb_hid_config[] =
+static const UsbDescHeader *usb_hid_config[] =
 {
-	(const usb_descriptor_header_t *)&usb_hid_config_descriptor,
-	(const usb_descriptor_header_t *)&usb_hid_interface_descriptor,
-	(const usb_descriptor_header_t *)&usb_hid_descriptor,
-	(const usb_descriptor_header_t *)&usb_hid_ep_descriptor,
+	(const UsbDescHeader *)&usb_hid_config_descriptor,
+	(const UsbDescHeader *)&usb_hid_interface_descriptor,
+	(const UsbDescHeader *)&usb_hid_descriptor,
+	(const UsbDescHeader *)&usb_hid_ep_descriptor,
 	NULL,
 };
 
@@ -176,11 +176,11 @@ static DEFINE_USB_STRING(manufacturer_str,
 static DEFINE_USB_STRING(product_str,
 		USB_STRING("U", "S", "B", " ", "M", "o", "u", "s", "e"));
 
-static const usb_string_descriptor_t *usb_hid_strings[] =
+static const UsbStringDesc *usb_hid_strings[] =
 {
-	(usb_string_descriptor_t *)&language_str,
-	(usb_string_descriptor_t *)&manufacturer_str,
-	(usb_string_descriptor_t *)&product_str,
+	(UsbStringDesc *)&language_str,
+	(UsbStringDesc *)&manufacturer_str,
+	(UsbStringDesc *)&product_str,
 	NULL,
 };
 
@@ -195,7 +195,7 @@ static mouse_report_t report;
 
 static bool hid_mouse_configured;
 
-static void usb_hid_event_cb(usb_ctrlrequest_t *ctrl)
+static void usb_hid_event_cb(UsbCtrlRequest *ctrl)
 {
 	uint16_t value = usb_le16_to_cpu(ctrl->wValue);
 	uint16_t index = usb_le16_to_cpu(ctrl->wIndex);
@@ -252,7 +252,7 @@ static void usb_hid_event_cb(usb_ctrlrequest_t *ctrl)
 }
 
 /* Global usb-mouse descriptor that identifies the usb-mouse device */
-static struct usb_device usb_mouse = {
+static UsbDevice usb_mouse = {
 	.device = &usb_hid_device_descriptor,
 	.config = usb_hid_config,
 	.strings = usb_hid_strings,
diff --git a/bertos/drv/usb_serial.c b/bertos/drv/usb_serial.c
index ce2094b1..fd1ae517 100644
--- a/bertos/drv/usb_serial.c
+++ b/bertos/drv/usb_serial.c
@@ -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 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,
@@ -95,7 +95,7 @@ static const usb_config_descriptor_t usb_serial_config_descriptor =
 	.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,
@@ -108,7 +108,7 @@ static const usb_interface_descriptor_t usb_serial_interface_descriptor =
 	.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,
@@ -118,7 +118,7 @@ static const usb_endpoint_descriptor_t usb_serial_ep_report_descriptor =
 	.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,
@@ -128,7 +128,7 @@ static const usb_endpoint_descriptor_t usb_serial_ep_in_descriptor =
 	.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,
@@ -138,13 +138,13 @@ static const usb_endpoint_descriptor_t usb_serial_ep_out_descriptor =
 	.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,
 };
 
@@ -156,17 +156,17 @@ static DEFINE_USB_STRING(product_str,
 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,