diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2010-04-13 23:29:11 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2010-04-13 23:29:11 +0000 |
commit | 7b79325aa037db9786f0da069c11315a3f6d9721 (patch) | |
tree | c7cecdb1ed159e7f9c2331cb159e8b39bb6a8316 /LUFA/Drivers/USB | |
parent | 19ecd04f37f68c0674f1194aa8d8a4fc94d6168b (diff) | |
download | lufa-7b79325aa037db9786f0da069c11315a3f6d9721.tar.gz lufa-7b79325aa037db9786f0da069c11315a3f6d9721.tar.bz2 lufa-7b79325aa037db9786f0da069c11315a3f6d9721.zip |
Removed two-step endpoint/pipe bank clear and switch sequence for smaller, faster endpoint/pipe code.
Added spacing between multiple paragraphs in Doxygen \note sections.
Removed call to the clock prescaler reset function in the Teensy bootloader to save space - the user application is accessed via a watchdog reset anyway, so the prescale reset would only affect the speed of the bootloader itself.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r-- | LUFA/Drivers/USB/Class/Device/Audio.h | 1 | ||||
-rw-r--r-- | LUFA/Drivers/USB/Class/Host/HID.h | 4 | ||||
-rw-r--r-- | LUFA/Drivers/USB/HighLevel/Events.h | 11 | ||||
-rw-r--r-- | LUFA/Drivers/USB/HighLevel/USBInterrupt.c | 2 | ||||
-rw-r--r-- | LUFA/Drivers/USB/HighLevel/USBTask.h | 1 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/DevChapter9.h | 1 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Device.h | 1 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Endpoint.h | 21 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/LowLevel.c | 19 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/LowLevel.h | 6 | ||||
-rw-r--r-- | LUFA/Drivers/USB/LowLevel/Pipe.h | 12 |
11 files changed, 59 insertions, 20 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.h b/LUFA/Drivers/USB/Class/Device/Audio.h index 053b69aab..2d33f395a 100644 --- a/LUFA/Drivers/USB/Class/Device/Audio.h +++ b/LUFA/Drivers/USB/Class/Device/Audio.h @@ -219,6 +219,7 @@ * the correct endpoint is selected and ready for data.
*
* \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state
+ *
* \return Signed 24-bit audio sample from the audio interface
*/
static inline int32_t Audio_Device_ReadSample24(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_ALWAYS_INLINE;
diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h index 29c390a1e..9c0400640 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.h +++ b/LUFA/Drivers/USB/Class/Host/HID.h @@ -169,6 +169,7 @@ *
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail.
+ * \n\n
*
* \note The destination buffer should be large enough to accommodate the largest report that the attached device
* can generate.
@@ -186,6 +187,7 @@ *
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail.
+ * \n\n
*
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
*
@@ -204,6 +206,7 @@ *
* \note This function must only be called when the Host state machine is in the HOST_STATE_Configured state or the
* call will fail.
+ * \n\n
*
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, the ReportID parameter is removed
* from the parameter list of this function.
@@ -256,6 +259,7 @@ *
* \note Whether this function is used or not, the \ref CALLBACK_HIDParser_FilterHIDReportItem() callback from the HID
* Report Parser this function references <b>must</b> be implemented in the user code.
+ * \n\n
*
* \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.
*
diff --git a/LUFA/Drivers/USB/HighLevel/Events.h b/LUFA/Drivers/USB/HighLevel/Events.h index 72c2b7fd2..8daa8ea2b 100644 --- a/LUFA/Drivers/USB/HighLevel/Events.h +++ b/LUFA/Drivers/USB/HighLevel/Events.h @@ -102,6 +102,7 @@ * 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).
@@ -114,6 +115,7 @@ * \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).
@@ -126,6 +128,7 @@ * 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).
@@ -139,6 +142,7 @@ * 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).
@@ -158,6 +162,7 @@ * 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).
@@ -186,6 +191,7 @@ * 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.
@@ -203,6 +209,7 @@ * 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.
@@ -226,6 +233,7 @@ *
* \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
@@ -256,6 +264,7 @@ *
* \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.
@@ -272,6 +281,7 @@ *
* \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.
@@ -301,6 +311,7 @@ *
* \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).
diff --git a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c index f8da7e656..925248d13 100644 --- a/LUFA/Drivers/USB/HighLevel/USBInterrupt.c +++ b/LUFA/Drivers/USB/HighLevel/USBInterrupt.c @@ -36,7 +36,7 @@ void USB_INT_DisableAllInterrupts(void) #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USBCON &= ~((1 << VBUSTE) | (1 << IDTE));
#elif defined(USB_SERIES_4_AVR)
- USBCON &= ~(1 << VBUSTE);
+ USBCON &= ~(1 << VBUSTE);
#endif
#if defined(USB_CAN_BE_HOST)
diff --git a/LUFA/Drivers/USB/HighLevel/USBTask.h b/LUFA/Drivers/USB/HighLevel/USBTask.h index 0b5474241..5246bf60e 100644 --- a/LUFA/Drivers/USB/HighLevel/USBTask.h +++ b/LUFA/Drivers/USB/HighLevel/USBTask.h @@ -135,6 +135,7 @@ * 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.
diff --git a/LUFA/Drivers/USB/LowLevel/DevChapter9.h b/LUFA/Drivers/USB/LowLevel/DevChapter9.h index 44913dbb5..d59132739 100644 --- a/LUFA/Drivers/USB/LowLevel/DevChapter9.h +++ b/LUFA/Drivers/USB/LowLevel/DevChapter9.h @@ -103,6 +103,7 @@ *
* \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
diff --git a/LUFA/Drivers/USB/LowLevel/Device.h b/LUFA/Drivers/USB/LowLevel/Device.h index ceb454934..5ef4fc08a 100644 --- a/LUFA/Drivers/USB/LowLevel/Device.h +++ b/LUFA/Drivers/USB/LowLevel/Device.h @@ -73,6 +73,7 @@ * USB interface should be initialized in low speed (1.5Mb/s) mode.
*
* \note Low Speed mode is not available on all USB AVR models.
+ * \n\n
*
* \note Restrictions apply on the number, size and type of endpoints which can be used
* when running in low speed mode -- refer to the USB 2.0 standard.
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h index 389d3c458..b18ff456d 100644 --- a/LUFA/Drivers/USB/LowLevel/Endpoint.h +++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h @@ -405,15 +405,13 @@ #define Endpoint_ClearSETUP() MACROS{ UEINTX &= ~(1 << RXSTPI); }MACROE
#if !defined(CONTROL_ONLY_DEVICE)
- #define Endpoint_ClearIN() MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << TXINI)); \
- UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE
+ #define Endpoint_ClearIN() MACROS{ UEINTX &= ~((1 << TXINI) | (1 << FIFOCON)); }MACROE
#else
#define Endpoint_ClearIN() MACROS{ UEINTX &= ~(1 << TXINI); }MACROE
#endif
#if !defined(CONTROL_ONLY_DEVICE)
- #define Endpoint_ClearOUT() MACROS{ uint8_t Temp = UEINTX; UEINTX = (Temp & ~(1 << RXOUTI)); \
- UEINTX = (Temp & ~(1 << FIFOCON)); }MACROE
+ #define Endpoint_ClearOUT() MACROS{ UEINTX &= ~((1 << RXOUTI) | (1 << FIFOCON)); }MACROE
#else
#define Endpoint_ClearOUT() MACROS{ UEINTX &= ~(1 << RXOUTI); }MACROE
#endif
@@ -747,7 +745,8 @@ * The banking mode may be either \ref ENDPOINT_BANK_SINGLE or \ref ENDPOINT_BANK_DOUBLE.
*
* \note The default control endpoint does not have to be manually configured, as it is automatically
- * configured by the library internally.
+ * configured by the library internally.
+ * \n\n
*
* \note This routine will select the specified endpoint, and the endpoint will remain selected
* once the routine completes regardless of if the endpoint configuration succeeds.
@@ -971,6 +970,7 @@ *
* \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.
*
@@ -990,6 +990,7 @@ *
* \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.
*
@@ -1009,8 +1010,10 @@ *
* \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 The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
+ * \n\n
*
* \note This routine should only be used on CONTROL type endpoints.
*
@@ -1033,6 +1036,7 @@ *
* \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.
*
@@ -1052,6 +1056,7 @@ *
* \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.
*
@@ -1071,8 +1076,10 @@ *
* \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 The FLASH data must be located in the first 64KB of FLASH for this function to work correctly.
+ * \n\n
*
* \note This routine should only be used on CONTROL type endpoints.
*
@@ -1095,6 +1102,7 @@ *
* \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.
*
@@ -1114,6 +1122,7 @@ *
* \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.
*
@@ -1136,6 +1145,7 @@ *
* \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.
*
@@ -1155,6 +1165,7 @@ *
* \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.
*
diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.c b/LUFA/Drivers/USB/LowLevel/LowLevel.c index f4f277ccb..c9d0493b4 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.c +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.c @@ -113,9 +113,18 @@ void USB_ShutDown(void) USB_Detach();
USB_Controller_Disable();
+ USB_INT_DisableAllInterrupts();
+ USB_INT_ClearAllInterrupts();
+
+ #if defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
+ UHWCON &= ~(1 << UIMOD);
+ #endif
+
if (!(USB_Options & USB_OPT_MANUAL_PLL))
USB_PLL_Off();
+ USB_REG_Off();
+
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
USB_OTGPAD_Off();
#endif
@@ -145,11 +154,11 @@ void USB_ResetInterface(void) USB_ConfigurationNumber = 0;
#if !defined(NO_DEVICE_REMOTE_WAKEUP)
- USB_RemoteWakeupEnabled = false;
+ USB_RemoteWakeupEnabled = false;
#endif
#if !defined(NO_DEVICE_SELF_POWER)
- USB_CurrentlySelfPowered = false;
+ USB_CurrentlySelfPowered = false;
#endif
#endif
@@ -217,9 +226,9 @@ void USB_ResetInterface(void) USB_INT_Clear(USB_INT_EORSTI);
USB_INT_Enable(USB_INT_EORSTI);
- #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
- USB_INT_Enable(USB_INT_VBUS);
- #endif
+ #if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR)
+ USB_INT_Enable(USB_INT_VBUS);
+ #endif
#elif defined(USB_HOST_ONLY)
USB_Host_HostMode_On();
diff --git a/LUFA/Drivers/USB/LowLevel/LowLevel.h b/LUFA/Drivers/USB/LowLevel/LowLevel.h index 04b2c460c..79261cd44 100644 --- a/LUFA/Drivers/USB/LowLevel/LowLevel.h +++ b/LUFA/Drivers/USB/LowLevel/LowLevel.h @@ -252,16 +252,18 @@ * mode speed.
*
* \note To reduce the FLASH requirements of the library if only device or host mode is required,
- * this can be statically set via defining the token USB_DEVICE_ONLY for device mode or
- * USB_HOST_ONLY for host mode in the use project makefile, passing the token to the compiler
+ * the mode can be statically set in the project makefile by defining the token USB_DEVICE_ONLY
+ * (for device mode) or USB_HOST_ONLY (for host mode), passing the token to the compiler
* via the -D switch. If the mode is statically set, this parameter does not exist in the
* function prototype.
+ * \n\n
*
* \note To reduce the FLASH requirements of the library if only fixed settings are are required,
* the options may be set statically in the same manner as the mode (see the Mode parameter of
* this function). To statically set the USB options, pass in the USE_STATIC_OPTIONS token,
* defined to the appropriate options masks. When the options are statically set, this
* parameter does not exist in the function prototype.
+ * \n\n
*
* \note The mode parameter does not exist on devices where only one mode is possible, such as USB
* AVR models which only implement the USB device mode in hardware.
diff --git a/LUFA/Drivers/USB/LowLevel/Pipe.h b/LUFA/Drivers/USB/LowLevel/Pipe.h index 127cea3ab..c16822b0d 100644 --- a/LUFA/Drivers/USB/LowLevel/Pipe.h +++ b/LUFA/Drivers/USB/LowLevel/Pipe.h @@ -493,14 +493,11 @@ #define Pipe_IsSETUPSent() ((UPINTX & (1 << TXSTPI)) ? true : false)
- #define Pipe_ClearIN() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << RXINI)); \
- UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE
+ #define Pipe_ClearIN() MACROS{ UPINTX &= ~((1 << RXINI) | (1 << FIFOCON)); }MACROE
- #define Pipe_ClearOUT() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXOUTI)); \
- UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE
+ #define Pipe_ClearOUT() MACROS{ UPINTX &= ~((1 << TXOUTI) | (1 << FIFOCON)); }MACROE
- #define Pipe_ClearSETUP() MACROS{ uint8_t Temp = UPINTX; UPINTX = (Temp & ~(1 << TXSTPI)); \
- UPINTX = (Temp & ~(1 << FIFOCON)); }MACROE
+ #define Pipe_ClearSETUP() MACROS{ UPINTX &= ~((1 << TXSTPI) | (1 << FIFOCON)); }MACROE
#define Pipe_IsNAKReceived() ((UPINTX & (1 << NAKEDI)) ? true : false)
@@ -803,7 +800,8 @@ * \ref Pipe_SetFiniteINRequests().
*
* \note The default control pipe does not have to be manually configured, as it is automatically
- * configured by the library internally.
+ * configured by the library internally.
+ * \n\n
*
* \note This routine will select the specified pipe, and the pipe will remain selected once the
* routine completes regardless of if the pipe configuration succeeds.
|