aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--libmaple/include/libmaple/usb_cdcacm.h (renamed from libmaple/usb/usb_cdcacm.h)4
-rw-r--r--libmaple/rules.mk14
-rw-r--r--libmaple/usb/rules.mk36
-rw-r--r--libmaple/usb/usb.c8
-rw-r--r--libmaple/usb/usb_cdcacm.c10
-rw-r--r--libmaple/usb/usb_descriptors.h2
-rw-r--r--libmaple/usb/usb_lib_globals.h1
-rw-r--r--libmaple/usb/usb_reg_map.h4
-rw-r--r--wirish/boards.cpp2
-rw-r--r--wirish/usb_serial.cpp2
11 files changed, 57 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index c6a1e07..c2a60dd 100644
--- a/Makefile
+++ b/Makefile
@@ -80,6 +80,7 @@ ifeq ($(LIBMAPLE_MODULES),)
else
LIBMAPLE_MODULES += $(SRCROOT)/libmaple
endif
+LIBMAPLE_MODULES += $(SRCROOT)/libmaple/usb # USB FS device
LIBMAPLE_MODULES += $(LIBMAPLE_MODULE_FAMILY) # family submodule in libmaple
LIBMAPLE_MODULES += $(SRCROOT)/wirish
# Official libraries:
diff --git a/libmaple/usb/usb_cdcacm.h b/libmaple/include/libmaple/usb_cdcacm.h
index ec672a3..2dbcbea 100644
--- a/libmaple/usb/usb_cdcacm.h
+++ b/libmaple/include/libmaple/usb_cdcacm.h
@@ -29,8 +29,8 @@
* @brief USB CDC ACM (virtual serial terminal) support
*/
-#ifndef _USB_CDCACM_H_
-#define _USB_CDCACM_H_
+#ifndef _LIBMAPLE_USB_CDCACM_H_
+#define _LIBMAPLE_USB_CDCACM_H_
#include <libmaple/libmaple_types.h>
#include <libmaple/gpio.h>
diff --git a/libmaple/rules.mk b/libmaple/rules.mk
index a6b330a..3dcf0ce 100644
--- a/libmaple/rules.mk
+++ b/libmaple/rules.mk
@@ -3,13 +3,8 @@ sp := $(sp).x
dirstack_$(sp) := $(d)
d := $(dir)
BUILDDIRS += $(BUILD_PATH)/$(d)
-BUILDDIRS += $(BUILD_PATH)/$(d)/usb
-BUILDDIRS += $(BUILD_PATH)/$(d)/usb/usb_lib
LIBMAPLE_INCLUDES := -I$(LIBMAPLE_PATH)/include
-# FIXME: move public USB headers to include/libmaple/usb/ or something.
-LIBMAPLE_INCLUDES += -I$(LIBMAPLE_PATH)/usb \
- -I$(LIBMAPLE_PATH)/usb/usb_lib
# Local flags
CFLAGS_$(d) = -I$(d) $(LIBMAPLE_INCLUDES) -Wall # -Werror
@@ -33,14 +28,7 @@ cSRCS_$(d) := adc.c \
systick.c \
timer.c \
usart.c \
- util.c \
- usb/usb.c \
- usb/usb_reg_map.c \
- usb/usb_cdcacm.c \
- usb/usb_lib/usb_core.c \
- usb/usb_lib/usb_init.c \
- usb/usb_lib/usb_mem.c \
- usb/usb_lib/usb_regs.c
+ util.c
sSRCS_$(d) := exc.S
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_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_
diff --git a/wirish/boards.cpp b/wirish/boards.cpp
index dbdcf1c..1f97119 100644
--- a/wirish/boards.cpp
+++ b/wirish/boards.cpp
@@ -41,7 +41,7 @@
#include <libmaple/gpio.h>
#include <libmaple/adc.h>
#include <libmaple/timer.h>
-#include "usb_cdcacm.h"
+#include <libmaple/usb_cdcacm.h>
static void setupFlash(void);
static void setupClocks(void);
diff --git a/wirish/usb_serial.cpp b/wirish/usb_serial.cpp
index 1fd6e65..388c739 100644
--- a/wirish/usb_serial.cpp
+++ b/wirish/usb_serial.cpp
@@ -32,7 +32,7 @@
#include <string.h>
-#include "usb_cdcacm.h"
+#include <libmaple/usb_cdcacm.h>
#include <libmaple/usb.h>
#include <wirish/wirish.h>