Fixed bug #674 (again).

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8542 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
Giovanni Di Sirio 2015-11-28 17:58:01 +00:00
parent 233ac50d25
commit 61d16a339e
2 changed files with 8 additions and 24 deletions

View File

@ -147,32 +147,11 @@ static void otg_disable_ep(USBDriver *usbp) {
unsigned i;
for (i = 0; i <= usbp->otgparams->num_endpoints; i++) {
/* Disable only if enabled because this sentence in the manual:
"The application must set this bit only if Endpoint Enable is
already set for this endpoint".*/
if ((otgp->ie[i].DIEPCTL & DIEPCTL_EPENA) != 0) {
otgp->ie[i].DIEPCTL = DIEPCTL_EPDIS;
/* Wait for endpoint disable.*/
while (!(otgp->ie[i].DIEPINT & DIEPINT_EPDISD))
;
}
else
otgp->ie[i].DIEPCTL = 0;
otgp->ie[i].DIEPCTL &= ~DIEPCTL_EPENA;
otgp->ie[i].DIEPTSIZ = 0;
otgp->ie[i].DIEPINT = 0xFFFFFFFF;
/* Disable only if enabled because this sentence in the manual:
"The application must set this bit only if Endpoint Enable is
already set for this endpoint".
Note that the attempt to disable the OUT EP0 is ignored by the
hardware but the code is simpler this way.*/
if ((otgp->oe[i].DOEPCTL & DOEPCTL_EPENA) != 0) {
otgp->oe[i].DOEPCTL = DOEPCTL_EPDIS;
/* Wait for endpoint disable.*/
while (!(otgp->oe[i].DOEPCTL & DOEPCTL_EPDIS))
;
}
else
otgp->oe[i].DOEPCTL = 0;
otgp->oe[i].DOEPCTL &= ~DOEPCTL_EPENA;
otgp->oe[i].DOEPTSIZ = 0;
otgp->oe[i].DOEPINT = 0xFFFFFFFF;
}

View File

@ -213,10 +213,15 @@ int main(void) {
chThdRelease(shelltp); /* Recovers memory of the previous shell. */
shelltp = NULL; /* Triggers spawning of a new shell. */
}
#if 0
if (palReadPad(GPIOI, GPIOI_BUTTON_USER)) {
usbDisconnectBus(serusbcfg.usbp);
usbStop(serusbcfg.usbp);
chThdSleepMilliseconds(1500);
usbStart(serusbcfg.usbp, &usbcfg);
usbConnectBus(serusbcfg.usbp);
}
#endif
chThdSleepMilliseconds(1000);
}
}