Fixed enumeration issues with low-speed devices:

- Unexpected second port-connected interrupt on cold boot with low-speed
device connected.

- Retry on failure to get device descriptor. (We still fail after three
attempts, but that is better than failing after the first one!)

Also changed eclipse project to use external builder.
USG_1.0
Robert Fisk 8 years ago
parent 2ae9850438
commit b80b99d9ec

@ -8,6 +8,8 @@
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
</extensions>
</storageModule>
@ -45,7 +47,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.1966851850" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith.1529172556" name="Warn if pointer arithmetic (-Wpointer-arith)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.pointerarith" value="true" valueType="boolean"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.1042769951" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder autoBuildTarget="all" buildPath="${workspace_loc:/Downstream}/Debug" cleanBuildTarget="clean" command="${cross_make}" id="org.eclipse.cdt.build.core.internal.builder.1804403788" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="org.eclipse.cdt.build.core.internal.builder"/>
<builder buildPath="${workspace_loc:/Downstream}/Debug" id="ilg.gnuarmeclipse.managedbuild.cross.builder.2070257479" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.789837881" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1524992420" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.559716966" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" valueType="definedSymbols">

@ -193,6 +193,7 @@ HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd,
void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd);
void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd);
void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd);
void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd);
void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd);
void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd,
uint8_t chnum,

@ -570,6 +570,11 @@ __weak void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd)
*/
}
__weak void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd)
{
}
/**
* @brief Disconnection Event callback.
* @param hhcd: HCD handle
@ -1055,11 +1060,11 @@ static void HCD_HC_OUT_IRQHandler (HCD_HandleTypeDef *hhcd, uint8_t chnum)
hhcd->hc[chnum].urb_state = URB_NOTREADY;
}
/* re-activate the channel */
tmpreg = USBx_HC(chnum)->HCCHAR;
tmpreg &= ~USB_OTG_HCCHAR_CHDIS;
tmpreg |= USB_OTG_HCCHAR_CHENA;
USBx_HC(chnum)->HCCHAR = tmpreg;
// /* re-activate the channel */
// tmpreg = USBx_HC(chnum)->HCCHAR;
// tmpreg &= ~USB_OTG_HCCHAR_CHDIS;
// tmpreg |= USB_OTG_HCCHAR_CHENA;
// USBx_HC(chnum)->HCCHAR = tmpreg;
}
__HAL_HCD_CLEAR_HC_INT(chnum, USB_OTG_HCINT_CHH);
@ -1174,7 +1179,7 @@ static void HCD_Port_IRQHandler (HCD_HandleTypeDef *hhcd)
USBx_HOST->HFIR = (uint32_t)60000;
}
}
HAL_HCD_Connect_Callback(hhcd);
HAL_HCD_PortEnabled_Callback(hhcd);
if(hhcd->Init.speed == HCD_SPEED_HIGH)
{

@ -122,6 +122,7 @@ USBH_StatusTypeDef USBH_LL_Start (USBH_HandleTypeDef *phost);
USBH_StatusTypeDef USBH_LL_Stop (USBH_HandleTypeDef *phost);
USBH_StatusTypeDef USBH_LL_Connect (USBH_HandleTypeDef *phost);
USBH_StatusTypeDef USBH_LL_PortEnabled (USBH_HandleTypeDef *phost);
USBH_StatusTypeDef USBH_LL_Disconnect (USBH_HandleTypeDef *phost);
USBH_SpeedTypeDef USBH_LL_GetSpeed (USBH_HandleTypeDef *phost);
USBH_StatusTypeDef USBH_LL_ResetPort (USBH_HandleTypeDef *phost);

@ -24,7 +24,9 @@
* limitations under the License.
*
******************************************************************************
*/
*
* Modifications by Robert Fisk
*/
/* Includes ------------------------------------------------------------------*/
#include "usbh_core.h"
@ -401,7 +403,7 @@ USBH_StatusTypeDef USBH_Process(USBH_HandleTypeDef *phost)
switch (phost->gState)
{
case HOST_IDLE :
case HOST_IDLE:
if (phost->device.is_connected)
{
@ -426,7 +428,7 @@ USBH_StatusTypeDef USBH_Process(USBH_HandleTypeDef *phost)
USBH_Delay(100);
phost->device.speed = USBH_LL_GetSpeed(phost);
phost->gState = HOST_ENUMERATION;
phost->Control.pipe_out = USBH_AllocPipe (phost, 0x00);
@ -835,18 +837,29 @@ USBH_StatusTypeDef USBH_LL_Connect (USBH_HandleTypeDef *phost)
{
phost->pUser(phost, HOST_USER_CONNECTION);
}
}
else if(phost->gState == HOST_DEV_WAIT_FOR_ATTACHMENT )
}
else if (phost->gState == HOST_DEV_WAIT_FOR_ATTACHMENT)
{
phost->gState = HOST_DEV_ATTACHED ;
//On the first boot after a power cycle with a low-speed device pre-attached,
//we get a second port-connected interrupt!???
//So go back and do the port reset again...
phost->gState = HOST_IDLE;
}
#if (USBH_USE_OS == 1)
osMessagePut ( phost->os_event, USBH_PORT_EVENT, 0);
#endif
return USBH_OK;
}
USBH_StatusTypeDef USBH_LL_PortEnabled (USBH_HandleTypeDef *phost)
{
if(phost->gState == HOST_DEV_WAIT_FOR_ATTACHMENT )
{
phost->gState = HOST_DEV_ATTACHED ;
}
return USBH_OK;
}
/**
* @brief USBH_LL_Disconnect
* Handle USB Host disconnection event

@ -23,7 +23,10 @@
* limitations under the License.
*
******************************************************************************
*/
*
* Modifications by Robert Fisk
*/
/* Includes ------------------------------------------------------------------*/
#include "usbh_ctlreq.h"
@ -654,7 +657,13 @@ static USBH_StatusTypeDef USBH_HandleControl (USBH_HandleTypeDef *phost)
#if (USBH_USE_OS == 1)
osMessagePut ( phost->os_event, USBH_CONTROL_EVENT, 0);
#endif
}
}
else if (URB_Status == USBH_URB_NOTREADY)
{
//Some mice cause a transaction error interrupt (HCINT_TXERR) at this point,
//so we retry and hope for the best!
phost->Control.state = CTRL_SETUP;
}
break;
case CTRL_DATA_IN:

@ -112,6 +112,13 @@ void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd)
USBH_LL_Connect(hhcd->pData);
}
void HAL_HCD_PortEnabled_Callback(HCD_HandleTypeDef *hhcd)
{
USBH_LL_PortEnabled(hhcd->pData);
}
/**
* @brief SOF callback.
* @param hhcd: HCD handle

@ -48,7 +48,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded.1572432926" name="Warn if padding is included (-Wpadded)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.padded" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.740202841" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="true" valueType="boolean"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.628949634" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder buildPath="${workspace_loc:/Upstream}/Debug" command="make" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1480076349" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<builder buildPath="${workspace_loc:/Upstream}/Debug" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1480076349" keepEnvironmentInBuildfile="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.1030197418" name="Cross ARM GNU Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1741569390" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.2044612762" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" valueType="includePath">

Loading…
Cancel
Save