From a9e628ac6fdd5ef1d775bc9e90c2475ef914b911 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 21 Oct 2011 17:55:48 -0400 Subject: USB: API cleanups. Modify usb.h functions (changing their names in some cases) to also take a usblib_dev* argument, to fit in better with the rest of libmaple. Store an rcc_clk_id in struct usblib_dev for the same reason. Signed-off-by: Marti Bolivar --- libmaple/usb/usb.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'libmaple/usb/usb.c') diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c index 00ba4ef..667b11f 100644 --- a/libmaple/usb/usb.c +++ b/libmaple/usb/usb.c @@ -72,6 +72,7 @@ struct { static usblib_dev usblib = { .irq_mask = USB_ISR_MSK, .state = USB_UNCONNECTED, + .clk_id = RCC_USB, }; usblib_dev *USBLIB = &usblib; @@ -79,11 +80,13 @@ usblib_dev *USBLIB = &usblib; * Routines */ -void usb_init_usblib(void (**ep_int_in)(void), void (**ep_int_out)(void)) { - rcc_clk_enable(RCC_USB); +void usb_init_usblib(usblib_dev *dev, + void (**ep_int_in)(void), + void (**ep_int_out)(void)) { + rcc_clk_enable(dev->clk_id); - USBLIB->ep_int_in = ep_int_in; - USBLIB->ep_int_out = ep_int_out; + dev->ep_int_in = ep_int_in; + dev->ep_int_out = ep_int_out; /* usb_lib/ declares both and then assumes that pFoo points to Foo * (even though the names don't always match), which is stupid for @@ -242,14 +245,6 @@ void __irq_usb_lp_can_rx0(void) { #endif } -uint8 usbIsConfigured() { - return USBLIB->state == USB_CONFIGURED; -} - -uint8 usbIsConnected() { - return USBLIB->state != USB_UNCONNECTED; -} - /* * Auxiliary routines */ -- cgit v1.2.3