projects
/
pub
/
USBasp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Port the device mode demos to the XMEGA architecture where applicable.
[pub/USBasp.git]
/
Bootloaders
/
HID
/
Descriptors.c
diff --git
a/Bootloaders/HID/Descriptors.c
b/Bootloaders/HID/Descriptors.c
index
bbb8214
..
ac27b76
100644
(file)
--- a/
Bootloaders/HID/Descriptors.c
+++ b/
Bootloaders/HID/Descriptors.c
@@
-1,24
+1,24
@@
/*
LUFA Library
/*
LUFA Library
- Copyright (C) Dean Camera, 201
1
.
+ Copyright (C) Dean Camera, 201
3
.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
- Copyright 201
1
Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
+ Copyright 201
3
Dean Camera (dean [at] fourwalledcubicle [dot] com)
+
+ Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
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
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.
software without specific, written prior permission.
- The author disclaim all warranties with regard to this
+ The author disclaim
s
all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
@@
-30,9
+30,9
@@
/** \file
*
/** \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
* 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"
*/
#include "Descriptors.h"
@@
-52,12
+52,12
@@
const USB_Descriptor_HIDReport_Datatype_t HIDReport[] =
HID_RI_LOGICAL_MINIMUM(8, 0x00),
HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
HID_RI_REPORT_SIZE(8, 0x08),
HID_RI_LOGICAL_MINIMUM(8, 0x00),
HID_RI_LOGICAL_MAXIMUM(8, 0xFF),
HID_RI_REPORT_SIZE(8, 0x08),
- HID_RI_REPORT_COUNT(16, (sizeof(uint16_t) + SPM_PAGESIZE)),
+ HID_RI_REPORT_COUNT(16, (sizeof(uint16_t) + SPM_PAGESIZE)),
HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
HID_RI_END_COLLECTION(0),
};
HID_RI_OUTPUT(8, HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE | HID_IOF_NON_VOLATILE),
HID_RI_END_COLLECTION(0),
};
-/** Device descriptor structure. This descriptor, located in
FLASH
memory, describes the overall
+/** Device descriptor structure. This descriptor, located in
SRAM
memory, describes the overall
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
* device characteristics, including the supported USB version, control endpoint size and the
* number of device configurations. The descriptor is read out by the USB host when the enumeration
* process begins.
@@
-84,63
+84,63
@@
const USB_Descriptor_Device_t DeviceDescriptor =
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
-/** Configuration descriptor structure. This descriptor, located in
FLASH
memory, describes the usage
+/** Configuration descriptor structure. This descriptor, located in
SRAM
memory, describes the usage
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t ConfigurationDescriptor =
{
* of the device in one of its supported configurations, including information about any device interfaces
* and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting
* a configuration so that the host may correctly communicate with the USB device.
*/
const USB_Descriptor_Configuration_t ConfigurationDescriptor =
{
- .Config =
+ .Config =
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
{
.Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration},
.TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t),
.TotalInterfaces = 1,
-
+
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
.ConfigurationNumber = 1,
.ConfigurationStrIndex = NO_DESCRIPTOR,
-
- .ConfigAttributes = USB_CONFIG_ATTR_
BUSPOWER
ED,
-
+
+ .ConfigAttributes = USB_CONFIG_ATTR_
RESERV
ED,
+
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
.MaxPowerConsumption = USB_CONFIG_POWER_MA(100)
},
-
- .HID_Interface =
+
+ .HID_Interface =
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
{
.Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface},
.InterfaceNumber = 0x00,
.AlternateSetting = 0x00,
-
+
.TotalEndpoints = 1,
.TotalEndpoints = 1,
-
+
.Class = HID_CSCP_HIDClass,
.SubClass = HID_CSCP_NonBootSubclass,
.Protocol = HID_CSCP_NonBootProtocol,
.Class = HID_CSCP_HIDClass,
.SubClass = HID_CSCP_NonBootSubclass,
.Protocol = HID_CSCP_NonBootProtocol,
-
+
.InterfaceStrIndex = NO_DESCRIPTOR
},
.InterfaceStrIndex = NO_DESCRIPTOR
},
- .HID_VendorHID =
- {
+ .HID_VendorHID =
+ {
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
.Header = {.Size = sizeof(USB_HID_Descriptor_HID_t), .Type = HID_DTYPE_HID},
-
+
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(HIDReport)
},
.HIDSpec = VERSION_BCD(01.11),
.CountryCode = 0x00,
.TotalReportDescriptors = 1,
.HIDReportType = HID_DTYPE_Report,
.HIDReportLength = sizeof(HIDReport)
},
-
- .HID_ReportINEndpoint =
+
+ .HID_ReportINEndpoint =
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
{
.Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint},
- .EndpointAddress =
(ENDPOINT_DIR_IN | HID_IN_EPNUM)
,
+ .EndpointAddress =
HID_IN_EPADDR
,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_IN_EPSIZE,
.Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA),
.EndpointSize = HID_IN_EPSIZE,
- .PollingIntervalMS = 0x0
1
+ .PollingIntervalMS = 0x0
5
},
};
},
};
@@
-158,17
+158,17
@@
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
const void* Address = NULL;
uint16_t Size = NO_DESCRIPTOR;
-
+
/* If/Else If chain compiles slightly smaller than a switch case */
if (DescriptorType == DTYPE_Device)
{
Address = &DeviceDescriptor;
/* If/Else If chain compiles slightly smaller than a switch case */
if (DescriptorType == DTYPE_Device)
{
Address = &DeviceDescriptor;
- Size = sizeof(USB_Descriptor_Device_t);
+ Size = sizeof(USB_Descriptor_Device_t);
}
else if (DescriptorType == DTYPE_Configuration)
{
Address = &ConfigurationDescriptor;
}
else if (DescriptorType == DTYPE_Configuration)
{
Address = &ConfigurationDescriptor;
- Size = sizeof(USB_Descriptor_Configuration_t);
+ Size = sizeof(USB_Descriptor_Configuration_t);
}
else if (DescriptorType == HID_DTYPE_HID)
{
}
else if (DescriptorType == HID_DTYPE_HID)
{
@@
-184,3
+184,4
@@
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
*DescriptorAddress = Address;
return Size;
}
*DescriptorAddress = Address;
return Size;
}
+