summaryrefslogtreecommitdiff
path: root/usb/dwc_otg_def.h
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2021-01-21 21:52:07 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2021-01-21 21:52:07 +0100
commit94d1f1a772c6655398e9773c0851330ead4ff49c (patch)
tree7ab922e0246fbe2a897c7c2b47db993fef753e97 /usb/dwc_otg_def.h
parent13bb78203cac7d3a582da55e004c84104ff214dd (diff)
usb/dwc_otg: Use mmio_ptr.
Diffstat (limited to 'usb/dwc_otg_def.h')
-rw-r--r--usb/dwc_otg_def.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/usb/dwc_otg_def.h b/usb/dwc_otg_def.h
index 6ed6ba8..2c22af4 100644
--- a/usb/dwc_otg_def.h
+++ b/usb/dwc_otg_def.h
@@ -1,10 +1,8 @@
#ifndef DWC_OTG_DEF_H
#define DWC_OTG_DEF_H
-#include <stdint.h>
+#include <mmio/mmio.h>
-class DWC_OTG_t {
- private:
struct DWC_OTG_reg_t {
volatile uint32_t GOTGCTL;
volatile uint32_t GOTGINT;
@@ -67,19 +65,19 @@ class DWC_OTG_t {
volatile uint32_t buf[1024];
};
+class DWC_OTG_t : public mmio_ptr<DWC_OTG_reg_t> {
public:
- DWC_OTG_reg_t& reg;
- DWC_OTG_dev_reg_t& dev_reg;
- DWC_OTG_dev_iep_reg_t* const dev_iep_reg;
- DWC_OTG_dev_oep_reg_t* const dev_oep_reg;
- DWC_OTG_fifo_reg_t* const fifo;
+ mmio_ptr<DWC_OTG_dev_reg_t> dev_reg;
+ mmio_ptr<DWC_OTG_dev_iep_reg_t> dev_iep_reg;
+ mmio_ptr<DWC_OTG_dev_oep_reg_t> dev_oep_reg;
+ mmio_ptr<DWC_OTG_fifo_reg_t> fifo;
- DWC_OTG_t(uint32_t reg_addr) :
- reg(*(DWC_OTG_reg_t*)reg_addr),
- dev_reg(*(DWC_OTG_dev_reg_t*)(reg_addr + 0x800)),
- dev_iep_reg((DWC_OTG_dev_iep_reg_t*)(reg_addr + 0x900)),
- dev_oep_reg((DWC_OTG_dev_oep_reg_t*)(reg_addr + 0xb00)),
- fifo((DWC_OTG_fifo_reg_t*)(reg_addr + 0x1000)) {}
+ constexpr DWC_OTG_t(uint32_t reg_addr) :
+ mmio_ptr(reg_addr),
+ dev_reg(reg_addr + 0x800),
+ dev_iep_reg(reg_addr + 0x900),
+ dev_oep_reg(reg_addr + 0xb00),
+ fifo(reg_addr + 0x1000) {}
};
#endif