aboutsummaryrefslogtreecommitdiff
path: root/lib/usb/usb_f103.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/usb/usb_f103.c')
-rw-r--r--lib/usb/usb_f103.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/usb/usb_f103.c b/lib/usb/usb_f103.c
index e4cf06e..1af4493 100644
--- a/lib/usb/usb_f103.c
+++ b/lib/usb/usb_f103.c
@@ -116,7 +116,22 @@ void usbd_ep_stall(u8 addr)
if(addr & 0x80)
USB_SET_EP_TX_STAT(addr, USB_EP_TX_STAT_STALL);
else
- USB_SET_EP_RX_STAT(addr & 0x7F, USB_EP_RX_STAT_STALL);
+ USB_SET_EP_RX_STAT(addr&0x7F, USB_EP_RX_STAT_STALL);
+}
+
+u8 usbd_get_ep_stall(u8 addr)
+{
+ if(addr == 0)
+ if ((*USB_EP_REG(addr) & USB_EP_TX_STAT) == USB_EP_TX_STAT_STALL)
+ return 1;
+ if(addr & 0x80) {
+ if ((*USB_EP_REG(addr) & USB_EP_TX_STAT) == USB_EP_TX_STAT_STALL)
+ return 1;
+ } else {
+ if ((*USB_EP_REG(addr&0x7F) & USB_EP_RX_STAT) == USB_EP_RX_STAT_STALL)
+ return 1;
+ }
+ return 0;
}
/** Copy a data buffer to Packet Memory.