diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2013-11-02 14:23:44 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2013-11-02 14:23:44 +0900 |
commit | 9fe6cefdc0564b6bb3d938c0c1074d57a4b9500f (patch) | |
tree | 915cfcf02076427abd45c4ca862d2062d947e50c /entry.c | |
parent | 5f14824977c1b7f281aa0b31cc8dbf93a649b504 (diff) |
fix spurious interrupts, Gnuk pin-cir support
Diffstat (limited to 'entry.c')
-rw-r--r-- | entry.c | 39 |
1 files changed, 35 insertions, 4 deletions
@@ -163,15 +163,33 @@ clock_init (void) ; } -#define RCC_APB2ENR_IOPAEN 0x00000004 +#define RCC_APB2RSTR_AFIORST 0x00000001 #define RCC_APB2RSTR_IOPARST 0x00000004 -#define RCC_APB2ENR_IOPBEN 0x00000008 #define RCC_APB2RSTR_IOPBRST 0x00000008 -#define RCC_APB2ENR_IOPCEN 0x00000010 #define RCC_APB2RSTR_IOPCRST 0x00000010 -#define RCC_APB2ENR_IOPDEN 0x00000020 #define RCC_APB2RSTR_IOPDRST 0x00000020 +#define RCC_APB2ENR_AFIOEN 0x00000001 +#define RCC_APB2ENR_IOPAEN 0x00000004 +#define RCC_APB2ENR_IOPBEN 0x00000008 +#define RCC_APB2ENR_IOPCEN 0x00000010 +#define RCC_APB2ENR_IOPDEN 0x00000020 + + +struct AFIO +{ + volatile uint32_t EVCR; + volatile uint32_t MAPR; + volatile uint32_t EXTICR[4]; + uint32_t RESERVED0; + volatile uint32_t MAPR2; +}; + +#define AFIO_BASE 0x40010000 +static struct AFIO *const AFIO = (struct AFIO *const)AFIO_BASE; + +#define AFIO_MAPR_TIM3_REMAP_PARTIALREMAP 0x00000800 + struct GPIO { volatile uint32_t CRL; @@ -196,6 +214,9 @@ struct GPIO { static struct GPIO *const GPIO_USB = ((struct GPIO *const) GPIO_USB_BASE); static struct GPIO *const GPIO_LED = ((struct GPIO *const) GPIO_LED_BASE); +#ifdef GPIO_OTHER_BASE +static struct GPIO *const GPIO_OTHER = ((struct GPIO *const) GPIO_OTHER_BASE); +#endif static void __attribute__((used)) gpio_init (void) @@ -205,6 +226,10 @@ gpio_init (void) RCC->APB2RSTR = RCC_APB2RSTR_IOP_RST; RCC->APB2RSTR = 0; +#ifdef AFIO_MAPR_SOMETHING + AFIO->MAPR |= AFIO_MAPR_SOMETHING; +#endif + GPIO_USB->ODR = VAL_GPIO_ODR; GPIO_USB->CRH = VAL_GPIO_CRH; GPIO_USB->CRL = VAL_GPIO_CRL; @@ -214,6 +239,12 @@ gpio_init (void) GPIO_LED->CRH = VAL_GPIO_LED_CRH; GPIO_LED->CRL = VAL_GPIO_LED_CRL; #endif + +#ifdef GPIO_OTHER_BASE + GPIO_OTHER->ODR = VAL_GPIO_OTHER_ODR; + GPIO_OTHER->CRH = VAL_GPIO_OTHER_CRH; + GPIO_OTHER->CRL = VAL_GPIO_OTHER_CRL; +#endif } #endif |