/** @file afio_regs.h * Module defining the AFIO registers. * * Mainly made to be used by the afio module. It is recommanded to go through * the functions provided by that module instead of directly using the registers * defined here. */ #ifndef _AFIO_REGS_H_ #define _AFIO_REGS_H_ //--includes-------------------------------------------------------------------- #include "stdint.h" //--type definitions------------------------------------------------------------ #define AFIO_BASE_ADDRESS 0x40010000 union EVCR { struct __attribute__((packed)) { uint32_t PIN:4; uint32_t PORT:3; uint32_t EVOE:1; uint32_t reserved1:24; }; uint32_t word; }; union MAPR { struct __attribute__((packed)) { uint32_t SPI1_REMAP:1; uint32_t I2C1_REMAP:1; uint32_t USART1_REMAP:1; uint32_t USART2_REMAP:1; uint32_t USART3_REMAP:2; uint32_t TIM1_REMAP:2; uint32_t TIM2_REMAP:2; uint32_t TIM3_REMAP:2; uint32_t TIM4_REMAP:1; uint32_t CAN_REMAP:2; uint32_t PD01_REMAP:1; uint32_t TIM5CH4_REMAP:1; uint32_t ADC1_ETRGINJ_REMAP:1; uint32_t ADC1_ETRGREG_REMAP:1; uint32_t ADC2_ETRGINJ_REMAP:1; uint32_t ADC2_ETRGREG_REMAP:1; uint32_t reserved1:3; uint32_t SWJ_CFG:3; uint32_t reserved2:5; }; uint32_t word; }; union EXTICR1 { struct __attribute__((packed)) { uint32_t EXTI0:4; uint32_t EXTI1:4; uint32_t EXTI2:4; uint32_t EXTI3:4; uint32_t reserved1:16; }; uint32_t word; }; union EXTICR2 { struct __attribute__((packed)) { uint32_t EXTI4:4; uint32_t EXTI5:4; uint32_t EXTI6:4; uint32_t EXTI7:4; uint32_t reserved1:16; }; uint32_t word; }; union EXTICR3 { struct __attribute__((packed)) { uint32_t EXTI8:4; uint32_t EXTI9:4; uint32_t EXTI10:4; uint32_t EXTI11:4; uint32_t reserved1:16; }; uint32_t word; }; union EXTICR4 { struct __attribute__((packed)) { uint32_t EXTI12:4; uint32_t EXTI13:4; uint32_t EXTI14:4; uint32_t EXTI15:4; uint32_t reserved1:16; }; uint32_t word; }; union MAPR2 { struct __attribute__((packed)) { uint32_t reserved1:5; uint32_t TIM9_REMAP:1; uint32_t TIM10_REMAP:1; uint32_t TIM11_REMAP:1; uint32_t TIM13_REMAP:1; uint32_t TIM14_REMAP:1; uint32_t FSMC_NADV:1; uint32_t reserved2:21; }; uint32_t word; }; struct __attribute__((packed)) AFIO { union EVCR EVCR; union MAPR MAPR; union EXTICR1 EXTICR1; union EXTICR2 EXTICR2; union EXTICR3 EXTICR3; union EXTICR4 EXTICR4; union MAPR2 MAPR2; }; #endif //_AFIO_REGS_H_