Lines Matching refs:udata0
188 static struct usb_it82xx2_data udata0; variable
295 if (USB_EP_DIR_IS_IN(ep) && udata0.ep_data[ep_idx].ep_status == EP_CONFIG_IN) { in it82xx2_usb_fifo_ctrl()
304 udata0.ep_data[ep_idx].ep_status == EP_CONFIG_OUT) { in it82xx2_usb_fifo_ctrl()
584 (udata0.last_token == IN_TOKEN && in it82xx2_check_setup_following_out()
598 udata0.st_state = STALL_SEND; in it82xx2_handler_setup()
604 if (udata0.st_state == DIN_ST) { in it82xx2_handler_setup()
606 udata0.last_token = udata0.now_token; in it82xx2_handler_setup()
607 udata0.now_token = OUT_TOKEN; in it82xx2_handler_setup()
608 udata0.st_state = STATUS_ST; in it82xx2_handler_setup()
609 udata0.ep_data[ep_idx].cb_out(ep_idx | USB_EP_DIR_OUT, USB_DC_EP_DATA_OUT); in it82xx2_handler_setup()
611 } else if (udata0.st_state == DOUT_ST || udata0.st_state == SETUP_ST) { in it82xx2_handler_setup()
616 udata0.last_token = udata0.now_token; in it82xx2_handler_setup()
617 udata0.now_token = IN_TOKEN; in it82xx2_handler_setup()
618 udata0.st_state = STATUS_ST; in it82xx2_handler_setup()
619 udata0.ep_data[ep_idx].cb_in(ep_idx | USB_EP_DIR_IN, USB_DC_EP_DATA_IN); in it82xx2_handler_setup()
622 udata0.last_token = udata0.now_token; in it82xx2_handler_setup()
623 udata0.now_token = SETUP_TOKEN; in it82xx2_handler_setup()
624 udata0.st_state = SETUP_ST; in it82xx2_handler_setup()
627 udata0.ep_data[ep_idx].cb_out(ep_idx | USB_EP_DIR_OUT, USB_DC_EP_SETUP); in it82xx2_handler_setup()
630 if (udata0.no_data_ctrl) { in it82xx2_handler_setup()
632 udata0.no_data_ctrl = false; in it82xx2_handler_setup()
644 udata0.st_state = STALL_SEND; in it82xx2_handler_in()
649 if (udata0.st_state >= STATUS_ST) { in it82xx2_handler_in()
653 udata0.last_token = udata0.now_token; in it82xx2_handler_in()
654 udata0.now_token = IN_TOKEN; in it82xx2_handler_in()
656 if (udata0.addr != DC_ADDR_NULL && in it82xx2_handler_in()
657 udata0.addr != usb_regs->dc_address) { in it82xx2_handler_in()
658 usb_regs->dc_address = udata0.addr; in it82xx2_handler_in()
662 if (udata0.st_state == DOUT_ST) { in it82xx2_handler_in()
664 udata0.st_state = STATUS_ST; in it82xx2_handler_in()
666 } else if (udata0.ep_data[ep_idx].remaining == 0 && in it82xx2_handler_in()
667 udata0.st_state == SETUP_ST) { in it82xx2_handler_in()
669 udata0.st_state = STATUS_ST; in it82xx2_handler_in()
672 udata0.st_state = DIN_ST; in it82xx2_handler_in()
678 if (udata0.ep_data[ep_idx].cb_in) { in it82xx2_handler_in()
679 udata0.ep_data[ep_idx].cb_in(ep_idx | USB_EP_DIR_IN, USB_DC_EP_DATA_IN); in it82xx2_handler_in()
687 k_sem_give(&udata0.fifo_sem[ep_fifo - 1]); in it82xx2_handler_in()
689 if (udata0.st_state == DIN_ST && udata0.ep_data[ep_idx].remaining == 0) { in it82xx2_handler_in()
699 if (udata0.st_state >= STATUS_ST) { in it82xx2_handler_out()
703 udata0.last_token = udata0.now_token; in it82xx2_handler_out()
704 udata0.now_token = OUT_TOKEN; in it82xx2_handler_out()
706 if (udata0.st_state == SETUP_ST) { in it82xx2_handler_out()
708 udata0.st_state = DOUT_ST; in it82xx2_handler_out()
711 udata0.st_state = STATUS_ST; in it82xx2_handler_out()
715 if (udata0.ep_data[ep_idx].cb_out) { in it82xx2_handler_out()
716 udata0.ep_data[ep_idx].cb_out(ep_idx, USB_DC_EP_DATA_OUT); in it82xx2_handler_out()
722 udata0.last_token = udata0.now_token; in it82xx2_handler_out()
723 udata0.now_token = SETUP_TOKEN; in it82xx2_handler_out()
724 udata0.st_state = SETUP_ST; in it82xx2_handler_out()
726 udata0.ep_data[ep_idx].cb_out(ep_idx | USB_EP_DIR_OUT, USB_DC_EP_SETUP); in it82xx2_handler_out()
728 if (udata0.no_data_ctrl) { in it82xx2_handler_out()
730 udata0.no_data_ctrl = false; in it82xx2_handler_out()
811 udata0.ep_data[ep_idx].ep_status != EP_CONFIG_IN) { in it82xx2_usb_fake_token()
816 if (!udata0.fifo_ready[ep_fifo - 1] || in it82xx2_usb_fake_token()
817 udata0.ep_data[ep_idx].ep_status != EP_CONFIG_OUT) { in it82xx2_usb_fake_token()
820 udata0.fifo_ready[ep_fifo - 1] = false; in it82xx2_usb_fake_token()
871 if (udata0.suspended) { in emit_resume_event()
872 udata0.suspended = false; in emit_resume_event()
873 k_sem_give(&udata0.suspended_sem); in emit_resume_event()
874 if (udata0.usb_status_cb) { in emit_resume_event()
875 (*(udata0.usb_status_cb))(USB_DC_RESUME, NULL); in emit_resume_event()
903 k_work_reschedule(&udata0.check_suspended_work, K_MSEC(5)); in it82xx2_usb_dc_isr()
961 if (udata0.attached) { in usb_dc_attach()
974 udata0.ep_data[idx].ep_status = EP_INIT; in usb_dc_attach()
977 udata0.attached = 1U; in usb_dc_attach()
980 udata0.fifo_ready[0] = false; in usb_dc_attach()
981 udata0.fifo_ready[1] = false; in usb_dc_attach()
982 udata0.fifo_ready[2] = false; in usb_dc_attach()
984 k_sem_init(&udata0.fifo_sem[0], 1, 1); in usb_dc_attach()
985 k_sem_init(&udata0.fifo_sem[1], 1, 1); in usb_dc_attach()
986 k_sem_init(&udata0.fifo_sem[2], 1, 1); in usb_dc_attach()
987 k_sem_init(&udata0.suspended_sem, 0, 1); in usb_dc_attach()
989 k_work_init_delayable(&udata0.check_suspended_work, suspended_check_handler); in usb_dc_attach()
999 it82xx2_enable_wu90_irq(udata0.dev, true); in usb_dc_attach()
1009 if (!udata0.attached) { in usb_dc_detach()
1019 udata0.attached = 0U; in usb_dc_detach()
1036 if (udata0.ep_data[idx].ep_status > EP_CHECK) { in usb_dc_reset()
1044 udata0.addr = DC_ADDR_NULL; in usb_dc_reset()
1047 if (udata0.usb_status_cb) { in usb_dc_reset()
1048 (*(udata0.usb_status_cb))(USB_DC_RESET, NULL); in usb_dc_reset()
1057 udata0.addr = addr & DC_ADDR_MASK; in usb_dc_set_address()
1063 udata0.usb_status_cb = cb; in usb_dc_set_status_callback()
1091 if (udata0.ep_data[ep_idx].ep_status > EP_INIT) { in usb_dc_ep_check_cap()
1097 udata0.ep_data[ep_idx].mps = cfg->ep_mps; in usb_dc_ep_check_cap()
1100 udata0.ep_data[ep_idx].ep_status = EP_CHECK; in usb_dc_ep_check_cap()
1111 if (!udata0.attached || ep_idx >= MAX_NUM_ENDPOINTS) { in usb_dc_ep_configure()
1121 udata0.ep_data[ep_idx].ep_status = EP_CONFIG; in usb_dc_ep_configure()
1122 udata0.ep_data[ep_idx].mps = cfg->ep_mps; in usb_dc_ep_configure()
1125 udata0.ep_data[ep_idx].ep_status, udata0.ep_data[ep_idx].mps); in usb_dc_ep_configure()
1135 udata0.ep_data[ep_idx].ep_status = EP_CONFIG_IN; in usb_dc_ep_configure()
1137 udata0.ep_data[ep_idx].ep_status = EP_CONFIG_OUT; in usb_dc_ep_configure()
1156 udata0.ep_data[ep_idx].ep_type = cfg->ep_type; in usb_dc_ep_configure()
1166 if (!udata0.attached || ep_idx >= MAX_NUM_ENDPOINTS) { in usb_dc_ep_set_callback()
1180 udata0.ep_data[ep_idx].cb_in = cb; in usb_dc_ep_set_callback()
1182 udata0.ep_data[ep_idx].cb_out = cb; in usb_dc_ep_set_callback()
1193 if (!udata0.attached || ep_idx >= MAX_NUM_ENDPOINTS) { in usb_dc_ep_enable()
1218 if (!udata0.attached || ep_idx >= MAX_NUM_ENDPOINTS) { in usb_dc_ep_disable()
1257 udata0.no_data_ctrl = false; in usb_dc_ep_set_stall()
1258 udata0.st_state = STALL_SEND; in usb_dc_ep_set_stall()
1334 if ((udata0.now_token == SETUP_TOKEN) && (data_len == 0)) { in usb_dc_ep_write()
1340 if (udata0.st_state == SETUP_ST) { in usb_dc_ep_write()
1341 udata0.st_state = DIN_ST; in usb_dc_ep_write()
1344 k_sem_take(&udata0.fifo_sem[ep_fifo - 1], K_FOREVER); in usb_dc_ep_write()
1349 if (data_len > udata0.ep_data[ep_idx].mps) { in usb_dc_ep_write()
1351 for (uint32_t idx = 0; idx < udata0.ep_data[ep_idx].mps; idx++) { in usb_dc_ep_write()
1355 *ret_bytes = udata0.ep_data[ep_idx].mps; in usb_dc_ep_write()
1356 udata0.ep_data[ep_idx].remaining = in usb_dc_ep_write()
1357 data_len - udata0.ep_data[ep_idx].mps; in usb_dc_ep_write()
1367 udata0.ep_data[ep_idx].remaining = 0; in usb_dc_ep_write()
1414 udata0.fifo_ready[ep_fifo - 1] = true; in usb_dc_ep_read()
1424 if (udata0.st_state == STATUS_ST) { in usb_dc_ep_read()
1427 } else if (udata0.now_token == SETUP_TOKEN) { in usb_dc_ep_read()
1456 udata0.now_token == SETUP_TOKEN) { in usb_dc_ep_read()
1463 udata0.fifo_ready[ep_fifo - 1] = true; in usb_dc_ep_read()
1465 } else if (udata0.now_token == SETUP_TOKEN) { in usb_dc_ep_read()
1475 udata0.no_data_ctrl = true; in usb_dc_ep_read()
1541 udata0.fifo_ready[ep_fifo - 1] = true; in usb_dc_ep_read_continue()
1557 if (udata0.ep_data[ep_idx].ep_status < EP_CONFIG) { in usb_dc_ep_mps()
1562 return udata0.ep_data[ep_idx].mps; in usb_dc_ep_mps()
1570 if (udata0.suspended) { in usb_dc_wakeup_request()
1585 ret = k_sem_take(&udata0.suspended_sem, K_MSEC(500)); in usb_dc_wakeup_request()
1607 udata0.dev = dev; in it82xx2_usb_dc_init()
1615 &udata0,