Lines Matching full:usbhs
83 if ((USBHS->USBHS_DEVCTRL & USBHS_DEVCTRL_SPDCONF_Msk) in usb_dc_enable_clock()
107 return (USBHS->USBHS_DEVCTRL & USBHS_DEVCTRL_DETACH) == 0; in usb_dc_is_attached()
113 return USBHS->USBHS_DEVEPTISR[ep_idx] & USBHS_DEVEPTISR_CFGOK; in usb_dc_ep_is_configured()
119 return USBHS->USBHS_DEVEPT & BIT(USBHS_DEVEPT_EPEN0_Pos + ep_idx); in usb_dc_ep_is_enabled()
125 USBHS->USBHS_DEVEPT |= BIT(USBHS_DEVEPT_EPRST0_Pos + ep_idx); in usb_dc_ep_reset()
126 USBHS->USBHS_DEVEPT &= ~BIT(USBHS_DEVEPT_EPRST0_Pos + ep_idx); in usb_dc_ep_reset()
135 USBHS->USBHS_DEVEPTIER[ep_idx] = USBHS_DEVEPTIER_CTRL_RXSTPES; in usb_dc_ep_enable_interrupts()
136 USBHS->USBHS_DEVEPTIER[ep_idx] = USBHS_DEVEPTIER_RXOUTES; in usb_dc_ep_enable_interrupts()
137 } else if ((USBHS->USBHS_DEVEPTCFG[ep_idx] & USBHS_DEVEPTCFG_EPDIR_Msk) in usb_dc_ep_enable_interrupts()
140 USBHS->USBHS_DEVEPTICR[ep_idx] = USBHS_DEVEPTICR_TXINIC; in usb_dc_ep_enable_interrupts()
141 USBHS->USBHS_DEVEPTIER[ep_idx] = USBHS_DEVEPTIER_TXINES; in usb_dc_ep_enable_interrupts()
144 USBHS->USBHS_DEVEPTIER[ep_idx] = USBHS_DEVEPTIER_RXOUTES; in usb_dc_ep_enable_interrupts()
172 uint32_t sr = USBHS->USBHS_DEVEPTISR[0] & USBHS->USBHS_DEVEPTIMR[0]; in usb_dc_ep0_isr()
173 uint32_t dev_ctrl = USBHS->USBHS_DEVCTRL; in usb_dc_ep0_isr()
187 USBHS->USBHS_DEVEPTIDR[0] = USBHS_DEVEPTIDR_TXINEC; in usb_dc_ep0_isr()
199 USBHS->USBHS_DEVCTRL = dev_ctrl | USBHS_DEVCTRL_ADDEN; in usb_dc_ep0_isr()
207 uint32_t sr = USBHS->USBHS_DEVEPTISR[ep_idx] & in usb_dc_ep_isr()
208 USBHS->USBHS_DEVEPTIMR[ep_idx]; in usb_dc_ep_isr()
214 USBHS->USBHS_DEVEPTICR[ep_idx] = USBHS_DEVEPTICR_RXOUTIC; in usb_dc_ep_isr()
224 USBHS->USBHS_DEVEPTICR[ep_idx] = USBHS_DEVEPTICR_TXINIC; in usb_dc_ep_isr()
235 uint32_t sr = USBHS->USBHS_DEVISR & USBHS->USBHS_DEVIMR; in usb_dc_isr()
240 USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSMC; in usb_dc_isr()
249 USBHS->USBHS_DEVICR = USBHS_DEVICR_EORSTC; in usb_dc_isr()
271 USBHS->USBHS_DEVEPTCFG[idx] &= ~USBHS_DEVEPTCFG_ALLOC; in usb_dc_isr()
281 USBHS->USBHS_DEVICR = USBHS_DEVICR_SUSPC; in usb_dc_isr()
291 USBHS->USBHS_DEVICR = USBHS_DEVICR_SOFC; in usb_dc_isr()
317 /* Enable USBHS clock in PMC */ in usb_dc_attach()
322 USBHS->USBHS_CTRL = USBHS_CTRL_UIMOD | USBHS_CTRL_USBE | in usb_dc_attach()
335 USBHS->USBHS_DEVCTRL = regval; in usb_dc_attach()
341 USBHS->USBHS_CTRL = USBHS_CTRL_UIMOD | USBHS_CTRL_USBE; in usb_dc_attach()
344 USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSMES; in usb_dc_attach()
345 USBHS->USBHS_DEVIER = USBHS_DEVIER_EORSTES; in usb_dc_attach()
346 USBHS->USBHS_DEVIER = USBHS_DEVIER_SUSPES; in usb_dc_attach()
348 USBHS->USBHS_DEVIER = USBHS_DEVIER_SOFES; in usb_dc_attach()
357 USBHS->USBHS_DEVCTRL &= ~USBHS_DEVCTRL_DETACH; in usb_dc_attach()
369 USBHS->USBHS_DEVCTRL |= USBHS_DEVCTRL_DETACH; in usb_dc_detach()
375 USBHS->USBHS_CTRL = USBHS_CTRL_UIMOD | USBHS_CTRL_FRZCLK; in usb_dc_detach()
377 /* Disable USBHS clock in PMC */ in usb_dc_detach()
392 USBHS->USBHS_CTRL = USBHS_CTRL_UIMOD | USBHS_CTRL_FRZCLK; in usb_dc_reset()
408 USBHS->USBHS_DEVCTRL &= ~(USBHS_DEVCTRL_UADD_Msk | USBHS_DEVCTRL_ADDEN); in usb_dc_set_address()
409 USBHS->USBHS_DEVCTRL |= USBHS_DEVCTRL_UADD(addr); in usb_dc_set_address()
532 USBHS->USBHS_DEVEPTCFG[ep_idx] = regval; in usb_dc_ep_configure()
550 USBHS->USBHS_DEVEPTCFG[i] &= ~USBHS_DEVEPTCFG_ALLOC; in usb_dc_ep_configure()
557 USBHS->USBHS_DEVEPTCFG[i] |= USBHS_DEVEPTCFG_ALLOC; in usb_dc_ep_configure()
583 USBHS->USBHS_DEVEPTIER[ep_idx] = USBHS_DEVEPTIER_CTRL_STALLRQS; in usb_dc_ep_set_stall()
599 USBHS->USBHS_DEVEPTIDR[ep_idx] = USBHS_DEVEPTIDR_CTRL_STALLRQC; in usb_dc_ep_clear_stall()
619 *stalled = (USBHS->USBHS_DEVEPTIMR[ep_idx] & in usb_dc_ep_is_stalled()
648 USBHS->USBHS_DEVEPT |= BIT(USBHS_DEVEPT_EPEN0_Pos + ep_idx); in usb_dc_ep_enable()
651 USBHS->USBHS_DEVIER = BIT(USBHS_DEVIER_PEP_0_Pos + ep_idx); in usb_dc_ep_enable()
672 USBHS->USBHS_DEVIDR = BIT(USBHS_DEVIDR_PEP_0_Pos + ep_idx); in usb_dc_ep_disable()
675 USBHS->USBHS_DEVEPT &= ~BIT(USBHS_DEVEPT_EPEN0_Pos + ep_idx); in usb_dc_ep_disable()
698 USBHS->USBHS_DEVEPTIDR[ep_idx] = USBHS_DEVEPTIDR_TXINEC; in usb_dc_ep_flush()
701 if (USBHS->USBHS_DEVEPTISR[ep_idx] & USBHS_DEVEPTISR_NBUSYBK_Msk) { in usb_dc_ep_flush()
702 USBHS->USBHS_DEVEPTIER[ep_idx] = USBHS_DEVEPTIER_KILLBKS; in usb_dc_ep_flush()
704 while (USBHS->USBHS_DEVEPTIMR[ep_idx] & in usb_dc_ep_flush()
741 if ((USBHS->USBHS_DEVEPTIMR[ep_idx] & USBHS_DEVEPTIMR_CTRL_STALLRQ) in usb_dc_ep_write()
760 USBHS->USBHS_DEVEPTICR[ep_idx] = USBHS_DEVEPTICR_TXINIC; in usb_dc_ep_write()
761 USBHS->USBHS_DEVEPTIER[ep_idx] = USBHS_DEVEPTIER_TXINES; in usb_dc_ep_write()
767 USBHS->USBHS_DEVEPTIDR[ep_idx] = USBHS_DEVEPTIDR_FIFOCONC; in usb_dc_ep_write()
798 if (!(USBHS->USBHS_DEVEPTISR[ep_idx] & USBHS_DEVEPTISR_RWALL)) { in usb_dc_ep_read()
831 uint32_t data_len = (USBHS->USBHS_DEVEPTISR[ep_idx] & in usb_dc_ep_read_wait()
849 if ((USBHS->USBHS_DEVEPTIMR[ep_idx] & USBHS_DEVEPTIMR_CTRL_STALLRQ) in usb_dc_ep_read_wait()
911 USBHS->USBHS_DEVEPTICR[ep_idx] = USBHS_DEVEPTICR_RXOUTIC; in usb_dc_ep_read_continue()
912 USBHS->USBHS_DEVEPTICR[ep_idx] = USBHS_DEVEPTICR_CTRL_RXSTPIC; in usb_dc_ep_read_continue()
918 USBHS->USBHS_DEVEPTIDR[ep_idx] = USBHS_DEVEPTIDR_FIFOCONC; in usb_dc_ep_read_continue()