summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2012-01-22 12:00:40 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2012-01-22 12:00:40 +0100
commit5fd6f9224700bf960941c00cc07370b0bc1a0632 (patch)
tree64ed47f51c2da21e780abcd2387ef307546b7b59
parent6fc7b7627313d2850895237d30c9e0ae2ee70ab3 (diff)
Added device endpoint registers.
-rw-r--r--hal/usb.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/hal/usb.h b/hal/usb.h
index 90a6ddb..9dc327a 100644
--- a/hal/usb.h
+++ b/hal/usb.h
@@ -29,23 +29,50 @@ struct USB_dev_reg_t {
volatile uint32_t DCFG;
volatile uint32_t DCTL;
volatile uint32_t DSTS;
+ uint32_t _reserved;
volatile uint32_t DIEPMSK;
volatile uint32_t DOEPMSK;
volatile uint32_t DAINT;
volatile uint32_t DAINTMSK;
+ uint32_t _reserved1[2];
volatile uint32_t DVBUSDIS;
volatile uint32_t DVBUSPULSE;
+ uint32_t _reserved2;
volatile uint32_t DIEPEMPMSK;
};
+struct USB_dev_iep_reg_t {
+ volatile uint32_t DIEPCTL;
+ uint32_t _reserved;
+ volatile uint32_t DIEPINT;
+ uint32_t _reserved1;
+ volatile uint32_t DIEPTSIZ;
+ uint32_t _reserved2;
+ volatile uint32_t DTXFSTS;
+ uint32_t _reserved3;
+};
+
+struct USB_dev_oep_reg_t {
+ volatile uint32_t DOEPCTL;
+ uint32_t _reserved;
+ volatile uint32_t DOEPINT;
+ uint32_t _reserved1;
+ volatile uint32_t DOEPTSIZ;
+ uint32_t _reserved2[3];
+};
+
class USB_t {
public:
USB_reg_t& reg;
USB_dev_reg_t& dev_reg;
+ USB_dev_iep_reg_t const* dev_iep_reg;
+ USB_dev_oep_reg_t const* dev_oep_reg;
USB_t(uint32_t reg_addr) :
reg(*(USB_reg_t*)reg_addr),
- dev_reg(*(USB_dev_reg_t*)(reg_addr + 0x800)) {}
+ dev_reg(*(USB_dev_reg_t*)(reg_addr + 0x800)),
+ dev_iep_reg((USB_dev_iep_reg_t*)(reg_addr + 0x900)),
+ dev_oep_reg((USB_dev_oep_reg_t*)(reg_addr + 0xb00)) {}
};
#if defined(STM32F1)