summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2012-01-22 15:01:57 +0100
committerJon Bergli Heier <snakebite@jvnv.net>2012-01-22 15:01:57 +0100
commite684c845fe3a76136af497f11daf4b666007f7f0 (patch)
treebffea325ea18d7ac86afc9d56fa2dc6836503b9c /main.cpp
parent5fd6f9224700bf960941c00cc07370b0bc1a0632 (diff)
Set some flags on USB reset.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index 2fafeb6..e56c435 100644
--- a/main.cpp
+++ b/main.cpp
@@ -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