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

4  * SPDX-License-Identifier: Apache-2.0
58 const struct udc_vrt_config *config = dev->config; in vrt_request_reply()
60 pkt->reply = reply; in vrt_request_reply()
62 return uvb_reply_pkt(config->dev_node, pkt); in vrt_request_reply()
70 cfg->stat.halted = false; in ctrl_ep_clear_halt()
73 cfg->stat.halted = false; in ctrl_ep_clear_halt()
84 return -ENOMEM; in vrt_ctrl_feed_dout()
100 return -ENOMEM; in vrt_handle_setup()
103 net_buf_add_mem(buf, pkt->data, pkt->length); in vrt_handle_setup()
111 /* Allocate and feed buffer for data OUT stage */ in vrt_handle_setup()
112 LOG_DBG("s: %p | feed for -out-", buf); in vrt_handle_setup()
114 if (err == -ENOMEM) { in vrt_handle_setup()
117 * halt control OUT endpoint. in vrt_handle_setup()
122 LOG_DBG("s: %p | submit for -in-", buf); in vrt_handle_setup()
126 LOG_DBG("s:%p | submit for -status", buf); in vrt_handle_setup()
163 const uint8_t ep = pkt->ep; in vrt_handle_out()
170 if (ep_cfg->stat.halted) { in vrt_handle_out()
181 min_len = MIN(pkt->length, net_buf_tailroom(buf)); in vrt_handle_out()
182 net_buf_add_mem(buf, pkt->data, min_len); in vrt_handle_out()
184 LOG_DBG("Handle data OUT, %zu | %zu", pkt->length, net_buf_tailroom(buf)); in vrt_handle_out()
186 if (net_buf_tailroom(buf) == 0 || pkt->length < udc_mps_ep_size(ep_cfg)) { in vrt_handle_out()
217 * Feed control OUT buffer for status stage. in isr_handle_ctrl_in()
230 const uint8_t ep = pkt->ep; in vrt_handle_in()
237 if (ep_cfg->stat.halted) { in vrt_handle_in()
249 pkt->length, buf->len, udc_mps_ep_size(ep_cfg)); in vrt_handle_in()
250 min_len = MIN(pkt->length, buf->len); in vrt_handle_in()
251 memcpy(pkt->data, buf->data, min_len); in vrt_handle_in()
253 pkt->length = min_len; in vrt_handle_in()
255 if (buf->len == 0 || pkt->length < udc_mps_ep_size(ep_cfg)) { in vrt_handle_in()
261 LOG_DBG("Finish data IN %zu | %u", pkt->length, buf->len); in vrt_handle_in()
282 if (USB_EP_GET_IDX(pkt->ep) == 0 && pkt->request == UVB_REQUEST_SETUP) { in vrt_handle_request()
286 if (USB_EP_DIR_IS_OUT(pkt->ep) && pkt->request == UVB_REQUEST_DATA) { in vrt_handle_request()
290 if (USB_EP_DIR_IS_IN(pkt->ep) && pkt->request == UVB_REQUEST_DATA) { in vrt_handle_request()
294 return -ENOTSUP; in vrt_handle_request()
306 vrt_ev = k_fifo_get(&priv->fifo, K_FOREVER); in udc_vrt_thread_handler()
308 switch (vrt_ev->type) { in udc_vrt_thread_handler()
325 err = vrt_handle_request(dev, vrt_ev->pkt); in udc_vrt_thread_handler()
350 vrt_ev->type = type; in vrt_submit_uvb_event()
351 vrt_ev->pkt = pkt; in vrt_submit_uvb_event()
352 k_fifo_put(&priv->fifo, vrt_ev); in vrt_submit_uvb_event()
381 if (udc_is_enabled(dev) && priv->addr == pkt->addr) { in udc_vrt_uvb_cb()
398 if (cfg->stat.halted) { in udc_vrt_ep_enqueue()
399 LOG_DBG("ep 0x%02x halted", cfg->addr); in udc_vrt_ep_enqueue()
414 buf = udc_buf_get_all(dev, cfg->addr); in udc_vrt_ep_dequeue()
416 udc_submit_ep_event(dev, buf, -ECONNABORTED); in udc_vrt_ep_dequeue()
438 LOG_DBG("Set halt ep 0x%02x", cfg->addr); in udc_vrt_ep_set_halt()
440 cfg->stat.halted = true; in udc_vrt_ep_set_halt()
448 cfg->stat.halted = false; in udc_vrt_ep_clear_halt()
457 priv->addr = addr; in udc_vrt_set_address()
458 LOG_DBG("Set new address %u for %p", priv->addr, dev); in udc_vrt_set_address()
466 const struct udc_vrt_config *config = dev->config; in udc_vrt_host_wakeup()
468 return uvb_to_host(config->dev_node, UVB_EVT_DEVICE_ACT, in udc_vrt_host_wakeup()
474 struct udc_data *data = dev->data; in udc_vrt_device_speed()
477 return data->caps.hs ? UDC_BUS_SPEED_HS : UDC_BUS_SPEED_FS; in udc_vrt_device_speed()
482 const struct udc_vrt_config *config = dev->config; in udc_vrt_enable()
485 switch (config->speed_idx) { in udc_vrt_enable()
501 return uvb_to_host(config->dev_node, UVB_EVT_DEVICE_ACT, in udc_vrt_enable()
507 const struct udc_vrt_config *config = dev->config; in udc_vrt_disable()
509 return uvb_to_host(config->dev_node, UVB_EVT_DEVICE_ACT, in udc_vrt_disable()
515 const struct udc_vrt_config *config = dev->config; in udc_vrt_init()
520 return -EIO; in udc_vrt_init()
526 return -EIO; in udc_vrt_init()
529 return uvb_subscribe(config->uhc_name, config->dev_node); in udc_vrt_init()
534 const struct udc_vrt_config *config = dev->config; in udc_vrt_shutdown()
538 return -EIO; in udc_vrt_shutdown()
543 return -EIO; in udc_vrt_shutdown()
546 return uvb_unsubscribe(config->uhc_name, config->dev_node); in udc_vrt_shutdown()
551 const struct udc_vrt_config *config = dev->config; in udc_vrt_driver_preinit()
552 struct udc_data *data = dev->data; in udc_vrt_driver_preinit()
553 struct udc_vrt_data *priv = data->priv; in udc_vrt_driver_preinit()
554 uint16_t mps = 1023; in udc_vrt_driver_preinit() local
557 k_mutex_init(&data->mutex); in udc_vrt_driver_preinit()
558 k_fifo_init(&priv->fifo); in udc_vrt_driver_preinit()
560 data->caps.rwup = true; in udc_vrt_driver_preinit()
561 data->caps.mps0 = UDC_MPS0_64; in udc_vrt_driver_preinit()
562 if (config->speed_idx == 2) { in udc_vrt_driver_preinit()
563 data->caps.hs = true; in udc_vrt_driver_preinit()
564 mps = 1024; in udc_vrt_driver_preinit()
567 for (int i = 0; i < config->num_of_eps; i++) { in udc_vrt_driver_preinit()
568 config->ep_cfg_out[i].caps.out = 1; in udc_vrt_driver_preinit()
570 config->ep_cfg_out[i].caps.control = 1; in udc_vrt_driver_preinit()
571 config->ep_cfg_out[i].caps.mps = 64; in udc_vrt_driver_preinit()
573 config->ep_cfg_out[i].caps.bulk = 1; in udc_vrt_driver_preinit()
574 config->ep_cfg_out[i].caps.interrupt = 1; in udc_vrt_driver_preinit()
575 config->ep_cfg_out[i].caps.iso = 1; in udc_vrt_driver_preinit()
576 config->ep_cfg_out[i].caps.mps = mps; in udc_vrt_driver_preinit()
579 config->ep_cfg_out[i].addr = USB_EP_DIR_OUT | i; in udc_vrt_driver_preinit()
580 err = udc_register_ep(dev, &config->ep_cfg_out[i]); in udc_vrt_driver_preinit()
587 for (int i = 0; i < config->num_of_eps; i++) { in udc_vrt_driver_preinit()
588 config->ep_cfg_in[i].caps.in = 1; in udc_vrt_driver_preinit()
590 config->ep_cfg_in[i].caps.control = 1; in udc_vrt_driver_preinit()
591 config->ep_cfg_in[i].caps.mps = 64; in udc_vrt_driver_preinit()
593 config->ep_cfg_in[i].caps.bulk = 1; in udc_vrt_driver_preinit()
594 config->ep_cfg_in[i].caps.interrupt = 1; in udc_vrt_driver_preinit()
595 config->ep_cfg_in[i].caps.iso = 1; in udc_vrt_driver_preinit()
596 config->ep_cfg_in[i].caps.mps = mps; in udc_vrt_driver_preinit()
599 config->ep_cfg_in[i].addr = USB_EP_DIR_IN | i; in udc_vrt_driver_preinit()
600 err = udc_register_ep(dev, &config->ep_cfg_in[i]); in udc_vrt_driver_preinit()
607 config->dev_node->priv = dev; in udc_vrt_driver_preinit()
608 config->make_thread(dev); in udc_vrt_driver_preinit()
610 dev, config->speed_idx, config->uhc_name); in udc_vrt_driver_preinit()
660 k_thread_create(&priv->thread_data, \
668 k_thread_name_set(&priv->thread_data, dev->name); \