forked from mirror/qmk_firmware
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)));
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
* - Altered the USB_Host_SetDeviceConfiguration() function to update the global Host state machine state and the new
|
||||
* USB_Host_ConfigurationNumber global as required
|
||||
* - Added endian correcting code to the library USB class drivers for multiple architecture support
|
||||
* - Removed the ENDPOINT_DESCRIPTOR_DIR_* macros, replaced by ENDPOINT_DIR_* instead
|
||||
* - Library Applications:
|
||||
* - Modified the Low Level and Class Driver AudioInput and AudioOutput demos to support multiple audio sample rates
|
||||
* - Updated all host mode demos and projects to use the EVENT_USB_Host_DeviceEnumerationComplete() event callback for device configuration
|
||||
|
||||
@@ -23,33 +23,8 @@
|
||||
* - The \c USB_ConfigurationNumber, \c USB_RemoteWakeupEnabled and \c USB_CurrentlySelfPowered globals have been renamed to
|
||||
* \ref USB_Device_ConfigurationNumber, \ref USB_Device_RemoteWakeupEnabled and \ref USB_Device_CurrentlySelfPowered to clearly indicate
|
||||
* the USB mode they relate to. Existing applications using these variables should rename all references to the previous names.
|
||||
*
|
||||
* <b>Host Mode</b>
|
||||
* - The USB_Host_SetDeviceConfiguration() function now automatically sets the USB Host state machine to the \ref HOST_STATE_Configured
|
||||
* state if a non-zero configuration is set sucessfully, or the \ref HOST_STATE_Addressed if a zero-index configuration is specified. Existing
|
||||
* applications should no longer manually alter the \ref USB_HostState global, and should instead call this function to configure and
|
||||
* unconfigure an attached device.
|
||||
* - The \c HOST_STATE_WaitForDeviceRemoval and \c HOST_STATE_Suspended host state machine states have been removed; these are replaced by
|
||||
* unconfiguring the attached device via a call to \ref USB_Host_SetDeviceConfiguration() and a test of \ref USB_Host_IsBusSuspended() instead.
|
||||
* - It is highly recommended that the EVENT_USB_Host_DeviceEnumerationComplete() event callback now be used for initial device configuration,
|
||||
* rather than a switch on the USB host state machine state for readability.
|
||||
*
|
||||
* \section Sec_Migration110528 Migrating from 101122 to 110528
|
||||
* <b>Non-USB Library Components</b>
|
||||
* - The TWI driver \ref TWI_StartTransmission() function return type has now changed, so that the function returns an
|
||||
* error code from the \ref TWI_ErrorCodes_t enum instead of a boolean success flag. Existing code must now check
|
||||
* against the \ref TWI_ERROR_NoError return value for success instead of a boolean \c true value, or it will not function
|
||||
* correctly.
|
||||
* - The Serial Stream driver has been removed, and its functionality rolled into the regular serial driver. Existing code
|
||||
* should remove references to the \c LUFA_SRC_SERIALSTREAM module in their makefiles, include the regular Serial driver
|
||||
* header instead and call the regular \ref Serial_Init() function followed by the new \ref Serial_CreateStream() function
|
||||
* with a \c NULL parameter.
|
||||
* - The \ref Serial_ReceiveByte() function has changed, and now returns a signed 16-bit integer, with -1 indicating no data was
|
||||
* received.
|
||||
* - The TWI driver \ref TWI_Init() function now expects additional prescaler and bitlength parameters. See the function
|
||||
* documentation for more details.
|
||||
* - The name postfix on all driver modules to turn off and disable that module has been changed from *_ShutDown() to *_Disable().
|
||||
* Rename all references to these functions to use the new function names.
|
||||
* - The \c ENDPOINT_DESCRIPTOR_DIR_IN and \c ENDPOINT_DESCRIPTOR_DIR_OUT macros have now been replaced by \ref ENDPOINT_DIR_IN and
|
||||
* \ref ENDPOINT_DIR_OUT to improve code clarity.
|
||||
*
|
||||
* <b>USB Core</b>
|
||||
* - By default, unordered Endpoint and Pipe configuration is now allowed once again, via the previous workaround of
|
||||
|
||||
Reference in New Issue
Block a user