Lines Matching full:ep

48 	/* OUT transaction for specific EP completed */
50 /* IN transaction for specific EP completed */
52 /* Re-activate queued transfer for specific EP */
68 uint8_t ep; member
71 uint8_t ep; member
74 uint8_t ep; member
79 /* EP H/W context */
85 uint8_t ep_hw_idx; /* BSP USBD driver EP index EP0, EP1, EP2, etc */
86 uint32_t ep_hw_cfg; /* BSP USBD driver EP configuration */
88 /* EP DMA buffer */
99 /* EP address */
103 /* EP MPS */
128 /* EP H/W context manager */
130 /* EP H/W context management
149 struct numaker_usbd_ep_mgmt ep_mgmt; /* EP management */
218 /* USBD EP base by e.g. EP0, EP1, ... */
224 return base->EP + ep_hw_idx; in numaker_usbd_ep_base()
242 /* Set EP to stalled */ in numaker_usbd_ep_set_stall()
247 /* Reset EP to unstalled and data toggle bit to 0 */
253 /* Reset EP to unstalled */ in numaker_usbd_ep_clear_stall_n_data_toggle()
257 /* Reset EP data toggle bit to 0 */ in numaker_usbd_ep_clear_stall_n_data_toggle()
397 /* Cancel EP on-going transaction */ in numaker_usbd_bus_reset_th()
400 /* Reset EP to unstalled */ in numaker_usbd_bus_reset_th()
403 /* Reset EP data toggle bit to 0 */ in numaker_usbd_bus_reset_th()
511 /* Abort EP on-going transaction */ in numaker_usbd_ep_abort()
519 /* Configure EP major common parts */
529 /* Configure EP transfer type, DATA0/1 toggle, direction, number, etc. */ in numaker_usbd_ep_config_major()
560 /* For safe, EP (re-)enable from clean state */ in numaker_usbd_ep_enable()
564 /* Enable EP to IN/OUT */ in numaker_usbd_ep_enable()
574 /* For USBD, no separate EP interrupt control */ in numaker_usbd_ep_enable()
582 /* For USBD, no separate EP interrupt control */ in numaker_usbd_ep_disable()
584 /* Disable EP */ in numaker_usbd_ep_disable()
589 /* Start EP data transaction */
614 /* Indicate this EP H/W context is allocated */ in numaker_usbd_ep_mgmt_alloc_ep()
649 /* Initialize all EP H/W contexts */
666 /* Initialize all EP H/W contexts */ in numaker_usbd_ep_mgmt_init()
674 /* BSP USBD driver EP handle */ in numaker_usbd_ep_mgmt_init()
678 /* Reserve 1st/2nd EP H/W contexts (BSP USBD driver EP0/EP1) for CTRL OUT/IN */ in numaker_usbd_ep_mgmt_init()
688 /* Reserve 1st EP H/W context (BSP USBD driver EP0) for CTRL OUT */ in numaker_usbd_ep_mgmt_init()
699 /* Reserve 2nd EP H/W context (BSP USBD driver EP1) for CTRL IN */ in numaker_usbd_ep_mgmt_init()
710 /* Find EP H/W context by EP address */
712 const uint8_t ep) in numaker_usbd_ep_mgmt_find_ep() argument
727 if (ep == ep_cur->addr) { in numaker_usbd_ep_mgmt_find_ep()
735 /* Bind EP H/W context to EP address */
737 const uint8_t ep) in numaker_usbd_ep_mgmt_bind_ep() argument
739 struct numaker_usbd_ep *ep_cur = numaker_usbd_ep_mgmt_find_ep(dev, ep); in numaker_usbd_ep_mgmt_bind_ep()
748 /* Bind EP H/W context to EP address */ in numaker_usbd_ep_mgmt_bind_ep()
749 ep_cur->addr = ep; in numaker_usbd_ep_mgmt_bind_ep()
753 /* Assert EP H/W context bound to EP address */ in numaker_usbd_ep_mgmt_bind_ep()
756 __ASSERT_NO_MSG(ep_cur->addr == ep); in numaker_usbd_ep_mgmt_bind_ep()
761 static int numaker_usbd_xfer_out(const struct device *dev, uint8_t ep, bool strict) in numaker_usbd_xfer_out() argument
766 if (!USB_EP_DIR_IS_OUT(ep)) { in numaker_usbd_xfer_out()
767 LOG_ERR("Invalid EP address 0x%02x for data out", ep); in numaker_usbd_xfer_out()
771 if (udc_ep_is_busy(dev, ep)) { in numaker_usbd_xfer_out()
773 LOG_ERR("EP 0x%02x busy", ep); in numaker_usbd_xfer_out()
780 buf = udc_buf_peek(dev, ep); in numaker_usbd_xfer_out()
783 LOG_ERR("No buffer queued for EP 0x%02x", ep); in numaker_usbd_xfer_out()
790 /* Bind EP H/W context to EP address */ in numaker_usbd_xfer_out()
791 ep_cur = numaker_usbd_ep_mgmt_bind_ep(dev, ep); in numaker_usbd_xfer_out()
793 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep); in numaker_usbd_xfer_out()
802 static int numaker_usbd_xfer_in(const struct device *dev, uint8_t ep, bool strict) in numaker_usbd_xfer_in() argument
808 if (!USB_EP_DIR_IS_IN(ep)) { in numaker_usbd_xfer_in()
809 LOG_ERR("Invalid EP address 0x%02x for data in", ep); in numaker_usbd_xfer_in()
813 if (udc_ep_is_busy(dev, ep)) { in numaker_usbd_xfer_in()
815 LOG_ERR("EP 0x%02x busy", ep); in numaker_usbd_xfer_in()
822 buf = udc_buf_peek(dev, ep); in numaker_usbd_xfer_in()
825 LOG_ERR("No buffer queued for EP 0x%02x", ep); in numaker_usbd_xfer_in()
832 /* Bind EP H/W context to EP address */ in numaker_usbd_xfer_in()
833 ep_cur = numaker_usbd_ep_mgmt_bind_ep(dev, ep); in numaker_usbd_xfer_in()
835 LOG_ERR("ep=0x%02x", ep); in numaker_usbd_xfer_in()
863 LOG_ERR("Bind udc_ep_config: ep=0x%02x", USB_CONTROL_EP_OUT); in numaker_usbd_ctrl_feed_dout()
869 LOG_ERR("Allocate net_buf: ep=0x%02x", USB_CONTROL_EP_OUT); in numaker_usbd_ctrl_feed_dout()
883 uint8_t ep; in numaker_usbd_msg_handle_setup() local
890 ep = USB_CONTROL_EP_OUT; in numaker_usbd_msg_handle_setup()
892 /* Bind EP H/W context to EP address */ in numaker_usbd_msg_handle_setup()
893 ep_cur = numaker_usbd_ep_mgmt_bind_ep(dev, ep); in numaker_usbd_msg_handle_setup()
895 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep); in numaker_usbd_msg_handle_setup()
899 /* We should have reserved 1st/2nd EP H/W contexts for CTRL OUT/IN */ in numaker_usbd_msg_handle_setup()
945 uint8_t ep; in numaker_usbd_msg_handle_out() local
954 ep = msg->out.ep; in numaker_usbd_msg_handle_out()
956 udc_ep_set_busy(dev, ep, false); in numaker_usbd_msg_handle_out()
958 /* Bind EP H/W context to EP address */ in numaker_usbd_msg_handle_out()
959 ep_cur = numaker_usbd_ep_mgmt_bind_ep(dev, ep); in numaker_usbd_msg_handle_out()
961 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep); in numaker_usbd_msg_handle_out()
965 buf = udc_buf_peek(dev, ep); in numaker_usbd_msg_handle_out()
967 LOG_ERR("No buffer queued for ep=0x%02x", ep); in numaker_usbd_msg_handle_out()
971 if (ep == USB_CONTROL_EP_OUT) { in numaker_usbd_msg_handle_out()
980 if (ep == USB_CONTROL_EP_OUT) { in numaker_usbd_msg_handle_out()
986 LOG_ERR("Buffer queued for ep=0x%02x cannot accommodate packet", ep); in numaker_usbd_msg_handle_out()
991 if (ep == USB_CONTROL_EP_OUT && priv->ctrlout_tailroom != 0) { in numaker_usbd_msg_handle_out()
996 udc_buf_get(dev, ep); in numaker_usbd_msg_handle_out()
998 if (ep == USB_CONTROL_EP_OUT) { in numaker_usbd_msg_handle_out()
1022 LOG_ERR("udc_submit_ep_event failed for ep=0x%02x: %d", ep, err); in numaker_usbd_msg_handle_out()
1029 numaker_usbd_xfer_out(dev, ep, false); in numaker_usbd_msg_handle_out()
1038 uint8_t ep; in numaker_usbd_msg_handle_in() local
1044 ep = msg->in.ep; in numaker_usbd_msg_handle_in()
1046 udc_ep_set_busy(dev, ep, false); in numaker_usbd_msg_handle_in()
1048 /* Bind EP H/W context to EP address */ in numaker_usbd_msg_handle_in()
1049 ep_cur = numaker_usbd_ep_mgmt_bind_ep(dev, ep); in numaker_usbd_msg_handle_in()
1051 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep); in numaker_usbd_msg_handle_in()
1055 buf = udc_buf_peek(dev, ep); in numaker_usbd_msg_handle_in()
1066 udc_buf_get(dev, ep); in numaker_usbd_msg_handle_in()
1068 if (ep == USB_CONTROL_EP_IN) { in numaker_usbd_msg_handle_in()
1097 LOG_ERR("udc_submit_ep_event failed for ep=0x%02x: %d", ep, err); in numaker_usbd_msg_handle_in()
1104 numaker_usbd_xfer_in(dev, ep, false); in numaker_usbd_msg_handle_in()
1112 uint8_t ep; in numaker_usbd_msg_handle_xfer() local
1116 ep = msg->xfer.ep; in numaker_usbd_msg_handle_xfer()
1118 if (USB_EP_DIR_IS_OUT(ep)) { in numaker_usbd_msg_handle_xfer()
1119 numaker_usbd_xfer_out(dev, ep, false); in numaker_usbd_msg_handle_xfer()
1121 numaker_usbd_xfer_in(dev, ep, false); in numaker_usbd_msg_handle_xfer()
1284 /* USB Setup/EP */ in numaker_udbd_isr()
1308 * CTRL OUT EP in numaker_udbd_isr()
1315 /* EP events */ in numaker_udbd_isr()
1325 uint8_t ep; in numaker_udbd_isr() local
1327 /* We don't enable INNAKEN interrupt, so as long as EP event occurs, in numaker_udbd_isr()
1333 /* EP direction, number, and address */ in numaker_udbd_isr()
1338 ep = USB_EP_GET_ADDR(ep_idx, ep_dir); in numaker_udbd_isr()
1343 if (ep == USB_EP_GET_ADDR(0, USB_EP_DIR_IN)) { in numaker_udbd_isr()
1350 if (ep == USB_EP_GET_ADDR(0, USB_EP_DIR_OUT)) { in numaker_udbd_isr()
1359 if (USB_EP_DIR_IS_OUT(ep)) { in numaker_udbd_isr()
1361 msg.out.ep = ep; in numaker_udbd_isr()
1364 msg.in.ep = ep; in numaker_udbd_isr()
1368 /* Have handled this EP and go next */ in numaker_udbd_isr()
1387 /* Resume the EP's queued transfer */ in udc_numaker_ep_enqueue()
1390 msg.xfer.ep = ep_cfg->addr; in udc_numaker_ep_enqueue()
1402 /* Bind EP H/W context to EP address */ in udc_numaker_ep_dequeue()
1405 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep_cfg->addr); in udc_numaker_ep_dequeue()
1423 LOG_DBG("Set halt ep 0x%02x", ep_cfg->addr); in udc_numaker_ep_set_halt()
1425 /* Bind EP H/W context to EP address */ in udc_numaker_ep_set_halt()
1428 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep_cfg->addr); in udc_numaker_ep_set_halt()
1432 /* Set EP to stalled */ in udc_numaker_ep_set_halt()
1443 LOG_DBG("Clear halt ep 0x%02x", ep_cfg->addr); in udc_numaker_ep_clear_halt()
1445 /* Bind EP H/W context to EP address */ in udc_numaker_ep_clear_halt()
1448 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep_cfg->addr); in udc_numaker_ep_clear_halt()
1452 /* Reset EP to unstalled and data toggle bit to 0 */ in udc_numaker_ep_clear_halt()
1455 /* Resume the EP's queued transfer */ in udc_numaker_ep_clear_halt()
1457 msg.xfer.ep = ep_cfg->addr; in udc_numaker_ep_clear_halt()
1470 LOG_DBG("Enable ep 0x%02x", ep_cfg->addr); in udc_numaker_ep_enable()
1472 /* Bind EP H/W context to EP address */ in udc_numaker_ep_enable()
1475 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep_cfg->addr); in udc_numaker_ep_enable()
1479 /* Configure EP DMA buffer */ in udc_numaker_ep_enable()
1489 /* Configure EP DMA buffer */ in udc_numaker_ep_enable()
1493 /* Configure EP majorly */ in udc_numaker_ep_enable()
1496 /* Enable EP */ in udc_numaker_ep_enable()
1506 LOG_DBG("Disable ep 0x%02x", ep_cfg->addr); in udc_numaker_ep_disable()
1508 /* Bind EP H/W context to EP address */ in udc_numaker_ep_disable()
1511 LOG_ERR("Bind EP H/W context: ep=0x%02x", ep_cfg->addr); in udc_numaker_ep_disable()
1515 /* Disable EP */ in udc_numaker_ep_disable()
1586 /* Initialize all EP H/W contexts */ in udc_numaker_init()
1645 /* Some soc series don't allow ISO IN/OUT to be assigned the same EP number. in udc_numaker_driver_preinit()
1646 * This is addressed by limiting all OUT/IN EP addresses in top/bottom halves, in udc_numaker_driver_preinit()
1651 /* Limit all OUT EP numbers to 0, 1~7 */ in udc_numaker_driver_preinit()
1676 /* Limit all IN EP numbers to 0, 8~15 */ in udc_numaker_driver_preinit()