ref: cd04f3c3b474248f93f005c1e4d0325ce6202fe6
parent: 964d90704a66fbf8410e0f25715333c90f04a2db
author: gkostka <kostka.grzegorz@gmail.com>
date: Sun Jun 22 17:28:03 EDT 2014
STM32F429 demo update
--- a/demos/stm32f429_disco/stm/usb_host/Class/MSC/src/usbh_msc.c
+++ b/demos/stm32f429_disco/stm/usb_host/Class/MSC/src/usbh_msc.c
@@ -713,8 +713,10 @@
length);
timeout = phost->Timer + (10000 * length);
- while (USBH_MSC_RdWrProcess(phost, lun) == USBH_BUSY)
+ USBH_StatusTypeDef stat = USBH_BUSY;
+ while (stat == USBH_BUSY)
{
+ stat = USBH_MSC_RdWrProcess(phost, lun);
if((phost->Timer > timeout) || (phost->device.is_connected == 0))
{
MSC_Handle->state = MSC_IDLE;
@@ -722,7 +724,7 @@
}
}
MSC_Handle->state = MSC_IDLE;
- return USBH_OK;
+ return stat;
}
/**
@@ -742,8 +744,9 @@
uint32_t length)
{
uint32_t timeout;
- MSC_HandleTypeDef *MSC_Handle = phost->pActiveClass->pData;
+ MSC_HandleTypeDef *MSC_Handle = phost->pActiveClass->pData;
+
if ((phost->device.is_connected == 0) ||
(phost->gState != HOST_CLASS) ||
(MSC_Handle->unit[lun].state != MSC_IDLE))
@@ -760,8 +763,11 @@
length);
timeout = phost->Timer + (10000 * length);
- while (USBH_MSC_RdWrProcess(phost, lun) == USBH_BUSY)
+ USBH_StatusTypeDef stat = USBH_BUSY;
+ while (stat == USBH_BUSY)
{
+ stat = USBH_MSC_RdWrProcess(phost, lun);
+
if((phost->Timer > timeout) || (phost->device.is_connected == 0))
{
MSC_Handle->state = MSC_IDLE;
@@ -769,7 +775,7 @@
}
}
MSC_Handle->state = MSC_IDLE;
- return USBH_OK;
+ return stat;
}
/**
--- a/demos/stm32f429_disco/usb_msc_lwext4.c
+++ b/demos/stm32f429_disco/usb_msc_lwext4.c
@@ -119,6 +119,9 @@
if(!hw_usb_connected())
return EIO;
+ while(!USBH_MSC_UnitIsReady(&hUSB_Host, 0))
+ ;
+
status = USBH_MSC_Read(&hUSB_Host, 0, blk_id + part_offset, buf, blk_cnt);
if(status != USBH_OK)
return EIO;
@@ -134,6 +137,9 @@
if(!hw_usb_connected())
return EIO;
+
+ while(!USBH_MSC_UnitIsReady(&hUSB_Host, 0))
+ ;
status = USBH_MSC_Write(&hUSB_Host, 0, blk_id + part_offset, (void *)buf, blk_cnt);
if(status != USBH_OK)