summaryrefslogtreecommitdiff
path: root/usb/l0_usb_def.h
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2015-03-29 21:37:03 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2016-08-18 23:36:07 +0200
commit7b2d322df819e8a339cdb534e69d8e205765d3b2 (patch)
treec18a85a712285d6f3939113824eb2f2636833992 /usb/l0_usb_def.h
parent29d8f1b4e89f31e2f3b448c4d40c6c2518629686 (diff)
Added STM32L0 support.
Diffstat (limited to 'usb/l0_usb_def.h')
-rw-r--r--usb/l0_usb_def.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/usb/l0_usb_def.h b/usb/l0_usb_def.h
new file mode 100644
index 0000000..b9d8d10
--- /dev/null
+++ b/usb/l0_usb_def.h
@@ -0,0 +1,37 @@
+#ifndef L0_USB_DEF_H
+#define L0_USB_DEF_H
+
+#include <stdint.h>
+
+class L0_USB_t {
+ private:
+ struct L0_USB_reg_t {
+ volatile uint32_t EPR[16];
+ volatile uint32_t CNTR;
+ volatile uint32_t ISTR;
+ volatile uint32_t FNR;
+ volatile uint32_t DADDR;
+ volatile uint32_t BTABLE;
+ volatile uint32_t LPMCSR;
+ volatile uint32_t BCDR;
+ };
+
+ struct L0_USB_bufd_t {
+ volatile uint16_t ADDR_TX;
+ volatile uint16_t COUNT_TX;
+ volatile uint16_t ADDR_RX;
+ volatile uint16_t COUNT_RX;
+ };
+
+ public:
+ L0_USB_reg_t& reg;
+ L0_USB_bufd_t* bufd;
+ volatile uint16_t* buf;
+
+ L0_USB_t(uint32_t reg_addr, uint32_t buf_addr) :
+ reg(*(L0_USB_reg_t*)reg_addr),
+ bufd((L0_USB_bufd_t*)buf_addr),
+ buf((volatile uint16_t*)buf_addr) {}
+};
+
+#endif