838d46c2da07a6f4e38f15541f1d5a9b9c202ae0
[openocd.git] / src / flash / str7x.h
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * Copyright (C) 2008 by Spencer Oliver *
6 * spen@spen-soft.co.uk *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ***************************************************************************/
23 #ifndef STR7X_H
24 #define STR7X_H
25
26 #include "flash.h"
27
28 struct str7x_flash_bank
29 {
30 uint32_t *sector_bits;
31 uint32_t disable_bit;
32 uint32_t busy_bits;
33 uint32_t register_base;
34 working_area_t *write_algorithm;
35 };
36
37 enum str7x_status_codes
38 {
39 STR7X_CMD_SUCCESS = 0,
40 STR7X_INVALID_COMMAND = 1,
41 STR7X_SRC_ADDR_ERROR = 2,
42 STR7X_DST_ADDR_ERROR = 3,
43 STR7X_SRC_ADDR_NOT_MAPPED = 4,
44 STR7X_DST_ADDR_NOT_MAPPED = 5,
45 STR7X_COUNT_ERROR = 6,
46 STR7X_INVALID_SECTOR = 7,
47 STR7X_SECTOR_NOT_BLANK = 8,
48 STR7X_SECTOR_NOT_PREPARED = 9,
49 STR7X_COMPARE_ERROR = 10,
50 STR7X_BUSY = 11
51 };
52
53 /* Flash registers */
54
55 #define FLASH_CR0 0x00000000
56 #define FLASH_CR1 0x00000004
57 #define FLASH_DR0 0x00000008
58 #define FLASH_DR1 0x0000000C
59 #define FLASH_AR 0x00000010
60 #define FLASH_ER 0x00000014
61 #define FLASH_NVWPAR 0x0000DFB0
62 #define FLASH_NVAPR0 0x0000DFB8
63 #define FLASH_NVAPR1 0x0000DFBC
64
65 /* FLASH_CR0 register bits */
66
67 #define FLASH_WMS 0x80000000
68 #define FLASH_SUSP 0x40000000
69 #define FLASH_WPG 0x20000000
70 #define FLASH_DWPG 0x10000000
71 #define FLASH_SER 0x08000000
72 #define FLASH_SPR 0x01000000
73 #define FLASH_BER 0x04000000
74 #define FLASH_MER 0x02000000
75 #define FLASH_LOCK 0x00000010
76 #define FLASH_BSYA1 0x00000004
77 #define FLASH_BSYA0 0x00000002
78
79 /* FLASH_CR1 register bits */
80
81 #define FLASH_B1S 0x02000000
82 #define FLASH_B0S 0x01000000
83 #define FLASH_B1F1 0x00020000
84 #define FLASH_B1F0 0x00010000
85 #define FLASH_B0F7 0x00000080
86 #define FLASH_B0F6 0x00000040
87 #define FLASH_B0F5 0x00000020
88 #define FLASH_B0F4 0x00000010
89 #define FLASH_B0F3 0x00000008
90 #define FLASH_B0F2 0x00000004
91 #define FLASH_B0F1 0x00000002
92 #define FLASH_B0F0 0x00000001
93
94 /* FLASH_ER register bits */
95
96 #define FLASH_WPF 0x00000100
97 #define FLASH_RESER 0x00000080
98 #define FLASH_SEQER 0x00000040
99 #define FLASH_10ER 0x00000008
100 #define FLASH_PGER 0x00000004
101 #define FLASH_ERER 0x00000002
102 #define FLASH_ERR 0x00000001
103
104 typedef struct str7x_mem_layout_s {
105 uint32_t sector_start;
106 uint32_t sector_size;
107 uint32_t sector_bit;
108 } str7x_mem_layout_t;
109
110 #endif /* STR7X_H */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)