Open FFBoard
Open source force feedback firmware
msc.h File Reference

Go to the source code of this file.

Classes

struct  TU_ATTR_PACKED
 AUDIO Channel Cluster Descriptor (4.1) More...
 
struct  scsi_read_capacity10_resp_t
 SCSI Read Capacity 10 Response Data. More...
 

Typedefs

typedef struct TU_ATTR_PACKED msc_cbw_t
 Command Block Wrapper. More...
 
typedef struct TU_ATTR_PACKED msc_csw_t
 Command Status Wrapper. More...
 
typedef struct TU_ATTR_PACKED scsi_test_unit_ready_t
 SCSI Test Unit Ready Command. More...
 
typedef struct TU_ATTR_PACKED scsi_inquiry_t
 SCSI Inquiry Command. More...
 
typedef struct TU_ATTR_PACKED scsi_request_sense_t
 
typedef struct TU_ATTR_PACKED scsi_inquiry_resp_t
 SCSI Inquiry Response Data. More...
 
typedef struct TU_ATTR_PACKED scsi_sense_fixed_resp_t
 
typedef struct TU_ATTR_PACKED scsi_mode_sense6_t
 
typedef struct TU_ATTR_PACKED scsi_mode_sense6_resp_t
 
typedef struct TU_ATTR_PACKED scsi_prevent_allow_medium_removal_t
 
typedef struct TU_ATTR_PACKED scsi_start_stop_unit_t
 
typedef struct TU_ATTR_PACKED scsi_read_format_capacity_t
 SCSI Read Format Capacity: Write Capacity. More...
 
typedef struct TU_ATTR_PACKED scsi_read_format_capacity_data_t
 
typedef struct TU_ATTR_PACKED scsi_read_capacity10_t
 SCSI Read Capacity 10 Command: Read Capacity. More...
 
typedef struct TU_ATTR_PACKED scsi_read10_t
 SCSI Read 10 Command. More...
 
typedef struct TU_ATTR_PACKED scsi_write10_t
 

Enumerations

enum  { MSC_CBW_SIGNATURE = 0x43425355 , MSC_CSW_SIGNATURE = 0x53425355 }
 
enum  msc_protocol_type_t { MSC_PROTOCOL_CBI = 0 , MSC_PROTOCOL_CBI_NO_INTERRUPT = 1 , MSC_PROTOCOL_BOT = 0x50 }
 MassStorage Protocol. More...
 
enum  msc_request_type_t { MSC_REQ_GET_MAX_LUN = 254 , MSC_REQ_RESET = 255 }
 MassStorage Class-Specific Control Request. More...
 
enum  msc_csw_status_t { MSC_CSW_STATUS_PASSED = 0 , MSC_CSW_STATUS_FAILED , MSC_CSW_STATUS_PHASE_ERROR }
 Command Block Status Values. More...
 
enum  scsi_cmd_type_t {
  SCSI_CMD_TEST_UNIT_READY = 0x00 , SCSI_CMD_INQUIRY = 0x12 , SCSI_CMD_MODE_SELECT_6 = 0x15 , SCSI_CMD_MODE_SENSE_6 = 0x1A ,
  SCSI_CMD_START_STOP_UNIT = 0x1B , SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E , SCSI_CMD_READ_CAPACITY_10 = 0x25 , SCSI_CMD_REQUEST_SENSE = 0x03 ,
  SCSI_CMD_READ_FORMAT_CAPACITY = 0x23 , SCSI_CMD_READ_10 = 0x28 , SCSI_CMD_WRITE_10 = 0x2A
}
 SCSI Command Operation Code. More...
 
enum  scsi_sense_key_type_t {
  SCSI_SENSE_NONE = 0x00 , SCSI_SENSE_RECOVERED_ERROR = 0x01 , SCSI_SENSE_NOT_READY = 0x02 , SCSI_SENSE_MEDIUM_ERROR = 0x03 ,
  SCSI_SENSE_HARDWARE_ERROR = 0x04 , SCSI_SENSE_ILLEGAL_REQUEST = 0x05 , SCSI_SENSE_UNIT_ATTENTION = 0x06 , SCSI_SENSE_DATA_PROTECT = 0x07 ,
  SCSI_SENSE_FIRMWARE_ERROR = 0x08 , SCSI_SENSE_ABORTED_COMMAND = 0x0b , SCSI_SENSE_EQUAL = 0x0c , SCSI_SENSE_VOLUME_OVERFLOW = 0x0d ,
  SCSI_SENSE_MISCOMPARE = 0x0e
}
 SCSI Sense Key. More...
 

Functions

 TU_VERIFY_STATIC (sizeof(msc_cbw_t)==31, "size is not correct")
 
 TU_VERIFY_STATIC (sizeof(scsi_read_capacity10_resp_t)==8, "size is not correct")
 

Variables

 C
 

Typedef Documentation

◆ msc_cbw_t

typedef struct TU_ATTR_PACKED msc_cbw_t

Command Block Wrapper.

◆ msc_csw_t

typedef struct TU_ATTR_PACKED msc_csw_t

Command Status Wrapper.

◆ scsi_inquiry_resp_t

SCSI Inquiry Response Data.

◆ scsi_inquiry_t

SCSI Inquiry Command.

◆ scsi_mode_sense6_resp_t

◆ scsi_mode_sense6_t

◆ scsi_prevent_allow_medium_removal_t

◆ scsi_read10_t

typedef struct TU_ATTR_PACKED scsi_read10_t

SCSI Read 10 Command.

◆ scsi_read_capacity10_t

SCSI Read Capacity 10 Command: Read Capacity.

◆ scsi_read_format_capacity_data_t

◆ scsi_read_format_capacity_t

SCSI Read Format Capacity: Write Capacity.

◆ scsi_request_sense_t

◆ scsi_sense_fixed_resp_t

◆ scsi_start_stop_unit_t

◆ scsi_test_unit_ready_t

SCSI Test Unit Ready Command.

◆ scsi_write10_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MSC_CBW_SIGNATURE 

Constant value of 43425355h (little endian)

MSC_CSW_SIGNATURE 

Constant value of 53425355h (little endian)

Definition at line 50 of file msc.h.

◆ msc_csw_status_t

Command Block Status Values.

Indicates the success or failure of the command. The device shall set this byte to zero if the command completed successfully. A non-zero value shall indicate a failure during command execution according to the following

Enumerator
MSC_CSW_STATUS_PASSED 

MSC_CSW_STATUS_PASSED.

MSC_CSW_STATUS_FAILED 

MSC_CSW_STATUS_FAILED.

MSC_CSW_STATUS_PHASE_ERROR 

MSC_CSW_STATUS_PHASE_ERROR.

Definition at line 74 of file msc.h.

◆ msc_protocol_type_t

MassStorage Protocol.

CBI only approved to use with full-speed floppy disk & should not used with highspeed or device other than floppy

Enumerator
MSC_PROTOCOL_CBI 

Control/Bulk/Interrupt protocol (with command completion interrupt)

MSC_PROTOCOL_CBI_NO_INTERRUPT 

Control/Bulk/Interrupt protocol (without command completion interrupt)

MSC_PROTOCOL_BOT 

Bulk-Only Transport.

Definition at line 57 of file msc.h.

◆ msc_request_type_t

MassStorage Class-Specific Control Request.

Enumerator
MSC_REQ_GET_MAX_LUN 

The Get Max LUN device request is used to determine the number of logical units supported by the device. Logical Unit Numbers on the device shall be numbered contiguously starting from LUN 0 to a maximum LUN of 15.

MSC_REQ_RESET 

This request is used to reset the mass storage device and its associated interface. This class-specific request shall ready the device for the next CBW from the host.

Definition at line 65 of file msc.h.

◆ scsi_cmd_type_t

SCSI Command Operation Code.

Enumerator
SCSI_CMD_TEST_UNIT_READY 

The SCSI Test Unit Ready command is used to determine if a device is ready to transfer data (read/write), i.e. if a disk has spun up, if a tape is loaded and ready etc. The device does not perform a self-test operation.

SCSI_CMD_INQUIRY 

The SCSI Inquiry command is used to obtain basic information from a target device.

SCSI_CMD_MODE_SELECT_6 

provides a means for the application client to specify medium, logical unit, or peripheral device parameters to the device server. Device servers that implement the MODE SELECT(6) command shall also implement the MODE SENSE(6) command. Application clients should issue MODE SENSE(6) prior to each MODE SELECT(6) to determine supported mode pages, page lengths, and other parameters.

SCSI_CMD_MODE_SENSE_6 

provides a means for a device server to report parameters to an application client. It is a complementary command to the MODE SELECT(6) command. Device servers that implement the MODE SENSE(6) command shall also implement the MODE SELECT(6) command.

SCSI_CMD_START_STOP_UNIT 
SCSI_CMD_PREVENT_ALLOW_MEDIUM_REMOVAL 
SCSI_CMD_READ_CAPACITY_10 

The SCSI Read Capacity command is used to obtain data capacity information from a target device.

SCSI_CMD_REQUEST_SENSE 

The SCSI Request Sense command is part of the SCSI computer protocol standard. This command is used to obtain sense data – status/error information – from a target device.

SCSI_CMD_READ_FORMAT_CAPACITY 

The command allows the Host to request a list of the possible format capacities for an installed writable media. This command also has the capability to report the writable capacity for a media when it is installed.

SCSI_CMD_READ_10 

The READ (10) command requests that the device server read the specified logical block(s) and transfer them to the data-in buffer.

SCSI_CMD_WRITE_10 

The WRITE (10) command requests that the device server transfer the specified logical block(s) from the data-out buffer and write them.

Definition at line 111 of file msc.h.

◆ scsi_sense_key_type_t

SCSI Sense Key.

Enumerator
SCSI_SENSE_NONE 

no specific Sense Key. This would be the case for a successful command

SCSI_SENSE_RECOVERED_ERROR 

Indicates the last command completed successfully with some recovery action performed by the disc drive.

SCSI_SENSE_NOT_READY 

Indicates the logical unit addressed cannot be accessed.

SCSI_SENSE_MEDIUM_ERROR 

Indicates the command terminated with a non-recovered error condition.

SCSI_SENSE_HARDWARE_ERROR 

Indicates the disc drive detected a nonrecoverable hardware failure while performing the command or during a self test.

SCSI_SENSE_ILLEGAL_REQUEST 

Indicates an illegal parameter in the command descriptor block or in the additional parameters.

SCSI_SENSE_UNIT_ATTENTION 

Indicates the disc drive may have been reset.

SCSI_SENSE_DATA_PROTECT 

Indicates that a command that reads or writes the medium was attempted on a block that is protected from this operation. The read or write operation is not performed.

SCSI_SENSE_FIRMWARE_ERROR 

Vendor specific sense key.

SCSI_SENSE_ABORTED_COMMAND 

Indicates the disc drive aborted the command.

SCSI_SENSE_EQUAL 

Indicates a SEARCH DATA command has satisfied an equal comparison.

SCSI_SENSE_VOLUME_OVERFLOW 

Indicates a buffered peripheral device has reached the end of medium partition and data remains in the buffer that has not been written to the medium.

SCSI_SENSE_MISCOMPARE 

Indicates that the source data did not match the data read from the medium.

Definition at line 127 of file msc.h.

Function Documentation

◆ TU_VERIFY_STATIC() [1/2]

TU_VERIFY_STATIC ( sizeof(msc_cbw_t = =31,
"size is not correct"   
)

◆ TU_VERIFY_STATIC() [2/2]

TU_VERIFY_STATIC ( sizeof(scsi_read_capacity10_resp_t = =8,
"size is not correct"   
)

Variable Documentation

◆ C

C
extern
Initial value:
{
#endif
typedef enum
{
MSC_SUBCLASS_RBC = 1 ,
MSC_SUBCLASS_SFF_MMC ,
MSC_SUBCLASS_QIC ,
MSC_SUBCLASS_UFI ,
MSC_SUBCLASS_SFF ,
MSC_SUBCLASS_SCSI
}msc_subclass_type_t