Commit afe6ae14 authored by Dean Camera's avatar Dean Camera
Browse files

Add host mode USB Class driver stubs, add beginnings of a CDC host class driver.

Split out common defines/types from class drivers into a seperate common class driver directory.

Make central USB Class driver dispatch headers, used for both device and host modes.
parent 9fdc53d7
......@@ -28,6 +28,9 @@
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "Audio.h"
void Audio_Device_ProcessControlPacket(USB_ClassInfo_Audio_t* AudioInterfaceInfo)
......@@ -157,3 +160,5 @@ bool Audio_Device_IsReadyForNextSample(USB_ClassInfo_Audio_t* AudioInterfaceInfo
Endpoint_SelectEndpoint(AudioInterfaceInfo->DataINEndpointNumber);
return Endpoint_IsINReady();
}
#endif
\ No newline at end of file
This diff is collapsed.
......@@ -28,7 +28,10 @@
this software.
*/
#define INCLUDE_FROM_CDC_CLASS_C
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_CDC_CLASS_DEVICE_C
#include "CDC.h"
void CDC_Device_Event_Stub(void)
......@@ -195,3 +198,5 @@ void CDC_Device_SendControlLineStateChange(USB_ClassInfo_CDC_t* CDCInterfaceInfo
Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask), NO_STREAM_CALLBACK);
Endpoint_ClearIN();
}
#endif
......@@ -28,25 +28,21 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassCDCDevice CDC Device Class Driver - LUFA/Drivers/Class/Device/CDC.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/CDC.c
/** \ingroup Group_USBClassCDC
* @defgroup Group_USBClassCDCDevice CDC Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB CDC Class interfaces
* within a USB device, for the implementation of CDC-ACM virtual serial ports.
* Device Mode USB Class driver framework interface, for the CDC USB Class driver.
*
* @{
*/
#ifndef _CDC_CLASS_H_
#define _CDC_CLASS_H_
#ifndef _CDC_CLASS_DEVICE_H_
#define _CDC_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/CDC.h"
#include <string.h>
......@@ -55,137 +51,8 @@
extern "C" {
#endif
/* Macros: */
/** CDC Class specific request to get the current virtual serial port configuration settings. */
#define REQ_GetLineEncoding 0x21
/** CDC Class specific request to set the current virtual serial port configuration settings. */
#define REQ_SetLineEncoding 0x20
/** CDC Class specific request to set the current virtual serial port handshake line states. */
#define REQ_SetControlLineState 0x22
/** Notification type constant for a change in the virtual serial port handshake line states, for
* use with a USB_Notification_Header_t notification structure when sent to the host via the CDC
* notification endpoint.
*/
#define NOTIF_SerialState 0x20
/** Mask for the DTR handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that the DTR line state should be high.
*/
#define CDC_CONTROL_LINE_OUT_DTR (1 << 0)
/** Mask for the RTS handshake line for use with the REQ_SetControlLineState class specific request
* from the host, to indicate that theRTS line state should be high.
*/
#define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
/** Mask for the DCD handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DCD line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_DCD (1 << 0)
/** Mask for the DSR handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the DSR line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_DSR (1 << 1)
/** Mask for the BREAK handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the BREAK line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_BREAK (1 << 2)
/** Mask for the RING handshake line for use with the a NOTIF_SerialState class specific notification
* from the device to the host, to indicate that the RING line state is currently high.
*/
#define CDC_CONTROL_LINE_IN_RING (1 << 3)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a framing error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a parity error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5)
/** Mask for use with the a NOTIF_SerialState class specific notification from the device to the host,
* to indicate that a data overrun error has occurred on the virtual serial port.
*/
#define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
/** Macro to define a CDC class-specific functional descriptor. CDC functional descriptors have a
* uniform structure but variable sized data payloads, thus cannot be represented accurately by
* a single typedef struct. A macro is used instead so that functional descriptors can be created
* easily by specifying the size of the payload. This allows sizeof() to work correctly.
*
* \param DataSize Size in bytes of the CDC functional descriptor's data payload
*/
#define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \
struct \
{ \
USB_Descriptor_Header_t Header; \
uint8_t SubType; \
uint8_t Data[DataSize]; \
}
/* Enums: */
/** Enum for the possible line encoding formats of a virtual serial port. */
enum CDCDevice_CDC_LineCodingFormats_t
{
CDC_LINEENCODING_OneStopBit = 0, /**< Each frame contains one stop bit */
CDC_LINEENCODING_OneAndAHalfStopBits = 1, /**< Each frame contains one and a half stop bits */
CDC_LINEENCODING_TwoStopBits = 2, /**< Each frame contains two stop bits */
};
/** Enum for the possible line encoding parity settings of a virtual serial port. */
enum CDCDevice_LineCodingParity_t
{
CDC_PARITY_None = 0, /**< No parity bit mode on each frame */
CDC_PARITY_Odd = 1, /**< Odd parity bit mode on each frame */
CDC_PARITY_Even = 2, /**< Even parity bit mode on each frame */
CDC_PARITY_Mark = 3, /**< Mark parity bit mode on each frame */
CDC_PARITY_Space = 4, /**< Space parity bit mode on each frame */
};
/* Type Defines: */
/** Class state structure. An instance of this structure should be made for each CDC interface
* within the user application, and passed to each of the CDC class driver functions as the
* CDCInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t ControlInterfaceNumber; /**< Interface number of the CDC control interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the CDC interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the CDC interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the CDC interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the CDC interface's OUT data endpoint */
uint8_t NotificationEndpointNumber; /**< Endpoint number of the CDC interface's IN notification endpoint, if used */
uint16_t NotificationEndpointSize; /**< Size in bytes of the CDC interface's IN notification endpoint, if used */
uint8_t ControlLineState; /**< Current control line states, as set by the host */
struct
{
uint32_t BaudRateBPS; /**< Baud rate of the virtual serial port, in bits per second */
uint8_t CharFormat; /**< Character format of the virtual serial port, a value from the
* CDCDevice_CDC_LineCodingFormats_t enum
*/
uint8_t ParityType; /**< Parity setting of the virtual serial port, a value from the
* CDCDevice_LineCodingParity_t enum
*/
uint8_t DataBits; /**< Bits of data per character of the virtual serial port */
} LineEncoding;
} USB_ClassInfo_CDC_t;
/* Function Prototypes: */
#if defined(INCLUDE_FROM_CDC_CLASS_C)
#if defined(INCLUDE_FROM_CDC_CLASS_DEVICE_C)
void CDC_Device_Event_Stub(void);
void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_t* CDCInterfaceInfo)
ATTR_WEAK ATTR_ALIAS(CDC_Device_Event_Stub);
......
......@@ -28,6 +28,9 @@
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "HID.h"
void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_t* HIDInterfaceInfo)
......@@ -172,3 +175,5 @@ void HID_Device_USBTask(USB_ClassInfo_HID_t* HIDInterfaceInfo)
Endpoint_ClearIN();
}
}
#endif
......@@ -28,25 +28,21 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassHIDDevice HID Device Class Driver - LUFA/Drivers/Class/Device/HID.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/HID.c
/** \ingroup Group_USBClassHID
* @defgroup Group_USBClassHIDDevice HID Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB HID Class interfaces
* within a USB device.
* Device Mode USB Class driver framework interface, for the HID USB Class driver.
*
* @{
*/
#ifndef _HID_CLASS_H_
#define _HID_CLASS_H_
#ifndef _HID_CLASS_DEVICE_H_
#define _HID_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/HID.h"
#include <string.h>
......@@ -55,73 +51,6 @@
extern "C" {
#endif
/* Macros: */
/** HID Class Specific Request to get the current HID report from the device. */
#define REQ_GetReport 0x01
/** HID Class Specific Request to get the current device idle count. */
#define REQ_GetIdle 0x02
/** HID Class Specific Request to set the current HID report to the device. */
#define REQ_SetReport 0x09
/** HID Class Specific Request to set the device's idle count. */
#define REQ_SetIdle 0x0A
/** HID Class Specific Request to get the current HID report protocol mode. */
#define REQ_GetProtocol 0x03
/** HID Class Specific Request to set the current HID report protocol mode. */
#define REQ_SetProtocol 0x0B
/** Descriptor header type value, to indicate a HID class HID descriptor. */
#define DTYPE_HID 0x21
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
/* Type Defines: */
/** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID
* specification for details on the structure elements.
*/
typedef struct
{
USB_Descriptor_Header_t Header;
uint16_t HIDSpec;
uint8_t CountryCode;
uint8_t TotalReportDescriptors;
uint8_t HIDReportType;
uint16_t HIDReportLength;
} USB_Descriptor_HID_t;
/** Type define for the data type used to store HID report descriptor elements. */
typedef uint8_t USB_Descriptor_HIDReport_Datatype_t;
/** Class state structure. An instance of this structure should be made for each HID interface
* within the user application, and passed to each of the HID class driver functions as the
* HIDInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*
* Note that for the HID class driver, host-to-device reports are received via HID class requests
* rather than a dedicated endpoint to simplify the driver and its interface.
*/
typedef struct
{
uint8_t InterfaceNumber; /**< Interface number of the HID interface within the device */
uint8_t ReportINEndpointNumber; /**< Endpoint number of the HID interface's IN report endpoint */
uint16_t ReportINEndpointSize; /**< Size in bytes of the HID interface's IN report endpoint */
uint8_t ReportINBufferSize; /**< Size of the largest possible report to send to the host, for buffer allocation purposes */
bool UsingReportProtocol; /**< Indicates if the HID interface is set to Boot or Report protocol mode */
uint16_t IdleCount; /**< Report idle period, in ms, set by the host */
uint16_t IdleMSRemaining; /**< Total number of ms remaining before the idle period elapses */
} USB_ClassInfo_HID_t;
/* Function Prototypes: */
/** Configures the endpoints of a given HID interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration
......
......@@ -28,6 +28,9 @@
this software.
*/
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#include "MIDI.h"
void MIDI_Device_ProcessControlPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo)
......@@ -94,3 +97,5 @@ bool MIDI_Device_ReceiveEventPacket(USB_ClassInfo_MIDI_t* MIDIInterfaceInfo, USB
return true;
}
#endif
......@@ -28,26 +28,21 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassMIDIDevice MIDI Device Class Driver - LUFA/Drivers/Class/Device/MIDI.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/MIDI.c
/** \ingroup Group_USBClassMIDI
* @defgroup Group_USBClassMIDIDevice MIDI Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB MIDI Class interfaces
* within a USB device. Note that the MIDI class is actually a special case of the regular Audio class,
* thus this module depends on structure definitions from the \ref Group_USBClassAudioDevice class driver module.
* Device Mode USB Class driver framework interface, for the MIDI USB Class driver.
*
* @{
*/
#ifndef _MIDI_CLASS_H_
#define _MIDI_CLASS_H_
#ifndef _MIDI_CLASS_DEVICE_H_
#define _MIDI_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/MIDI.h"
#include "Audio.h"
#include <string.h>
......@@ -57,121 +52,6 @@
extern "C" {
#endif
/* Macros: */
/** Audio class descriptor subtype value for a Audio class specific MIDI input jack descriptor. */
#define DSUBTYPE_InputJack 0x02
/** Audio class descriptor subtype value for a Audio class specific MIDI output jack descriptor. */
#define DSUBTYPE_OutputJack 0x03
/** Audio class descriptor jack type value for an embedded (logical) MIDI input or output jack. */
#define MIDI_JACKTYPE_EMBEDDED 0x01
/** Audio class descriptor jack type value for an external (physical) MIDI input or output jack. */
#define MIDI_JACKTYPE_EXTERNAL 0x02
/** MIDI command for a note on (activation) event */
#define MIDI_COMMAND_NOTE_ON 0x09
/** MIDI command for a note off (deactivation) event */
#define MIDI_COMMAND_NOTE_OFF 0x08
/** Standard key press velocity value used for all note events */
#define MIDI_STANDARD_VELOCITY 64
/** Convenience macro. MIDI channels are numbered from 1-10 (natural numbers) however the logical channel
* addresses are zero-indexed. This converts a natural MIDI channel number into the logical channel address.
*
* \param channel MIDI channel number to address
*/
#define MIDI_CHANNEL(channel) (channel - 1)
/* Type Defines: */
/** Type define for an Audio class specific MIDI streaming interface descriptor. This indicates to the host
* how MIDI the specification compliance of the device and the total length of the Audio class specific descriptors.
* See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint16_t AudioSpecification; /**< Binary coded decimal value, indicating the supported Audio Class specification version */
uint16_t TotalLength; /**< Total length of the Audio class specific descriptors, including this descriptor */
} USB_AudioInterface_MIDI_AS_t;
/** Type define for an Audio class specific MIDI IN jack. This gives information to the host on a MIDI input, either
* a physical input jack, or a logical jack (receiving input data internally, or from the host via an endpoint).
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_MIDI_In_Jack_t;
/** Type define for an Audio class specific MIDI OUT jack. This gives information to the host on a MIDI output, either
* a physical output jack, or a logical jack (sending output data internally, or to the host via an endpoint).
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t JackType; /**< Type of jack, one of the JACKTYPE_* mask values */
uint8_t JackID; /**< ID value of this jack - must be a unique value within the device */
uint8_t NumberOfPins; /**< Number of output channels within the jack, either physical or logical */
uint8_t SourceJackID[1]; /**< ID of each output pin's source data jack */
uint8_t SourcePinID[1]; /**< Pin number in the input jack of each output pin's source data */
uint8_t JackStrIndex; /**< Index of a string descriptor describing this descriptor within the device */
} USB_MIDI_Out_Jack_t;
/** Type define for an Audio class specific extended MIDI jack endpoint descriptor. This contains extra information
* on the usage of MIDI endpoints used to stream MIDI events in and out of the USB Audio device, and follows an Audio
* class specific extended MIDI endpoint descriptor. See the USB Audio specification for more details.
*/
typedef struct
{
USB_Descriptor_Header_t Header; /**< Regular descriptor header containing the descriptor's type and length */
uint8_t Subtype; /**< Sub type value used to distinguish between audio class specific descriptors */
uint8_t TotalEmbeddedJacks; /**< Total number of jacks inside this endpoint */
uint8_t AssociatedJackID[1]; /**< IDs of each jack inside the endpoint */
} USB_MIDI_Jack_Endpoint_t;
/** Type define for a USB MIDI event packet, used to encapsulate sent and received MIDI messages from a USB MIDI interface. */
typedef struct
{
unsigned char Command : 4; /**< MIDI command being sent or received in the event packet */
unsigned char CableNumber : 4; /**< Virtual cable number of the event being sent or received in the given MIDI interface */
uint8_t Data1; /**< First byte of data in the MIDI event */
uint8_t Data2; /**< Second byte of data in the MIDI event */
uint8_t Data3; /**< Third byte of data in the MIDI event */
} USB_MIDI_EventPacket_t;
/** Class state structure. An instance of this structure should be made for each MIDI interface
* within the user application, and passed to each of the MIDI class driver functions as the
* MIDIInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t StreamingInterfaceNumber; /**< Index of the Audio Streaming interface within the device this structure controls */
uint8_t DataINEndpointNumber; /**< Endpoint number of the incomming MIDI data, if available (zero if unused) */
uint16_t DataINEndpointSize; /**< Size in bytes of the incomming MIDI data endpoint, if available (zero if unused) */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the outgoing MIDI data, if available (zero if unused) */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the outgoing MIDI data endpoint, if available (zero if unused) */
} USB_ClassInfo_MIDI_t;
/* Function Prototypes: */
/** Configures the endpoints of a given MIDI interface, ready for use. This should be linked to the library
* \ref EVENT_USB_ConfigurationChanged() event so that the endpoints are configured when the configuration
......
......@@ -28,7 +28,10 @@
this software.
*/
#define INCLUDE_FROM_MS_CLASS_C
#include "../../HighLevel/USBMode.h"
#if defined(USB_CAN_BE_DEVICE)
#define INCLUDE_FROM_MS_CLASS_DEVICE_C
#include "MassStorage.h"
static USB_ClassInfo_MS_t* CallbackMSInterfaceInfo;
......@@ -206,3 +209,5 @@ static uint8_t StreamCallback_MS_Device_AbortOnMassStoreReset(void)
else
return STREAMCALLBACK_Continue;
}
#endif
......@@ -28,25 +28,21 @@
this software.
*/
/** \ingroup Group_USBDeviceClassDrivers
* @defgroup Group_USBClassMSDevice Mass Storage Device Class Driver - LUFA/Drivers/Class/Device/MassStorage.h
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/MassStorage.c
/** \ingroup Group_USBClassMS
* @defgroup Group_USBClassMSDevice Mass Storage Class Device Mode Driver
*
* \section Module Description
* Functions, macros, variables, enums and types related to the management of USB Mass Storage Class interfaces
* within a USB device.
* Device Mode USB Class driver framework interface, for the Mass Storage USB Class driver.
*
* @{
*/
#ifndef _MS_CLASS_H_
#define _MS_CLASS_H_
#ifndef _MS_CLASS_DEVICE_H_
#define _MS_CLASS_DEVICE_H_
/* Includes: */
#include "../../USB.h"
#include "../Common/MassStorage.h"
#include <string.h>
......@@ -55,88 +51,8 @@
extern "C" {
#endif
/* Macros: */
/** Mass Storage Class specific request to reset the Mass Storage interface, ready for the next command. */
#define REQ_MassStorageReset 0xFF
/** Mass Storage Class specific request to retrieve the total number of Logical Units (drives) in the SCSI device. */
#define REQ_GetMaxLUN 0xFE
/** Magic signature for a Command Block Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define MS_CBW_SIGNATURE 0x43425355UL
/** Magic signature for a Command Status Wrapper used in the Mass Storage Bulk-Only transport protocol. */
#define MS_CSW_SIGNATURE 0x53425355UL
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from host-to-device. */
#define MS_COMMAND_DIR_DATA_OUT (0 << 7)
/** Mask for a Command Block Wrapper's flags attribute to specify a command with data sent from device-to-host. */
#define MS_COMMAND_DIR_DATA_IN (1 << 7)
/* Type defines: */
/** Type define for a Command Block Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct
{
uint32_t Signature; /**< Command block signature, must be CBW_SIGNATURE to indicate a valid Command Block */
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
uint32_t DataTransferLength; /** Length of the optional data portion of the issued command, in bytes */
uint8_t Flags; /**< Command block flags, indicating command data direction */
uint8_t LUN; /**< Logical Unit number this command is issued to */
uint8_t SCSICommandLength; /**< Length of the issued SCSI command within the SCSI command data array */
uint8_t SCSICommandData[16]; /**< Issued SCSI command in the Command Block */
} CommandBlockWrapper_t;
/** Type define for a Command Status Wrapper, used in the Mass Storage Bulk-Only Transport protocol. */
typedef struct
{
uint32_t Signature; /**< Status block signature, must be CSW_SIGNATURE to indicate a valid Command Status */
uint32_t Tag; /**< Unique command ID value, to associate a command block wrapper with its command status wrapper */
uint32_t DataTransferResidue; /**< Number of bytes of data not processed in the SCSI command */
uint8_t Status; /**< Status code of the issued command - a value from the MassStorage_CommandStatusCodes_t enum */
} CommandStatusWrapper_t;
/* Enums: */
/** Enum for the possible command status wrapper return status codes. */
enum MassStorage_CommandStatusCodes_t
{
SCSI_Command_Pass = 0, /**< Command completed with no error */
SCSI_Command_Fail = 1, /**< Command failed to complete - host may check the exact error via a SCSI REQUEST SENSE command */
SCSI_Phase_Error = 2 /**< Command failed due to being invalid in the current phase */
};
/* Type Defines: */
/** Class state structure. An instance of this structure should be made for each Mass Storage interface
* within the user application, and passed to each of the Mass Storage class driver functions as the
* MSInterfaceInfo parameter. The contents of this structure should be set to their correct
* values when used, or ommitted to force the library to use default values.
*/
typedef struct
{
uint8_t InterfaceNumber; /**< Interface number of the Mass Storage interface within the device */
uint8_t DataINEndpointNumber; /**< Endpoint number of the Mass Storage interface's IN data endpoint */
uint16_t DataINEndpointSize; /**< Size in bytes of the Mass Storage interface's IN data endpoint */
uint8_t DataOUTEndpointNumber; /**< Endpoint number of the Mass Storage interface's OUT data endpoint */
uint16_t DataOUTEndpointSize; /**< Size in bytes of the Mass Storage interface's OUT data endpoint */
uint8_t TotalLUNs; /**< Total number of logical drives in the Mass Storage interface */
CommandBlockWrapper_t CommandBlock; /**< Mass Storage class command block structure, used internally
* by the class driver
*/
CommandStatusWrapper_t CommandStatus; /**< Mass Storage class command status structure, used i