*/
#define NO_DESCRIPTOR 0
- /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes. */
+ /** Macro to calculate the power value for the configuration descriptor, from a given number of milliamperes.
+ *
+ * \param[in] mA Maximum number of milliamps the device consumes when the given configuration is selected.
+ */
#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.
+ *
+ * \param[in] UnicodeChars Number of Unicode characters in the string text.
*/
- #define USB_STRING_LEN(str) (sizeof(USB_Descriptor_Header_t) + ((str) << 1))
+ #define USB_STRING_LEN(UnicodeChars) (sizeof(USB_Descriptor_Header_t) + ((UnicodeChars) << 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.
+ *
+ * \param[in] x Version number to encode as a 16-bit little-endian number, as a floating point number.
*/
#define VERSION_BCD(x) CPU_TO_LE16((((VERSION_TENS(x) << 4) | VERSION_ONES(x)) << 8) | \
((VERSION_TENTHS(x) << 4) | VERSION_HUNDREDTHS(x)))
bool UIDModeSelectEnabled = AVR32_USBB.USBCON.uide;\r
#endif\r
\r
- AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].pllsel = !(USB_Options & USB_OPT_GCLK_SRC_OSC);\r
- AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].oscsel = !(USB_Options & USB_OPT_GCLK_CHANNEL_0);\r
- AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].diven = (F_CLOCK != 48000000UL);\r
- AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].div = (F_CLOCK == 48000000UL) ? 0 : (uint32_t)(((F_CLOCK / 48000000UL) - 1) / 2);\r
- AVR32_PM.GCCTRL[USB_GCLK_USBB_INDEX].cen = true;\r
+ AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].pllsel = !(USB_Options & USB_OPT_GCLK_SRC_OSC);\r
+ AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].oscsel = !(USB_Options & USB_OPT_GCLK_CHANNEL_0);\r
+ AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].diven = (F_CLOCK != USB_CLOCK_REQUIRED_FREQ);\r
+ AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].div = (F_CLOCK == USB_CLOCK_REQUIRED_FREQ) ? 0 : (uint32_t)(((F_CLOCK / USB_CLOCK_REQUIRED_FREQ) - 1) / 2);\r
+ AVR32_PM.GCCTRL[AVR32_PM_GCLK_USBB].cen = true;\r
\r
USB_INT_DisableAllInterrupts();\r
USB_INT_ClearAllInterrupts();\r
/* Public Interface - May be used in end-application: */
#if defined(__DOXYGEN__)
- /** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller
+ /** Indicates that the target AVR microcontroller belongs to the Series 2 AVR8 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
+ /** Indicates that the target AVR microcontroller belongs to the Series 4 AVR8 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
+ /** Indicates that the target AVR microcontroller belongs to the Series 6 AVR8 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
+ /** Indicates that the target AVR microcontroller belongs to the Series 7 AVR8 USB controller
* (i.e. AT90USBxxx7) when defined.
*/
#define USB_SERIES_7_AVR
- /** Indicates that the target AVR microcontroller belongs to the UC3B Series USB controller
- * (i.e. AT32UC3B*) when defined.
+ /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A0 Series USB controller
+ * (i.e. AT32UC3A0*) when defined.
*/
- #define USB_SERIES_UC3B_AVR
+ #define USB_SERIES_UC3A0_AVR
+
+ /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A1 Series USB controller
+ * (i.e. AT32UC3A1*) when defined.
+ */
+ #define USB_SERIES_UC3A1_AVR
+
+ /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3A3 Series USB controller
+ * (i.e. AT32UC3A3*) when defined.
+ */
+ #define USB_SERIES_UC3A3_AVR
+
+ /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B0 Series USB controller
+ * (i.e. AT32UC3B0*) when defined.
+ */
+ #define USB_SERIES_UC3B0_AVR
+
+ /** Indicates that the target AVR microcontroller belongs to the AVR32 UC3B1 Series USB controller
+ * (i.e. AT32UC3B1*) when defined.
+ */
+ #define USB_SERIES_UC3B1_AVR
/** Indicates that the target microcontroller and compilation settings allow for the
* target to be configured in USB Device mode when defined.
#define USB_SERIES_7_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
- #elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B1512__) || \
- defined(__AVR32_UC3B0256__) || defined(__AVR32_UC3B1256__) || \
- defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B1128__) || \
- defined(__AVR32_UC3B064__) || defined(__AVR32_UC3B164__))
- #define USB_SERIES_UC3B_AVR
+ #elif (defined(__AVR32_UC3A0512__) || defined(__AVR32_UC3A0256__) || \
+ defined(__AVR32_UC3A0128__) || defined(__AVR32_UC3A064__))
+ #define USB_SERIES_UC3A0_AVR
+ #define USB_CAN_BE_DEVICE
+ #define USB_CAN_BE_HOST
+ #elif (defined(__AVR32_UC3A1512__) || defined(__AVR32_UC3A1256__) || \
+ defined(__AVR32_UC3A1128__) || defined(__AVR32_UC3A164__))
+ #define USB_SERIES_UC3A1_AVR
+ #define USB_CAN_BE_DEVICE
+ #define USB_CAN_BE_HOST
+ #elif (defined(__AVR32_UC3A3256__) || defined(__AVR32_UC3A3256S__) || \
+ defined(__AVR32_UC3A3128__) || defined(__AVR32_UC3A3128S__) || \
+ defined(__AVR32_UC3A364__) || defined(__AVR32_UC3A364S__))
+ #define USB_SERIES_UC3A3_AVR
+ #define USB_CAN_BE_DEVICE
+ #define USB_CAN_BE_HOST
+ #elif (defined(__AVR32_UC3B0512__) || defined(__AVR32_UC3B0256__) || \
+ defined(__AVR32_UC3B0128__) || defined(__AVR32_UC3B064__))
+ #define USB_SERIES_UC3B0_AVR
+ #define USB_CAN_BE_DEVICE
+ #define USB_CAN_BE_HOST
+ #elif (defined(__AVR32_UC3B1512__) || defined(__AVR32_UC3B1256__) || \
+ defined(__AVR32_UC3B1128__) || defined(__AVR32_UC3B164__))
+ #define USB_SERIES_UC3B1_AVR
#define USB_CAN_BE_DEVICE
#define USB_CAN_BE_HOST
#endif
#endif
#if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST))
- #error The currently selected architecture is not supported under the USB component of the library.
+ #error The currently selected device or architecture is not supported under the USB component of the library.
#endif
#endif