Lines Matching +full:iso +full:- +full:out +full:- +full:mps

4  * SPDX-License-Identifier: Apache-2.0
23 #include <zephyr/dt-bindings/regulator/nrf5x.h>
90 /* Allow data chunk on EP0 OUT */ in udc_nrf_clear_control_out()
93 LOG_INF("Allow data OUT"); in udc_nrf_clear_control_out()
108 .p_data = {.tx = buf->data}, in udc_event_xfer_in_next()
109 .size = buf->len, in udc_event_xfer_in_next()
119 udc_submit_ep_event(dev, buf, -ECONNREFUSED); in udc_event_xfer_in_next()
137 * s-in-[status] finished, release buffer. in udc_event_xfer_ctrl_in()
138 * Since the controller supports auto-status we cannot use in udc_event_xfer_ctrl_in()
169 uint8_t ep = event->data.eptransfer.ep; in udc_event_xfer_in()
172 switch (event->data.eptransfer.status) { in udc_event_xfer_in()
200 udc_submit_ep_event(dev, buf, -ECONNABORTED); in udc_event_xfer_in()
205 event->data.eptransfer.status, ep); in udc_event_xfer_in()
206 udc_submit_event(dev, UDC_EVT_ERROR, -EIO); in udc_event_xfer_in()
215 * In case s-in-status, controller supports auto-status therefore we in udc_event_xfer_ctrl_out()
238 .p_data = {.rx = buf->data}, in udc_event_xfer_out_next()
239 .size = buf->size, in udc_event_xfer_out_next()
248 udc_submit_ep_event(dev, buf, -ECONNREFUSED); in udc_event_xfer_out_next()
260 uint8_t ep = event->data.eptransfer.ep; in udc_event_xfer_out()
265 switch (event->data.eptransfer.status) { in udc_event_xfer_out()
276 LOG_ERR("OUT transfer failed %d", err_code); in udc_event_xfer_out()
297 event->data.eptransfer.status, ep); in udc_event_xfer_out()
298 udc_submit_event(dev, UDC_EVT_ERROR, -EIO); in udc_event_xfer_out()
312 return -ENOMEM; in usbd_ctrl_feed_dout()
315 k_fifo_put(&cfg->fifo, buf); in usbd_ctrl_feed_dout()
331 return -ENOMEM; in udc_event_xfer_setup()
335 setup = (nrf_usbd_common_setup_t *)buf->data; in udc_event_xfer_setup()
346 * * sends SETUP Set Address with non-zero wLength in udc_event_xfer_setup()
347 * * does not send corresponding OUT DATA packets (to match wLength) in udc_event_xfer_setup()
362 setup->bmRequestType == 0 && in udc_event_xfer_setup()
363 setup->bRequest == USB_SREQ_SET_ADDRESS; in udc_event_xfer_setup()
365 if (setup->wLength) { in udc_event_xfer_setup()
366 /* Currently USB stack only STALLs OUT Data Stage when in udc_event_xfer_setup()
386 setup->wValue &= 0x7F; in udc_event_xfer_setup()
387 setup->wIndex = 0; in udc_event_xfer_setup()
390 if (!udc_nrf_setup_set_addr && udc_nrf_address != NRF_USBD->USBADDR) { in udc_event_xfer_setup()
397 setup->bmRequestType = 0; in udc_event_xfer_setup()
398 setup->bRequest = USB_SREQ_SET_ADDRESS; in udc_event_xfer_setup()
399 setup->wValue = NRF_USBD->USBADDR; in udc_event_xfer_setup()
400 setup->wIndex = 0; in udc_event_xfer_setup()
401 setup->wLength = 0; in udc_event_xfer_setup()
413 /* Allocate and feed buffer for data OUT stage */ in udc_event_xfer_setup()
414 LOG_DBG("s:%p|feed for -out-", buf); in udc_event_xfer_setup()
416 if (err == -ENOMEM) { in udc_event_xfer_setup()
510 if (ep_cfg->stat.enabled && !k_fifo_is_empty(&ep_cfg->fifo)) { in udc_sof_check_iso_out()
517 switch (hal_evt->type) { in usbd_event_handler()
590 .ep = cfg->addr, in udc_nrf_ep_enqueue()
595 if (cfg->addr == USB_CONTROL_EP_IN && buf->len == 0) { in udc_nrf_ep_enqueue()
609 bool busy = nrf_usbd_common_ep_is_busy(cfg->addr); in udc_nrf_ep_dequeue()
611 nrf_usbd_common_ep_abort(cfg->addr); in udc_nrf_ep_dequeue()
612 if (USB_EP_DIR_IS_OUT(cfg->addr) || !busy) { in udc_nrf_ep_dequeue()
616 * HAL driver does not generate event for an OUT endpoint in udc_nrf_ep_dequeue()
619 buf = udc_buf_get_all(dev, cfg->addr); in udc_nrf_ep_dequeue()
621 udc_submit_ep_event(dev, buf, -ECONNABORTED); in udc_nrf_ep_dequeue()
623 LOG_INF("ep 0x%02x queue is empty", cfg->addr); in udc_nrf_ep_dequeue()
628 udc_ep_set_busy(dev, cfg->addr, false); in udc_nrf_ep_dequeue()
636 uint16_t mps; in udc_nrf_ep_enable() local
639 mps = (udc_mps_ep_size(cfg) == 0) ? cfg->caps.mps : udc_mps_ep_size(cfg); in udc_nrf_ep_enable()
640 nrf_usbd_common_ep_max_packet_size_set(cfg->addr, mps); in udc_nrf_ep_enable()
641 nrf_usbd_common_ep_enable(cfg->addr); in udc_nrf_ep_enable()
642 if (!NRF_USBD_EPISO_CHECK(cfg->addr)) { in udc_nrf_ep_enable()
643 /* ISO transactions for full-speed device do not support in udc_nrf_ep_enable()
646 nrf_usbd_common_ep_dtoggle_clear(cfg->addr); in udc_nrf_ep_enable()
647 nrf_usbd_common_ep_stall_clear(cfg->addr); in udc_nrf_ep_enable()
650 LOG_DBG("Enable ep 0x%02x", cfg->addr); in udc_nrf_ep_enable()
659 nrf_usbd_common_ep_disable(cfg->addr); in udc_nrf_ep_disable()
660 LOG_DBG("Disable ep 0x%02x", cfg->addr); in udc_nrf_ep_disable()
668 LOG_DBG("Halt ep 0x%02x", cfg->addr); in udc_nrf_ep_set_halt()
670 if (cfg->addr == USB_CONTROL_EP_OUT || in udc_nrf_ep_set_halt()
671 cfg->addr == USB_CONTROL_EP_IN) { in udc_nrf_ep_set_halt()
674 nrf_usbd_common_ep_stall(cfg->addr); in udc_nrf_ep_set_halt()
683 LOG_DBG("Clear halt ep 0x%02x", cfg->addr); in udc_nrf_ep_clear_halt()
685 nrf_usbd_common_ep_dtoggle_clear(cfg->addr); in udc_nrf_ep_clear_halt()
686 nrf_usbd_common_ep_stall_clear(cfg->addr); in udc_nrf_ep_clear_halt()
695 * the host sends IN token) then NRF_USBD->USBADDR will have the same in udc_nrf_set_address()
736 return -EAGAIN; in udc_nrf_host_wakeup()
750 return -EIO; in udc_nrf_enable()
756 return -EIO; in udc_nrf_enable()
762 return -EIO; in udc_nrf_enable()
788 return -EIO; in udc_nrf_disable()
793 return -EIO; in udc_nrf_disable()
809 const struct udc_nrf_config *cfg = dev->config; in udc_nrf_init()
811 hfxo_mgr = z_nrf_clock_control_get_onoff(cfg->clock); in udc_nrf_init()
826 (void)nrfx_power_init(&cfg->pwr); in udc_nrf_init()
827 nrfx_power_usbevt_init(&cfg->evt); in udc_nrf_init()
850 struct udc_data *data = dev->data; in udc_nrf_driver_init()
855 k_mutex_init(&data->mutex); in udc_nrf_driver_init()
865 ep_cfg_out[i].caps.out = 1; in udc_nrf_driver_init()
868 ep_cfg_out[i].caps.mps = NRF_USBD_COMMON_EPSIZE; in udc_nrf_driver_init()
872 ep_cfg_out[i].caps.mps = NRF_USBD_COMMON_EPSIZE; in udc_nrf_driver_init()
874 ep_cfg_out[i].caps.iso = 1; in udc_nrf_driver_init()
875 ep_cfg_out[i].caps.mps = NRF_USBD_COMMON_ISOSIZE / 2; in udc_nrf_driver_init()
890 ep_cfg_in[i].caps.mps = NRF_USBD_COMMON_EPSIZE; in udc_nrf_driver_init()
894 ep_cfg_in[i].caps.mps = NRF_USBD_COMMON_EPSIZE; in udc_nrf_driver_init()
896 ep_cfg_in[i].caps.iso = 1; in udc_nrf_driver_init()
897 ep_cfg_in[i].caps.mps = NRF_USBD_COMMON_ISOSIZE / 2; in udc_nrf_driver_init()
908 data->caps.rwup = true; in udc_nrf_driver_init()
909 data->caps.out_ack = true; in udc_nrf_driver_init()
910 data->caps.mps0 = UDC_NRF_MPS0; in udc_nrf_driver_init()
911 data->caps.can_detect_vbus = true; in udc_nrf_driver_init()