diff --git a/firmware/export/tcc77x.h b/firmware/export/tcc77x.h index 9ff8adea3e..5346e585aa 100644 --- a/firmware/export/tcc77x.h +++ b/firmware/export/tcc77x.h @@ -258,4 +258,7 @@ /* USB 2.0 device system MMR base address */ #define USB_BASE 0x90000b00 +#define USB_NUM_ENDPOINTS 3 +#define USB_DEVBSS_ATTR IBSS_ATTR + #endif diff --git a/firmware/export/tcc780x.h b/firmware/export/tcc780x.h index 1e2052c4be..b10b311fed 100644 --- a/firmware/export/tcc780x.h +++ b/firmware/export/tcc780x.h @@ -229,4 +229,7 @@ /* USB 2.0 device system MMR base address */ #define USB_BASE 0xf0010000 +#define USB_NUM_ENDPOINTS 3 +#define USB_DEVBSS_ATTR IBSS_ATTR + #endif diff --git a/firmware/system.c b/firmware/system.c index 52be7a1a71..290452b0af 100644 --- a/firmware/system.c +++ b/firmware/system.c @@ -24,6 +24,7 @@ #include "kernel.h" #include "thread.h" #include "string.h" +#include "file.h" #ifndef SIMULATOR long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ; diff --git a/firmware/target/arm/usb-tcc.c b/firmware/target/arm/usb-tcc.c index aa4c2e4226..6f15e68af8 100644 --- a/firmware/target/arm/usb-tcc.c +++ b/firmware/target/arm/usb-tcc.c @@ -122,7 +122,7 @@ void usb_drv_release_endpoint(int ep) int flags; ep = ep & 0x7f; - if (ep < 1 || ep > NUM_ENDPOINTS) + if (ep < 1 || ep > USB_NUM_ENDPOINTS) return ; flags = disable_irq_save(); @@ -744,6 +744,10 @@ void usb_enable(bool on) usb_core_exit(); } +void usb_attach(void) +{ + usb_enable(true); +} int usb_detect(void) {