diff options
Diffstat (limited to 'firmware/LUFA/Drivers/USB/HighLevel')
36 files changed, 8894 insertions, 0 deletions
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c b/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c new file mode 100644 index 0000000..977d9e1 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c @@ -0,0 +1,142 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#define __INCLUDE_FROM_USB_DRIVER
+#include "ConfigDescriptor.h"
+
+#if defined(USB_CAN_BE_HOST)
+uint8_t USB_Host_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const ConfigSizePtr,
+ void* BufferPtr, uint16_t BufferSize)
+{
+ uint8_t ErrorCode;
+ uint8_t ConfigHeader[sizeof(USB_Descriptor_Configuration_Header_t)];
+
+ USB_ControlRequest = (USB_Request_Header_t)
+ {
+ .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE),
+ .bRequest = REQ_GetDescriptor,
+ .wValue = ((DTYPE_Configuration << 8) | (ConfigNumber - 1)),
+ .wIndex = 0,
+ .wLength = sizeof(USB_Descriptor_Configuration_Header_t),
+ };
+
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ if ((ErrorCode = USB_Host_SendControlRequest(ConfigHeader)) != HOST_SENDCONTROL_Successful)
+ return ErrorCode;
+
+ *ConfigSizePtr = DESCRIPTOR_PCAST(ConfigHeader, USB_Descriptor_Configuration_Header_t)->TotalConfigurationSize;
+
+ if (*ConfigSizePtr > BufferSize)
+ return HOST_GETCONFIG_BuffOverflow;
+
+ USB_ControlRequest.wLength = *ConfigSizePtr;
+
+ if ((ErrorCode = USB_Host_SendControlRequest(BufferPtr)) != HOST_SENDCONTROL_Successful)
+ return ErrorCode;
+
+ if (DESCRIPTOR_TYPE(BufferPtr) != DTYPE_Configuration)
+ return HOST_GETCONFIG_InvalidData;
+
+ return HOST_GETCONFIG_Successful;
+}
+#endif
+
+void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
+ void** const CurrConfigLoc,
+ const uint8_t Type)
+{
+ while (*BytesRem)
+ {
+ USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
+
+ if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type)
+ return;
+ }
+}
+
+void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,
+ void** const CurrConfigLoc,
+ const uint8_t Type,
+ const uint8_t BeforeType)
+{
+ while (*BytesRem)
+ {
+ USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
+
+ if (DESCRIPTOR_TYPE(*CurrConfigLoc) == Type)
+ {
+ return;
+ }
+ else if (DESCRIPTOR_TYPE(*CurrConfigLoc) == BeforeType)
+ {
+ *BytesRem = 0;
+ return;
+ }
+ }
+}
+
+void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
+ void** const CurrConfigLoc,
+ const uint8_t Type,
+ const uint8_t AfterType)
+{
+ USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, AfterType);
+
+ if (*BytesRem)
+ USB_GetNextDescriptorOfType(BytesRem, CurrConfigLoc, Type);
+}
+
+uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem, void** const CurrConfigLoc, ConfigComparatorPtr_t const ComparatorRoutine)
+{
+ uint8_t ErrorCode;
+
+ while (*BytesRem)
+ {
+ uint8_t* PrevDescLoc = *CurrConfigLoc;
+ uint16_t PrevBytesRem = *BytesRem;
+
+ USB_GetNextDescriptor(BytesRem, CurrConfigLoc);
+
+ if ((ErrorCode = ComparatorRoutine(*CurrConfigLoc)) != DESCRIPTOR_SEARCH_NotFound)
+ {
+ if (ErrorCode == DESCRIPTOR_SEARCH_Fail)
+ {
+ *CurrConfigLoc = PrevDescLoc;
+ *BytesRem = PrevBytesRem;
+ }
+
+ return ErrorCode;
+ }
+ }
+
+ return DESCRIPTOR_SEARCH_COMP_EndOfDescriptor;
+}
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h b/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h new file mode 100644 index 0000000..dc33391 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.h @@ -0,0 +1,287 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief Configuration descriptor parser API.
+ *
+ * This section of the library gives a friendly API which can be used in host applications to easily
+ * parse an attached device's configuration descriptor so that endpoint, interface and other descriptor
+ * data can be extracted and used as needed.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+/** \ingroup Group_Descriptors
+ * @defgroup Group_ConfigDescriptorParser Configuration Descriptor Parser
+ *
+ * Functions, macros, variables, enums and types related to the parsing of Configuration Descriptors.
+ *
+ * @{
+ */
+
+#ifndef __CONFIGDESCRIPTOR_H__
+#define __CONFIGDESCRIPTOR_H__
+
+ /* Includes: */
+ #include <stdint.h>
+
+ #include "../../../Common/Common.h"
+ #include "HostStandardReq.h"
+ #include "USBMode.h"
+ #include "StdDescriptors.h"
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared
+ * with the EP_TYPE_* masks to determine the exact type of the endpoint.
+ */
+ #define EP_TYPE_MASK 0x03
+
+ /** Casts a pointer to a descriptor inside the configuration descriptor into a pointer to the given
+ * descriptor type.
+ *
+ * Usage Example:
+ * \code
+ * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header
+ * USB_Descriptor_Configuration_Header_t* ConfigHeaderPtr = DESCRIPTOR_PCAST(CurrDescriptor,
+ * USB_Descriptor_Configuration_Header_t);
+ *
+ * // Can now access elements of the configuration header struct using the -> indirection operator
+ * \endcode
+ */
+ #define DESCRIPTOR_PCAST(DescriptorPtr, Type) ((Type*)(DescriptorPtr))
+
+ /** Casts a pointer to a descriptor inside the configuration descriptor into the given descriptor
+ * type (as an actual struct instance rather than a pointer to a struct).
+ *
+ * Usage Example:
+ * \code
+ * uint8_t* CurrDescriptor = &ConfigDescriptor[0]; // Pointing to the configuration header
+ * USB_Descriptor_Configuration_Header_t ConfigHeader = DESCRIPTOR_CAST(CurrDescriptor,
+ * USB_Descriptor_Configuration_Header_t);
+ *
+ * // Can now access elements of the configuration header struct using the . operator
+ * \endcode
+ */
+ #define DESCRIPTOR_CAST(DescriptorPtr, Type) (*DESCRIPTOR_PCAST(DescriptorPtr, Type))
+
+ /** Returns the descriptor's type, expressed as the 8-bit type value in the header of the descriptor.
+ * This value's meaning depends on the descriptor's placement in the descriptor, but standard type
+ * values can be accessed in the \ref USB_DescriptorTypes_t enum.
+ */
+ #define DESCRIPTOR_TYPE(DescriptorPtr) DESCRIPTOR_PCAST(DescriptorPtr, USB_Descriptor_Header_t)->Type
+
+ /** Returns the descriptor's size, expressed as the 8-bit value indicating the number of bytes. */
+ #define DESCRIPTOR_SIZE(DescriptorPtr) DESCRIPTOR_PCAST(DescriptorPtr, USB_Descriptor_Header_t)->Size
+
+ /* Type Defines: */
+ /** Type define for a Configuration Descriptor comparator function (function taking a pointer to an array
+ * of type void, returning a uint8_t value).
+ *
+ * \see \ref USB_GetNextDescriptorComp function for more details.
+ */
+ typedef uint8_t (* ConfigComparatorPtr_t)(void*);
+
+ /* Enums: */
+ /** Enum for the possible return codes of the \ref USB_Host_GetDeviceConfigDescriptor() function. */
+ enum USB_Host_GetConfigDescriptor_ErrorCodes_t
+ {
+ HOST_GETCONFIG_Successful = 0, /**< No error occurred while retrieving the configuration descriptor. */
+ HOST_GETCONFIG_DeviceDisconnect = 1, /**< The attached device was disconnected while retrieving the configuration
+ * descriptor.
+ */
+ HOST_GETCONFIG_PipeError = 2, /**< An error occurred in the pipe while sending the request. */
+ HOST_GETCONFIG_SetupStalled = 3, /**< The attached device stalled the request to retrieve the configuration
+ * descriptor.
+ */
+ HOST_GETCONFIG_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */
+ HOST_GETCONFIG_BuffOverflow = 5, /**< The device's configuration descriptor is too large to fit into the allocated
+ * buffer.
+ */
+ HOST_GETCONFIG_InvalidData = 6, /**< The device returned invalid configuration descriptor data. */
+ };
+
+ /** Enum for return values of a descriptor comparator function. */
+ enum DSearch_Return_ErrorCodes_t
+ {
+ DESCRIPTOR_SEARCH_Found = 0, /**< Current descriptor matches comparator criteria. */
+ DESCRIPTOR_SEARCH_Fail = 1, /**< No further descriptor could possibly match criteria, fail the search. */
+ DESCRIPTOR_SEARCH_NotFound = 2, /**< Current descriptor does not match comparator criteria. */
+ };
+
+ /** Enum for return values of \ref USB_GetNextDescriptorComp(). */
+ enum DSearch_Comp_Return_ErrorCodes_t
+ {
+ DESCRIPTOR_SEARCH_COMP_Found = 0, /**< Configuration descriptor now points to descriptor which matches
+ * search criteria of the given comparator function. */
+ DESCRIPTOR_SEARCH_COMP_Fail = 1, /**< Comparator function returned Descriptor_Search_Fail. */
+ DESCRIPTOR_SEARCH_COMP_EndOfDescriptor = 2, /**< End of configuration descriptor reached before match found. */
+ };
+
+ /* Function Prototypes: */
+ /** Retrieves the configuration descriptor data from an attached device via a standard request into a buffer,
+ * including validity and size checking to prevent a buffer overflow.
+ *
+ * \param[in] ConfigNumber Device configuration descriptor number to fetch from the device (usually set to 1 for
+ * single configuration devices).
+ * \param[in,out] ConfigSizePtr Pointer to a uint16_t for storing the retrieved configuration descriptor size.
+ * \param[out] BufferPtr Pointer to the buffer for storing the configuration descriptor data.
+ * \param[out] BufferSize Size of the allocated buffer where the configuration descriptor is to be stored.
+ *
+ * \return A value from the \ref USB_Host_GetConfigDescriptor_ErrorCodes_t enum.
+ */
+ uint8_t USB_Host_GetDeviceConfigDescriptor(uint8_t ConfigNumber, uint16_t* const ConfigSizePtr, void* BufferPtr,
+ uint16_t BufferSize) ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(3);
+
+ /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value.
+ * The bytes remaining value is automatically decremented.
+ *
+ * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor.
+ * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
+ * \param[in] Type Descriptor type value to search for.
+ */
+ void USB_GetNextDescriptorOfType(uint16_t* const BytesRem,
+ void** const CurrConfigLoc,
+ const uint8_t Type)
+ ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
+
+ /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value,
+ * which must come before a descriptor of the second given type value. If the BeforeType type
+ * descriptor is reached first, the number of bytes remaining to process is set to zero and the
+ * function exits. The bytes remaining value is automatically decremented.
+ *
+ * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor.
+ * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
+ * \param[in] Type Descriptor type value to search for.
+ * \param[in] BeforeType Descriptor type value which must not be reached before the given Type descriptor.
+ */
+ void USB_GetNextDescriptorOfTypeBefore(uint16_t* const BytesRem,
+ void** const CurrConfigLoc,
+ const uint8_t Type,
+ const uint8_t BeforeType)
+ ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
+
+ /** Skips to the next sub-descriptor inside the configuration descriptor of the specified type value,
+ * which must come after a descriptor of the second given type value. The bytes remaining value is
+ * automatically decremented.
+ *
+ * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor.
+ * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
+ * \param[in] Type Descriptor type value to search for.
+ * \param[in] AfterType Descriptor type value which must be reached before the given Type descriptor.
+ */
+ void USB_GetNextDescriptorOfTypeAfter(uint16_t* const BytesRem,
+ void** const CurrConfigLoc,
+ const uint8_t Type,
+ const uint8_t AfterType)
+ ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
+
+ /** Searches for the next descriptor in the given configuration descriptor using a pre-made comparator
+ * function. The routine updates the position and remaining configuration descriptor bytes values
+ * automatically. If a comparator routine fails a search, the descriptor pointer is retreated back
+ * so that the next descriptor search invocation will start from the descriptor which first caused the
+ * original search to fail. This behaviour allows for one comparator to be used immediately after another
+ * has failed, starting the second search from the descriptor which failed the first.
+ *
+ * Comparator functions should be standard functions which accept a pointer to the header of the current
+ * descriptor inside the configuration descriptor which is being compared, and should return a value from
+ * the \ref DSearch_Return_ErrorCodes_t enum as a uint8_t value.
+ *
+ * \note This function is available in USB Host mode only.
+ *
+ * \param[in,out] BytesRem Pointer to an int storing the remaining bytes in the configuration descriptor.
+ * \param[in,out] CurrConfigLoc Pointer to the current position in the configuration descriptor.
+ * \param[in] ComparatorRoutine Name of the comparator search function to use on the configuration descriptor.
+ *
+ * \return Value of one of the members of the \ref DSearch_Comp_Return_ErrorCodes_t enum.
+ *
+ * Usage Example:
+ * \code
+ * uint8_t EndpointSearcher(void* CurrentDescriptor); // Comparator Prototype
+ *
+ * uint8_t EndpointSearcher(void* CurrentDescriptor)
+ * {
+ * if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Endpoint)
+ * return DESCRIPTOR_SEARCH_Found;
+ * else
+ * return DESCRIPTOR_SEARCH_NotFound;
+ * }
+ *
+ * //...
+ * // After retrieving configuration descriptor:
+ * if (USB_Host_GetNextDescriptorComp(&BytesRemaining, &CurrentConfigLoc, EndpointSearcher) ==
+ * Descriptor_Search_Comp_Found)
+ * {
+ * // Do something with the endpoint descriptor
+ * }
+ * \endcode
+ */
+ uint8_t USB_GetNextDescriptorComp(uint16_t* const BytesRem,
+ void** const CurrConfigLoc,
+ ConfigComparatorPtr_t const ComparatorRoutine);
+
+ /* Inline Functions: */
+ /** Skips over the current sub-descriptor inside the configuration descriptor, so that the pointer then
+ points to the next sub-descriptor. The bytes remaining value is automatically decremented.
+ *
+ * \param[in,out] BytesRem Pointer to the number of bytes remaining of the configuration descriptor.
+ * \param[in,out] CurrConfigLoc Pointer to the current descriptor inside the configuration descriptor.
+ */
+ static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
+ void** CurrConfigLoc) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
+ static inline void USB_GetNextDescriptor(uint16_t* const BytesRem,
+ void** CurrConfigLoc)
+ {
+ uint16_t CurrDescriptorSize = DESCRIPTOR_CAST(*CurrConfigLoc, USB_Descriptor_Header_t).Size;
+
+ *CurrConfigLoc = ((uint8_t*)*CurrConfigLoc) + CurrDescriptorSize;
+ *BytesRem -= CurrDescriptorSize;
+ }
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
+
+/** @} */
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.lst b/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.lst new file mode 100644 index 0000000..d2407d9 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.lst @@ -0,0 +1,306 @@ + 1 .file "ConfigDescriptor.c" + 2 __SREG__ = 0x3f + 3 __SP_H__ = 0x3e + 4 __SP_L__ = 0x3d + 5 __CCP__ = 0x34 + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 15 .Ltext0: + 16 .section .text.USB_GetNextDescriptorOfType,"ax",@progbits + 17 .global USB_GetNextDescriptorOfType + 19 USB_GetNextDescriptorOfType: + 20 .LFB69: + 21 .LSM0: + 22 .LVL0: + 23 0000 CF93 push r28 + 24 0002 DF93 push r29 + 25 /* prologue: function */ + 26 /* frame size = 0 */ + 27 0004 EC01 movw r28,r24 + 28 0006 DB01 movw r26,r22 + 29 0008 00C0 rjmp .L2 + 30 .LVL1: + 31 .L4: + 32 .LBB9: + 33 .LBB10: + 34 .LSM1: + 35 000a ED91 ld r30,X+ + 36 000c FC91 ld r31,X + 37 000e 1197 sbiw r26,1 + 38 0010 2081 ld r18,Z + 39 .LVL2: + 40 0012 30E0 ldi r19,lo8(0) + 41 .LSM2: + 42 0014 E20F add r30,r18 + 43 0016 F31F adc r31,r19 + 44 .LVL3: + 45 0018 1196 adiw r26,1 + 46 001a FC93 st X,r31 + 47 001c EE93 st -X,r30 + 48 .LSM3: + 49 001e 8881 ld r24,Y + 50 0020 9981 ldd r25,Y+1 + 51 0022 821B sub r24,r18 + 52 0024 930B sbc r25,r19 + 53 0026 9983 std Y+1,r25 + 54 0028 8883 st Y,r24 + 55 .LBE10: + 56 .LBE9: + 57 .LSM4: + 58 002a ED91 ld r30,X+ + 59 002c FC91 ld r31,X + 60 002e 1197 sbiw r26,1 + 61 0030 8181 ldd r24,Z+1 + 62 0032 8417 cp r24,r20 + 63 0034 01F0 breq .L5 + 64 .LVL4: + 65 .L2: + 66 .LSM5: + 67 0036 8881 ld r24,Y + 68 0038 9981 ldd r25,Y+1 + 69 003a 892B or r24,r25 + 70 003c 01F4 brne .L4 + 71 .L5: + 72 /* epilogue start */ + 73 .LSM6: + 74 003e DF91 pop r29 + 75 0040 CF91 pop r28 + 76 .LVL5: + 77 0042 0895 ret + 78 .LFE69: + 80 .section .text.USB_GetNextDescriptorOfTypeBefore,"ax",@progbits + 81 .global USB_GetNextDescriptorOfTypeBefore + 83 USB_GetNextDescriptorOfTypeBefore: + 84 .LFB70: + 85 .LSM7: + 86 .LVL6: + 87 0000 CF93 push r28 + 88 0002 DF93 push r29 + 89 /* prologue: function */ + 90 /* frame size = 0 */ + 91 0004 DC01 movw r26,r24 + 92 0006 EB01 movw r28,r22 + 93 0008 522F mov r21,r18 + 94 000a 00C0 rjmp .L7 + 95 .LVL7: + 96 .L9: + 97 .LBB11: + 98 .LBB12: + 99 .LSM8: + 100 000c E881 ld r30,Y + 101 000e F981 ldd r31,Y+1 + 102 0010 2081 ld r18,Z + 103 .LVL8: + 104 0012 30E0 ldi r19,lo8(0) + 105 .LSM9: + 106 0014 E20F add r30,r18 + 107 0016 F31F adc r31,r19 + 108 .LVL9: + 109 0018 F983 std Y+1,r31 + 110 001a E883 st Y,r30 + 111 .LSM10: + 112 001c 8D91 ld r24,X+ + 113 001e 9C91 ld r25,X + 114 0020 1197 sbiw r26,1 + 115 0022 821B sub r24,r18 + 116 0024 930B sbc r25,r19 + 117 0026 1196 adiw r26,1 + 118 0028 9C93 st X,r25 + 119 002a 8E93 st -X,r24 + 120 .LBE12: + 121 .LBE11: + 122 .LSM11: + 123 002c E881 ld r30,Y + 124 002e F981 ldd r31,Y+1 + 125 0030 8181 ldd r24,Z+1 + 126 0032 8417 cp r24,r20 + 127 0034 01F0 breq .L10 + 128 .LSM12: + 129 0036 8517 cp r24,r21 + 130 0038 01F4 brne .L7 + 131 .LSM13: + 132 003a 1D92 st X+,__zero_reg__ + 133 003c 1C92 st X,__zero_reg__ + 134 003e 00C0 rjmp .L10 + 135 .LVL10: + 136 .L7: + 137 .LSM14: + 138 0040 8D91 ld r24,X+ + 139 0042 9C91 ld r25,X + 140 0044 1197 sbiw r26,1 + 141 0046 892B or r24,r25 + 142 0048 01F4 brne .L9 + 143 .L10: + 144 /* epilogue start */ + 145 .LSM15: + 146 004a DF91 pop r29 + 147 004c CF91 pop r28 + 148 .LVL11: + 149 004e 0895 ret + 150 .LFE70: + 152 .section .text.USB_GetNextDescriptorOfTypeAfter,"ax",@progbits + 153 .global USB_GetNextDescriptorOfTypeAfter + 155 USB_GetNextDescriptorOfTypeAfter: + 156 .LFB71: + 157 .LSM16: + 158 .LVL12: + 159 0000 FF92 push r15 + 160 0002 0F93 push r16 + 161 0004 1F93 push r17 + 162 0006 CF93 push r28 + 163 0008 DF93 push r29 + 164 /* prologue: function */ + 165 /* frame size = 0 */ + 166 000a EC01 movw r28,r24 + 167 000c 8B01 movw r16,r22 + 168 000e F42E mov r15,r20 + 169 .LSM17: + 170 0010 422F mov r20,r18 + 171 .LVL13: + 172 0012 0E94 0000 call USB_GetNextDescriptorOfType + 173 .LVL14: + 174 .LSM18: + 175 0016 8881 ld r24,Y + 176 0018 9981 ldd r25,Y+1 + 177 001a 892B or r24,r25 + 178 001c 01F0 breq .L14 + 179 .LSM19: + 180 001e CE01 movw r24,r28 + 181 0020 B801 movw r22,r16 + 182 0022 4F2D mov r20,r15 + 183 0024 0E94 0000 call USB_GetNextDescriptorOfType + 184 .L14: + 185 /* epilogue start */ + 186 .LSM20: + 187 0028 DF91 pop r29 + 188 002a CF91 pop r28 + 189 .LVL15: + 190 002c 1F91 pop r17 + 191 002e 0F91 pop r16 + 192 .LVL16: + 193 0030 FF90 pop r15 + 194 .LVL17: + 195 0032 0895 ret + 196 .LFE71: + 198 .section .text.USB_GetNextDescriptorComp,"ax",@progbits + 199 .global USB_GetNextDescriptorComp + 201 USB_GetNextDescriptorComp: + 202 .LFB72: + 203 .LSM21: + 204 .LVL18: + 205 0000 AF92 push r10 + 206 0002 BF92 push r11 + 207 0004 CF92 push r12 + 208 0006 DF92 push r13 + 209 0008 EF92 push r14 + 210 000a FF92 push r15 + 211 000c 0F93 push r16 + 212 000e 1F93 push r17 + 213 0010 CF93 push r28 + 214 0012 DF93 push r29 + 215 /* prologue: function */ + 216 /* frame size = 0 */ + 217 0014 7C01 movw r14,r24 + 218 0016 8B01 movw r16,r22 + 219 0018 5A01 movw r10,r20 + 220 001a 00C0 rjmp .L16 + 221 .LVL19: + 222 .L19: + 223 .LBB13: + 224 .LSM22: + 225 001c F801 movw r30,r16 + 226 001e C081 ld r28,Z + 227 0020 D181 ldd r29,Z+1 + 228 .LBB14: + 229 .LBB15: + 230 .LSM23: + 231 0022 8881 ld r24,Y + 232 .LVL20: + 233 0024 90E0 ldi r25,lo8(0) + 234 .LVL21: + 235 .LSM24: + 236 0026 9E01 movw r18,r28 + 237 0028 280F add r18,r24 + 238 002a 391F adc r19,r25 + 239 .LVL22: + 240 002c 3183 std Z+1,r19 + 241 002e 2083 st Z,r18 + 242 .LSM25: + 243 0030 F701 movw r30,r14 + 244 0032 2081 ld r18,Z + 245 0034 3181 ldd r19,Z+1 + 246 0036 281B sub r18,r24 + 247 0038 390B sbc r19,r25 + 248 003a 3183 std Z+1,r19 + 249 003c 2083 st Z,r18 + 250 .LBE15: + 251 .LBE14: + 252 .LSM26: + 253 003e F801 movw r30,r16 + 254 0040 8081 ld r24,Z + 255 0042 9181 ldd r25,Z+1 + 256 .LVL23: + 257 0044 F501 movw r30,r10 + 258 0046 0995 icall + 259 .LVL24: + 260 0048 8230 cpi r24,lo8(2) + 261 .LVL25: + 262 004a 01F0 breq .L16 + 263 .LSM27: + 264 004c 8130 cpi r24,lo8(1) + 265 004e 01F4 brne .L18 + 266 .LSM28: + 267 0050 F801 movw r30,r16 + 268 0052 C083 st Z,r28 + 269 0054 D183 std Z+1,r29 + 270 .LSM29: + 271 0056 F701 movw r30,r14 + 272 0058 D182 std Z+1,r13 + 273 005a C082 st Z,r12 + 274 005c 00C0 rjmp .L18 + 275 .LVL26: + 276 .L16: + 277 .LBE13: + 278 .LSM30: + 279 005e F701 movw r30,r14 + 280 0060 C080 ld r12,Z + 281 0062 D180 ldd r13,Z+1 + 282 0064 C114 cp r12,__zero_reg__ + 283 0066 D104 cpc r13,__zero_reg__ + 284 0068 01F4 brne .L19 + 285 006a 82E0 ldi r24,lo8(2) + 286 .LVL27: + 287 .L18: + 288 .LVL28: + 289 /* epilogue start */ + 290 .LSM31: + 291 006c DF91 pop r29 + 292 006e CF91 pop r28 + 293 0070 1F91 pop r17 + 294 0072 0F91 pop r16 + 295 .LVL29: + 296 0074 FF90 pop r15 + 297 0076 EF90 pop r14 + 298 .LVL30: + 299 0078 DF90 pop r13 + 300 007a CF90 pop r12 + 301 007c BF90 pop r11 + 302 007e AF90 pop r10 + 303 .LVL31: + 304 0080 0895 ret + 305 .LFE72: + 355 .Letext0: +DEFINED SYMBOLS + *ABS*:0000000000000000 ConfigDescriptor.c + /tmp/cc806buQ.s:2 *ABS*:000000000000003f __SREG__ + /tmp/cc806buQ.s:3 *ABS*:000000000000003e __SP_H__ + /tmp/cc806buQ.s:4 *ABS*:000000000000003d __SP_L__ + /tmp/cc806buQ.s:5 *ABS*:0000000000000034 __CCP__ + /tmp/cc806buQ.s:6 *ABS*:0000000000000000 __tmp_reg__ + /tmp/cc806buQ.s:7 *ABS*:0000000000000001 __zero_reg__ + /tmp/cc806buQ.s:19 .text.USB_GetNextDescriptorOfType:0000000000000000 USB_GetNextDescriptorOfType + /tmp/cc806buQ.s:83 .text.USB_GetNextDescriptorOfTypeBefore:0000000000000000 USB_GetNextDescriptorOfTypeBefore + /tmp/cc806buQ.s:155 .text.USB_GetNextDescriptorOfTypeAfter:0000000000000000 USB_GetNextDescriptorOfTypeAfter + /tmp/cc806buQ.s:201 .text.USB_GetNextDescriptorComp:0000000000000000 USB_GetNextDescriptorComp + +NO UNDEFINED SYMBOLS diff --git a/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.o b/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.o Binary files differnew file mode 100644 index 0000000..0173c2f --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.o diff --git a/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c b/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c new file mode 100644 index 0000000..a27151e --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c @@ -0,0 +1,382 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#define __INCLUDE_FROM_USB_DRIVER
+#include "USBMode.h"
+
+#if defined(USB_CAN_BE_DEVICE)
+
+#define __INCLUDE_FROM_DEVICESTDREQ_C
+#include "DeviceStandardReq.h"
+
+uint8_t USB_ConfigurationNumber;
+
+#if !defined(NO_DEVICE_SELF_POWER)
+bool USB_CurrentlySelfPowered;
+#endif
+
+#if !defined(NO_DEVICE_REMOTE_WAKEUP)
+bool USB_RemoteWakeupEnabled;
+#endif
+
+void USB_Device_ProcessControlRequest(void)
+{
+ uint8_t* RequestHeader = (uint8_t*)&USB_ControlRequest;
+
+ for (uint8_t RequestHeaderByte = 0; RequestHeaderByte < sizeof(USB_Request_Header_t); RequestHeaderByte++)
+ *(RequestHeader++) = Endpoint_Read_Byte();
+
+ EVENT_USB_Device_ControlRequest();
+
+ if (Endpoint_IsSETUPReceived())
+ {
+ uint8_t bmRequestType = USB_ControlRequest.bmRequestType;
+
+ switch (USB_ControlRequest.bRequest)
+ {
+ case REQ_GetStatus:
+ if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) ||
+ (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT)))
+ {
+ USB_Device_GetStatus();
+ }
+
+ break;
+ case REQ_ClearFeature:
+ case REQ_SetFeature:
+ if ((bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) ||
+ (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT)))
+ {
+ USB_Device_ClearSetFeature();
+ }
+
+ break;
+ case REQ_SetAddress:
+ if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE))
+ USB_Device_SetAddress();
+
+ break;
+ case REQ_GetDescriptor:
+ if ((bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) ||
+ (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE)))
+ {
+ USB_Device_GetDescriptor();
+ }
+
+ break;
+ case REQ_GetConfiguration:
+ if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE))
+ USB_Device_GetConfiguration();
+
+ break;
+ case REQ_SetConfiguration:
+ if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE))
+ USB_Device_SetConfiguration();
+
+ break;
+ }
+ }
+
+ if (Endpoint_IsSETUPReceived())
+ {
+ Endpoint_StallTransaction();
+ Endpoint_ClearSETUP();
+ }
+}
+
+static void USB_Device_SetAddress(void)
+{
+ uint8_t DeviceAddress = (USB_ControlRequest.wValue & 0x7F);
+
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ {
+ Endpoint_ClearSETUP();
+
+ Endpoint_ClearStatusStage();
+
+ while (!(Endpoint_IsINReady()));
+
+ USB_DeviceState = (DeviceAddress) ? DEVICE_STATE_Addressed : DEVICE_STATE_Default;
+
+ USB_Device_SetDeviceAddress(DeviceAddress);
+ }
+}
+
+static void USB_Device_SetConfiguration(void)
+{
+ #if defined(FIXED_NUM_CONFIGURATIONS)
+ if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS)
+ return;
+ #else
+ USB_Descriptor_Device_t* DevDescriptorPtr;
+
+ #if defined(USE_FLASH_DESCRIPTORS)
+ #define MemoryAddressSpace MEMSPACE_FLASH
+ #elif defined(USE_EEPROM_DESCRIPTORS)
+ #define MemoryAddressSpace MEMSPACE_EEPROM
+ #elif defined(USE_SRAM_DESCRIPTORS)
+ #define MemoryAddressSpace MEMSPACE_SRAM
+ #else
+ uint8_t MemoryAddressSpace;
+ #endif
+
+ if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DevDescriptorPtr
+ #if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
+ , &MemoryAddressSpace
+ #endif
+ ) == NO_DESCRIPTOR)
+ {
+ return;
+ }
+
+ if (MemoryAddressSpace == MEMSPACE_FLASH)
+ {
+ if (((uint8_t)USB_ControlRequest.wValue > pgm_read_byte(&DevDescriptorPtr->NumberOfConfigurations)))
+ return;
+ }
+ else if (MemoryAddressSpace == MEMSPACE_EEPROM)
+ {
+ if (((uint8_t)USB_ControlRequest.wValue > eeprom_read_byte(&DevDescriptorPtr->NumberOfConfigurations)))
+ return;
+ }
+ else
+ {
+ if ((uint8_t)USB_ControlRequest.wValue > DevDescriptorPtr->NumberOfConfigurations)
+ return;
+ }
+ #endif
+
+ Endpoint_ClearSETUP();
+
+ USB_ConfigurationNumber = (uint8_t)USB_ControlRequest.wValue;
+
+ Endpoint_ClearStatusStage();
+
+ if (USB_ConfigurationNumber)
+ USB_DeviceState = DEVICE_STATE_Configured;
+ else
+ USB_DeviceState = (USB_Device_IsAddressSet()) ? DEVICE_STATE_Configured : DEVICE_STATE_Powered;
+
+ EVENT_USB_Device_ConfigurationChanged();
+}
+
+static void USB_Device_GetConfiguration(void)
+{
+ Endpoint_ClearSETUP();
+
+ Endpoint_Write_Byte(USB_ConfigurationNumber);
+ Endpoint_ClearIN();
+
+ Endpoint_ClearStatusStage();
+}
+
+#if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
+static void USB_Device_GetInternalSerialDescriptor(void)
+{
+ struct
+ {
+ USB_Descriptor_Header_t Header;
+ wchar_t UnicodeString[20];
+ } SignatureDescriptor;
+
+ SignatureDescriptor.Header.Type = DTYPE_String;
+ SignatureDescriptor.Header.Size = sizeof(SignatureDescriptor);
+
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ {
+ uint8_t SigReadAddress = 0x0E;
+
+ for (uint8_t SerialCharNum = 0; SerialCharNum < 20; SerialCharNum++)
+ {
+ uint8_t SerialByte = boot_signature_byte_get(SigReadAddress);
+
+ if (SerialCharNum & 0x01)
+ {
+ SerialByte >>= 4;
+ SigReadAddress++;
+ }
+
+ SerialByte &= 0x0F;
+
+ SignatureDescriptor.UnicodeString[SerialCharNum] = (SerialByte >= 10) ?
+ (('A' - 10) + SerialByte) : ('0' + SerialByte);
+ }
+ }
+
+ Endpoint_ClearSETUP();
+
+ Endpoint_Write_Control_Stream_LE(&SignatureDescriptor, sizeof(SignatureDescriptor));
+
+ Endpoint_ClearOUT();
+}
+#endif
+
+static void USB_Device_GetDescriptor(void)
+{
+ const void* DescriptorPointer;
+ uint16_t DescriptorSize;
+
+ #if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
+ uint8_t DescriptorAddressSpace;
+ #endif
+
+ #if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
+ if (USB_ControlRequest.wValue == ((DTYPE_String << 8) | USE_INTERNAL_SERIAL))
+ {
+ USB_Device_GetInternalSerialDescriptor();
+ return;
+ }
+ #endif
+
+ if ((DescriptorSize = CALLBACK_USB_GetDescriptor(USB_ControlRequest.wValue, USB_ControlRequest.wIndex,
+ &DescriptorPointer
+ #if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
+ , &DescriptorAddressSpace
+ #endif
+ )) == NO_DESCRIPTOR)
+ {
+ return;
+ }
+
+ Endpoint_ClearSETUP();
+
+ #if defined(USE_RAM_DESCRIPTORS)
+ Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
+ #elif defined(USE_EEPROM_DESCRIPTORS)
+ Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);
+ #elif defined(USE_FLASH_DESCRIPTORS)
+ Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
+ #else
+ if (DescriptorAddressSpace == MEMSPACE_FLASH)
+ Endpoint_Write_Control_PStream_LE(DescriptorPointer, DescriptorSize);
+ else if (DescriptorAddressSpace == MEMSPACE_EEPROM)
+ Endpoint_Write_Control_EStream_LE(DescriptorPointer, DescriptorSize);
+ else
+ Endpoint_Write_Control_Stream_LE(DescriptorPointer, DescriptorSize);
+ #endif
+
+ Endpoint_ClearOUT();
+}
+
+static void USB_Device_GetStatus(void)
+{
+ uint8_t CurrentStatus = 0;
+
+ switch (USB_ControlRequest.bmRequestType)
+ {
+ #if !defined(NO_DEVICE_SELF_POWER) || !defined(NO_DEVICE_REMOTE_WAKEUP)
+ case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE):
+ #if !defined(NO_DEVICE_SELF_POWER)
+ if (USB_CurrentlySelfPowered)
+ CurrentStatus |= FEATURE_SELFPOWERED_ENABLED;
+ #endif
+
+ #if !defined(NO_DEVICE_REMOTE_WAKEUP)
+ if (USB_RemoteWakeupEnabled)
+ CurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
+ #endif
+ break;
+ #endif
+ #if !defined(CONTROL_ONLY_DEVICE)
+ case (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT):
+ Endpoint_SelectEndpoint((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
+
+ CurrentStatus = Endpoint_IsStalled();
+
+ Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
+
+ break;
+ #endif
+ default:
+ return;
+ }
+
+ Endpoint_ClearSETUP();
+
+ Endpoint_Write_Word_LE(CurrentStatus);
+ Endpoint_ClearIN();
+
+ Endpoint_ClearStatusStage();
+}
+
+static void USB_Device_ClearSetFeature(void)
+{
+ switch (USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT)
+ {
+ #if !defined(NO_DEVICE_REMOTE_WAKEUP)
+ case REQREC_DEVICE:
+ if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_DeviceRemoteWakeup)
+ USB_RemoteWakeupEnabled = (USB_ControlRequest.bRequest == REQ_SetFeature);
+ else
+ return;
+
+ break;
+ #endif
+ #if !defined(CONTROL_ONLY_DEVICE)
+ case REQREC_ENDPOINT:
+ if ((uint8_t)USB_ControlRequest.wValue == FEATURE_SEL_EndpointHalt)
+ {
+ uint8_t EndpointIndex = ((uint8_t)USB_ControlRequest.wIndex & ENDPOINT_EPNUM_MASK);
+
+ if (EndpointIndex == ENDPOINT_CONTROLEP)
+ return;
+
+ Endpoint_SelectEndpoint(EndpointIndex);
+
+ if (Endpoint_IsEnabled())
+ {
+ if (USB_ControlRequest.bRequest == REQ_SetFeature)
+ {
+ Endpoint_StallTransaction();
+ }
+ else
+ {
+ Endpoint_ClearStall();
+ Endpoint_ResetFIFO(EndpointIndex);
+ Endpoint_ResetDataToggle();
+ }
+ }
+ }
+
+ break;
+ #endif
+ default:
+ return;
+ }
+
+ Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
+
+ Endpoint_ClearSETUP();
+
+ Endpoint_ClearStatusStage();
+}
+
+#endif
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h b/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h new file mode 100644 index 0000000..df5a79a --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.h @@ -0,0 +1,165 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB device standard request management.
+ *
+ * This file contains the function prototypes necessary for the processing of incoming standard control requests
+ * when the library is in USB device mode.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+#ifndef __DEVICESTDREQ_H__
+#define __DEVICESTDREQ_H__
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+ #include <avr/eeprom.h>
+ #include <avr/boot.h>
+ #include <util/atomic.h>
+ #include <stdint.h>
+ #include <stdbool.h>
+
+ #include "StdDescriptors.h"
+ #include "Events.h"
+ #include "StdRequestType.h"
+ #include "USBTask.h"
+ #include "../LowLevel/USBController.h"
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Macros: */
+ #if defined(USE_SINGLE_DEVICE_CONFIGURATION)
+ #define FIXED_NUM_CONFIGURATIONS 1
+ #endif
+
+ /* Enums: */
+ #if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
+ /** Enum for the possible descriptor memory spaces, for the MemoryAddressSpace of the
+ * \ref CALLBACK_USB_GetDescriptor() function. This can be used when none of the USE_*_DESCRIPTORS
+ * compile time options are used, to indicate in which memory space the descriptor is stored.
+ *
+ * \ingroup Group_Device
+ */
+ enum USB_DescriptorMemorySpaces_t
+ {
+ MEMSPACE_FLASH = 0, /**< Indicates the requested descriptor is located in FLASH memory. */
+ MEMSPACE_EEPROM = 1, /**< Indicates the requested descriptor is located in EEPROM memory. */
+ MEMSPACE_RAM = 2, /**< Indicates the requested descriptor is located in RAM memory. */
+ };
+ #endif
+
+ /* Global Variables: */
+ /** Indicates the currently set configuration number of the device. USB devices may have several
+ * different configurations which the host can select between; this indicates the currently selected
+ * value, or 0 if no configuration has been selected.
+ *
+ * \note This variable should be treated as read-only in the user application, and never manually
+ * changed in value.
+ *
+ * \ingroup Group_Device
+ */
+ extern uint8_t USB_ConfigurationNumber;
+
+ #if !defined(NO_DEVICE_REMOTE_WAKEUP)
+ /** Indicates if the host is currently allowing the device to issue remote wakeup events. If this
+ * flag is cleared, the device should not issue remote wakeup events to the host.
+ *
+ * \note This variable should be treated as read-only in the user application, and never manually
+ * changed in value.
+ * \n\n
+ *
+ * \note To reduce FLASH usage of the compiled applications where Remote Wakeup is not supported,
+ * this global and the underlying management code can be disabled by defining the
+ * NO_DEVICE_REMOTE_WAKEUP token in the project makefile and passing it to the compiler via
+ * the -D switch.
+ *
+ * \ingroup Group_Device
+ */
+ extern bool USB_RemoteWakeupEnabled;
+ #endif
+
+ #if !defined(NO_DEVICE_SELF_POWER)
+ /** Indicates if the device is currently being powered by its own power supply, rather than being
+ * powered by the host's USB supply. This flag should remain cleared if the device does not
+ * support self powered mode, as indicated in the device descriptors.
+ *
+ * \ingroup Group_Device
+ */
+ extern bool USB_CurrentlySelfPowered;
+ #endif
+
+ /* Private Interface - For use in library only: */
+ #if !defined(__DOXYGEN__)
+ #if defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)
+ #error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
+ #elif defined(USE_RAM_DESCRIPTORS) && defined(USE_FLASH_DESCRIPTORS)
+ #error USE_RAM_DESCRIPTORS and USE_FLASH_DESCRIPTORS are mutually exclusive.
+ #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)
+ #error USE_FLASH_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive.
+ #elif defined(USE_FLASH_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS) && defined(USE_RAM_DESCRIPTORS)
+ #error Only one of the USE_*_DESCRIPTORS modes should be selected.
+ #endif
+
+ /* Function Prototypes: */
+ void USB_Device_ProcessControlRequest(void);
+
+ #if defined(__INCLUDE_FROM_DEVICESTDREQ_C)
+ static void USB_Device_SetAddress(void);
+ static void USB_Device_SetConfiguration(void);
+ static void USB_Device_GetConfiguration(void);
+ static void USB_Device_GetDescriptor(void);
+ static void USB_Device_GetStatus(void);
+ static void USB_Device_ClearSetFeature(void);
+
+ #if !defined(NO_INTERNAL_SERIAL) && (USE_INTERNAL_SERIAL != NO_DESCRIPTOR)
+ static void USB_Device_GetInternalSerialDescriptor(void);
+ #endif
+ #endif
+ #endif
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.lst b/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.lst new file mode 100644 index 0000000..eed7de6 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.lst @@ -0,0 +1,569 @@ + 1 .file "DeviceStandardReq.c" + 2 __SREG__ = 0x3f + 3 __SP_H__ = 0x3e + 4 __SP_L__ = 0x3d + 5 __CCP__ = 0x34 + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 15 .Ltext0: + 16 .section .text.USB_Device_ProcessControlRequest,"ax",@progbits + 17 .global USB_Device_ProcessControlRequest + 19 USB_Device_ProcessControlRequest: + 20 .LFB68: + 21 .LSM0: + 22 0000 0F93 push r16 + 23 0002 1F93 push r17 + 24 0004 DF93 push r29 + 25 0006 CF93 push r28 + 26 0008 00D0 rcall . + 27 000a CDB7 in r28,__SP_L__ + 28 000c DEB7 in r29,__SP_H__ + 29 /* prologue: function */ + 30 /* frame size = 2 */ + 31 .LSM1: + 32 000e E0E0 ldi r30,lo8(USB_ControlRequest) + 33 0010 F0E0 ldi r31,hi8(USB_ControlRequest) + 34 .LVL0: + 35 .L2: + 36 .LBB146: + 37 .LBB147: + 38 .LBB148: + 39 .LSM2: + 40 0012 8091 F100 lds r24,241 + 41 .LBE148: + 42 .LBE147: + 43 .LSM3: + 44 0016 8193 st Z+,r24 + 45 .LSM4: + 46 0018 80E0 ldi r24,hi8(USB_ControlRequest+8) + 47 001a E030 cpi r30,lo8(USB_ControlRequest+8) + 48 001c F807 cpc r31,r24 + 49 001e 01F4 brne .L2 + 50 .LBE146: + 51 .LSM5: + 52 0020 0E94 0000 call EVENT_USB_Device_ControlRequest + 53 .LVL1: + 54 .LBB149: + 55 .LBB150: + 56 .LSM6: + 57 0024 8091 E800 lds r24,232 + 58 .LBE150: + 59 .LBE149: + 60 .LSM7: + 61 0028 83FF sbrs r24,3 + 62 002a 00C0 rjmp .L3 + 63 .LBB151: + 64 .LSM8: + 65 002c 8091 0000 lds r24,USB_ControlRequest + 66 .LVL2: + 67 .LSM9: + 68 0030 3091 0000 lds r19,USB_ControlRequest+1 + 69 0034 3530 cpi r19,lo8(5) + 70 0036 01F4 brne .+2 + 71 0038 00C0 rjmp .L6 + 72 003a 3630 cpi r19,lo8(6) + 73 003c 00F4 brsh .L10 + 74 003e 3130 cpi r19,lo8(1) + 75 0040 01F0 breq .L5 + 76 0042 3130 cpi r19,lo8(1) + 77 0044 00F0 brlo .L4 + 78 0046 3330 cpi r19,lo8(3) + 79 0048 01F0 breq .+2 + 80 004a 00C0 rjmp .L3 + 81 004c 00C0 rjmp .L5 + 82 .L10: + 83 004e 3830 cpi r19,lo8(8) + 84 0050 01F4 brne .+2 + 85 0052 00C0 rjmp .L8 + 86 0054 3930 cpi r19,lo8(9) + 87 0056 01F4 brne .+2 + 88 0058 00C0 rjmp .L9 + 89 005a 3630 cpi r19,lo8(6) + 90 005c 01F0 breq .+2 + 91 005e 00C0 rjmp .L3 + 92 0060 00C0 rjmp .L34 + 93 .L4: + 94 .LSM10: + 95 0062 8038 cpi r24,lo8(-128) + 96 0064 01F0 breq .L11 + 97 0066 8238 cpi r24,lo8(-126) + 98 0068 01F0 breq .+2 + 99 006a 00C0 rjmp .L3 + 100 006c 00C0 rjmp .L35 + 101 .L11: + 102 006e 9091 0000 lds r25,USB_CurrentlySelfPowered + 103 .LVL3: + 104 .LBB152: + 105 .LBB153: + 106 .LSM11: + 107 0072 8091 0000 lds r24,USB_RemoteWakeupEnabled + 108 .LVL4: + 109 0076 8823 tst r24 + 110 0078 01F0 breq .L13 + 111 .LSM12: + 112 007a 9260 ori r25,lo8(2) + 113 007c 00C0 rjmp .L13 + 114 .LVL5: + 115 .L35: + 116 .LSM13: + 117 007e 8091 0000 lds r24,USB_ControlRequest+4 + 118 .LVL6: + 119 0082 8770 andi r24,lo8(7) + 120 .LBB154: + 121 .LBB155: + 122 .LSM14: + 123 0084 8093 E900 sts 233,r24 + 124 .LBE155: + 125 .LBE154: + 126 .LBB156: + 127 .LBB157: + 128 .LSM15: + 129 0088 8091 EB00 lds r24,235 + 130 .LBE157: + 131 .LBE156: + 132 .LSM16: + 133 008c 90E0 ldi r25,lo8(0) + 134 008e 25E0 ldi r18,5 + 135 0090 9695 1: lsr r25 + 136 0092 8795 ror r24 + 137 0094 2A95 dec r18 + 138 0096 01F4 brne 1b + 139 0098 982F mov r25,r24 + 140 .LVL7: + 141 009a 9170 andi r25,lo8(1) + 142 .LBB158: + 143 .LBB159: + 144 .LSM17: + 145 009c 1092 E900 sts 233,__zero_reg__ + 146 .L13: + 147 .LBE159: + 148 .LBE158: + 149 .LBB160: + 150 .LBB161: + 151 .LSM18: + 152 00a0 8091 E800 lds r24,232 + 153 00a4 877F andi r24,lo8(-9) + 154 00a6 8093 E800 sts 232,r24 + 155 .LBE161: + 156 .LBE160: + 157 .LBB162: + 158 .LBB163: + 159 .LSM19: + 160 00aa 9093 F100 sts 241,r25 + 161 .LSM20: + 162 00ae 1092 F100 sts 241,__zero_reg__ + 163 00b2 00C0 rjmp .L33 + 164 .LVL8: + 165 .L5: + 166 .LBE163: + 167 .LBE162: + 168 .LBE153: + 169 .LBE152: + 170 .LSM21: + 171 00b4 8823 tst r24 + 172 00b6 01F0 breq .L14 + 173 00b8 8230 cpi r24,lo8(2) + 174 00ba 01F0 breq .+2 + 175 00bc 00C0 rjmp .L3 + 176 .L14: + 177 .LBB164: + 178 .LBB165: + 179 .LSM22: + 180 00be 90E0 ldi r25,lo8(0) + 181 00c0 8F71 andi r24,lo8(31) + 182 00c2 9070 andi r25,hi8(31) + 183 .LVL9: + 184 00c4 0097 sbiw r24,0 + 185 00c6 01F0 breq .L15 + 186 00c8 0297 sbiw r24,2 + 187 00ca 01F0 breq .+2 + 188 00cc 00C0 rjmp .L3 + 189 00ce 00C0 rjmp .L36 + 190 .L15: + 191 .LSM23: + 192 00d0 8091 0000 lds r24,USB_ControlRequest+2 + 193 00d4 8130 cpi r24,lo8(1) + 194 00d6 01F0 breq .+2 + 195 00d8 00C0 rjmp .L3 + 196 .LSM24: + 197 00da 1092 0000 sts USB_RemoteWakeupEnabled,__zero_reg__ + 198 00de 3330 cpi r19,lo8(3) + 199 00e0 01F4 brne .L18 + 200 00e2 8093 0000 sts USB_RemoteWakeupEnabled,r24 + 201 00e6 00C0 rjmp .L18 + 202 .L36: + 203 .LSM25: + 204 00e8 8091 0000 lds r24,USB_ControlRequest+2 + 205 00ec 8823 tst r24 + 206 00ee 01F4 brne .L18 + 207 .LBB166: + 208 .LSM26: + 209 00f0 2091 0000 lds r18,USB_ControlRequest+4 + 210 .LVL10: + 211 00f4 2770 andi r18,lo8(7) + 212 .LSM27: + 213 00f6 01F4 brne .+2 + 214 00f8 00C0 rjmp .L3 + 215 .LBB167: + 216 .LBB168: + 217 .LSM28: + 218 00fa 2093 E900 sts 233,r18 + 219 .LBE168: + 220 .LBE167: + 221 .LBB169: + 222 .LBB170: + 223 .LSM29: + 224 00fe 8091 EB00 lds r24,235 + 225 .LBE170: + 226 .LBE169: + 227 .LSM30: + 228 0102 80FF sbrs r24,0 + 229 0104 00C0 rjmp .L18 + 230 .LSM31: + 231 0106 3330 cpi r19,lo8(3) + 232 0108 01F4 brne .L19 + 233 .LBB171: + 234 .LBB172: + 235 .LSM32: + 236 010a 8091 EB00 lds r24,235 + 237 010e 8062 ori r24,lo8(32) + 238 0110 00C0 rjmp .L31 + 239 .L19: + 240 .LBE172: + 241 .LBE171: + 242 .LBB173: + 243 .LBB174: + 244 .LSM33: + 245 0112 8091 EB00 lds r24,235 + 246 0116 8061 ori r24,lo8(16) + 247 0118 8093 EB00 sts 235,r24 + 248 .LBE174: + 249 .LBE173: + 250 .LBB175: + 251 .LBB176: + 252 .LSM34: + 253 011c 81E0 ldi r24,lo8(1) + 254 011e 90E0 ldi r25,hi8(1) + 255 0120 00C0 rjmp 2f + 256 0122 880F 1: lsl r24 + 257 0124 991F rol r25 + 258 0126 2A95 2: dec r18 + 259 0128 02F4 brpl 1b + 260 012a 8093 EA00 sts 234,r24 + 261 .LSM35: + 262 012e 1092 EA00 sts 234,__zero_reg__ + 263 .LBE176: + 264 .LBE175: + 265 .LBB177: + 266 .LBB178: + 267 .LSM36: + 268 0132 8091 EB00 lds r24,235 + 269 0136 8860 ori r24,lo8(8) + 270 .L31: + 271 0138 8093 EB00 sts 235,r24 + 272 .L18: + 273 .LBE178: + 274 .LBE177: + 275 .LBE166: + 276 .LBB179: + 277 .LBB180: + 278 .LSM37: + 279 013c 1092 E900 sts 233,__zero_reg__ + 280 .LBE180: + 281 .LBE179: + 282 .LBB181: + 283 .LBB182: + 284 .LSM38: + 285 0140 8091 E800 lds r24,232 + 286 0144 877F andi r24,lo8(-9) + 287 0146 00C0 rjmp .L32 + 288 .LVL11: + 289 .L6: + 290 .LBE182: + 291 .LBE181: + 292 .LBE165: + 293 .LBE164: + 294 .LSM39: + 295 0148 8823 tst r24 + 296 014a 01F0 breq .+2 + 297 014c 00C0 rjmp .L3 + 298 .LBB183: + 299 .LBB184: + 300 .LSM40: + 301 014e 1091 0000 lds r17,USB_ControlRequest+2 + 302 .LVL12: + 303 0152 1F77 andi r17,lo8(127) + 304 .LBB185: + 305 .LSM41: + 306 0154 0FB7 in r16,__SREG__ + 307 .LBB186: + 308 .LBB187: + 309 .LSM42: + 310 /* #APP */ + 311 ; 50 "/usr/lib/gcc/avr/4.3.5/../../../avr/include/util/atomic.h" 1 + 312 0156 F894 cli + 313 ; 0 "" 2 + 314 /* #NOAPP */ + 315 .LBE187: + 316 .LBE186: + 317 .LBB188: + 318 .LBB189: + 319 .LSM43: + 320 0158 8091 E800 lds r24,232 + 321 .LVL13: + 322 015c 877F andi r24,lo8(-9) + 323 015e 8093 E800 sts 232,r24 + 324 .LBE189: + 325 .LBE188: + 326 .LSM44: + 327 0162 0E94 0000 call Endpoint_ClearStatusStage + 328 .L20: + 329 .LBB190: + 330 .LBB191: + 331 .LSM45: + 332 0166 8091 E800 lds r24,232 + 333 .LBE191: + 334 .LBE190: + 335 .LSM46: + 336 016a 80FF sbrs r24,0 + 337 016c 00C0 rjmp .L20 + 338 .LSM47: + 339 016e 1123 tst r17 + 340 0170 01F4 brne .L21 + 341 0172 82E0 ldi r24,lo8(2) + 342 0174 00C0 rjmp .L22 + 343 .L21: + 344 0176 83E0 ldi r24,lo8(3) + 345 .L22: + 346 0178 8093 0000 sts USB_DeviceState,r24 + 347 .LBB192: + 348 .LBB193: + 349 .LSM48: + 350 017c 8091 E300 lds r24,227 + 351 0180 8078 andi r24,lo8(-128) + 352 0182 182B or r17,r24 + 353 0184 1093 E300 sts 227,r17 + 354 .LSM49: + 355 0188 8091 E300 lds r24,227 + 356 018c 8068 ori r24,lo8(-128) + 357 018e 8093 E300 sts 227,r24 + 358 .LBE193: + 359 .LBE192: + 360 .LBB194: + 361 .LBB195: + 362 .LSM50: + 363 0192 0FBF out __SREG__,r16 + 364 .LSM51: + 365 0194 00C0 rjmp .L3 + 366 .LVL14: + 367 .L34: + 368 .LBE195: + 369 .LBE194: + 370 .LBE185: + 371 .LBE184: + 372 .LBE183: + 373 .LSM52: + 374 0196 8058 subi r24,lo8(-(-128)) + 375 0198 8230 cpi r24,lo8(2) + 376 019a 00F0 brlo .+2 + 377 019c 00C0 rjmp .L3 + 378 .LBB196: + 379 .LSM53: + 380 019e 8091 0000 lds r24,USB_ControlRequest+2 + 381 01a2 9091 0000 lds r25,(USB_ControlRequest+2)+1 + 382 .LVL15: + 383 01a6 6091 0000 lds r22,USB_ControlRequest+4 + 384 01aa AE01 movw r20,r28 + 385 01ac 4F5F subi r20,lo8(-(1)) + 386 01ae 5F4F sbci r21,hi8(-(1)) + 387 01b0 0E94 0000 call CALLBACK_USB_GetDescriptor + 388 01b4 BC01 movw r22,r24 + 389 .LVL16: + 390 .LBB197: + 391 01b6 0097 sbiw r24,0 + 392 01b8 01F4 brne .+2 + 393 01ba 00C0 rjmp .L3 + 394 .LVL17: + 395 .LBB198: + 396 .LBB199: + 397 .LSM54: + 398 01bc 8091 E800 lds r24,232 + 399 .LVL18: + 400 01c0 877F andi r24,lo8(-9) + 401 01c2 8093 E800 sts 232,r24 + 402 .LBE199: + 403 .LBE198: + 404 .LSM55: + 405 01c6 8981 ldd r24,Y+1 + 406 01c8 9A81 ldd r25,Y+2 + 407 .LVL19: + 408 01ca 0E94 0000 call Endpoint_Write_Control_PStream_LE + 409 .LVL20: + 410 .LBB200: + 411 .LBB201: + 412 .LSM56: + 413 01ce 8091 E800 lds r24,232 + 414 01d2 8B77 andi r24,lo8(123) + 415 01d4 8093 E800 sts 232,r24 + 416 01d8 00C0 rjmp .L3 + 417 .LVL21: + 418 .L8: + 419 .LBE201: + 420 .LBE200: + 421 .LBE197: + 422 .LBE196: + 423 .LSM57: + 424 01da 8038 cpi r24,lo8(-128) + 425 01dc 01F4 brne .L3 + 426 .LBB202: + 427 .LBB203: + 428 .LBB204: + 429 .LBB205: + 430 .LSM58: + 431 01de 8091 E800 lds r24,232 + 432 .LVL22: + 433 01e2 877F andi r24,lo8(-9) + 434 01e4 8093 E800 sts 232,r24 + 435 .LBE205: + 436 .LBE204: + 437 .LSM59: + 438 01e8 8091 0000 lds r24,USB_ConfigurationNumber + 439 .LBB206: + 440 .LBB207: + 441 .LSM60: + 442 01ec 8093 F100 sts 241,r24 + 443 .LVL23: + 444 .L33: + 445 .LBE207: + 446 .LBE206: + 447 .LBB208: + 448 .LBB209: + 449 .LSM61: + 450 01f0 8091 E800 lds r24,232 + 451 01f4 8E77 andi r24,lo8(126) + 452 .LVL24: + 453 .L32: + 454 01f6 8093 E800 sts 232,r24 + 455 .LBE209: + 456 .LBE208: + 457 .LSM62: + 458 01fa 0E94 0000 call Endpoint_ClearStatusStage + 459 .LVL25: + 460 01fe 00C0 rjmp .L3 + 461 .LVL26: + 462 .L9: + 463 .LBE203: + 464 .LBE202: + 465 .LSM63: + 466 0200 8823 tst r24 + 467 0202 01F4 brne .L3 + 468 .LBB210: + 469 .LBB211: + 470 .LSM64: + 471 0204 9091 0000 lds r25,USB_ControlRequest+2 + 472 0208 9230 cpi r25,lo8(2) + 473 020a 00F4 brsh .L3 + 474 .LBB212: + 475 .LBB213: + 476 .LSM65: + 477 020c 8091 E800 lds r24,232 + 478 .LVL27: + 479 0210 877F andi r24,lo8(-9) + 480 0212 8093 E800 sts 232,r24 + 481 .LBE213: + 482 .LBE212: + 483 .LSM66: + 484 0216 9093 0000 sts USB_ConfigurationNumber,r25 + 485 .LSM67: + 486 021a 0E94 0000 call Endpoint_ClearStatusStage + 487 .LSM68: + 488 021e 8091 0000 lds r24,USB_ConfigurationNumber + 489 0222 8823 tst r24 + 490 0224 01F4 brne .L25 + 491 .L23: + 492 .LBB214: + 493 .LBB215: + 494 .LSM69: + 495 0226 8091 E300 lds r24,227 + 496 .LBE215: + 497 .LBE214: + 498 .LSM70: + 499 022a 87FD sbrc r24,7 + 500 022c 00C0 rjmp .L25 + 501 022e 81E0 ldi r24,lo8(1) + 502 0230 00C0 rjmp .L26 + 503 .L25: + 504 0232 84E0 ldi r24,lo8(4) + 505 .L26: + 506 0234 8093 0000 sts USB_DeviceState,r24 + 507 .LSM71: + 508 0238 0E94 0000 call EVENT_USB_Device_ConfigurationChanged + 509 .LVL28: + 510 .L3: + 511 .LBE211: + 512 .LBE210: + 513 .LBE151: + 514 .LBB216: + 515 .LBB217: + 516 .LSM72: + 517 023c 8091 E800 lds r24,232 + 518 .LVL29: + 519 .LBE217: + 520 .LBE216: + 521 .LSM73: + 522 0240 83FF sbrs r24,3 + 523 0242 00C0 rjmp .L28 + 524 .LBB218: + 525 .LBB219: + 526 .LSM74: + 527 0244 8091 EB00 lds r24,235 + 528 0248 8062 ori r24,lo8(32) + 529 024a 8093 EB00 sts 235,r24 + 530 .LBE219: + 531 .LBE218: + 532 .LBB220: + 533 .LBB221: + 534 .LSM75: + 535 024e 8091 E800 lds r24,232 + 536 0252 877F andi r24,lo8(-9) + 537 0254 8093 E800 sts 232,r24 + 538 .L28: + 539 /* epilogue start */ + 540 .LBE221: + 541 .LBE220: + 542 .LSM76: + 543 0258 0F90 pop __tmp_reg__ + 544 025a 0F90 pop __tmp_reg__ + 545 025c CF91 pop r28 + 546 025e DF91 pop r29 + 547 0260 1F91 pop r17 + 548 .LVL30: + 549 0262 0F91 pop r16 + 550 0264 0895 ret + 551 .LFE68: + 553 .comm USB_ConfigurationNumber,1,1 + 554 .comm USB_RemoteWakeupEnabled,1,1 + 555 .comm USB_CurrentlySelfPowered,1,1 + 580 .Letext0: +DEFINED SYMBOLS + *ABS*:0000000000000000 DeviceStandardReq.c + /tmp/ccT135RT.s:2 *ABS*:000000000000003f __SREG__ + /tmp/ccT135RT.s:3 *ABS*:000000000000003e __SP_H__ + /tmp/ccT135RT.s:4 *ABS*:000000000000003d __SP_L__ + /tmp/ccT135RT.s:5 *ABS*:0000000000000034 __CCP__ + /tmp/ccT135RT.s:6 *ABS*:0000000000000000 __tmp_reg__ + /tmp/ccT135RT.s:7 *ABS*:0000000000000001 __zero_reg__ + /tmp/ccT135RT.s:19 .text.USB_Device_ProcessControlRequest:0000000000000000 USB_Device_ProcessControlRequest + *COM*:0000000000000001 USB_CurrentlySelfPowered + *COM*:0000000000000001 USB_RemoteWakeupEnabled + *COM*:0000000000000001 USB_ConfigurationNumber + +UNDEFINED SYMBOLS +USB_ControlRequest +EVENT_USB_Device_ControlRequest +Endpoint_ClearStatusStage +USB_DeviceState +CALLBACK_USB_GetDescriptor +Endpoint_Write_Control_PStream_LE +EVENT_USB_Device_ConfigurationChanged +__do_clear_bss diff --git a/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.o b/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.o Binary files differnew file mode 100644 index 0000000..5984660 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.o diff --git a/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.c b/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.c new file mode 100644 index 0000000..7e92b7e --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.c @@ -0,0 +1,233 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#define __INCLUDE_FROM_USB_DRIVER
+#include "USBMode.h"
+
+#if defined(USB_CAN_BE_DEVICE)
+
+#include "EndpointStream.h"
+
+#if !defined(CONTROL_ONLY_DEVICE)
+uint8_t Endpoint_Discard_Stream(uint16_t Length
+ __CALLBACK_PARAM)
+{
+ uint8_t ErrorCode;
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+
+ #if defined(FAST_STREAM_TRANSFERS)
+ uint8_t BytesRemToAlignment = (Endpoint_BytesInEndpoint() & 0x07);
+
+ if (Length >= 8)
+ {
+ Length -= BytesRemToAlignment;
+
+ switch (BytesRemToAlignment)
+ {
+ default:
+ do
+ {
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ Endpoint_ClearOUT();
+
+ #if !defined(NO_STREAM_CALLBACKS)
+ if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
+ return ENDPOINT_RWSTREAM_CallbackAborted;
+ #endif
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+ }
+
+ Length -= 8;
+
+ Endpoint_Discard_Byte();
+ case 7: Endpoint_Discard_Byte();
+ case 6: Endpoint_Discard_Byte();
+ case 5: Endpoint_Discard_Byte();
+ case 4: Endpoint_Discard_Byte();
+ case 3: Endpoint_Discard_Byte();
+ case 2: Endpoint_Discard_Byte();
+ case 1: Endpoint_Discard_Byte();
+ } while (Length >= 8);
+ }
+ }
+ #endif
+
+ while (Length)
+ {
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ Endpoint_ClearOUT();
+
+ #if !defined(NO_STREAM_CALLBACKS)
+ if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
+ return ENDPOINT_RWSTREAM_CallbackAborted;
+ #endif
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+ }
+ else
+ {
+ Endpoint_Discard_Byte();
+ Length--;
+ }
+ }
+
+ return ENDPOINT_RWSTREAM_NoError;
+}
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr++))
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++))
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr--))
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr--))
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE
+#define TEMPLATE_BUFFER_TYPE void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Endpoint_Read_Byte()
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE
+#define TEMPLATE_BUFFER_TYPE void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr++, Endpoint_Read_Byte())
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE
+#define TEMPLATE_BUFFER_TYPE void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Endpoint_Read_Byte()
+#include "Template/Template_Endpoint_RW.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE
+#define TEMPLATE_BUFFER_TYPE void*
+#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
+#include "Template/Template_Endpoint_RW.c"
+
+#endif
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr++))
+#include "Template/Template_Endpoint_Control_W.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++))
+#include "Template/Template_Endpoint_Control_W.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
+#include "Template/Template_Endpoint_Control_W.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(*((uint8_t*)BufferPtr--))
+#include "Template/Template_Endpoint_Control_W.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr--))
+#include "Template/Template_Endpoint_Control_W.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
+#include "Template/Template_Endpoint_Control_W.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Endpoint_Read_Byte()
+#include "Template/Template_Endpoint_Control_R.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr++, Endpoint_Read_Byte())
+#include "Template/Template_Endpoint_Control_R.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Endpoint_Read_Byte()
+#include "Template/Template_Endpoint_Control_R.c"
+
+#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr--, Endpoint_Read_Byte())
+#include "Template/Template_Endpoint_Control_R.c"
+
+#endif diff --git a/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.h b/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.h new file mode 100644 index 0000000..a8b9021 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.h @@ -0,0 +1,524 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB device endpoint stream function definitions.
+ *
+ * This file contains structures, function prototypes and macros related to the sending and receiving of
+ * arbitrary data streams through the device's data endpoints when the library is initialized in USB device mode.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+/** \ingroup Group_EndpointRW
+ * @defgroup Group_EndpointStreamRW Read/Write of Multi-Byte Streams
+ *
+ * Functions, macros, variables, enums and types related to data reading and writing of data streams from
+ * and to endpoints.
+ *
+ * @{
+ */
+
+#ifndef __ENDPOINT_STREAM_H__
+#define __ENDPOINT_STREAM_H__
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+ #include <avr/eeprom.h>
+ #include <stdbool.h>
+
+ #include "../../../Common/Common.h"
+ #include "USBTask.h"
+
+ #if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
+ #include "StreamCallbacks.h"
+ #endif
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ #if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
+ #define __CALLBACK_PARAM , StreamCallbackPtr_t Callback
+ #else
+ #define __CALLBACK_PARAM
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Enums: */
+ /** Enum for the possible error return codes of the Endpoint_*_Stream_* functions. */
+ enum Endpoint_Stream_RW_ErrorCodes_t
+ {
+ ENDPOINT_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */
+ ENDPOINT_RWSTREAM_EndpointStalled = 1, /**< The endpoint was stalled during the stream
+ * transfer by the host or device.
+ */
+ ENDPOINT_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
+ * the transfer.
+ */
+ ENDPOINT_RWSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and
+ * no USB endpoint traffic can occur until the bus
+ * has resumed.
+ */
+ ENDPOINT_RWSTREAM_Timeout = 4, /**< The host failed to accept or send the next packet
+ * within the software timeout period set by the
+ * \ref USB_STREAM_TIMEOUT_MS macro.
+ */
+ ENDPOINT_RWSTREAM_CallbackAborted = 5, /**< Indicates that the stream's callback function
+ * aborted the transfer early.
+ */
+ };
+
+ /** Enum for the possible error return codes of the Endpoint_*_Control_Stream_* functions. */
+ enum Endpoint_ControlStream_RW_ErrorCodes_t
+ {
+ ENDPOINT_RWCSTREAM_NoError = 0, /**< Command completed successfully, no error. */
+ ENDPOINT_RWCSTREAM_HostAborted = 1, /**< The aborted the transfer prematurely. */
+ ENDPOINT_RWCSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
+ * the transfer.
+ */
+ ENDPOINT_RWCSTREAM_BusSuspended = 3, /**< The USB bus has been suspended by the host and
+ * no USB endpoint traffic can occur until the bus
+ * has resumed.
+ */
+ };
+
+ /* Function Prototypes: */
+ /** Reads and discards the given number of bytes from the endpoint from the given buffer,
+ * discarding fully read packets from the host as needed. The last packet is not automatically
+ * discarded once the remaining bytes has been read; the user is responsible for manually
+ * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. Between
+ * each USB packet, the given stream callback function is executed repeatedly until the next
+ * packet is ready, allowing for early aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * \note This routine should not be used on CONTROL type endpoints.
+ *
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Discard_Stream(uint16_t Length
+ __CALLBACK_PARAM);
+
+ /** Writes the given number of bytes to the endpoint from the given buffer in little endian,
+ * sending full packets to the host as needed. The last packet filled is not automatically sent;
+ * the user is responsible for manually sending the last written packet to the host via the
+ * \ref Endpoint_ClearIN() macro. Between each USB packet, the given stream callback function
+ * is executed repeatedly until the endpoint is ready to accept the next packet, allowing for early
+ * aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * \note This routine should not be used on CONTROL type endpoints.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_Stream_LE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_EStream_LE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().
+ *
+ * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_PStream_LE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Writes the given number of bytes to the endpoint from the given buffer in big endian,
+ * sending full packets to the host as needed. The last packet filled is not automatically sent;
+ * the user is responsible for manually sending the last written packet to the host via the
+ * \ref Endpoint_ClearIN() macro. Between each USB packet, the given stream callback function
+ * is executed repeatedly until the endpoint is ready to accept the next packet, allowing for early
+ * aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * \note This routine should not be used on CONTROL type endpoints.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_Stream_BE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_EStream_BE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().
+ *
+ * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_PStream_BE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Reads the given number of bytes from the endpoint from the given buffer in little endian,
+ * discarding fully read packets from the host as needed. The last packet is not automatically
+ * discarded once the remaining bytes has been read; the user is responsible for manually
+ * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. Between
+ * each USB packet, the given stream callback function is executed repeatedly until the endpoint
+ * is ready to accept the next packet, allowing for early aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * \note This routine should not be used on CONTROL type endpoints.
+ *
+ * \param[out] Buffer Pointer to the destination data buffer to write to.
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Read_Stream_LE(void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Endpoint_Read_Stream_LE().
+ *
+ * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Read_EStream_LE(void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Reads the given number of bytes from the endpoint from the given buffer in big endian,
+ * discarding fully read packets from the host as needed. The last packet is not automatically
+ * discarded once the remaining bytes has been read; the user is responsible for manually
+ * discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. Between
+ * each USB packet, the given stream callback function is executed repeatedly until the endpoint
+ * is ready to accept the next packet, allowing for early aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * \note This routine should not be used on CONTROL type endpoints.
+ *
+ * \param[out] Buffer Pointer to the destination data buffer to write to.
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Read_Stream_BE(void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Endpoint_Read_Stream_BE().
+ *
+ * \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space.
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Read_EStream_BE(void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian,
+ * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
+ * in both failure and success states; the user is responsible for manually clearing the setup OUT to
+ * finalize the transfer via the \ref Endpoint_ClearOUT() macro.
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_Control_Stream_LE(const void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_Control_EStream_LE(const void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().
+ *
+ * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_Control_PStream_LE(const void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,
+ * sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared
+ * in both failure and success states; the user is responsible for manually clearing the setup OUT to
+ * finalize the transfer via the \ref Endpoint_ClearOUT() macro.
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_Control_Stream_BE(const void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_Control_EStream_BE(const void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().
+ *
+ * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Write_Control_PStream_BE(const void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,
+ * discarding fully read packets from the host as needed. The device IN acknowledgement is not
+ * automatically sent after success or failure states; the user is responsible for manually sending the
+ * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[out] Buffer Pointer to the destination data buffer to write to.
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Read_Control_Stream_LE(void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[out] Buffer Pointer to the destination data buffer to write to.
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Read_Control_EStream_LE(void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,
+ * discarding fully read packets from the host as needed. The device IN acknowledgement is not
+ * automatically sent after success or failure states; the user is responsible for manually sending the
+ * setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro.
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[out] Buffer Pointer to the destination data buffer to write to.
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Read_Control_Stream_BE(void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().
+ *
+ * \note This function automatically clears the control transfer's status stage. Do not manually attempt
+ * to clear the status stage when using this routine in a control transaction.
+ * \n\n
+ *
+ * \note This routine should only be used on CONTROL type endpoints.
+ *
+ * \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained
+ * together; i.e. the entire stream data must be read or written at the one time.
+ *
+ * \param[out] Buffer Pointer to the destination data buffer to write to.
+ * \param[in] Length Number of bytes to send via the currently selected endpoint.
+ *
+ * \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Endpoint_Read_Control_EStream_BE(void* Buffer,
+ uint16_t Length) ATTR_NON_NULL_PTR_ARG(1);
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
+
+/** @} */
+ diff --git a/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.lst b/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.lst new file mode 100644 index 0000000..47a008f --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.lst @@ -0,0 +1,3174 @@ + 1 .file "EndpointStream.c" + 2 __SREG__ = 0x3f + 3 __SP_H__ = 0x3e + 4 __SP_L__ = 0x3d + 5 __CCP__ = 0x34 + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 15 .Ltext0: + 16 .section .text.Endpoint_Write_Control_Stream_LE,"ax",@progbits + 17 .global Endpoint_Write_Control_Stream_LE + 19 Endpoint_Write_Control_Stream_LE: + 20 .LFB79: + 21 .LSM0: + 22 .LVL0: + 23 /* prologue: function */ + 24 /* frame size = 0 */ + 25 0000 9C01 movw r18,r24 + 26 .LVL1: + 27 .LSM1: + 28 0002 4091 0000 lds r20,USB_ControlRequest+6 + 29 0006 5091 0000 lds r21,(USB_ControlRequest+6)+1 + 30 .LVL2: + 31 000a 4617 cp r20,r22 + 32 000c 5707 cpc r21,r23 + 33 000e 00F4 brsh .L2 + 34 .L5: + 35 .LSM2: + 36 0010 F901 movw r30,r18 + 37 .LVL3: + 38 0012 90E0 ldi r25,lo8(0) + 39 .LVL4: + 40 0014 00C0 rjmp .L21 + 41 .LVL5: + 42 .L2: + 43 .LSM3: + 44 0016 6115 cp r22,__zero_reg__ + 45 0018 7105 cpc r23,__zero_reg__ + 46 001a 01F0 breq .L4 + 47 .LVL6: + 48 001c AB01 movw r20,r22 + 49 001e 00C0 rjmp .L5 + 50 .L4: + 51 .LBB250: + 52 .LBB251: + 53 .LSM4: + 54 0020 8091 E800 lds r24,232 + 55 0024 8E77 andi r24,lo8(126) + 56 0026 8093 E800 sts 232,r24 + 57 002a 40E0 ldi r20,lo8(0) + 58 002c 50E0 ldi r21,hi8(0) + 59 .LVL7: + 60 002e 00C0 rjmp .L5 + 61 .LVL8: + 62 .L15: + 63 .LBE251: + 64 .LBE250: + 65 .LBB252: + 66 .LSM5: + 67 0030 8091 0000 lds r24,USB_DeviceState + 68 .LVL9: + 69 .LSM6: + 70 0034 8823 tst r24 + 71 0036 01F0 breq .L6 + 72 .LSM7: + 73 0038 8530 cpi r24,lo8(5) + 74 003a 01F0 breq .L7 + 75 .LBB253: + 76 .LBB254: + 77 .LSM8: + 78 003c 8091 E800 lds r24,232 + 79 .LVL10: + 80 .LBE254: + 81 .LBE253: + 82 .LSM9: + 83 0040 83FF sbrs r24,3 + 84 0042 00C0 rjmp .L8 + 85 0044 81E0 ldi r24,lo8(1) + 86 0046 0895 ret + 87 .L8: + 88 .LBB255: + 89 .LBB256: + 90 .LSM10: + 91 0048 8091 E800 lds r24,232 + 92 .LBE256: + 93 .LBE255: + 94 .LSM11: + 95 004c 82FD sbrc r24,2 + 96 004e 00C0 rjmp .L19 + 97 .LBB257: + 98 .LBB258: + 99 .LSM12: + 100 0050 8091 E800 lds r24,232 + 101 .LBE258: + 102 .LBE257: + 103 .LSM13: + 104 0054 80FF sbrs r24,0 + 105 0056 00C0 rjmp .L21 + 106 .LBB259: + 107 .LBB260: + 108 .LBB261: + 109 .LSM14: + 110 0058 8091 F200 lds r24,242 + 111 005c 282F mov r18,r24 + 112 005e 30E0 ldi r19,lo8(0) + 113 0060 00C0 rjmp .L11 + 114 .L13: + 115 .LBE261: + 116 .LBE260: + 117 .LSM15: + 118 0062 8191 ld r24,Z+ + 119 .LBB262: + 120 .LBB263: + 121 .LSM16: + 122 0064 8093 F100 sts 241,r24 + 123 .LBE263: + 124 .LBE262: + 125 .LSM17: + 126 0068 4150 subi r20,lo8(-(-1)) + 127 006a 5040 sbci r21,hi8(-(-1)) + 128 .LSM18: + 129 006c 2F5F subi r18,lo8(-(1)) + 130 006e 3F4F sbci r19,hi8(-(1)) + 131 .LVL11: + 132 .L11: + 133 .LSM19: + 134 0070 4115 cp r20,__zero_reg__ + 135 0072 5105 cpc r21,__zero_reg__ + 136 0074 01F0 breq .L12 + 137 0076 2830 cpi r18,8 + 138 0078 3105 cpc r19,__zero_reg__ + 139 007a 00F0 brlo .L13 + 140 .L12: + 141 .LSM20: + 142 007c 90E0 ldi r25,lo8(0) + 143 007e 2830 cpi r18,8 + 144 0080 3105 cpc r19,__zero_reg__ + 145 0082 01F4 brne .L14 + 146 0084 91E0 ldi r25,lo8(1) + 147 .L14: + 148 .LBB264: + 149 .LBB265: + 150 .LSM21: + 151 0086 8091 E800 lds r24,232 + 152 008a 8E77 andi r24,lo8(126) + 153 008c 8093 E800 sts 232,r24 + 154 .LVL12: + 155 .L21: + 156 .LBE265: + 157 .LBE264: + 158 .LBE259: + 159 .LBE252: + 160 .LSM22: + 161 0090 4115 cp r20,__zero_reg__ + 162 0092 5105 cpc r21,__zero_reg__ + 163 0094 01F4 brne .L15 + 164 0096 9923 tst r25 + 165 0098 01F4 brne .L15 + 166 009a 00C0 rjmp .L19 + 167 .L16: + 168 .LBB266: + 169 .LSM23: + 170 009c 8091 0000 lds r24,USB_DeviceState + 171 .LVL13: + 172 .LSM24: + 173 00a0 8823 tst r24 + 174 00a2 01F0 breq .L6 + 175 .LSM25: + 176 00a4 8530 cpi r24,lo8(5) + 177 00a6 01F0 breq .L7 + 178 .L19: + 179 .LBE266: + 180 .LBB267: + 181 .LBB268: + 182 .LSM26: + 183 00a8 8091 E800 lds r24,232 + 184 .LVL14: + 185 .LBE268: + 186 .LBE267: + 187 .LSM27: + 188 00ac 82FF sbrs r24,2 + 189 00ae 00C0 rjmp .L16 + 190 00b0 80E0 ldi r24,lo8(0) + 191 00b2 0895 ret + 192 .LVL15: + 193 .L6: + 194 00b4 82E0 ldi r24,lo8(2) + 195 .LVL16: + 196 00b6 0895 ret + 197 .LVL17: + 198 .L7: + 199 00b8 83E0 ldi r24,lo8(3) + 200 .LVL18: + 201 .LSM28: + 202 00ba 0895 ret + 203 .LFE79: + 205 .section .text.Endpoint_Write_Control_PStream_LE,"ax",@progbits + 206 .global Endpoint_Write_Control_PStream_LE + 208 Endpoint_Write_Control_PStream_LE: + 209 .LFB80: + 210 .LSM29: + 211 .LVL19: + 212 /* prologue: function */ + 213 /* frame size = 0 */ + 214 0000 9C01 movw r18,r24 + 215 .LVL20: + 216 .LSM30: + 217 0002 4091 0000 lds r20,USB_ControlRequest+6 + 218 0006 5091 0000 lds r21,(USB_ControlRequest+6)+1 + 219 .LVL21: + 220 000a 4617 cp r20,r22 + 221 000c 5707 cpc r21,r23 + 222 000e 00F4 brsh .L23 + 223 .L26: + 224 .LSM31: + 225 0010 60E0 ldi r22,lo8(0) + 226 .LVL22: + 227 0012 00C0 rjmp .L42 + 228 .LVL23: + 229 .L23: + 230 .LSM32: + 231 0014 6115 cp r22,__zero_reg__ + 232 0016 7105 cpc r23,__zero_reg__ + 233 0018 01F0 breq .L25 + 234 .LVL24: + 235 001a AB01 movw r20,r22 + 236 001c 00C0 rjmp .L26 + 237 .L25: + 238 .LBB269: + 239 .LBB270: + 240 .LSM33: + 241 001e 8091 E800 lds r24,232 + 242 0022 8E77 andi r24,lo8(126) + 243 0024 8093 E800 sts 232,r24 + 244 0028 40E0 ldi r20,lo8(0) + 245 002a 50E0 ldi r21,hi8(0) + 246 .LVL25: + 247 002c 00C0 rjmp .L26 + 248 .LVL26: + 249 .L36: + 250 .LBE270: + 251 .LBE269: + 252 .LBB271: + 253 .LSM34: + 254 002e 8091 0000 lds r24,USB_DeviceState + 255 .LVL27: + 256 .LSM35: + 257 0032 8823 tst r24 + 258 0034 01F4 brne .+2 + 259 0036 00C0 rjmp .L27 + 260 .LSM36: + 261 0038 8530 cpi r24,lo8(5) + 262 003a 01F4 brne .+2 + 263 003c 00C0 rjmp .L28 + 264 .LBB272: + 265 .LBB273: + 266 .LSM37: + 267 003e 8091 E800 lds r24,232 + 268 .LVL28: + 269 .LBE273: + 270 .LBE272: + 271 .LSM38: + 272 0042 83FF sbrs r24,3 + 273 0044 00C0 rjmp .L29 + 274 0046 81E0 ldi r24,lo8(1) + 275 0048 0895 ret + 276 .L29: + 277 .LBB274: + 278 .LBB275: + 279 .LSM39: + 280 004a 8091 E800 lds r24,232 + 281 .LBE275: + 282 .LBE274: + 283 .LSM40: + 284 004e 82FD sbrc r24,2 + 285 0050 00C0 rjmp .L40 + 286 .LBB276: + 287 .LBB277: + 288 .LSM41: + 289 0052 8091 E800 lds r24,232 + 290 .LBE277: + 291 .LBE276: + 292 .LSM42: + 293 0056 80FF sbrs r24,0 + 294 0058 00C0 rjmp .L42 + 295 .LBB278: + 296 .LBB279: + 297 .LBB280: + 298 .LSM43: + 299 005a 8091 F200 lds r24,242 + 300 005e 90E0 ldi r25,lo8(0) + 301 0060 00C0 rjmp .L32 + 302 .LVL29: + 303 .L34: + 304 .LSM44: + 305 0062 F901 movw r30,r18 + 306 .LVL30: + 307 .LBE280: + 308 .LBE279: + 309 .LBB281: + 310 .LSM45: + 311 0064 2F5F subi r18,lo8(-(1)) + 312 0066 3F4F sbci r19,hi8(-(1)) + 313 /* #APP */ + 314 ; 31 "LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c" 1 + 315 0068 E491 lpm r30, Z + 316 + 317 ; 0 "" 2 + 318 .LVL31: + 319 /* #NOAPP */ + 320 .LBE281: + 321 .LBB282: + 322 .LBB283: + 323 .LSM46: + 324 006a E093 F100 sts 241,r30 + 325 .LBE283: + 326 .LBE282: + 327 .LSM47: + 328 006e 4150 subi r20,lo8(-(-1)) + 329 0070 5040 sbci r21,hi8(-(-1)) + 330 .LSM48: + 331 0072 0196 adiw r24,1 + 332 .L32: + 333 .LSM49: + 334 0074 4115 cp r20,__zero_reg__ + 335 0076 5105 cpc r21,__zero_reg__ + 336 0078 01F0 breq .L33 + 337 007a 8830 cpi r24,8 + 338 007c 9105 cpc r25,__zero_reg__ + 339 007e 00F0 brlo .L34 + 340 .L33: + 341 .LSM50: + 342 0080 60E0 ldi r22,lo8(0) + 343 0082 0897 sbiw r24,8 + 344 0084 01F4 brne .L35 + 345 0086 61E0 ldi r22,lo8(1) + 346 .L35: + 347 .LBB284: + 348 .LBB285: + 349 .LSM51: + 350 0088 8091 E800 lds r24,232 + 351 .LVL32: + 352 008c 8E77 andi r24,lo8(126) + 353 008e 8093 E800 sts 232,r24 + 354 .L42: + 355 .LBE285: + 356 .LBE284: + 357 .LBE278: + 358 .LBE271: + 359 .LSM52: + 360 0092 4115 cp r20,__zero_reg__ + 361 0094 5105 cpc r21,__zero_reg__ + 362 0096 01F4 brne .L36 + 363 0098 6623 tst r22 + 364 009a 01F4 brne .L36 + 365 009c 00C0 rjmp .L40 + 366 .L37: + 367 .LBB286: + 368 .LSM53: + 369 009e 8091 0000 lds r24,USB_DeviceState + 370 .LVL33: + 371 .LSM54: + 372 00a2 8823 tst r24 + 373 00a4 01F0 breq .L27 + 374 .LSM55: + 375 00a6 8530 cpi r24,lo8(5) + 376 00a8 01F0 breq .L28 + 377 .L40: + 378 .LBE286: + 379 .LBB287: + 380 .LBB288: + 381 .LSM56: + 382 00aa 8091 E800 lds r24,232 + 383 .LVL34: + 384 .LBE288: + 385 .LBE287: + 386 .LSM57: + 387 00ae 82FF sbrs r24,2 + 388 00b0 00C0 rjmp .L37 + 389 00b2 80E0 ldi r24,lo8(0) + 390 00b4 0895 ret + 391 .LVL35: + 392 .L27: + 393 00b6 82E0 ldi r24,lo8(2) + 394 .LVL36: + 395 00b8 0895 ret + 396 .LVL37: + 397 .L28: + 398 00ba 83E0 ldi r24,lo8(3) + 399 .LVL38: + 400 .LSM58: + 401 00bc 0895 ret + 402 .LFE80: + 404 .section .text.Endpoint_Write_Control_Stream_BE,"ax",@progbits + 405 .global Endpoint_Write_Control_Stream_BE + 407 Endpoint_Write_Control_Stream_BE: + 408 .LFB82: + 409 .LSM59: + 410 .LVL39: + 411 /* prologue: function */ + 412 /* frame size = 0 */ + 413 0000 9C01 movw r18,r24 + 414 .LSM60: + 415 0002 4091 0000 lds r20,USB_ControlRequest+6 + 416 0006 5091 0000 lds r21,(USB_ControlRequest+6)+1 + 417 .LVL40: + 418 000a 4617 cp r20,r22 + 419 000c 5707 cpc r21,r23 + 420 000e 00F4 brsh .L44 + 421 .LVL41: + 422 .L47: + 423 .LSM61: + 424 0010 FB01 movw r30,r22 + 425 .LVL42: + 426 0012 3197 sbiw r30,1 + 427 0014 E20F add r30,r18 + 428 0016 F31F adc r31,r19 + 429 0018 90E0 ldi r25,lo8(0) + 430 .LVL43: + 431 001a 00C0 rjmp .L63 + 432 .LVL44: + 433 .L44: + 434 .LSM62: + 435 001c 6115 cp r22,__zero_reg__ + 436 001e 7105 cpc r23,__zero_reg__ + 437 0020 01F0 breq .L46 + 438 .LVL45: + 439 0022 AB01 movw r20,r22 + 440 0024 00C0 rjmp .L47 + 441 .L46: + 442 .LBB289: + 443 .LBB290: + 444 .LSM63: + 445 0026 8091 E800 lds r24,232 + 446 002a 8E77 andi r24,lo8(126) + 447 002c 8093 E800 sts 232,r24 + 448 0030 40E0 ldi r20,lo8(0) + 449 0032 50E0 ldi r21,hi8(0) + 450 .LVL46: + 451 0034 00C0 rjmp .L47 + 452 .LVL47: + 453 .L57: + 454 .LBE290: + 455 .LBE289: + 456 .LBB291: + 457 .LSM64: + 458 0036 8091 0000 lds r24,USB_DeviceState + 459 .LVL48: + 460 .LSM65: + 461 003a 8823 tst r24 + 462 003c 01F4 brne .+2 + 463 003e 00C0 rjmp .L48 + 464 .LSM66: + 465 0040 8530 cpi r24,lo8(5) + 466 0042 01F4 brne .+2 + 467 0044 00C0 rjmp .L49 + 468 .LBB292: + 469 .LBB293: + 470 .LSM67: + 471 0046 8091 E800 lds r24,232 + 472 .LVL49: + 473 .LBE293: + 474 .LBE292: + 475 .LSM68: + 476 004a 83FF sbrs r24,3 + 477 004c 00C0 rjmp .L50 + 478 004e 81E0 ldi r24,lo8(1) + 479 0050 0895 ret + 480 .L50: + 481 .LBB294: + 482 .LBB295: + 483 .LSM69: + 484 0052 8091 E800 lds r24,232 + 485 .LBE295: + 486 .LBE294: + 487 .LSM70: + 488 0056 82FD sbrc r24,2 + 489 0058 00C0 rjmp .L61 + 490 .LBB296: + 491 .LBB297: + 492 .LSM71: + 493 005a 8091 E800 lds r24,232 + 494 .LBE297: + 495 .LBE296: + 496 .LSM72: + 497 005e 80FF sbrs r24,0 + 498 0060 00C0 rjmp .L63 + 499 .LBB298: + 500 .LBB299: + 501 .LBB300: + 502 .LSM73: + 503 0062 8091 F200 lds r24,242 + 504 0066 282F mov r18,r24 + 505 .LVL50: + 506 0068 30E0 ldi r19,lo8(0) + 507 006a 00C0 rjmp .L53 + 508 .L55: + 509 .LBE300: + 510 .LBE299: + 511 .LSM74: + 512 006c 8081 ld r24,Z + 513 006e 3197 sbiw r30,1 + 514 .LBB301: + 515 .LBB302: + 516 .LSM75: + 517 0070 8093 F100 sts 241,r24 + 518 .LBE302: + 519 .LBE301: + 520 .LSM76: + 521 0074 4150 subi r20,lo8(-(-1)) + 522 0076 5040 sbci r21,hi8(-(-1)) + 523 .LSM77: + 524 0078 2F5F subi r18,lo8(-(1)) + 525 007a 3F4F sbci r19,hi8(-(1)) + 526 .LVL51: + 527 .L53: + 528 .LSM78: + 529 007c 4115 cp r20,__zero_reg__ + 530 007e 5105 cpc r21,__zero_reg__ + 531 0080 01F0 breq .L54 + 532 0082 2830 cpi r18,8 + 533 0084 3105 cpc r19,__zero_reg__ + 534 0086 00F0 brlo .L55 + 535 .L54: + 536 .LSM79: + 537 0088 90E0 ldi r25,lo8(0) + 538 008a 2830 cpi r18,8 + 539 008c 3105 cpc r19,__zero_reg__ + 540 008e 01F4 brne .L56 + 541 0090 91E0 ldi r25,lo8(1) + 542 .L56: + 543 .LBB303: + 544 .LBB304: + 545 .LSM80: + 546 0092 8091 E800 lds r24,232 + 547 0096 8E77 andi r24,lo8(126) + 548 0098 8093 E800 sts 232,r24 + 549 .LVL52: + 550 .L63: + 551 .LBE304: + 552 .LBE303: + 553 .LBE298: + 554 .LBE291: + 555 .LSM81: + 556 009c 4115 cp r20,__zero_reg__ + 557 009e 5105 cpc r21,__zero_reg__ + 558 00a0 01F4 brne .L57 + 559 00a2 9923 tst r25 + 560 00a4 01F4 brne .L57 + 561 00a6 00C0 rjmp .L61 + 562 .LVL53: + 563 .L58: + 564 .LBB305: + 565 .LSM82: + 566 00a8 8091 0000 lds r24,USB_DeviceState + 567 .LVL54: + 568 .LSM83: + 569 00ac 8823 tst r24 + 570 00ae 01F0 breq .L48 + 571 .LSM84: + 572 00b0 8530 cpi r24,lo8(5) + 573 00b2 01F0 breq .L49 + 574 .LVL55: + 575 .L61: + 576 .LBE305: + 577 .LBB306: + 578 .LBB307: + 579 .LSM85: + 580 00b4 8091 E800 lds r24,232 + 581 .LVL56: + 582 .LBE307: + 583 .LBE306: + 584 .LSM86: + 585 00b8 82FF sbrs r24,2 + 586 00ba 00C0 rjmp .L58 + 587 00bc 80E0 ldi r24,lo8(0) + 588 00be 0895 ret + 589 .LVL57: + 590 .L48: + 591 00c0 82E0 ldi r24,lo8(2) + 592 .LVL58: + 593 00c2 0895 ret + 594 .LVL59: + 595 .L49: + 596 00c4 83E0 ldi r24,lo8(3) + 597 .LVL60: + 598 .LSM87: + 599 00c6 0895 ret + 600 .LFE82: + 602 .section .text.Endpoint_Write_Control_PStream_BE,"ax",@progbits + 603 .global Endpoint_Write_Control_PStream_BE + 605 Endpoint_Write_Control_PStream_BE: + 606 .LFB83: + 607 .LSM88: + 608 .LVL61: + 609 /* prologue: function */ + 610 /* frame size = 0 */ + 611 0000 AC01 movw r20,r24 + 612 .LSM89: + 613 0002 2091 0000 lds r18,USB_ControlRequest+6 + 614 0006 3091 0000 lds r19,(USB_ControlRequest+6)+1 + 615 .LVL62: + 616 000a 2617 cp r18,r22 + 617 000c 3707 cpc r19,r23 + 618 000e 00F4 brsh .L65 + 619 .LVL63: + 620 .L68: + 621 .LSM90: + 622 0010 6150 subi r22,lo8(-(-1)) + 623 0012 7040 sbci r23,hi8(-(-1)) + 624 .LVL64: + 625 0014 640F add r22,r20 + 626 0016 751F adc r23,r21 + 627 0018 40E0 ldi r20,lo8(0) + 628 .LVL65: + 629 001a 00C0 rjmp .L84 + 630 .LVL66: + 631 .L65: + 632 .LSM91: + 633 001c 6115 cp r22,__zero_reg__ + 634 001e 7105 cpc r23,__zero_reg__ + 635 0020 01F0 breq .L67 + 636 .LVL67: + 637 0022 9B01 movw r18,r22 + 638 0024 00C0 rjmp .L68 + 639 .L67: + 640 .LBB308: + 641 .LBB309: + 642 .LSM92: + 643 0026 8091 E800 lds r24,232 + 644 002a 8E77 andi r24,lo8(126) + 645 002c 8093 E800 sts 232,r24 + 646 0030 20E0 ldi r18,lo8(0) + 647 0032 30E0 ldi r19,hi8(0) + 648 .LVL68: + 649 0034 00C0 rjmp .L68 + 650 .LVL69: + 651 .L78: + 652 .LBE309: + 653 .LBE308: + 654 .LBB310: + 655 .LSM93: + 656 0036 8091 0000 lds r24,USB_DeviceState + 657 .LVL70: + 658 .LSM94: + 659 003a 8823 tst r24 + 660 003c 01F4 brne .+2 + 661 003e 00C0 rjmp .L69 + 662 .LSM95: + 663 0040 8530 cpi r24,lo8(5) + 664 0042 01F4 brne .+2 + 665 0044 00C0 rjmp .L70 + 666 .LBB311: + 667 .LBB312: + 668 .LSM96: + 669 0046 8091 E800 lds r24,232 + 670 .LVL71: + 671 .LBE312: + 672 .LBE311: + 673 .LSM97: + 674 004a 83FF sbrs r24,3 + 675 004c 00C0 rjmp .L71 + 676 004e 81E0 ldi r24,lo8(1) + 677 0050 0895 ret + 678 .L71: + 679 .LBB313: + 680 .LBB314: + 681 .LSM98: + 682 0052 8091 E800 lds r24,232 + 683 .LBE314: + 684 .LBE313: + 685 .LSM99: + 686 0056 82FD sbrc r24,2 + 687 0058 00C0 rjmp .L82 + 688 .LBB315: + 689 .LBB316: + 690 .LSM100: + 691 005a 8091 E800 lds r24,232 + 692 .LBE316: + 693 .LBE315: + 694 .LSM101: + 695 005e 80FF sbrs r24,0 + 696 0060 00C0 rjmp .L84 + 697 .LBB317: + 698 .LBB318: + 699 .LBB319: + 700 .LSM102: + 701 0062 8091 F200 lds r24,242 + 702 0066 90E0 ldi r25,lo8(0) + 703 0068 00C0 rjmp .L74 + 704 .LVL72: + 705 .L76: + 706 .LSM103: + 707 006a FB01 movw r30,r22 + 708 .LVL73: + 709 .LBE319: + 710 .LBE318: + 711 .LBB320: + 712 .LSM104: + 713 006c 6150 subi r22,lo8(-(-1)) + 714 006e 7040 sbci r23,hi8(-(-1)) + 715 /* #APP */ + 716 ; 31 "LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c" 1 + 717 0070 E491 lpm r30, Z + 718 + 719 ; 0 "" 2 + 720 .LVL74: + 721 /* #NOAPP */ + 722 .LBE320: + 723 .LBB321: + 724 .LBB322: + 725 .LSM105: + 726 0072 E093 F100 sts 241,r30 + 727 .LBE322: + 728 .LBE321: + 729 .LSM106: + 730 0076 2150 subi r18,lo8(-(-1)) + 731 0078 3040 sbci r19,hi8(-(-1)) + 732 .LSM107: + 733 007a 0196 adiw r24,1 + 734 .L74: + 735 .LSM108: + 736 007c 2115 cp r18,__zero_reg__ + 737 007e 3105 cpc r19,__zero_reg__ + 738 0080 01F0 breq .L75 + 739 0082 8830 cpi r24,8 + 740 0084 9105 cpc r25,__zero_reg__ + 741 0086 00F0 brlo .L76 + 742 .L75: + 743 .LSM109: + 744 0088 40E0 ldi r20,lo8(0) + 745 008a 0897 sbiw r24,8 + 746 008c 01F4 brne .L77 + 747 008e 41E0 ldi r20,lo8(1) + 748 .L77: + 749 .LBB323: + 750 .LBB324: + 751 .LSM110: + 752 0090 8091 E800 lds r24,232 + 753 .LVL75: + 754 0094 8E77 andi r24,lo8(126) + 755 0096 8093 E800 sts 232,r24 + 756 .LVL76: + 757 .L84: + 758 .LBE324: + 759 .LBE323: + 760 .LBE317: + 761 .LBE310: + 762 .LSM111: + 763 009a 2115 cp r18,__zero_reg__ + 764 009c 3105 cpc r19,__zero_reg__ + 765 009e 01F4 brne .L78 + 766 00a0 4423 tst r20 + 767 00a2 01F4 brne .L78 + 768 00a4 00C0 rjmp .L82 + 769 .LVL77: + 770 .L79: + 771 .LBB325: + 772 .LSM112: + 773 00a6 8091 0000 lds r24,USB_DeviceState + 774 .LVL78: + 775 .LSM113: + 776 00aa 8823 tst r24 + 777 00ac 01F0 breq .L69 + 778 .LSM114: + 779 00ae 8530 cpi r24,lo8(5) + 780 00b0 01F0 breq .L70 + 781 .LVL79: + 782 .L82: + 783 .LBE325: + 784 .LBB326: + 785 .LBB327: + 786 .LSM115: + 787 00b2 8091 E800 lds r24,232 + 788 .LVL80: + 789 .LBE327: + 790 .LBE326: + 791 .LSM116: + 792 00b6 82FF sbrs r24,2 + 793 00b8 00C0 rjmp .L79 + 794 00ba 80E0 ldi r24,lo8(0) + 795 00bc 0895 ret + 796 .LVL81: + 797 .L69: + 798 00be 82E0 ldi r24,lo8(2) + 799 .LVL82: + 800 00c0 0895 ret + 801 .LVL83: + 802 .L70: + 803 00c2 83E0 ldi r24,lo8(3) + 804 .LVL84: + 805 .LSM117: + 806 00c4 0895 ret + 807 .LFE83: + 809 .section .text.Endpoint_Read_Control_Stream_LE,"ax",@progbits + 810 .global Endpoint_Read_Control_Stream_LE + 812 Endpoint_Read_Control_Stream_LE: + 813 .LFB85: + 814 .LSM118: + 815 .LVL85: + 816 /* prologue: function */ + 817 /* frame size = 0 */ + 818 0000 9C01 movw r18,r24 + 819 .LVL86: + 820 .LSM119: + 821 0002 6115 cp r22,__zero_reg__ + 822 0004 7105 cpc r23,__zero_reg__ + 823 0006 01F4 brne .L86 + 824 .LBB328: + 825 .LBB329: + 826 .LSM120: + 827 0008 8091 E800 lds r24,232 + 828 000c 8B77 andi r24,lo8(123) + 829 000e 8093 E800 sts 232,r24 + 830 .L86: + 831 .LBE329: + 832 .LBE328: + 833 .LSM121: + 834 0012 F901 movw r30,r18 + 835 .LVL87: + 836 0014 00C0 rjmp .L87 + 837 .LVL88: + 838 .L100: + 839 .LBB330: + 840 .LSM122: + 841 0016 8091 0000 lds r24,USB_DeviceState + 842 .LVL89: + 843 .LSM123: + 844 001a 8823 tst r24 + 845 001c 01F0 breq .L88 + 846 .LSM124: + 847 001e 8530 cpi r24,lo8(5) + 848 0020 01F0 breq .L89 + 849 .LBB331: + 850 .LBB332: + 851 .LSM125: + 852 0022 8091 E800 lds r24,232 + 853 .LVL90: + 854 .LBE332: + 855 .LBE331: + 856 .LSM126: + 857 0026 83FF sbrs r24,3 + 858 0028 00C0 rjmp .L90 + 859 002a 81E0 ldi r24,lo8(1) + 860 002c 0895 ret + 861 .L90: + 862 .LBB333: + 863 .LBB334: + 864 .LSM127: + 865 002e 8091 E800 lds r24,232 + 866 .LBE334: + 867 .LBE333: + 868 .LSM128: + 869 0032 82FF sbrs r24,2 + 870 0034 00C0 rjmp .L100 + 871 0036 00C0 rjmp .L99 + 872 .L95: + 873 .LBB335: + 874 .LBB336: + 875 .LSM129: + 876 0038 8091 F100 lds r24,241 + 877 .LBE336: + 878 .LBE335: + 879 .LSM130: + 880 003c 8193 st Z+,r24 + 881 .LSM131: + 882 003e 6150 subi r22,lo8(-(-1)) + 883 0040 7040 sbci r23,hi8(-(-1)) + 884 .LVL91: + 885 .LSM132: + 886 0042 01F0 breq .L94 + 887 .L99: + 888 .LBB337: + 889 .LBB338: + 890 .LSM133: + 891 0044 8091 F200 lds r24,242 + 892 .LBE338: + 893 .LBE337: + 894 .LSM134: + 895 0048 8823 tst r24 + 896 004a 01F4 brne .L95 + 897 .L94: + 898 .LBB339: + 899 .LBB340: + 900 .LSM135: + 901 004c 8091 E800 lds r24,232 + 902 0050 8B77 andi r24,lo8(123) + 903 0052 8093 E800 sts 232,r24 + 904 .L87: + 905 .LBE340: + 906 .LBE339: + 907 .LBE330: + 908 .LSM136: + 909 0056 6115 cp r22,__zero_reg__ + 910 0058 7105 cpc r23,__zero_reg__ + 911 005a 01F4 brne .L100 + 912 005c 00C0 rjmp .L101 + 913 .L97: + 914 .LBB341: + 915 .LSM137: + 916 005e 8091 0000 lds r24,USB_DeviceState + 917 .LVL92: + 918 .LSM138: + 919 0062 8823 tst r24 + 920 0064 01F0 breq .L88 + 921 .LSM139: + 922 0066 8530 cpi r24,lo8(5) + 923 0068 01F0 breq .L89 + 924 .L101: + 925 .LBE341: + 926 .LBB342: + 927 .LBB343: + 928 .LSM140: + 929 006a 8091 E800 lds r24,232 + 930 .LVL93: + 931 .LBE343: + 932 .LBE342: + 933 .LSM141: + 934 006e 80FF sbrs r24,0 + 935 0070 00C0 rjmp .L97 + 936 0072 80E0 ldi r24,lo8(0) + 937 0074 0895 ret + 938 .LVL94: + 939 .L88: + 940 0076 82E0 ldi r24,lo8(2) + 941 .LVL95: + 942 0078 0895 ret + 943 .LVL96: + 944 .L89: + 945 007a 83E0 ldi r24,lo8(3) + 946 .LVL97: + 947 .LSM142: + 948 007c 0895 ret + 949 .LFE85: + 951 .section .text.Endpoint_Read_Control_Stream_BE,"ax",@progbits + 952 .global Endpoint_Read_Control_Stream_BE + 954 Endpoint_Read_Control_Stream_BE: + 955 .LFB87: + 956 .LSM143: + 957 .LVL98: + 958 /* prologue: function */ + 959 /* frame size = 0 */ + 960 0000 AC01 movw r20,r24 + 961 .LSM144: + 962 0002 6115 cp r22,__zero_reg__ + 963 0004 7105 cpc r23,__zero_reg__ + 964 0006 01F0 breq .L103 + 965 .LVL99: + 966 0008 9B01 movw r18,r22 + 967 000a 00C0 rjmp .L104 + 968 .LVL100: + 969 .L103: + 970 .LBB344: + 971 .LBB345: + 972 .LSM145: + 973 000c 8091 E800 lds r24,232 + 974 0010 8B77 andi r24,lo8(123) + 975 0012 8093 E800 sts 232,r24 + 976 0016 20E0 ldi r18,lo8(0) + 977 0018 30E0 ldi r19,hi8(0) + 978 .LVL101: + 979 .L104: + 980 .LBE345: + 981 .LBE344: + 982 .LSM146: + 983 001a FB01 movw r30,r22 + 984 .LVL102: + 985 001c 3197 sbiw r30,1 + 986 001e E40F add r30,r20 + 987 0020 F51F adc r31,r21 + 988 0022 00C0 rjmp .L105 + 989 .L118: + 990 .LBB346: + 991 .LSM147: + 992 0024 8091 0000 lds r24,USB_DeviceState + 993 .LVL103: + 994 .LSM148: + 995 0028 8823 tst r24 + 996 002a 01F0 breq .L106 + 997 .LSM149: + 998 002c 8530 cpi r24,lo8(5) + 999 002e 01F0 breq .L107 + 1000 .LBB347: + 1001 .LBB348: + 1002 .LSM150: + 1003 0030 8091 E800 lds r24,232 + 1004 .LVL104: + 1005 .LBE348: + 1006 .LBE347: + 1007 .LSM151: + 1008 0034 83FF sbrs r24,3 + 1009 0036 00C0 rjmp .L108 + 1010 0038 81E0 ldi r24,lo8(1) + 1011 003a 0895 ret + 1012 .L108: + 1013 .LBB349: + 1014 .LBB350: + 1015 .LSM152: + 1016 003c 8091 E800 lds r24,232 + 1017 .LBE350: + 1018 .LBE349: + 1019 .LSM153: + 1020 0040 82FF sbrs r24,2 + 1021 0042 00C0 rjmp .L118 + 1022 0044 00C0 rjmp .L117 + 1023 .L113: + 1024 .LBB351: + 1025 .LBB352: + 1026 .LSM154: + 1027 0046 8091 F100 lds r24,241 + 1028 .LBE352: + 1029 .LBE351: + 1030 .LSM155: + 1031 004a 8083 st Z,r24 + 1032 004c 3197 sbiw r30,1 + 1033 .LSM156: + 1034 004e 2150 subi r18,lo8(-(-1)) + 1035 0050 3040 sbci r19,hi8(-(-1)) + 1036 .LSM157: + 1037 0052 01F0 breq .L112 + 1038 .LVL105: + 1039 .L117: + 1040 .LBB353: + 1041 .LBB354: + 1042 .LSM158: + 1043 0054 8091 F200 lds r24,242 + 1044 .LBE354: + 1045 .LBE353: + 1046 .LSM159: + 1047 0058 8823 tst r24 + 1048 005a 01F4 brne .L113 + 1049 .L112: + 1050 .LBB355: + 1051 .LBB356: + 1052 .LSM160: + 1053 005c 8091 E800 lds r24,232 + 1054 0060 8B77 andi r24,lo8(123) + 1055 0062 8093 E800 sts 232,r24 + 1056 .LVL106: + 1057 .L105: + 1058 .LBE356: + 1059 .LBE355: + 1060 .LBE346: + 1061 .LSM161: + 1062 0066 2115 cp r18,__zero_reg__ + 1063 0068 3105 cpc r19,__zero_reg__ + 1064 006a 01F4 brne .L118 + 1065 006c 00C0 rjmp .L119 + 1066 .LVL107: + 1067 .L115: + 1068 .LBB357: + 1069 .LSM162: + 1070 006e 8091 0000 lds r24,USB_DeviceState + 1071 .LVL108: + 1072 .LSM163: + 1073 0072 8823 tst r24 + 1074 0074 01F0 breq .L106 + 1075 .LSM164: + 1076 0076 8530 cpi r24,lo8(5) + 1077 0078 01F0 breq .L107 + 1078 .LVL109: + 1079 .L119: + 1080 .LBE357: + 1081 .LBB358: + 1082 .LBB359: + 1083 .LSM165: + 1084 007a 8091 E800 lds r24,232 + 1085 .LVL110: + 1086 .LBE359: + 1087 .LBE358: + 1088 .LSM166: + 1089 007e 80FF sbrs r24,0 + 1090 0080 00C0 rjmp .L115 + 1091 0082 80E0 ldi r24,lo8(0) + 1092 0084 0895 ret + 1093 .LVL111: + 1094 .L106: + 1095 0086 82E0 ldi r24,lo8(2) + 1096 .LVL112: + 1097 0088 0895 ret + 1098 .LVL113: + 1099 .L107: + 1100 008a 83E0 ldi r24,lo8(3) + 1101 .LVL114: + 1102 .LSM167: + 1103 008c 0895 ret + 1104 .LFE87: + 1106 .section .text.Endpoint_Read_Control_EStream_BE,"ax",@progbits + 1107 .global Endpoint_Read_Control_EStream_BE + 1109 Endpoint_Read_Control_EStream_BE: + 1110 .LFB88: + 1111 .LSM168: + 1112 .LVL115: + 1113 0000 0F93 push r16 + 1114 0002 1F93 push r17 + 1115 0004 CF93 push r28 + 1116 0006 DF93 push r29 + 1117 /* prologue: function */ + 1118 /* frame size = 0 */ + 1119 0008 AC01 movw r20,r24 + 1120 .LSM169: + 1121 000a 6115 cp r22,__zero_reg__ + 1122 000c 7105 cpc r23,__zero_reg__ + 1123 000e 01F0 breq .L121 + 1124 .LVL116: + 1125 0010 8B01 movw r16,r22 + 1126 0012 00C0 rjmp .L122 + 1127 .LVL117: + 1128 .L121: + 1129 .LBB360: + 1130 .LBB361: + 1131 .LSM170: + 1132 0014 8091 E800 lds r24,232 + 1133 0018 8B77 andi r24,lo8(123) + 1134 001a 8093 E800 sts 232,r24 + 1135 001e 00E0 ldi r16,lo8(0) + 1136 0020 10E0 ldi r17,hi8(0) + 1137 .LVL118: + 1138 .L122: + 1139 .LBE361: + 1140 .LBE360: + 1141 .LSM171: + 1142 0022 9B01 movw r18,r22 + 1143 .LVL119: + 1144 0024 2150 subi r18,lo8(-(-1)) + 1145 0026 3040 sbci r19,hi8(-(-1)) + 1146 0028 240F add r18,r20 + 1147 002a 351F adc r19,r21 + 1148 002c 00C0 rjmp .L123 + 1149 .LVL120: + 1150 .L136: + 1151 .LBB362: + 1152 .LSM172: + 1153 002e 8091 0000 lds r24,USB_DeviceState + 1154 .LVL121: + 1155 .LSM173: + 1156 0032 8823 tst r24 + 1157 0034 01F0 breq .L124 + 1158 .LSM174: + 1159 0036 8530 cpi r24,lo8(5) + 1160 0038 01F0 breq .L125 + 1161 .LBB363: + 1162 .LBB364: + 1163 .LSM175: + 1164 003a 8091 E800 lds r24,232 + 1165 .LVL122: + 1166 .LBE364: + 1167 .LBE363: + 1168 .LSM176: + 1169 003e 83FF sbrs r24,3 + 1170 0040 00C0 rjmp .L126 + 1171 0042 81E0 ldi r24,lo8(1) + 1172 0044 00C0 rjmp .L127 + 1173 .L126: + 1174 .LBB365: + 1175 .LBB366: + 1176 .LSM177: + 1177 0046 8091 E800 lds r24,232 + 1178 .LBE366: + 1179 .LBE365: + 1180 .LSM178: + 1181 004a 82FF sbrs r24,2 + 1182 004c 00C0 rjmp .L136 + 1183 004e 00C0 rjmp .L135 + 1184 .L131: + 1185 .LSM179: + 1186 0050 E901 movw r28,r18 + 1187 0052 2197 sbiw r28,1 + 1188 .LVL123: + 1189 .LBB367: + 1190 .LBB368: + 1191 .LSM180: + 1192 0054 6091 F100 lds r22,241 + 1193 .LBE368: + 1194 .LBE367: + 1195 .LSM181: + 1196 0058 C901 movw r24,r18 + 1197 005a 0E94 0000 call __eeupd_byte_usb162 + 1198 .LVL124: + 1199 .LSM182: + 1200 005e 0150 subi r16,lo8(-(-1)) + 1201 0060 1040 sbci r17,hi8(-(-1)) + 1202 .LSM183: + 1203 0062 01F0 breq .L130 + 1204 0064 9E01 movw r18,r28 + 1205 .LVL125: + 1206 .L135: + 1207 .LBB369: + 1208 .LBB370: + 1209 .LSM184: + 1210 0066 8091 F200 lds r24,242 + 1211 .LBE370: + 1212 .LBE369: + 1213 .LSM185: + 1214 006a 8823 tst r24 + 1215 006c 01F4 brne .L131 + 1216 006e E901 movw r28,r18 + 1217 .LVL126: + 1218 .L130: + 1219 .LBB371: + 1220 .LBB372: + 1221 .LSM186: + 1222 0070 8091 E800 lds r24,232 + 1223 0074 8B77 andi r24,lo8(123) + 1224 0076 8093 E800 sts 232,r24 + 1225 007a 9E01 movw r18,r28 + 1226 .LVL127: + 1227 .L123: + 1228 .LBE372: + 1229 .LBE371: + 1230 .LBE362: + 1231 .LSM187: + 1232 007c 0115 cp r16,__zero_reg__ + 1233 007e 1105 cpc r17,__zero_reg__ + 1234 0080 01F4 brne .L136 + 1235 0082 00C0 rjmp .L137 + 1236 .LVL128: + 1237 .L133: + 1238 .LBB373: + 1239 .LSM188: + 1240 0084 8091 0000 lds r24,USB_DeviceState + 1241 .LVL129: + 1242 .LSM189: + 1243 0088 8823 tst r24 + 1244 008a 01F0 breq .L124 + 1245 .LSM190: + 1246 008c 8530 cpi r24,lo8(5) + 1247 008e 01F0 breq .L125 + 1248 .LVL130: + 1249 .L137: + 1250 .LBE373: + 1251 .LBB374: + 1252 .LBB375: + 1253 .LSM191: + 1254 0090 8091 E800 lds r24,232 + 1255 .LVL131: + 1256 .LBE375: + 1257 .LBE374: + 1258 .LSM192: + 1259 0094 80FF sbrs r24,0 + 1260 0096 00C0 rjmp .L133 + 1261 0098 80E0 ldi r24,lo8(0) + 1262 009a 00C0 rjmp .L127 + 1263 .LVL132: + 1264 .L124: + 1265 009c 82E0 ldi r24,lo8(2) + 1266 .LVL133: + 1267 009e 00C0 rjmp .L127 + 1268 .LVL134: + 1269 .L125: + 1270 00a0 83E0 ldi r24,lo8(3) + 1271 .LVL135: + 1272 .L127: + 1273 /* epilogue start */ + 1274 .LSM193: + 1275 00a2 DF91 pop r29 + 1276 00a4 CF91 pop r28 + 1277 00a6 1F91 pop r17 + 1278 00a8 0F91 pop r16 + 1279 .LVL136: + 1280 00aa 0895 ret + 1281 .LFE88: + 1283 .section .text.Endpoint_Read_Control_EStream_LE,"ax",@progbits + 1284 .global Endpoint_Read_Control_EStream_LE + 1286 Endpoint_Read_Control_EStream_LE: + 1287 .LFB86: + 1288 .LSM194: + 1289 .LVL137: + 1290 0000 0F93 push r16 + 1291 0002 1F93 push r17 + 1292 0004 CF93 push r28 + 1293 0006 DF93 push r29 + 1294 /* prologue: function */ + 1295 /* frame size = 0 */ + 1296 0008 9C01 movw r18,r24 + 1297 .LVL138: + 1298 000a 8B01 movw r16,r22 + 1299 .LSM195: + 1300 000c 6115 cp r22,__zero_reg__ + 1301 000e 7105 cpc r23,__zero_reg__ + 1302 0010 01F4 brne .L140 + 1303 .LBB376: + 1304 .LBB377: + 1305 .LSM196: + 1306 0012 8091 E800 lds r24,232 + 1307 0016 8B77 andi r24,lo8(123) + 1308 0018 8093 E800 sts 232,r24 + 1309 001c 00C0 rjmp .L140 + 1310 .LVL139: + 1311 .L153: + 1312 .LBE377: + 1313 .LBE376: + 1314 .LBB378: + 1315 .LSM197: + 1316 001e 8091 0000 lds r24,USB_DeviceState + 1317 .LVL140: + 1318 .LSM198: + 1319 0022 8823 tst r24 + 1320 0024 01F0 breq .L141 + 1321 .LSM199: + 1322 0026 8530 cpi r24,lo8(5) + 1323 0028 01F0 breq .L142 + 1324 .LBB379: + 1325 .LBB380: + 1326 .LSM200: + 1327 002a 8091 E800 lds r24,232 + 1328 .LVL141: + 1329 .LBE380: + 1330 .LBE379: + 1331 .LSM201: + 1332 002e 83FF sbrs r24,3 + 1333 0030 00C0 rjmp .L143 + 1334 0032 81E0 ldi r24,lo8(1) + 1335 0034 00C0 rjmp .L144 + 1336 .L143: + 1337 .LBB381: + 1338 .LBB382: + 1339 .LSM202: + 1340 0036 8091 E800 lds r24,232 + 1341 .LBE382: + 1342 .LBE381: + 1343 .LSM203: + 1344 003a 82FF sbrs r24,2 + 1345 003c 00C0 rjmp .L153 + 1346 003e 00C0 rjmp .L152 + 1347 .L148: + 1348 .LSM204: + 1349 0040 E901 movw r28,r18 + 1350 0042 2196 adiw r28,1 + 1351 .LVL142: + 1352 .LBB383: + 1353 .LBB384: + 1354 .LSM205: + 1355 0044 6091 F100 lds r22,241 + 1356 .LBE384: + 1357 .LBE383: + 1358 .LSM206: + 1359 0048 C901 movw r24,r18 + 1360 004a 0E94 0000 call __eeupd_byte_usb162 + 1361 .LSM207: + 1362 004e 0150 subi r16,lo8(-(-1)) + 1363 0050 1040 sbci r17,hi8(-(-1)) + 1364 .LSM208: + 1365 0052 01F0 breq .L147 + 1366 0054 9E01 movw r18,r28 + 1367 .LVL143: + 1368 .L152: + 1369 .LBB385: + 1370 .LBB386: + 1371 .LSM209: + 1372 0056 8091 F200 lds r24,242 + 1373 .LBE386: + 1374 .LBE385: + 1375 .LSM210: + 1376 005a 8823 tst r24 + 1377 005c 01F4 brne .L148 + 1378 005e E901 movw r28,r18 + 1379 .LVL144: + 1380 .L147: + 1381 .LBB387: + 1382 .LBB388: + 1383 .LSM211: + 1384 0060 8091 E800 lds r24,232 + 1385 0064 8B77 andi r24,lo8(123) + 1386 0066 8093 E800 sts 232,r24 + 1387 006a 9E01 movw r18,r28 + 1388 .LVL145: + 1389 .L140: + 1390 .LBE388: + 1391 .LBE387: + 1392 .LBE378: + 1393 .LSM212: + 1394 006c 0115 cp r16,__zero_reg__ + 1395 006e 1105 cpc r17,__zero_reg__ + 1396 0070 01F4 brne .L153 + 1397 0072 00C0 rjmp .L154 + 1398 .L150: + 1399 .LBB389: + 1400 .LSM213: + 1401 0074 8091 0000 lds r24,USB_DeviceState + 1402 .LVL146: + 1403 .LSM214: + 1404 0078 8823 tst r24 + 1405 007a 01F0 breq .L141 + 1406 .LSM215: + 1407 007c 8530 cpi r24,lo8(5) + 1408 007e 01F0 breq .L142 + 1409 .L154: + 1410 .LBE389: + 1411 .LBB390: + 1412 .LBB391: + 1413 .LSM216: + 1414 0080 8091 E800 lds r24,232 + 1415 .LVL147: + 1416 .LBE391: + 1417 .LBE390: + 1418 .LSM217: + 1419 0084 80FF sbrs r24,0 + 1420 0086 00C0 rjmp .L150 + 1421 0088 80E0 ldi r24,lo8(0) + 1422 008a 00C0 rjmp .L144 + 1423 .LVL148: + 1424 .L141: + 1425 008c 82E0 ldi r24,lo8(2) + 1426 .LVL149: + 1427 008e 00C0 rjmp .L144 + 1428 .LVL150: + 1429 .L142: + 1430 0090 83E0 ldi r24,lo8(3) + 1431 .LVL151: + 1432 .L144: + 1433 /* epilogue start */ + 1434 .LSM218: + 1435 0092 DF91 pop r29 + 1436 0094 CF91 pop r28 + 1437 0096 1F91 pop r17 + 1438 0098 0F91 pop r16 + 1439 .LVL152: + 1440 009a 0895 ret + 1441 .LFE86: + 1443 .section .text.Endpoint_Write_Control_EStream_BE,"ax",@progbits + 1444 .global Endpoint_Write_Control_EStream_BE + 1446 Endpoint_Write_Control_EStream_BE: + 1447 .LFB84: + 1448 .LSM219: + 1449 .LVL153: + 1450 0000 EF92 push r14 + 1451 0002 FF92 push r15 + 1452 0004 0F93 push r16 + 1453 0006 1F93 push r17 + 1454 0008 CF93 push r28 + 1455 000a DF93 push r29 + 1456 /* prologue: function */ + 1457 /* frame size = 0 */ + 1458 000c 9C01 movw r18,r24 + 1459 .LSM220: + 1460 000e E090 0000 lds r14,USB_ControlRequest+6 + 1461 0012 F090 0000 lds r15,(USB_ControlRequest+6)+1 + 1462 .LVL154: + 1463 0016 E616 cp r14,r22 + 1464 0018 F706 cpc r15,r23 + 1465 001a 00F4 brsh .L156 + 1466 .LVL155: + 1467 .L159: + 1468 .LSM221: + 1469 001c 6150 subi r22,lo8(-(-1)) + 1470 001e 7040 sbci r23,hi8(-(-1)) + 1471 .LVL156: + 1472 0020 620F add r22,r18 + 1473 0022 731F adc r23,r19 + 1474 0024 90E0 ldi r25,lo8(0) + 1475 .LVL157: + 1476 0026 00C0 rjmp .L175 + 1477 .LVL158: + 1478 .L156: + 1479 .LSM222: + 1480 0028 6115 cp r22,__zero_reg__ + 1481 002a 7105 cpc r23,__zero_reg__ + 1482 002c 01F0 breq .L158 + 1483 .LVL159: + 1484 002e 7B01 movw r14,r22 + 1485 0030 00C0 rjmp .L159 + 1486 .L158: + 1487 .LBB392: + 1488 .LBB393: + 1489 .LSM223: + 1490 0032 8091 E800 lds r24,232 + 1491 0036 8E77 andi r24,lo8(126) + 1492 0038 8093 E800 sts 232,r24 + 1493 003c EE24 clr r14 + 1494 003e FF24 clr r15 + 1495 .LVL160: + 1496 0040 00C0 rjmp .L159 + 1497 .LVL161: + 1498 .L169: + 1499 .LBE393: + 1500 .LBE392: + 1501 .LBB394: + 1502 .LSM224: + 1503 0042 8091 0000 lds r24,USB_DeviceState + 1504 .LVL162: + 1505 .LSM225: + 1506 0046 8823 tst r24 + 1507 0048 01F4 brne .+2 + 1508 004a 00C0 rjmp .L160 + 1509 .LSM226: + 1510 004c 8530 cpi r24,lo8(5) + 1511 004e 01F4 brne .+2 + 1512 0050 00C0 rjmp .L161 + 1513 .LBB395: + 1514 .LBB396: + 1515 .LSM227: + 1516 0052 8091 E800 lds r24,232 + 1517 .LVL163: + 1518 .LBE396: + 1519 .LBE395: + 1520 .LSM228: + 1521 0056 83FF sbrs r24,3 + 1522 0058 00C0 rjmp .L162 + 1523 005a 81E0 ldi r24,lo8(1) + 1524 005c 00C0 rjmp .L163 + 1525 .L162: + 1526 .LBB397: + 1527 .LBB398: + 1528 .LSM229: + 1529 005e 8091 E800 lds r24,232 + 1530 .LBE398: + 1531 .LBE397: + 1532 .LSM230: + 1533 0062 82FD sbrc r24,2 + 1534 0064 00C0 rjmp .L173 + 1535 .LBB399: + 1536 .LBB400: + 1537 .LSM231: + 1538 0066 8091 E800 lds r24,232 + 1539 .LBE400: + 1540 .LBE399: + 1541 .LSM232: + 1542 006a 80FF sbrs r24,0 + 1543 006c 00C0 rjmp .L175 + 1544 .LBB401: + 1545 .LBB402: + 1546 .LBB403: + 1547 .LSM233: + 1548 006e 8091 F200 lds r24,242 + 1549 0072 C82F mov r28,r24 + 1550 .LVL164: + 1551 0074 D0E0 ldi r29,lo8(0) + 1552 0076 00C0 rjmp .L165 + 1553 .L167: + 1554 .LBE403: + 1555 .LBE402: + 1556 .LSM234: + 1557 0078 8B01 movw r16,r22 + 1558 007a 0150 subi r16,lo8(-(-1)) + 1559 007c 1040 sbci r17,hi8(-(-1)) + 1560 .LVL165: + 1561 007e CB01 movw r24,r22 + 1562 0080 0E94 0000 call __eerd_byte_usb162 + 1563 .LVL166: + 1564 .LBB404: + 1565 .LBB405: + 1566 .LSM235: + 1567 0084 8093 F100 sts 241,r24 + 1568 .LBE405: + 1569 .LBE404: + 1570 .LSM236: + 1571 0088 0894 sec + 1572 008a E108 sbc r14,__zero_reg__ + 1573 008c F108 sbc r15,__zero_reg__ + 1574 .LSM237: + 1575 008e 2196 adiw r28,1 + 1576 0090 B801 movw r22,r16 + 1577 .LVL167: + 1578 .L165: + 1579 .LSM238: + 1580 0092 E114 cp r14,__zero_reg__ + 1581 0094 F104 cpc r15,__zero_reg__ + 1582 0096 01F0 breq .L166 + 1583 0098 C830 cpi r28,8 + 1584 009a D105 cpc r29,__zero_reg__ + 1585 009c 00F0 brlo .L167 + 1586 .L166: + 1587 .LSM239: + 1588 009e 90E0 ldi r25,lo8(0) + 1589 00a0 2897 sbiw r28,8 + 1590 00a2 01F4 brne .L168 + 1591 00a4 91E0 ldi r25,lo8(1) + 1592 .L168: + 1593 .LBB406: + 1594 .LBB407: + 1595 .LSM240: + 1596 00a6 8091 E800 lds r24,232 + 1597 00aa 8E77 andi r24,lo8(126) + 1598 00ac 8093 E800 sts 232,r24 + 1599 .LVL168: + 1600 .L175: + 1601 .LBE407: + 1602 .LBE406: + 1603 .LBE401: + 1604 .LBE394: + 1605 .LSM241: + 1606 00b0 E114 cp r14,__zero_reg__ + 1607 00b2 F104 cpc r15,__zero_reg__ + 1608 00b4 01F4 brne .L169 + 1609 00b6 9923 tst r25 + 1610 00b8 01F4 brne .L169 + 1611 00ba 00C0 rjmp .L173 + 1612 .LVL169: + 1613 .L170: + 1614 .LBB408: + 1615 .LSM242: + 1616 00bc 8091 0000 lds r24,USB_DeviceState + 1617 .LVL170: + 1618 .LSM243: + 1619 00c0 8823 tst r24 + 1620 00c2 01F0 breq .L160 + 1621 .LSM244: + 1622 00c4 8530 cpi r24,lo8(5) + 1623 00c6 01F0 breq .L161 + 1624 .LVL171: + 1625 .L173: + 1626 .LBE408: + 1627 .LBB409: + 1628 .LBB410: + 1629 .LSM245: + 1630 00c8 8091 E800 lds r24,232 + 1631 .LVL172: + 1632 .LBE410: + 1633 .LBE409: + 1634 .LSM246: + 1635 00cc 82FF sbrs r24,2 + 1636 00ce 00C0 rjmp .L170 + 1637 00d0 80E0 ldi r24,lo8(0) + 1638 00d2 00C0 rjmp .L163 + 1639 .LVL173: + 1640 .L160: + 1641 00d4 82E0 ldi r24,lo8(2) + 1642 .LVL174: + 1643 00d6 00C0 rjmp .L163 + 1644 .LVL175: + 1645 .L161: + 1646 00d8 83E0 ldi r24,lo8(3) + 1647 .LVL176: + 1648 .L163: + 1649 /* epilogue start */ + 1650 .LSM247: + 1651 00da DF91 pop r29 + 1652 .LVL177: + 1653 00dc CF91 pop r28 + 1654 .LVL178: + 1655 00de 1F91 pop r17 + 1656 00e0 0F91 pop r16 + 1657 00e2 FF90 pop r15 + 1658 00e4 EF90 pop r14 + 1659 .LVL179: + 1660 00e6 0895 ret + 1661 .LFE84: + 1663 .section .text.Endpoint_Write_Control_EStream_LE,"ax",@progbits + 1664 .global Endpoint_Write_Control_EStream_LE + 1666 Endpoint_Write_Control_EStream_LE: + 1667 .LFB81: + 1668 .LSM248: + 1669 .LVL180: + 1670 0000 EF92 push r14 + 1671 0002 FF92 push r15 + 1672 0004 0F93 push r16 + 1673 0006 1F93 push r17 + 1674 0008 CF93 push r28 + 1675 000a DF93 push r29 + 1676 /* prologue: function */ + 1677 /* frame size = 0 */ + 1678 000c 9C01 movw r18,r24 + 1679 .LVL181: + 1680 .LSM249: + 1681 000e E090 0000 lds r14,USB_ControlRequest+6 + 1682 0012 F090 0000 lds r15,(USB_ControlRequest+6)+1 + 1683 .LVL182: + 1684 0016 E616 cp r14,r22 + 1685 0018 F706 cpc r15,r23 + 1686 001a 00F4 brsh .L177 + 1687 .L180: + 1688 .LSM250: + 1689 001c 90E0 ldi r25,lo8(0) + 1690 .LVL183: + 1691 001e 00C0 rjmp .L196 + 1692 .LVL184: + 1693 .L177: + 1694 .LSM251: + 1695 0020 6115 cp r22,__zero_reg__ + 1696 0022 7105 cpc r23,__zero_reg__ + 1697 0024 01F0 breq .L179 + 1698 .LVL185: + 1699 0026 7B01 movw r14,r22 + 1700 0028 00C0 rjmp .L180 + 1701 .L179: + 1702 .LBB411: + 1703 .LBB412: + 1704 .LSM252: + 1705 002a 8091 E800 lds r24,232 + 1706 002e 8E77 andi r24,lo8(126) + 1707 0030 8093 E800 sts 232,r24 + 1708 0034 EE24 clr r14 + 1709 0036 FF24 clr r15 + 1710 .LVL186: + 1711 0038 00C0 rjmp .L180 + 1712 .LVL187: + 1713 .L190: + 1714 .LBE412: + 1715 .LBE411: + 1716 .LBB413: + 1717 .LSM253: + 1718 003a 8091 0000 lds r24,USB_DeviceState + 1719 .LVL188: + 1720 .LSM254: + 1721 003e 8823 tst r24 + 1722 0040 01F4 brne .+2 + 1723 0042 00C0 rjmp .L181 + 1724 .LSM255: + 1725 0044 8530 cpi r24,lo8(5) + 1726 0046 01F4 brne .+2 + 1727 0048 00C0 rjmp .L182 + 1728 .LBB414: + 1729 .LBB415: + 1730 .LSM256: + 1731 004a 8091 E800 lds r24,232 + 1732 .LVL189: + 1733 .LBE415: + 1734 .LBE414: + 1735 .LSM257: + 1736 004e 83FF sbrs r24,3 + 1737 0050 00C0 rjmp .L183 + 1738 0052 81E0 ldi r24,lo8(1) + 1739 0054 00C0 rjmp .L184 + 1740 .L183: + 1741 .LBB416: + 1742 .LBB417: + 1743 .LSM258: + 1744 0056 8091 E800 lds r24,232 + 1745 .LBE417: + 1746 .LBE416: + 1747 .LSM259: + 1748 005a 82FD sbrc r24,2 + 1749 005c 00C0 rjmp .L194 + 1750 .LBB418: + 1751 .LBB419: + 1752 .LSM260: + 1753 005e 8091 E800 lds r24,232 + 1754 .LBE419: + 1755 .LBE418: + 1756 .LSM261: + 1757 0062 80FF sbrs r24,0 + 1758 0064 00C0 rjmp .L196 + 1759 .LBB420: + 1760 .LBB421: + 1761 .LBB422: + 1762 .LSM262: + 1763 0066 8091 F200 lds r24,242 + 1764 006a C82F mov r28,r24 + 1765 .LVL190: + 1766 006c D0E0 ldi r29,lo8(0) + 1767 006e 00C0 rjmp .L186 + 1768 .L188: + 1769 .LBE422: + 1770 .LBE421: + 1771 .LSM263: + 1772 0070 8901 movw r16,r18 + 1773 0072 0F5F subi r16,lo8(-(1)) + 1774 0074 1F4F sbci r17,hi8(-(1)) + 1775 .LVL191: + 1776 0076 C901 movw r24,r18 + 1777 0078 0E94 0000 call __eerd_byte_usb162 + 1778 .LVL192: + 1779 .LBB423: + 1780 .LBB424: + 1781 .LSM264: + 1782 007c 8093 F100 sts 241,r24 + 1783 .LBE424: + 1784 .LBE423: + 1785 .LSM265: + 1786 0080 0894 sec + 1787 0082 E108 sbc r14,__zero_reg__ + 1788 0084 F108 sbc r15,__zero_reg__ + 1789 .LSM266: + 1790 0086 2196 adiw r28,1 + 1791 0088 9801 movw r18,r16 + 1792 .LVL193: + 1793 .L186: + 1794 .LSM267: + 1795 008a E114 cp r14,__zero_reg__ + 1796 008c F104 cpc r15,__zero_reg__ + 1797 008e 01F0 breq .L187 + 1798 0090 C830 cpi r28,8 + 1799 0092 D105 cpc r29,__zero_reg__ + 1800 0094 00F0 brlo .L188 + 1801 .L187: + 1802 .LSM268: + 1803 0096 90E0 ldi r25,lo8(0) + 1804 0098 2897 sbiw r28,8 + 1805 009a 01F4 brne .L189 + 1806 009c 91E0 ldi r25,lo8(1) + 1807 .L189: + 1808 .LBB425: + 1809 .LBB426: + 1810 .LSM269: + 1811 009e 8091 E800 lds r24,232 + 1812 00a2 8E77 andi r24,lo8(126) + 1813 00a4 8093 E800 sts 232,r24 + 1814 .L196: + 1815 .LBE426: + 1816 .LBE425: + 1817 .LBE420: + 1818 .LBE413: + 1819 .LSM270: + 1820 00a8 E114 cp r14,__zero_reg__ + 1821 00aa F104 cpc r15,__zero_reg__ + 1822 00ac 01F4 brne .L190 + 1823 00ae 9923 tst r25 + 1824 00b0 01F4 brne .L190 + 1825 00b2 00C0 rjmp .L194 + 1826 .L191: + 1827 .LBB427: + 1828 .LSM271: + 1829 00b4 8091 0000 lds r24,USB_DeviceState + 1830 .LVL194: + 1831 .LSM272: + 1832 00b8 8823 tst r24 + 1833 00ba 01F0 breq .L181 + 1834 .LSM273: + 1835 00bc 8530 cpi r24,lo8(5) + 1836 00be 01F0 breq .L182 + 1837 .L194: + 1838 .LBE427: + 1839 .LBB428: + 1840 .LBB429: + 1841 .LSM274: + 1842 00c0 8091 E800 lds r24,232 + 1843 .LVL195: + 1844 .LBE429: + 1845 .LBE428: + 1846 .LSM275: + 1847 00c4 82FF sbrs r24,2 + 1848 00c6 00C0 rjmp .L191 + 1849 00c8 80E0 ldi r24,lo8(0) + 1850 00ca 00C0 rjmp .L184 + 1851 .LVL196: + 1852 .L181: + 1853 00cc 82E0 ldi r24,lo8(2) + 1854 .LVL197: + 1855 00ce 00C0 rjmp .L184 + 1856 .LVL198: + 1857 .L182: + 1858 00d0 83E0 ldi r24,lo8(3) + 1859 .LVL199: + 1860 .L184: + 1861 /* epilogue start */ + 1862 .LSM276: + 1863 00d2 DF91 pop r29 + 1864 .LVL200: + 1865 00d4 CF91 pop r28 + 1866 .LVL201: + 1867 00d6 1F91 pop r17 + 1868 00d8 0F91 pop r16 + 1869 00da FF90 pop r15 + 1870 00dc EF90 pop r14 + 1871 .LVL202: + 1872 00de 0895 ret + 1873 .LFE81: + 1875 .section .text.Endpoint_Read_EStream_BE,"ax",@progbits + 1876 .global Endpoint_Read_EStream_BE + 1878 Endpoint_Read_EStream_BE: + 1879 .LFB78: + 1880 .LSM277: + 1881 .LVL203: + 1882 0000 BF92 push r11 + 1883 0002 CF92 push r12 + 1884 0004 DF92 push r13 + 1885 0006 EF92 push r14 + 1886 0008 FF92 push r15 + 1887 000a 0F93 push r16 + 1888 000c 1F93 push r17 + 1889 000e CF93 push r28 + 1890 0010 DF93 push r29 + 1891 /* prologue: function */ + 1892 /* frame size = 0 */ + 1893 0012 7C01 movw r14,r24 + 1894 0014 EB01 movw r28,r22 + 1895 0016 6A01 movw r12,r20 + 1896 .LSM278: + 1897 0018 0E94 0000 call Endpoint_WaitUntilReady + 1898 .LVL204: + 1899 001c B82E mov r11,r24 + 1900 .LVL205: + 1901 001e 8823 tst r24 + 1902 0020 01F4 brne .L198 + 1903 .LVL206: + 1904 .LSM279: + 1905 0022 2197 sbiw r28,1 + 1906 0024 EC0E add r14,r28 + 1907 0026 FD1E adc r15,r29 + 1908 .LVL207: + 1909 0028 2196 adiw r28,1 + 1910 002a 00C0 rjmp .L205 + 1911 .LVL208: + 1912 .L203: + 1913 .LBB430: + 1914 .LBB431: + 1915 .LSM280: + 1916 002c 8091 E800 lds r24,232 + 1917 .LBE431: + 1918 .LBE430: + 1919 .LSM281: + 1920 0030 85FD sbrc r24,5 + 1921 0032 00C0 rjmp .L200 + 1922 .LBB432: + 1923 .LBB433: + 1924 .LSM282: + 1925 0034 8091 E800 lds r24,232 + 1926 0038 8B77 andi r24,lo8(123) + 1927 003a 8093 E800 sts 232,r24 + 1928 .LBE433: + 1929 .LBE432: + 1930 .LSM283: + 1931 003e C114 cp r12,__zero_reg__ + 1932 0040 D104 cpc r13,__zero_reg__ + 1933 0042 01F0 breq .L201 + 1934 0044 F601 movw r30,r12 + 1935 0046 0995 icall + 1936 0048 8130 cpi r24,lo8(1) + 1937 004a 01F4 brne .L201 + 1938 004c 85E0 ldi r24,lo8(5) + 1939 .LVL209: + 1940 004e 00C0 rjmp .L202 + 1941 .LVL210: + 1942 .L201: + 1943 .LSM284: + 1944 0050 0E94 0000 call Endpoint_WaitUntilReady + 1945 0054 8823 tst r24 + 1946 0056 01F0 breq .L205 + 1947 .LVL211: + 1948 0058 00C0 rjmp .L202 + 1949 .LVL212: + 1950 .L200: + 1951 .LSM285: + 1952 005a 8701 movw r16,r14 + 1953 005c 0150 subi r16,lo8(-(-1)) + 1954 005e 1040 sbci r17,hi8(-(-1)) + 1955 .LVL213: + 1956 .LBB434: + 1957 .LBB435: + 1958 .LSM286: + 1959 0060 6091 F100 lds r22,241 + 1960 .LBE435: + 1961 .LBE434: + 1962 .LSM287: + 1963 0064 C701 movw r24,r14 + 1964 0066 0E94 0000 call __eeupd_byte_usb162 + 1965 .LSM288: + 1966 006a 2197 sbiw r28,1 + 1967 006c 7801 movw r14,r16 + 1968 .LVL214: + 1969 .L205: + 1970 .LSM289: + 1971 006e 2097 sbiw r28,0 + 1972 0070 01F4 brne .L203 + 1973 .LVL215: + 1974 .L198: + 1975 0072 8B2D mov r24,r11 + 1976 .L202: + 1977 .LVL216: + 1978 /* epilogue start */ + 1979 .LSM290: + 1980 0074 DF91 pop r29 + 1981 0076 CF91 pop r28 + 1982 .LVL217: + 1983 0078 1F91 pop r17 + 1984 007a 0F91 pop r16 + 1985 007c FF90 pop r15 + 1986 007e EF90 pop r14 + 1987 .LVL218: + 1988 0080 DF90 pop r13 + 1989 0082 CF90 pop r12 + 1990 .LVL219: + 1991 0084 BF90 pop r11 + 1992 .LVL220: + 1993 0086 0895 ret + 1994 .LFE78: + 1996 .section .text.Endpoint_Read_Stream_BE,"ax",@progbits + 1997 .global Endpoint_Read_Stream_BE + 1999 Endpoint_Read_Stream_BE: + 2000 .LFB77: + 2001 .LSM291: + 2002 .LVL221: + 2003 0000 DF92 push r13 + 2004 0002 EF92 push r14 + 2005 0004 FF92 push r15 + 2006 0006 0F93 push r16 + 2007 0008 1F93 push r17 + 2008 000a CF93 push r28 + 2009 000c DF93 push r29 + 2010 /* prologue: function */ + 2011 /* frame size = 0 */ + 2012 000e 8C01 movw r16,r24 + 2013 0010 EB01 movw r28,r22 + 2014 0012 7A01 movw r14,r20 + 2015 .LSM292: + 2016 0014 0E94 0000 call Endpoint_WaitUntilReady + 2017 .LVL222: + 2018 0018 D82E mov r13,r24 + 2019 .LVL223: + 2020 001a 8823 tst r24 + 2021 001c 01F4 brne .L207 + 2022 .LVL224: + 2023 .LSM293: + 2024 001e 2197 sbiw r28,1 + 2025 0020 0C0F add r16,r28 + 2026 0022 1D1F adc r17,r29 + 2027 .LVL225: + 2028 0024 2196 adiw r28,1 + 2029 0026 00C0 rjmp .L214 + 2030 .L212: + 2031 .LBB436: + 2032 .LBB437: + 2033 .LSM294: + 2034 0028 8091 E800 lds r24,232 + 2035 .LVL226: + 2036 .LBE437: + 2037 .LBE436: + 2038 .LSM295: + 2039 002c 85FD sbrc r24,5 + 2040 002e 00C0 rjmp .L209 + 2041 .LBB438: + 2042 .LBB439: + 2043 .LSM296: + 2044 0030 8091 E800 lds r24,232 + 2045 0034 8B77 andi r24,lo8(123) + 2046 0036 8093 E800 sts 232,r24 + 2047 .LBE439: + 2048 .LBE438: + 2049 .LSM297: + 2050 003a E114 cp r14,__zero_reg__ + 2051 003c F104 cpc r15,__zero_reg__ + 2052 003e 01F0 breq .L210 + 2053 0040 F701 movw r30,r14 + 2054 0042 0995 icall + 2055 0044 8130 cpi r24,lo8(1) + 2056 0046 01F4 brne .L210 + 2057 0048 85E0 ldi r24,lo8(5) + 2058 .LVL227: + 2059 004a 00C0 rjmp .L211 + 2060 .LVL228: + 2061 .L210: + 2062 .LSM298: + 2063 004c 0E94 0000 call Endpoint_WaitUntilReady + 2064 0050 8823 tst r24 + 2065 0052 01F0 breq .L214 + 2066 .LVL229: + 2067 0054 00C0 rjmp .L211 + 2068 .LVL230: + 2069 .L209: + 2070 .LBB440: + 2071 .LBB441: + 2072 .LSM299: + 2073 0056 8091 F100 lds r24,241 + 2074 .LBE441: + 2075 .LBE440: + 2076 .LSM300: + 2077 005a F801 movw r30,r16 + 2078 005c 8083 st Z,r24 + 2079 005e 0150 subi r16,lo8(-(-1)) + 2080 0060 1040 sbci r17,hi8(-(-1)) + 2081 .LSM301: + 2082 0062 2197 sbiw r28,1 + 2083 .LVL231: + 2084 .L214: + 2085 .LSM302: + 2086 0064 2097 sbiw r28,0 + 2087 0066 01F4 brne .L212 + 2088 .LVL232: + 2089 .L207: + 2090 0068 8D2D mov r24,r13 + 2091 .L211: + 2092 .LVL233: + 2093 /* epilogue start */ + 2094 .LSM303: + 2095 006a DF91 pop r29 + 2096 006c CF91 pop r28 + 2097 .LVL234: + 2098 006e 1F91 pop r17 + 2099 0070 0F91 pop r16 + 2100 .LVL235: + 2101 0072 FF90 pop r15 + 2102 0074 EF90 pop r14 + 2103 .LVL236: + 2104 0076 DF90 pop r13 + 2105 .LVL237: + 2106 0078 0895 ret + 2107 .LFE77: + 2109 .section .text.Endpoint_Read_EStream_LE,"ax",@progbits + 2110 .global Endpoint_Read_EStream_LE + 2112 Endpoint_Read_EStream_LE: + 2113 .LFB76: + 2114 .LSM304: + 2115 .LVL238: + 2116 0000 BF92 push r11 + 2117 0002 CF92 push r12 + 2118 0004 DF92 push r13 + 2119 0006 EF92 push r14 + 2120 0008 FF92 push r15 + 2121 000a 0F93 push r16 + 2122 000c 1F93 push r17 + 2123 000e CF93 push r28 + 2124 0010 DF93 push r29 + 2125 /* prologue: function */ + 2126 /* frame size = 0 */ + 2127 0012 8C01 movw r16,r24 + 2128 .LVL239: + 2129 0014 7B01 movw r14,r22 + 2130 0016 6A01 movw r12,r20 + 2131 .LSM305: + 2132 0018 0E94 0000 call Endpoint_WaitUntilReady + 2133 .LVL240: + 2134 001c B82E mov r11,r24 + 2135 .LVL241: + 2136 001e 8823 tst r24 + 2137 0020 01F4 brne .L216 + 2138 .LVL242: + 2139 .LSM306: + 2140 0022 E801 movw r28,r16 + 2141 .LVL243: + 2142 0024 00C0 rjmp .L223 + 2143 .LVL244: + 2144 .L221: + 2145 .LBB442: + 2146 .LBB443: + 2147 .LSM307: + 2148 0026 8091 E800 lds r24,232 + 2149 .LVL245: + 2150 .LBE443: + 2151 .LBE442: + 2152 .LSM308: + 2153 002a 85FD sbrc r24,5 + 2154 002c 00C0 rjmp .L218 + 2155 .LBB444: + 2156 .LBB445: + 2157 .LSM309: + 2158 002e 8091 E800 lds r24,232 + 2159 0032 8B77 andi r24,lo8(123) + 2160 0034 8093 E800 sts 232,r24 + 2161 .LBE445: + 2162 .LBE444: + 2163 .LSM310: + 2164 0038 C114 cp r12,__zero_reg__ + 2165 003a D104 cpc r13,__zero_reg__ + 2166 003c 01F0 breq .L219 + 2167 003e F601 movw r30,r12 + 2168 0040 0995 icall + 2169 0042 8130 cpi r24,lo8(1) + 2170 0044 01F4 brne .L219 + 2171 0046 85E0 ldi r24,lo8(5) + 2172 .LVL246: + 2173 0048 00C0 rjmp .L220 + 2174 .LVL247: + 2175 .L219: + 2176 .LSM311: + 2177 004a 0E94 0000 call Endpoint_WaitUntilReady + 2178 004e 8823 tst r24 + 2179 0050 01F0 breq .L223 + 2180 .LVL248: + 2181 0052 00C0 rjmp .L220 + 2182 .LVL249: + 2183 .L218: + 2184 .LSM312: + 2185 0054 8E01 movw r16,r28 + 2186 0056 0F5F subi r16,lo8(-(1)) + 2187 0058 1F4F sbci r17,hi8(-(1)) + 2188 .LVL250: + 2189 .LBB446: + 2190 .LBB447: + 2191 .LSM313: + 2192 005a 6091 F100 lds r22,241 + 2193 .LBE447: + 2194 .LBE446: + 2195 .LSM314: + 2196 005e CE01 movw r24,r28 + 2197 0060 0E94 0000 call __eeupd_byte_usb162 + 2198 .LSM315: + 2199 0064 0894 sec + 2200 0066 E108 sbc r14,__zero_reg__ + 2201 0068 F108 sbc r15,__zero_reg__ + 2202 006a E801 movw r28,r16 + 2203 .LVL251: + 2204 .L223: + 2205 .LSM316: + 2206 006c E114 cp r14,__zero_reg__ + 2207 006e F104 cpc r15,__zero_reg__ + 2208 0070 01F4 brne .L221 + 2209 .LVL252: + 2210 .L216: + 2211 0072 8B2D mov r24,r11 + 2212 .L220: + 2213 .LVL253: + 2214 /* epilogue start */ + 2215 .LSM317: + 2216 0074 DF91 pop r29 + 2217 0076 CF91 pop r28 + 2218 .LVL254: + 2219 0078 1F91 pop r17 + 2220 007a 0F91 pop r16 + 2221 .LVL255: + 2222 007c FF90 pop r15 + 2223 007e EF90 pop r14 + 2224 .LVL256: + 2225 0080 DF90 pop r13 + 2226 0082 CF90 pop r12 + 2227 .LVL257: + 2228 0084 BF90 pop r11 + 2229 .LVL258: + 2230 0086 0895 ret + 2231 .LFE76: + 2233 .section .text.Endpoint_Read_Stream_LE,"ax",@progbits + 2234 .global Endpoint_Read_Stream_LE + 2236 Endpoint_Read_Stream_LE: + 2237 .LFB75: + 2238 .LSM318: + 2239 .LVL259: + 2240 0000 DF92 push r13 + 2241 0002 EF92 push r14 + 2242 0004 FF92 push r15 + 2243 0006 0F93 push r16 + 2244 0008 1F93 push r17 + 2245 000a CF93 push r28 + 2246 000c DF93 push r29 + 2247 /* prologue: function */ + 2248 /* frame size = 0 */ + 2249 000e 182F mov r17,r24 + 2250 0010 092F mov r16,r25 + 2251 .LVL260: + 2252 0012 EB01 movw r28,r22 + 2253 0014 7A01 movw r14,r20 + 2254 .LSM319: + 2255 0016 0E94 0000 call Endpoint_WaitUntilReady + 2256 .LVL261: + 2257 001a D82E mov r13,r24 + 2258 .LVL262: + 2259 001c 8823 tst r24 + 2260 001e 01F4 brne .L225 + 2261 .LVL263: + 2262 .LSM320: + 2263 0020 812F mov r24,r17 + 2264 .LVL264: + 2265 0022 902F mov r25,r16 + 2266 .LVL265: + 2267 0024 9C01 movw r18,r24 + 2268 .LVL266: + 2269 0026 8901 movw r16,r18 + 2270 .LVL267: + 2271 0028 00C0 rjmp .L232 + 2272 .LVL268: + 2273 .L230: + 2274 .LBB448: + 2275 .LBB449: + 2276 .LSM321: + 2277 002a 8091 E800 lds r24,232 + 2278 .LBE449: + 2279 .LBE448: + 2280 .LSM322: + 2281 002e 85FD sbrc r24,5 + 2282 0030 00C0 rjmp .L227 + 2283 .LBB450: + 2284 .LBB451: + 2285 .LSM323: + 2286 0032 8091 E800 lds r24,232 + 2287 0036 8B77 andi r24,lo8(123) + 2288 0038 8093 E800 sts 232,r24 + 2289 .LBE451: + 2290 .LBE450: + 2291 .LSM324: + 2292 003c E114 cp r14,__zero_reg__ + 2293 003e F104 cpc r15,__zero_reg__ + 2294 0040 01F0 breq .L228 + 2295 0042 F701 movw r30,r14 + 2296 0044 0995 icall + 2297 .LVL269: + 2298 0046 8130 cpi r24,lo8(1) + 2299 0048 01F4 brne .L228 + 2300 004a 85E0 ldi r24,lo8(5) + 2301 .LVL270: + 2302 004c 00C0 rjmp .L229 + 2303 .LVL271: + 2304 .L228: + 2305 .LSM325: + 2306 004e 0E94 0000 call Endpoint_WaitUntilReady + 2307 .LVL272: + 2308 0052 8823 tst r24 + 2309 0054 01F0 breq .L232 + 2310 .LVL273: + 2311 0056 00C0 rjmp .L229 + 2312 .LVL274: + 2313 .L227: + 2314 .LBB452: + 2315 .LBB453: + 2316 .LSM326: + 2317 0058 8091 F100 lds r24,241 + 2318 .LBE453: + 2319 .LBE452: + 2320 .LSM327: + 2321 005c F801 movw r30,r16 + 2322 005e 8193 st Z+,r24 + 2323 0060 8F01 movw r16,r30 + 2324 .LSM328: + 2325 0062 2197 sbiw r28,1 + 2326 .LVL275: + 2327 .L232: + 2328 .LSM329: + 2329 0064 2097 sbiw r28,0 + 2330 0066 01F4 brne .L230 + 2331 .LVL276: + 2332 .L225: + 2333 0068 8D2D mov r24,r13 + 2334 .L229: + 2335 .LVL277: + 2336 /* epilogue start */ + 2337 .LSM330: + 2338 006a DF91 pop r29 + 2339 006c CF91 pop r28 + 2340 .LVL278: + 2341 006e 1F91 pop r17 + 2342 .LVL279: + 2343 0070 0F91 pop r16 + 2344 .LVL280: + 2345 0072 FF90 pop r15 + 2346 0074 EF90 pop r14 + 2347 .LVL281: + 2348 0076 DF90 pop r13 + 2349 .LVL282: + 2350 0078 0895 ret + 2351 .LFE75: + 2353 .section .text.Endpoint_Write_PStream_BE,"ax",@progbits + 2354 .global Endpoint_Write_PStream_BE + 2356 Endpoint_Write_PStream_BE: + 2357 .LFB74: + 2358 .LSM331: + 2359 .LVL283: + 2360 0000 DF92 push r13 + 2361 0002 EF92 push r14 + 2362 0004 FF92 push r15 + 2363 0006 0F93 push r16 + 2364 0008 1F93 push r17 + 2365 000a CF93 push r28 + 2366 000c DF93 push r29 + 2367 /* prologue: function */ + 2368 /* frame size = 0 */ + 2369 000e 8C01 movw r16,r24 + 2370 0010 EB01 movw r28,r22 + 2371 0012 7A01 movw r14,r20 + 2372 .LSM332: + 2373 0014 0E94 0000 call Endpoint_WaitUntilReady + 2374 .LVL284: + 2375 0018 D82E mov r13,r24 + 2376 .LVL285: + 2377 001a 8823 tst r24 + 2378 001c 01F4 brne .L234 + 2379 .LVL286: + 2380 .LSM333: + 2381 001e 2197 sbiw r28,1 + 2382 0020 0C0F add r16,r28 + 2383 0022 1D1F adc r17,r29 + 2384 .LVL287: + 2385 0024 2196 adiw r28,1 + 2386 0026 00C0 rjmp .L241 + 2387 .LVL288: + 2388 .L239: + 2389 .LBB454: + 2390 .LBB455: + 2391 .LSM334: + 2392 0028 8091 E800 lds r24,232 + 2393 .LBE455: + 2394 .LBE454: + 2395 .LSM335: + 2396 002c 85FD sbrc r24,5 + 2397 002e 00C0 rjmp .L236 + 2398 .LBB456: + 2399 .LBB457: + 2400 .LSM336: + 2401 0030 8091 E800 lds r24,232 + 2402 0034 8E77 andi r24,lo8(126) + 2403 0036 8093 E800 sts 232,r24 + 2404 .LBE457: + 2405 .LBE456: + 2406 .LSM337: + 2407 003a E114 cp r14,__zero_reg__ + 2408 003c F104 cpc r15,__zero_reg__ + 2409 003e 01F0 breq .L237 + 2410 0040 F701 movw r30,r14 + 2411 0042 0995 icall + 2412 .LVL289: + 2413 0044 8130 cpi r24,lo8(1) + 2414 0046 01F4 brne .L237 + 2415 0048 85E0 ldi r24,lo8(5) + 2416 .LVL290: + 2417 004a 00C0 rjmp .L238 + 2418 .LVL291: + 2419 .L237: + 2420 .LSM338: + 2421 004c 0E94 0000 call Endpoint_WaitUntilReady + 2422 .LVL292: + 2423 0050 8823 tst r24 + 2424 0052 01F0 breq .L241 + 2425 .LVL293: + 2426 0054 00C0 rjmp .L238 + 2427 .LVL294: + 2428 .L236: + 2429 .LBB458: + 2430 .LSM339: + 2431 0056 F801 movw r30,r16 + 2432 .LVL295: + 2433 0058 0150 subi r16,lo8(-(-1)) + 2434 005a 1040 sbci r17,hi8(-(-1)) + 2435 /* #APP */ + 2436 ; 67 "LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c" 1 + 2437 005c E491 lpm r30, Z + 2438 + 2439 ; 0 "" 2 + 2440 .LVL296: + 2441 /* #NOAPP */ + 2442 .LBE458: + 2443 .LBB459: + 2444 .LBB460: + 2445 .LSM340: + 2446 005e E093 F100 sts 241,r30 + 2447 .LBE460: + 2448 .LBE459: + 2449 .LSM341: + 2450 0062 2197 sbiw r28,1 + 2451 .LVL297: + 2452 .L241: + 2453 .LSM342: + 2454 0064 2097 sbiw r28,0 + 2455 0066 01F4 brne .L239 + 2456 .LVL298: + 2457 .L234: + 2458 0068 8D2D mov r24,r13 + 2459 .L238: + 2460 .LVL299: + 2461 /* epilogue start */ + 2462 .LSM343: + 2463 006a DF91 pop r29 + 2464 006c CF91 pop r28 + 2465 .LVL300: + 2466 006e 1F91 pop r17 + 2467 0070 0F91 pop r16 + 2468 .LVL301: + 2469 0072 FF90 pop r15 + 2470 0074 EF90 pop r14 + 2471 .LVL302: + 2472 0076 DF90 pop r13 + 2473 .LVL303: + 2474 0078 0895 ret + 2475 .LFE74: + 2477 .section .text.Endpoint_Write_EStream_BE,"ax",@progbits + 2478 .global Endpoint_Write_EStream_BE + 2480 Endpoint_Write_EStream_BE: + 2481 .LFB73: + 2482 .LSM344: + 2483 .LVL304: + 2484 0000 BF92 push r11 + 2485 0002 CF92 push r12 + 2486 0004 DF92 push r13 + 2487 0006 EF92 push r14 + 2488 0008 FF92 push r15 + 2489 000a 0F93 push r16 + 2490 000c 1F93 push r17 + 2491 000e CF93 push r28 + 2492 0010 DF93 push r29 + 2493 /* prologue: function */ + 2494 /* frame size = 0 */ + 2495 0012 7C01 movw r14,r24 + 2496 0014 EB01 movw r28,r22 + 2497 0016 6A01 movw r12,r20 + 2498 .LSM345: + 2499 0018 0E94 0000 call Endpoint_WaitUntilReady + 2500 .LVL305: + 2501 001c B82E mov r11,r24 + 2502 .LVL306: + 2503 001e 8823 tst r24 + 2504 0020 01F4 brne .L243 + 2505 .LVL307: + 2506 .LSM346: + 2507 0022 2197 sbiw r28,1 + 2508 0024 EC0E add r14,r28 + 2509 0026 FD1E adc r15,r29 + 2510 .LVL308: + 2511 0028 2196 adiw r28,1 + 2512 002a 00C0 rjmp .L250 + 2513 .LVL309: + 2514 .L248: + 2515 .LBB461: + 2516 .LBB462: + 2517 .LSM347: + 2518 002c 8091 E800 lds r24,232 + 2519 .LBE462: + 2520 .LBE461: + 2521 .LSM348: + 2522 0030 85FD sbrc r24,5 + 2523 0032 00C0 rjmp .L245 + 2524 .LBB463: + 2525 .LBB464: + 2526 .LSM349: + 2527 0034 8091 E800 lds r24,232 + 2528 0038 8E77 andi r24,lo8(126) + 2529 003a 8093 E800 sts 232,r24 + 2530 .LBE464: + 2531 .LBE463: + 2532 .LSM350: + 2533 003e C114 cp r12,__zero_reg__ + 2534 0040 D104 cpc r13,__zero_reg__ + 2535 0042 01F0 breq .L246 + 2536 0044 F601 movw r30,r12 + 2537 0046 0995 icall + 2538 0048 8130 cpi r24,lo8(1) + 2539 004a 01F4 brne .L246 + 2540 004c 85E0 ldi r24,lo8(5) + 2541 .LVL310: + 2542 004e 00C0 rjmp .L247 + 2543 .LVL311: + 2544 .L246: + 2545 .LSM351: + 2546 0050 0E94 0000 call Endpoint_WaitUntilReady + 2547 0054 8823 tst r24 + 2548 0056 01F0 breq .L250 + 2549 .LVL312: + 2550 0058 00C0 rjmp .L247 + 2551 .LVL313: + 2552 .L245: + 2553 .LSM352: + 2554 005a 8701 movw r16,r14 + 2555 005c 0150 subi r16,lo8(-(-1)) + 2556 005e 1040 sbci r17,hi8(-(-1)) + 2557 .LVL314: + 2558 0060 C701 movw r24,r14 + 2559 0062 0E94 0000 call __eerd_byte_usb162 + 2560 .LBB465: + 2561 .LBB466: + 2562 .LSM353: + 2563 0066 8093 F100 sts 241,r24 + 2564 .LBE466: + 2565 .LBE465: + 2566 .LSM354: + 2567 006a 2197 sbiw r28,1 + 2568 006c 7801 movw r14,r16 + 2569 .LVL315: + 2570 .L250: + 2571 .LSM355: + 2572 006e 2097 sbiw r28,0 + 2573 0070 01F4 brne .L248 + 2574 .LVL316: + 2575 .L243: + 2576 0072 8B2D mov r24,r11 + 2577 .L247: + 2578 .LVL317: + 2579 /* epilogue start */ + 2580 .LSM356: + 2581 0074 DF91 pop r29 + 2582 0076 CF91 pop r28 + 2583 .LVL318: + 2584 0078 1F91 pop r17 + 2585 007a 0F91 pop r16 + 2586 007c FF90 pop r15 + 2587 007e EF90 pop r14 + 2588 .LVL319: + 2589 0080 DF90 pop r13 + 2590 0082 CF90 pop r12 + 2591 .LVL320: + 2592 0084 BF90 pop r11 + 2593 .LVL321: + 2594 0086 0895 ret + 2595 .LFE73: + 2597 .section .text.Endpoint_Write_Stream_BE,"ax",@progbits + 2598 .global Endpoint_Write_Stream_BE + 2600 Endpoint_Write_Stream_BE: + 2601 .LFB72: + 2602 .LSM357: + 2603 .LVL322: + 2604 0000 DF92 push r13 + 2605 0002 EF92 push r14 + 2606 0004 FF92 push r15 + 2607 0006 0F93 push r16 + 2608 0008 1F93 push r17 + 2609 000a CF93 push r28 + 2610 000c DF93 push r29 + 2611 /* prologue: function */ + 2612 /* frame size = 0 */ + 2613 000e 8C01 movw r16,r24 + 2614 0010 EB01 movw r28,r22 + 2615 0012 7A01 movw r14,r20 + 2616 .LSM358: + 2617 0014 0E94 0000 call Endpoint_WaitUntilReady + 2618 .LVL323: + 2619 0018 D82E mov r13,r24 + 2620 .LVL324: + 2621 001a 8823 tst r24 + 2622 001c 01F4 brne .L252 + 2623 .LVL325: + 2624 .LSM359: + 2625 001e 2197 sbiw r28,1 + 2626 0020 0C0F add r16,r28 + 2627 0022 1D1F adc r17,r29 + 2628 .LVL326: + 2629 0024 2196 adiw r28,1 + 2630 0026 00C0 rjmp .L259 + 2631 .L257: + 2632 .LBB467: + 2633 .LBB468: + 2634 .LSM360: + 2635 0028 8091 E800 lds r24,232 + 2636 .LVL327: + 2637 .LBE468: + 2638 .LBE467: + 2639 .LSM361: + 2640 002c 85FD sbrc r24,5 + 2641 002e 00C0 rjmp .L254 + 2642 .LBB469: + 2643 .LBB470: + 2644 .LSM362: + 2645 0030 8091 E800 lds r24,232 + 2646 0034 8E77 andi r24,lo8(126) + 2647 0036 8093 E800 sts 232,r24 + 2648 .LBE470: + 2649 .LBE469: + 2650 .LSM363: + 2651 003a E114 cp r14,__zero_reg__ + 2652 003c F104 cpc r15,__zero_reg__ + 2653 003e 01F0 breq .L255 + 2654 0040 F701 movw r30,r14 + 2655 0042 0995 icall + 2656 0044 8130 cpi r24,lo8(1) + 2657 0046 01F4 brne .L255 + 2658 0048 85E0 ldi r24,lo8(5) + 2659 .LVL328: + 2660 004a 00C0 rjmp .L256 + 2661 .LVL329: + 2662 .L255: + 2663 .LSM364: + 2664 004c 0E94 0000 call Endpoint_WaitUntilReady + 2665 0050 8823 tst r24 + 2666 0052 01F0 breq .L259 + 2667 .LVL330: + 2668 0054 00C0 rjmp .L256 + 2669 .LVL331: + 2670 .L254: + 2671 .LSM365: + 2672 0056 F801 movw r30,r16 + 2673 0058 8081 ld r24,Z + 2674 005a 0150 subi r16,lo8(-(-1)) + 2675 005c 1040 sbci r17,hi8(-(-1)) + 2676 .LBB471: + 2677 .LBB472: + 2678 .LSM366: + 2679 005e 8093 F100 sts 241,r24 + 2680 .LBE472: + 2681 .LBE471: + 2682 .LSM367: + 2683 0062 2197 sbiw r28,1 + 2684 .LVL332: + 2685 .L259: + 2686 .LSM368: + 2687 0064 2097 sbiw r28,0 + 2688 0066 01F4 brne .L257 + 2689 .LVL333: + 2690 .L252: + 2691 0068 8D2D mov r24,r13 + 2692 .L256: + 2693 .LVL334: + 2694 /* epilogue start */ + 2695 .LSM369: + 2696 006a DF91 pop r29 + 2697 006c CF91 pop r28 + 2698 .LVL335: + 2699 006e 1F91 pop r17 + 2700 0070 0F91 pop r16 + 2701 .LVL336: + 2702 0072 FF90 pop r15 + 2703 0074 EF90 pop r14 + 2704 .LVL337: + 2705 0076 DF90 pop r13 + 2706 .LVL338: + 2707 0078 0895 ret + 2708 .LFE72: + 2710 .section .text.Endpoint_Write_EStream_LE,"ax",@progbits + 2711 .global Endpoint_Write_EStream_LE + 2713 Endpoint_Write_EStream_LE: + 2714 .LFB71: + 2715 .LSM370: + 2716 .LVL339: + 2717 0000 BF92 push r11 + 2718 0002 CF92 push r12 + 2719 0004 DF92 push r13 + 2720 0006 EF92 push r14 + 2721 0008 FF92 push r15 + 2722 000a 0F93 push r16 + 2723 000c 1F93 push r17 + 2724 000e CF93 push r28 + 2725 0010 DF93 push r29 + 2726 /* prologue: function */ + 2727 /* frame size = 0 */ + 2728 0012 8C01 movw r16,r24 + 2729 .LVL340: + 2730 0014 7B01 movw r14,r22 + 2731 0016 6A01 movw r12,r20 + 2732 .LSM371: + 2733 0018 0E94 0000 call Endpoint_WaitUntilReady + 2734 .LVL341: + 2735 001c B82E mov r11,r24 + 2736 .LVL342: + 2737 001e 8823 tst r24 + 2738 0020 01F4 brne .L261 + 2739 .LVL343: + 2740 .LSM372: + 2741 0022 E801 movw r28,r16 + 2742 .LVL344: + 2743 0024 00C0 rjmp .L268 + 2744 .LVL345: + 2745 .L266: + 2746 .LBB473: + 2747 .LBB474: + 2748 .LSM373: + 2749 0026 8091 E800 lds r24,232 + 2750 .LVL346: + 2751 .LBE474: + 2752 .LBE473: + 2753 .LSM374: + 2754 002a 85FD sbrc r24,5 + 2755 002c 00C0 rjmp .L263 + 2756 .LBB475: + 2757 .LBB476: + 2758 .LSM375: + 2759 002e 8091 E800 lds r24,232 + 2760 0032 8E77 andi r24,lo8(126) + 2761 0034 8093 E800 sts 232,r24 + 2762 .LBE476: + 2763 .LBE475: + 2764 .LSM376: + 2765 0038 C114 cp r12,__zero_reg__ + 2766 003a D104 cpc r13,__zero_reg__ + 2767 003c 01F0 breq .L264 + 2768 003e F601 movw r30,r12 + 2769 0040 0995 icall + 2770 0042 8130 cpi r24,lo8(1) + 2771 0044 01F4 brne .L264 + 2772 0046 85E0 ldi r24,lo8(5) + 2773 .LVL347: + 2774 0048 00C0 rjmp .L265 + 2775 .LVL348: + 2776 .L264: + 2777 .LSM377: + 2778 004a 0E94 0000 call Endpoint_WaitUntilReady + 2779 004e 8823 tst r24 + 2780 0050 01F0 breq .L268 + 2781 .LVL349: + 2782 0052 00C0 rjmp .L265 + 2783 .LVL350: + 2784 .L263: + 2785 .LSM378: + 2786 0054 8E01 movw r16,r28 + 2787 0056 0F5F subi r16,lo8(-(1)) + 2788 0058 1F4F sbci r17,hi8(-(1)) + 2789 .LVL351: + 2790 005a CE01 movw r24,r28 + 2791 005c 0E94 0000 call __eerd_byte_usb162 + 2792 .LBB477: + 2793 .LBB478: + 2794 .LSM379: + 2795 0060 8093 F100 sts 241,r24 + 2796 .LBE478: + 2797 .LBE477: + 2798 .LSM380: + 2799 0064 0894 sec + 2800 0066 E108 sbc r14,__zero_reg__ + 2801 0068 F108 sbc r15,__zero_reg__ + 2802 006a E801 movw r28,r16 + 2803 .LVL352: + 2804 .L268: + 2805 .LSM381: + 2806 006c E114 cp r14,__zero_reg__ + 2807 006e F104 cpc r15,__zero_reg__ + 2808 0070 01F4 brne .L266 + 2809 .LVL353: + 2810 .L261: + 2811 0072 8B2D mov r24,r11 + 2812 .L265: + 2813 .LVL354: + 2814 /* epilogue start */ + 2815 .LSM382: + 2816 0074 DF91 pop r29 + 2817 0076 CF91 pop r28 + 2818 .LVL355: + 2819 0078 1F91 pop r17 + 2820 007a 0F91 pop r16 + 2821 .LVL356: + 2822 007c FF90 pop r15 + 2823 007e EF90 pop r14 + 2824 .LVL357: + 2825 0080 DF90 pop r13 + 2826 0082 CF90 pop r12 + 2827 .LVL358: + 2828 0084 BF90 pop r11 + 2829 .LVL359: + 2830 0086 0895 ret + 2831 .LFE71: + 2833 .section .text.Endpoint_Write_PStream_LE,"ax",@progbits + 2834 .global Endpoint_Write_PStream_LE + 2836 Endpoint_Write_PStream_LE: + 2837 .LFB70: + 2838 .LSM383: + 2839 .LVL360: + 2840 0000 BF92 push r11 + 2841 0002 CF92 push r12 + 2842 0004 DF92 push r13 + 2843 0006 EF92 push r14 + 2844 0008 FF92 push r15 + 2845 000a 0F93 push r16 + 2846 000c 1F93 push r17 + 2847 000e CF93 push r28 + 2848 0010 DF93 push r29 + 2849 /* prologue: function */ + 2850 /* frame size = 0 */ + 2851 0012 F82E mov r15,r24 + 2852 0014 E92E mov r14,r25 + 2853 .LVL361: + 2854 0016 8B01 movw r16,r22 + 2855 0018 6A01 movw r12,r20 + 2856 .LSM384: + 2857 001a 0E94 0000 call Endpoint_WaitUntilReady + 2858 .LVL362: + 2859 001e B82E mov r11,r24 + 2860 .LVL363: + 2861 0020 8823 tst r24 + 2862 0022 01F4 brne .L270 + 2863 .LVL364: + 2864 .LSM385: + 2865 0024 8F2D mov r24,r15 + 2866 .LVL365: + 2867 0026 9E2D mov r25,r14 + 2868 .LVL366: + 2869 0028 9C01 movw r18,r24 + 2870 .LVL367: + 2871 002a E901 movw r28,r18 + 2872 .LVL368: + 2873 002c 00C0 rjmp .L277 + 2874 .LVL369: + 2875 .L275: + 2876 .LBB479: + 2877 .LBB480: + 2878 .LSM386: + 2879 002e 8091 E800 lds r24,232 + 2880 .LBE480: + 2881 .LBE479: + 2882 .LSM387: + 2883 0032 85FD sbrc r24,5 + 2884 0034 00C0 rjmp .L272 + 2885 .LBB481: + 2886 .LBB482: + 2887 .LSM388: + 2888 0036 8091 E800 lds r24,232 + 2889 003a 8E77 andi r24,lo8(126) + 2890 003c 8093 E800 sts 232,r24 + 2891 .LBE482: + 2892 .LBE481: + 2893 .LSM389: + 2894 0040 C114 cp r12,__zero_reg__ + 2895 0042 D104 cpc r13,__zero_reg__ + 2896 0044 01F0 breq .L273 + 2897 0046 F601 movw r30,r12 + 2898 0048 0995 icall + 2899 .LVL370: + 2900 004a 8130 cpi r24,lo8(1) + 2901 004c 01F4 brne .L273 + 2902 004e 85E0 ldi r24,lo8(5) + 2903 .LVL371: + 2904 0050 00C0 rjmp .L274 + 2905 .LVL372: + 2906 .L273: + 2907 .LSM390: + 2908 0052 0E94 0000 call Endpoint_WaitUntilReady + 2909 .LVL373: + 2910 0056 8823 tst r24 + 2911 0058 01F0 breq .L277 + 2912 .LVL374: + 2913 005a 00C0 rjmp .L274 + 2914 .LVL375: + 2915 .L272: + 2916 .LBB483: + 2917 .LSM391: + 2918 005c FE01 movw r30,r28 + 2919 .LVL376: + 2920 005e 2196 adiw r28,1 + 2921 /* #APP */ + 2922 ; 67 "LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c" 1 + 2923 0060 E491 lpm r30, Z + 2924 + 2925 ; 0 "" 2 + 2926 .LVL377: + 2927 /* #NOAPP */ + 2928 .LBE483: + 2929 .LBB484: + 2930 .LBB485: + 2931 .LSM392: + 2932 0062 E093 F100 sts 241,r30 + 2933 .LBE485: + 2934 .LBE484: + 2935 .LSM393: + 2936 0066 0150 subi r16,lo8(-(-1)) + 2937 0068 1040 sbci r17,hi8(-(-1)) + 2938 .LVL378: + 2939 .L277: + 2940 .LSM394: + 2941 006a 0115 cp r16,__zero_reg__ + 2942 006c 1105 cpc r17,__zero_reg__ + 2943 006e 01F4 brne .L275 + 2944 .LVL379: + 2945 .L270: + 2946 0070 8B2D mov r24,r11 + 2947 .L274: + 2948 .LVL380: + 2949 /* epilogue start */ + 2950 .LSM395: + 2951 0072 DF91 pop r29 + 2952 0074 CF91 pop r28 + 2953 .LVL381: + 2954 0076 1F91 pop r17 + 2955 0078 0F91 pop r16 + 2956 .LVL382: + 2957 007a FF90 pop r15 + 2958 .LVL383: + 2959 007c EF90 pop r14 + 2960 .LVL384: + 2961 007e DF90 pop r13 + 2962 0080 CF90 pop r12 + 2963 .LVL385: + 2964 0082 BF90 pop r11 + 2965 .LVL386: + 2966 0084 0895 ret + 2967 .LFE70: + 2969 .section .text.Endpoint_Write_Stream_LE,"ax",@progbits + 2970 .global Endpoint_Write_Stream_LE + 2972 Endpoint_Write_Stream_LE: + 2973 .LFB69: + 2974 .LSM396: + 2975 .LVL387: + 2976 0000 DF92 push r13 + 2977 0002 EF92 push r14 + 2978 0004 FF92 push r15 + 2979 0006 0F93 push r16 + 2980 0008 1F93 push r17 + 2981 000a CF93 push r28 + 2982 000c DF93 push r29 + 2983 /* prologue: function */ + 2984 /* frame size = 0 */ + 2985 000e 182F mov r17,r24 + 2986 0010 092F mov r16,r25 + 2987 .LVL388: + 2988 0012 EB01 movw r28,r22 + 2989 0014 7A01 movw r14,r20 + 2990 .LSM397: + 2991 0016 0E94 0000 call Endpoint_WaitUntilReady + 2992 .LVL389: + 2993 001a D82E mov r13,r24 + 2994 .LVL390: + 2995 001c 8823 tst r24 + 2996 001e 01F4 brne .L279 + 2997 .LVL391: + 2998 .LSM398: + 2999 0020 812F mov r24,r17 + 3000 .LVL392: + 3001 0022 902F mov r25,r16 + 3002 .LVL393: + 3003 0024 9C01 movw r18,r24 + 3004 .LVL394: + 3005 0026 8901 movw r16,r18 + 3006 .LVL395: + 3007 0028 00C0 rjmp .L286 + 3008 .LVL396: + 3009 .L284: + 3010 .LBB486: + 3011 .LBB487: + 3012 .LSM399: + 3013 002a 8091 E800 lds r24,232 + 3014 .LBE487: + 3015 .LBE486: + 3016 .LSM400: + 3017 002e 85FD sbrc r24,5 + 3018 0030 00C0 rjmp .L281 + 3019 .LBB488: + 3020 .LBB489: + 3021 .LSM401: + 3022 0032 8091 E800 lds r24,232 + 3023 0036 8E77 andi r24,lo8(126) + 3024 0038 8093 E800 sts 232,r24 + 3025 .LBE489: + 3026 .LBE488: + 3027 .LSM402: + 3028 003c E114 cp r14,__zero_reg__ + 3029 003e F104 cpc r15,__zero_reg__ + 3030 0040 01F0 breq .L282 + 3031 0042 F701 movw r30,r14 + 3032 0044 0995 icall + 3033 .LVL397: + 3034 0046 8130 cpi r24,lo8(1) + 3035 0048 01F4 brne .L282 + 3036 004a 85E0 ldi r24,lo8(5) + 3037 .LVL398: + 3038 004c 00C0 rjmp .L283 + 3039 .LVL399: + 3040 .L282: + 3041 .LSM403: + 3042 004e 0E94 0000 call Endpoint_WaitUntilReady + 3043 .LVL400: + 3044 0052 8823 tst r24 + 3045 0054 01F0 breq .L286 + 3046 .LVL401: + 3047 0056 00C0 rjmp .L283 + 3048 .LVL402: + 3049 .L281: + 3050 .LSM404: + 3051 0058 F801 movw r30,r16 + 3052 005a 8191 ld r24,Z+ + 3053 005c 8F01 movw r16,r30 + 3054 .LBB490: + 3055 .LBB491: + 3056 .LSM405: + 3057 005e 8093 F100 sts 241,r24 + 3058 .LBE491: + 3059 .LBE490: + 3060 .LSM406: + 3061 0062 2197 sbiw r28,1 + 3062 .LVL403: + 3063 .L286: + 3064 .LSM407: + 3065 0064 2097 sbiw r28,0 + 3066 0066 01F4 brne .L284 + 3067 .LVL404: + 3068 .L279: + 3069 0068 8D2D mov r24,r13 + 3070 .L283: + 3071 .LVL405: + 3072 /* epilogue start */ + 3073 .LSM408: + 3074 006a DF91 pop r29 + 3075 006c CF91 pop r28 + 3076 .LVL406: + 3077 006e 1F91 pop r17 + 3078 .LVL407: + 3079 0070 0F91 pop r16 + 3080 .LVL408: + 3081 0072 FF90 pop r15 + 3082 0074 EF90 pop r14 + 3083 .LVL409: + 3084 0076 DF90 pop r13 + 3085 .LVL410: + 3086 0078 0895 ret + 3087 .LFE69: + 3089 .section .text.Endpoint_Discard_Stream,"ax",@progbits + 3090 .global Endpoint_Discard_Stream + 3092 Endpoint_Discard_Stream: + 3093 .LFB68: + 3094 .LSM409: + 3095 .LVL411: + 3096 0000 FF92 push r15 + 3097 0002 0F93 push r16 + 3098 0004 1F93 push r17 + 3099 0006 CF93 push r28 + 3100 0008 DF93 push r29 + 3101 /* prologue: function */ + 3102 /* frame size = 0 */ + 3103 000a EC01 movw r28,r24 + 3104 000c 8B01 movw r16,r22 + 3105 .LSM410: + 3106 000e 0E94 0000 call Endpoint_WaitUntilReady + 3107 .LVL412: + 3108 0012 F82E mov r15,r24 + 3109 .LVL413: + 3110 0014 8823 tst r24 + 3111 0016 01F0 breq .L295 + 3112 .LVL414: + 3113 0018 00C0 rjmp .L288 + 3114 .LVL415: + 3115 .L293: + 3116 .LBB492: + 3117 .LBB493: + 3118 .LSM411: + 3119 001a 8091 E800 lds r24,232 + 3120 .LVL416: + 3121 .LBE493: + 3122 .LBE492: + 3123 .LSM412: + 3124 001e 85FD sbrc r24,5 + 3125 0020 00C0 rjmp .L290 + 3126 .LBB494: + 3127 .LBB495: + 3128 .LSM413: + 3129 0022 8091 E800 lds r24,232 + 3130 0026 8B77 andi r24,lo8(123) + 3131 0028 8093 E800 sts 232,r24 + 3132 .LBE495: + 3133 .LBE494: + 3134 .LSM414: + 3135 002c 0115 cp r16,__zero_reg__ + 3136 002e 1105 cpc r17,__zero_reg__ + 3137 0030 01F0 breq .L291 + 3138 0032 F801 movw r30,r16 + 3139 0034 0995 icall + 3140 0036 8130 cpi r24,lo8(1) + 3141 0038 01F4 brne .L291 + 3142 003a 85E0 ldi r24,lo8(5) + 3143 .LVL417: + 3144 003c 00C0 rjmp .L292 + 3145 .LVL418: + 3146 .L291: + 3147 .LSM415: + 3148 003e 0E94 0000 call Endpoint_WaitUntilReady + 3149 0042 8823 tst r24 + 3150 0044 01F0 breq .L295 + 3151 .LVL419: + 3152 0046 00C0 rjmp .L292 + 3153 .LVL420: + 3154 .L290: + 3155 .LBB496: + 3156 .LBB497: + 3157 .LSM416: + 3158 0048 8091 F100 lds r24,241 + 3159 .LVL421: + 3160 .LBE497: + 3161 .LBE496: + 3162 .LSM417: + 3163 004c 2197 sbiw r28,1 + 3164 .LVL422: + 3165 .L295: + 3166 .LSM418: + 3167 004e 2097 sbiw r28,0 + 3168 0050 01F4 brne .L293 + 3169 .L288: + 3170 0052 8F2D mov r24,r15 + 3171 .LVL423: + 3172 .L292: + 3173 .LVL424: + 3174 /* epilogue start */ + 3175 .LSM419: + 3176 0054 DF91 pop r29 + 3177 0056 CF91 pop r28 + 3178 .LVL425: + 3179 0058 1F91 pop r17 + 3180 005a 0F91 pop r16 + 3181 .LVL426: + 3182 005c FF90 pop r15 + 3183 .LVL427: + 3184 005e 0895 ret + 3185 .LFE68: + 3371 .Letext0: +DEFINED SYMBOLS + *ABS*:0000000000000000 EndpointStream.c + /tmp/ccfOEB0Q.s:2 *ABS*:000000000000003f __SREG__ + /tmp/ccfOEB0Q.s:3 *ABS*:000000000000003e __SP_H__ + /tmp/ccfOEB0Q.s:4 *ABS*:000000000000003d __SP_L__ + /tmp/ccfOEB0Q.s:5 *ABS*:0000000000000034 __CCP__ + /tmp/ccfOEB0Q.s:6 *ABS*:0000000000000000 __tmp_reg__ + /tmp/ccfOEB0Q.s:7 *ABS*:0000000000000001 __zero_reg__ + /tmp/ccfOEB0Q.s:19 .text.Endpoint_Write_Control_Stream_LE:0000000000000000 Endpoint_Write_Control_Stream_LE + /tmp/ccfOEB0Q.s:208 .text.Endpoint_Write_Control_PStream_LE:0000000000000000 Endpoint_Write_Control_PStream_LE + /tmp/ccfOEB0Q.s:407 .text.Endpoint_Write_Control_Stream_BE:0000000000000000 Endpoint_Write_Control_Stream_BE + /tmp/ccfOEB0Q.s:605 .text.Endpoint_Write_Control_PStream_BE:0000000000000000 Endpoint_Write_Control_PStream_BE + /tmp/ccfOEB0Q.s:812 .text.Endpoint_Read_Control_Stream_LE:0000000000000000 Endpoint_Read_Control_Stream_LE + /tmp/ccfOEB0Q.s:954 .text.Endpoint_Read_Control_Stream_BE:0000000000000000 Endpoint_Read_Control_Stream_BE + /tmp/ccfOEB0Q.s:1109 .text.Endpoint_Read_Control_EStream_BE:0000000000000000 Endpoint_Read_Control_EStream_BE + /tmp/ccfOEB0Q.s:1286 .text.Endpoint_Read_Control_EStream_LE:0000000000000000 Endpoint_Read_Control_EStream_LE + /tmp/ccfOEB0Q.s:1446 .text.Endpoint_Write_Control_EStream_BE:0000000000000000 Endpoint_Write_Control_EStream_BE + /tmp/ccfOEB0Q.s:1666 .text.Endpoint_Write_Control_EStream_LE:0000000000000000 Endpoint_Write_Control_EStream_LE + /tmp/ccfOEB0Q.s:1878 .text.Endpoint_Read_EStream_BE:0000000000000000 Endpoint_Read_EStream_BE + /tmp/ccfOEB0Q.s:1999 .text.Endpoint_Read_Stream_BE:0000000000000000 Endpoint_Read_Stream_BE + /tmp/ccfOEB0Q.s:2112 .text.Endpoint_Read_EStream_LE:0000000000000000 Endpoint_Read_EStream_LE + /tmp/ccfOEB0Q.s:2236 .text.Endpoint_Read_Stream_LE:0000000000000000 Endpoint_Read_Stream_LE + /tmp/ccfOEB0Q.s:2356 .text.Endpoint_Write_PStream_BE:0000000000000000 Endpoint_Write_PStream_BE + /tmp/ccfOEB0Q.s:2480 .text.Endpoint_Write_EStream_BE:0000000000000000 Endpoint_Write_EStream_BE + /tmp/ccfOEB0Q.s:2600 .text.Endpoint_Write_Stream_BE:0000000000000000 Endpoint_Write_Stream_BE + /tmp/ccfOEB0Q.s:2713 .text.Endpoint_Write_EStream_LE:0000000000000000 Endpoint_Write_EStream_LE + /tmp/ccfOEB0Q.s:2836 .text.Endpoint_Write_PStream_LE:0000000000000000 Endpoint_Write_PStream_LE + /tmp/ccfOEB0Q.s:2972 .text.Endpoint_Write_Stream_LE:0000000000000000 Endpoint_Write_Stream_LE + /tmp/ccfOEB0Q.s:3092 .text.Endpoint_Discard_Stream:0000000000000000 Endpoint_Discard_Stream + +UNDEFINED SYMBOLS +USB_ControlRequest +USB_DeviceState +__eeupd_byte_usb162 +__eerd_byte_usb162 +Endpoint_WaitUntilReady diff --git a/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.o b/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.o Binary files differnew file mode 100644 index 0000000..9ba8202 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/EndpointStream.o diff --git a/firmware/LUFA/Drivers/USB/HighLevel/Events.c b/firmware/LUFA/Drivers/USB/HighLevel/Events.c new file mode 100644 index 0000000..b73a7d1 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/Events.c @@ -0,0 +1,39 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#define __INCLUDE_FROM_EVENTS_C
+#define __INCLUDE_FROM_USB_DRIVER
+#include "Events.h"
+
+void USB_Event_Stub(void)
+{
+
+}
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/Events.h b/firmware/LUFA/Drivers/USB/HighLevel/Events.h new file mode 100644 index 0000000..a7d3543 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/Events.h @@ -0,0 +1,375 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB controller events manager.
+ *
+ * This file contains macros and functions relating to the management of library events, which are small
+ * pieces of code similar to ISRs which are run when a given condition is met. Each event can be fired from
+ * multiple places in the user or library code, which may or may not be inside an ISR, thus each handler
+ * should be written to be as small and fast as possible to prevent possible problems.
+ *
+ * Events can be hooked by the user application by declaring a handler function with the same name and parameters
+ * listed here. If an event with no user-associated handler is fired within the library, it by default maps to an
+ * internal empty stub function.
+ *
+ * Each event must only have one associated event handler, but can be raised by multiple sources by calling the
+ * event handler function (with any required event parameters).
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+/** \ingroup Group_USB
+ * @defgroup Group_Events USB Events
+ *
+ * This module contains macros and functions relating to the management of library events, which are small
+ * pieces of code similar to ISRs which are run when a given condition is met. Each event can be fired from
+ * multiple places in the user or library code, which may or may not be inside an ISR, thus each handler
+ * should be written to be as small and fast as possible to prevent possible problems.
+ *
+ * Events can be hooked by the user application by declaring a handler function with the same name and parameters
+ * listed here. If an event with no user-associated handler is fired within the library, it by default maps to an
+ * internal empty stub function.
+ *
+ * Each event must only have one associated event handler, but can be raised by multiple sources by calling the
+ * event handler function (with any required event parameters).
+ *
+ * @{
+ */
+
+#ifndef __USBEVENTS_H__
+#define __USBEVENTS_H__
+
+ /* Includes: */
+ #include <stdint.h>
+
+ #include "../../../Common/Common.h"
+ #include "USBMode.h"
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Pseudo-Functions for Doxygen: */
+ #if !defined(__INCLUDE_FROM_EVENTS_C) || defined(__DOXYGEN__)
+ /** Event for USB mode pin level change. This event fires when the USB interface is set to dual role
+ * mode, and the UID pin level has changed to indicate a new mode (device or host). This event fires
+ * before the mode is switched to the newly indicated mode but after the \ref EVENT_USB_Device_Disconnect
+ * event has fired (if connected before the role change).
+ *
+ * \note This event only exists on USB AVR models which support dual role modes.
+ * \n\n
+ *
+ * \note This event does not exist if the USB_DEVICE_ONLY or USB_HOST_ONLY tokens have been supplied
+ * to the compiler (see \ref Group_USBManagement documentation).
+ */
+ void EVENT_USB_UIDChange(void);
+
+ /** Event for USB host error. This event fires when a hardware fault has occurred whilst the USB
+ * interface is in host mode.
+ *
+ * \param[in] ErrorCode Error code indicating the failure reason, a value in \ref USB_Host_ErrorCodes_t.
+ *
+ * \note This event only exists on USB AVR models which supports host mode.
+ * \n\n
+ *
+ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ */
+ void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
+
+ /** Event for USB device attachment. This event fires when a the USB interface is in host mode, and
+ * a USB device has been connected to the USB interface. This is interrupt driven, thus fires before
+ * the standard \ref EVENT_USB_Device_Connect() event and so can be used to programmatically start the USB
+ * management task to reduce CPU consumption.
+ *
+ * \note This event only exists on USB AVR models which supports host mode.
+ * \n\n
+ *
+ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ *
+ * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
+ */
+ void EVENT_USB_Host_DeviceAttached(void);
+
+ /** Event for USB device removal. This event fires when a the USB interface is in host mode, and
+ * a USB device has been removed the USB interface whether or not it has been enumerated. This
+ * can be used to programmatically stop the USB management task to reduce CPU consumption.
+ *
+ * \note This event only exists on USB AVR models which supports host mode.
+ * \n\n
+ *
+ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ *
+ * \see \ref USB_USBTask() for more information on the USB management task and reducing CPU usage.
+ */
+ void EVENT_USB_Host_DeviceUnattached(void);
+
+ /** Event for USB device enumeration failure. This event fires when a the USB interface is
+ * in host mode, and an attached USB device has failed to enumerate completely.
+ *
+ * \param[in] ErrorCode Error code indicating the failure reason, a value in
+ * \ref USB_Host_EnumerationErrorCodes_t.
+ *
+ * \param[in] SubErrorCode Sub error code indicating the reason for failure - for example, if the
+ * ErrorCode parameter indicates a control error, this will give the error
+ * code returned by the \ref USB_Host_SendControlRequest() function.
+ *
+ * \note This event only exists on USB AVR models which supports host mode.
+ * \n\n
+ *
+ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ */
+ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
+ const uint8_t SubErrorCode);
+
+ /** Event for USB device enumeration completion. This event fires when a the USB interface is
+ * in host mode and an attached USB device has been completely enumerated and is ready to be
+ * controlled by the user application.
+ *
+ * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around
+ * 1 second) when a transaction is waiting to be processed by the device will prevent break communications
+ * and cause the host to reset the USB bus.
+ */
+ void EVENT_USB_Host_DeviceEnumerationComplete(void);
+
+ /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB
+ * frame, once per millisecond, and is synchronized to the USB bus. This can be used as an accurate
+ * millisecond timer source when the USB bus is not suspended while in host mode.
+ *
+ * This event is time-critical; it is run once per millisecond and thus long handlers will significantly
+ * degrade device performance. This event should only be enabled when needed to reduce device wake-ups.
+ *
+ * \note This event is not normally active - it must be manually enabled and disabled via the
+ * \ref USB_Host_EnableSOFEvents() and \ref USB_Host_DisableSOFEvents() commands after enumeration of
+ * a USB device.
+ * \n\n
+ *
+ * \note This event does not exist if the USB_DEVICE_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ */
+ void EVENT_USB_Host_StartOfFrame(void);
+
+ /** Event for USB device connection. This event fires when the AVR in device mode and the device is connected
+ * to a host, beginning the enumeration process, measured by a rising level on the AVR's VBUS pin.
+ *
+ * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around
+ * two seconds) will prevent the device from enumerating correctly.
+ *
+ * \note For the smaller series 2 USB AVRs with limited USB controllers, VBUS is not available to the USB controller.
+ * this means that the current connection state is derived from the bus suspension and wake up events by default,
+ * which is not always accurate (host may suspend the bus while still connected). If the actual connection state
+ * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
+ * passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
+ * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
+ * \n\n
+ *
+ * \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers
+ * if NO_LIMITED_CONTROLLER_CONNECT is not defined.
+ *
+ * \see USBTask.h for more information on the USB management task and reducing CPU usage.
+ */
+ void EVENT_USB_Device_Connect(void);
+
+ /** Event for USB device disconnection. This event fires when the AVR in device mode and the device is disconnected
+ * from a host, measured by a falling level on the AVR's VBUS pin.
+ *
+ * \note For the smaller series 2 USB AVRs with limited USB controllers, VBUS is not available to the USB controller.
+ * this means that the current connection state is derived from the bus suspension and wake up events by default,
+ * which is not always accurate (host may suspend the bus while still connected). If the actual connection state
+ * needs to be determined, VBUS should be routed to an external pin, and the auto-detect behaviour turned off by
+ * passing the NO_LIMITED_CONTROLLER_CONNECT token to the compiler via the -D switch at compile time. The connection
+ * and disconnection events may be manually fired, and the \ref USB_DeviceState global changed manually.
+ * \n\n
+ *
+ * \note This event may fire multiple times during device enumeration on the series 2 USB AVRs with limited USB controllers
+ * if NO_LIMITED_CONTROLLER_CONNECT is not defined.
+ *
+ * \see USBTask.h for more information on the USB management task and reducing CPU usage.
+ */
+ void EVENT_USB_Device_Disconnect(void);
+
+ /** Event for control requests. This event fires when a the USB host issues a control request
+ * to the mandatory device control endpoint (of address 0). This may either be a standard
+ * request that the library may have a handler code for internally, or a class specific request
+ * issued to the device which must be handled appropriately. If a request is not processed in the
+ * user application via this event, it will be passed to the library for processing internally
+ * if a suitable handler exists.
+ *
+ * This event is time-critical; each packet within the request transaction must be acknowledged or
+ * sent within 50ms or the host will abort the transfer.
+ *
+ * The library internally handles all standard control requests with the exceptions of SYNC FRAME,
+ * SET DESCRIPTOR and SET INTERFACE. These and all other non-standard control requests will be left
+ * for the user to process via this event if desired. If not handled in the user application or by
+ * the library internally, unknown requests are automatically STALLed.
+ *
+ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ * \n\n
+ *
+ * \note Requests should be handled in the same manner as described in the USB 2.0 Specification,
+ * or appropriate class specification. In all instances, the library has already read the
+ * request SETUP parameters into the \ref USB_ControlRequest structure which should then be used
+ * by the application to determine how to handle the issued request.
+ */
+ void EVENT_USB_Device_ControlRequest(void);
+
+ /** Event for USB configuration number changed. This event fires when a the USB host changes the
+ * selected configuration number while in device mode. This event should be hooked in device
+ * applications to create the endpoints and configure the device for the selected configuration.
+ *
+ * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around
+ * one second) will prevent the device from enumerating correctly.
+ *
+ * This event fires after the value of \ref USB_ConfigurationNumber has been changed.
+ *
+ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ */
+ void EVENT_USB_Device_ConfigurationChanged(void);
+
+ /** Event for USB suspend. This event fires when a the USB host suspends the device by halting its
+ * transmission of Start Of Frame pulses to the device. This is generally hooked in order to move
+ * the device over to a low power state until the host wakes up the device. If the USB interface is
+ * enumerated with the \ref USB_OPT_AUTO_PLL option set, the library will automatically suspend the
+ * USB PLL before the event is fired to save power.
+ *
+ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ * \n\n
+ *
+ * \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT
+ * compile time token is not set - see \ref EVENT_USB_Device_Disconnect.
+ *
+ * \see \ref EVENT_USB_Device_WakeUp() event for accompanying Wake Up event.
+ */
+ void EVENT_USB_Device_Suspend(void);
+
+ /** Event for USB wake up. This event fires when a the USB interface is suspended while in device
+ * mode, and the host wakes up the device by supplying Start Of Frame pulses. This is generally
+ * hooked to pull the user application out of a low power state and back into normal operating
+ * mode. If the USB interface is enumerated with the \ref USB_OPT_AUTO_PLL option set, the library
+ * will automatically restart the USB PLL before the event is fired.
+ *
+ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ * \n\n
+ *
+ * \note This event does not exist on the series 2 USB AVRs when the NO_LIMITED_CONTROLLER_CONNECT
+ * compile time token is not set - see \ref EVENT_USB_Device_Connect.
+ *
+ * \see \ref EVENT_USB_Device_Suspend() event for accompanying Suspend event.
+ */
+ void EVENT_USB_Device_WakeUp(void);
+
+ /** Event for USB interface reset. This event fires when the USB interface is in device mode, and
+ * a the USB host requests that the device reset its interface. This event fires after the control
+ * endpoint has been automatically configured by the library.
+ *
+ * This event is time-critical; exceeding OS-specific delays within this event handler (typically of around
+ * two seconds) will prevent the device from enumerating correctly.
+ *
+ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ */
+ void EVENT_USB_Device_Reset(void);
+
+ /** Event for USB Start Of Frame detection, when enabled. This event fires at the start of each USB
+ * frame, once per millisecond, and is synchronized to the USB bus. This can be used as an accurate
+ * millisecond timer source when the USB bus is enumerated in device mode to a USB host.
+ *
+ * This event is time-critical; it is run once per millisecond and thus long handlers will significantly
+ * degrade device performance. This event should only be enabled when needed to reduce device wake-ups.
+ *
+ * \note This event is not normally active - it must be manually enabled and disabled via the
+ * \ref USB_Device_EnableSOFEvents() and \ref USB_Device_DisableSOFEvents() commands after enumeration.
+ * \n\n
+ *
+ * \note This event does not exist if the USB_HOST_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
+ */
+ void EVENT_USB_Device_StartOfFrame(void);
+ #endif
+
+ /* Private Interface - For use in library only: */
+ #if !defined(__DOXYGEN__)
+ /* Function Prototypes: */
+ #if defined(__INCLUDE_FROM_EVENTS_C)
+ void USB_Event_Stub(void) ATTR_CONST;
+
+ #if defined(USB_CAN_BE_BOTH)
+ void EVENT_USB_UIDChange(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ #endif
+
+ #if defined(USB_CAN_BE_HOST)
+ void EVENT_USB_Host_HostError(const uint8_t ErrorCode) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Host_DeviceAttached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Host_DeviceUnattached(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Host_DeviceEnumerationComplete(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
+ const uint8_t SubErrorCode)
+ ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Host_StartOfFrame(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ #endif
+
+ #if defined(USB_CAN_BE_DEVICE)
+ void EVENT_USB_Device_Connect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Device_Disconnect(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Device_ControlRequest(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Device_ConfigurationChanged(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Device_Suspend(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Device_WakeUp(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Device_Reset(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ void EVENT_USB_Device_StartOfFrame(void) ATTR_WEAK ATTR_ALIAS(USB_Event_Stub);
+ #endif
+ #endif
+ #endif
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
+
+/** @} */
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/Events.lst b/firmware/LUFA/Drivers/USB/HighLevel/Events.lst new file mode 100644 index 0000000..73ddf6a --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/Events.lst @@ -0,0 +1,55 @@ + 1 .file "Events.c" + 2 __SREG__ = 0x3f + 3 __SP_H__ = 0x3e + 4 __SP_L__ = 0x3d + 5 __CCP__ = 0x34 + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 15 .Ltext0: + 16 .section .text.USB_Event_Stub,"ax",@progbits + 17 .global USB_Event_Stub + 19 USB_Event_Stub: + 20 .LFB6: + 21 .LSM0: + 22 /* prologue: function */ + 23 /* frame size = 0 */ + 24 /* epilogue start */ + 25 .LSM1: + 26 0000 0895 ret + 27 .LFE6: + 29 .weak EVENT_USB_Device_Connect + 30 .set EVENT_USB_Device_Connect,USB_Event_Stub + 31 .weak EVENT_USB_Device_Disconnect + 32 .set EVENT_USB_Device_Disconnect,USB_Event_Stub + 33 .weak EVENT_USB_Device_ControlRequest + 34 .set EVENT_USB_Device_ControlRequest,USB_Event_Stub + 35 .weak EVENT_USB_Device_ConfigurationChanged + 36 .set EVENT_USB_Device_ConfigurationChanged,USB_Event_Stub + 37 .weak EVENT_USB_Device_Suspend + 38 .set EVENT_USB_Device_Suspend,USB_Event_Stub + 39 .weak EVENT_USB_Device_WakeUp + 40 .set EVENT_USB_Device_WakeUp,USB_Event_Stub + 41 .weak EVENT_USB_Device_Reset + 42 .set EVENT_USB_Device_Reset,USB_Event_Stub + 43 .weak EVENT_USB_Device_StartOfFrame + 44 .set EVENT_USB_Device_StartOfFrame,USB_Event_Stub + 69 .Letext0: +DEFINED SYMBOLS + *ABS*:0000000000000000 Events.c + /tmp/ccamxlGJ.s:2 *ABS*:000000000000003f __SREG__ + /tmp/ccamxlGJ.s:3 *ABS*:000000000000003e __SP_H__ + /tmp/ccamxlGJ.s:4 *ABS*:000000000000003d __SP_L__ + /tmp/ccamxlGJ.s:5 *ABS*:0000000000000034 __CCP__ + /tmp/ccamxlGJ.s:6 *ABS*:0000000000000000 __tmp_reg__ + /tmp/ccamxlGJ.s:7 *ABS*:0000000000000001 __zero_reg__ + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 USB_Event_Stub + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 EVENT_USB_Device_Connect + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 EVENT_USB_Device_Disconnect + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 EVENT_USB_Device_ControlRequest + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 EVENT_USB_Device_ConfigurationChanged + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 EVENT_USB_Device_Suspend + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 EVENT_USB_Device_WakeUp + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 EVENT_USB_Device_Reset + /tmp/ccamxlGJ.s:19 .text.USB_Event_Stub:0000000000000000 EVENT_USB_Device_StartOfFrame + +NO UNDEFINED SYMBOLS diff --git a/firmware/LUFA/Drivers/USB/HighLevel/Events.o b/firmware/LUFA/Drivers/USB/HighLevel/Events.o Binary files differnew file mode 100644 index 0000000..7b2f08b --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/Events.o diff --git a/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.c b/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.c new file mode 100644 index 0000000..2eee726 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.c @@ -0,0 +1,180 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#define __INCLUDE_FROM_USB_DRIVER
+#include "USBMode.h"
+
+#if defined(USB_CAN_BE_HOST)
+
+#define __INCLUDE_FROM_HOSTSTDREQ_C
+#include "HostStandardReq.h"
+
+uint8_t USB_Host_SendControlRequest(void* const BufferPtr)
+{
+ uint8_t* HeaderStream = (uint8_t*)&USB_ControlRequest;
+ uint8_t* DataStream = (uint8_t*)BufferPtr;
+ bool BusSuspended = USB_Host_IsBusSuspended();
+ uint8_t ReturnStatus = HOST_SENDCONTROL_Successful;
+ uint16_t DataLen = USB_ControlRequest.wLength;
+
+ USB_Host_ResumeBus();
+
+ if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
+ goto End_Of_Control_Send;
+
+ Pipe_SetPipeToken(PIPE_TOKEN_SETUP);
+ Pipe_ClearErrorFlags();
+
+ Pipe_Unfreeze();
+
+ for (uint8_t HeaderByte = 0; HeaderByte < sizeof(USB_Request_Header_t); HeaderByte++)
+ Pipe_Write_Byte(*(HeaderStream++));
+
+ Pipe_ClearSETUP();
+
+ if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_SetupSent)) != HOST_SENDCONTROL_Successful)
+ goto End_Of_Control_Send;
+
+ Pipe_Freeze();
+
+ if ((ReturnStatus = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
+ goto End_Of_Control_Send;
+
+ if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_DIRECTION) == REQDIR_DEVICETOHOST)
+ {
+ Pipe_SetPipeToken(PIPE_TOKEN_IN);
+
+ if (DataStream != NULL)
+ {
+ while (DataLen)
+ {
+ Pipe_Unfreeze();
+
+ if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful)
+ goto End_Of_Control_Send;
+
+ if (!(Pipe_BytesInPipe()))
+ DataLen = 0;
+
+ while (Pipe_BytesInPipe() && DataLen)
+ {
+ *(DataStream++) = Pipe_Read_Byte();
+ DataLen--;
+ }
+
+ Pipe_Freeze();
+ Pipe_ClearIN();
+ }
+ }
+
+ Pipe_SetPipeToken(PIPE_TOKEN_OUT);
+ Pipe_Unfreeze();
+
+ if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
+ goto End_Of_Control_Send;
+
+ Pipe_ClearOUT();
+
+ if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
+ goto End_Of_Control_Send;
+ }
+ else
+ {
+ if (DataStream != NULL)
+ {
+ Pipe_SetPipeToken(PIPE_TOKEN_OUT);
+ Pipe_Unfreeze();
+
+ while (DataLen)
+ {
+ if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
+ goto End_Of_Control_Send;
+
+ while (DataLen && (Pipe_BytesInPipe() < USB_ControlPipeSize))
+ {
+ Pipe_Write_Byte(*(DataStream++));
+ DataLen--;
+ }
+
+ Pipe_ClearOUT();
+ }
+
+ if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_OutReady)) != HOST_SENDCONTROL_Successful)
+ goto End_Of_Control_Send;
+
+ Pipe_Freeze();
+ }
+
+ Pipe_SetPipeToken(PIPE_TOKEN_IN);
+ Pipe_Unfreeze();
+
+ if ((ReturnStatus = USB_Host_WaitForIOS(USB_HOST_WAITFOR_InReceived)) != HOST_SENDCONTROL_Successful)
+ goto End_Of_Control_Send;
+
+ Pipe_ClearIN();
+ }
+
+End_Of_Control_Send:
+ Pipe_Freeze();
+
+ if (BusSuspended)
+ USB_Host_SuspendBus();
+
+ Pipe_ResetPipe(PIPE_CONTROLPIPE);
+
+ return ReturnStatus;
+}
+
+static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType)
+{
+ #if (USB_HOST_TIMEOUT_MS < 0xFF)
+ uint8_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
+ #else
+ uint16_t TimeoutCounter = USB_HOST_TIMEOUT_MS;
+ #endif
+
+ while (!(((WaitType == USB_HOST_WAITFOR_SetupSent) && Pipe_IsSETUPSent()) ||
+ ((WaitType == USB_HOST_WAITFOR_InReceived) && Pipe_IsINReceived()) ||
+ ((WaitType == USB_HOST_WAITFOR_OutReady) && Pipe_IsOUTReady())))
+ {
+ uint8_t ErrorCode;
+
+ if ((ErrorCode = USB_Host_WaitMS(1)) != HOST_WAITERROR_Successful)
+ return ErrorCode;
+
+ if (!(TimeoutCounter--))
+ return HOST_SENDCONTROL_SoftwareTimeOut;
+ }
+
+ return HOST_SENDCONTROL_Successful;
+}
+
+#endif
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.h b/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.h new file mode 100644 index 0000000..4b9b3dc --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.h @@ -0,0 +1,118 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB host standard request management.
+ *
+ * This file contains the function prototypes necessary for the issuing of outgoing standard control requests
+ * when the library is in USB host mode.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+#ifndef __HOSTSTDREQ_H__
+#define __HOSTSTDREQ_H__
+
+ /* Includes: */
+ #include <stdint.h>
+ #include <stdbool.h>
+
+ #include "USBMode.h"
+ #include "StdRequestType.h"
+ #include "../LowLevel/USBController.h"
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Enums: */
+ /** Enum for the \ref USB_Host_SendControlRequest() return code, indicating the reason for the error
+ * if the transfer of the request is unsuccessful.
+ *
+ * \ingroup Group_PipeControlReq
+ */
+ enum USB_Host_SendControlErrorCodes_t
+ {
+ HOST_SENDCONTROL_Successful = 0, /**< No error occurred in the request transfer. */
+ HOST_SENDCONTROL_DeviceDisconnected = 1, /**< The attached device was disconnected during the
+ * request transfer.
+ */
+ HOST_SENDCONTROL_PipeError = 2, /**< An error occurred in the pipe while sending the request. */
+ HOST_SENDCONTROL_SetupStalled = 3, /**< The attached device stalled the request, usually
+ * indicating that the request is unsupported on the device.
+ */
+ HOST_SENDCONTROL_SoftwareTimeOut = 4, /**< The request or data transfer timed out. */
+ };
+
+ /* Function Prototypes: */
+ /** Sends the request stored in the \ref USB_ControlRequest global structure to the attached device,
+ * and transfers the data stored in the buffer to the device, or from the device to the buffer
+ * as requested. The transfer is made on the currently selected pipe.
+ *
+ * \ingroup Group_PipeControlReq
+ *
+ * \param[in] BufferPtr Pointer to the start of the data buffer if the request has a data stage, or
+ * NULL if the request transfers no data to or from the device.
+ *
+ * \return A value from the \ref USB_Host_SendControlErrorCodes_t enum to indicate the result.
+ */
+ uint8_t USB_Host_SendControlRequest(void* const BufferPtr);
+
+ /* Private Interface - For use in library only: */
+ #if !defined(__DOXYGEN__)
+ /* Enums: */
+ enum USB_WaitForTypes_t
+ {
+ USB_HOST_WAITFOR_SetupSent,
+ USB_HOST_WAITFOR_InReceived,
+ USB_HOST_WAITFOR_OutReady,
+ };
+
+ /* Function Prototypes: */
+ #if defined(__INCLUDE_FROM_HOSTSTDREQ_C)
+ static uint8_t USB_Host_WaitForIOS(const uint8_t WaitType);
+ #endif
+ #endif
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.lst b/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.lst new file mode 100644 index 0000000..499a9dd --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.lst @@ -0,0 +1,19 @@ + 1 .file "HostStandardReq.c" + 2 __SREG__ = 0x3f + 3 __SP_H__ = 0x3e + 4 __SP_L__ = 0x3d + 5 __CCP__ = 0x34 + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 15 .Ltext0: + 16 .Letext0: +DEFINED SYMBOLS + *ABS*:0000000000000000 HostStandardReq.c + /tmp/ccRphupV.s:2 *ABS*:000000000000003f __SREG__ + /tmp/ccRphupV.s:3 *ABS*:000000000000003e __SP_H__ + /tmp/ccRphupV.s:4 *ABS*:000000000000003d __SP_L__ + /tmp/ccRphupV.s:5 *ABS*:0000000000000034 __CCP__ + /tmp/ccRphupV.s:6 *ABS*:0000000000000000 __tmp_reg__ + /tmp/ccRphupV.s:7 *ABS*:0000000000000001 __zero_reg__ + +NO UNDEFINED SYMBOLS diff --git a/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.o b/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.o Binary files differnew file mode 100644 index 0000000..b9865fa --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/HostStandardReq.o diff --git a/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.c b/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.c new file mode 100644 index 0000000..25100ca --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.c @@ -0,0 +1,196 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#define __INCLUDE_FROM_USB_DRIVER
+#include "USBMode.h"
+
+#if defined(USB_CAN_BE_HOST)
+
+#include "PipeStream.h"
+
+uint8_t Pipe_Discard_Stream(uint16_t Length
+ __CALLBACK_PARAM)
+{
+ uint8_t ErrorCode;
+
+ Pipe_SetPipeToken(PIPE_TOKEN_IN);
+
+ if ((ErrorCode = Pipe_WaitUntilReady()))
+ return ErrorCode;
+
+ #if defined(FAST_STREAM_TRANSFERS)
+ uint8_t BytesRemToAlignment = (Pipe_BytesInPipe() & 0x07);
+
+ if (Length >= 8)
+ {
+ Length -= BytesRemToAlignment;
+
+ switch (BytesRemToAlignment)
+ {
+ default:
+ do
+ {
+ if (!(Pipe_IsReadWriteAllowed()))
+ {
+ Pipe_ClearIN();
+
+ #if !defined(NO_STREAM_CALLBACKS)
+ if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
+ return PIPE_RWSTREAM_CallbackAborted;
+ #endif
+
+ if ((ErrorCode = Pipe_WaitUntilReady()))
+ return ErrorCode;
+ }
+
+ Length -= 8;
+
+ Pipe_Discard_Byte();
+ case 7: Pipe_Discard_Byte();
+ case 6: Pipe_Discard_Byte();
+ case 5: Pipe_Discard_Byte();
+ case 4: Pipe_Discard_Byte();
+ case 3: Pipe_Discard_Byte();
+ case 2: Pipe_Discard_Byte();
+ case 1: Pipe_Discard_Byte();
+ } while (Length >= 8);
+ }
+ }
+ #endif
+
+ while (Length)
+ {
+ if (!(Pipe_IsReadWriteAllowed()))
+ {
+ Pipe_ClearIN();
+
+ #if !defined(NO_STREAM_CALLBACKS)
+ if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
+ return PIPE_RWSTREAM_CallbackAborted;
+ #endif
+
+ if ((ErrorCode = Pipe_WaitUntilReady()))
+ return ErrorCode;
+ }
+ else
+ {
+ Pipe_Discard_Byte();
+ Length--;
+ }
+ }
+
+ return PIPE_RWSTREAM_NoError;
+}
+
+/* The following abuses the C preprocessor in order to copy-past common code with slight alterations,
+ * so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */
+
+#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*((uint8_t*)BufferPtr++))
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_LE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr++))
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_LE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr++))
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(*((uint8_t*)BufferPtr--))
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_BE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(pgm_read_byte((uint8_t*)BufferPtr--))
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_BE
+#define TEMPLATE_BUFFER_TYPE const void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_Byte(eeprom_read_byte((uint8_t*)BufferPtr--))
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE
+#define TEMPLATE_BUFFER_TYPE void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_IN
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr++) = Pipe_Read_Byte()
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_LE
+#define TEMPLATE_BUFFER_TYPE void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_IN
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) 0
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr++, Pipe_Read_Byte())
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE
+#define TEMPLATE_BUFFER_TYPE void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_IN
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *((uint8_t*)BufferPtr--) = Pipe_Read_Byte()
+#include "Template/Template_Pipe_RW.c"
+
+#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_BE
+#define TEMPLATE_BUFFER_TYPE void*
+#define TEMPLATE_TOKEN PIPE_TOKEN_IN
+#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
+#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
+#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte((uint8_t*)BufferPtr--, Pipe_Read_Byte())
+#include "Template/Template_Pipe_RW.c"
+
+#endif
+ diff --git a/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.h b/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.h new file mode 100644 index 0000000..730a338 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.h @@ -0,0 +1,298 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB host pipe stream function definitions.
+ *
+ * This file contains structures, function prototypes and macros related to the sending and receiving of
+ * arbitrary data streams through the device's data pipes when the library is initialized in USB host mode.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+/** \ingroup Group_PipeRW
+ * @defgroup Group_PipeStreamRW Read/Write of Multi-Byte Streams
+ *
+ * Functions, macros, variables, enums and types related to data reading and writing of data streams from
+ * and to pipes.
+ *
+ * @{
+ */
+
+#ifndef __PIPE_STREAM_H__
+#define __PIPE_STREAM_H__
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+ #include <avr/eeprom.h>
+ #include <stdbool.h>
+
+ #include "../../../Common/Common.h"
+ #include "USBTask.h"
+
+ #if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
+ #include "StreamCallbacks.h"
+ #endif
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ #if !defined(NO_STREAM_CALLBACKS) || defined(__DOXYGEN__)
+ #define __CALLBACK_PARAM , StreamCallbackPtr_t Callback
+ #else
+ #define __CALLBACK_PARAM
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Enums: */
+ /** Enum for the possible error return codes of the Pipe_*_Stream_* functions. */
+ enum Pipe_Stream_RW_ErrorCodes_t
+ {
+ PIPE_RWSTREAM_NoError = 0, /**< Command completed successfully, no error. */
+ PIPE_RWSTREAM_PipeStalled = 1, /**< The device stalled the pipe during the transfer. */
+ PIPE_RWSTREAM_DeviceDisconnected = 2, /**< Device was disconnected from the host during
+ * the transfer.
+ */
+ PIPE_RWSTREAM_Timeout = 3, /**< The device failed to accept or send the next packet
+ * within the software timeout period set by the
+ * \ref USB_STREAM_TIMEOUT_MS macro.
+ */
+ PIPE_RWSTREAM_CallbackAborted = 4, /**< Indicates that the stream's callback function aborted
+ * the transfer early.
+ */
+ };
+
+ /* Function Prototypes: */
+ /** Reads and discards the given number of bytes from the pipe, discarding fully read packets from the host
+ * as needed. The last packet is not automatically discarded once the remaining bytes has been read; the
+ * user is responsible for manually discarding the last packet from the device via the \ref Pipe_ClearIN() macro.
+ * Between each USB packet, the given stream callback function is executed repeatedly until the next packet is ready,
+ * allowing for early aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
+ *
+ * \param[in] Length Number of bytes to send via the currently selected pipe.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Discard_Stream(uint16_t Length
+ __CALLBACK_PARAM);
+
+ /** Writes the given number of bytes to the pipe from the given buffer in little endian,
+ * sending full packets to the device as needed. The last packet filled is not automatically sent;
+ * the user is responsible for manually sending the last written packet to the host via the
+ * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is
+ * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Write_Stream_LE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Pipe_Write_Stream_LE().
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Write_EStream_LE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** FLASH buffer source version of \ref Pipe_Write_Stream_LE().
+ *
+ * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Write_PStream_LE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Writes the given number of bytes to the pipe from the given buffer in big endian,
+ * sending full packets to the device as needed. The last packet filled is not automatically sent;
+ * the user is responsible for manually sending the last written packet to the host via the
+ * \ref Pipe_ClearOUT() macro. Between each USB packet, the given stream callback function is
+ * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Write_Stream_BE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Pipe_Write_Stream_BE().
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Write_EStream_BE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** FLASH buffer source version of \ref Pipe_Write_Stream_BE().
+ *
+ * \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
+ *
+ * \param[in] Buffer Pointer to the source data buffer to read from.
+ * \param[in] Length Number of bytes to read for the currently selected pipe into the buffer.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Write_PStream_BE(const void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Reads the given number of bytes from the pipe into the given buffer in little endian,
+ * sending full packets to the device as needed. The last packet filled is not automatically sent;
+ * the user is responsible for manually sending the last written packet to the host via the
+ * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is
+ * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
+ *
+ * \param[out] Buffer Pointer to the source data buffer to write to.
+ * \param[in] Length Number of bytes to read for the currently selected pipe to read from.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Read_Stream_LE(void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Pipe_Read_Stream_LE().
+ *
+ * \param[out] Buffer Pointer to the source data buffer to write to.
+ * \param[in] Length Number of bytes to read for the currently selected pipe to read from.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Read_EStream_LE(void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** Reads the given number of bytes from the pipe into the given buffer in big endian,
+ * sending full packets to the device as needed. The last packet filled is not automatically sent;
+ * the user is responsible for manually sending the last written packet to the host via the
+ * \ref Pipe_ClearIN() macro. Between each USB packet, the given stream callback function is
+ * executed repeatedly until the next packet is ready, allowing for early aborts of stream transfers.
+ *
+ * The callback routine should be created according to the information in \ref Group_StreamCallbacks.
+ * If the token NO_STREAM_CALLBACKS is passed via the -D option to the compiler, stream callbacks are
+ * disabled and this function has the Callback parameter omitted.
+ *
+ * The pipe token is set automatically, thus this can be used on bi-directional pipes directly without
+ * having to explicitly change the data direction with a call to \ref Pipe_SetPipeToken().
+ *
+ * \param[out] Buffer Pointer to the source data buffer to write to.
+ * \param[in] Length Number of bytes to read for the currently selected pipe to read from.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Read_Stream_BE(void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /** EEPROM buffer source version of \ref Pipe_Read_Stream_BE().
+ *
+ * \param[out] Buffer Pointer to the source data buffer to write to.
+ * \param[in] Length Number of bytes to read for the currently selected pipe to read from.
+ * \param[in] Callback Name of a callback routine to call between successive USB packet transfers, NULL if no callback.
+ *
+ * \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum.
+ */
+ uint8_t Pipe_Read_EStream_BE(void* Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM) ATTR_NON_NULL_PTR_ARG(1);
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
+
+/** @} */
+ diff --git a/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.lst b/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.lst new file mode 100644 index 0000000..f931e06 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.lst @@ -0,0 +1,19 @@ + 1 .file "PipeStream.c" + 2 __SREG__ = 0x3f + 3 __SP_H__ = 0x3e + 4 __SP_L__ = 0x3d + 5 __CCP__ = 0x34 + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 15 .Ltext0: + 16 .Letext0: +DEFINED SYMBOLS + *ABS*:0000000000000000 PipeStream.c + /tmp/cct2dEBX.s:2 *ABS*:000000000000003f __SREG__ + /tmp/cct2dEBX.s:3 *ABS*:000000000000003e __SP_H__ + /tmp/cct2dEBX.s:4 *ABS*:000000000000003d __SP_L__ + /tmp/cct2dEBX.s:5 *ABS*:0000000000000034 __CCP__ + /tmp/cct2dEBX.s:6 *ABS*:0000000000000000 __tmp_reg__ + /tmp/cct2dEBX.s:7 *ABS*:0000000000000001 __zero_reg__ + +NO UNDEFINED SYMBOLS diff --git a/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.o b/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.o Binary files differnew file mode 100644 index 0000000..32ff384 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/PipeStream.o diff --git a/firmware/LUFA/Drivers/USB/HighLevel/StdDescriptors.h b/firmware/LUFA/Drivers/USB/HighLevel/StdDescriptors.h new file mode 100644 index 0000000..6001325 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/StdDescriptors.h @@ -0,0 +1,692 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB standard descriptor definitions.
+ *
+ * This file contains structures and macros for the easy creation of standard USB descriptors in USB device projects.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+/** \ingroup Group_USB
+ * @defgroup Group_Descriptors USB Descriptors
+ *
+ * Standard USB device descriptor defines and retrieval routines, for USB devices. This module contains
+ * structures and macros for the easy creation of standard USB descriptors in USB device projects.
+ *
+ * @{
+ */
+
+#ifndef __USBDESCRIPTORS_H__
+#define __USBDESCRIPTORS_H__
+
+ /* Includes: */
+ #include <avr/pgmspace.h>
+ #include <stdbool.h>
+ #include <stdint.h>
+ #include <stddef.h>
+
+ #include "../../../Common/Common.h"
+ #include "USBMode.h"
+ #include "Events.h"
+
+ #if defined(USB_CAN_BE_DEVICE)
+ #include "../LowLevel/Device.h"
+ #endif
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** Indicates that a given descriptor does not exist in the device. This can be used inside descriptors
+ * for string descriptor indexes, or may be use as a return value for GetDescriptor when the specified
+ * descriptor does not exist.
+ */
+ #define NO_DESCRIPTOR 0
+
+ #if (!defined(NO_INTERNAL_SERIAL) && \
+ (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__) || \
+ defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__) || \
+ defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)))
+ /** String descriptor index for the device's unique serial number string descriptor within the device.
+ * This unique serial number is used by the host to associate resources to the device (such as drivers or COM port
+ * number allocations) to a device regardless of the port it is plugged in to on the host. Some USB AVRs contain
+ * a unique serial number internally, and setting the device descriptors serial number string index to this value
+ * will cause it to use the internal serial number.
+ *
+ * On unsupported devices, this will evaluate to NO_DESCRIPTOR and so will force the host to create a pseudo-serial
+ * number for the device.
+ */
+ #define USE_INTERNAL_SERIAL 0xDC
+ #else
+ #define USE_INTERNAL_SERIAL NO_DESCRIPTOR
+ #endif
+
+ /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. */
+ #define USB_CONFIG_POWER_MA(mA) ((mA) >> 1)
+
+ /** Macro to calculate the Unicode length of a string with a given number of Unicode characters.
+ * Should be used in string descriptor's headers for giving the string descriptor's byte length.
+ */
+ #define USB_STRING_LEN(str) (sizeof(USB_Descriptor_Header_t) + ((str) << 1))
+
+ /** Macro to encode a given four digit floating point version number (e.g. 01.23) into Binary Coded
+ * Decimal format for descriptor fields requiring BCD encoding, such as the USB version number in the
+ * standard device descriptor.
+ */
+ #define VERSION_BCD(x) ((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \
+ ((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x)))
+
+ /** String language ID for the English language. Should be used in \ref USB_Descriptor_String_t descriptors
+ * to indicate that the English language is supported by the device in its string descriptors.
+ */
+ #define LANGUAGE_ID_ENG 0x0409
+
+ /** \name Endpoint Address Direction Masks */
+ //@{
+ /** Can be masked with an endpoint address for a \ref USB_Descriptor_Endpoint_t endpoint descriptor's
+ * EndpointAddress value to indicate to the host that the endpoint is of the IN direction (i.e, from
+ * device to host).
+ */
+ #define ENDPOINT_DESCRIPTOR_DIR_IN 0x80
+
+ /** Can be masked with an endpoint address for a \ref USB_Descriptor_Endpoint_t endpoint descriptor's
+ * EndpointAddress value to indicate to the host that the endpoint is of the OUT direction (i.e, from
+ * host to device).
+ */
+ #define ENDPOINT_DESCRIPTOR_DIR_OUT 0x00
+ //@}
+
+ /** \name USB Configuration Descriptor Attribute Masks */
+ //@{
+ /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
+ * descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power
+ * from the host's VBUS line.
+ */
+ #define USB_CONFIG_ATTR_BUSPOWERED 0x80
+
+ /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
+ * descriptor's ConfigAttributes value to indicate that the specified configuration can draw its power
+ * from the device's own power source.
+ */
+ #define USB_CONFIG_ATTR_SELFPOWERED 0x40
+
+ /** Can be masked with other configuration descriptor attributes for a \ref USB_Descriptor_Configuration_Header_t
+ * descriptor's ConfigAttributes value to indicate that the specified configuration supports the
+ * remote wakeup feature of the USB standard, allowing a suspended USB device to wake up the host upon
+ * request.
+ */
+ #define USB_CONFIG_ATTR_REMOTEWAKEUP 0x20
+ //@}
+
+ /** \name Endpoint Descriptor Attribute Masks */
+ //@{
+ /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
+ * Attributes value to indicate that the specified endpoint is not synchronized.
+ *
+ * \see The USB specification for more details on the possible Endpoint attributes.
+ */
+ #define ENDPOINT_ATTR_NO_SYNC (0 << 2)
+
+ /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
+ * Attributes value to indicate that the specified endpoint is asynchronous.
+ *
+ * \see The USB specification for more details on the possible Endpoint attributes.
+ */
+ #define ENDPOINT_ATTR_ASYNC (1 << 2)
+
+ /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
+ * Attributes value to indicate that the specified endpoint is adaptive.
+ *
+ * \see The USB specification for more details on the possible Endpoint attributes.
+ */
+ #define ENDPOINT_ATTR_ADAPTIVE (2 << 2)
+
+ /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
+ * Attributes value to indicate that the specified endpoint is synchronized.
+ *
+ * \see The USB specification for more details on the possible Endpoint attributes.
+ */
+ #define ENDPOINT_ATTR_SYNC (3 << 2)
+ //@}
+
+ /** \name Endpoint Descriptor Usage Masks */
+ //@{
+ /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
+ * Attributes value to indicate that the specified endpoint is used for data transfers.
+ *
+ * \see The USB specification for more details on the possible Endpoint usage attributes.
+ */
+ #define ENDPOINT_USAGE_DATA (0 << 4)
+
+ /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
+ * Attributes value to indicate that the specified endpoint is used for feedback.
+ *
+ * \see The USB specification for more details on the possible Endpoint usage attributes.
+ */
+ #define ENDPOINT_USAGE_FEEDBACK (1 << 4)
+
+ /** Can be masked with other endpoint descriptor attributes for a \ref USB_Descriptor_Endpoint_t descriptor's
+ * Attributes value to indicate that the specified endpoint is used for implicit feedback.
+ *
+ * \see The USB specification for more details on the possible Endpoint usage attributes.
+ */
+ #define ENDPOINT_USAGE_IMPLICIT_FEEDBACK (2 << 4)
+ //@}
+
+ /* Enums: */
+ /** Enum for the possible standard descriptor types, as given in each descriptor's header. */
+ enum USB_DescriptorTypes_t
+ {
+ DTYPE_Device = 0x01, /**< Indicates that the descriptor is a device descriptor. */
+ DTYPE_Configuration = 0x02, /**< Indicates that the descriptor is a configuration descriptor. */
+ DTYPE_String = 0x03, /**< Indicates that the descriptor is a string descriptor. */
+ DTYPE_Interface = 0x04, /**< Indicates that the descriptor is an interface descriptor. */
+ DTYPE_Endpoint = 0x05, /**< Indicates that the descriptor is an endpoint descriptor. */
+ DTYPE_DeviceQualifier = 0x06, /**< Indicates that the descriptor is a device qualifier descriptor. */
+ DTYPE_Other = 0x07, /**< Indicates that the descriptor is of other type. */
+ DTYPE_InterfacePower = 0x08, /**< Indicates that the descriptor is an interface power descriptor. */
+ DTYPE_InterfaceAssociation = 0x0B, /**< Indicates that the descriptor is an interface association descriptor. */
+ DTYPE_CSInterface = 0x24, /**< Indicates that the descriptor is a class specific interface descriptor. */
+ DTYPE_CSEndpoint = 0x25, /**< Indicates that the descriptor is a class specific endpoint descriptor. */
+ };
+
+ /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors. */
+ enum USB_Descriptor_ClassSubclassProtocol_t
+ {
+ USB_CSCP_NoDeviceClass = 0x00, /**< Descriptor Class value indicating that the device does not belong
+ * to a particular class at the device level.
+ */
+ USB_CSCP_NoDeviceSubclass = 0x00, /**< Descriptor Subclass value indicating that the device does not belong
+ * to a particular subclass at the device level.
+ */
+ USB_CSCP_NoDeviceProtocol = 0x00, /**< Descriptor Protocol value indicating that the device does not belong
+ * to a particular protocol at the device level.
+ */
+ USB_CSCP_VendorSpecificClass = 0xFF, /**< Descriptor Class value indicating that the device/interface belongs
+ * to a vendor specific class.
+ */
+ USB_CSCP_VendorSpecificSubclass = 0xFF, /**< Descriptor Subclass value indicating that the device/interface belongs
+ * to a vendor specific subclass.
+ */
+ USB_CSCP_VendorSpecificProtocol = 0xFF, /**< Descriptor Protocol value indicating that the device/interface belongs
+ * to a vendor specific protocol.
+ */
+ USB_CSCP_IADDeviceClass = 0xEF, /**< Descriptor Class value indicating that the device belongs to the
+ * Interface Association Descriptor class.
+ */
+ USB_CSCP_IADDeviceSubclass = 0x02, /**< Descriptor Subclass value indicating that the device belongs to the
+ * Interface Association Descriptor subclass.
+ */
+ USB_CSCP_IADDeviceProtocol = 0x01, /**< Descriptor Protocol value indicating that the device belongs to the
+ * Interface Association Descriptor protocol.
+ */
+ };
+
+ /* Type Defines: */
+ /** \brief Standard USB Descriptor Header (LUFA naming conventions).
+ *
+ * Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure
+ * uses LUFA-specific element names to make each element's purpose clearer.
+ *
+ * \see \ref USB_StdDescriptor_Header_t for the version of this type with standard element names.
+ */
+ typedef struct
+ {
+ uint8_t Size; /**< Size of the descriptor, in bytes. */
+ uint8_t Type; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
+ * given by the specific class.
+ */
+ } USB_Descriptor_Header_t;
+
+ /** \brief Standard USB Descriptor Header (USB-IF naming conventions).
+ *
+ * Type define for all descriptors' standard header, indicating the descriptor's length and type. This structure
+ * uses the relevant standard's given element names to ensure compatibility with the standard.
+ *
+ * \see \ref USB_Descriptor_Header_t for the version of this type with non-standard LUFA specific element names.
+ */
+ typedef struct
+ {
+ uint8_t bLength; /**< Size of the descriptor, in bytes. */
+ uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
+ * given by the specific class.
+ */
+ } USB_StdDescriptor_Header_t;
+
+ /** \brief Standard USB Device Descriptor (LUFA naming conventions).
+ *
+ * Type define for a standard Device Descriptor. This structure uses LUFA-specific element names to make each
+ * element's purpose clearer.
+ *
+ * \see \ref USB_StdDescriptor_Device_t for the version of this type with standard element names.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
+
+ uint16_t USBSpecification; /**< BCD of the supported USB specification. */
+ uint8_t Class; /**< USB device class. */
+ uint8_t SubClass; /**< USB device subclass. */
+ uint8_t Protocol; /**< USB device protocol. */
+
+ uint8_t Endpoint0Size; /**< Size of the control (address 0) endpoint's bank in bytes. */
+
+ uint16_t VendorID; /**< Vendor ID for the USB product. */
+ uint16_t ProductID; /**< Unique product ID for the USB product. */
+ uint16_t ReleaseNumber; /**< Product release (version) number. */
+
+ uint8_t ManufacturerStrIndex; /**< String index for the manufacturer's name. The
+ * host will request this string via a separate
+ * control request for the string descriptor.
+ *
+ * \note If no string supplied, use \ref NO_DESCRIPTOR.
+ */
+ uint8_t ProductStrIndex; /**< String index for the product name/details.
+ *
+ * \see ManufacturerStrIndex structure entry.
+ */
+ uint8_t SerialNumStrIndex; /**< String index for the product's globally unique hexadecimal
+ * serial number, in uppercase Unicode ASCII.
+ *
+ * \note On some AVR models, there is an embedded serial number
+ * in the chip which can be used for the device serial number.
+ * To use this serial number, set this to USE_INTERNAL_SERIAL.
+ * On unsupported devices, this will evaluate to 0 and will cause
+ * the host to generate a pseudo-unique value for the device upon
+ * insertion.
+ *
+ * \see ManufacturerStrIndex structure entry.
+ */
+ uint8_t NumberOfConfigurations; /**< Total number of configurations supported by
+ * the device.
+ */
+ } USB_Descriptor_Device_t;
+
+ /** \brief Standard USB Device Descriptor (USB-IF naming conventions).
+ *
+ * Type define for a standard Device Descriptor. This structure uses the relevant standard's given element names
+ * to ensure compatibility with the standard.
+ *
+ * \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names.
+ */
+ typedef struct
+ {
+ uint8_t bLength; /**< Size of the descriptor, in bytes. */
+ uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
+ * given by the specific class.
+ */
+ uint16_t bcdUSB; /**< BCD of the supported USB specification. */
+ uint8_t bDeviceClass; /**< USB device class. */
+ uint8_t bDeviceSubClass; /**< USB device subclass. */
+ uint8_t bDeviceProtocol; /**< USB device protocol. */
+ uint8_t bMaxPacketSize0; /**< Size of the control (address 0) endpoint's bank in bytes. */
+ uint16_t idVendor; /**< Vendor ID for the USB product. */
+ uint16_t idProduct; /**< Unique product ID for the USB product. */
+ uint16_t bcdDevice; /**< Product release (version) number. */
+ uint8_t iManufacturer; /**< String index for the manufacturer's name. The
+ * host will request this string via a separate
+ * control request for the string descriptor.
+ *
+ * \note If no string supplied, use \ref NO_DESCRIPTOR.
+ */
+ uint8_t iProduct; /**< String index for the product name/details.
+ *
+ * \see ManufacturerStrIndex structure entry.
+ */
+ uint8_t iSerialNumber; /**< String index for the product's globally unique hexadecimal
+ * serial number, in uppercase Unicode ASCII.
+ *
+ * \note On some AVR models, there is an embedded serial number
+ * in the chip which can be used for the device serial number.
+ * To use this serial number, set this to USE_INTERNAL_SERIAL.
+ * On unsupported devices, this will evaluate to 0 and will cause
+ * the host to generate a pseudo-unique value for the device upon
+ * insertion.
+ *
+ * \see ManufacturerStrIndex structure entry.
+ */
+ uint8_t bNumConfigurations; /**< Total number of configurations supported by
+ * the device.
+ */
+ } USB_StdDescriptor_Device_t;
+
+ /** \brief Standard USB Configuration Descriptor (LUFA naming conventions).
+ *
+ * Type define for a standard Configuration Descriptor header. This structure uses LUFA-specific element names
+ * to make each element's purpose clearer.
+ *
+ * \see \ref USB_StdDescriptor_Configuration_Header_t for the version of this type with standard element names.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
+
+ uint16_t TotalConfigurationSize; /**< Size of the configuration descriptor header,
+ * and all sub descriptors inside the configuration.
+ */
+ uint8_t TotalInterfaces; /**< Total number of interfaces in the configuration. */
+
+ uint8_t ConfigurationNumber; /**< Configuration index of the current configuration. */
+ uint8_t ConfigurationStrIndex; /**< Index of a string descriptor describing the configuration. */
+
+ uint8_t ConfigAttributes; /**< Configuration attributes, comprised of a mask of zero or
+ * more USB_CONFIG_ATTR_* masks.
+ */
+
+ uint8_t MaxPowerConsumption; /**< Maximum power consumption of the device while in the
+ * current configuration, calculated by the \ref USB_CONFIG_POWER_MA()
+ * macro.
+ */
+ } USB_Descriptor_Configuration_Header_t;
+
+ /** \brief Standard USB Configuration Descriptor (USB-IF naming conventions).
+ *
+ * Type define for a standard Configuration Descriptor header. This structure uses the relevant standard's given element names
+ * to ensure compatibility with the standard.
+ *
+ * \see \ref USB_Descriptor_Device_t for the version of this type with non-standard LUFA specific element names.
+ */
+ typedef struct
+ {
+ uint8_t bLength; /**< Size of the descriptor, in bytes. */
+ uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
+ * given by the specific class.
+ */
+ uint16_t wTotalLength; /**< Size of the configuration descriptor header,
+ * and all sub descriptors inside the configuration.
+ */
+ uint8_t bNumInterfaces; /**< Total number of interfaces in the configuration. */
+ uint8_t bConfigurationValue; /**< Configuration index of the current configuration. */
+ uint8_t iConfiguration; /**< Index of a string descriptor describing the configuration. */
+ uint8_t bmAttributes; /**< Configuration attributes, comprised of a mask of zero or
+ * more USB_CONFIG_ATTR_* masks.
+ */
+ uint8_t bMaxPower; /**< Maximum power consumption of the device while in the
+ * current configuration, calculated by the \ref USB_CONFIG_POWER_MA()
+ * macro.
+ */
+ } USB_StdDescriptor_Configuration_Header_t;
+
+ /** \brief Standard USB Interface Descriptor (LUFA naming conventions).
+ *
+ * Type define for a standard Interface Descriptor. This structure uses LUFA-specific element names
+ * to make each element's purpose clearer.
+ *
+ * \see \ref USB_StdDescriptor_Interface_t for the version of this type with standard element names.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
+
+ uint8_t InterfaceNumber; /**< Index of the interface in the current configuration. */
+ uint8_t AlternateSetting; /**< Alternate setting for the interface number. The same
+ * interface number can have multiple alternate settings
+ * with different endpoint configurations, which can be
+ * selected by the host.
+ */
+ uint8_t TotalEndpoints; /**< Total number of endpoints in the interface. */
+
+ uint8_t Class; /**< Interface class ID. */
+ uint8_t SubClass; /**< Interface subclass ID. */
+ uint8_t Protocol; /**< Interface protocol ID. */
+
+ uint8_t InterfaceStrIndex; /**< Index of the string descriptor describing the interface. */
+ } USB_Descriptor_Interface_t;
+
+ /** \brief Standard USB Interface Descriptor (USB-IF naming conventions).
+ *
+ * Type define for a standard Interface Descriptor. This structure uses the relevant standard's given element names
+ * to ensure compatibility with the standard.
+ *
+ * \see \ref USB_Descriptor_Interface_t for the version of this type with non-standard LUFA specific element names.
+ */
+ typedef struct
+ {
+ uint8_t bLength; /**< Size of the descriptor, in bytes. */
+ uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
+ * given by the specific class.
+ */
+ uint8_t bInterfaceNumber; /**< Index of the interface in the current configuration. */
+ uint8_t bAlternateSetting; /**< Alternate setting for the interface number. The same
+ * interface number can have multiple alternate settings
+ * with different endpoint configurations, which can be
+ * selected by the host.
+ */
+ uint8_t bNumEndpoints; /**< Total number of endpoints in the interface. */
+ uint8_t bInterfaceClass; /**< Interface class ID. */
+ uint8_t bInterfaceSubClass; /**< Interface subclass ID. */
+ uint8_t bInterfaceProtocol; /**< Interface protocol ID. */
+ uint8_t iInterface; /**< Index of the string descriptor describing the
+ * interface.
+ */
+ } USB_StdDescriptor_Interface_t;
+
+ /** \brief Standard USB Interface Association Descriptor (LUFA naming conventions).
+ *
+ * Type define for a standard Interface Association Descriptor. This structure uses LUFA-specific element names
+ * to make each element's purpose clearer.
+ *
+ * This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at
+ * <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows composite
+ * devices with multiple interfaces related to the same function to have the multiple interfaces bound
+ * together at the point of enumeration, loading one generic driver for all the interfaces in the single
+ * function. Read the ECN for more information.
+ *
+ * \see \ref USB_StdDescriptor_Interface_Association_t for the version of this type with standard element names.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
+
+ uint8_t FirstInterfaceIndex; /**< Index of the first associated interface. */
+ uint8_t TotalInterfaces; /**< Total number of associated interfaces. */
+
+ uint8_t Class; /**< Interface class ID. */
+ uint8_t SubClass; /**< Interface subclass ID. */
+ uint8_t Protocol; /**< Interface protocol ID. */
+
+ uint8_t IADStrIndex; /**< Index of the string descriptor describing the
+ * interface association.
+ */
+ } USB_Descriptor_Interface_Association_t;
+
+ /** \brief Standard USB Interface Association Descriptor (USB-IF naming conventions).
+ *
+ * Type define for a standard Interface Association Descriptor. This structure uses the relevant standard's given
+ * element names to ensure compatibility with the standard.
+ *
+ * This descriptor has been added as a supplement to the USB2.0 standard, in the ECN located at
+ * <a>http://www.usb.org/developers/docs/InterfaceAssociationDescriptor_ecn.pdf</a>. It allows composite
+ * devices with multiple interfaces related to the same function to have the multiple interfaces bound
+ * together at the point of enumeration, loading one generic driver for all the interfaces in the single
+ * function. Read the ECN for more information.
+ *
+ * \see \ref USB_Descriptor_Interface_Association_t for the version of this type with non-standard LUFA specific
+ * element names.
+ */
+ typedef struct
+ {
+ uint8_t bLength; /**< Size of the descriptor, in bytes. */
+ uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a value
+ * given by the specific class.
+ */
+ uint8_t bFirstInterface; /**< Index of the first associated interface. */
+ uint8_t bInterfaceCount; /**< Total number of associated interfaces. */
+ uint8_t bFunctionClass; /**< Interface class ID. */
+ uint8_t bFunctionSubClass; /**< Interface subclass ID. */
+ uint8_t bFunctionProtocol; /**< Interface protocol ID. */
+ uint8_t iFunction; /**< Index of the string descriptor describing the
+ * interface association.
+ */
+ } USB_StdDescriptor_Interface_Association_t;
+
+ /** \brief Standard USB Endpoint Descriptor (LUFA naming conventions).
+ *
+ * Type define for a standard Endpoint Descriptor. This structure uses LUFA-specific element names
+ * to make each element's purpose clearer.
+ *
+ * \see \ref USB_StdDescriptor_Endpoint_t for the version of this type with standard element names.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
+
+ uint8_t EndpointAddress; /**< Logical address of the endpoint within the device for the current
+ * configuration, including direction mask.
+ */
+ uint8_t Attributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
+ * and attributes (ENDPOINT_ATTR_*) masks.
+ */
+ uint16_t EndpointSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet
+ * size that the endpoint can receive at a time.
+ */
+ uint8_t PollingIntervalMS; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT
+ * or ISOCHRONOUS type.
+ */
+ } USB_Descriptor_Endpoint_t;
+
+ /** \brief Standard USB Endpoint Descriptor (USB-IF naming conventions).
+ *
+ * Type define for a standard Endpoint Descriptor. This structure uses the relevant standard's given
+ * element names to ensure compatibility with the standard.
+ *
+ * \see \ref USB_Descriptor_Endpoint_t for the version of this type with non-standard LUFA specific
+ * element names.
+ */
+ typedef struct
+ {
+ uint8_t bLength; /**< Size of the descriptor, in bytes. */
+ uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t or a
+ * value given by the specific class.
+ */
+ uint8_t bEndpointAddress; /**< Logical address of the endpoint within the device for the current
+ * configuration, including direction mask.
+ */
+ uint8_t bmAttributes; /**< Endpoint attributes, comprised of a mask of the endpoint type (EP_TYPE_*)
+ * and attributes (ENDPOINT_ATTR_*) masks.
+ */
+ uint16_t wMaxPacketSize; /**< Size of the endpoint bank, in bytes. This indicates the maximum packet size
+ * that the endpoint can receive at a time.
+ */
+ uint8_t bInterval; /**< Polling interval in milliseconds for the endpoint if it is an INTERRUPT or
+ * ISOCHRONOUS type.
+ */
+ } USB_StdDescriptor_Endpoint_t;
+
+ /** \brief Standard USB String Descriptor (LUFA naming conventions).
+ *
+ * Type define for a standard string descriptor. Unlike other standard descriptors, the length
+ * of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN()
+ * macro rather than by the size of the descriptor structure, as the length is not fixed.
+ *
+ * This structure should also be used for string index 0, which contains the supported language IDs for
+ * the device as an array.
+ *
+ * This structure uses LUFA-specific element names to make each element's purpose clearer.
+ *
+ * \see \ref USB_StdDescriptor_String_t for the version of this type with standard element names.
+ */
+ typedef struct
+ {
+ USB_Descriptor_Header_t Header; /**< Descriptor header, including type and size. */
+
+ wchar_t UnicodeString[]; /**< String data, as unicode characters (alternatively,
+ * string language IDs). If normal ASCII characters are
+ * to be used, they must be added as an array of characters
+ * rather than a normal C string so that they are widened to
+ * Unicode size.
+ *
+ * Under GCC, strings prefixed with the "L" character (before
+ * the opening string quotation mark) are considered to be
+ * Unicode strings, and may be used instead of an explicit
+ * array of ASCII characters.
+ */
+ } USB_Descriptor_String_t;
+
+ /** \brief Standard USB String Descriptor (USB-IF naming conventions).
+ *
+ * Type define for a standard string descriptor. Unlike other standard descriptors, the length
+ * of the descriptor for placement in the descriptor header must be determined by the \ref USB_STRING_LEN()
+ * macro rather than by the size of the descriptor structure, as the length is not fixed.
+ *
+ * This structure should also be used for string index 0, which contains the supported language IDs for
+ * the device as an array.
+ *
+ * This structure uses the relevant standard's given element names to ensure compatibility with the standard.
+ *
+ * \see \ref USB_Descriptor_String_t for the version of this type with with non-standard LUFA specific
+ * element names.
+ */
+ typedef struct
+ {
+ uint8_t bLength; /**< Size of the descriptor, in bytes. */
+ uint8_t bDescriptorType; /**< Type of the descriptor, either a value in \ref USB_DescriptorTypes_t
+ * or a value given by the specific class.
+ */
+ int16_t bString[]; /**< String data, as unicode characters (alternatively, string language IDs).
+ * If normal ASCII characters are to be used, they must be added as an array
+ * of characters rather than a normal C string so that they are widened to
+ * Unicode size.
+ *
+ * Under GCC, strings prefixed with the "L" character (before the opening string
+ * quotation mark) are considered to be Unicode strings, and may be used instead
+ * of an explicit array of ASCII characters.
+ */
+ } USB_StdDescriptor_String_t;
+
+ /* Private Interface - For use in library only: */
+ #if !defined(__DOXYGEN__)
+ /* Macros: */
+ #define VERSION_TENS(x) (int)((x) / 10)
+ #define VERSION_ONES(x) (int)((x) - (10 * VERSION_TENS(x)))
+ #define VERSION_TENTHS(x) (int)(((x) - (int)(x)) * 10)
+ #define VERSION_HUNDREDTHS(x) (int)((((x) - (int)(x)) * 100) - (10 * VERSION_TENTHS(x)))
+ #endif
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
+
+/** @} */
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/StdRequestType.h b/firmware/LUFA/Drivers/USB/HighLevel/StdRequestType.h new file mode 100644 index 0000000..7c18ead --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/StdRequestType.h @@ -0,0 +1,247 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB control endpoint request definitions.
+ *
+ * This file contains structures and macros for the easy creation and parsing of standard USB control requests.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+/** \ingroup Group_USB
+ * @defgroup Group_StdRequest Standard USB Requests
+ *
+ * This module contains definitions for the various control request parameters, so that the request
+ * details (such as data direction, request recipient, etc.) can be extracted via masking.
+ *
+ * @{
+ */
+
+#ifndef __STDREQTYPE_H__
+#define __STDREQTYPE_H__
+
+ /* Includes: */
+ #include <stdint.h>
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** Mask for the request type parameter, to indicate the direction of the request data (Host to Device
+ * or Device to Host). The result of this mask should then be compared to the request direction masks.
+ *
+ * \see REQDIR_* macros for masks indicating the request data direction.
+ */
+ #define CONTROL_REQTYPE_DIRECTION 0x80
+
+ /** Mask for the request type parameter, to indicate the type of request (Device, Class or Vendor
+ * Specific). The result of this mask should then be compared to the request type masks.
+ *
+ * \see REQTYPE_* macros for masks indicating the request type.
+ */
+ #define CONTROL_REQTYPE_TYPE 0x60
+
+ /** Mask for the request type parameter, to indicate the recipient of the request (Standard, Class
+ * or Vendor Specific). The result of this mask should then be compared to the request recipient
+ * masks.
+ *
+ * \see REQREC_* macros for masks indicating the request recipient.
+ */
+ #define CONTROL_REQTYPE_RECIPIENT 0x1F
+
+ /** \name Control Request Data Direction Masks */
+ //@{
+ /** Request data direction mask, indicating that the request data will flow from host to device.
+ *
+ * \see \ref CONTROL_REQTYPE_DIRECTION macro.
+ */
+ #define REQDIR_HOSTTODEVICE (0 << 7)
+
+ /** Request data direction mask, indicating that the request data will flow from device to host.
+ *
+ * \see \ref CONTROL_REQTYPE_DIRECTION macro.
+ */
+ #define REQDIR_DEVICETOHOST (1 << 7)
+ //@}
+
+ /** \name Control Request Type Masks */
+ //@{
+ /** Request type mask, indicating that the request is a standard request.
+ *
+ * \see \ref CONTROL_REQTYPE_TYPE macro.
+ */
+ #define REQTYPE_STANDARD (0 << 5)
+
+ /** Request type mask, indicating that the request is a class-specific request.
+ *
+ * \see \ref CONTROL_REQTYPE_TYPE macro.
+ */
+ #define REQTYPE_CLASS (1 << 5)
+
+ /** Request type mask, indicating that the request is a vendor specific request.
+ *
+ * \see \ref CONTROL_REQTYPE_TYPE macro.
+ */
+ #define REQTYPE_VENDOR (2 << 5)
+ //@}
+
+ /** \name Control Request Recipient Masks */
+ //@{
+ /** Request recipient mask, indicating that the request is to be issued to the device as a whole.
+ *
+ * \see \ref CONTROL_REQTYPE_RECIPIENT macro.
+ */
+ #define REQREC_DEVICE (0 << 0)
+
+ /** Request recipient mask, indicating that the request is to be issued to an interface in the
+ * currently selected configuration.
+ *
+ * \see \ref CONTROL_REQTYPE_RECIPIENT macro.
+ */
+ #define REQREC_INTERFACE (1 << 0)
+
+ /** Request recipient mask, indicating that the request is to be issued to an endpoint in the
+ * currently selected configuration.
+ *
+ * \see \ref CONTROL_REQTYPE_RECIPIENT macro.
+ */
+ #define REQREC_ENDPOINT (2 << 0)
+
+ /** Request recipient mask, indicating that the request is to be issued to an unspecified element
+ * in the currently selected configuration.
+ *
+ * \see \ref CONTROL_REQTYPE_RECIPIENT macro.
+ */
+ #define REQREC_OTHER (3 << 0)
+ //@}
+
+ /* Type Defines: */
+ /** \brief Standard USB Control Request
+ *
+ * Type define for a standard USB control request.
+ *
+ * \see The USB 2.0 specification for more information on standard control requests.
+ */
+ typedef struct
+ {
+ uint8_t bmRequestType; /**< Type of the request. */
+ uint8_t bRequest; /**< Request command code. */
+ uint16_t wValue; /**< wValue parameter of the request. */
+ uint16_t wIndex; /**< wIndex parameter of the request. */
+ uint16_t wLength; /**< Length of the data to transfer in bytes. */
+ } USB_Request_Header_t;
+
+ /* Enums: */
+ /** Enumeration for the various standard request commands. These commands are applicable when the
+ * request type is \ref REQTYPE_STANDARD (with the exception of \ref REQ_GetDescriptor, which is always
+ * handled regardless of the request type value).
+ *
+ * \see Chapter 9 of the USB 2.0 Specification.
+ */
+ enum USB_Control_Request_t
+ {
+ REQ_GetStatus = 0, /**< Implemented in the library for device, endpoint and interface
+ * recipients. Passed to the user application for other recipients
+ * via the \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_ClearFeature = 1, /**< Implemented in the library for device, endpoint and interface
+ * recipients. Passed to the user application for other recipients
+ * via the \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_SetFeature = 3, /**< Implemented in the library for device, endpoint and interface
+ * recipients. Passed to the user application for other recipients
+ * via the \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_SetAddress = 5, /**< Implemented in the library for the device recipient. Passed
+ * to the user application for other recipients via the
+ * \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_GetDescriptor = 6, /**< Implemented in the library for device and interface recipients. Passed to the
+ * user application for other recipients via the
+ * \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_SetDescriptor = 7, /**< Not implemented in the library, passed to the user application
+ * via the \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_GetConfiguration = 8, /**< Implemented in the library for the device recipient. Passed
+ * to the user application for other recipients via the
+ * \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_SetConfiguration = 9, /**< Implemented in the library for the device recipient. Passed
+ * to the user application for other recipients via the
+ * \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_GetInterface = 10, /**< Not implemented in the library, passed to the user application
+ * via the \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_SetInterface = 11, /**< Not implemented in the library, passed to the user application
+ * via the \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ REQ_SynchFrame = 12, /**< Not implemented in the library, passed to the user application
+ * via the \ref EVENT_USB_Device_ControlRequest() event when received in
+ * device mode. */
+ };
+
+ /** Feature Selector values for Set Feature and Clear Feature standard control requests directed to the device, interface
+ * and endpoint recipients.
+ */
+ enum USB_Feature_Selectors_t
+ {
+ FEATURE_SEL_EndpointHalt = 0x00, /**< Feature selector for Clear Feature or Set Feature commands. When
+ * used in a Set Feature or Clear Feature request this indicates that an
+ * endpoint (whose address is given elsewhere in the request should have
+ * its stall condition changed.
+ */
+ FEATURE_SEL_DeviceRemoteWakeup = 0x01, /**< Feature selector for Device level Remote Wakeup enable set or clear.
+ * This feature can be controlled by the host on devices which indicate
+ * remote wakeup support in their descriptors to selectively disable or
+ * enable remote wakeup.
+ */
+ FEATURE_SEL_TestMode = 0x02, /**< Feature selector for Test Mode features, used to test the USB controller
+ * to check for incorrect operation.
+ */
+ };
+
+ /* Private Interface - For use in library only: */
+ #if !defined(__DOXYGEN__)
+ /* Macros: */
+ #define FEATURE_SELFPOWERED_ENABLED (1 << 0)
+ #define FEATURE_REMOTE_WAKEUP_ENABLED (1 << 1)
+ #endif
+
+#endif
+
+/** @} */
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h b/firmware/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h new file mode 100644 index 0000000..6109de5 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/StreamCallbacks.h @@ -0,0 +1,87 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB endpoint/pipe stream callback management.
+ *
+ * This file contains definitions for the creation of optional callback routines which can be passed to the
+ * endpoint and/or pipe stream APIs, to abort the transfer currently in progress when a condition is met.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+/** \ingroup Group_USB
+ * @defgroup Group_StreamCallbacks Endpoint and Pipe Stream Callbacks
+ *
+ * Macros and enums for the stream callback routines. This module contains the code required to easily set up
+ * stream callback functions which can be used to force early abort of a stream read/write process. Each callback
+ * should take no arguments, and return a value from the \ref StreamCallback_Return_ErrorCodes_t enum.
+ *
+ * @{
+ */
+
+#ifndef __STREAMCALLBACK_H__
+#define __STREAMCALLBACK_H__
+
+ /* Includes: */
+ #include <stdint.h>
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Macros: */
+ /** Used with the Endpoint and Pipe stream functions as the callback function parameter, indicating that the stream
+ * call has no callback function to be called between USB packets.
+ */
+ #define NO_STREAM_CALLBACK NULL
+
+ /* Enums: */
+ /** Enum for the possible error return codes of a stream callback function. */
+ enum StreamCallback_Return_ErrorCodes_t
+ {
+ STREAMCALLBACK_Continue = 0, /**< Continue sending or receiving the stream. */
+ STREAMCALLBACK_Abort = 1, /**< Abort the stream send or receiving process. */
+ };
+
+ /* Type Defines: */
+ /** Type define for a Stream Callback function (function taking no arguments and retuning a
+ * uint8_t value). Stream callback functions should have an identical function signature if they
+ * are to be used as the callback parameter of the stream functions.
+ */
+ typedef uint8_t (* const StreamCallbackPtr_t)(void);
+
+#endif
+
+/** @} */
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c b/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c new file mode 100644 index 0000000..893a390 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_R.c @@ -0,0 +1,48 @@ +uint8_t TEMPLATE_FUNC_NAME (void* Buffer,
+ uint16_t Length)
+{
+ uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
+
+ if (!(Length))
+ Endpoint_ClearOUT();
+
+ while (Length)
+ {
+ uint8_t USB_DeviceState_LCL = USB_DeviceState;
+
+ if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
+ return ENDPOINT_RWCSTREAM_DeviceDisconnected;
+ else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
+ return ENDPOINT_RWCSTREAM_BusSuspended;
+ else if (Endpoint_IsSETUPReceived())
+ return ENDPOINT_RWCSTREAM_HostAborted;
+
+ if (Endpoint_IsOUTReceived())
+ {
+ while (Length && Endpoint_BytesInEndpoint())
+ {
+ TEMPLATE_TRANSFER_BYTE(DataStream);
+ Length--;
+ }
+
+ Endpoint_ClearOUT();
+ }
+ }
+
+ while (!(Endpoint_IsINReady()))
+ {
+ uint8_t USB_DeviceState_LCL = USB_DeviceState;
+
+ if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
+ return ENDPOINT_RWCSTREAM_DeviceDisconnected;
+ else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
+ return ENDPOINT_RWCSTREAM_BusSuspended;
+ }
+
+ return ENDPOINT_RWCSTREAM_NoError;
+}
+
+
+#undef TEMPLATE_BUFFER_OFFSET
+#undef TEMPLATE_FUNC_NAME
+#undef TEMPLATE_TRANSFER_BYTE
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c b/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c new file mode 100644 index 0000000..1bc550f --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_Control_W.c @@ -0,0 +1,56 @@ +uint8_t TEMPLATE_FUNC_NAME (const void* Buffer,
+ uint16_t Length)
+{
+ uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
+ bool LastPacketFull = false;
+
+ if (Length > USB_ControlRequest.wLength)
+ Length = USB_ControlRequest.wLength;
+ else if (!(Length))
+ Endpoint_ClearIN();
+
+ while (Length || LastPacketFull)
+ {
+ uint8_t USB_DeviceState_LCL = USB_DeviceState;
+
+ if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
+ return ENDPOINT_RWCSTREAM_DeviceDisconnected;
+ else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
+ return ENDPOINT_RWCSTREAM_BusSuspended;
+ else if (Endpoint_IsSETUPReceived())
+ return ENDPOINT_RWCSTREAM_HostAborted;
+ else if (Endpoint_IsOUTReceived())
+ break;
+
+ if (Endpoint_IsINReady())
+ {
+ uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint();
+
+ while (Length && (BytesInEndpoint < USB_ControlEndpointSize))
+ {
+ TEMPLATE_TRANSFER_BYTE(DataStream);
+ Length--;
+ BytesInEndpoint++;
+ }
+
+ LastPacketFull = (BytesInEndpoint == USB_ControlEndpointSize);
+ Endpoint_ClearIN();
+ }
+ }
+
+ while (!(Endpoint_IsOUTReceived()))
+ {
+ uint8_t USB_DeviceState_LCL = USB_DeviceState;
+
+ if (USB_DeviceState_LCL == DEVICE_STATE_Unattached)
+ return ENDPOINT_RWCSTREAM_DeviceDisconnected;
+ else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended)
+ return ENDPOINT_RWCSTREAM_BusSuspended;
+ }
+
+ return ENDPOINT_RWCSTREAM_NoError;
+}
+
+#undef TEMPLATE_BUFFER_OFFSET
+#undef TEMPLATE_FUNC_NAME
+#undef TEMPLATE_TRANSFER_BYTE
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c b/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c new file mode 100644 index 0000000..a1a1e4b --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Endpoint_RW.c @@ -0,0 +1,79 @@ +uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM)
+{
+ uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
+ uint8_t ErrorCode;
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+
+ #if defined(FAST_STREAM_TRANSFERS)
+ uint8_t BytesRemToAlignment = (Endpoint_BytesInEndpoint() & 0x07);
+
+ if (Length >= 8)
+ {
+ Length -= BytesRemToAlignment;
+
+ switch (BytesRemToAlignment)
+ {
+ default:
+ do
+ {
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ TEMPLATE_CLEAR_ENDPOINT();
+
+ #if !defined(NO_STREAM_CALLBACKS)
+ if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
+ return ENDPOINT_RWSTREAM_CallbackAborted;
+ #endif
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+ }
+
+ Length -= 8;
+
+ TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 7: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 6: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 5: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 4: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 3: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 2: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 1: TEMPLATE_TRANSFER_BYTE(DataStream);
+ } while (Length >= 8);
+ }
+ }
+ #endif
+
+ while (Length)
+ {
+ if (!(Endpoint_IsReadWriteAllowed()))
+ {
+ TEMPLATE_CLEAR_ENDPOINT();
+
+ #if !defined(NO_STREAM_CALLBACKS)
+ if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
+ return ENDPOINT_RWSTREAM_CallbackAborted;
+ #endif
+
+ if ((ErrorCode = Endpoint_WaitUntilReady()))
+ return ErrorCode;
+ }
+ else
+ {
+ TEMPLATE_TRANSFER_BYTE(DataStream);
+ Length--;
+ }
+ }
+
+ return ENDPOINT_RWSTREAM_NoError;
+}
+
+#undef TEMPLATE_FUNC_NAME
+#undef TEMPLATE_BUFFER_TYPE
+#undef TEMPLATE_TRANSFER_BYTE
+#undef TEMPLATE_CLEAR_ENDPOINT
+#undef TEMPLATE_BUFFER_OFFSET
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c b/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c new file mode 100644 index 0000000..3f8d91f --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/Template/Template_Pipe_RW.c @@ -0,0 +1,83 @@ +uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE Buffer,
+ uint16_t Length
+ __CALLBACK_PARAM)
+{
+ uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length));
+ uint8_t ErrorCode;
+
+ Pipe_SetPipeToken(TEMPLATE_TOKEN);
+
+ if ((ErrorCode = Pipe_WaitUntilReady()))
+ return ErrorCode;
+
+ #if defined(FAST_STREAM_TRANSFERS)
+ uint8_t BytesRemToAlignment = (Pipe_BytesInPipe() & 0x07);
+
+ if (Length >= 8)
+ {
+ Length -= BytesRemToAlignment;
+
+ switch (BytesRemToAlignment)
+ {
+ default:
+ do
+ {
+ if (!(Pipe_IsReadWriteAllowed()))
+ {
+ TEMPLATE_CLEAR_PIPE();
+
+ #if !defined(NO_STREAM_CALLBACKS)
+ if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
+ return PIPE_RWSTREAM_CallbackAborted;
+ #endif
+
+ if ((ErrorCode = Pipe_WaitUntilReady()))
+ return ErrorCode;
+ }
+
+ Length -= 8;
+
+ TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 7: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 6: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 5: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 4: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 3: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 2: TEMPLATE_TRANSFER_BYTE(DataStream);
+ case 1: TEMPLATE_TRANSFER_BYTE(DataStream);
+ } while (Length >= 8);
+ }
+ }
+ #endif
+
+ while (Length)
+ {
+ if (!(Pipe_IsReadWriteAllowed()))
+ {
+ TEMPLATE_CLEAR_PIPE();
+
+ #if !defined(NO_STREAM_CALLBACKS)
+ if ((Callback != NULL) && (Callback() == STREAMCALLBACK_Abort))
+ return PIPE_RWSTREAM_CallbackAborted;
+ #endif
+
+ if ((ErrorCode = Pipe_WaitUntilReady()))
+ return ErrorCode;
+ }
+ else
+ {
+ TEMPLATE_TRANSFER_BYTE(DataStream);
+ Length--;
+ }
+ }
+
+ return PIPE_RWSTREAM_NoError;
+}
+
+#undef TEMPLATE_FUNC_NAME
+#undef TEMPLATE_BUFFER_TYPE
+#undef TEMPLATE_TOKEN
+#undef TEMPLATE_TRANSFER_BYTE
+#undef TEMPLATE_CLEAR_PIPE
+#undef TEMPLATE_BUFFER_OFFSET
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/USBMode.h b/firmware/LUFA/Drivers/USB/HighLevel/USBMode.h new file mode 100644 index 0000000..09d3631 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/USBMode.h @@ -0,0 +1,138 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief USB mode and capability macros.
+ *
+ * This file defines macros indicating the type of USB controller the library is being compiled for, and its
+ * capabilities. These macros may then be referenced in the user application to selectively enable or disable
+ * code sections depending on if they are defined or not.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+/** \ingroup Group_USB
+ * @defgroup Group_USBMode USB Mode Tokens
+ *
+ * After the inclusion of the master USB driver header, one or more of the following
+ * tokens may be defined, to allow the user code to conditionally enable or disable
+ * code based on the USB controller family and allowable USB modes. These tokens may
+ * be tested against to eliminate code relating to a USB mode which is not enabled for
+ * the given compilation.
+ *
+ * @{
+ */
+
+#ifndef __USBMODE_H__
+#define __USBMODE_H__
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ #if defined(__DOXYGEN__)
+ /** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller
+ * (i.e. AT90USBxxx2 or ATMEGAxxU2) when defined.
+ */
+ #define USB_SERIES_2_AVR
+
+ /** Indicates that the target AVR microcontroller belongs to the Series 4 USB controller
+ * (i.e. ATMEGAxxU4) when defined.
+ */
+ #define USB_SERIES_4_AVR
+
+ /** Indicates that the target AVR microcontroller belongs to the Series 6 USB controller
+ * (i.e. AT90USBxxx6) when defined.
+ */
+ #define USB_SERIES_6_AVR
+
+ /** Indicates that the target AVR microcontroller belongs to the Series 7 USB controller
+ * (i.e. AT90USBxxx7) when defined.
+ */
+ #define USB_SERIES_7_AVR
+
+ /** Indicates that the target AVR microcontroller and compilation settings allow for the
+ * target to be configured in USB Device mode when defined.
+ */
+ #define USB_CAN_BE_DEVICE
+
+ /** Indicates that the target AVR microcontroller and compilation settings allow for the
+ * target to be configured in USB Host mode when defined.
+ */
+ #define USB_CAN_BE_HOST
+
+ /** Indicates that the target AVR microcontroller and compilation settings allow for the
+ * target to be configured in either USB Device or Host mode when defined.
+ */
+ #define USB_CAN_BE_BOTH
+ #else
+ /* Macros: */
+ #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
+ defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__))
+ #define USB_SERIES_2_AVR
+ #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__))
+ #define USB_SERIES_4_AVR
+ #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
+ #define USB_SERIES_6_AVR
+ #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
+ #define USB_SERIES_7_AVR
+ #endif
+
+ #if !defined(USB_SERIES_7_AVR)
+ #if defined(USB_HOST_ONLY)
+ #error USB_HOST_ONLY is not available for the currently selected USB AVR model.
+ #endif
+
+ #if !defined(USB_DEVICE_ONLY)
+ #define USB_DEVICE_ONLY
+ #endif
+ #endif
+
+ #if (!defined(USB_DEVICE_ONLY) && !defined(USB_HOST_ONLY))
+ #define USB_CAN_BE_BOTH
+ #define USB_CAN_BE_HOST
+ #define USB_CAN_BE_DEVICE
+ #elif defined(USB_HOST_ONLY)
+ #define USB_CAN_BE_HOST
+ #elif defined(USB_DEVICE_ONLY)
+ #define USB_CAN_BE_DEVICE
+ #endif
+
+ #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
+ #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
+ #endif
+ #endif
+
+#endif
+
+/** @} */
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/USBTask.c b/firmware/LUFA/Drivers/USB/HighLevel/USBTask.c new file mode 100644 index 0000000..6967283 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/USBTask.c @@ -0,0 +1,89 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+#define __INCLUDE_FROM_USBTASK_C
+#define __INCLUDE_FROM_USB_DRIVER
+#include "USBTask.h"
+
+volatile bool USB_IsInitialized;
+USB_Request_Header_t USB_ControlRequest;
+
+#if defined(USB_CAN_BE_HOST) && !defined(HOST_STATE_AS_GPIOR)
+volatile uint8_t USB_HostState;
+#endif
+
+#if defined(USB_CAN_BE_DEVICE) && !defined(DEVICE_STATE_AS_GPIOR)
+volatile uint8_t USB_DeviceState;
+#endif
+
+void USB_USBTask(void)
+{
+ #if defined(USB_HOST_ONLY)
+ USB_HostTask();
+ #elif defined(USB_DEVICE_ONLY)
+ USB_DeviceTask();
+ #else
+ if (USB_CurrentMode == USB_MODE_Device)
+ USB_DeviceTask();
+ else if (USB_CurrentMode == USB_MODE_Host)
+ USB_HostTask();
+ #endif
+}
+
+#if defined(USB_CAN_BE_DEVICE)
+static void USB_DeviceTask(void)
+{
+ if (USB_DeviceState != DEVICE_STATE_Unattached)
+ {
+ uint8_t PrevEndpoint = Endpoint_GetCurrentEndpoint();
+
+ Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
+
+ if (Endpoint_IsSETUPReceived())
+ USB_Device_ProcessControlRequest();
+
+ Endpoint_SelectEndpoint(PrevEndpoint);
+ }
+}
+#endif
+
+#if defined(USB_CAN_BE_HOST)
+static void USB_HostTask(void)
+{
+ uint8_t PrevPipe = Pipe_GetCurrentPipe();
+
+ Pipe_SelectPipe(PIPE_CONTROLPIPE);
+
+ USB_Host_ProcessNextHostState();
+
+ Pipe_SelectPipe(PrevPipe);
+}
+#endif
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/USBTask.h b/firmware/LUFA/Drivers/USB/HighLevel/USBTask.h new file mode 100644 index 0000000..0af39bf --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/USBTask.h @@ -0,0 +1,206 @@ +/*
+ LUFA Library
+ Copyright (C) Dean Camera, 2010.
+
+ dean [at] fourwalledcubicle [dot] com
+ www.lufa-lib.org
+*/
+
+/*
+ Copyright 2010 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
+ 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
+ software without specific, written prior permission.
+
+ The author disclaim 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
+ whatsoever resulting from loss of use, data or profits, whether
+ in an action of contract, negligence or other tortious action,
+ arising out of or in connection with the use or performance of
+ this software.
+*/
+
+/** \file
+ * \brief Main USB service task management.
+ *
+ * This file contains the function definitions required for the main USB service task, which must be called
+ * from the user application to ensure that the USB connection to or from a connected USB device is maintained.
+ *
+ * \note This file should not be included directly. It is automatically included as needed by the USB driver
+ * dispatch header located in LUFA/Drivers/USB/USB.h.
+ */
+
+#ifndef __USBTASK_H__
+#define __USBTASK_H__
+
+ /* Includes: */
+ #include <avr/interrupt.h>
+ #include <stdint.h>
+ #include <stdbool.h>
+
+ #include "../LowLevel/USBController.h"
+ #include "Events.h"
+ #include "StdRequestType.h"
+ #include "StdDescriptors.h"
+ #include "USBMode.h"
+
+ #if defined(USB_CAN_BE_DEVICE)
+ #include "DeviceStandardReq.h"
+ #endif
+
+ #if defined(USB_CAN_BE_HOST)
+ #include "HostStandardReq.h"
+ #endif
+
+ /* Enable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+
+ /* Preprocessor Checks: */
+ #if !defined(__INCLUDE_FROM_USB_DRIVER)
+ #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
+ #endif
+
+ /* Public Interface - May be used in end-application: */
+ /* Global Variables: */
+ /** Indicates if the USB interface is currently initialized but not necessarily connected to a host
+ * or device (i.e. if \ref USB_Init() has been run). If this is false, all other library globals related
+ * to the USB driver are invalid.
+ *
+ * \note This variable should be treated as read-only in the user application, and never manually
+ * changed in value.
+ *
+ * \ingroup Group_USBManagement
+ */
+ extern volatile bool USB_IsInitialized;
+
+ /** Structure containing the last received Control request when in Device mode (for use in user-applications
+ * inside of the \ref EVENT_USB_Device_ControlRequest() event, or for filling up with a control request to
+ * issue when in Host mode before calling \ref USB_Host_SendControlRequest().
+ *
+ * \ingroup Group_USBManagement
+ */
+ extern USB_Request_Header_t USB_ControlRequest;
+
+ #if defined(USB_CAN_BE_HOST) || defined(__DOXYGEN__)
+ #if !defined(HOST_STATE_AS_GPIOR) || defined(__DOXYGEN__)
+ /** Indicates the current host state machine state. When in host mode, this indicates the state
+ * via one of the values of the \ref USB_Host_States_t enum values.
+ *
+ * This value may be altered by the user application to implement the \ref HOST_STATE_Addressed,
+ * \ref HOST_STATE_Configured and \ref HOST_STATE_Suspended states which are not implemented by
+ * the library internally.
+ *
+ * To reduce program size and speed up checks of this global, it can be placed into one of the AVR's
+ * GPIOR hardware registers instead of RAM by defining the HOST_STATE_AS_GPIOR token to a value
+ * between 0 and 2 in the project makefile and passing it to the compiler via the -D switch. When
+ * defined, the corresponding GPIOR register should not be used in the user application except
+ * implicitly via the library APIs.
+ *
+ * \note This global is only present if the user application can be a USB host.
+ *
+ * \see \ref USB_Host_States_t for a list of possible device states.
+ *
+ * \ingroup Group_Host
+ */
+ extern volatile uint8_t USB_HostState;
+ #else
+ #define _GET_HOST_GPIOR_NAME2(y) GPIOR ## y
+ #define _GET_HOST_GPIOR_NAME(x) _GET_HOST_GPIOR_NAME2(x)
+ #define USB_HostState _GET_HOST_GPIOR_NAME(HOST_STATE_AS_GPIOR)
+ #endif
+ #endif
+
+ #if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__)
+ #if !defined(DEVICE_STATE_AS_GPIOR) || defined(__DOXYGEN__)
+ /** Indicates the current device state machine state. When in device mode, this indicates the state
+ * via one of the values of the \ref USB_Device_States_t enum values.
+ *
+ * This value should not be altered by the user application as it is handled automatically by the
+ * library. The only exception to this rule is if the NO_LIMITED_CONTROLLER_CONNECT token is used
+ * (see \ref EVENT_USB_Device_Connect() and \ref EVENT_USB_Device_Disconnect() events).
+ *
+ * To reduce program size and speed up checks of this global, it can be placed into one of the AVR's
+ * GPIOR hardware registers instead of RAM by defining the DEVICE_STATE_AS_GPIOR token to a value
+ * between 0 and 2 in the project makefile and passing it to the compiler via the -D switch. When
+ * defined, the corresponding GPIOR register should not be used in the user application except
+ * implicitly via the library APIs.
+ *
+ * \note This global is only present if the user application can be a USB device.
+ * \n\n
+ *
+ * \note This variable should be treated as read-only in the user application, and never manually
+ * changed in value except in the circumstances outlined above.
+ *
+ * \see \ref USB_Device_States_t for a list of possible device states.
+ *
+ * \ingroup Group_Device
+ */
+ extern volatile uint8_t USB_DeviceState;
+ #else
+ #define _GET_DEVICE_GPIOR_NAME2(y) GPIOR ## y
+ #define _GET_DEVICE_GPIOR_NAME(x) _GET_DEVICE_GPIOR_NAME2(x)
+ #define USB_DeviceState _GET_DEVICE_GPIOR_NAME(DEVICE_STATE_AS_GPIOR)
+ #endif
+ #endif
+
+ /* Function Prototypes: */
+ /** This is the main USB management task. The USB driver requires this task to be executed
+ * continuously when the USB system is active (device attached in host mode, or attached to a host
+ * in device mode) in order to manage USB communications. This task may be executed inside an RTOS,
+ * fast timer ISR or the main user application loop.
+ *
+ * The USB task must be serviced within 30ms while in device mode, or within 1ms while in host mode.
+ * The task may be serviced at all times, or (for minimum CPU consumption):
+ *
+ * - In device mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Device_Connect()
+ * event and disabled again on the firing of the \ref EVENT_USB_Device_Disconnect() event.
+ *
+ * - In host mode, it may be disabled at start-up, enabled on the firing of the \ref EVENT_USB_Host_DeviceAttached()
+ * event and disabled again on the firing of the \ref EVENT_USB_Host_DeviceEnumerationComplete() or
+ * \ref EVENT_USB_Host_DeviceEnumerationFailed() events.
+ *
+ * If in device mode (only), the control endpoint can instead be managed via interrupts entirely by the library
+ * by defining the INTERRUPT_CONTROL_ENDPOINT token and passing it to the compiler via the -D switch.
+ *
+ * \see \ref Group_Events for more information on the USB events.
+ *
+ * \ingroup Group_USBManagement
+ */
+ void USB_USBTask(void);
+
+ /* Private Interface - For use in library only: */
+ #if !defined(__DOXYGEN__)
+ /* Function Prototypes: */
+ #if defined(__INCLUDE_FROM_USBTASK_C)
+ #if defined(USB_CAN_BE_HOST)
+ static void USB_HostTask(void);
+ #endif
+
+ #if defined(USB_CAN_BE_DEVICE)
+ static void USB_DeviceTask(void);
+ #endif
+ #endif
+
+ /* Macros: */
+ #define HOST_TASK_NONBLOCK_WAIT(Duration, NextState) MACROS{ USB_HostState = HOST_STATE_WaitForDevice; \
+ WaitMSRemaining = (Duration); \
+ PostWaitState = (NextState); }MACROE
+ #endif
+
+ /* Disable C linkage for C++ Compilers: */
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif
+
diff --git a/firmware/LUFA/Drivers/USB/HighLevel/USBTask.lst b/firmware/LUFA/Drivers/USB/HighLevel/USBTask.lst new file mode 100644 index 0000000..4881054 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/USBTask.lst @@ -0,0 +1,88 @@ + 1 .file "USBTask.c" + 2 __SREG__ = 0x3f + 3 __SP_H__ = 0x3e + 4 __SP_L__ = 0x3d + 5 __CCP__ = 0x34 + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 15 .Ltext0: + 16 .section .text.USB_USBTask,"ax",@progbits + 17 .global USB_USBTask + 19 USB_USBTask: + 20 .LFB68: + 21 .LSM0: + 22 0000 1F93 push r17 + 23 /* prologue: function */ + 24 /* frame size = 0 */ + 25 .LBB22: + 26 .LBB23: + 27 .LSM1: + 28 0002 8091 0000 lds r24,USB_DeviceState + 29 0006 8823 tst r24 + 30 0008 01F0 breq .L4 + 31 .LBB24: + 32 .LBB25: + 33 .LBB26: + 34 .LSM2: + 35 000a 1091 E900 lds r17,233 + 36 .LBE26: + 37 .LBE25: + 38 .LBB28: + 39 .LBB29: + 40 .LSM3: + 41 000e 1092 E900 sts 233,__zero_reg__ + 42 .LBE29: + 43 .LBE28: + 44 .LBB30: + 45 .LBB31: + 46 .LSM4: + 47 0012 8091 E800 lds r24,232 + 48 .LBE31: + 49 .LBE30: + 50 .LSM5: + 51 0016 83FF sbrs r24,3 + 52 0018 00C0 rjmp .L3 + 53 .LSM6: + 54 001a 0E94 0000 call USB_Device_ProcessControlRequest + 55 .L3: + 56 .LBB32: + 57 .LBB27: + 58 .LSM7: + 59 001e 1770 andi r17,lo8(7) + 60 .LBE27: + 61 .LBE32: + 62 .LBB33: + 63 .LBB34: + 64 .LSM8: + 65 0020 1093 E900 sts 233,r17 + 66 .L4: + 67 /* epilogue start */ + 68 .LBE34: + 69 .LBE33: + 70 .LBE24: + 71 .LBE23: + 72 .LBE22: + 73 .LSM9: + 74 0024 1F91 pop r17 + 75 0026 0895 ret + 76 .LFE68: + 78 .comm USB_IsInitialized,1,1 + 79 .comm USB_ControlRequest,8,1 + 80 .comm USB_DeviceState,1,1 + 105 .Letext0: +DEFINED SYMBOLS + *ABS*:0000000000000000 USBTask.c + /tmp/ccROWpPW.s:2 *ABS*:000000000000003f __SREG__ + /tmp/ccROWpPW.s:3 *ABS*:000000000000003e __SP_H__ + /tmp/ccROWpPW.s:4 *ABS*:000000000000003d __SP_L__ + /tmp/ccROWpPW.s:5 *ABS*:0000000000000034 __CCP__ + /tmp/ccROWpPW.s:6 *ABS*:0000000000000000 __tmp_reg__ + /tmp/ccROWpPW.s:7 *ABS*:0000000000000001 __zero_reg__ + /tmp/ccROWpPW.s:19 .text.USB_USBTask:0000000000000000 USB_USBTask + *COM*:0000000000000001 USB_DeviceState + *COM*:0000000000000001 USB_IsInitialized + *COM*:0000000000000008 USB_ControlRequest + +UNDEFINED SYMBOLS +USB_Device_ProcessControlRequest +__do_clear_bss diff --git a/firmware/LUFA/Drivers/USB/HighLevel/USBTask.o b/firmware/LUFA/Drivers/USB/HighLevel/USBTask.o Binary files differnew file mode 100644 index 0000000..1db7f83 --- /dev/null +++ b/firmware/LUFA/Drivers/USB/HighLevel/USBTask.o |