Lines Matching refs:td
715 dwc_otg_host_check_tx_fifo_empty(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
721 if (td->ep_type == UE_ISOCHRONOUS) {
750 struct dwc_otg_td *td, uint8_t is_out)
756 if (td->channel[0] < DWC_OTG_MAX_CHANNELS)
760 if (DWC_OTG_PC2UDEV(td->pc)->flags.self_suspended != 0)
765 if (dwc_otg_host_check_tx_fifo_empty(sc, td) != 0)
768 z = td->max_packet_count;
777 td->channel[y++] = x;
784 td->channel[0] = DWC_OTG_MAX_CHANNELS;
785 td->channel[1] = DWC_OTG_MAX_CHANNELS;
786 td->channel[2] = DWC_OTG_MAX_CHANNELS;
793 x = td->channel[y];
805 "HCSPLT=0x%08x\n", x, td->hcchar, td->hcsplt);
814 dwc_otg_host_channel_free_sub(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t index)
819 if (td->channel[index] >= DWC_OTG_MAX_CHANNELS)
823 x = td->channel[index];
824 td->channel[index] = DWC_OTG_MAX_CHANNELS;
860 dwc_otg_host_channel_free(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
863 for (x = 0; x != td->max_packet_count; x++)
864 dwc_otg_host_channel_free_sub(sc, td, x);
868 dwc_otg_host_dump_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
874 for (x = 0; x != td->max_packet_count; x++) {
875 if (td->channel[x] >= DWC_OTG_MAX_CHANNELS ||
876 td->channel[x] != GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status))
884 dwc_otg_host_setup_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
891 dwc_otg_host_dump_rx(sc, td);
893 if (td->channel[0] < DWC_OTG_MAX_CHANNELS) {
894 hcint = sc->sc_chan_state[td->channel[0]].hcint;
897 td->channel[0], td->state, hcint,
898 DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel[0])),
899 DWC_OTG_READ_4(sc, DOTG_HCTSIZ(td->channel[0])));
909 DPRINTF("CH=%d STALL\n", td->channel[0]);
910 td->error_stall = 1;
911 td->error_any = 1;
914 DPRINTF("CH=%d ERROR\n", td->channel[0]);
915 td->errcnt++;
916 if (td->hcsplt != 0 || td->errcnt >= 3) {
917 td->error_any = 1;
925 td->errcnt = 0;
929 switch (td->state) {
935 td->did_nak = 1;
936 td->tt_scheduled = 0;
939 td->offset += td->tx_bytes;
940 td->remainder -= td->tx_bytes;
941 td->toggle = 1;
942 td->tt_scheduled = 0;
949 td->did_nak = 1;
950 td->tt_scheduled = 0;
961 td->did_nak = 1;
962 td->tt_scheduled = 0;
965 td->offset += td->tx_bytes;
966 td->remainder -= td->tx_bytes;
967 td->toggle = 1;
982 dwc_otg_host_channel_free(sc, td);
984 if (sizeof(req) != td->remainder) {
985 td->error_any = 1;
989 if (td->hcsplt != 0) {
990 delta = td->tt_start_slot - sc->sc_last_frame_num - 1;
991 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
992 td->state = DWC_CHAN_ST_START;
995 delta = sc->sc_last_frame_num - td->tt_start_slot;
998 td->tt_scheduled = 0;
999 td->state = DWC_CHAN_ST_START;
1005 if (dwc_otg_host_channel_alloc(sc, td, 1)) {
1006 td->state = DWC_CHAN_ST_START;
1010 if (td->hcsplt != 0) {
1011 td->hcsplt &= ~HCSPLT_COMPSPLT;
1012 td->state = DWC_CHAN_ST_WAIT_S_ANE;
1014 td->state = DWC_CHAN_ST_WAIT_ANE;
1018 usbd_copy_out(td->pc, 0, &req, sizeof(req));
1020 DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(td->channel[0]),
1025 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel[0]), td->hcsplt);
1027 hcchar = td->hcchar;
1032 DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel[0]), hcchar);
1036 DOTG_DFIFO(td->channel[0]), (uint32_t *)&req, sizeof(req) / 4);
1039 td->tt_complete_slot = sc->sc_last_frame_num + 1;
1042 td->tx_bytes = sizeof(req);
1047 dwc_otg_host_channel_free(sc, td);
1049 delta = td->tt_complete_slot - sc->sc_last_frame_num - 1;
1050 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
1051 td->state = DWC_CHAN_ST_WAIT_C_PKT;
1054 delta = sc->sc_last_frame_num - td->tt_start_slot;
1057 if (td->ep_type != UE_ISOCHRONOUS)
1058 td->error_any = 1;
1062 if (dwc_otg_host_channel_alloc(sc, td, 0)) {
1063 td->state = DWC_CHAN_ST_WAIT_C_PKT;
1068 td->tt_complete_slot = sc->sc_last_frame_num + 1;
1070 td->hcsplt |= HCSPLT_COMPSPLT;
1071 td->state = DWC_CHAN_ST_WAIT_C_ANE;
1073 DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(td->channel[0]),
1076 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel[0]), td->hcsplt);
1078 hcchar = td->hcchar;
1083 DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel[0]), hcchar);
1089 dwc_otg_host_channel_free(sc, td);
1094 dwc_otg_setup_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
1111 GRXSTSRD_STP_COMPLETE || td->remainder != 0) {
1131 td->did_stall = 0;
1145 dwc_otg_read_fifo(sc, td->pc, 0, sizeof(req));
1148 usbd_copy_out(td->pc, 0, &req, sizeof(req));
1150 td->offset = sizeof(req);
1151 td->remainder = 0;
1171 td->did_stall = 1;
1175 if (!td->did_stall) {
1176 td->did_stall = 1;
1196 dwc_otg_host_rate_check_interrupt(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
1200 delta = sc->sc_tmr_val - td->tmr_val;
1204 td->tmr_val = sc->sc_tmr_val + td->tmr_res;
1207 if (td->set_toggle) {
1208 td->set_toggle = 0;
1209 td->toggle = 1;
1215 dwc_otg_host_rate_check(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
1219 if (td->ep_type == UE_ISOCHRONOUS) {
1221 if (frame_num & (td->tmr_res - 1))
1223 if ((frame_num ^ td->tmr_val) & td->tmr_res)
1225 td->tmr_val = td->tmr_res + sc->sc_last_frame_num;
1226 td->toggle = 0;
1228 } else if (td->ep_type == UE_INTERRUPT) {
1229 if (!td->tt_scheduled)
1231 td->tt_scheduled = 0;
1233 } else if (td->did_nak != 0) {
1235 if (td->tmr_res == frame_num) {
1240 } else if (td->set_toggle) {
1241 td->set_toggle = 0;
1242 td->toggle = 1;
1245 td->tmr_res = frame_num;
1246 td->did_nak = 0;
1253 dwc_otg_host_data_rx_sub(struct dwc_otg_softc *sc, struct dwc_otg_td *td,
1272 (int)td->state, (int)sc->sc_last_rx_status);
1287 if (td->ep_type == UE_ISOCHRONOUS) {
1291 td->tt_xactpos = HCSPLT_XACTPOS_MIDDLE;
1294 td->tt_xactpos = HCSPLT_XACTPOS_BEGIN;
1296 if (count != td->remainder) {
1298 td->short_pkt = 1;
1299 td->got_short = 1;
1304 if (count != td->max_packet_size) {
1305 if (count < td->max_packet_size) {
1307 td->short_pkt = 1;
1308 td->got_short = 1;
1311 td->error_any = 1;
1318 td->toggle ^= 1;
1319 td->tt_scheduled = 0;
1323 if (count > td->remainder) {
1325 td->error_any = 1;
1333 dwc_otg_read_fifo(sc, td->pc, td->offset, count);
1335 td->remainder -= count;
1336 td->offset += count;
1351 dwc_otg_host_data_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
1359 for (x = 0; x != td->max_packet_count; x++) {
1360 channel = td->channel[x];
1366 channel, td->state, hcint,
1376 td->error_stall = 1;
1377 td->error_any = 1;
1381 td->errcnt++;
1382 if (td->hcsplt != 0 || td->errcnt >= 3) {
1383 if (td->ep_type != UE_ISOCHRONOUS) {
1384 td->error_any = 1;
1391 if (dwc_otg_host_data_rx_sub(sc, td, channel))
1400 td->errcnt = 0;
1404 switch (td->state) {
1406 if (td->hcsplt != 0)
1413 if (td->ep_type == UE_INTERRUPT) {
1425 td->toggle ^= 1;
1428 } else if (td->ep_type == UE_ISOCHRONOUS) {
1429 if (td->hcsplt != 0) {
1444 td->did_nak = 1;
1445 td->tt_scheduled = 0;
1446 if (td->hcsplt != 0)
1451 if (td->hcsplt != 0) {
1456 td->error_any = 1;
1464 if (td->ep_type == UE_ISOCHRONOUS) {
1466 if (td->tt_xactpos == HCSPLT_XACTPOS_BEGIN) {
1468 } else if (td->hcsplt != 0) {
1476 if ((td->remainder == 0) || (td->got_short != 0)) {
1477 if (td->short_pkt)
1485 td->tt_scheduled = 0;
1486 td->did_nak = 0;
1487 if (td->hcsplt != 0)
1501 td->did_nak = 1;
1502 td->tt_scheduled = 0;
1505 td->tt_scheduled = 0;
1508 td->did_nak = 0;
1523 dwc_otg_host_channel_free(sc, td);
1525 if (td->hcsplt != 0) {
1526 delta = td->tt_complete_slot - sc->sc_last_frame_num - 1;
1527 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
1528 if (td->ep_type != UE_ISOCHRONOUS) {
1529 td->state = DWC_CHAN_ST_WAIT_C_PKT;
1533 delta = sc->sc_last_frame_num - td->tt_start_slot;
1535 if (td->ep_type != UE_ISOCHRONOUS) {
1537 td->error_any = 1;
1542 td->hcsplt |= HCSPLT_COMPSPLT;
1543 } else if (dwc_otg_host_rate_check(sc, td)) {
1544 td->state = DWC_CHAN_ST_WAIT_C_PKT;
1549 if (dwc_otg_host_channel_alloc(sc, td, 0)) {
1550 td->state = DWC_CHAN_ST_WAIT_C_PKT;
1555 if (td->set_toggle) {
1556 td->set_toggle = 0;
1557 td->toggle = 1;
1560 td->state = DWC_CHAN_ST_WAIT_ANE;
1562 for (x = 0; x != td->max_packet_count; x++) {
1563 channel = td->channel[x];
1567 (td->max_packet_size << HCTSIZ_XFERSIZE_SHIFT) |
1569 (td->toggle ? (HCTSIZ_PID_DATA1 << HCTSIZ_PID_SHIFT) :
1572 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(channel), td->hcsplt);
1574 hcchar = td->hcchar;
1577 if (td->ep_type == UE_ISOCHRONOUS) {
1578 if (td->hcsplt != 0) {
1599 td->tt_complete_slot = sc->sc_last_frame_num + 1;
1605 dwc_otg_host_channel_free(sc, td);
1607 delta = td->tt_start_slot - sc->sc_last_frame_num - 1;
1608 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
1609 td->state = DWC_CHAN_ST_START;
1612 delta = sc->sc_last_frame_num - td->tt_start_slot;
1615 td->tt_scheduled = 0;
1616 td->state = DWC_CHAN_ST_START;
1621 if (dwc_otg_host_channel_alloc(sc, td, 0)) {
1622 td->state = DWC_CHAN_ST_START;
1626 channel = td->channel[0];
1628 td->hcsplt &= ~HCSPLT_COMPSPLT;
1629 td->state = DWC_CHAN_ST_WAIT_S_ANE;
1635 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(channel), td->hcsplt);
1639 td->ep_type == UE_ISOCHRONOUS)
1640 td->hcchar |= HCCHAR_ODDFRM;
1642 td->hcchar &= ~HCCHAR_ODDFRM;
1644 hcchar = td->hcchar;
1648 td->tt_complete_slot = sc->sc_last_frame_num + 1;
1656 dwc_otg_host_channel_free(sc, td);
1661 dwc_otg_data_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
1673 if (GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status) != td->ep_no)
1681 if (td->remainder == 0) {
1692 td->error_any = 1;
1707 if (count != td->max_packet_size) {
1708 if (count < td->max_packet_size) {
1710 td->short_pkt = 1;
1714 td->error_any = 1;
1722 if (count > td->remainder) {
1724 td->error_any = 1;
1732 dwc_otg_read_fifo(sc, td->pc, td->offset, count);
1734 td->remainder -= count;
1735 td->offset += count;
1740 temp = sc->sc_out_ctl[td->ep_no];
1753 sc->sc_out_ctl[td->ep_no] = temp;
1757 if ((td->remainder == 0) || got_short) {
1758 if (td->short_pkt) {
1768 if (td->ep_no == 0) {
1772 DXEPTSIZ_SET_NBYTES(td->max_packet_size));
1775 DWC_OTG_WRITE_4(sc, DOTG_DOEPTSIZ(td->ep_no),
1779 ((td->max_packet_size + 3) & ~3)));
1781 temp = sc->sc_out_ctl[td->ep_no];
1782 DWC_OTG_WRITE_4(sc, DOTG_DOEPCTL(td->ep_no), temp |
1789 dwc_otg_host_data_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
1798 dwc_otg_host_dump_rx(sc, td);
1801 channel = td->channel[td->npkt];
1807 channel, td->state, hcint,
1816 td->error_stall = 1;
1817 td->error_any = 1;
1821 td->errcnt++;
1822 if (td->hcsplt != 0 || td->errcnt >= 3) {
1823 td->error_any = 1;
1831 td->errcnt = 0;
1837 switch (td->state) {
1843 td->did_nak = 1;
1844 td->tt_scheduled = 0;
1847 td->offset += td->tx_bytes;
1848 td->remainder -= td->tx_bytes;
1849 td->toggle ^= 1;
1852 td->did_nak = 1;
1854 td->did_nak = 0;
1855 td->tt_scheduled = 0;
1858 if (td->remainder == 0) {
1859 if (td->short_pkt)
1873 td->did_nak = 1;
1874 td->tt_scheduled = 0;
1877 td->did_nak = 0;
1886 td->did_nak = 1;
1887 td->tt_scheduled = 0;
1890 td->offset += td->tx_bytes;
1891 td->remainder -= td->tx_bytes;
1892 td->toggle ^= 1;
1893 td->did_nak = 0;
1894 td->tt_scheduled = 0;
1897 if (td->remainder == 0) {
1898 if (td->short_pkt)
1915 td->offset += td->tx_bytes;
1916 td->remainder -= td->tx_bytes;
1925 dwc_otg_host_channel_free(sc, td);
1927 if (td->hcsplt != 0) {
1928 delta = td->tt_start_slot - sc->sc_last_frame_num - 1;
1929 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
1930 td->state = DWC_CHAN_ST_START;
1933 delta = sc->sc_last_frame_num - td->tt_start_slot;
1936 td->tt_scheduled = 0;
1937 td->state = DWC_CHAN_ST_START;
1940 } else if (dwc_otg_host_rate_check(sc, td)) {
1941 td->state = DWC_CHAN_ST_START;
1946 if (dwc_otg_host_channel_alloc(sc, td, 1)) {
1947 td->state = DWC_CHAN_ST_START;
1952 if (td->set_toggle) {
1953 td->set_toggle = 0;
1954 td->toggle = 1;
1957 if (td->ep_type == UE_ISOCHRONOUS) {
1959 td->state = DWC_CHAN_ST_TX_WAIT_ISOC;
1960 td->hcsplt &= ~HCSPLT_COMPSPLT;
1961 if (td->hcsplt != 0) {
1963 count = td->remainder;
1966 td->error_any = 1;
1970 td->hcsplt &= ~HCSPLT_XACTPOS_MASK;
1971 td->hcsplt |= (HCSPLT_XACTPOS_ALL << HCSPLT_XACTPOS_SHIFT);
1973 } else if (td->hcsplt != 0) {
1974 td->hcsplt &= ~HCSPLT_COMPSPLT;
1976 td->state = DWC_CHAN_ST_WAIT_S_ANE;
1979 td->state = DWC_CHAN_ST_WAIT_ANE;
1982 td->tx_bytes = 0;
1984 for (x = 0; x != td->max_packet_count; x++) {
1987 channel = td->channel[x];
1990 count = td->max_packet_size;
1991 rem_bytes = td->remainder - td->tx_bytes;
1994 td->short_pkt = 1;
2004 (td->toggle ? (HCTSIZ_PID_DATA1 << HCTSIZ_PID_SHIFT) :
2020 } else if (td->ep_type == UE_ISOCHRONOUS &&
2021 td->max_packet_count > 1) {
2033 (td->toggle ? (HCTSIZ_PID_DATA1 << HCTSIZ_PID_SHIFT) :
2037 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(channel), td->hcsplt);
2039 hcchar = td->hcchar;
2044 td->ep_type == UE_ISOCHRONOUS)
2054 dwc_otg_write_fifo(sc, td->pc, td->offset +
2055 td->tx_bytes, DOTG_DFIFO(channel), count);
2059 td->tx_bytes += count;
2062 td->npkt = x;
2072 dwc_otg_host_channel_free(sc, td);
2074 delta = td->tt_complete_slot - sc->sc_last_frame_num - 1;
2075 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
2076 td->state = DWC_CHAN_ST_WAIT_C_PKT;
2079 delta = sc->sc_last_frame_num - td->tt_start_slot;
2082 if (td->ep_type != UE_ISOCHRONOUS)
2083 td->error_any = 1;
2088 if (dwc_otg_host_channel_alloc(sc, td, 0)) {
2089 td->state = DWC_CHAN_ST_WAIT_C_PKT;
2093 channel = td->channel[0];
2095 td->hcsplt |= HCSPLT_COMPSPLT;
2096 td->state = DWC_CHAN_ST_WAIT_C_ANE;
2101 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(channel), td->hcsplt);
2103 hcchar = td->hcchar;
2108 td->ep_type == UE_ISOCHRONOUS)
2117 td->tt_complete_slot = sc->sc_last_frame_num + 1;
2122 dwc_otg_host_channel_free(sc, td);
2127 dwc_otg_data_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
2138 max_buffer = sc->sc_hw_ep_profile[td->ep_no].max_buffer;
2145 if ((td->ep_no == 0) && (temp != 0) &&
2158 td->error_any = 1;
2164 if (td->tx_bytes != 0) {
2168 temp = DWC_OTG_READ_4(sc, DOTG_DIEPTSIZ(td->ep_no));
2173 if (cpkt >= td->npkt) {
2177 fifo_left = (td->npkt - cpkt) *
2178 td->max_packet_size;
2183 fifo_left = td->max_packet_size;
2187 count = td->tx_bytes;
2193 dwc_otg_write_fifo(sc, td->pc, td->offset,
2194 DOTG_DFIFO(td->ep_no), count);
2196 td->tx_bytes -= count;
2197 td->remainder -= count;
2198 td->offset += count;
2199 td->npkt = cpkt;
2201 if (td->tx_bytes != 0)
2205 if (td->remainder == 0) {
2206 if (td->short_pkt)
2217 temp = DWC_OTG_READ_4(sc, DOTG_DIEPTSIZ(td->ep_no));
2221 "DIEPCTL=0x%08x\n", td->ep_no,
2223 temp, DWC_OTG_READ_4(sc, DOTG_DIEPCTL(td->ep_no)));
2228 DPRINTFN(5, "rem=%u ep=%d\n", td->remainder, td->ep_no);
2231 if ((max_buffer != 0) && ((td->max_packet_size & 3) == 0)) {
2233 mpkt = max_buffer / td->max_packet_size;
2238 count = td->remainder;
2240 count = 0x7FFFFF - (0x7FFFFF % td->max_packet_size);
2242 td->npkt = count / td->max_packet_size;
2252 if (td->npkt > mpkt) {
2253 td->npkt = mpkt;
2254 count = td->max_packet_size * mpkt;
2255 } else if ((count == 0) || (count % td->max_packet_size)) {
2257 td->npkt++;
2258 td->short_pkt = 1;
2263 count = td->max_packet_size;
2264 if (td->remainder < count) {
2266 td->short_pkt = 1;
2267 count = td->remainder;
2269 td->npkt = 1;
2271 DWC_OTG_WRITE_4(sc, DOTG_DIEPTSIZ(td->ep_no),
2273 DXEPTSIZ_SET_NPKT(td->npkt) |
2277 td->npkt += mpkt;
2279 temp = sc->sc_in_ctl[td->ep_no];
2292 sc->sc_in_ctl[td->ep_no] = temp;
2296 DWC_OTG_WRITE_4(sc, DOTG_DIEPCTL(td->ep_no), temp |
2299 td->tx_bytes = count;
2302 if (td->tx_bytes == 0 &&
2303 td->remainder == 0) {
2304 if (td->short_pkt)
2316 dwc_otg_data_tx_sync(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
2323 temp = DWC_OTG_READ_4(sc, DOTG_DIEPTSIZ(td->ep_no));
2327 DPRINTFN(5, "busy ep=%d\n", td->ep_no);
2338 if ((td->ep_no == 0) && (temp != 0) &&
2360 struct dwc_otg_td *td;
2367 td = xfer->td_transfer_cache;
2368 if (td == NULL)
2372 if ((td->func) (sc, td)) {
2376 if (((void *)td) == xfer->td_transfer_last) {
2379 if (td->error_any) {
2381 } else if (td->remainder > 0) {
2386 if (!td->alt_next)
2394 tmr_res = td->tmr_res;
2395 tmr_val = td->tmr_val;
2396 toggle = td->toggle;
2397 td = td->obj_next;
2398 xfer->td_transfer_cache = td;
2399 td->toggle = toggle; /* transfer toggle */
2400 td->tmr_res = tmr_res;
2401 td->tmr_val = tmr_val;
2413 struct dwc_otg_td *td;
2417 td = xfer->td_transfer_cache;
2418 if (td == NULL) {
2493 struct dwc_otg_td *td;
2511 td = xfer->td_transfer_cache;
2512 if (td == NULL || td->ep_type != UE_ISOCHRONOUS)
2516 if ((td->hcchar & HCCHAR_EPDIR_IN) != 0)
2521 if (td->hcsplt == 0 || td->tt_scheduled != 0)
2526 sc->sc_tt_info + td->tt_index);
2535 td->tt_start_slot = temp + slot;
2536 td->tt_scheduled = 1;
2542 td = xfer->td_transfer_cache;
2543 if (td == NULL || td->ep_type != UE_ISOCHRONOUS)
2547 if ((td->hcchar & HCCHAR_EPDIR_IN) == 0)
2552 if (td->hcsplt == 0 || td->tt_scheduled != 0)
2556 td->tt_start_slot = temp;
2557 td->tt_scheduled = 1;
2563 td = xfer->td_transfer_cache;
2564 if (td == NULL || td->ep_type != UE_INTERRUPT)
2567 if (td->tt_scheduled != 0) {
2572 if (dwc_otg_host_rate_check_interrupt(sc, td))
2575 if (td->hcsplt == 0) {
2577 td->tt_scheduled = 1;
2582 td->tt_start_slot = temp;
2584 td->tt_scheduled = 1;
2590 td = xfer->td_transfer_cache;
2591 if (td == NULL ||
2592 td->ep_type != UE_CONTROL) {
2598 if (td->hcsplt == 0 || td->tt_scheduled != 0)
2602 td->tt_start_slot = temp;
2603 td->tt_scheduled = 1;
2610 td = xfer->td_transfer_cache;
2611 if (td == NULL ||
2612 td->ep_type != UE_BULK) {
2618 if (td->hcsplt == 0 || td->tt_scheduled != 0)
2622 td->tt_start_slot = temp;
2623 td->tt_scheduled = 1;
2634 td = xfer->td_transfer_cache;
2635 if (td == NULL || td->hcsplt == 0)
2645 td = xfer->td_transfer_cache;
2646 if (td == NULL || td->hcsplt != 0 || td->ep_type == UE_ISOCHRONOUS)
3088 struct dwc_otg_td *td;
3091 td = temp->td_next;
3092 temp->td = td;
3095 temp->td_next = td->obj_next;
3098 td->func = temp->func;
3099 td->pc = temp->pc;
3100 td->offset = temp->offset;
3101 td->remainder = temp->len;
3102 td->tx_bytes = 0;
3103 td->error_any = 0;
3104 td->error_stall = 0;
3105 td->npkt = 0;
3106 td->did_stall = temp->did_stall;
3107 td->short_pkt = temp->short_pkt;
3108 td->alt_next = temp->setup_alt_next;
3109 td->set_toggle = 0;
3110 td->got_short = 0;
3111 td->did_nak = 0;
3112 td->channel[0] = DWC_OTG_MAX_CHANNELS;
3113 td->channel[1] = DWC_OTG_MAX_CHANNELS;
3114 td->channel[2] = DWC_OTG_MAX_CHANNELS;
3115 td->state = 0;
3116 td->errcnt = 0;
3117 td->tt_scheduled = 0;
3118 td->tt_xactpos = HCSPLT_XACTPOS_BEGIN;
3125 struct dwc_otg_td *td;
3136 td = xfer->td_start[0];
3137 xfer->td_transfer_first = td;
3138 xfer->td_transfer_cache = td;
3143 temp.td = NULL;
3281 td = temp.td;
3282 td->set_toggle = 1;
3305 td = temp.td;
3306 xfer->td_transfer_last = td;
3316 td = xfer->td_transfer_first;
3317 td->toggle = (xfer->endpoint->toggle_next ? 1 : 0);
3338 if (td->ep_type == UE_INTERRUPT)
3341 hcchar |= (td->ep_type << HCCHAR_EPTYPE_SHIFT);
3361 if (td->ep_type == UE_INTERRUPT) {
3368 td->tmr_val = sc->sc_tmr_val + ival;
3369 td->tmr_res = ival;
3370 } else if (td->ep_type == UE_ISOCHRONOUS) {
3371 td->tmr_res = 1;
3372 td->tmr_val = sc->sc_last_frame_num;
3373 if (td->hcchar & HCCHAR_EPDIR_IN)
3374 td->tmr_val++;
3376 td->tmr_val = 0;
3377 td->tmr_res = (uint8_t)sc->sc_last_frame_num;
3382 if (td->ep_type == UE_INTERRUPT) {
3391 td->tmr_val = sc->sc_tmr_val + ival;
3392 td->tmr_res = ival;
3393 } else if (td->ep_type == UE_ISOCHRONOUS) {
3396 td->tmr_res = 1 << usbd_xfer_get_fps_shift(xfer);
3397 td->tmr_val = sc->sc_last_frame_num;
3398 if (td->hcchar & HCCHAR_EPDIR_IN)
3399 td->tmr_val += td->tmr_res;
3402 td->tmr_val = 0;
3403 td->tmr_res = (uint8_t)sc->sc_last_frame_num;
3408 td->tmr_val = 0;
3409 td->tmr_res = 0;
3415 td->hcchar = hcchar;
3416 td->hcsplt = hcsplt;
3418 if (((void *)td) == xfer->td_transfer_last)
3421 td = td->obj_next;
3458 struct dwc_otg_td *td = xfer->td_transfer_cache;
3459 if (td->ep_type == UE_ISOCHRONOUS &&
3460 (td->hcchar & HCCHAR_EPDIR_IN) == 0) {
3507 struct dwc_otg_td *td;
3513 td = xfer->td_transfer_cache;
3516 len = td->remainder;
3519 xfer->endpoint->toggle_next = td->toggle;
3527 td->error_any = 1;
3533 if (td->error_any) {
3535 error = (td->error_stall ?
3537 td = NULL;
3545 if (td->alt_next) {
3546 td = td->obj_next;
3548 td = NULL;
3552 td = NULL;
3557 td = td->obj_next;
3567 xfer->td_transfer_cache = td;
3630 struct dwc_otg_td *td;
3632 td = xfer->td_transfer_cache;
3633 if (td != NULL)
3634 dwc_otg_host_channel_free(sc, td);
4838 struct dwc_otg_td *td;
4841 td = USB_ADD_BYTES(parm->buf, parm->size[0]);
4846 td->tt_index = parm->udev->device_index;
4848 td->tt_index = parm->udev->parent_hs_hub->device_index;
4850 td->tt_index = parm->udev->device_index;
4854 td->max_packet_size = xfer->max_packet_size;
4855 td->max_packet_count = xfer->max_packet_count;
4857 if (td->max_packet_count == 0 || td->max_packet_count > 3)
4858 td->max_packet_count = 1;
4859 td->ep_no = ep_no;
4860 td->ep_type = ep_type;
4861 td->obj_next = last_obj;
4863 last_obj = td;
4865 parm->size[0] += sizeof(*td);