This is an automated email from Gerrit. Martin Schmölzer ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/1484
-- gerrit commit 0f0cc0b2a2cc616990da19306c2731183454b783 Author: Martin Schmölzer <[email protected]> Date: Thu Jul 4 20:06:02 2013 +0200 OpenULINK firmware: Use C99 designated struct initializers Recent versions of SDCC added support for C99 designated struct initializers. This provides better code readability (no functional changes). Successfully tested with ULINK probe and STM32F103 (debug, erase and write flash). Change-Id: Idfa35147d2c3043baaa21a811b926b3845c85f9b Signed-off-by: Martin Schmölzer <[email protected]> diff --git a/src/jtag/drivers/OpenULINK/src/usb.c b/src/jtag/drivers/OpenULINK/src/usb.c index 557afff..98ae67f 100644 --- a/src/jtag/drivers/OpenULINK/src/usb.c +++ b/src/jtag/drivers/OpenULINK/src/usb.c @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2011 by Martin Schmoelzer * + * Copyright (C) 2011-2013 by Martin Schmoelzer * * <[email protected]> * * * * This program is free software; you can redistribute it and/or modify * @@ -43,87 +43,72 @@ volatile __xdata __at 0x7FE8 struct setup_data setup_data; * Be sure to include the neccessary endpoint descriptors! */ #define NUM_ENDPOINTS 2 -/* - * Normally, we would initialize the descriptor structures in C99 style: - * - * __code usb_device_descriptor_t device_descriptor = { - * .bLength = foo, - * .bDescriptorType = bar, - * .bcdUSB = 0xABCD, - * ... - * }; - * - * But SDCC currently does not support this, so we have to do it the - * old-fashioned way... - */ - __code struct usb_device_descriptor device_descriptor = { - /* .bLength = */ sizeof(struct usb_device_descriptor), - /* .bDescriptorType = */ DESCRIPTOR_TYPE_DEVICE, - /* .bcdUSB = */ 0x0110, /* BCD: 01.00 (Version 1.0 USB spec) */ - /* .bDeviceClass = */ 0xFF, /* 0xFF = vendor-specific */ - /* .bDeviceSubClass = */ 0xFF, - /* .bDeviceProtocol = */ 0xFF, - /* .bMaxPacketSize0 = */ 64, - /* .idVendor = */ 0xC251, - /* .idProduct = */ 0x2710, - /* .bcdDevice = */ 0x0100, - /* .iManufacturer = */ 1, - /* .iProduct = */ 2, - /* .iSerialNumber = */ 3, - /* .bNumConfigurations = */ 1 + .bLength = sizeof(struct usb_device_descriptor), + .bDescriptorType = DESCRIPTOR_TYPE_DEVICE, + .bcdUSB = 0x0110, /* BCD: 01.00 (Version 1.0 USB spec) */ + .bDeviceClass = 0xFF, /* 0xFF = vendor-specific */ + .bDeviceSubClass = 0xFF, + .bDeviceProtocol = 0xFF, + .bMaxPacketSize0 = 64, + .idVendor = 0xC251, + .idProduct = 0x2710, + .bcdDevice = 0x0100, + .iManufacturer = 1, + .iProduct = 2, + .iSerialNumber = 3, + .bNumConfigurations = 1 }; /* WARNING: ALL config, interface and endpoint descriptors MUST be adjacent! */ __code struct usb_config_descriptor config_descriptor = { - /* .bLength = */ sizeof(struct usb_config_descriptor), - /* .bDescriptorType = */ DESCRIPTOR_TYPE_CONFIGURATION, - /* .wTotalLength = */ sizeof(struct usb_config_descriptor) + - sizeof(struct usb_interface_descriptor) + - (NUM_ENDPOINTS * - sizeof(struct usb_endpoint_descriptor)), - /* .bNumInterfaces = */ 1, - /* .bConfigurationValue = */ 1, - /* .iConfiguration = */ 4, /* String describing this configuration */ - /* .bmAttributes = */ 0x80, /* Only MSB set according to USB spec */ - /* .MaxPower = */ 50 /* 100 mA */ + .bLength = sizeof(struct usb_config_descriptor), + .bDescriptorType = DESCRIPTOR_TYPE_CONFIGURATION, + .wTotalLength = sizeof(struct usb_config_descriptor) + + sizeof(struct usb_interface_descriptor) + + (NUM_ENDPOINTS * sizeof(struct usb_endpoint_descriptor)), + .bNumInterfaces = 1, + .bConfigurationValue = 1, + .iConfiguration = 4, /* String describing this configuration */ + .bmAttributes = 0x80, /* Only MSB set according to USB spec */ + .MaxPower = 50 /* 100 mA */ }; __code struct usb_interface_descriptor interface_descriptor00 = { - /* .bLength = */ sizeof(struct usb_interface_descriptor), - /* .bDescriptorType = */ DESCRIPTOR_TYPE_INTERFACE, - /* .bInterfaceNumber = */ 0, - /* .bAlternateSetting = */ 0, - /* .bNumEndpoints = */ NUM_ENDPOINTS, - /* .bInterfaceClass = */ 0xFF, - /* .bInterfaceSubclass = */ 0xFF, - /* .bInterfaceProtocol = */ 0xFF, - /* .iInterface = */ 0 + .bLength = sizeof(struct usb_interface_descriptor), + .bDescriptorType = DESCRIPTOR_TYPE_INTERFACE, + .bInterfaceNumber = 0, + .bAlternateSetting = 0, + .bNumEndpoints = NUM_ENDPOINTS, + .bInterfaceClass = 0xFF, + .bInterfaceSubclass = 0xFF, + .bInterfaceProtocol = 0xFF, + .iInterface = 0 }; __code struct usb_endpoint_descriptor Bulk_EP2_IN_Endpoint_Descriptor = { - /* .bLength = */ sizeof(struct usb_endpoint_descriptor), - /* .bDescriptorType = */ 0x05, - /* .bEndpointAddress = */ 2 | USB_DIR_IN, - /* .bmAttributes = */ 0x02, - /* .wMaxPacketSize = */ 64, - /* .bInterval = */ 0 + .bLength = sizeof(struct usb_endpoint_descriptor), + .bDescriptorType = 0x05, + .bEndpointAddress = (2 | USB_DIR_IN), + .bmAttributes = 0x02, + .wMaxPacketSize = 64, + .bInterval = 0 }; __code struct usb_endpoint_descriptor Bulk_EP2_OUT_Endpoint_Descriptor = { - /* .bLength = */ sizeof(struct usb_endpoint_descriptor), - /* .bDescriptorType = */ 0x05, - /* .bEndpointAddress = */ 2 | USB_DIR_OUT, - /* .bmAttributes = */ 0x02, - /* .wMaxPacketSize = */ 64, - /* .bInterval = */ 0 + .bLength = sizeof(struct usb_endpoint_descriptor), + .bDescriptorType = 0x05, + .bEndpointAddress = (2 | USB_DIR_OUT), + .bmAttributes = 0x02, + .wMaxPacketSize = 64, + .bInterval = 0 }; __code struct usb_language_descriptor language_descriptor = { - /* .bLength = */ 4, - /* .bDescriptorType = */ DESCRIPTOR_TYPE_STRING, - /* .wLANGID = */ {0x0409 /* US English */} + .bLength = 4, + .bDescriptorType = DESCRIPTOR_TYPE_STRING, + .wLANGID = {0x0409 /* US English */} }; __code struct usb_string_descriptor strManufacturer = -- ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
