From 55538dcef34bc3c0f2ada4767c51d11202ac0678 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 25 Oct 2010 12:42:55 +0000 Subject: Add descriptor class, subclass and protocol constants to the class drivers, modify all demos to use them where possible. Move out private/internal host class driver constants to the common class driver headers, so that they can be used in the Low Level host mode demos. Ensure all demos, projects and bootloaders use the class driver constants where possible to minimise code repetition. --- LUFA/Drivers/USB/Class/Common/Audio.h | 25 +++++++++++++++++ LUFA/Drivers/USB/Class/Common/CDC.h | 34 +++++++++++++++++++++++ LUFA/Drivers/USB/Class/Common/HID.h | 42 +++++++++++++++++------------ LUFA/Drivers/USB/Class/Common/MIDI.h | 1 + LUFA/Drivers/USB/Class/Common/MassStorage.h | 39 +++++++++++++++++++-------- LUFA/Drivers/USB/Class/Common/Printer.h | 36 ++++++++++++++++++------- LUFA/Drivers/USB/Class/Common/StillImage.h | 16 +++++++++++ LUFA/Drivers/USB/Class/Host/CDC.c | 12 ++++----- LUFA/Drivers/USB/Class/Host/CDC.h | 8 ------ LUFA/Drivers/USB/Class/Host/HID.c | 4 +-- LUFA/Drivers/USB/Class/Host/HID.h | 3 --- LUFA/Drivers/USB/Class/Host/MIDI.c | 6 ++--- LUFA/Drivers/USB/Class/Host/MIDI.h | 5 ---- LUFA/Drivers/USB/Class/Host/MassStorage.c | 26 +++++++++--------- LUFA/Drivers/USB/Class/Host/MassStorage.h | 12 +-------- LUFA/Drivers/USB/Class/Host/Printer.c | 6 ++--- LUFA/Drivers/USB/Class/Host/Printer.h | 5 ---- LUFA/Drivers/USB/Class/Host/RNDIS.c | 12 ++++----- LUFA/Drivers/USB/Class/Host/RNDIS.h | 8 ------ LUFA/Drivers/USB/Class/Host/StillImage.c | 8 +++--- LUFA/Drivers/USB/Class/Host/StillImage.h | 6 +---- 21 files changed, 194 insertions(+), 120 deletions(-) (limited to 'LUFA/Drivers/USB/Class') diff --git a/LUFA/Drivers/USB/Class/Common/Audio.h b/LUFA/Drivers/USB/Class/Common/Audio.h index b848015e0..b5739c1d0 100644 --- a/LUFA/Drivers/USB/Class/Common/Audio.h +++ b/LUFA/Drivers/USB/Class/Common/Audio.h @@ -210,6 +210,31 @@ #define AUDIO_EP_ACCEPTS_SMALL_PACKETS (0 << 7) /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Audio + * device class. + */ + enum Audio_Descriptor_ClassSubclassProtocol_t + { + AUDIO_CSCP_AudioClass = 0x01, /**< Descriptor Class value indicating that the device or + * interface belongs to the USB Audio 1.0 class. + */ + AUDIO_CSCP_ControlSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or + * interface belongs to the Audio Control subclass. + */ + AUDIO_CSCP_ControlProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or + * interface belongs to the Audio Control protocol. + */ + AUDIO_CSCP_AudioStreamingSubclass = 0x02, /**< Descriptor Subclass value indicating that the device or + * interface belongs to the MIDI Streaming subclass. + */ + AUDIO_CSCP_MIDIStreamingSubclass = 0x03, /**< Descriptor Subclass value indicating that the device or + * interface belongs to the Audio streaming subclass. + */ + AUDIO_CSCP_StreamingProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or + * interface belongs to the Streaming Audio protocol. + */ + }; + /** Audio class specific interface description subtypes, for the Audio Control interface. */ enum Audio_CSInterface_AC_SubTypes_t { diff --git a/LUFA/Drivers/USB/Class/Common/CDC.h b/LUFA/Drivers/USB/Class/Common/CDC.h index eb6577e5c..b4ce72ef8 100644 --- a/LUFA/Drivers/USB/Class/Common/CDC.h +++ b/LUFA/Drivers/USB/Class/Common/CDC.h @@ -127,6 +127,40 @@ } /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the CDC + * device class. + */ + enum CDC_Descriptor_ClassSubclassProtocol_t + { + CDC_CSCP_CDCClass = 0x02, /**< Descriptor Class value indicating that the device or interface + * belongs to the CDC class. + */ + CDC_CSCP_NoSpecificSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface + * belongs to no specific subclass of the CDC class. + */ + CDC_CSCP_ACMSubclass = 0x02, /**< Descriptor Subclass value indicating that the device or interface + * belongs to the Abstract Control Model CDC subclass. + */ + CDC_CSCP_ATCommandProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the AT Command protocol of the CDC class. + */ + CDC_CSCP_NoSpecificProtocol = 0x00, /**< Descriptor Class value indicating that the device or interface + * belongs to no specific protocol of the CDC class. + */ + CDC_CSCP_VendorSpecificProtocol = 0xFF, /**< Descriptor Class value indicating that the device or interface + * belongs to a vendor-specific protocol of the CDC class. + */ + CDC_CSCP_CDCDataClass = 0x0A, /**< Descriptor Class value indicating that the device or interface + * belongs to the CDC Data class. + */ + CDC_CSCP_NoDataSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface + * belongs to no specific subclass of the CDC data class. + */ + CDC_CSCP_NoDataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface + * belongs to no specific protocol of the CDC data class. + */ + }; + /** Enum for the CDC class specific control requests that can be issued by the USB bus host. */ enum CDC_ClassRequests_t { diff --git a/LUFA/Drivers/USB/Class/Common/HID.h b/LUFA/Drivers/USB/Class/Common/HID.h index b5d095e08..0a7ada3a9 100644 --- a/LUFA/Drivers/USB/Class/Common/HID.h +++ b/LUFA/Drivers/USB/Class/Common/HID.h @@ -98,6 +98,31 @@ #define HID_KEYBOARD_LED_KATANA (1 << 3) /* Type Defines: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the HID + * device class. + */ + enum HID_Descriptor_ClassSubclassProtocol_t + { + HID_CSCP_HIDClass = 0x03, /**< Descriptor Class value indicating that the device or interface + * belongs to the HID class. + */ + HID_CSCP_NonBootSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface + * does not implement a HID boot protocol. + */ + HID_CSCP_BootSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface + * implements a HID boot protocol. + */ + HID_CSCP_NonBootProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface + * does not belong to a HID boot protocol. + */ + HID_CSCP_KeyboardBootProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Keyboard HID boot protocol. + */ + HID_CSCP_MouseBootProtocol = 0x02, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Mouse HID boot protocol. + */ + }; + /** Enum for the HID class specific control requests that can be issued by the USB bus host. */ enum HID_ClassRequests_t { @@ -116,23 +141,6 @@ HID_DTYPE_Report = 0x22, /**< Descriptor header type value, to indicate a HID class HID report descriptor. */ }; - /** Enum for the HID class boot protocols that may be supported by HID devices. */ - enum HID_BootProtocols_t - { - HID_BOOTP_NonBootProtocol = 0x00, /**< Constant for the protocol value of a HID interface descriptor, indicating - * that the interface does not support any HID class boot protocol (see HID - * Class Specification). - */ - HID_BOOTP_KeyboardBootProtocol = 0x01, /**< Constant for the protocol value of a HID interface descriptor, indicating - * that the interface supports the HID class Keyboard boot protocol (see HID - * Class Specification). - */ - HID_BOOTP_MouseBootProtocol = 0x02, /**< Constant for the protocol value of a HID interface descriptor, indicating - * that the interface supports the HID class Mouse boot protocol (see HID Class - * Specification). - */ - }; - /** Enum for the different types of HID reports. */ enum HID_ReportItemTypes_t { diff --git a/LUFA/Drivers/USB/Class/Common/MIDI.h b/LUFA/Drivers/USB/Class/Common/MIDI.h index 22e32479f..b92c5f962 100644 --- a/LUFA/Drivers/USB/Class/Common/MIDI.h +++ b/LUFA/Drivers/USB/Class/Common/MIDI.h @@ -87,6 +87,7 @@ #define MIDI_CHANNEL(channel) ((channel) - 1) /* Enums: */ + /** Enum for the possible MIDI jack types in a MIDI device jack descriptor. */ enum MIDI_JackTypes_t { MIDI_JACKTYPE_Embedded = 0x01, /**< MIDI class descriptor jack type value for an embedded (logical) MIDI input or output jack. */ diff --git a/LUFA/Drivers/USB/Class/Common/MassStorage.h b/LUFA/Drivers/USB/Class/Common/MassStorage.h index e8693335d..01e5c9445 100644 --- a/LUFA/Drivers/USB/Class/Common/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Common/MassStorage.h @@ -205,25 +205,42 @@ #define SCSI_ASENSEQ_OPERATION_IN_PROGRESS 0x07 /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Mass + * Storage device class. + */ + enum MS_Descriptor_ClassSubclassProtocol_t + { + MS_CSCP_MassStorageClass = 0x08, /**< Descriptor Class value indicating that the device or interface + * belongs to the Mass Storage class. + */ + MS_CSCP_SCSITransparentSubclass = 0x06, /**< Descriptor Subclass value indicating that the device or interface + * belongs to the SCSI Transparent Command Set subclass of the Mass + * storage class. + */ + MS_CSCP_BulkOnlyTransportProtocol = 0x50, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Bulk Only Transport protocol of the Mass Storage class. + */ + }; + /** Enum for the Mass Storage class specific control requests that can be issued by the USB bus host. */ enum MS_ClassRequests_t { - MS_REQ_GetMaxLUN = 0xFE, /**< Mass Storage class-specific request to retrieve the total number of Logical - * Units (drives) in the SCSI device. - */ - MS_REQ_MassStorageReset = 0xFF, /**< Mass Storage class-specific request to reset the Mass Storage interface, - * ready for the next command. - */ + MS_REQ_GetMaxLUN = 0xFE, /**< Mass Storage class-specific request to retrieve the total number of Logical + * Units (drives) in the SCSI device. + */ + MS_REQ_MassStorageReset = 0xFF, /**< Mass Storage class-specific request to reset the Mass Storage interface, + * ready for the next command. + */ }; /** Enum for the possible command status wrapper return status codes. */ enum MS_CommandStatusCodes_t { - MS_SCSI_COMMAND_Pass = 0, /**< Command completed with no error */ - MS_SCSI_COMMAND_Fail = 1, /**< Command failed to complete - host may check the exact error via a - * SCSI REQUEST SENSE command. - */ - MS_SCSI_COMMAND_PhaseError = 2, /**< Command failed due to being invalid in the current phase. */ + MS_SCSI_COMMAND_Pass = 0, /**< Command completed with no error */ + MS_SCSI_COMMAND_Fail = 1, /**< Command failed to complete - host may check the exact error via a + * SCSI REQUEST SENSE command. + */ + MS_SCSI_COMMAND_PhaseError = 2, /**< Command failed due to being invalid in the current phase. */ }; /* Type Defines: */ diff --git a/LUFA/Drivers/USB/Class/Common/Printer.h b/LUFA/Drivers/USB/Class/Common/Printer.h index 03ae12e59..6619ced04 100644 --- a/LUFA/Drivers/USB/Class/Common/Printer.h +++ b/LUFA/Drivers/USB/Class/Common/Printer.h @@ -76,19 +76,35 @@ #define PRNT_PORTSTATUS_PAPEREMPTY (1 << 5) /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the Printer + * device class. + */ + enum PRNT_Descriptor_ClassSubclassProtocol_t + { + PRNT_CSCP_PrinterClass = 0x07, /**< Descriptor Class value indicating that the device or interface + * belongs to the Printer class. + */ + PRNT_CSCP_PrinterSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface + * belongs to the Printer subclass. + */ + PRNT_CSCP_BidirectionalProtocol = 0x02, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Bidirectional protocol of the Printer class. + */ + }; + /** Enum for the Printer class specific control requests that can be issued by the USB bus host. */ enum PRNT_ClassRequests_t { - PRNT_REQ_GetDeviceID = 0x00, /**< Printer class-specific request to retrieve the Unicode ID - * string of the device, containing the device's name, manufacturer - * and supported printer languages. - */ - PRNT_REQ_GetPortStatus = 0x01, /**< Printer class-specific request to get the current status of the - * virtual printer port, for device selection and ready states. - */ - PRNT_REQ_SoftReset = 0x02, /**< Printer class-specific request to reset the device, ready for new - * printer commands. - */ + PRNT_REQ_GetDeviceID = 0x00, /**< Printer class-specific request to retrieve the Unicode ID + * string of the device, containing the device's name, manufacturer + * and supported printer languages. + */ + PRNT_REQ_GetPortStatus = 0x01, /**< Printer class-specific request to get the current status of the + * virtual printer port, for device selection and ready states. + */ + PRNT_REQ_SoftReset = 0x02, /**< Printer class-specific request to reset the device, ready for new + * printer commands. + */ }; /* Disable C linkage for C++ Compilers: */ diff --git a/LUFA/Drivers/USB/Class/Common/StillImage.h b/LUFA/Drivers/USB/Class/Common/StillImage.h index bb9460934..98dc7981c 100644 --- a/LUFA/Drivers/USB/Class/Common/StillImage.h +++ b/LUFA/Drivers/USB/Class/Common/StillImage.h @@ -100,6 +100,22 @@ }; /* Enums: */ + /** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the + * Still Image device class. + */ + enum SI_Descriptor_ClassSubclassProtocol_t + { + SI_CSCP_StillImageClass = 0x06, /**< Descriptor Class value indicating that the device or interface + * belongs to the Still Image class. + */ + SI_CSCP_StillImageSubclass = 0x01, /**< Descriptor Subclass value indicating that the device or interface + * belongs to the Still Image subclass. + */ + SI_CSCP_BulkOnlyProtocol = 0x01, /**< Descriptor Protocol value indicating that the device or interface + * belongs to the Bulk Only Transport protocol of the Still Image class. + */ + }; + /** Enums for the possible status codes of a returned Response Block from an attached PIMA compliant Still Image device. */ enum PIMA_ResponseCodes_t { diff --git a/LUFA/Drivers/USB/Class/Host/CDC.c b/LUFA/Drivers/USB/Class/Host/CDC.c index 28d94e594..ab5305f8e 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.c +++ b/LUFA/Drivers/USB/Class/Host/CDC.c @@ -142,9 +142,9 @@ static uint8_t DCOMP_CDC_Host_NextCDCControlInterface(void* const CurrentDescrip USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if ((CurrentInterface->Class == CDC_CONTROL_CLASS) && - (CurrentInterface->SubClass == CDC_CONTROL_SUBCLASS) && - (CurrentInterface->Protocol == CDC_CONTROL_PROTOCOL)) + if ((CurrentInterface->Class == CDC_CSCP_CDCClass) && + (CurrentInterface->SubClass == CDC_CSCP_ACMSubclass) && + (CurrentInterface->Protocol == CDC_CSCP_ATCommandProtocol)) { return DESCRIPTOR_SEARCH_Found; } @@ -160,9 +160,9 @@ static uint8_t DCOMP_CDC_Host_NextCDCDataInterface(void* const CurrentDescriptor USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if ((CurrentInterface->Class == CDC_DATA_CLASS) && - (CurrentInterface->SubClass == CDC_DATA_SUBCLASS) && - (CurrentInterface->Protocol == CDC_DATA_PROTOCOL)) + if ((CurrentInterface->Class == CDC_CSCP_CDCDataClass) && + (CurrentInterface->SubClass == CDC_CSCP_NoDataSubclass) && + (CurrentInterface->Protocol == CDC_CSCP_NoDataProtocol)) { return DESCRIPTOR_SEARCH_Found; } diff --git a/LUFA/Drivers/USB/Class/Host/CDC.h b/LUFA/Drivers/USB/Class/Host/CDC.h index 164e94f92..b9b468781 100644 --- a/LUFA/Drivers/USB/Class/Host/CDC.h +++ b/LUFA/Drivers/USB/Class/Host/CDC.h @@ -306,14 +306,6 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) - /* Macros: */ - #define CDC_CONTROL_CLASS 0x02 - #define CDC_CONTROL_SUBCLASS 0x02 - #define CDC_CONTROL_PROTOCOL 0x01 - #define CDC_DATA_CLASS 0x0A - #define CDC_DATA_SUBCLASS 0x00 - #define CDC_DATA_PROTOCOL 0x00 - /* Function Prototypes: */ #if defined(__INCLUDE_FROM_CDC_HOST_C) static int CDC_Host_putchar(char c, diff --git a/LUFA/Drivers/USB/Class/Host/HID.c b/LUFA/Drivers/USB/Class/Host/HID.c index c38766500..60dec5a18 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.c +++ b/LUFA/Drivers/USB/Class/Host/HID.c @@ -118,7 +118,7 @@ uint8_t HID_Host_ConfigurePipes(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo HIDInterfaceInfo->State.InterfaceNumber = HIDInterface->InterfaceNumber; HIDInterfaceInfo->State.HIDReportSize = HIDDescriptor->HIDReportLength; - HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_BOOTP_NonBootProtocol); + HIDInterfaceInfo->State.SupportsBootProtocol = (HIDInterface->SubClass != HID_CSCP_NonBootProtocol); HIDInterfaceInfo->State.LargestReportSize = 8; HIDInterfaceInfo->State.IsActive = true; @@ -132,7 +132,7 @@ static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if (CurrentInterface->Class == HID_INTERFACE_CLASS) + if (CurrentInterface->Class == HID_CSCP_HIDClass) return DESCRIPTOR_SEARCH_Found; } diff --git a/LUFA/Drivers/USB/Class/Host/HID.h b/LUFA/Drivers/USB/Class/Host/HID.h index 9c86e1240..af8407bb5 100644 --- a/LUFA/Drivers/USB/Class/Host/HID.h +++ b/LUFA/Drivers/USB/Class/Host/HID.h @@ -297,9 +297,6 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) - /* Macros: */ - #define HID_INTERFACE_CLASS 0x03 - /* Function Prototypes: */ #if defined(__INCLUDE_FROM_HID_HOST_C) static uint8_t DCOMP_HID_Host_NextHIDInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.c b/LUFA/Drivers/USB/Class/Host/MIDI.c index 4483b5073..c500240e7 100644 --- a/LUFA/Drivers/USB/Class/Host/MIDI.c +++ b/LUFA/Drivers/USB/Class/Host/MIDI.c @@ -110,9 +110,9 @@ static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDes USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if ((CurrentInterface->Class == MIDI_STREAMING_CLASS) && - (CurrentInterface->SubClass == MIDI_STREAMING_SUBCLASS) && - (CurrentInterface->Protocol == MIDI_STREAMING_PROTOCOL)) + if ((CurrentInterface->Class == AUDIO_CSCP_AudioClass) && + (CurrentInterface->SubClass == AUDIO_CSCP_MIDIStreamingSubclass) && + (CurrentInterface->Protocol == AUDIO_CSCP_StreamingProtocol)) { return DESCRIPTOR_SEARCH_Found; } diff --git a/LUFA/Drivers/USB/Class/Host/MIDI.h b/LUFA/Drivers/USB/Class/Host/MIDI.h index 34228121f..a21bdbd52 100644 --- a/LUFA/Drivers/USB/Class/Host/MIDI.h +++ b/LUFA/Drivers/USB/Class/Host/MIDI.h @@ -188,11 +188,6 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) - /* Macros: */ - #define MIDI_STREAMING_CLASS 0x01 - #define MIDI_STREAMING_SUBCLASS 0x03 - #define MIDI_STREAMING_PROTOCOL 0x00 - /* Function Prototypes: */ #if defined(__INCLUDE_FROM_MIDI_HOST_C) static uint8_t DCOMP_MIDI_Host_NextMIDIStreamingInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.c b/LUFA/Drivers/USB/Class/Host/MassStorage.c index 97b0aba4d..8cb1042bb 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.c +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.c @@ -110,9 +110,9 @@ static uint8_t DCOMP_MS_Host_NextMSInterface(void* const CurrentDescriptor) USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if ((CurrentInterface->Class == MASS_STORE_CLASS) && - (CurrentInterface->SubClass == MASS_STORE_SUBCLASS) && - (CurrentInterface->Protocol == MASS_STORE_PROTOCOL)) + if ((CurrentInterface->Class == MS_CSCP_MassStorageClass) && + (CurrentInterface->SubClass == MS_CSCP_SCSITransparentSubclass) && + (CurrentInterface->Protocol == MS_CSCP_BulkOnlyTransportProtocol)) { return DESCRIPTOR_SEARCH_Found; } @@ -150,7 +150,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf { uint8_t ErrorCode = PIPE_RWSTREAM_NoError; - SCSICommandBlock->Signature = CBW_SIGNATURE; + SCSICommandBlock->Signature = MS_CBW_SIGNATURE; SCSICommandBlock->Tag = ++MSInterfaceInfo->State.TransactionTag; if (MSInterfaceInfo->State.TransactionTag == 0xFFFFFFFF) @@ -180,7 +180,7 @@ static uint8_t MS_Host_SendCommand(USB_ClassInfo_MS_Host_t* const MSInterfaceInf static uint8_t MS_Host_WaitForDataReceived(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo) { - uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS; + uint16_t TimeoutMSRem = MS_COMMAND_DATA_TIMEOUT_MS; uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); Pipe_SelectPipe(MSInterfaceInfo->Config.DataINPipeNumber); @@ -240,7 +240,7 @@ static uint8_t MS_Host_SendReceiveData(USB_ClassInfo_MS_Host_t* const MSInterfac uint8_t ErrorCode = PIPE_RWSTREAM_NoError; uint16_t BytesRem = SCSICommandBlock->DataTransferLength; - if (SCSICommandBlock->Flags & COMMAND_DIRECTION_DATA_IN) + if (SCSICommandBlock->Flags & MS_COMMAND_DIR_DATA_IN) { if ((ErrorCode = MS_Host_WaitForDataReceived(MSInterfaceInfo)) != PIPE_RWSTREAM_NoError) { @@ -357,7 +357,7 @@ uint8_t MS_Host_GetInquiryData(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) { .DataTransferLength = sizeof(SCSI_Inquiry_Response_t), - .Flags = COMMAND_DIRECTION_DATA_IN, + .Flags = MS_COMMAND_DIR_DATA_IN, .LUN = LUNIndex, .SCSICommandLength = 6, .SCSICommandData = @@ -393,7 +393,7 @@ uint8_t MS_Host_TestUnitReady(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) { .DataTransferLength = 0, - .Flags = COMMAND_DIRECTION_DATA_IN, + .Flags = MS_COMMAND_DIR_DATA_IN, .LUN = LUNIndex, .SCSICommandLength = 6, .SCSICommandData = @@ -430,7 +430,7 @@ uint8_t MS_Host_ReadDeviceCapacity(USB_ClassInfo_MS_Host_t* const MSInterfaceInf MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) { .DataTransferLength = sizeof(SCSI_Capacity_t), - .Flags = COMMAND_DIRECTION_DATA_IN, + .Flags = MS_COMMAND_DIR_DATA_IN, .LUN = LUNIndex, .SCSICommandLength = 10, .SCSICommandData = @@ -474,7 +474,7 @@ uint8_t MS_Host_RequestSense(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) { .DataTransferLength = sizeof(SCSI_Request_Sense_Response_t), - .Flags = COMMAND_DIRECTION_DATA_IN, + .Flags = MS_COMMAND_DIR_DATA_IN, .LUN = LUNIndex, .SCSICommandLength = 6, .SCSICommandData = @@ -511,7 +511,7 @@ uint8_t MS_Host_PreventAllowMediumRemoval(USB_ClassInfo_MS_Host_t* const MSInter MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) { .DataTransferLength = 0, - .Flags = COMMAND_DIRECTION_DATA_OUT, + .Flags = MS_COMMAND_DIR_DATA_OUT, .LUN = LUNIndex, .SCSICommandLength = 6, .SCSICommandData = @@ -551,7 +551,7 @@ uint8_t MS_Host_ReadDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo, MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) { .DataTransferLength = ((uint32_t)Blocks * BlockSize), - .Flags = COMMAND_DIRECTION_DATA_IN, + .Flags = MS_COMMAND_DIR_DATA_IN, .LUN = LUNIndex, .SCSICommandLength = 10, .SCSICommandData = @@ -595,7 +595,7 @@ uint8_t MS_Host_WriteDeviceBlocks(USB_ClassInfo_MS_Host_t* const MSInterfaceInfo MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t) { .DataTransferLength = ((uint32_t)Blocks * BlockSize), - .Flags = COMMAND_DIRECTION_DATA_OUT, + .Flags = MS_COMMAND_DIR_DATA_OUT, .LUN = LUNIndex, .SCSICommandLength = 10, .SCSICommandData = diff --git a/LUFA/Drivers/USB/Class/Host/MassStorage.h b/LUFA/Drivers/USB/Class/Host/MassStorage.h index f375f3244..7eca94820 100644 --- a/LUFA/Drivers/USB/Class/Host/MassStorage.h +++ b/LUFA/Drivers/USB/Class/Host/MassStorage.h @@ -313,17 +313,7 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #define MASS_STORE_CLASS 0x08 - #define MASS_STORE_SUBCLASS 0x06 - #define MASS_STORE_PROTOCOL 0x50 - - #define CBW_SIGNATURE 0x43425355UL - #define CSW_SIGNATURE 0x53425355UL - - #define COMMAND_DIRECTION_DATA_OUT (0 << 7) - #define COMMAND_DIRECTION_DATA_IN (1 << 7) - - #define COMMAND_DATA_TIMEOUT_MS 10000 + #define MS_COMMAND_DATA_TIMEOUT_MS 10000 /* Function Prototypes: */ #if defined(__INCLUDE_FROM_MASSSTORAGE_HOST_C) diff --git a/LUFA/Drivers/USB/Class/Host/Printer.c b/LUFA/Drivers/USB/Class/Host/Printer.c index 4249a8b70..e69948b1e 100644 --- a/LUFA/Drivers/USB/Class/Host/Printer.c +++ b/LUFA/Drivers/USB/Class/Host/Printer.c @@ -111,9 +111,9 @@ static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* CurrentDescriptor) USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if ((CurrentInterface->Class == PRINTER_CLASS) && - (CurrentInterface->SubClass == PRINTER_SUBCLASS) && - (CurrentInterface->Protocol == PRINTER_PROTOCOL)) + if ((CurrentInterface->Class == PRNT_CSCP_PrinterClass) && + (CurrentInterface->SubClass == PRNT_CSCP_PrinterSubclass) && + (CurrentInterface->Protocol == PRNT_CSCP_BidirectionalProtocol)) { return DESCRIPTOR_SEARCH_Found; } diff --git a/LUFA/Drivers/USB/Class/Host/Printer.h b/LUFA/Drivers/USB/Class/Host/Printer.h index 962806e52..f82941905 100644 --- a/LUFA/Drivers/USB/Class/Host/Printer.h +++ b/LUFA/Drivers/USB/Class/Host/Printer.h @@ -264,11 +264,6 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) - /* Macros: */ - #define PRINTER_CLASS 0x07 - #define PRINTER_SUBCLASS 0x01 - #define PRINTER_PROTOCOL 0x02 - /* Function Prototypes: */ #if defined(__INCLUDE_FROM_PRINTER_HOST_C) static uint8_t DCOMP_PRNT_Host_NextPRNTInterface(void* const CurrentDescriptor) ATTR_NON_NULL_PTR_ARG(1); diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.c b/LUFA/Drivers/USB/Class/Host/RNDIS.c index ad242b258..3054d7fc1 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.c @@ -142,9 +142,9 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISControlInterface(void* const CurrentDes USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if ((CurrentInterface->Class == RNDIS_CONTROL_CLASS) && - (CurrentInterface->SubClass == RNDIS_CONTROL_SUBCLASS) && - (CurrentInterface->Protocol == RNDIS_CONTROL_PROTOCOL)) + if ((CurrentInterface->Class == CDC_CSCP_CDCClass) && + (CurrentInterface->SubClass == CDC_CSCP_ACMSubclass) && + (CurrentInterface->Protocol == CDC_CSCP_VendorSpecificProtocol)) { return DESCRIPTOR_SEARCH_Found; } @@ -160,9 +160,9 @@ static uint8_t DCOMP_RNDIS_Host_NextRNDISDataInterface(void* const CurrentDescri USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if ((CurrentInterface->Class == RNDIS_DATA_CLASS) && - (CurrentInterface->SubClass == RNDIS_DATA_SUBCLASS) && - (CurrentInterface->Protocol == RNDIS_DATA_PROTOCOL)) + if ((CurrentInterface->Class == CDC_CSCP_CDCDataClass) && + (CurrentInterface->SubClass == CDC_CSCP_NoDataSubclass) && + (CurrentInterface->Protocol == CDC_CSCP_NoDataProtocol)) { return DESCRIPTOR_SEARCH_Found; } diff --git a/LUFA/Drivers/USB/Class/Host/RNDIS.h b/LUFA/Drivers/USB/Class/Host/RNDIS.h index 2c2aad8df..f79a2c42b 100644 --- a/LUFA/Drivers/USB/Class/Host/RNDIS.h +++ b/LUFA/Drivers/USB/Class/Host/RNDIS.h @@ -262,14 +262,6 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) - /* Macros: */ - #define RNDIS_CONTROL_CLASS 0x02 - #define RNDIS_CONTROL_SUBCLASS 0x02 - #define RNDIS_CONTROL_PROTOCOL 0xFF - #define RNDIS_DATA_CLASS 0x0A - #define RNDIS_DATA_SUBCLASS 0x00 - #define RNDIS_DATA_PROTOCOL 0x00 - /* Function Prototypes: */ #if defined(__INCLUDE_FROM_RNDIS_HOST_C) static uint8_t RNDIS_SendEncapsulatedCommand(USB_ClassInfo_RNDIS_Host_t* const RNDISInterfaceInfo, diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.c b/LUFA/Drivers/USB/Class/Host/StillImage.c index 25c5f20b0..c4cd47e75 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.c +++ b/LUFA/Drivers/USB/Class/Host/StillImage.c @@ -128,9 +128,9 @@ uint8_t DCOMP_SI_Host_NextSIInterface(void* const CurrentDescriptor) USB_Descriptor_Interface_t* CurrentInterface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); - if ((CurrentInterface->Class == STILL_IMAGE_CLASS) && - (CurrentInterface->SubClass == STILL_IMAGE_SUBCLASS) && - (CurrentInterface->Protocol == STILL_IMAGE_PROTOCOL)) + if ((CurrentInterface->Class == SI_CSCP_StillImageClass) && + (CurrentInterface->SubClass == SI_CSCP_StillImageSubclass) && + (CurrentInterface->Protocol == SI_CSCP_BulkOnlyProtocol)) { return DESCRIPTOR_SEARCH_Found; } @@ -196,7 +196,7 @@ uint8_t SI_Host_SendBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, uint8_t SI_Host_ReceiveBlockHeader(USB_ClassInfo_SI_Host_t* const SIInterfaceInfo, PIMA_Container_t* const PIMAHeader) { - uint16_t TimeoutMSRem = COMMAND_DATA_TIMEOUT_MS; + uint16_t TimeoutMSRem = SI_COMMAND_DATA_TIMEOUT_MS; uint16_t PreviousFrameNumber = USB_Host_GetFrameNumber(); if ((USB_HostState != HOST_STATE_Configured) || !(SIInterfaceInfo->State.IsActive)) diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h index 07c6546c2..4367bcea8 100644 --- a/LUFA/Drivers/USB/Class/Host/StillImage.h +++ b/LUFA/Drivers/USB/Class/Host/StillImage.h @@ -311,11 +311,7 @@ /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Macros: */ - #define STILL_IMAGE_CLASS 0x06 - #define STILL_IMAGE_SUBCLASS 0x01 - #define STILL_IMAGE_PROTOCOL 0x01 - - #define COMMAND_DATA_TIMEOUT_MS 10000 + #define SI_COMMAND_DATA_TIMEOUT_MS 10000 /* Function Prototypes: */ #if defined(__INCLUDE_FROM_STILLIMAGE_HOST_C) -- cgit v1.2.3