Fork of Smoothie to port to mbed non-LPC targets.

Dependencies:   mbed

Fork of Smoothie by Stéphane Cachat

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers descriptor_msc.h Source File

descriptor_msc.h

00001 #ifndef _DESCRIPTOR_MSC_H
00002 #define _DESCRIPTOR_MSC_H
00003 
00004 /* MSC Subclass Codes */
00005 #define MSC_SUBCLASS_RBC                0x01
00006 #define MSC_SUBCLASS_SFF8020I_MMC2      0x02
00007 #define MSC_SUBCLASS_QIC157             0x03
00008 #define MSC_SUBCLASS_UFI                0x04
00009 #define MSC_SUBCLASS_SFF8070I           0x05
00010 #define MSC_SUBCLASS_SCSI               0x06
00011 
00012 /* MSC Protocol Codes */
00013 #define MSC_PROTOCOL_CBI_INT            0x00
00014 #define MSC_PROTOCOL_CBI_NOINT          0x01
00015 #define MSC_PROTOCOL_BULK_ONLY          0x50
00016 
00017 /* MSC Request Codes */
00018 #define MSC_REQUEST_RESET               0xFF
00019 #define MSC_REQUEST_GET_MAX_LUN         0xFE
00020 
00021 /* MSC Bulk-only Stage */
00022 #define MSC_BS_CBW                      0       /* Command Block Wrapper */
00023 #define MSC_BS_DATA_OUT                 1       /* Data Out Phase */
00024 #define MSC_BS_DATA_IN                  2       /* Data In Phase */
00025 #define MSC_BS_DATA_IN_LAST             3       /* Data In Last Phase */
00026 #define MSC_BS_DATA_IN_LAST_STALL       4       /* Data In Last Phase with Stall */
00027 #define MSC_BS_CSW                      5       /* Command Status Wrapper */
00028 #define MSC_BS_ERROR                    6       /* Error */
00029 
00030 /* Bulk-only Command Block Wrapper */
00031 typedef struct __attribute__ ((packed)) {
00032     uint32_t dSignature;
00033     uint32_t dTag;
00034     uint32_t dDataLength;
00035     uint8_t  bmFlags;
00036     uint8_t  bLUN;
00037     uint8_t  bCBLength;
00038     uint8_t  CB[16];
00039 } MSC_CBW;
00040 
00041 /* Bulk-only Command Status Wrapper */
00042 typedef struct __attribute__ ((packed)) {
00043     uint32_t dSignature;
00044     uint32_t dTag;
00045     uint32_t dDataResidue;
00046     uint8_t  bStatus;
00047 } MSC_CSW;
00048 
00049 #define MSC_CBW_Signature               0x43425355
00050 #define MSC_CSW_Signature               0x53425355
00051 
00052 /* CSW Status Definitions */
00053 #define CSW_CMD_PASSED                  0x00
00054 #define CSW_CMD_FAILED                  0x01
00055 #define CSW_PHASE_ERROR                 0x02
00056 
00057 /* SCSI Commands */
00058 #define SCSI_TEST_UNIT_READY            0x00
00059 #define SCSI_REQUEST_SENSE              0x03
00060 #define SCSI_FORMAT_UNIT                0x04
00061 #define SCSI_INQUIRY                    0x12
00062 #define SCSI_MODE_SELECT6               0x15
00063 #define SCSI_MODE_SENSE6                0x1A
00064 #define SCSI_START_STOP_UNIT            0x1B
00065 #define SCSI_MEDIA_REMOVAL              0x1E
00066 #define SCSI_READ_FORMAT_CAPACITIES     0x23
00067 #define SCSI_READ_CAPACITY              0x25
00068 #define SCSI_READ10                     0x28
00069 #define SCSI_WRITE10                    0x2A
00070 #define SCSI_VERIFY10                   0x2F
00071 #define SCSI_MODE_SELECT10              0x55
00072 #define SCSI_MODE_SENSE10               0x5A
00073 
00074 #endif /* _DESCRIPTOR_MSC_H */