/** * @brief Deactivates the USB peripheral. * * @param[in] usbp pointer to the @p USBDriver object * * @api */ void usbStop(USBDriver *usbp) { unsigned i; osalDbgCheck(usbp != NULL); osalSysLock(); osalDbgAssert((usbp->state == USB_STOP) || (usbp->state == USB_READY) || (usbp->state == USB_SELECTED) || (usbp->state == USB_ACTIVE) || (usbp->state == USB_SUSPENDED), "invalid state"); usb_lld_stop(usbp); usbp->config = NULL; usbp->state = USB_STOP; /* Resetting all ongoing synchronous operations.*/ for (i = 0; i <= (unsigned)USB_MAX_ENDPOINTS; i++) { #if USB_USE_WAIT == TRUE if (usbp->epc[i] != NULL) { if (usbp->epc[i]->in_state != NULL) { osalThreadResumeI(&usbp->epc[i]->in_state->thread, MSG_RESET); } if (usbp->epc[i]->out_state != NULL) { osalThreadResumeI(&usbp->epc[i]->out_state->thread, MSG_RESET); } } #endif usbp->epc[i] = NULL; } osalOsRescheduleS(); osalSysUnlock(); }
/** * @brief Deactivates the USB peripheral. * * @param[in] usbp pointer to the @p USBDriver object * * @api */ void usbStop(USBDriver *usbp) { chDbgCheck(usbp != NULL, "usbStop"); chSysLock(); chDbgAssert((usbp->state == USB_STOP) || (usbp->state == USB_READY), "usbStop(), #1", "invalid state"); usb_lld_stop(usbp); usbp->state = USB_STOP; chSysUnlock(); }
/** * @brief Deactivates the USB peripheral. * * @param[in] usbp pointer to the @p USBDriver object * * @api */ void usbStop(USBDriver *usbp) { osalDbgCheck(usbp != NULL); osalSysLock(); osalDbgAssert((usbp->state == USB_STOP) || (usbp->state == USB_READY) || (usbp->state == USB_SELECTED) || (usbp->state == USB_ACTIVE), "invalid state"); usb_lld_stop(usbp); usbp->state = USB_STOP; osalSysUnlock(); }