flash/nor/tcl: fix segfault on write_image misuse
[openocd.git] / src / flash / nor / spi.h
1 /***************************************************************************
2 * Copyright (C) 2012 by George Harris *
3 * george@luminairecoffee.com *
4 * *
5 * Copyright (C) 2010 by Antonio Borneo *
6 * borneo.antonio@gmail.com *
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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
22 ***************************************************************************/
23
24 /* data structure to maintain flash ids from different vendors */
25 struct flash_device {
26 char *name;
27 uint8_t erase_cmd;
28 uint8_t chip_erase_cmd;
29 uint32_t device_id;
30 uint32_t pagesize;
31 unsigned long sectorsize;
32 unsigned long size_in_bytes;
33 };
34
35 #define FLASH_ID(n, es, ces, id, psize, ssize, size) \
36 { \
37 .name = n, \
38 .erase_cmd = es, \
39 .chip_erase_cmd = ces, \
40 .device_id = id, \
41 .pagesize = psize, \
42 .sectorsize = ssize, \
43 .size_in_bytes = size \
44 }
45
46 extern const struct flash_device flash_devices[];
47
48 /* fields in SPI flash status register */
49 #define SPIFLASH_BSY_BIT 0x00000001 /* WIP Bit of SPI SR on SMI SR */
50 #define SPIFLASH_WE_BIT 0x00000002 /* WEL Bit of SPI SR on SMI SR */
51
52 /* SPI Flash Commands */
53 #define SPIFLASH_READ_ID 0x9F /* Read Flash Identification */
54 #define SPIFLASH_READ_STATUS 0x05 /* Read Status Register */
55 #define SPIFLASH_WRITE_ENABLE 0x06 /* Write Enable */
56 #define SPIFLASH_PAGE_PROGRAM 0x02 /* Page Program */
57 #define SPIFLASH_FAST_READ 0x0B /* Fast Read */
58 #define SPIFLASH_READ 0x03 /* Normal Read */

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)