Lines Matching full:ep
138 * @param ep Endpoint control block pointer
142 struct nrf_usbd_ep_ctx *ep; member
212 * Max buffers size possible: 1536 Bytes (8 EP * 64B + 1 ISO * 1024B)
293 static inline nrf_usbd_common_ep_t ep_addr_to_nrfx(uint8_t ep) in ep_addr_to_nrfx() argument
295 return (nrf_usbd_common_ep_t)ep; in ep_addr_to_nrfx()
298 static inline uint8_t nrfx_addr_to_ep(nrf_usbd_common_ep_t ep) in nrfx_addr_to_ep() argument
300 return (uint8_t)ep; in nrfx_addr_to_ep()
303 static inline bool ep_is_valid(const uint8_t ep) in ep_is_valid() argument
305 uint8_t ep_num = USB_EP_GET_IDX(ep); in ep_is_valid()
307 if (NRF_USBD_EPIN_CHECK(ep)) { in ep_is_valid()
332 static struct nrf_usbd_ep_ctx *endpoint_ctx(const uint8_t ep) in endpoint_ctx() argument
337 if (!ep_is_valid(ep)) { in endpoint_ctx()
342 ep_num = NRF_USBD_EP_NR_GET(ep); in endpoint_ctx()
344 if (NRF_USBD_EPIN_CHECK(ep)) { in endpoint_ctx()
345 if (unlikely(NRF_USBD_EPISO_CHECK(ep))) { in endpoint_ctx()
351 if (unlikely(NRF_USBD_EPISO_CHECK(ep))) { in endpoint_ctx()
363 static struct nrf_usbd_ep_ctx *in_endpoint_ctx(const uint8_t ep) in in_endpoint_ctx() argument
365 return endpoint_ctx(NRF_USBD_EPIN(ep)); in in_endpoint_ctx()
368 static struct nrf_usbd_ep_ctx *out_endpoint_ctx(const uint8_t ep) in out_endpoint_ctx() argument
370 return endpoint_ctx(NRF_USBD_EPOUT(ep)); in out_endpoint_ctx()
741 "Invalid event on CTRL EP."); in usbd_work_process_setup()
810 struct nrf_usbd_ep_ctx *ep_ctx = ep_evt->ep; in usbd_work_process_ep_events()
850 endpoint_ctx(p_event->data.eptransfer.ep); in usbd_event_transfer_ctrl()
852 if (NRF_USBD_EPIN_CHECK(p_event->data.eptransfer.ep)) { in usbd_event_transfer_ctrl()
864 ev->evt.ep_evt.ep = ep_ctx; in usbd_event_transfer_ctrl()
874 p_event->data.eptransfer.ep); in usbd_event_transfer_ctrl()
879 LOG_ERR("Unexpected event (nrfx_usbd): %d, ep 0x%02x", in usbd_event_transfer_ctrl()
881 p_event->data.eptransfer.ep); in usbd_event_transfer_ctrl()
899 ev->evt.ep_evt.ep = ep_ctx; in usbd_event_transfer_ctrl()
917 ev->evt.ep_evt.ep = ep_ctx; in usbd_event_transfer_ctrl()
920 p_event->data.eptransfer.ep, &ep_ctx->buf.len); in usbd_event_transfer_ctrl()
943 LOG_ERR("Unexpected event (nrfx_usbd): %d, ep 0x%02x", in usbd_event_transfer_ctrl()
945 p_event->data.eptransfer.ep); in usbd_event_transfer_ctrl()
955 endpoint_ctx(p_event->data.eptransfer.ep); in usbd_event_transfer_data()
957 if (NRF_USBD_EPIN_CHECK(p_event->data.eptransfer.ep)) { in usbd_event_transfer_data()
966 LOG_DBG("write complete, ep 0x%02x", in usbd_event_transfer_data()
967 (uint32_t)p_event->data.eptransfer.ep); in usbd_event_transfer_data()
972 ev->evt.ep_evt.ep = ep_ctx; in usbd_event_transfer_data()
980 p_event->data.eptransfer.ep); in usbd_event_transfer_data()
985 LOG_ERR("Unexpected event (nrfx_usbd): %d, ep 0x%02x", in usbd_event_transfer_data()
987 p_event->data.eptransfer.ep); in usbd_event_transfer_data()
1001 LOG_DBG("read request, ep 0x%02x", in usbd_event_transfer_data()
1002 (uint32_t)p_event->data.eptransfer.ep); in usbd_event_transfer_data()
1007 ev->evt.ep_evt.ep = ep_ctx; in usbd_event_transfer_data()
1022 p_event->data.eptransfer.ep); in usbd_event_transfer_data()
1024 LOG_DBG("read complete, ep 0x%02x, len %d", in usbd_event_transfer_data()
1025 (uint32_t)p_event->data.eptransfer.ep, in usbd_event_transfer_data()
1030 ev->evt.ep_evt.ep = ep_ctx; in usbd_event_transfer_data()
1038 LOG_ERR("Unexpected event (nrfx_usbd): %d, ep 0x%02x", in usbd_event_transfer_data()
1040 p_event->data.eptransfer.ep); in usbd_event_transfer_data()
1088 ep_ctx = endpoint_ctx(p_event->data.eptransfer.ep); in usbd_event_handler()
1121 evt.evt.ep_evt.ep = ep_ctx; in usbd_event_handler()
1171 * ISO OUT EP.
1174 * from ISO OUT ep is synchronized with SOF frame. For more details
1184 LOG_ERR("There is no ISO ep"); in usbd_sof_trigger_iso_read()
1190 * if the iso OUT ep is enabled in usbd_sof_trigger_iso_read()
1201 ev->evt.ep_evt.ep = ep_ctx; in usbd_sof_trigger_iso_read()
1227 LOG_ERR("not attached, EP 0x%02x event dropped", in usbd_work_handler()
1228 (uint32_t)ev->evt.ep_evt.ep->cfg.addr); in usbd_work_handler()
1383 LOG_DBG("ep 0x%02x, mps %d, type %d", ep_cfg->ep_addr, ep_cfg->ep_mps, in usb_dc_ep_check_cap()
1440 LOG_ERR("EP max packet size must be a power of 2"); in usb_dc_ep_configure()
1451 int usb_dc_ep_set_stall(const uint8_t ep) in usb_dc_ep_set_stall() argument
1459 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_set_stall()
1470 nrf_usbd_common_ep_stall(ep_addr_to_nrfx(ep)); in usb_dc_ep_set_stall()
1480 LOG_DBG("STALL on EP 0x%02x", ep); in usb_dc_ep_set_stall()
1485 int usb_dc_ep_clear_stall(const uint8_t ep) in usb_dc_ep_clear_stall() argument
1494 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_clear_stall()
1499 if (NRF_USBD_EPISO_CHECK(ep)) { in usb_dc_ep_clear_stall()
1504 nrf_usbd_common_ep_dtoggle_clear(ep_addr_to_nrfx(ep)); in usb_dc_ep_clear_stall()
1505 nrf_usbd_common_ep_stall_clear(ep_addr_to_nrfx(ep)); in usb_dc_ep_clear_stall()
1506 LOG_DBG("Unstall on EP 0x%02x", ep); in usb_dc_ep_clear_stall()
1511 int usb_dc_ep_halt(const uint8_t ep) in usb_dc_ep_halt() argument
1513 return usb_dc_ep_set_stall(ep); in usb_dc_ep_halt()
1516 int usb_dc_ep_is_stalled(const uint8_t ep, uint8_t *const stalled) in usb_dc_ep_is_stalled() argument
1524 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_is_stalled()
1533 *stalled = (uint8_t) nrf_usbd_common_ep_stall_check(ep_addr_to_nrfx(ep)); in usb_dc_ep_is_stalled()
1538 int usb_dc_ep_enable(const uint8_t ep) in usb_dc_ep_enable() argument
1546 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_enable()
1551 if (!NRF_USBD_EPISO_CHECK(ep)) { in usb_dc_ep_enable()
1555 nrf_usbd_common_ep_dtoggle_clear(ep_addr_to_nrfx(ep)); in usb_dc_ep_enable()
1557 * This should also clear EP's halt status. in usb_dc_ep_enable()
1559 nrf_usbd_common_ep_stall_clear(ep_addr_to_nrfx(ep)); in usb_dc_ep_enable()
1565 LOG_DBG("EP enable: 0x%02x", ep); in usb_dc_ep_enable()
1571 nrf_usbd_common_ep_enable(ep_addr_to_nrfx(ep)); in usb_dc_ep_enable()
1577 int usb_dc_ep_disable(const uint8_t ep) in usb_dc_ep_disable() argument
1581 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_disable()
1590 LOG_DBG("EP disable: 0x%02x", ep); in usb_dc_ep_disable()
1592 nrf_usbd_common_ep_disable(ep_addr_to_nrfx(ep)); in usb_dc_ep_disable()
1603 int usb_dc_ep_flush(const uint8_t ep) in usb_dc_ep_flush() argument
1611 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_flush()
1619 nrf_usbd_common_transfer_out_drop(ep_addr_to_nrfx(ep)); in usb_dc_ep_flush()
1624 int usb_dc_ep_write(const uint8_t ep, const uint8_t *const data, in usb_dc_ep_write() argument
1627 LOG_DBG("ep_write: ep 0x%02x, len %d", ep, data_len); in usb_dc_ep_write()
1636 if (NRF_USBD_EPOUT_CHECK(ep)) { in usb_dc_ep_write()
1640 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_write()
1646 LOG_ERR("Endpoint 0x%02x is not enabled", ep); in usb_dc_ep_write()
1653 * for one EP at a time. Next USB transfer on this endpoint can be in usb_dc_ep_write()
1687 && (nrf_usbd_common_last_setup_dir_get() != ep)) { in usb_dc_ep_write()
1695 nrfx_err_t err = nrf_usbd_common_ep_transfer(ep_addr_to_nrfx(ep), &transfer); in usb_dc_ep_write()
1714 int usb_dc_ep_read_wait(uint8_t ep, uint8_t *data, uint32_t max_data_len, in usb_dc_ep_read_wait() argument
1725 if (NRF_USBD_EPIN_CHECK(ep)) { in usb_dc_ep_read_wait()
1733 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_read_wait()
1739 LOG_ERR("Endpoint 0x%02x is not enabled", ep); in usb_dc_ep_read_wait()
1767 int usb_dc_ep_read_continue(uint8_t ep) in usb_dc_ep_read_continue() argument
1776 if (NRF_USBD_EPIN_CHECK(ep)) { in usb_dc_ep_read_continue()
1780 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_read_continue()
1786 LOG_ERR("Endpoint 0x%02x is not enabled", ep); in usb_dc_ep_read_continue()
1804 ev->evt.ep_evt.ep = ep_ctx; in usb_dc_ep_read_continue()
1815 int usb_dc_ep_read(const uint8_t ep, uint8_t *const data, in usb_dc_ep_read() argument
1818 LOG_DBG("ep_read: ep 0x%02x, maxlen %d", ep, max_data_len); in usb_dc_ep_read()
1821 ret = usb_dc_ep_read_wait(ep, data, max_data_len, read_bytes); in usb_dc_ep_read()
1830 ret = usb_dc_ep_read_continue(ep); in usb_dc_ep_read()
1834 int usb_dc_ep_set_callback(const uint8_t ep, const usb_dc_ep_callback cb) in usb_dc_ep_set_callback() argument
1842 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_set_callback()
1857 int usb_dc_ep_mps(const uint8_t ep) in usb_dc_ep_mps() argument
1865 ep_ctx = endpoint_ctx(ep); in usb_dc_ep_mps()