Lines Matching refs:ep_cfg
252 static int udc_ambiq_ep_enqueue(const struct device *dev, struct udc_ep_config *ep_cfg, in udc_ambiq_ep_enqueue() argument
257 .ep = ep_cfg->addr, in udc_ambiq_ep_enqueue()
261 LOG_DBG("%p enqueue %x %p", dev, ep_cfg->addr, buf); in udc_ambiq_ep_enqueue()
262 udc_buf_put(ep_cfg, buf); in udc_ambiq_ep_enqueue()
263 if (ep_cfg->addr == USB_CONTROL_EP_IN && buf->len == 0 && priv->ctrl_pending_in_ack) { in udc_ambiq_ep_enqueue()
269 if (!ep_cfg->stat.halted) { in udc_ambiq_ep_enqueue()
276 static int udc_ambiq_ep_dequeue(const struct device *dev, struct udc_ep_config *ep_cfg) in udc_ambiq_ep_dequeue() argument
284 buf = udc_buf_get_all(dev, ep_cfg->addr); in udc_ambiq_ep_dequeue()
289 udc_ep_set_busy(dev, ep_cfg->addr, false); in udc_ambiq_ep_dequeue()
290 am_hal_usb_ep_state_reset(priv->usb_handle, ep_cfg->addr); in udc_ambiq_ep_dequeue()
293 LOG_DBG("dequeue ep 0x%02x", ep_cfg->addr); in udc_ambiq_ep_dequeue()
298 static int udc_ambiq_ep_set_halt(const struct device *dev, struct udc_ep_config *ep_cfg) in udc_ambiq_ep_set_halt() argument
302 LOG_DBG("Halt ep 0x%02x", ep_cfg->addr); in udc_ambiq_ep_set_halt()
304 am_hal_usb_ep_stall(priv->usb_handle, ep_cfg->addr); in udc_ambiq_ep_set_halt()
305 if (USB_EP_GET_IDX(ep_cfg->addr)) { in udc_ambiq_ep_set_halt()
306 ep_cfg->stat.halted = true; in udc_ambiq_ep_set_halt()
312 static int udc_ambiq_ep_clear_halt(const struct device *dev, struct udc_ep_config *ep_cfg) in udc_ambiq_ep_clear_halt() argument
316 LOG_DBG("Clear halt ep 0x%02x", ep_cfg->addr); in udc_ambiq_ep_clear_halt()
318 am_hal_usb_ep_clear_stall(priv->usb_handle, ep_cfg->addr); in udc_ambiq_ep_clear_halt()
320 ep_cfg->stat.halted = false; in udc_ambiq_ep_clear_halt()
323 if (udc_buf_peek(dev, ep_cfg->addr)) { in udc_ambiq_ep_clear_halt()
325 .ep = ep_cfg->addr, in udc_ambiq_ep_clear_halt()
334 static int udc_ambiq_ep_enable(const struct device *dev, struct udc_ep_config *ep_cfg) in udc_ambiq_ep_enable() argument
340 __ASSERT_NO_MSG(ep_cfg); in udc_ambiq_ep_enable()
342 switch (ep_cfg->attributes) { in udc_ambiq_ep_enable()
359 status = am_hal_usb_ep_init(priv->usb_handle, ep_cfg->addr, endpoint_type, ep_cfg->mps); in udc_ambiq_ep_enable()
361 LOG_ERR("am_hal_usb_ep_init failed(0x%02x), %d", ep_cfg->addr, (int)status); in udc_ambiq_ep_enable()
365 LOG_DBG("Enable ep 0x%02x", ep_cfg->addr); in udc_ambiq_ep_enable()
370 static int udc_ambiq_ep_disable(const struct device *dev, struct udc_ep_config *ep_cfg) in udc_ambiq_ep_disable() argument
374 __ASSERT_NO_MSG(ep_cfg); in udc_ambiq_ep_disable()
375 am_hal_usb_ep_state_reset(priv->usb_handle, ep_cfg->addr); in udc_ambiq_ep_disable()
376 LOG_DBG("Disable ep 0x%02x", ep_cfg->addr); in udc_ambiq_ep_disable()
773 struct udc_ep_config *ep_cfg; in ambiq_thread_handler() local
778 ep_cfg = udc_get_ep_cfg(dev, evt.ep); in ambiq_thread_handler()
782 udc_event_xfer(dev, ep_cfg); in ambiq_thread_handler()
789 LOG_DBG("DOUT event ep 0x%02x", ep_cfg->addr); in ambiq_thread_handler()
790 ambiq_handle_evt_dout(dev, ep_cfg); in ambiq_thread_handler()
794 ambiq_handle_evt_din(dev, ep_cfg); in ambiq_thread_handler()