Fixed endpoint halt reset implementation

This commit is contained in:
Diego Ismirlian 2017-06-06 09:23:07 -03:00
parent 0bf5a7aa4c
commit 108ae2534c
2 changed files with 5 additions and 10 deletions

View File

@ -373,14 +373,7 @@ extern "C" {
usbhEPCloseS(ep);
osalSysUnlock();
}
bool usbhEPResetS(usbh_ep_t *ep);
static inline bool usbhEPReset(usbh_ep_t *ep) {
bool ret;
osalSysLock();
ret = usbhEPResetS(ep);
osalSysUnlock();
return ret;
}
bool usbhEPReset(usbh_ep_t *ep);
static inline bool usbhEPIsPeriodic(usbh_ep_t *ep) {
osalDbgCheck(ep != NULL);
return (ep->type & 1) != 0;

View File

@ -195,8 +195,7 @@ static void _ep0_object_init(usbh_device_t *dev, uint16_t wMaxPacketSize) {
usbhEPSetName(&dev->ctrl, "DEV[CTRL]");
}
bool usbhEPResetS(usbh_ep_t *ep) {
osalDbgCheckClassS();
bool usbhEPReset(usbh_ep_t *ep) {
osalDbgCheck(ep != NULL);
osalDbgAssert((ep->status == USBH_EPSTATUS_OPEN) || (ep->status == USBH_EPSTATUS_HALTED), "invalid state");
osalDbgAssert(ep->type != USBH_EPTYPE_CTRL, "don't need to reset control endpoint");
@ -206,9 +205,12 @@ bool usbhEPResetS(usbh_ep_t *ep) {
0, 0);
/* TODO: GET_STATUS to see if endpoint is still halted */
osalSysLock();
if ((ret == USBH_URBSTATUS_OK) && usbh_lld_ep_reset(ep)) {
osalSysUnlock();
return HAL_SUCCESS;
}
osalSysUnlock();
return HAL_FAILED;
}