aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/include
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2012-07-31 13:03:12 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2012-07-31 15:04:49 -0400
commit9e49090ac6fb41645e5d09145cc4163e65565788 (patch)
treef5247e9864c1476f68110e9deae47ae3f36e2651 /libmaple/include
parentf4c716a527f374c96923e2f81f6a605335e56aba (diff)
downloadlibrambutan-9e49090ac6fb41645e5d09145cc4163e65565788.tar.gz
librambutan-9e49090ac6fb41645e5d09145cc4163e65565788.zip
usb_cdcacm: Add hook system.
Provide hooks so users can reach into the CDC ACM callbacks with their own code. We'll use this to move the bootloader reset signals to Wirish. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple/include')
-rw-r--r--libmaple/include/libmaple/usb_cdcacm.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/libmaple/include/libmaple/usb_cdcacm.h b/libmaple/include/libmaple/usb_cdcacm.h
index 85b4f5e..3b15d48 100644
--- a/libmaple/include/libmaple/usb_cdcacm.h
+++ b/libmaple/include/libmaple/usb_cdcacm.h
@@ -94,6 +94,19 @@ uint16 usb_cdcacm_get_pending(void);
uint8 usb_cdcacm_get_dtr(void);
uint8 usb_cdcacm_get_rts(void);
+/*
+ * Hack: hooks for bootloader reset signalling
+ */
+
+#define USB_CDCACM_HOOK_RX 0x1
+#define USB_CDCACM_HOOK_IFACE_SETUP 0x2
+
+void usb_cdcacm_set_hooks(unsigned hook_flags, void (*hook)(unsigned, void*));
+
+static __always_inline void usb_cdcacm_remove_hooks(unsigned hook_flags) {
+ usb_cdcacm_set_hooks(hook_flags, 0);
+}
+
#ifdef __cplusplus
}
#endif