aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-10-25 12:42:55 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-10-25 12:42:55 +0000
commit55538dcef34bc3c0f2ada4767c51d11202ac0678 (patch)
treef047601bd6ab339511e24acb00801de8fdebc19c /Demos/Host
parentb37d77eab32d171ad7b28157a924a4026e2aebd1 (diff)
downloadlufa-55538dcef34bc3c0f2ada4767c51d11202ac0678.tar.gz
lufa-55538dcef34bc3c0f2ada4767c51d11202ac0678.tar.bz2
lufa-55538dcef34bc3c0f2ada4767c51d11202ac0678.zip
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.
Diffstat (limited to 'Demos/Host')
-rw-r--r--Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c2
-rw-r--r--Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c2
-rw-r--r--Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c2
-rw-r--r--Demos/Host/ClassDriver/MouseHost/MouseHost.c2
-rw-r--r--Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c2
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c2
-rw-r--r--Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h3
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c5
-rw-r--r--Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h6
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c4
-rw-r--r--Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h6
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c9
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h6
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c2
-rw-r--r--Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h4
-rw-r--r--Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c6
-rw-r--r--Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h9
-rw-r--r--Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c30
-rw-r--r--Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c4
-rw-r--r--Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h6
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c5
-rw-r--r--Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h6
-rw-r--r--Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c8
-rw-r--r--Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h13
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c12
-rw-r--r--Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h9
-rw-r--r--Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c8
-rw-r--r--Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h9
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c12
-rw-r--r--Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h18
30 files changed, 63 insertions, 149 deletions
diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
index 8d87e88c2..08117460f 100644
--- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
+++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c
@@ -53,7 +53,7 @@ USB_ClassInfo_HID_Host_t Joystick_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
- .HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
+ .HIDInterfaceProtocol = HID_CSCP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
diff --git a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
index 9b7941e5f..4f7b2b34f 100644
--- a/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
+++ b/Demos/Host/ClassDriver/KeyboardHost/KeyboardHost.c
@@ -50,7 +50,7 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
- .HIDInterfaceProtocol = HID_BOOTP_KeyboardBootProtocol,
+ .HIDInterfaceProtocol = HID_CSCP_KeyboardBootProtocol,
},
};
diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
index 5f10d8bf7..596eccc5a 100644
--- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
+++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c
@@ -53,7 +53,7 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
- .HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
+ .HIDInterfaceProtocol = HID_CSCP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
diff --git a/Demos/Host/ClassDriver/MouseHost/MouseHost.c b/Demos/Host/ClassDriver/MouseHost/MouseHost.c
index c34a2fcb6..ccb42ebb5 100644
--- a/Demos/Host/ClassDriver/MouseHost/MouseHost.c
+++ b/Demos/Host/ClassDriver/MouseHost/MouseHost.c
@@ -50,7 +50,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
- .HIDInterfaceProtocol = HID_BOOTP_MouseBootProtocol,
+ .HIDInterfaceProtocol = HID_CSCP_MouseBootProtocol,
},
};
diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
index 7948e2c49..1e82a662f 100644
--- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
+++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c
@@ -53,7 +53,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
- .HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
+ .HIDInterfaceProtocol = HID_CSCP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
diff --git a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
index 83eb30101..ccae36770 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.c
@@ -139,7 +139,7 @@ uint8_t DComp_NextHIDInterface(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the HID descriptor class, break out if correct class/protocol interface found */
- if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CLASS)
+ if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CSCP_HIDClass)
{
/* Indicate that the descriptor being searched for has been found */
return DESCRIPTOR_SEARCH_Found;
diff --git a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
index bde951439..ebd5a4e31 100644
--- a/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/GenericHIDHost/ConfigDescriptor.h
@@ -42,9 +42,6 @@
#include "GenericHIDHost.h"
/* Macros: */
- /** Interface Class value for the Human Interface Device class. */
- #define HID_CLASS 0x03
-
/** Pipe number for the HID data IN pipe. */
#define HID_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
index 33d77154b..e419e7c35 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.c
@@ -133,9 +133,8 @@ uint8_t DComp_NextJoystickInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
- /* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == JOYSTICK_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == JOYSTICK_PROTOCOL))
+ /* Check the HID descriptor class, break out if correct class interface found */
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CSCP_HIDClass))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
index b40110963..d3461196d 100644
--- a/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/JoystickHostWithParser/ConfigDescriptor.h
@@ -42,12 +42,6 @@
#include "HIDReport.h"
/* Macros: */
- /** Interface Class value for the Human Interface Device class. */
- #define JOYSTICK_CLASS 0x03
-
- /** Interface Protocol value for a Boot Protocol Mouse compliant device. */
- #define JOYSTICK_PROTOCOL 0x02
-
/** Pipe number for the joystick report data pipe. */
#define JOYSTICK_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
index ea42a28ab..bf52a1462 100644
--- a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.c
@@ -119,8 +119,8 @@ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == KEYBOARD_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == KEYBOARD_PROTOCOL))
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CSCP_HIDClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == HID_CSCP_KeyboardBootProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
index 14f691b68..b300c5138 100644
--- a/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/KeyboardHost/ConfigDescriptor.h
@@ -42,12 +42,6 @@
#include "KeyboardHost.h"
/* Macros: */
- /** Interface Class value for the Human Interface Device class. */
- #define KEYBOARD_CLASS 0x03
-
- /** Interface Protocol value for a Boot Protocol Keyboard compliant device. */
- #define KEYBOARD_PROTOCOL 0x01
-
/** Pipe number for the keyboard data IN pipe. */
#define KEYBOARD_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
index dc2daf9ed..132b97bff 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.c
@@ -52,7 +52,7 @@ uint8_t ProcessConfigurationDescriptor(void)
uint16_t CurrConfigBytesRem;
USB_Descriptor_Interface_t* HIDInterface = NULL;
- USB_Descriptor_HID_t* HIDDescriptor = NULL;
+ USB_HID_Descriptor_HID_t* HIDDescriptor = NULL;
USB_Descriptor_Endpoint_t* DataINEndpoint = NULL;
/* Retrieve the entire configuration descriptor into the allocated buffer */
@@ -95,7 +95,7 @@ uint8_t ProcessConfigurationDescriptor(void)
}
/* Save the HID descriptor for later use */
- HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_Descriptor_HID_t);
+ HIDDescriptor = DESCRIPTOR_PCAST(CurrConfigLocation, USB_HID_Descriptor_HID_t);
/* Skip the remainder of the loop as we have not found an endpoint yet */
continue;
@@ -133,9 +133,8 @@ uint8_t DComp_NextKeyboardInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
- /* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == KEYBOARD_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == KEYBOARD_PROTOCOL))
+ /* Check the HID descriptor class, break out if correct class interface found */
+ if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CSCP_HIDClass)
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
index ab04b3105..245b5e30a 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/ConfigDescriptor.h
@@ -42,12 +42,6 @@
#include "HIDReport.h"
/* Macros: */
- /** Interface Class value for the Human Interface Device class. */
- #define KEYBOARD_CLASS 0x03
-
- /** Interface Protocol value for a Boot Protocol Keyboard compliant device. */
- #define KEYBOARD_PROTOCOL 0x01
-
/** Pipe number for the keyboard report data pipe. */
#define KEYBOARD_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c
index d2dde64bd..1366a1e1a 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.c
@@ -51,7 +51,7 @@ uint8_t GetHIDReportData(void)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE),
.bRequest = REQ_GetDescriptor,
- .wValue = (DTYPE_Report << 8),
+ .wValue = (HID_DTYPE_Report << 8),
.wIndex = 0,
.wLength = HIDReportSize,
};
diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h
index cf409caf8..1cb73e372 100644
--- a/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h
+++ b/Demos/Host/LowLevel/KeyboardHostWithParser/HIDReport.h
@@ -41,6 +41,10 @@
#include "KeyboardHostWithParser.h"
+ /* Macros: */
+ /** HID Report Descriptor Usage Page value for a desktop keyboard. */
+ #define USAGE_PAGE_KEYBOARD 0x07
+
/* Enums: */
/** Enum for the possible return codes of the \ref GetHIDReportData() function. */
enum KeyboardHostWithParser_GetHIDReportDataCodes_t
diff --git a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
index 874fa7a3a..2d7248088 100644
--- a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.c
@@ -129,9 +129,9 @@ uint8_t DComp_NextMIDIStreamingInterface(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the MIDI descriptor class, subclass and protocol, break out if correct data interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == MIDI_STREAMING_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == MIDI_STREAMING_SUBCLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MIDI_STREAMING_PROTOCOL))
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == AUDIO_CSCP_AudioClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == AUDIO_CSCP_MIDIStreamingSubclass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == AUDIO_CSCP_StreamingProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
index 57a36d924..2fb9e473e 100644
--- a/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MIDIHost/ConfigDescriptor.h
@@ -42,15 +42,6 @@
#include "MIDIHost.h"
/* Macros: */
- /** Interface Class value for the MIDI Audio class. */
- #define MIDI_STREAMING_CLASS 0x01
-
- /** Interface Class value for the MIDI Audio Streaming subclass. */
- #define MIDI_STREAMING_SUBCLASS 0x03
-
- /** Interface Class value for the MIDI Audio Streaming protocol. */
- #define MIDI_STREAMING_PROTOCOL 0x00
-
/** Pipe number for the MIDI data IN pipe. */
#define MIDI_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
index 1ab70077e..ce616cb2a 100644
--- a/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
+++ b/Demos/Host/LowLevel/MassStorageHost/Lib/MassStoreCommands.c
@@ -189,7 +189,7 @@ static uint8_t MassStore_SendReceiveData(MS_CommandBlockWrapper_t* const SCSICom
uint16_t BytesRem = SCSICommandBlock->DataTransferLength;
/* Check the direction of the SCSI command data stage */
- if (SCSICommandBlock->Flags & COMMAND_DIRECTION_DATA_IN)
+ if (SCSICommandBlock->Flags & MS_COMMAND_DIR_DATA_IN)
{
/* Wait until the device has replied with some data */
if ((ErrorCode = MassStore_WaitForDataReceived()) != PIPE_RWSTREAM_NoError)
@@ -347,9 +347,9 @@ uint8_t MassStore_Inquiry(const uint8_t LUNIndex,
/* Create a CBW with a SCSI command to issue INQUIRY command */
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .Signature = CBW_SIGNATURE,
+ .Signature = MS_CBW_SIGNATURE,
.DataTransferLength = sizeof(SCSI_Inquiry_Response_t),
- .Flags = COMMAND_DIRECTION_DATA_IN,
+ .Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 6,
.SCSICommandData =
@@ -398,9 +398,9 @@ uint8_t MassStore_RequestSense(const uint8_t LUNIndex,
/* Create a CBW with a SCSI command to issue REQUEST SENSE command */
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .Signature = CBW_SIGNATURE,
+ .Signature = MS_CBW_SIGNATURE,
.DataTransferLength = sizeof(SCSI_Request_Sense_Response_t),
- .Flags = COMMAND_DIRECTION_DATA_IN,
+ .Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 6,
.SCSICommandData =
@@ -455,9 +455,9 @@ uint8_t MassStore_ReadDeviceBlock(const uint8_t LUNIndex,
/* Create a CBW with a SCSI command to read in the given blocks from the device */
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .Signature = CBW_SIGNATURE,
+ .Signature = MS_CBW_SIGNATURE,
.DataTransferLength = ((uint32_t)Blocks * BlockSize),
- .Flags = COMMAND_DIRECTION_DATA_IN,
+ .Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 10,
.SCSICommandData =
@@ -516,9 +516,9 @@ uint8_t MassStore_WriteDeviceBlock(const uint8_t LUNIndex,
/* Create a CBW with a SCSI command to write the given blocks to the device */
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .Signature = CBW_SIGNATURE,
+ .Signature = MS_CBW_SIGNATURE,
.DataTransferLength = ((uint32_t)Blocks * BlockSize),
- .Flags = COMMAND_DIRECTION_DATA_OUT,
+ .Flags = MS_COMMAND_DIR_DATA_OUT,
.LUN = LUNIndex,
.SCSICommandLength = 10,
.SCSICommandData =
@@ -569,9 +569,9 @@ uint8_t MassStore_TestUnitReady(const uint8_t LUNIndex)
/* Create a CBW with a SCSI command to issue TEST UNIT READY command */
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .Signature = CBW_SIGNATURE,
+ .Signature = MS_CBW_SIGNATURE,
.DataTransferLength = 0,
- .Flags = COMMAND_DIRECTION_DATA_IN,
+ .Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 6,
.SCSICommandData =
@@ -620,9 +620,9 @@ uint8_t MassStore_ReadCapacity(const uint8_t LUNIndex,
/* Create a CBW with a SCSI command to issue READ CAPACITY command */
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .Signature = CBW_SIGNATURE,
+ .Signature = MS_CBW_SIGNATURE,
.DataTransferLength = sizeof(SCSI_Capacity_t),
- .Flags = COMMAND_DIRECTION_DATA_IN,
+ .Flags = MS_COMMAND_DIR_DATA_IN,
.LUN = LUNIndex,
.SCSICommandLength = 10,
.SCSICommandData =
@@ -680,9 +680,9 @@ uint8_t MassStore_PreventAllowMediumRemoval(const uint8_t LUNIndex,
/* Create a CBW with a SCSI command to issue PREVENT ALLOW MEDIUM REMOVAL command */
MS_CommandBlockWrapper_t SCSICommandBlock = (MS_CommandBlockWrapper_t)
{
- .Signature = CBW_SIGNATURE,
+ .Signature = MS_CBW_SIGNATURE,
.DataTransferLength = 0,
- .Flags = COMMAND_DIRECTION_DATA_OUT,
+ .Flags = MS_COMMAND_DIR_DATA_OUT,
.LUN = LUNIndex,
.SCSICommandLength = 6,
.SCSICommandData =
diff --git a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
index 83e0c5338..3a28802e2 100644
--- a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.c
@@ -120,8 +120,8 @@ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == MOUSE_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MOUSE_PROTOCOL))
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CSCP_HIDClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == HID_CSCP_MouseBootProtocol))
{
/* Indicate that the descriptor being searched for has been found */
return DESCRIPTOR_SEARCH_Found;
diff --git a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
index 57d71e692..d482ad600 100644
--- a/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MouseHost/ConfigDescriptor.h
@@ -42,12 +42,6 @@
#include "MouseHost.h"
/* Macros: */
- /** Interface Class value for the Human Interface Device class. */
- #define MOUSE_CLASS 0x03
-
- /** Interface Protocol value for a Boot Protocol Mouse compliant device. */
- #define MOUSE_PROTOCOL 0x02
-
/** Pipe number for the mouse data IN pipe. */
#define MOUSE_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
index eb85e4a47..033c8ac7f 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.c
@@ -133,9 +133,8 @@ uint8_t DComp_NextMouseInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
- /* Check the HID descriptor class and protocol, break out if correct class/protocol interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == MOUSE_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == MOUSE_PROTOCOL))
+ /* Check the HID descriptor class, break out if correct class interface found */
+ if (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == HID_CSCP_HIDClass)
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
index 2e44b4068..b9d11ad65 100644
--- a/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/MouseHostWithParser/ConfigDescriptor.h
@@ -42,12 +42,6 @@
#include "HIDReport.h"
/* Macros: */
- /** Interface Class value for the Human Interface Device class. */
- #define MOUSE_CLASS 0x03
-
- /** Interface Protocol value for a Boot Protocol Mouse compliant device. */
- #define MOUSE_PROTOCOL 0x02
-
/** Pipe number for the mouse report data pipe. */
#define MOUSE_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
index b269820e4..30096743f 100644
--- a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.c
@@ -132,10 +132,10 @@ uint8_t DComp_NextBidirectionalPrinterInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
- /* Check the descriptor class and protocol, break out if correct class/protocol interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == PRINTER_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == PRINTER_SUBCLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == PRINTER_PROTOCOL))
+ /* Check the descriptor class, subclass and protocol, break out if correct value interface found */
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == PRNT_CSCP_PrinterClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == PRNT_CSCP_PrinterSubclass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == PRNT_CSCP_BidirectionalProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
index b25f3bdc7..9b9750362 100644
--- a/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/PrinterHost/ConfigDescriptor.h
@@ -38,15 +38,6 @@
#include "Lib/PrinterCommands.h"
/* Macros: */
- /** Interface Class value for the Printer Device class. */
- #define PRINTER_CLASS 0x07
-
- /** Interface Subclass value for the Printer Device class. */
- #define PRINTER_SUBCLASS 0x01
-
- /** Interface Protocol value for a Bidirectional communication encapsulation. */
- #define PRINTER_PROTOCOL 0x02
-
/** Pipe number of the Printer data IN pipe. */
#define PRINTER_DATA_IN_PIPE 1
@@ -68,12 +59,12 @@
/** Interface index of the Bidirectional Printer interface within the device, once the Configuration
* Descriptor has been processed.
*/
- uint8_t PrinterInterfaceNumber;
+ extern uint8_t PrinterInterfaceNumber;
/** Interface Alternate Setting index of the Bidirectional Printer interface within the device, once
* the Configuration Descriptor has been processed.
*/
- uint8_t PrinterAltSetting;
+ extern uint8_t PrinterAltSetting;
/* Function Prototypes: */
uint8_t ProcessConfigurationDescriptor(void);
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
index 1190d28b7..88a15c69b 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.c
@@ -160,9 +160,9 @@ uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the CDC descriptor class, subclass and protocol, break out if correct control interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_CONTROL_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CONTROL_SUBCLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CONTROL_PROTOCOL))
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_CSCP_CDCClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CSCP_ACMSubclass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CSCP_VendorSpecificProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
@@ -184,9 +184,9 @@ uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the CDC descriptor class, subclass and protocol, break out if correct data interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_DATA_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_DATA_SUBCLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_DATA_PROTOCOL))
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_CSCP_CDCDataClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CSCP_NoDataSubclass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CSCP_NoDataProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
index 740d73ef0..86ded0587 100644
--- a/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/RNDISEthernetHost/ConfigDescriptor.h
@@ -42,15 +42,6 @@
#include "RNDISEthernetHost.h"
/* Macros: */
- /** Interface Class value for the CDC data class. */
- #define CDC_DATA_CLASS 0x0A
-
- /** Interface Class value for the CDC data subclass. */
- #define CDC_DATA_SUBCLASS 0x00
-
- /** Interface Class value for the CDC data protocol. */
- #define CDC_DATA_PROTOCOL 0x00
-
/** Pipe number for the RNDIS data IN pipe. */
#define RNDIS_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
index 2a00a7361..ebb4002b9 100644
--- a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.c
@@ -143,10 +143,10 @@ uint8_t DComp_NextStillImageInterface(void* CurrentDescriptor)
{
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
- /* Check the descriptor class and protocol, break out if correct class/protocol interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == SIMAGE_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == SIMAGE_SUBCLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == SIMAGE_PROTOCOL))
+ /* Check the descriptor class, subclass and protocol, break out if correct interface found */
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == SI_CSCP_StillImageClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == SI_CSCP_StillImageSubclass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == SI_CSCP_BulkOnlyProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
index bd31c6bf2..082e75e76 100644
--- a/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/StillImageHost/ConfigDescriptor.h
@@ -42,15 +42,6 @@
#include "StillImageHost.h"
/* Macros: */
- /** Interface Class value for the Still Image Device class. */
- #define SIMAGE_CLASS 0x06
-
- /** Interface Class value for the Still Image Device subclass. */
- #define SIMAGE_SUBCLASS 0x01
-
- /** Interface Class value for the Still Image Device protocol. */
- #define SIMAGE_PROTOCOL 0x01
-
/** Pipe number of the Still Image data IN pipe. */
#define SIMAGE_DATA_IN_PIPE 1
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
index 54eb99c84..611399c1e 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.c
@@ -160,9 +160,9 @@ uint8_t DComp_NextCDCControlInterface(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the CDC descriptor class, subclass and protocol, break out if correct control interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_CONTROL_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CONTROL_SUBCLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CONTROL_PROTOCOL))
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_CSCP_CDCClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CSCP_ACMSubclass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CSCP_ATCommandProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
@@ -184,9 +184,9 @@ uint8_t DComp_NextCDCDataInterface(void* CurrentDescriptor)
if (DESCRIPTOR_TYPE(CurrentDescriptor) == DTYPE_Interface)
{
/* Check the CDC descriptor class, subclass and protocol, break out if correct data interface found */
- if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_DATA_CLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_DATA_SUBCLASS) &&
- (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_DATA_PROTOCOL))
+ if ((DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Class == CDC_CSCP_CDCDataClass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).SubClass == CDC_CSCP_NoDataSubclass) &&
+ (DESCRIPTOR_CAST(CurrentDescriptor, USB_Descriptor_Interface_t).Protocol == CDC_CSCP_NoDataProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
index 270e130ae..1da1035a6 100644
--- a/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/VirtualSerialHost/ConfigDescriptor.h
@@ -42,24 +42,6 @@
#include "VirtualSerialHost.h"
/* Macros: */
- /** Interface Class value for the CDC class. */
- #define CDC_CONTROL_CLASS 0x02
-
- /** Interface Class value for the CDC Communication Interface subclass. */
- #define CDC_CONTROL_SUBCLASS 0x02
-
- /** Interface Class value for the CDC protocol. */
- #define CDC_CONTROL_PROTOCOL 0x01
-
- /** Interface Class value for the CDC data class. */
- #define CDC_DATA_CLASS 0x0A
-
- /** Interface Class value for the CDC data subclass. */
- #define CDC_DATA_SUBCLASS 0x00
-
- /** Interface Class value for the CDC data protocol. */
- #define CDC_DATA_PROTOCOL 0x00
-
/** Pipe number for the CDC data IN pipe. */
#define CDC_DATA_IN_PIPE 1