From bbcbf65fd7d074268f4e25ae014965bceb995b79 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Fri, 23 Sep 2011 17:56:24 -0400 Subject: usb: Disentangle CDC ACM functionality. Add new usb_cdcacm.h, which provides the virtual serial port API. This file (and new usb_cdcacm.c) consolidate the VCOM support, which was previously distributed through descriptors.[hc], usb.[hc], usb_callbacks.[hc], and usb_config.h. Add usb_init_usblib() to usb.h, as a way of initializing the USB peripheral in terms of the data structures required by usb_lib. This is used by the new usb_cdcacm_enable(). Create new usb_lib_globals.h, with declarations for the usb_lib global state which is most used throughout the rest of the libmaple USB stack. Remove descriptors.c and usb_callbacks.[hc]; they are no longer necessary. Update the USB README accordingly. Signed-off-by: Marti Bolivar --- libmaple/usb/usb_config.h | 62 ----------------------------------------------- 1 file changed, 62 deletions(-) (limited to 'libmaple/usb/usb_config.h') diff --git a/libmaple/usb/usb_config.h b/libmaple/usb/usb_config.h index 9facb96..5adfdd4 100644 --- a/libmaple/usb/usb_config.h +++ b/libmaple/usb/usb_config.h @@ -27,73 +27,11 @@ #ifndef __USB_CONFIG_H #define __USB_CONFIG_H -/****************************************************************************** - ****************************************************************************** - *** - *** HACK ALERT - *** - *** FIXME FIXME FIXME FIXME - *** - *** A bunch of board-specific #defines that are only used by the - *** USB routines got put into libmaple.h for what appear to be - *** historical reasons. I'm [mbolivar] putting them in here for - *** now, so that we can treat the usb/ directory as a black box, - *** freeing the rest of libmaple/ to be implemented as a - *** general-purpose STM32 library. All of this REALLY needs to get - *** moved into wirish when we get a chance to redo the USB stack. - *** - ****************************************************************************** - *****************************************************************************/ - -#define VCOM_ID_VENDOR 0x1EAF -#define VCOM_ID_PRODUCT 0x0004 #define RESET_DELAY (100000) #define USB_CONFIG_MAX_POWER (100 >> 1) -#if !(defined(BOARD_maple) || defined(BOARD_maple_RET6) || \ - defined(BOARD_maple_mini) || defined(BOARD_maple_native)) - -#warning ("Warning! The USB stack relies on LeafLabs board-specific " \ - "configuration right now. If you want, you can pretend " \ - "you're one of our boards; i.e., #define BOARD_maple, " \ - "BOARD_maple_mini, etc. according to what matches your MCU " \ - "best. You should also take a look at " \ - "libmaple/usb/descriptors.c; " \ - "we make some assumptions there that you probably won't like.") - -#endif - -/****************************************************************************** - ****************************************************************************** - *** - *** END HACK - *** - ****************************************************************************** - *****************************************************************************/ - - /* choose addresses to give endpoints the max 64 byte buffers */ #define USB_BTABLE_ADDRESS 0x00 -#define VCOM_CTRL_EPNUM 0x00 -#define VCOM_CTRL_RX_ADDR 0x40 -#define VCOM_CTRL_TX_ADDR 0x80 -#define VCOM_CTRL_EPSIZE 0x40 - -#define VCOM_TX_ENDP 1 -#define VCOM_TX_EPNUM 0x01 -#define VCOM_TX_ADDR 0xC0 -#define VCOM_TX_EPSIZE 0x40 - -#define VCOM_NOTIFICATION_ENDP 2 -#define VCOM_NOTIFICATION_EPNUM 0x02 -#define VCOM_NOTIFICATION_ADDR 0x100 -#define VCOM_NOTIFICATION_EPSIZE 0x40 - -#define VCOM_RX_ENDP 3 -#define VCOM_RX_EPNUM 0x03 -#define VCOM_RX_ADDR 0x110 -#define VCOM_RX_EPSIZE 0x40 -#define VCOM_RX_BUFLEN (VCOM_RX_EPSIZE*3) #define bMaxPacketSize 0x40 /* 64B, maximum for USB FS Devices */ -- cgit v1.2.3