115 USBH_MSC_InterfaceInit,
116 USBH_MSC_InterfaceDeInit,
117 USBH_MSC_ClassRequest,
151 uint8_t
interface = 0;
155 interface =
USBH_FindInterface(phost, phost->pActiveClass->ClassCode, MSC_TRANSPARENT, MSC_BOT);
157 if(interface == 0xFF)
159 USBH_DbgLog (
"Cannot Find the interface for %s class.", phost->pActiveClass->Name);
169 if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].bEndpointAddress & 0x80)
171 MSC_Handle->
InEp = (phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].bEndpointAddress);
172 MSC_Handle->
InEpSize = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].wMaxPacketSize;
176 MSC_Handle->
OutEp = (phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].bEndpointAddress);
177 MSC_Handle->
OutEpSize = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[0].wMaxPacketSize;
180 if(phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[1].bEndpointAddress & 0x80)
182 MSC_Handle->
InEp = (phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[1].bEndpointAddress);
183 MSC_Handle->
InEpSize = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[1].wMaxPacketSize;
187 MSC_Handle->
OutEp = (phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[1].bEndpointAddress);
188 MSC_Handle->
OutEpSize = phost->device.CfgDesc.Itf_Desc[phost->device.current_interface].Ep_Desc[1].wMaxPacketSize;
208 phost->device.address,
216 phost->device.address,
296 for(i = 0; i < MSC_Handle->
max_lun; i++)
332 switch (MSC_Handle->
state)
446 if((phost->
Timer - MSC_Handle->
timer) < 10000)
479 #if (USBH_USE_OS == 1) 487 #if (USBH_USE_OS == 1) 550 #if (USBH_USE_OS == 1) 572 #if (USBH_USE_OS == 1) 599 #if (USBH_USE_OS == 1) 724 timeout = phost->
Timer;
726 while (USBH_MSC_RdWrProcess(phost, lun) ==
USBH_BUSY)
772 timeout = phost->
Timer;
773 while (USBH_MSC_RdWrProcess(phost, lun) ==
USBH_BUSY)
USBH_StatusTypeDef USBH_MSC_BOT_Init(USBH_HandleTypeDef *phost)
USBH_MSC_BOT_Init The function Initializes the BOT protocol.
USBH_ClassTypeDef USBH_msc
uint8_t USBH_MSC_UnitIsReady(USBH_HandleTypeDef *phost, uint8_t lun)
USBH_MSC_UnitIsReady The function check whether a LUN is ready.
uint8_t USBH_MSC_IsReady(USBH_HandleTypeDef *phost)
USBH_MSC_IsReady The function check if the MSC function is ready.
USBH_DeviceTypeDef device
Header file for usbh_msc_bot.c.
USBH_StatusTypeDef USBH_OpenPipe(USBH_HandleTypeDef *phost, uint8_t ch_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
USBH_Open_Pipe Open a pipe.
USBH_StatusTypeDef USBH_SelectInterface(USBH_HandleTypeDef *phost, uint8_t interface)
USBH_SelectInterface Select current interface.
USBH_StatusTypeDef USBH_MSC_Write(USBH_HandleTypeDef *phost, uint8_t lun, uint32_t address, uint8_t *pbuf, uint32_t length)
USBH_MSC_Write The function performs a Write operation.
MSC_LUNTypeDef unit[MAX_SUPPORTED_LUN]
uint8_t USBH_AllocPipe(USBH_HandleTypeDef *phost, uint8_t ep_addr)
USBH_Alloc_Pipe Allocate a new Pipe.
#define HOST_USER_CLASS_ACTIVE
#define SCSI_SENSE_KEY_UNIT_ATTENTION
USBH_StatusTypeDef USBH_FreePipe(USBH_HandleTypeDef *phost, uint8_t idx)
USBH_Free_Pipe Free the USB Pipe.
uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, uint8_t Class, uint8_t SubClass, uint8_t Protocol)
USBH_FindInterface Find the interface index for a specific class.
USBH_StatusTypeDef USBH_ClrFeature(USBH_HandleTypeDef *phost, uint8_t ep_num)
USBH_ClrFeature This request is used to clear or disable a specific feature.
void(* pUser)(struct _USBH_HandleTypeDef *pHandle, uint8_t id)
USBH_StatusTypeDef USBH_MSC_SCSI_Write(USBH_HandleTypeDef *phost, uint8_t lun, uint32_t address, uint8_t *pbuf, uint32_t length)
USBH_MSC_SCSI_Write Issue write10 command.
This file contains all the prototypes for the usbh_msc.c.
int8_t USBH_MSC_GetMaxLUN(USBH_HandleTypeDef *phost)
USBH_MSC_GetMaxLUN The function return the Max LUN supported.
USBH_StatusTypeDef USBH_MSC_BOT_REQ_GetMaxLUN(USBH_HandleTypeDef *phost, uint8_t *Maxlun)
USBH_MSC_BOT_REQ_GetMaxLUN The function the MSC BOT GetMaxLUN request.
SCSI_StdInquiryDataTypeDef inquiry
USBH_StatusTypeDef USBH_MSC_SCSI_TestUnitReady(USBH_HandleTypeDef *phost, uint8_t lun)
USBH_MSC_SCSI_TestUnitReady Issue TestUnitReady command.
USBH_StatusTypeDef USBH_MSC_SCSI_Inquiry(USBH_HandleTypeDef *phost, uint8_t lun, SCSI_StdInquiryDataTypeDef *inquiry)
USBH_MSC_SCSI_Inquiry Issue Inquiry command.
SCSI_CapacityTypeDef capacity
USBH_StatusTypeDef USBH_MSC_SCSI_Read(USBH_HandleTypeDef *phost, uint8_t lun, uint32_t address, uint8_t *pbuf, uint32_t length)
USBH_MSC_SCSI_Read Issue Read10 command.
USBH_StatusTypeDef USBH_MSC_SCSI_RequestSense(USBH_HandleTypeDef *phost, uint8_t lun, SCSI_SenseTypeDef *sense_data)
USBH_MSC_SCSI_RequestSense Issue RequestSense command.
Header file for usbh_msc_scsi.c.
#define SCSI_SENSE_KEY_NOT_READY
MSC_ReqStateTypeDef prev_req_state
USBH_StatusTypeDef USBH_LL_SetToggle(USBH_HandleTypeDef *phost, uint8_t, uint8_t)
USBH_LL_SetToggle Set toggle for a pipe.
__IO HOST_StateTypeDef gState
osStatus osMessagePut(osMessageQId queue_id, uint32_t info, uint32_t millisec)
Put a Message to a Queue.
USBH_StatusTypeDef prev_ready_state
USBH_StatusTypeDef USBH_MSC_Read(USBH_HandleTypeDef *phost, uint8_t lun, uint32_t address, uint8_t *pbuf, uint32_t length)
USBH_MSC_Read The function performs a Read operation.
USBH_ClassTypeDef * pActiveClass
MSC_ReqStateTypeDef req_state
USBH_StatusTypeDef USBH_MSC_SCSI_ReadCapacity(USBH_HandleTypeDef *phost, uint8_t lun, SCSI_CapacityTypeDef *capacity)
USBH_MSC_SCSI_ReadCapacity Issue Read Capacity command.
USBH_StatusTypeDef USBH_MSC_GetLUNInfo(USBH_HandleTypeDef *phost, uint8_t lun, MSC_LUNTypeDef *info)
USBH_MSC_GetLUNInfo The function return a LUN information.
__IO uint8_t is_connected
USBH_StatusTypeDef USBH_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe_num)
USBH_ClosePipe Close a pipe.