projects
/
pub
/
USBasp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e225de8
)
Fixed logic hole breaking USB operations on a USB controller with only one supported...
author
Dean Camera
<dean@fourwalledcubicle.com>
Tue, 28 Aug 2012 20:09:14 +0000
(20:09 +0000)
committer
Dean Camera
<dean@fourwalledcubicle.com>
Tue, 28 Aug 2012 20:09:14 +0000
(20:09 +0000)
LUFA/DoxygenPages/ChangeLog.txt
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/Events.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/UC3/USBController_UC3.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/USBMode.h
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/USBTask.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
patch
|
blob
|
blame
|
history
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
patch
|
blob
|
blame
|
history
diff --git
a/LUFA/DoxygenPages/ChangeLog.txt
b/LUFA/DoxygenPages/ChangeLog.txt
index
62cf1f9
..
79f96aa
100644
(file)
--- a/
LUFA/DoxygenPages/ChangeLog.txt
+++ b/
LUFA/DoxygenPages/ChangeLog.txt
@@
-25,6
+25,8
@@
* - Core:
* - Fixed inverted LEDs_GetLEDs() function implementation for the Benito, Minimus and Arduino UNO boards
* - Fixed missing Win-32bit compatibility sections in the LUFA INF driver files (thanks to Christan Beharrell)
* - Core:
* - Fixed inverted LEDs_GetLEDs() function implementation for the Benito, Minimus and Arduino UNO boards
* - Fixed missing Win-32bit compatibility sections in the LUFA INF driver files (thanks to Christan Beharrell)
+ * - Fixed logic hole breaking USB operations on a USB controller with only one supported USB mode and no USB_DEVICE_ONLY or USB_HOST_ONLY
+ * configuration token set
* - Library Applications:
* - Fixed broken RESET_TOGGLES_LIBUSB_COMPAT compile time option in the AVRISP-MKII project
* - Fixed incompatibility in the CDC class bootloader on some systems (thanks to Sylvain Munaut)
* - Library Applications:
* - Fixed broken RESET_TOGGLES_LIBUSB_COMPAT compile time option in the AVRISP-MKII project
* - Fixed incompatibility in the CDC class bootloader on some systems (thanks to Sylvain Munaut)
diff --git
a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
index
8285f7e
..
67e14b0
100644
(file)
--- a/
LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
+++ b/
LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.c
@@
-35,7
+35,7
@@
#define __INCLUDE_FROM_USB_CONTROLLER_C
#include "../USBController.h"
#define __INCLUDE_FROM_USB_CONTROLLER_C
#include "../USBController.h"
-#if
(!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)
)
+#if
defined(USB_CAN_BE_BOTH
)
volatile uint8_t USB_CurrentMode = USB_MODE_None;
#endif
volatile uint8_t USB_CurrentMode = USB_MODE_None;
#endif
diff --git
a/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
b/LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
index
8106988
..
817732d
100644
(file)
--- a/
LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
+++ b/
LUFA/Drivers/USB/Core/AVR8/USBController_AVR8.h
@@
-211,8
+211,10
@@
* Calling this function when the USB interface is already initialized will cause a complete USB
* interface reset and re-enumeration.
*
* Calling this function when the USB interface is already initialized will cause a complete USB
* interface reset and re-enumeration.
*
- * \param[in] Mode
This is a m
ask indicating what mode the USB interface is to be initialized to, a value
+ * \param[in] Mode
M
ask indicating what mode the USB interface is to be initialized to, a value
* from the \ref USB_Modes_t enum.
* from the \ref USB_Modes_t enum.
+ * \note This parameter does not exist on devices with only one supported USB
+ * mode (device or host).
*
* \param[in] Options Mask indicating the options which should be used when initializing the USB
* interface to control the USB interface's behavior. This should be comprised of
*
* \param[in] Options Mask indicating the options which should be used when initializing the USB
* interface to control the USB interface's behavior. This should be comprised of
@@
-267,7
+269,7
@@
void USB_ResetInterface(void);
/* Global Variables: */
void USB_ResetInterface(void);
/* Global Variables: */
- #if
(!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)
) || defined(__DOXYGEN__)
+ #if
defined(USB_CAN_BE_BOTH
) || defined(__DOXYGEN__)
/** Indicates the mode that the USB interface is currently initialized to, a value from the
* \ref USB_Modes_t enum.
*
/** Indicates the mode that the USB interface is currently initialized to, a value from the
* \ref USB_Modes_t enum.
*
@@
-282,9
+284,9
@@
* USB interface is not initialized.
*/
extern volatile uint8_t USB_CurrentMode;
* USB interface is not initialized.
*/
extern volatile uint8_t USB_CurrentMode;
- #elif defined(USB_
HOST_ONLY
)
+ #elif defined(USB_
CAN_BE_HOST
)
#define USB_CurrentMode USB_MODE_Host
#define USB_CurrentMode USB_MODE_Host
- #elif defined(USB_
DEVICE_ONLY
)
+ #elif defined(USB_
CAN_BE_DEVICE
)
#define USB_CurrentMode USB_MODE_Device
#endif
#define USB_CurrentMode USB_MODE_Device
#endif
diff --git
a/LUFA/Drivers/USB/Core/Events.h
b/LUFA/Drivers/USB/Core/Events.h
index
f468b7e
..
192869b
100644
(file)
--- a/
LUFA/Drivers/USB/Core/Events.h
+++ b/
LUFA/Drivers/USB/Core/Events.h
@@
-156,6
+156,12
@@
* 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.
* 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.
+ *
+ * \note This event only exists on microcontrollers that supports USB host mode.
+ * \n\n
+ *
+ * \note This event does not exist if the \c USB_DEVICE_ONLY token is supplied to the compiler (see
+ * \ref Group_USBManagement documentation).
*/
void EVENT_USB_Host_DeviceEnumerationComplete(void);
*/
void EVENT_USB_Host_DeviceEnumerationComplete(void);
diff --git
a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
index
6a3df6e
..
159bf71
100644
(file)
--- a/
LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
+++ b/
LUFA/Drivers/USB/Core/UC3/USBController_UC3.c
@@
-35,7
+35,7
@@
#define __INCLUDE_FROM_USB_CONTROLLER_C
#include "../USBController.h"
#define __INCLUDE_FROM_USB_CONTROLLER_C
#include "../USBController.h"
-#if
(!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)
)
+#if
defined(USB_CAN_BE_BOTH
)
volatile uint8_t USB_CurrentMode = USB_MODE_None;
#endif
volatile uint8_t USB_CurrentMode = USB_MODE_None;
#endif
diff --git
a/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h
b/LUFA/Drivers/USB/Core/UC3/USBController_UC3.h
index
006e089
..
10a7d0d
100644
(file)
--- a/
LUFA/Drivers/USB/Core/UC3/USBController_UC3.h
+++ b/
LUFA/Drivers/USB/Core/UC3/USBController_UC3.h
@@
-178,8
+178,10
@@
* Calling this function when the USB interface is already initialized will cause a complete USB
* interface reset and re-enumeration.
*
* Calling this function when the USB interface is already initialized will cause a complete USB
* interface reset and re-enumeration.
*
- * \param[in] Mode
This is a m
ask indicating what mode the USB interface is to be initialized to, a value
+ * \param[in] Mode
M
ask indicating what mode the USB interface is to be initialized to, a value
* from the \ref USB_Modes_t enum.
* from the \ref USB_Modes_t enum.
+ * \note This parameter does not exist on devices with only one supported USB
+ * mode (device or host).
*
* \param[in] Options Mask indicating the options which should be used when initializing the USB
* interface to control the USB interface's behavior. This should be comprised of
*
* \param[in] Options Mask indicating the options which should be used when initializing the USB
* interface to control the USB interface's behavior. This should be comprised of
@@
-230,7
+232,7
@@
void USB_ResetInterface(void);
/* Global Variables: */
void USB_ResetInterface(void);
/* Global Variables: */
- #if
(!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)
) || defined(__DOXYGEN__)
+ #if
defined(USB_CAN_BE_BOTH
) || defined(__DOXYGEN__)
/** Indicates the mode that the USB interface is currently initialized to, a value from the
* \ref USB_Modes_t enum.
*
/** Indicates the mode that the USB interface is currently initialized to, a value from the
* \ref USB_Modes_t enum.
*
@@
-245,9
+247,9
@@
* USB interface is not initialized.
*/
extern volatile uint8_t USB_CurrentMode;
* USB interface is not initialized.
*/
extern volatile uint8_t USB_CurrentMode;
- #elif defined(USB_
HOST_ONLY
)
+ #elif defined(USB_
CAN_BE_HOST
)
#define USB_CurrentMode USB_MODE_Host
#define USB_CurrentMode USB_MODE_Host
- #elif defined(USB_
DEVICE_ONLY
)
+ #elif defined(USB_
CAN_BE_DEVICE
)
#define USB_CurrentMode USB_MODE_Device
#endif
#define USB_CurrentMode USB_MODE_Device
#endif
diff --git
a/LUFA/Drivers/USB/Core/USBMode.h
b/LUFA/Drivers/USB/Core/USBMode.h
index
7ae30bb
..
5de57ff
100644
(file)
--- a/
LUFA/Drivers/USB/Core/USBMode.h
+++ b/
LUFA/Drivers/USB/Core/USBMode.h
@@
-244,34
+244,28
@@
#define USB_CAN_BE_DEVICE
#endif
#define USB_CAN_BE_DEVICE
#endif
- #if (defined(USB_CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST))
- #define USB_CAN_BE_BOTH
- #endif
-
- #if defined(USB_HOST_ONLY)
+ #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
+ #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
+ #elif defined(USB_HOST_ONLY)
#if !defined(USB_CAN_BE_HOST)
#error USB_HOST_ONLY is not available for the currently selected microcontroller model.
#else
#undef USB_CAN_BE_DEVICE
#if !defined(USB_CAN_BE_HOST)
#error USB_HOST_ONLY is not available for the currently selected microcontroller model.
#else
#undef USB_CAN_BE_DEVICE
- #undef USB_CAN_BE_BOTH
#endif
#endif
- #endif
-
- #if defined(USB_DEVICE_ONLY)
+ #elif defined(USB_DEVICE_ONLY)
#if !defined(USB_CAN_BE_DEVICE)
#error USB_DEVICE_ONLY is not available for the currently selected microcontroller model.
#else
#undef USB_CAN_BE_HOST
#if !defined(USB_CAN_BE_DEVICE)
#error USB_DEVICE_ONLY is not available for the currently selected microcontroller model.
#else
#undef USB_CAN_BE_HOST
- #undef USB_CAN_BE_BOTH
#endif
#endif
#endif
#endif
- #if (defined(USB_
HOST_ONLY) && defined(USB_DEVICE_ONLY
))
- #
error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
+ #if (defined(USB_
CAN_BE_DEVICE) && defined(USB_CAN_BE_HOST
))
+ #
define USB_CAN_BE_BOTH
#endif
#if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST))
#endif
#if (!defined(USB_CAN_BE_DEVICE) && !defined(USB_CAN_BE_HOST))
- #error The currently selected device
or architecture is not supported under the USB component of the library
.
+ #error The currently selected device
, USB mode or architecture is not supported
.
#endif
#endif
#endif
#endif
diff --git
a/LUFA/Drivers/USB/Core/USBTask.c
b/LUFA/Drivers/USB/Core/USBTask.c
index
b0b6914
..
71ae47d
100644
(file)
--- a/
LUFA/Drivers/USB/Core/USBTask.c
+++ b/
LUFA/Drivers/USB/Core/USBTask.c
@@
-45,17
+45,15
@@
volatile uint8_t USB_DeviceState;
void USB_USBTask(void)
{
void USB_USBTask(void)
{
- #if defined(USB_HOST_ONLY)
- USB_HostTask();
- #elif defined(USB_DEVICE_ONLY)
- USB_DeviceTask();
- #else
+ #if defined(USB_CAN_BE_BOTH)
if (USB_CurrentMode == USB_MODE_Device)
USB_DeviceTask();
if (USB_CurrentMode == USB_MODE_Device)
USB_DeviceTask();
- #if defined(USB_CAN_BE_HOST)
else if (USB_CurrentMode == USB_MODE_Host)
USB_HostTask();
else if (USB_CurrentMode == USB_MODE_Host)
USB_HostTask();
- #endif
+ #elif defined(USB_CAN_BE_HOST)
+ USB_HostTask();
+ #elif defined(USB_CAN_BE_DEVICE)
+ USB_DeviceTask();
#endif
}
#endif
}
diff --git
a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
index
86df5c8
..
dde984b
100644
(file)
--- a/
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
+++ b/
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.c
@@
-35,7
+35,7
@@
#define __INCLUDE_FROM_USB_CONTROLLER_C
#include "../USBController.h"
#define __INCLUDE_FROM_USB_CONTROLLER_C
#include "../USBController.h"
-#if
(!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)
)
+#if
defined(USB_CAN_BE_BOTH
)
volatile uint8_t USB_CurrentMode = USB_MODE_None;
#endif
volatile uint8_t USB_CurrentMode = USB_MODE_None;
#endif
@@
-43,7
+43,7
@@
volatile uint8_t USB_CurrentMode = USB_MODE_None;
volatile uint8_t USB_Options;
#endif
volatile uint8_t USB_Options;
#endif
-/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for
8-bit AVR-GCC
*/
+/* Ugly workaround to ensure an aligned table, since __BIGGEST_ALIGNMENT__ == 1 for
the 8-bit AVR-GCC toolchain
*/
uint8_t USB_EndpointTable[sizeof(USB_EndpointTable_t) + 1];
void USB_Init(
uint8_t USB_EndpointTable[sizeof(USB_EndpointTable_t) + 1];
void USB_Init(
@@
-66,8
+66,6
@@
void USB_Init(
USB_Options = Options;
#endif
USB_Options = Options;
#endif
- USB_IsInitialized = true;
-
uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
GlobalInterruptDisable();
uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask();
GlobalInterruptDisable();
@@
-89,6
+87,12
@@
void USB_Init(
SetGlobalInterruptMask(CurrentGlobalInt);
SetGlobalInterruptMask(CurrentGlobalInt);
+ #if defined(USB_CAN_BE_BOTH)
+ USB_CurrentMode = Mode;
+ #endif
+
+ USB_IsInitialized = true;
+
USB_ResetInterface();
}
USB_ResetInterface();
}
diff --git
a/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
b/LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
index
e1c782d
..
8cc9daf
100644
(file)
--- a/
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
+++ b/
LUFA/Drivers/USB/Core/XMEGA/USBController_XMEGA.h
@@
-70,7
+70,6
@@
/* External Variables: */
extern uint8_t USB_EndpointTable[];
/* External Variables: */
extern uint8_t USB_EndpointTable[];
-
#endif
/* Includes: */
#endif
/* Includes: */
@@
-176,8
+175,10
@@
* Calling this function when the USB interface is already initialized will cause a complete USB
* interface reset and re-enumeration.
*
* Calling this function when the USB interface is already initialized will cause a complete USB
* interface reset and re-enumeration.
*
- * \param[in] Mode
This is a m
ask indicating what mode the USB interface is to be initialized to, a value
+ * \param[in] Mode
M
ask indicating what mode the USB interface is to be initialized to, a value
* from the \ref USB_Modes_t enum.
* from the \ref USB_Modes_t enum.
+ * \note This parameter does not exist on devices with only one supported USB
+ * mode (device or host).
*
* \param[in] Options Mask indicating the options which should be used when initializing the USB
* interface to control the USB interface's behavior. This should be comprised of
*
* \param[in] Options Mask indicating the options which should be used when initializing the USB
* interface to control the USB interface's behavior. This should be comprised of
@@
-232,7
+233,7
@@
void USB_ResetInterface(void);
/* Global Variables: */
void USB_ResetInterface(void);
/* Global Variables: */
- #if
(!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)
) || defined(__DOXYGEN__)
+ #if
defined(USB_CAN_BE_BOTH
) || defined(__DOXYGEN__)
/** Indicates the mode that the USB interface is currently initialized to, a value from the
* \ref USB_Modes_t enum.
*
/** Indicates the mode that the USB interface is currently initialized to, a value from the
* \ref USB_Modes_t enum.
*
@@
-247,7
+248,9
@@
* USB interface is not initialized.
*/
extern volatile uint8_t USB_CurrentMode;
* USB interface is not initialized.
*/
extern volatile uint8_t USB_CurrentMode;
- #elif defined(USB_DEVICE_ONLY)
+ #elif defined(USB_CAN_BE_HOST)
+ #define USB_CurrentMode USB_MODE_Host
+ #elif defined(USB_CAN_BE_DEVICE)
#define USB_CurrentMode USB_MODE_Device
#endif
#define USB_CurrentMode USB_MODE_Device
#endif