*/
static int usb_find_interface(uint32_t num, uint32_t alt)
{
- usb_interface_descriptor_t *id;
+ const usb_interface_descriptor_t *id;
int i;
for (i = 0; ; i++)
{
/* TODO: support more than one configuration per device */
- id = (usb_interface_descriptor_t *)usb_dev->config[i];
+ id = (const usb_interface_descriptor_t *)usb_dev->config[i];
if (id == NULL)
break;
if (id->bDescriptorType != USB_DT_INTERFACE)
static void
usb_configure_ep_interface(unsigned int num, unsigned int alt, bool enable)
{
- usb_endpoint_descriptor_t *epd;
+ const usb_endpoint_descriptor_t *epd;
int i, start;
/*
*/
for (i = start + 1; ; i++)
{
- epd = (usb_endpoint_descriptor_t *)usb_dev->config[i];
+ epd = (const usb_endpoint_descriptor_t *)usb_dev->config[i];
if ((epd == NULL) || (epd->bDescriptorType == USB_DT_INTERFACE))
break;
if (epd->bDescriptorType != USB_DT_ENDPOINT)
static int usb_get_string_descriptor(unsigned int id)
{
- usb_string_descriptor_t *lang_str;
+ const usb_string_descriptor_t *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) & 0xff00) >> 8;
+ uint16_t w_index_hi = (usb_le16_to_cpu(setup_packet.wIndex) &
+ 0xff00) >> 8;
ASSERT(usb_dev->strings != NULL);
ASSERT(usb_dev->strings[0] != NULL);
/* Find Language index */
for (lang_id = 0; ; lang_id++)
{
- usb_string_descriptor_t *str = usb_dev->strings[lang_id];
-
+ const usb_string_descriptor_t *str =
+ usb_dev->strings[lang_id];
if (UNLIKELY(str == NULL))
return -USB_NODEV_ERROR;
if ((str->data[0] == w_index_lo) &&
.bNumConfigurations = 1,
};
-static usb_config_descriptor_t usb_serial_config_descriptor =
+static const usb_config_descriptor_t usb_serial_config_descriptor =
{
.bLength = sizeof(usb_serial_config_descriptor),
.bDescriptorType = USB_DT_CONFIG,
.bMaxPower = 50, /* 100 mA */
};
-static usb_interface_descriptor_t usb_serial_interface_descriptor =
+static const usb_interface_descriptor_t usb_serial_interface_descriptor =
{
.bLength = sizeof(usb_serial_interface_descriptor),
.bDescriptorType = USB_DT_INTERFACE,
.iInterface = 0,
};
-static usb_endpoint_descriptor_t usb_serial_ep_report_descriptor =
+static const usb_endpoint_descriptor_t usb_serial_ep_report_descriptor =
{
.bLength = sizeof(usb_serial_ep_report_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bInterval = 1,
};
-static usb_endpoint_descriptor_t usb_serial_ep_in_descriptor =
+static const usb_endpoint_descriptor_t usb_serial_ep_in_descriptor =
{
.bLength = sizeof(usb_serial_ep_in_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bInterval = 0,
};
-static usb_endpoint_descriptor_t usb_serial_ep_out_descriptor =
+static const usb_endpoint_descriptor_t usb_serial_ep_out_descriptor =
{
.bLength = sizeof(usb_serial_ep_in_descriptor),
.bDescriptorType = USB_DT_ENDPOINT,
.bInterval = 0,
};
-static usb_descriptor_header_t *usb_serial_config[] =
+static const usb_descriptor_header_t *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 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,
NULL,
};
static DEFINE_USB_STRING(serial_str,
USB_STRING("0", "0", "1"));
-static usb_string_descriptor_t *usb_serial_strings[] =
+static const usb_string_descriptor_t *usb_serial_strings[] =
{
(usb_string_descriptor_t *)&language_str,
(usb_string_descriptor_t *)&manufacturer_str,