diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2012-01-22 15:01:57 +0100 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2012-01-22 15:01:57 +0100 |
commit | e684c845fe3a76136af497f11daf4b666007f7f0 (patch) | |
tree | bffea325ea18d7ac86afc9d56fa2dc6836503b9c | |
parent | 5fd6f9224700bf960941c00cc07370b0bc1a0632 (diff) |
Set some flags on USB reset.
-rw-r--r-- | hal/usb.h | 4 | ||||
-rw-r--r-- | main.cpp | 12 |
2 files changed, 13 insertions, 3 deletions
@@ -65,8 +65,8 @@ 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_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), @@ -21,6 +21,16 @@ template<> void interrupt<(Interrupt::IRQ)67>() { led_blue.toggle(); led_red.toggle(); + + if(OTG_FS.reg.GINTSTS & (1 << 12)) { + led_yellow.toggle(); + OTG_FS.dev_oep_reg[0].DOEPCTL = (1 << 27); + OTG_FS.dev_reg.DAINTMSK = (1 << 16) | 1; + OTG_FS.dev_reg.DOEPMSK = (1 << 3) | 1; + OTG_FS.dev_reg.DIEPEMPMSK = (1 << 3) | 1; + OTG_FS.reg.GRXFSIZ = 256; + OTG_FS.dev_oep_reg[0].DOEPTSIZ = (3 << 29); + } OTG_FS.reg.GINTSTS = 0xffffffff; } @@ -56,7 +66,7 @@ int main() { OTG_FS.reg.GAHBCFG = 1; // USB configuration - OTG_FS.reg.GUSBCFG = (1 << 30) | (0xf << 10) | (1 << 9) | (1 << 8); + OTG_FS.reg.GUSBCFG = (1 << 30) | (0xf << 10) | (0 << 9) | (0 << 8); // FDMOD TRDT HNPCAP SRPCAP // interrupt mask |