diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-11-16 13:26:34 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2012-04-11 16:56:51 -0400 |
commit | 844665608fbeeab270e3d1a4bd797afd24302a10 (patch) | |
tree | 30a292680106fd81e9e8b41344b27ec8306c31f6 /libmaple/usb | |
parent | 62e4ce256e1f2ea18cf2d576ed8110d6553c7fc1 (diff) | |
download | librambutan-844665608fbeeab270e3d1a4bd797afd24302a10.tar.gz librambutan-844665608fbeeab270e3d1a4bd797afd24302a10.zip |
Make USB its own submodule.
Add libmaple/usb/rules.mk, which compiles the USB FS device firmware
submodule. Move the logic for compiling the USB stack from
libmaple/rules.mk into libmaple/usb/rules.mk.
Move libmaple/usb/usb_cdacm.h to libmaple/include/libmaple/. Its API
is sufficiently general that we'll be able to port it over to USB
OTG (either FS or HS) eventually, and that lets us include it from
Wirish using the new style for libmaple headers.
Fix the includes for public libmaple headers within libmaple/usb.
Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/usb')
-rw-r--r-- | libmaple/usb/rules.mk | 36 | ||||
-rw-r--r-- | libmaple/usb/usb.c | 8 | ||||
-rw-r--r-- | libmaple/usb/usb_cdcacm.c | 10 | ||||
-rw-r--r-- | libmaple/usb/usb_cdcacm.h | 59 | ||||
-rw-r--r-- | libmaple/usb/usb_descriptors.h | 2 | ||||
-rw-r--r-- | libmaple/usb/usb_lib_globals.h | 1 | ||||
-rw-r--r-- | libmaple/usb/usb_reg_map.h | 4 |
7 files changed, 51 insertions, 69 deletions
diff --git a/libmaple/usb/rules.mk b/libmaple/usb/rules.mk new file mode 100644 index 0000000..9ef8d70 --- /dev/null +++ b/libmaple/usb/rules.mk @@ -0,0 +1,36 @@ +# Standard things +sp := $(sp).x +dirstack_$(sp) := $(d) +d := $(dir) +BUILDDIRS += $(BUILD_PATH)/$(d) +BUILDDIRS += $(BUILD_PATH)/$(d)/usb_lib + +# Local flags +CFLAGS_$(d) = -I$(d) -I$(d)/usb_lib $(LIBMAPLE_INCLUDES) -Wall + +# Local rules and targets +sSRCS_$(d) := +cSRCS_$(d) := usb.c \ + usb_reg_map.c \ + usb_cdcacm.c \ + usb_lib/usb_core.c \ + usb_lib/usb_init.c \ + usb_lib/usb_mem.c \ + usb_lib/usb_regs.c + +sFILES_$(d) := $(sSRCS_$(d):%=$(d)/%) +cFILES_$(d) := $(cSRCS_$(d):%=$(d)/%) + +OBJS_$(d) := $(sFILES_$(d):%.S=$(BUILD_PATH)/%.o) \ + $(cFILES_$(d):%.c=$(BUILD_PATH)/%.o) +DEPS_$(d) := $(OBJS_$(d):%.o=%.d) + +$(OBJS_$(d)): TGT_CFLAGS := $(CFLAGS_$(d)) +$(OBJS_$(d)): TGT_ASFLAGS := + +TGT_BIN += $(OBJS_$(d)) + +# Standard things +-include $(DEPS_$(d)) +d := $(dirstack_$(sp)) +sp := $(basename $(sp)) diff --git a/libmaple/usb/usb.c b/libmaple/usb/usb.c index 667b11f..6f23848 100644 --- a/libmaple/usb/usb.c +++ b/libmaple/usb/usb.c @@ -29,14 +29,16 @@ * @brief USB support. */ -#include "usb.h" +#include <libmaple/usb.h> -#include "libmaple.h" -#include "rcc.h" +#include <libmaple/libmaple.h> +#include <libmaple/rcc.h> +/* Private headers */ #include "usb_reg_map.h" #include "usb_lib_globals.h" +/* usb_lib headers */ #include "usb_type.h" #include "usb_core.h" diff --git a/libmaple/usb/usb_cdcacm.c b/libmaple/usb/usb_cdcacm.c index dc7b79e..07d2bc8 100644 --- a/libmaple/usb/usb_cdcacm.c +++ b/libmaple/usb/usb_cdcacm.c @@ -31,16 +31,18 @@ * routines. */ -#include "usb_cdcacm.h" +#include <libmaple/usb_cdcacm.h> -#include "nvic.h" -#include "delay.h" +#include <libmaple/usb.h> +#include <libmaple/nvic.h> +#include <libmaple/delay.h> -#include "usb.h" +/* Private headers */ #include "usb_descriptors.h" #include "usb_lib_globals.h" #include "usb_reg_map.h" +/* usb_lib headers */ #include "usb_type.h" #include "usb_core.h" #include "usb_def.h" diff --git a/libmaple/usb/usb_cdcacm.h b/libmaple/usb/usb_cdcacm.h deleted file mode 100644 index ec672a3..0000000 --- a/libmaple/usb/usb_cdcacm.h +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** - * The MIT License - * - * Copyright (c) 2011 LeafLabs LLC. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - *****************************************************************************/ - -/** - * @file usb_cdcacm.h - * @brief USB CDC ACM (virtual serial terminal) support - */ - -#ifndef _USB_CDCACM_H_ -#define _USB_CDCACM_H_ - -#include <libmaple/libmaple_types.h> -#include <libmaple/gpio.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void usb_cdcacm_enable(gpio_dev*, uint8); -void usb_cdcacm_disable(gpio_dev*, uint8); - -void usb_cdcacm_putc(char ch); -uint32 usb_cdcacm_tx(const uint8* buf, uint32 len); -uint32 usb_cdcacm_rx(uint8* buf, uint32 len); - -uint32 usb_cdcacm_data_available(void); /* in RX buffer */ -uint16 usb_cdcacm_get_pending(void); - -uint8 usb_cdcacm_get_dtr(void); -uint8 usb_cdcacm_get_rts(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libmaple/usb/usb_descriptors.h b/libmaple/usb/usb_descriptors.h index 405588a..9bcb2b6 100644 --- a/libmaple/usb/usb_descriptors.h +++ b/libmaple/usb/usb_descriptors.h @@ -27,7 +27,7 @@ #ifndef _USB_DESCRIPTORS_H_ #define _USB_DESCRIPTORS_H_ -#include "libmaple.h" +#include <libmaple/libmaple.h> #define USB_DESCRIPTOR_TYPE_DEVICE 0x01 #define USB_DESCRIPTOR_TYPE_CONFIGURATION 0x02 diff --git a/libmaple/usb/usb_lib_globals.h b/libmaple/usb/usb_lib_globals.h index a494817..1cd2754 100644 --- a/libmaple/usb/usb_lib_globals.h +++ b/libmaple/usb/usb_lib_globals.h @@ -27,6 +27,7 @@ #ifndef _USB_LIB_GLOBALS_H_ #define _USB_LIB_GLOBALS_H_ +/* usb_lib headers */ #include "usb_type.h" #include "usb_core.h" diff --git a/libmaple/usb/usb_reg_map.h b/libmaple/usb/usb_reg_map.h index 5bf5d96..ce80842 100644 --- a/libmaple/usb/usb_reg_map.h +++ b/libmaple/usb/usb_reg_map.h @@ -24,8 +24,8 @@ * SOFTWARE. *****************************************************************************/ -#include "libmaple_types.h" -#include "util.h" +#include <libmaple/libmaple_types.h> +#include <libmaple/util.h> #ifndef _USB_REG_MAP_H_ #define _USB_REG_MAP_H_ |