Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers usb_msc.h Source File

usb_msc.h

Go to the documentation of this file.
00001 /**
00002  * @file    usb_msc.h
00003  * @brief   USB mass storage header
00004  *
00005  * DAPLink Interface Firmware
00006  * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
00007  * SPDX-License-Identifier: Apache-2.0
00008  *
00009  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00010  * not use this file except in compliance with the License.
00011  * You may obtain a copy of the License at
00012  *
00013  * http://www.apache.org/licenses/LICENSE-2.0
00014  *
00015  * Unless required by applicable law or agreed to in writing, software
00016  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00017  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00022 #ifndef __USB_MSC_H__
00023 #define __USB_MSC_H__
00024 
00025 
00026 /* MSC Subclass Codes */
00027 #define MSC_SUBCLASS_RBC                0x01
00028 #define MSC_SUBCLASS_SFF8020I_MMC2      0x02
00029 #define MSC_SUBCLASS_QIC157             0x03
00030 #define MSC_SUBCLASS_UFI                0x04
00031 #define MSC_SUBCLASS_SFF8070I           0x05
00032 #define MSC_SUBCLASS_SCSI               0x06
00033 
00034 /* MSC Protocol Codes */
00035 #define MSC_PROTOCOL_CBI_INT            0x00
00036 #define MSC_PROTOCOL_CBI_NOINT          0x01
00037 #define MSC_PROTOCOL_BULK_ONLY          0x50
00038 
00039 
00040 /* MSC Request Codes */
00041 #define MSC_REQUEST_RESET               0xFF
00042 #define MSC_REQUEST_GET_MAX_LUN         0xFE
00043 
00044 
00045 /* MSC Bulk-only Stage */
00046 #define MSC_BS_CBW                      0       /* Command Block Wrapper */
00047 #define MSC_BS_DATA_OUT                 1       /* Data Out Phase */
00048 #define MSC_BS_DATA_IN                  2       /* Data In Phase */
00049 #define MSC_BS_DATA_IN_LAST             3       /* Data In Last Phase */
00050 #define MSC_BS_DATA_IN_LAST_STALL       4       /* Data In Last Phase with Stall */
00051 #define MSC_BS_CSW                      5       /* Command Status Wrapper */
00052 #define MSC_BS_ERROR                    6       /* Error */
00053 #define MSC_BS_RESET                    7       /* Bulk-Only Mass Storage Reset */
00054 
00055 
00056 /* Bulk-only Command Block Wrapper */
00057 typedef __packed struct _MSC_CBW {
00058     U32 dSignature;
00059     U32 dTag;
00060     U32 dDataLength;
00061     U8  bmFlags;
00062     U8  bLUN;
00063     U8  bCBLength;
00064     U8  CB[16];
00065 } MSC_CBW;
00066 
00067 /* Bulk-only Command Status Wrapper */
00068 typedef __packed struct _MSC_CSW {
00069     U32 dSignature;
00070     U32 dTag;
00071     U32 dDataResidue;
00072     U8  bStatus;
00073 } MSC_CSW;
00074 
00075 #define MSC_CBW_Signature               0x43425355
00076 #define MSC_CSW_Signature               0x53425355
00077 
00078 
00079 /* CSW Status Definitions */
00080 #define CSW_CMD_PASSED                  0x00
00081 #define CSW_CMD_FAILED                  0x01
00082 #define CSW_PHASE_ERROR                 0x02
00083 
00084 
00085 /* SCSI Commands */
00086 #define SCSI_TEST_UNIT_READY            0x00
00087 #define SCSI_REQUEST_SENSE              0x03
00088 #define SCSI_FORMAT_UNIT                0x04
00089 #define SCSI_INQUIRY                    0x12
00090 #define SCSI_MODE_SELECT6               0x15
00091 #define SCSI_MODE_SENSE6                0x1A
00092 #define SCSI_START_STOP_UNIT            0x1B
00093 #define SCSI_MEDIA_REMOVAL              0x1E
00094 #define SCSI_READ_FORMAT_CAPACITIES     0x23
00095 #define SCSI_READ_CAPACITY              0x25
00096 #define SCSI_READ10                     0x28
00097 #define SCSI_WRITE10                    0x2A
00098 #define SCSI_VERIFY10                   0x2F
00099 #define SCSI_SYNC_CACHE10               0x35
00100 #define SCSI_READ12                     0xA8
00101 #define SCSI_WRITE12                    0xAA
00102 #define SCSI_MODE_SELECT10              0x55
00103 #define SCSI_MODE_SENSE10               0x5A
00104 #define SCSI_SYNC_CACHE16               0x91
00105 #define SCSI_ATA_COMMAND_PASS_THROUGH12 0xA1
00106 #define SCSI_ATA_COMMAND_PASS_THROUGH16 0x85
00107 #define SCSI_SERVICE_ACTION_IN12        0xAB
00108 #define SCSI_SERVICE_ACTION_IN16        0x9E
00109 #define SCSI_SERVICE_ACTION_OUT12       0xA9
00110 #define SCSI_SERVICE_ACTION_OUT16       0x9F
00111 #define SCSI_REPORT_ID_INFO             0xA3
00112 
00113 #endif  /* __USB_MSC_H__ */