diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2012-05-20 17:16:21 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2012-05-20 17:16:21 +0000 |
commit | 5f709e281eec223c5de9766a99bdd54339e149cb (patch) | |
tree | aac4b2e9f666d28d37ca6078afc08926021867f8 /Projects/AVRISP-MKII | |
parent | 28967ef2e8f32e77031eb645970d2fa1a843e255 (diff) | |
parent | 5833b27f80f4b6b10f5765468f5863e57b97a65a (diff) | |
download | lufa-5f709e281eec223c5de9766a99bdd54339e149cb.tar.gz lufa-5f709e281eec223c5de9766a99bdd54339e149cb.tar.bz2 lufa-5f709e281eec223c5de9766a99bdd54339e149cb.zip |
Merge in latest trunk.
Diffstat (limited to 'Projects/AVRISP-MKII')
-rw-r--r-- | Projects/AVRISP-MKII/AVRISP-MKII.c | 21 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/AVRISP-MKII.h | 8 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/AVRISP-MKII.txt | 3 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/AVRISPDescriptors.c (renamed from Projects/AVRISP-MKII/Descriptors.c) | 48 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/AVRISPDescriptors.h (renamed from Projects/AVRISP-MKII/Descriptors.h) | 14 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/Lib/V2Protocol.h | 4 | ||||
-rw-r--r-- | Projects/AVRISP-MKII/makefile | 2 |
7 files changed, 64 insertions, 36 deletions
diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.c b/Projects/AVRISP-MKII/AVRISP-MKII.c index 236a2a878..71b6da7cd 100644 --- a/Projects/AVRISP-MKII/AVRISP-MKII.c +++ b/Projects/AVRISP-MKII/AVRISP-MKII.c @@ -131,3 +131,24 @@ void AVRISP_Task(void) } } +/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" + * documentation) by the application code so that the address and size of a requested descriptor can be given + * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function + * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the + * USB host. + * + * \param[in] wValue Descriptor type and index to retrieve + * \param[in] wIndex Sub-index to retrieve (such as a localized string language) + * \param[out] DescriptorAddress Address of the retrieved descriptor + * \param[out] DescriptorMemorySpace Memory space that the descriptor is stored in + * + * \return Length of the retrieved descriptor in bytes, or NO_DESCRIPTOR if the descriptor was not found + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress, + uint8_t* DescriptorMemorySpace) +{ + return AVRISP_GetDescriptor(wValue, wIndex, DescriptorAddress, DescriptorMemorySpace); +} + diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.h b/Projects/AVRISP-MKII/AVRISP-MKII.h index 86e30d6c8..8f0fabcca 100644 --- a/Projects/AVRISP-MKII/AVRISP-MKII.h +++ b/Projects/AVRISP-MKII/AVRISP-MKII.h @@ -49,7 +49,7 @@ #include <LUFA/Drivers/Peripheral/ADC.h> #endif - #include "Descriptors.h" + #include "AVRISPDescriptors.h" #include "Lib/V2Protocol.h" #include "Config/AppConfig.h" @@ -79,6 +79,12 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); + + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress, + uint8_t* const DescriptorMemorySpace) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3) ATTR_NON_NULL_PTR_ARG(4); #endif diff --git a/Projects/AVRISP-MKII/AVRISP-MKII.txt b/Projects/AVRISP-MKII/AVRISP-MKII.txt index cd1faf094..2cf8ceb47 100644 --- a/Projects/AVRISP-MKII/AVRISP-MKII.txt +++ b/Projects/AVRISP-MKII/AVRISP-MKII.txt @@ -304,6 +304,9 @@ * reset externally via the reset pin, the compatibility mode will be toggled. The compatibility mode is preserved between * power cycles and is not toggled via other forms of reset such as Watchdog or Brown Out. * + * When this option is enabled, all board LEDs will flash twice on startup for Jungo compatibility mode, and five times for + * libUSB compatibility mode. + * * \note This option is incompatible with \c LIBUSB_DRIVER_COMPAT.</td> * </tr> * <tr> diff --git a/Projects/AVRISP-MKII/Descriptors.c b/Projects/AVRISP-MKII/AVRISPDescriptors.c index 0a43dc902..f3381e121 100644 --- a/Projects/AVRISP-MKII/Descriptors.c +++ b/Projects/AVRISP-MKII/AVRISPDescriptors.c @@ -35,7 +35,7 @@ * the device's capabilities and functions. */ -#include "Descriptors.h" +#include "AVRISPDescriptors.h" #if defined(RESET_TOGGLES_LIBUSB_COMPAT) || defined(__DOXYGEN__) static bool AVRISP_NeedCompatibilitySwitch ATTR_NO_INIT; @@ -52,7 +52,7 @@ * number of device configurations. The descriptor is read out by the USB host when the enumeration * process begins. */ -const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = +const USB_Descriptor_Device_t PROGMEM AVRISP_DeviceDescriptor = { .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, @@ -79,13 +79,13 @@ const USB_Descriptor_Device_t PROGMEM DeviceDescriptor = * 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. */ -USB_Descriptor_Configuration_t ConfigurationDescriptor = +AVRISP_USB_Descriptor_Configuration_t AVRISP_ConfigurationDescriptor = { .Config = { .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, - .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalConfigurationSize = sizeof(AVRISP_USB_Descriptor_Configuration_t), .TotalInterfaces = 1, .ConfigurationNumber = 1, @@ -141,7 +141,7 @@ USB_Descriptor_Configuration_t ConfigurationDescriptor = * 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. */ -const USB_Descriptor_String_t PROGMEM LanguageString = +const USB_Descriptor_String_t PROGMEM AVRISP_LanguageString = { .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, @@ -152,7 +152,7 @@ const USB_Descriptor_String_t PROGMEM LanguageString = * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ -const USB_Descriptor_String_t PROGMEM ManufacturerString = +const USB_Descriptor_String_t PROGMEM AVRISP_ManufacturerString = { .Header = {.Size = USB_STRING_LEN(5), .Type = DTYPE_String}, @@ -163,7 +163,7 @@ const USB_Descriptor_String_t PROGMEM ManufacturerString = * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device * Descriptor. */ -const USB_Descriptor_String_t PROGMEM ProductString = +const USB_Descriptor_String_t PROGMEM AVRISP_ProductString = { .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, @@ -173,7 +173,7 @@ const USB_Descriptor_String_t PROGMEM ProductString = /** Serial number string. This is a Unicode string containing the device's unique serial number, expressed as a * series of uppercase hexadecimal digits. */ -const USB_Descriptor_String_t PROGMEM SerialString = +const USB_Descriptor_String_t PROGMEM AVRISP_SerialString = { .Header = {.Size = USB_STRING_LEN(13), .Type = DTYPE_String}, @@ -186,10 +186,10 @@ const USB_Descriptor_String_t PROGMEM SerialString = * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the * USB host. */ -uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint8_t wIndex, - const void** const DescriptorAddress, - uint8_t* DescriptorMemorySpace) +uint16_t AVRISP_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress, + uint8_t* DescriptorMemorySpace) { const uint8_t DescriptorType = (wValue >> 8); const uint8_t DescriptorNumber = (wValue & 0xFF); @@ -202,36 +202,36 @@ uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, switch (DescriptorType) { case DTYPE_Device: - Address = &DeviceDescriptor; + Address = &AVRISP_DeviceDescriptor; Size = sizeof(USB_Descriptor_Device_t); break; case DTYPE_Configuration: *DescriptorMemorySpace = MEMSPACE_RAM; #if defined(RESET_TOGGLES_LIBUSB_COMPAT) - ConfigurationDescriptor.AVRISP_DataInEndpoint.EndpointAddress = AVRISP_CurrDataINEndpointAddress; + AVRISP_ConfigurationDescriptor.AVRISP_DataInEndpoint.EndpointAddress = AVRISP_CurrDataINEndpointAddress; #endif - Address = &ConfigurationDescriptor; - Size = sizeof(USB_Descriptor_Configuration_t); + Address = &AVRISP_ConfigurationDescriptor; + Size = sizeof(AVRISP_USB_Descriptor_Configuration_t); break; case DTYPE_String: switch (DescriptorNumber) { case 0x00: - Address = &LanguageString; - Size = pgm_read_byte(&LanguageString.Header.Size); + Address = &AVRISP_LanguageString; + Size = pgm_read_byte(&AVRISP_LanguageString.Header.Size); break; case 0x01: - Address = &ManufacturerString; - Size = pgm_read_byte(&ManufacturerString.Header.Size); + Address = &AVRISP_ManufacturerString; + Size = pgm_read_byte(&AVRISP_ManufacturerString.Header.Size); break; case 0x02: - Address = &ProductString; - Size = pgm_read_byte(&ProductString.Header.Size); + Address = &AVRISP_ProductString; + Size = pgm_read_byte(&AVRISP_ProductString.Header.Size); break; case 0x03: - Address = &SerialString; - Size = pgm_read_byte(&SerialString.Header.Size); + Address = &AVRISP_SerialString; + Size = pgm_read_byte(&AVRISP_SerialString.Header.Size); break; } diff --git a/Projects/AVRISP-MKII/Descriptors.h b/Projects/AVRISP-MKII/AVRISPDescriptors.h index 1ff25635e..2779e0839 100644 --- a/Projects/AVRISP-MKII/Descriptors.h +++ b/Projects/AVRISP-MKII/AVRISPDescriptors.h @@ -42,8 +42,6 @@ #include <LUFA/Drivers/USB/USB.h> #include <LUFA/Drivers/Board/LEDs.h> - #include "Config/AppConfig.h" - /* Preprocessor Checks: */ #if defined(LIBUSB_DRIVER_COMPAT) && defined(RESET_TOGGLES_LIBUSB_COMPAT) #error LIBUSB_DRIVER_COMPAT and RESET_TOGGLES_LIBUSB_COMPAT are mutually exclusive. @@ -84,7 +82,7 @@ USB_Descriptor_Interface_t AVRISP_Interface; USB_Descriptor_Endpoint_t AVRISP_DataInEndpoint; USB_Descriptor_Endpoint_t AVRISP_DataOutEndpoint; - } USB_Descriptor_Configuration_t; + } AVRISP_USB_Descriptor_Configuration_t; /* External Variables: */ #if defined(RESET_TOGGLES_LIBUSB_COMPAT) @@ -92,11 +90,11 @@ #endif /* Function Prototypes: */ - uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, - const uint8_t wIndex, - const void** const DescriptorAddress, - uint8_t* const DescriptorMemorySpace) - ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3) ATTR_NON_NULL_PTR_ARG(4); + uint16_t AVRISP_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + const void** const DescriptorAddress, + uint8_t* const DescriptorMemorySpace) + ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3) ATTR_NON_NULL_PTR_ARG(4); #if defined(RESET_TOGGLES_LIBUSB_COMPAT) void CheckExternalReset(void) ATTR_NAKED ATTR_INIT_SECTION(3); diff --git a/Projects/AVRISP-MKII/Lib/V2Protocol.h b/Projects/AVRISP-MKII/Lib/V2Protocol.h index 35cd13928..ae69efffd 100644 --- a/Projects/AVRISP-MKII/Lib/V2Protocol.h +++ b/Projects/AVRISP-MKII/Lib/V2Protocol.h @@ -43,10 +43,10 @@ #include <LUFA/Drivers/USB/USB.h> - #include "../Descriptors.h" + #include "../AVRISPDescriptors.h" #include "V2ProtocolConstants.h" #include "V2ProtocolParams.h" -// #include "ISP/ISPProtocol.h" + #include "ISP/ISPProtocol.h" #include "XPROG/XPROGProtocol.h" #include "Config/AppConfig.h" diff --git a/Projects/AVRISP-MKII/makefile b/Projects/AVRISP-MKII/makefile index f3a457e20..c54f4ec74 100644 --- a/Projects/AVRISP-MKII/makefile +++ b/Projects/AVRISP-MKII/makefile @@ -129,7 +129,7 @@ include $(LUFA_PATH)/LUFA/makefile # List C source files here. (C dependencies are automatically generated.) SRC = $(TARGET).c \ - Descriptors.c \ + AVRISPDescriptors.c \ Lib/V2Protocol.c \ Lib/V2ProtocolParams.c \ Lib/ISP/ISPProtocol.c \ |