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
+ * number allocations) to a device regardless of the port it is plugged in to on the host. Some microcontrollers 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.
*
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
#define ENDPOINT_DETAILS_MAXEP 7
- #define ENDPOINT_DETAILS_EP0 64, 2
+ #define ENDPOINT_DETAILS_EP0 64, 1
#define ENDPOINT_DETAILS_EP1 256, 2
#define ENDPOINT_DETAILS_EP2 64, 2
#define ENDPOINT_DETAILS_EP3 64, 2
#else
#define ENDPOINT_DETAILS_MAXEP 5
- #define ENDPOINT_DETAILS_EP0 64, 2
+ #define ENDPOINT_DETAILS_EP0 64, 1
#define ENDPOINT_DETAILS_EP1 64, 1
#define ENDPOINT_DETAILS_EP2 64, 1
#define ENDPOINT_DETAILS_EP3 64, 2
* ascending order, or bank corruption will occur.
* \n\n
*
- * \note Certain models of USB AVR's endpoints may have different maximum packet sizes based on the endpoint's
- * index - refer to the chosen USB AVR's datasheet to determine the maximum bank size for each endpoint.
+ * \note Different endpoints may have different maximum packet sizes based on the endpoint's index - refer to
+ * the chosen microcontroller model's datasheet to determine the maximum bank size for each endpoint.
* \n\n
*
* \note The default control endpoint should not be manually configured by the user application, as
* or bank corruption will occur.
* \n\n
*
- * \note Certain models of USB AVR's pipes may have different maximum packet sizes based on the pipe's
- * index - refer to the chosen USB AVR's datasheet to determine the maximum bank size for each pipe.
+ * \note Certain microcontroller model's pipes may have different maximum packet sizes based on the pipe's
+ * index - refer to the chosen microcontroller's datasheet to determine the maximum bank size for each pipe.
* \n\n
*
* \note The default control pipe should not be manually configured by the user application, as it is
/* Macros: */\r
/** \name USB Device Mode Option Masks */\r
//@{\r
- #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) || defined(__DOXYGEN__)\r
- /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the\r
- * USB interface should be initialized in low speed (1.5Mb/s) mode.\r
- *\r
- * \note Low Speed mode is not available on all USB AVR models.\r
- * \n\r
- *\r
- * \note Restrictions apply on the number, size and type of endpoints which can be used\r
- * when running in low speed mode - refer to the USB 2.0 specification.\r
- */\r
- #define USB_DEVICE_OPT_LOWSPEED (1 << 0)\r
- #endif\r
+ /** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the\r
+ * USB interface should be initialized in low speed (1.5Mb/s) mode.\r
+ *\r
+ * \note Restrictions apply on the number, size and type of endpoints which can be used\r
+ * when running in low speed mode - refer to the USB 2.0 specification.\r
+ */\r
+ #define USB_DEVICE_OPT_LOWSPEED (1 << 0)\r
\r
/** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the\r
* USB interface should be initialized in full speed (12Mb/s) mode.\r
\r
/** String descriptor index for the device's unique serial number string descriptor within the device.\r
* This unique serial number is used by the host to associate resources to the device (such as drivers or COM port\r
- * number allocations) to a device regardless of the port it is plugged in to on the host. Some USB AVRs contain\r
+ * number allocations) to a device regardless of the port it is plugged in to on the host. Some microcontrollers contain\r
* a unique serial number internally, and setting the device descriptors serial number string index to this value\r
* will cause it to use the internal serial number.\r
*\r
/* Private Interface - For use in library only: */\r
#if !defined(__DOXYGEN__)\r
/* Inline Functions: */\r
- #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))\r
static inline void USB_Device_SetLowSpeed(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Device_SetLowSpeed(void)\r
{\r
{\r
AVR32_USBB.UDCON.ls = false;\r
}\r
- #endif\r
\r
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;\r
static inline void USB_Device_SetDeviceAddress(const uint8_t Address)\r
#define _ENDPOINT_GET_BANKS2(EPDetails) _ENDPOINT_GET_BANKS3(EPDetails)\r
#define _ENDPOINT_GET_BANKS3(MaxSize, Banks) (Banks)\r
\r
- #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)\r
- #define ENDPOINT_DETAILS_MAXEP 7\r
-\r
- #define ENDPOINT_DETAILS_EP0 64, 2\r
- #define ENDPOINT_DETAILS_EP1 256, 2\r
- #define ENDPOINT_DETAILS_EP2 64, 2\r
- #define ENDPOINT_DETAILS_EP3 64, 2\r
- #define ENDPOINT_DETAILS_EP4 64, 2\r
- #define ENDPOINT_DETAILS_EP5 64, 2\r
- #define ENDPOINT_DETAILS_EP6 64, 2\r
- #else\r
- #define ENDPOINT_DETAILS_MAXEP 5\r
+ #define ENDPOINT_DETAILS_MAXEP 7\r
\r
- #define ENDPOINT_DETAILS_EP0 64, 2\r
- #define ENDPOINT_DETAILS_EP1 64, 1\r
- #define ENDPOINT_DETAILS_EP2 64, 1\r
- #define ENDPOINT_DETAILS_EP3 64, 2\r
- #define ENDPOINT_DETAILS_EP4 64, 2\r
- #endif\r
+ #define ENDPOINT_DETAILS_EP0 64, 1\r
+ #define ENDPOINT_DETAILS_EP1 64, 2\r
+ #define ENDPOINT_DETAILS_EP2 64, 2\r
+ #define ENDPOINT_DETAILS_EP3 64, 2\r
+ #define ENDPOINT_DETAILS_EP4 64, 2\r
+ #define ENDPOINT_DETAILS_EP5 256, 2\r
+ #define ENDPOINT_DETAILS_EP6 256, 2\r
\r
/* Inline Functions: */\r
static inline uint32_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST\r
* accesses the second bank.\r
*/\r
#define ENDPOINT_BANK_DOUBLE AVR32_USBB_UECFG0_EPBK_DOUBLE\r
-\r
- /** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates\r
- * that the endpoint should have three banks, which requires more USB FIFO memory but results\r
- * in faster transfers as one USB device (the AVR or the host) can access one bank while the other\r
- * accesses the remaining banks.\r
- */\r
- #define ENDPOINT_BANK_TRIPLE AVR32_USBB_UECFG0_EPBK_TRIPLE\r
//@}\r
\r
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__))\r
\r
#if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__)\r
/** Total number of endpoints (including the default control endpoint at address 0) which may\r
- * be used in the device. Different USB AVR models support different amounts of endpoints,\r
+ * be used in the device. Different AVR models support different amounts of endpoints,\r
* this value reflects the maximum number of endpoints for the currently selected AVR model.\r
*/\r
#define ENDPOINT_TOTAL_ENDPOINTS ENDPOINT_DETAILS_MAXEP\r
* ascending order, or bank corruption will occur.\r
* \n\n\r
*\r
- * \note Certain models of USB AVR's endpoints may have different maximum packet sizes based on the endpoint's\r
- * index - refer to the chosen USB AVR's datasheet to determine the maximum bank size for each endpoint.\r
+ * \note Different endpoints may have different maximum packet sizes based on the endpoint's index - refer to\r
+ * the chosen microcontroller model's datasheet to determine the maximum bank size for each endpoint.\r
* \n\n\r
*\r
* \note The default control endpoint should not be manually configured by the user application, as\r
static inline void USB_Host_VBUS_Manual_Enable(void)\r
{\r
AVR32_USBB.USBCON.vbushwc = true;\r
- \r
- // TODO: Manual VBUS pin output setup\r
}\r
\r
static inline void USB_Host_VBUS_Auto_On(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Manual_On(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Manual_On(void)\r
{\r
- // TODO: Manual VBUS pin output on\r
+ AVR32_USBB.USBSTASET.vbusrqs = true;\r
}\r
\r
static inline void USB_Host_VBUS_Auto_Off(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Manual_Off(void) ATTR_ALWAYS_INLINE;\r
static inline void USB_Host_VBUS_Manual_Off(void)\r
{\r
- // TODO: Manual VBUS pin output off\r
+ AVR32_USBB.USBSTACLR.vbusrqc = true;\r
}\r
\r
static inline void USB_Host_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE;\r
#define PIPE_CONTROLPIPE_DEFAULT_SIZE 64\r
\r
/** Total number of pipes (including the default control pipe at address 0) which may be used in\r
- * the device. Different USB AVR models support different amounts of pipes, this value reflects\r
- * the maximum number of pipes for the currently selected AVR model.\r
+ * the device.\r
*/\r
#define PIPE_TOTAL_PIPES 7\r
\r
/** Size in bytes of the largest pipe bank size possible in the device. Not all banks on each AVR\r
* model supports the largest bank size possible on the device; different pipe numbers support\r
* different maximum bank sizes. This value reflects the largest possible bank of any pipe on the\r
- * currently selected USB AVR model.\r
+ * currently selected UC3B AVR model.\r
*/\r
#define PIPE_MAX_SIZE 256\r
\r
* or bank corruption will occur.\r
* \n\n\r
*\r
- * \note Certain models of USB AVR's pipes may have different maximum packet sizes based on the pipe's\r
- * index - refer to the chosen USB AVR's datasheet to determine the maximum bank size for each pipe.\r
+ * \note Certain microcontroller model's pipes may have different maximum packet sizes based on the pipe's\r
+ * index - refer to the chosen microcontroller's datasheet to determine the maximum bank size for each pipe.\r
* \n\n\r
*\r
* \note The default control pipe should not be manually configured by the user application, as it is\r
USB_Descriptor_Device_t* DeviceDescriptorPtr;\r
\r
if (CALLBACK_USB_GetDescriptor((DTYPE_Device << 8), 0, (void*)&DeviceDescriptorPtr) != NO_DESCRIPTOR)\r
- {\r
- #if defined(USE_RAM_DESCRIPTORS)\r
- USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size;\r
- #elif defined(USE_EEPROM_DESCRIPTORS)\r
- USB_ControlEndpointSize = eeprom_read_byte(&DeviceDescriptorPtr->Endpoint0Size);\r
- #else\r
- USB_ControlEndpointSize = pgm_read_byte(&DeviceDescriptorPtr->Endpoint0Size);\r
- #endif\r
- }\r
+ USB_ControlEndpointSize = DeviceDescriptorPtr->Endpoint0Size;\r
#endif\r
\r
- #if (defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))\r
if (USB_Options & USB_DEVICE_OPT_LOWSPEED)\r
USB_Device_SetLowSpeed();\r
else\r
USB_Device_SetFullSpeed();\r
\r
USB_INT_Enable(USB_INT_VBUS);\r
- #endif\r
\r
Endpoint_ConfigureEndpoint(ENDPOINT_CONTROLEP, EP_TYPE_CONTROL,\r
ENDPOINT_DIR_OUT, USB_ControlEndpointSize,\r
\r
USB_Host_HostMode_On();\r
\r
- USB_Host_VBUS_Auto_Off();\r
- USB_Host_VBUS_Manual_Enable();\r
- USB_Host_VBUS_Manual_On();\r
+ USB_Host_VBUS_Auto_On();\r
\r
USB_INT_Enable(USB_INT_SRPI);\r
USB_INT_Enable(USB_INT_BCERRI);\r
/* Inline Functions: */\r
/** Determines if the VBUS line is currently high (i.e. the USB host is supplying power).\r
*\r
- * \note This function is not available on some AVR models which do not support hardware VBUS monitoring.\r
- *\r
* \return Boolean \c true if the VBUS line is currently detecting power from a host, \c false otherwise.\r
*/\r
static inline bool USB_VBUS_GetStatus(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE;\r
* this function). To statically set the USB options, pass in the \c USE_STATIC_OPTIONS token,\r
* defined to the appropriate options masks. When the options are statically set, this\r
* parameter does not exist in the function prototype.\r
- * \n\n\r
- *\r
- * \note The mode parameter does not exist on devices where only one mode is possible, such as USB\r
- * AVR models which only implement the USB device mode in hardware.\r
*\r
* \see \ref Group_Device for the \c USB_DEVICE_OPT_* masks.\r
*/\r