aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
Diffstat (limited to 'libmaple')
-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
8 files changed, 54 insertions, 25 deletions
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_