|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
- * stm32f10x.h
|
|
|
+ * stm32/common.h
|
|
|
*
|
|
|
* Core and peripheral registers.
|
|
|
*
|
|
@@ -16,11 +16,9 @@
|
|
|
#define DBG volatile struct dbg * const
|
|
|
#define FLASH volatile struct flash * const
|
|
|
#define PWR volatile struct pwr * const
|
|
|
-#define BKP volatile struct bkp * const
|
|
|
#define RCC volatile struct rcc * const
|
|
|
#define IWDG volatile struct iwdg * const
|
|
|
#define GPIO volatile struct gpio * const
|
|
|
-#define AFIO volatile struct afio * const
|
|
|
#define EXTI volatile struct exti * const
|
|
|
#define DMA volatile struct dma * const
|
|
|
#define TIM volatile struct tim * const
|
|
@@ -32,46 +30,6 @@
|
|
|
#define USB_BUF volatile uint32_t * const
|
|
|
#define USB_OTG volatile struct usb_otg * const
|
|
|
|
|
|
-/* C-accessible registers. */
|
|
|
-static STK stk = (struct stk *)STK_BASE;
|
|
|
-static SCB scb = (struct scb *)SCB_BASE;
|
|
|
-static NVIC nvic = (struct nvic *)NVIC_BASE;
|
|
|
-static DBG dbg = (struct dbg *)DBG_BASE;
|
|
|
-static FLASH flash = (struct flash *)FLASH_BASE;
|
|
|
-static PWR pwr = (struct pwr *)PWR_BASE;
|
|
|
-static BKP bkp = (struct bkp *)BKP_BASE;
|
|
|
-static RCC rcc = (struct rcc *)RCC_BASE;
|
|
|
-static IWDG iwdg = (struct iwdg *)IWDG_BASE;
|
|
|
-static GPIO gpioa = (struct gpio *)GPIOA_BASE;
|
|
|
-static GPIO gpiob = (struct gpio *)GPIOB_BASE;
|
|
|
-static GPIO gpioc = (struct gpio *)GPIOC_BASE;
|
|
|
-static GPIO gpiod = (struct gpio *)GPIOD_BASE;
|
|
|
-static GPIO gpioe = (struct gpio *)GPIOE_BASE;
|
|
|
-static GPIO gpiof = (struct gpio *)GPIOF_BASE;
|
|
|
-static GPIO gpiog = (struct gpio *)GPIOG_BASE;
|
|
|
-static AFIO afio = (struct afio *)AFIO_BASE;
|
|
|
-static EXTI exti = (struct exti *)EXTI_BASE;
|
|
|
-static DMA dma1 = (struct dma *)DMA1_BASE;
|
|
|
-static DMA dma2 = (struct dma *)DMA2_BASE;
|
|
|
-static TIM tim1 = (struct tim *)TIM1_BASE;
|
|
|
-static TIM tim2 = (struct tim *)TIM2_BASE;
|
|
|
-static TIM tim3 = (struct tim *)TIM3_BASE;
|
|
|
-static TIM tim4 = (struct tim *)TIM4_BASE;
|
|
|
-static TIM tim5 = (struct tim *)TIM5_BASE;
|
|
|
-static TIM tim6 = (struct tim *)TIM6_BASE;
|
|
|
-static TIM tim7 = (struct tim *)TIM7_BASE;
|
|
|
-static SPI spi1 = (struct spi *)SPI1_BASE;
|
|
|
-static SPI spi2 = (struct spi *)SPI2_BASE;
|
|
|
-static SPI spi3 = (struct spi *)SPI3_BASE;
|
|
|
-static I2C i2c1 = (struct i2c *)I2C1_BASE;
|
|
|
-static I2C i2c2 = (struct i2c *)I2C2_BASE;
|
|
|
-static USART usart1 = (struct usart *)USART1_BASE;
|
|
|
-static USART usart2 = (struct usart *)USART2_BASE;
|
|
|
-static USART usart3 = (struct usart *)USART3_BASE;
|
|
|
-static USB usb = (struct usb *)USB_BASE;
|
|
|
-static USB_BUFD usb_bufd = (struct usb_bufd *)USB_BUF_BASE;
|
|
|
-static USB_BUF usb_buf = (uint32_t *)USB_BUF_BASE;
|
|
|
-
|
|
|
/* NVIC table */
|
|
|
extern uint32_t vector_table[];
|
|
|
|
|
@@ -123,6 +81,7 @@ typedef uint32_t stk_time_t;
|
|
|
#define IRQx_get_prio(x) (nvic->ipr[x] >> 4)
|
|
|
|
|
|
/* GPIO */
|
|
|
+struct gpio;
|
|
|
void gpio_configure_pin(GPIO gpio, unsigned int pin, unsigned int mode);
|
|
|
#define gpio_write_pin(gpio, pin, level) \
|
|
|
((gpio)->bsrr = ((level) ? 0x1u : 0x10000u) << (pin))
|
|
@@ -137,8 +96,6 @@ void fpec_init(void);
|
|
|
void fpec_page_erase(uint32_t flash_address);
|
|
|
void fpec_write(const void *data, unsigned int size, uint32_t flash_address);
|
|
|
|
|
|
-#define FLASH_PAGE_SIZE 1024
|
|
|
-
|
|
|
/*
|
|
|
* Local variables:
|
|
|
* mode: C
|