summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6782cd9)
.clearerr = lm3s_flash_clearerror,
};
.clearerr = lm3s_flash_clearerror,
};
-/* Flash memory mapping */
-#if CPU_CM3_LM3S1968
- #define EMB_FLASH_SIZE 0x40000 //< 256KiB
- #define EMB_FLASH_PAGE_SIZE 0x400 //< 1KiB
-#else
- #error Unknown CPU
-#endif
-
static struct FlashHardware flash_lm3s_hw;
static struct FlashHardware flash_lm3s_hw;
-static uint8_t flash_buf[EMB_FLASH_PAGE_SIZE];
+static uint8_t flash_buf[FLASH_PAGE_SIZE];
static void common_init(Flash *fls)
{
static void common_init(Flash *fls)
{
fls->hw = &flash_lm3s_hw;
fls->hw = &flash_lm3s_hw;
- fls->blk.blk_size = EMB_FLASH_PAGE_SIZE;
- fls->blk.blk_cnt = EMB_FLASH_SIZE / EMB_FLASH_PAGE_SIZE;
+ fls->blk.blk_size = FLASH_PAGE_SIZE;
+ fls->blk.blk_cnt = FLASH_SIZE / FLASH_PAGE_SIZE;
#define EMB_FLASH ((struct stm32_flash*)FLASH_R_BASE)
#define EMB_FLASH ((struct stm32_flash*)FLASH_R_BASE)
-#if CPU_CM3_STM32F103RB
- #define EMB_FLASH_PAGE_SIZE 1024
-#else
- #error Unknown CPU
-#endif
-
-
struct FlashHardware
{
uint8_t status;
struct FlashHardware
{
uint8_t status;
};
static struct FlashHardware flash_stm32_hw;
};
static struct FlashHardware flash_stm32_hw;
-static uint8_t flash_buf[EMB_FLASH_PAGE_SIZE];
+static uint8_t flash_buf[FLASH_PAGE_SIZE];
static void common_init(Flash *fls)
{
memset(fls, 0, sizeof(*fls));
DB(fls->blk.priv.type = KBT_FLASH);
static void common_init(Flash *fls)
{
memset(fls, 0, sizeof(*fls));
DB(fls->blk.priv.type = KBT_FLASH);
fls->hw = &flash_stm32_hw;
fls->hw = &flash_stm32_hw;
- fls->blk.blk_size = EMB_FLASH_PAGE_SIZE;
- fls->blk.blk_cnt = (F_SIZE * 1024) / EMB_FLASH_PAGE_SIZE;
+ fls->blk.blk_size = FLASH_PAGE_SIZE;
+ fls->blk.blk_cnt = (F_SIZE * 1024) / FLASH_PAGE_SIZE;
/* Unlock flash memory for the FPEC Access */
EMB_FLASH->KEYR = FLASH_KEY1;
/* Unlock flash memory for the FPEC Access */
EMB_FLASH->KEYR = FLASH_KEY1;
#error No i2c pins are defined for select cpu
#endif
#error No i2c pins are defined for select cpu
#endif
+
+/* Flash memory mapping */
+#if CPU_CM3_LM3S1968
+ #define FLASH_SIZE 0x40000 //< 256KiB
+ #define FLASH_PAGE_SIZE 0x400 //< 1KiB
+#else
+ #error No embedded definition for select cpu
+#endif
+
#include "stm32_i2c.h"
#include "stm32_flash.h"
#include "stm32_i2c.h"
#include "stm32_flash.h"
-#define GPIO_USART1_TX_PIN BV(9)
-#define GPIO_USART1_RX_PIN BV(10)
-#define GPIO_USART2_TX_PIN BV(2)
-#define GPIO_USART2_RX_PIN BV(3)
-#define GPIO_USART3_TX_PIN BV(10)
-#define GPIO_USART3_RX_PIN BV(11)
+#if CPU_CM3_STM32F103RB
+ #define GPIO_USART1_TX_PIN BV(9)
+ #define GPIO_USART1_RX_PIN BV(10)
+ #define GPIO_USART2_TX_PIN BV(2)
+ #define GPIO_USART2_RX_PIN BV(3)
+ #define GPIO_USART3_TX_PIN BV(10)
+ #define GPIO_USART3_RX_PIN BV(11)
+#else
+ #error No USART pins are defined for select cpu
+#endif
+#if CPU_CM3_STM32F103RB
+ #define GPIO_I2C1_SCL_PIN BV(6)
+ #define GPIO_I2C1_SDA_PIN BV(7)
+ #define GPIO_I2C2_SCL_PIN BV(10)
+ #define GPIO_I2C2_SDA_PIN BV(11)
+#else
+ #error No i2c pins are defined for select cpu
+#endif
-#define GPIO_I2C1_SCL_PIN BV(6)
-#define GPIO_I2C1_SDA_PIN BV(7)
-#define GPIO_I2C2_SCL_PIN BV(10)
-#define GPIO_I2C2_SDA_PIN BV(11)
+#if CPU_CM3_STM32F103RB
+ #define FLASH_PAGE_SIZE 1024
+#else
+ #error No embedded definition for select cpu
+#endif