aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-07-19 07:02:19 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-07-19 07:02:19 +0000
commit110711598af766ef5da7aaf183d0c4886beb8fb7 (patch)
treea9b006b1ff2477562c7eae83dfa0b6761a421e21 /LUFA/Drivers/USB
parent2c404e5af53409af5ce279321377a1303c776617 (diff)
downloadlufa-110711598af766ef5da7aaf183d0c4886beb8fb7.tar.gz
lufa-110711598af766ef5da7aaf183d0c4886beb8fb7.tar.bz2
lufa-110711598af766ef5da7aaf183d0c4886beb8fb7.zip
Removed the ENDPOINT_DESCRIPTOR_DIR_* macros in favour of the shorter ENDPOINT_DIR_* macros, which can now be used with both Endpoint_ConfigureEndpoint() and in the device descriptors.
Diffstat (limited to 'LUFA/Drivers/USB')
-rw-r--r--LUFA/Drivers/USB/Class/Device/Audio.c4
-rw-r--r--LUFA/Drivers/USB/Class/Host/Audio.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/CDC.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/HID.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/MIDI.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/MassStorage.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/Printer.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/RNDIS.c2
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.c2
-rw-r--r--LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h17
-rw-r--r--LUFA/Drivers/USB/Core/ConfigDescriptor.h5
-rw-r--r--LUFA/Drivers/USB/Core/Endpoint.h5
-rw-r--r--LUFA/Drivers/USB/Core/StdDescriptors.h15
-rw-r--r--LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h17
-rw-r--r--LUFA/Drivers/USB/Core/USBController.h23
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h18
16 files changed, 40 insertions, 80 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/Audio.c b/LUFA/Drivers/USB/Class/Device/Audio.c
index 0b47b34a2..cdbe1a0d9 100644
--- a/LUFA/Drivers/USB/Class/Device/Audio.c
+++ b/LUFA/Drivers/USB/Class/Device/Audio.c
@@ -52,10 +52,10 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi
bool EndpointFilterMatch = false;
EndpointFilterMatch |= (AudioInterfaceInfo->Config.DataINEndpointNumber &&
- ((uint8_t)USB_ControlRequest.wIndex == (ENDPOINT_DESCRIPTOR_DIR_IN | AudioInterfaceInfo->Config.DataINEndpointNumber)));
+ ((uint8_t)USB_ControlRequest.wIndex == (ENDPOINT_DIR_IN | AudioInterfaceInfo->Config.DataINEndpointNumber)));
EndpointFilterMatch |= (AudioInterfaceInfo->Config.DataOUTEndpointNumber &&
- ((uint8_t)USB_ControlRequest.wIndex == (ENDPOINT_DESCRIPTOR_DIR_OUT | AudioInterfaceInfo->Config.DataOUTEndpointNumber)));
+ ((uint8_t)USB_ControlRequest.wIndex == (ENDPOINT_DIR_OUT | AudioInterfaceInfo->Config.DataOUTEndpointNumber)));
if (!(EndpointFilterMatch))
return;
diff --git a/LUFA/Drivers/USB/Class/Host/Audio.c b/LUFA/Drivers/USB/Class/Host/Audio.c
index adcf162be..d8665e4ea 100644
--- a/LUFA/Drivers/USB/Class/Host/Audio.c
+++ b/LUFA/Drivers/USB/Class/Host/Audio.c
@@ -87,7 +87,7 @@ uint8_t Audio_Host_ConfigurePipes(USB_ClassInfo_Audio_Host_t* const AudioInterfa
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
DataINEndpoint = EndpointData;
else
DataOUTEndpoint = EndpointData;
diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c
index 2e83365e1..2b9835996 100644
--- a/LUFA/Drivers/USB/Class/Host/CDC.c
+++ b/LUFA/Drivers/USB/Class/Host/CDC.c
@@ -86,7 +86,7 @@ uint8_t CDC_Host_ConfigurePipes(USB_ClassInfo_CDC_Host_t* const CDCInterfaceInfo
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
{
if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)
NotificationEndpoint = EndpointData;
diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c
index 512480b3b..fdcd6ee2b 100644
--- a/LUFA/Drivers/USB/Class/Host/HID.c
+++ b/LUFA/Drivers/USB/Class/Host/HID.c
@@ -88,7 +88,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
DataINEndpoint = EndpointData;
else
DataOUTEndpoint = EndpointData;
diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.c b/LUFA/Drivers/USB/Class/Host/MIDI.c
index 944ecc3e8..9f7bbd4ea 100644
--- a/LUFA/Drivers/USB/Class/Host/MIDI.c
+++ b/LUFA/Drivers/USB/Class/Host/MIDI.c
@@ -72,7 +72,7 @@ uint8_t MIDI_Host_ConfigurePipes(USB_ClassInfo_MIDI_Host_t* const MIDIInterfaceI
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
DataINEndpoint = EndpointData;
else
DataOUTEndpoint = EndpointData;
diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c
index 65ed6940e..60195e987 100644
--- a/LUFA/Drivers/USB/Class/Host/MassStorage.c
+++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c
@@ -72,7 +72,7 @@ uint8_t MS_Host_ConfigurePipes(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo,
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
DataINEndpoint = EndpointData;
else
DataOUTEndpoint = EndpointData;
diff --git a/LUFA/Drivers/USB/Class/Host/Printer.c b/LUFA/Drivers/USB/Class/Host/Printer.c
index 46dc1fa5f..576dd36f1 100644
--- a/LUFA/Drivers/USB/Class/Host/Printer.c
+++ b/LUFA/Drivers/USB/Class/Host/Printer.c
@@ -72,7 +72,7 @@ uint8_t PRNT_Host_ConfigurePipes(USB_ClassInfo_PRNT_Host_t* const PRNTInterfaceI
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
DataINEndpoint = EndpointData;
else
DataOUTEndpoint = EndpointData;
diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c
index 2750260c5..b942c536c 100644
--- a/LUFA/Drivers/USB/Class/Host/RNDIS.c
+++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c
@@ -88,7 +88,7 @@ uint8_t RNDIS_Host_ConfigurePipes(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfa
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
{
if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)
NotificationEndpoint = EndpointData;
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c
index be83497b2..64cae45f6 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.c
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.c
@@ -74,7 +74,7 @@ uint8_t SI_Host_ConfigurePipes(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo,
USB_Descriptor_Endpoint_t* EndpointData = DESCRIPTOR_PCAST(ConfigDescriptorData, USB_Descriptor_Endpoint_t);
- if (EndpointData->EndpointAddress & ENDPOINT_DESCRIPTOR_DIR_IN)
+ if ((EndpointData->EndpointAddress & ENDPOINT_DIR_MASK) == ENDPOINT_DIR_IN)
{
if ((EndpointData->Attributes & EP_TYPE_MASK) == EP_TYPE_INTERRUPT)
EventsEndpoint = EndpointData;
diff --git a/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h b/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
index 8611dd638..d1bea6dfd 100644
--- a/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
+++ b/LUFA/Drivers/USB/Core/AVR8/Endpoint_AVR8.h
@@ -144,20 +144,7 @@
#endif
/* Public Interface - May be used in end-application: */
- /* Macros: */
- /** \name Endpoint Direction Masks */
- //@{
- /** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
- * should be initialized in the OUT direction - i.e. data flows from host to device.
- */
- #define ENDPOINT_DIR_OUT (0 << EPDIR)
-
- /** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
- * should be initialized in the IN direction - i.e. data flows from device to host.
- */
- #define ENDPOINT_DIR_IN (1 << EPDIR)
- //@}
-
+ /* Macros: */
/** \name Endpoint Bank Mode Masks */
//@{
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
@@ -286,7 +273,7 @@
const uint16_t Size,
const uint8_t Banks)
{
- return Endpoint_ConfigureEndpoint_Prv(Number, ((Type << EPTYPE0) | Direction),
+ return Endpoint_ConfigureEndpoint_Prv(Number, ((Type << EPTYPE0) | (Direction ? (1 << EPDIR) : 0)),
((1 << ALLOC) | Banks | Endpoint_BytesToEPSizeMask(Size)));
}
diff --git a/LUFA/Drivers/USB/Core/ConfigDescriptor.h b/LUFA/Drivers/USB/Core/ConfigDescriptor.h
index 85cee466e..b34937a96 100644
--- a/LUFA/Drivers/USB/Core/ConfigDescriptor.h
+++ b/LUFA/Drivers/USB/Core/ConfigDescriptor.h
@@ -68,11 +68,6 @@
/* 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 \c 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.
*
diff --git a/LUFA/Drivers/USB/Core/Endpoint.h b/LUFA/Drivers/USB/Core/Endpoint.h
index 550414ce3..f6412ddff 100644
--- a/LUFA/Drivers/USB/Core/Endpoint.h
+++ b/LUFA/Drivers/USB/Core/Endpoint.h
@@ -93,11 +93,6 @@
*/
#define ENDPOINT_EPNUM_MASK 0x07
- /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's
- * direction for comparing with the \c ENDPOINT_DESCRIPTOR_DIR_* masks.
- */
- #define ENDPOINT_EPDIR_MASK 0x80
-
/** Endpoint address for the default control endpoint, which always resides in address 0. This is
* defined for convenience to give more readable code when used with the endpoint macros.
*/
diff --git a/LUFA/Drivers/USB/Core/StdDescriptors.h b/LUFA/Drivers/USB/Core/StdDescriptors.h
index 1cb85d5cb..fc79483cf 100644
--- a/LUFA/Drivers/USB/Core/StdDescriptors.h
+++ b/LUFA/Drivers/USB/Core/StdDescriptors.h
@@ -102,21 +102,6 @@
*/
#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
diff --git a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
index a57a568b7..eefd9cfcd 100644
--- a/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
+++ b/LUFA/Drivers/USB/Core/UC3/Endpoint_UC3.h
@@ -161,20 +161,7 @@
#endif
/* Public Interface - May be used in end-application: */
- /* Macros: */
- /** \name Endpoint Direction Masks */
- //@{
- /** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
- * should be initialized in the OUT direction - i.e. data flows from host to device.
- */
- #define ENDPOINT_DIR_OUT AVR32_USBB_UECFG0_EPDIR_OUT
-
- /** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
- * should be initialized in the IN direction - i.e. data flows from device to host.
- */
- #define ENDPOINT_DIR_IN AVR32_USBB_UECFG0_EPDIR_IN
- //@}
-
+ /* Macros: */
/** \name Endpoint Bank Mode Masks */
//@{
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
@@ -316,7 +303,7 @@
{
return Endpoint_ConfigureEndpoint_Prv(Number, (AVR32_USBB_ALLOC_MASK |
((uint32_t)Type << AVR32_USBB_EPTYPE_OFFSET) |
- ((uint32_t)Direction << AVR32_USBB_EPDIR_OFFSET) |
+ ((uint32_t)(Direction ? AVR32_USBB_UECFG0_EPDIR_MASK : 0) |
((uint32_t)Banks << AVR32_USBB_EPBK_OFFSET) |
Endpoint_BytesToEPSizeMask(Size)));
}
diff --git a/LUFA/Drivers/USB/Core/USBController.h b/LUFA/Drivers/USB/Core/USBController.h
index 49fbb41ff..3190957c1 100644
--- a/LUFA/Drivers/USB/Core/USBController.h
+++ b/LUFA/Drivers/USB/Core/USBController.h
@@ -63,8 +63,31 @@
#endif
/* Defines: */
+ /** \name Endpoint Direction Masks */
+ //@{
+ /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's
+ * direction for comparing with the \c ENDPOINT_DIR_* masks.
+ */
+ #define ENDPOINT_DIR_MASK 0x80
+
+ /** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with
+ * the index of the address within a device to obtain the full endpoint address.
+ */
+ #define ENDPOINT_DIR_OUT 0x00
+
+ /** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with
+ * the index of the address within a device to obtain the full endpoint address.
+ */
+ #define ENDPOINT_DIR_IN 0x80
+ //@}
+
/** \name Endpoint/Pipe Type Masks */
//@{
+ /** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared
+ * with the \c EP_TYPE_* masks to determine the exact type of the endpoint.
+ */
+ #define EP_TYPE_MASK 0x03
+
/** Mask for a CONTROL type endpoint or pipe.
*
* \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions.
diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
index 8a679f532..15ba8fe35 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
+++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
@@ -122,20 +122,7 @@
#endif
/* Public Interface - May be used in end-application: */
- /* Macros: */
- /** \name Endpoint Direction Masks */
- //@{
- /** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
- * should be initialized in the OUT direction - i.e. data flows from host to device.
- */
- #define ENDPOINT_DIR_OUT ENDPOINT_DESCRIPTOR_DIR_OUT
-
- /** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
- * should be initialized in the IN direction - i.e. data flows from device to host.
- */
- #define ENDPOINT_DIR_IN ENDPOINT_DESCRIPTOR_DIR_IN
- //@}
-
+ /* Macros: */
/** \name Endpoint Bank Mode Masks */
//@{
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
@@ -225,7 +212,8 @@
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE;
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber)
{
- uint8_t EPTableIndex = ((EndpointNumber & ENDPOINT_EPNUM_MASK) << 1) | ((EndpointNumber & ENDPOINT_DESCRIPTOR_DIR_IN) ? 0x01 : 0);
+ uint8_t EPTableIndex = ((EndpointNumber & ENDPOINT_EPNUM_MASK) << 1) |
+ ((EndpointNumber & ENDPOINT_DIR_IN) ? 0x01 : 0);
Endpoint_SelectedEndpoint = EndpointNumber;
Endpoint_SelectedEndpointHandle = &((USB_EP_t*)&USB_EndpointTable)[EPTableIndex];