- prepare OpenOCD for branching, created ./trunk/
[openocd.git] / src / flash / flash.h
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
20 #ifndef FLASH_H
21 #define FLASH_H
22
23 #include "target.h"
24
25 typedef struct flash_sector_s
26 {
27 u32 offset;
28 u32 size;
29 int is_erased;
30 int is_protected;
31 } flash_sector_t;
32
33 struct flash_bank_s;
34
35 typedef struct flash_driver_s
36 {
37 char *name;
38 int (*register_commands)(struct command_context_s *cmd_ctx);
39 int (*flash_bank_command)(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct flash_bank_s *bank);
40 int (*erase)(struct flash_bank_s *bank, int first, int last);
41 int (*protect)(struct flash_bank_s *bank, int set, int first, int last);
42 int (*write)(struct flash_bank_s *bank, u8 *buffer, u32 offset, u32 count);
43 int (*probe)(struct flash_bank_s *bank);
44 int (*erase_check)(struct flash_bank_s *bank);
45 int (*protect_check)(struct flash_bank_s *bank);
46 int (*info)(struct flash_bank_s *bank, char *buf, int buf_size);
47 } flash_driver_t;
48
49 typedef struct flash_bank_s
50 {
51 flash_driver_t *driver;
52 void *driver_priv;
53 u32 base;
54 u32 size;
55 int chip_width;
56 int bus_width;
57 int num_sectors;
58 flash_sector_t *sectors;
59 struct flash_bank_s *next;
60 } flash_bank_t;
61
62 extern int flash_register_commands(struct command_context_s *cmd_ctx);
63 extern int flash_init(struct command_context_s *cmd_ctx);
64
65 extern flash_bank_t *get_flash_bank_by_num(int num);
66
67 #define ERROR_FLASH_BANK_INVALID (-900)
68 #define ERROR_FLASH_SECTOR_INVALID (-901)
69 #define ERROR_FLASH_OPERATION_FAILED (-902)
70 #define ERROR_FLASH_DST_OUT_OF_BANK (-903)
71 #define ERROR_FLASH_DST_BREAKS_ALIGNMENT (-904)
72 #define ERROR_FLASH_BUSY (-905)
73 #define ERROR_FLASH_SECTOR_NOT_ERASED (-906)
74 #define ERROR_FLASH_BANK_NOT_PROBED (-907)
75
76 #endif /* FLASH_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)