summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2024-06-09 15:26:00 +0800
committersakumisu <[email protected]>2024-06-09 15:27:21 +0800
commit3429f833f3b8c65f2788f4f633b422aadd57cc0e (patch)
treeb524e04fa2c7cf90b999da6b2031af80fa9ba8bb
parent9d265f23983526ac292bcf4a431fd07729b746e7 (diff)
update(port/musb/usb_dc_musb): remove ununsed code
-rw-r--r--port/musb/usb_dc_musb.c124
1 files changed, 0 insertions, 124 deletions
diff --git a/port/musb/usb_dc_musb.c b/port/musb/usb_dc_musb.c
index 4bcc7eee..ad61fabd 100644
--- a/port/musb/usb_dc_musb.c
+++ b/port/musb/usb_dc_musb.c
@@ -472,130 +472,6 @@ int usbd_ep_is_stalled(uint8_t busid, const uint8_t ep, uint8_t *stalled)
return 0;
}
-int usb_ep_out_data_avail(uint8_t ep_addr)
-{
- uint16_t old_ep_idx, length;
- uint8_t ep_idx = USB_EP_GET_IDX(ep_addr);
-
- old_ep_idx = musb_get_active_ep();
- musb_set_active_ep(ep_idx);
-
- if (ep_idx == 0) {
- if (!(HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) & USB_CSRL0_RXRDY)) {
- musb_set_active_ep(old_ep_idx);
- return 0;
- }
- length = HWREGH(USB_BASE + MUSB_IND_RXCOUNT_OFFSET);
- musb_set_active_ep(old_ep_idx);
- return length;
- } else {
- if (!(HWREGB(USB_BASE + MUSB_IND_RXCSRL_OFFSET) & USB_RXCSRL1_RXRDY)) {
- musb_set_active_ep(old_ep_idx);
- return 0;
- }
- length = HWREGH(USB_BASE + MUSB_IND_RXCOUNT_OFFSET);
- musb_set_active_ep(old_ep_idx);
- return length;
- }
-}
-
-int usb_ep_in_data_avail(uint8_t ep_addr)
-{
- uint16_t old_ep_idx, length;
- uint8_t ep_idx = USB_EP_GET_IDX(ep_addr);
-
- old_ep_idx = musb_get_active_ep();
- musb_set_active_ep(ep_idx);
-
- if (ep_idx == 0) {
- if (HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) & USB_CSRL0_TXRDY) {
- musb_set_active_ep(old_ep_idx);
- return 0;
- }
- } else {
- if (HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) & USB_TXCSRL1_TXRDY) {
- musb_set_active_ep(old_ep_idx);
- return 0;
- }
- }
- length = HWREGH(USB_BASE + MUSB_IND_TXMAP_OFFSET);
- musb_set_active_ep(old_ep_idx);
- return length;
-}
-
-int usb_ep_wait_in_data_avail(uint8_t ep_addr)
-{
- uint32_t cnt;
-
- for (cnt = 0; cnt < 3000; cnt++) {
- if (usb_ep_in_data_avail(ep_addr))
- return cnt;
- }
- return 0;
-}
-
-int usbd_read_packet(uint8_t ep_addr, uint8_t *buffer, uint16_t len)
-{
- uint16_t old_ep_idx, cnt;
- uint8_t ep_idx = USB_EP_GET_IDX(ep_addr);
-
- old_ep_idx = musb_get_active_ep();
- musb_set_active_ep(ep_idx);
- if (ep_idx == 0) {
- if (!(HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) & USB_CSRL0_RXRDY)) {
- musb_set_active_ep(old_ep_idx);
- return 0;
- }
- } else {
- if (!(HWREGB(USB_BASE + MUSB_IND_RXCSRL_OFFSET) & USB_RXCSRL1_RXRDY)) {
- musb_set_active_ep(old_ep_idx);
- return 0;
- }
- }
- cnt = usb_ep_out_data_avail(ep_idx);
- if (cnt) {
- musb_read_packet(ep_idx, buffer, cnt);
- HWREGB(USB_BASE + MUSB_IND_RXCSRL_OFFSET) &= ~(USB_RXCSRL1_OVER | USB_RXCSRL1_ERROR | USB_RXCSRL1_STALL | USB_RXCSRL1_STALLED);
- HWREGB(USB_BASE + MUSB_IND_RXCSRL_OFFSET) &= ~(USB_RXCSRL1_RXRDY);
- musb_set_active_ep(old_ep_idx);
- }
- return cnt;
-}
-
-int usbd_write_packet(uint8_t ep_addr, uint8_t *buffer, uint16_t len)
-{
- uint16_t old_ep_idx, cnt;
- uint8_t ep_idx = USB_EP_GET_IDX(ep_addr);
-
- old_ep_idx = musb_get_active_ep();
- musb_set_active_ep(ep_idx);
- if (HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) & USB_TXCSRL1_UNDRN) {
- HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) &= ~USB_TXCSRL1_UNDRN;
- }
- if (HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) & USB_TXCSRL1_TXRDY) {
- musb_set_active_ep(old_ep_idx);
- return -1;
- }
-
- if (!buffer && len) {
- return -2;
- }
-
- if (!len) {
- HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) |= USB_TXCSRL1_TXRDY;
- return 0;
- }
-
- cnt = usb_ep_in_data_avail(ep_idx);
- if (cnt) {
- cnt = MIN(cnt, len);
- musb_write_packet(ep_idx, buffer, cnt);
- HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET) |= USB_TXCSRL1_TXRDY;
- musb_set_active_ep(old_ep_idx);
- }
- return cnt;
-}
-
int usbd_ep_start_write(uint8_t busid, const uint8_t ep, const uint8_t *data, uint32_t data_len)
{
uint8_t ep_idx = USB_EP_GET_IDX(ep);