Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BSP_DISCO_F746NG_patch mbed-rtos mbed
usbh_msc_scsi.h
00001 /** 00002 ****************************************************************************** 00003 * @file usbh_msc_scsi.h 00004 * @author MCD Application Team 00005 * @version V3.2.2 00006 * @date 07-July-2015 00007 * @brief Header file for usbh_msc_scsi.c 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT 2015 STMicroelectronics</center></h2> 00012 * 00013 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00014 * You may not use this file except in compliance with the License. 00015 * You may obtain a copy of the License at: 00016 * 00017 * http://www.st.com/software_license_agreement_liberty_v2 00018 * 00019 * Unless required by applicable law or agreed to in writing, software 00020 * distributed under the License is distributed on an "AS IS" BASIS, 00021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00022 * See the License for the specific language governing permissions and 00023 * limitations under the License. 00024 * 00025 ****************************************************************************** 00026 */ 00027 00028 /* Define to prevent recursive ----------------------------------------------*/ 00029 #ifndef __USBH_MSC_SCSI_H 00030 #define __USBH_MSC_SCSI_H 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 /* Includes ------------------------------------------------------------------*/ 00037 #include "usbh_core.h" 00038 00039 00040 /** @addtogroup USBH_LIB 00041 * @{ 00042 */ 00043 00044 /** @addtogroup USBH_CLASS 00045 * @{ 00046 */ 00047 00048 /** @addtogroup USBH_MSC_CLASS 00049 * @{ 00050 */ 00051 00052 /** @defgroup USBH_MSC_SCSI 00053 * @brief This file is the Header file for usbh_msc_scsi.c 00054 * @{ 00055 */ 00056 00057 00058 // Capacity data. 00059 typedef struct 00060 { 00061 uint32_t block_nbr; 00062 uint16_t block_size; 00063 } SCSI_CapacityTypeDef; 00064 00065 00066 // Sense data. 00067 typedef struct 00068 { 00069 uint8_t key; 00070 uint8_t asc; 00071 uint8_t ascq; 00072 } SCSI_SenseTypeDef; 00073 00074 // INQUIRY data. 00075 typedef struct 00076 { 00077 uint8_t PeripheralQualifier; 00078 uint8_t DeviceType; 00079 uint8_t RemovableMedia; 00080 uint8_t vendor_id[9]; 00081 uint8_t product_id[17]; 00082 uint8_t revision_id[5]; 00083 }SCSI_StdInquiryDataTypeDef; 00084 00085 /** @defgroup USBH_MSC_SCSI_Exported_Defines 00086 * @{ 00087 */ 00088 #define OPCODE_TEST_UNIT_READY 0x00 00089 #define OPCODE_READ_CAPACITY10 0x25 00090 #define OPCODE_READ10 0x28 00091 #define OPCODE_WRITE10 0x2A 00092 #define OPCODE_REQUEST_SENSE 0x03 00093 #define OPCODE_INQUIRY 0x12 00094 00095 #define DATA_LEN_MODE_TEST_UNIT_READY 0 00096 #define DATA_LEN_READ_CAPACITY10 8 00097 #define DATA_LEN_INQUIRY 36 00098 #define DATA_LEN_REQUEST_SENSE 14 00099 00100 #define CBW_CB_LENGTH 16 00101 #define CBW_LENGTH 10 00102 00103 /** @defgroup USBH_MSC_SCSI_Exported_Defines 00104 * @{ 00105 */ 00106 #define SCSI_SENSE_KEY_NO_SENSE 0x00 00107 #define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01 00108 #define SCSI_SENSE_KEY_NOT_READY 0x02 00109 #define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03 00110 #define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04 00111 #define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05 00112 #define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06 00113 #define SCSI_SENSE_KEY_DATA_PROTECT 0x07 00114 #define SCSI_SENSE_KEY_BLANK_CHECK 0x08 00115 #define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09 00116 #define SCSI_SENSE_KEY_COPY_ABORTED 0x0A 00117 #define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B 00118 #define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D 00119 #define SCSI_SENSE_KEY_MISCOMPARE 0x0E 00120 /** 00121 * @} 00122 */ 00123 00124 00125 /** @defgroup USBH_MSC_SCSI_Exported_Defines 00126 * @{ 00127 */ 00128 #define SCSI_ASC_NO_ADDITIONAL_SENSE_INFORMATION 0x00 00129 #define SCSI_ASC_LOGICAL_UNIT_NOT_READY 0x04 00130 #define SCSI_ASC_INVALID_FIELD_IN_CDB 0x24 00131 #define SCSI_ASC_WRITE_PROTECTED 0x27 00132 #define SCSI_ASC_FORMAT_ERROR 0x31 00133 #define SCSI_ASC_INVALID_COMMAND_OPERATION_CODE 0x20 00134 #define SCSI_ASC_NOT_READY_TO_READY_CHANGE 0x28 00135 #define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3A 00136 /** 00137 * @} 00138 */ 00139 00140 00141 /** @defgroup USBH_MSC_SCSI_Exported_Defines 00142 * @{ 00143 */ 00144 #define SCSI_ASCQ_FORMAT_COMMAND_FAILED 0x01 00145 #define SCSI_ASCQ_INITIALIZING_COMMAND_REQUIRED 0x02 00146 #define SCSI_ASCQ_OPERATION_IN_PROGRESS 0x07 00147 00148 /** 00149 * @} 00150 */ 00151 00152 /** @defgroup USBH_MSC_SCSI_Exported_Macros 00153 * @{ 00154 */ 00155 /** 00156 * @} 00157 */ 00158 00159 /** @defgroup _Exported_Variables 00160 * @{ 00161 */ 00162 00163 /** 00164 * @} 00165 */ 00166 00167 /** @defgroup USBH_MSC_SCSI_Exported_FunctionsPrototype 00168 * @{ 00169 */ 00170 USBH_StatusTypeDef USBH_MSC_SCSI_TestUnitReady (USBH_HandleTypeDef *phost, 00171 uint8_t lun); 00172 00173 USBH_StatusTypeDef USBH_MSC_SCSI_ReadCapacity (USBH_HandleTypeDef *phost, 00174 uint8_t lun, 00175 SCSI_CapacityTypeDef *capacity); 00176 00177 USBH_StatusTypeDef USBH_MSC_SCSI_Inquiry (USBH_HandleTypeDef *phost, 00178 uint8_t lun, 00179 SCSI_StdInquiryDataTypeDef *inquiry); 00180 00181 USBH_StatusTypeDef USBH_MSC_SCSI_RequestSense (USBH_HandleTypeDef *phost, 00182 uint8_t lun, 00183 SCSI_SenseTypeDef *sense_data); 00184 00185 USBH_StatusTypeDef USBH_MSC_SCSI_Write(USBH_HandleTypeDef *phost, 00186 uint8_t lun, 00187 uint32_t address, 00188 uint8_t *pbuf, 00189 uint32_t length); 00190 00191 USBH_StatusTypeDef USBH_MSC_SCSI_Read(USBH_HandleTypeDef *phost, 00192 uint8_t lun, 00193 uint32_t address, 00194 uint8_t *pbuf, 00195 uint32_t length); 00196 00197 00198 /** 00199 * @} 00200 */ 00201 00202 #ifdef __cplusplus 00203 } 00204 #endif 00205 00206 #endif /* __USBH_MSC_SCSI_H */ 00207 00208 00209 /** 00210 * @} 00211 */ 00212 00213 /** 00214 * @} 00215 */ 00216 00217 /** 00218 * @} 00219 */ 00220 00221 /** 00222 * @} 00223 */ 00224 00225 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 00226
Generated on Tue Jul 12 2022 14:58:25 by
1.7.2