aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-09-23 17:31:47 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-10-18 13:30:17 -0400
commit24e294c9b0be5f2f24c9d7b9cddd163ac22efab2 (patch)
tree9454b38a13c721d6d9d730b21594411b8fdc7662 /libmaple
parent985138fd8952edeb58606b0c35cf60aa0039c14f (diff)
downloadlibrambutan-24e294c9b0be5f2f24c9d7b9cddd163ac22efab2.tar.gz
librambutan-24e294c9b0be5f2f24c9d7b9cddd163ac22efab2.zip
usb: Prepare for moving some files to usb_reg_map.h.
usb_config.h: Remove usb_regs.h dependency; fix includes; add license. usb_callbacks.h: Change includes to the pieces of usb_lib/ it uses, which doesn't include usb_regs.h. descriptors.h: Remove unused usb_lib.h include. usb.h: Remove unused usb_lib.h include. Some cosmetic commenting. Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/usb/descriptors.h1
-rw-r--r--libmaple/usb/usb.h5
-rw-r--r--libmaple/usb/usb_callbacks.h8
-rw-r--r--libmaple/usb/usb_config.h46
4 files changed, 39 insertions, 21 deletions
diff --git a/libmaple/usb/descriptors.h b/libmaple/usb/descriptors.h
index 13aef29..77ff3bb 100644
--- a/libmaple/usb/descriptors.h
+++ b/libmaple/usb/descriptors.h
@@ -27,7 +27,6 @@
#include "libmaple.h"
-#include "usb_lib.h"
#define USB_DESCRIPTOR_TYPE_DEVICE 0x01
#define USB_DESCRIPTOR_TYPE_CONFIGURATION 0x02
diff --git a/libmaple/usb/usb.h b/libmaple/usb/usb.h
index 9498dcf..903964b 100644
--- a/libmaple/usb/usb.h
+++ b/libmaple/usb/usb.h
@@ -27,7 +27,6 @@
#ifndef _USB_H_
#define _USB_H_
-#include "usb_lib.h"
#include "libmaple.h"
#include "gpio.h"
@@ -35,6 +34,10 @@
extern "C" {
#endif
+/*
+ * Convenience routines, etc.
+ */
+
typedef enum {
RESUME_EXTERNAL,
RESUME_INTERNAL,
diff --git a/libmaple/usb/usb_callbacks.h b/libmaple/usb/usb_callbacks.h
index 20d2c13..a71af01 100644
--- a/libmaple/usb/usb_callbacks.h
+++ b/libmaple/usb/usb_callbacks.h
@@ -4,9 +4,11 @@
#define __USB_CALLBACKS
#include "libmaple.h"
-#include "usb_lib.h"
#include "usb_config.h"
+#include "usb_type.h"
+#include "usb_core.h"
+
#define SET_LINE_CODING 0x20
#define GET_LINE_CODING 0x21
#define SET_COMM_FEATURE 0x02
@@ -29,11 +31,11 @@ typedef enum {
DTR_UNSET,
DTR_HIGH,
DTR_NEGEDGE,
- DTR_LOW
+ DTR_LOW
} RESET_STATE;
extern RESET_STATE reset_state; /* tracks DTR/RTS */
-extern uint8 line_dtr_rts;
+extern uint8 line_dtr_rts;
extern volatile uint32 countTx;
extern uint8 vcomBufferRx[VCOM_RX_BUFLEN]; /* no reason this has to be VCOM_RX_EPSIZE, could be bigger */
extern volatile uint32 recvBufIn; /* the FIFO in index to the recvbuffer */
diff --git a/libmaple/usb/usb_config.h b/libmaple/usb/usb_config.h
index 6eb88a5..9facb96 100644
--- a/libmaple/usb/usb_config.h
+++ b/libmaple/usb/usb_config.h
@@ -1,11 +1,32 @@
-/* insert license */
+/******************************************************************************
+ * 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.
+ *****************************************************************************/
#ifndef __USB_CONFIG_H
#define __USB_CONFIG_H
-#include "usb_lib.h"
-#include "gpio.h"
-
/******************************************************************************
******************************************************************************
***
@@ -58,17 +79,17 @@
#define VCOM_CTRL_TX_ADDR 0x80
#define VCOM_CTRL_EPSIZE 0x40
-#define VCOM_TX_ENDP ENDP1
+#define VCOM_TX_ENDP 1
#define VCOM_TX_EPNUM 0x01
#define VCOM_TX_ADDR 0xC0
#define VCOM_TX_EPSIZE 0x40
-#define VCOM_NOTIFICATION_ENDP ENDP2
+#define VCOM_NOTIFICATION_ENDP 2
#define VCOM_NOTIFICATION_EPNUM 0x02
#define VCOM_NOTIFICATION_ADDR 0x100
#define VCOM_NOTIFICATION_EPSIZE 0x40
-#define VCOM_RX_ENDP ENDP3
+#define VCOM_RX_ENDP 3
#define VCOM_RX_EPNUM 0x03
#define VCOM_RX_ADDR 0x110
#define VCOM_RX_EPSIZE 0x40
@@ -78,16 +99,9 @@
#define NUM_ENDPTS 0x04
-/* handle all usb interrupts */
-#define ISR_MSK (CNTR_CTRM | \
- CNTR_WKUPM | \
- CNTR_SUSPM | \
- CNTR_ERRM | \
- CNTR_SOFM | \
- CNTR_ESOFM | \
- CNTR_RESETM)
+/* handle CTRM, WKUPM, SUSPM, ERRM, SOFM, ESOFM, RESETM */
+#define ISR_MSK 0xBF00
#define F_SUSPEND_ENABLED 1
-
#endif