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.h
00001 /** 00002 ****************************************************************************** 00003 * @file usbh_msc.h 00004 * @author MCD Application Team 00005 * @version V3.2.2 00006 * @date 07-July-2015 00007 * @brief This file contains all the prototypes for the usbh_msc.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_H 00030 #define __USBH_MSC_H 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 /* Includes ------------------------------------------------------------------*/ 00037 #include "usbh_core.h" 00038 #include "usbh_msc_bot.h" 00039 #include "usbh_msc_scsi.h" 00040 00041 /** @addtogroup USBH_LIB 00042 * @{ 00043 */ 00044 00045 /** @addtogroup USBH_CLASS 00046 * @{ 00047 */ 00048 00049 /** @addtogroup USBH_MSC_CLASS 00050 * @{ 00051 */ 00052 00053 /** @defgroup USBH_MSC_CORE 00054 * @brief This file is the Header file for usbh_msc.c 00055 * @{ 00056 */ 00057 00058 00059 /** @defgroup USBH_MSC_CORE_Exported_Types 00060 * @{ 00061 */ 00062 00063 typedef enum 00064 { 00065 MSC_INIT = 0, 00066 MSC_IDLE, 00067 MSC_TEST_UNIT_READY, 00068 MSC_READ_CAPACITY10, 00069 MSC_READ_INQUIRY, 00070 MSC_REQUEST_SENSE, 00071 MSC_READ, 00072 MSC_WRITE, 00073 MSC_UNRECOVERED_ERROR, 00074 MSC_PERIODIC_CHECK, 00075 } 00076 MSC_StateTypeDef; 00077 00078 typedef enum 00079 { 00080 MSC_OK, 00081 MSC_NOT_READY, 00082 MSC_ERROR, 00083 00084 } 00085 MSC_ErrorTypeDef; 00086 00087 typedef enum 00088 { 00089 MSC_REQ_IDLE = 0, 00090 MSC_REQ_RESET, 00091 MSC_REQ_GET_MAX_LUN, 00092 MSC_REQ_ERROR, 00093 } 00094 MSC_ReqStateTypeDef; 00095 00096 #ifndef MAX_SUPPORTED_LUN 00097 #define MAX_SUPPORTED_LUN 2 00098 #endif 00099 00100 00101 /* Structure for LUN */ 00102 typedef struct 00103 { 00104 MSC_StateTypeDef state; 00105 MSC_ErrorTypeDef error; 00106 USBH_StatusTypeDef prev_ready_state; 00107 SCSI_CapacityTypeDef capacity; 00108 SCSI_SenseTypeDef sense; 00109 SCSI_StdInquiryDataTypeDef inquiry; 00110 uint8_t state_changed; 00111 00112 } 00113 MSC_LUNTypeDef; 00114 00115 /* Structure for MSC process */ 00116 typedef struct _MSC_Process 00117 { 00118 uint32_t max_lun; 00119 uint8_t InPipe; 00120 uint8_t OutPipe; 00121 uint8_t OutEp; 00122 uint8_t InEp; 00123 uint16_t OutEpSize; 00124 uint16_t InEpSize; 00125 MSC_StateTypeDef state; 00126 MSC_ErrorTypeDef error; 00127 MSC_ReqStateTypeDef req_state; 00128 MSC_ReqStateTypeDef prev_req_state; 00129 BOT_HandleTypeDef hbot; 00130 MSC_LUNTypeDef unit[MAX_SUPPORTED_LUN]; 00131 uint16_t current_lun; 00132 uint16_t rw_lun; 00133 uint32_t timer; 00134 } 00135 MSC_HandleTypeDef; 00136 00137 00138 /** 00139 * @} 00140 */ 00141 00142 00143 00144 /** @defgroup USBH_MSC_CORE_Exported_Defines 00145 * @{ 00146 */ 00147 00148 #define USB_REQ_BOT_RESET 0xFF 00149 #define USB_REQ_GET_MAX_LUN 0xFE 00150 00151 00152 /* MSC Class Codes */ 00153 #define USB_MSC_CLASS 0x08 00154 00155 /* Interface Descriptor field values for HID Boot Protocol */ 00156 #define MSC_BOT 0x50 00157 #define MSC_TRANSPARENT 0x06 00158 /** 00159 * @} 00160 */ 00161 00162 /** @defgroup USBH_MSC_CORE_Exported_Macros 00163 * @{ 00164 */ 00165 /** 00166 * @} 00167 */ 00168 00169 /** @defgroup USBH_MSC_CORE_Exported_Variables 00170 * @{ 00171 */ 00172 extern USBH_ClassTypeDef USBH_msc; 00173 #define USBH_MSC_CLASS &USBH_msc 00174 00175 /** 00176 * @} 00177 */ 00178 00179 /** @defgroup USBH_MSC_CORE_Exported_FunctionsPrototype 00180 * @{ 00181 */ 00182 00183 /* Common APIs */ 00184 uint8_t USBH_MSC_IsReady (USBH_HandleTypeDef *phost); 00185 00186 /* APIs for LUN */ 00187 int8_t USBH_MSC_GetMaxLUN (USBH_HandleTypeDef *phost); 00188 00189 uint8_t USBH_MSC_UnitIsReady (USBH_HandleTypeDef *phost, uint8_t lun); 00190 00191 USBH_StatusTypeDef USBH_MSC_GetLUNInfo(USBH_HandleTypeDef *phost, uint8_t lun, MSC_LUNTypeDef *info); 00192 00193 USBH_StatusTypeDef USBH_MSC_Read(USBH_HandleTypeDef *phost, 00194 uint8_t lun, 00195 uint32_t address, 00196 uint8_t *pbuf, 00197 uint32_t length); 00198 00199 USBH_StatusTypeDef USBH_MSC_Write(USBH_HandleTypeDef *phost, 00200 uint8_t lun, 00201 uint32_t address, 00202 uint8_t *pbuf, 00203 uint32_t length); 00204 /** 00205 * @} 00206 */ 00207 00208 #ifdef __cplusplus 00209 } 00210 #endif 00211 00212 #endif /* __USBH_MSC_H */ 00213 00214 00215 /** 00216 * @} 00217 */ 00218 00219 /** 00220 * @} 00221 */ 00222 00223 /** 00224 * @} 00225 */ 00226 00227 /** 00228 * @} 00229 */ 00230 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 00231 00232 00233
Generated on Tue Jul 12 2022 14:58:25 by
 1.7.2
 1.7.2