X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/b2a30cd48a0621b360d23dd430c646d22e943d09..b120c4e4cda5b5ed12a61697b5ab33d4dd0a70e8:/Bootloaders/DFU/Descriptors.c?ds=inline diff --git a/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c index 8db65310a..95f1e4779 100644 --- a/Bootloaders/DFU/Descriptors.c +++ b/Bootloaders/DFU/Descriptors.c @@ -1,21 +1,21 @@ /* LUFA Library Copyright (C) Dean Camera, 2010. - + dean [at] fourwalledcubicle [dot] com - www.fourwalledcubicle.com + www.lufa-lib.org */ /* Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) - Permission to use, copy, modify, distribute, and sell this + Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted - without fee, provided that the above copyright notice appear in + without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this - permission notice and warranty disclaimer appear in supporting - documentation, and that the name of the author not be used in - advertising or publicity pertaining to distribution of the + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaim all warranties with regard to this @@ -30,9 +30,9 @@ /** \file * - * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * USB Device Descriptors, for library use when in USB device mode. Descriptors are special * computer-readable structures which the host requests upon device enumeration, to determine - * the device's capabilities and functions. + * the device's capabilities and functions. */ #include "Descriptors.h" @@ -45,22 +45,22 @@ USB_Descriptor_Device_t DeviceDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, - + .USBSpecification = VERSION_BCD(01.10), - .Class = 0x00, - .SubClass = 0x00, - .Protocol = 0x00, - + .Class = USB_CSCP_NoDeviceClass, + .SubClass = USB_CSCP_NoDeviceSubclass, + .Protocol = USB_CSCP_NoDeviceProtocol, + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, - + .VendorID = 0x03EB, .ProductID = PRODUCT_ID_CODE, - .ReleaseNumber = 0x0000, - + .ReleaseNumber = VERSION_BCD(00.00), + .ManufacturerStrIndex = NO_DESCRIPTOR, .ProductStrIndex = 0x01, .SerialNumStrIndex = NO_DESCRIPTOR, - + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS }; @@ -71,7 +71,7 @@ USB_Descriptor_Device_t DeviceDescriptor = */ USB_Descriptor_Configuration_t ConfigurationDescriptor = { - .Config = + .Config = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, @@ -80,37 +80,37 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor = .ConfigurationNumber = 1, .ConfigurationStrIndex = NO_DESCRIPTOR, - + .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED, - + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) }, - - .DFU_Interface = + + .DFU_Interface = { .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, .InterfaceNumber = 0, .AlternateSetting = 0, - + .TotalEndpoints = 0, - + .Class = 0xFE, .SubClass = 0x01, .Protocol = 0x02, .InterfaceStrIndex = NO_DESCRIPTOR }, - - .DFU_Functional = + + .DFU_Functional = { .Header = {.Size = sizeof(USB_Descriptor_DFU_Functional_t), .Type = DTYPE_DFUFunctional}, - + .Attributes = (ATTR_CAN_UPLOAD | ATTR_CAN_DOWNLOAD), .DetachTimeout = 0x0000, .TransferSize = 0x0c00, - + .DFUSpecification = VERSION_BCD(01.01) } }; @@ -118,11 +118,11 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor = /** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate * via the language ID table available at USB.org what languages the device supports for its string descriptors. - */ + */ USB_Descriptor_String_t LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, - + .UnicodeString = {LANGUAGE_ID_ENG} }; @@ -133,7 +133,7 @@ USB_Descriptor_String_t LanguageString = USB_Descriptor_String_t ProductString = { .Header = {.Size = USB_STRING_LEN(18), .Type = DTYPE_String}, - + .UnicodeString = L"AVR DFU Bootloader" }; @@ -159,11 +159,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, Address = &DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; - case DTYPE_Configuration: + case DTYPE_Configuration: Address = &ConfigurationDescriptor; Size = sizeof(USB_Descriptor_Configuration_t); break; - case DTYPE_String: + case DTYPE_String: if (!(DescriptorNumber)) { Address = &LanguageString; @@ -174,10 +174,11 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, Address = &ProductString; Size = ProductString.Header.Size; } - + break; } - + *DescriptorAddress = Address; return Size; } +