1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
26 typedef struct stm32x_flash_bank_s
28 struct target_s *target;
29 working_area_t *write_algorithm;
30 } stm32x_flash_bank_t;
32 /* stm32x register locations */
34 #define STM32_FLASH_ACR 0x40022000
35 #define STM32_FLASH_KEYR 0x40022004
36 #define STM32_FLASH_OPTKEYR 0x40022008
37 #define STM32_FLASH_SR 0x4002200C
38 #define STM32_FLASH_CR 0x40022010
39 #define STM32_FLASH_AR 0x40022014
40 #define STM32_FLASH_OBR 0x4002201C
41 #define STM32_FLASH_WRPR 0x40022020
43 /* option byte location */
45 #define STM32_OB_ADR 0x1FFFF800
47 /* FLASH_CR register bits */
49 #define FLASH_PG (1<<0)
50 #define FLASH_PER (1<<1)
51 #define FLASH_MER (1<<2)
52 #define FLASH_OPTPG (1<<4)
53 #define FLASH_OPTER (1<<5)
54 #define FLASH_STRT (1<<6)
55 #define FLASH_LOCK (1<<7)
56 #define FLASH_OPTWRE (1<<9)
58 /* FLASH_SR regsiter bits */
60 #define FLASH_BSY (1<<0)
61 #define FLASH_PGERR (1<<2)
62 #define FLASH_WRPRTERR (1<<4)
63 #define FLASH_EOP (1<<5)
65 /* STM32_FLASH_OBR bit definitions (reading) */
70 #define OPT_RDRSTSTOP 3
71 #define OPT_RDRSTSTDBY 4
73 /* register unlock keys */
75 #define KEY1 0x45670123
76 #define KEY2 0xCDEF89AB
78 typedef struct stm32x_mem_layout_s {
81 } stm32x_mem_layout_t;