diff options
author | Keith Packard <keithp@keithp.com> | 2015-02-01 16:44:52 +0100 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2015-02-01 16:44:52 +0100 |
commit | 8f9e192e9d1c6fab9843939ff9117f6bb3725943 (patch) | |
tree | 9fa48516b412042e2510371c39ee3765f73cbefb | |
parent | 466d3e977ca279f97944141fcc12c04f4f58212e (diff) |
altos/stmf0: Support PA11/PA12 remapping
Small pin-count versions of the STMF0 can remap PA11/PA12 on the same
pins as PA9/PA10. These are used by USB, so have the USB driver deal
with remapping them.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/stmf0/ao_usb_stm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/stmf0/ao_usb_stm.c b/src/stmf0/ao_usb_stm.c index e0ff541a..3ea7da5e 100644 --- a/src/stmf0/ao_usb_stm.c +++ b/src/stmf0/ao_usb_stm.c @@ -23,6 +23,10 @@ #define USB_DEBUG_DATA 0 #define USB_ECHO 0 +#ifndef AO_PA11_PA12_RMP +#error "must define AO_PA11_PA12_RMP" +#endif + #ifndef USE_USB_STDIO #define USE_USB_STDIO 1 #endif @@ -1069,6 +1073,12 @@ __code struct ao_cmds ao_usb_cmds[] = { void ao_usb_init(void) { + /* Turn on syscfg */ + stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_SYSCFGCOMPEN); + + /* Set PA11/PA12 remapping bit */ + stm_syscfg.cfgr1 |= (AO_PA11_PA12_RMP << STM_SYSCFG_CFGR1_PA11_PA12_RMP); + ao_usb_enable(); debug ("ao_usb_init\n"); |