From 6788dff2e0ba8a548b0a91b78c04031a4fc5df54 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Sat, 4 Aug 2012 00:15:39 -0400 Subject: Add FIXME for usb_get_ep_tx_count(). We definitely need to mask out the high bits, as RM0008 doesn't specify that they read as zero. Calling this function seems to crash the board, though. I'm not sure why, especially since usb_set_ep_tx_count(), used by usb_cdcacm.c, seems to work. Confusing. Signed-off-by: Marti Bolivar --- libmaple/usb/stm32f1/usb_reg_map.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libmaple/usb/stm32f1/usb_reg_map.h b/libmaple/usb/stm32f1/usb_reg_map.h index ce80842..ea483d2 100644 --- a/libmaple/usb/stm32f1/usb_reg_map.h +++ b/libmaple/usb/stm32f1/usb_reg_map.h @@ -377,7 +377,9 @@ static inline uint32* usb_ep_tx_count_ptr(uint8 ep) { } static inline uint16 usb_get_ep_tx_count(uint8 ep) { - return (uint16)*usb_ep_tx_count_ptr(ep); + /* FIXME: this is broken somehow; calling it seems to + * confuse/crash the chip. */ + return (uint16)(*usb_ep_tx_count_ptr(ep) & 0x3FF); } static inline void usb_set_ep_tx_count(uint8 ep, uint16 count) { -- cgit v1.2.3