OpenOCD
nor/driver.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 /***************************************************************************
4  * Copyright (C) 2005 by Dominic Rath <Dominic.Rath@gmx.de> *
5  * Copyright (C) 2007,2008 Øyvind Harboe <oyvind.harboe@zylin.com> *
6  * Copyright (C) 2008 by Spencer Oliver <spen@spen-soft.co.uk> *
7  * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
8  * Copyright (C) 2010 by Antonio Borneo <borneo.antonio@gmail.com> *
9  ***************************************************************************/
10 
11 #ifndef OPENOCD_FLASH_NOR_DRIVER_H
12 #define OPENOCD_FLASH_NOR_DRIVER_H
13 
14 struct flash_bank;
15 
16 #define __FLASH_BANK_COMMAND(name) \
17  COMMAND_HELPER(name, struct flash_bank *bank)
18 
39 struct flash_driver {
44  const char *name;
45 
49  const char *usage;
50 
57 
84  __FLASH_BANK_COMMAND((*flash_bank_command));
85 
96  int (*erase)(struct flash_bank *bank, unsigned int first,
97  unsigned int last);
98 
116  int (*protect)(struct flash_bank *bank, int set, unsigned int first,
117  unsigned int last);
118 
130  int (*write)(struct flash_bank *bank,
131  const uint8_t *buffer, uint32_t offset, uint32_t count);
132 
144  int (*read)(struct flash_bank *bank,
145  uint8_t *buffer, uint32_t offset, uint32_t count);
146 
158  int (*verify)(struct flash_bank *bank,
159  const uint8_t *buffer, uint32_t offset, uint32_t count);
160 
168  int (*probe)(struct flash_bank *bank);
169 
179  int (*erase_check)(struct flash_bank *bank);
180 
193  int (*protect_check)(struct flash_bank *bank);
194 
204  int (*info)(struct flash_bank *bank, struct command_invocation *cmd);
205 
219  int (*auto_probe)(struct flash_bank *bank);
220 
227  void (*free_driver_priv)(struct flash_bank *bank);
228 };
229 
230 #define FLASH_BANK_COMMAND_HANDLER(name) \
231  static __FLASH_BANK_COMMAND(name)
232 
238 const struct flash_driver *flash_driver_find_by_name(const char *name);
239 
240 extern const struct flash_driver aduc702x_flash;
241 extern const struct flash_driver aducm360_flash;
242 extern const struct flash_driver ambiqmicro_flash;
243 extern const struct flash_driver at91sam3_flash;
244 extern const struct flash_driver at91sam4_flash;
245 extern const struct flash_driver at91sam4l_flash;
246 extern const struct flash_driver at91sam7_flash;
247 extern const struct flash_driver at91samd_flash;
248 extern const struct flash_driver ath79_flash;
249 extern const struct flash_driver atsame5_flash;
250 extern const struct flash_driver atsamv_flash;
251 extern const struct flash_driver avr_flash;
252 extern const struct flash_driver bluenrgx_flash;
253 extern const struct flash_driver cc26xx_flash;
254 extern const struct flash_driver cc3220sf_flash;
255 extern const struct flash_driver cfi_flash;
256 extern const struct flash_driver dsp5680xx_flash;
257 extern const struct flash_driver efm32_flash;
258 extern const struct flash_driver em357_flash;
259 extern const struct flash_driver eneispif_flash;
260 extern const struct flash_driver esirisc_flash;
261 extern const struct flash_driver faux_flash;
262 extern const struct flash_driver fespi_flash;
263 extern const struct flash_driver fm3_flash;
264 extern const struct flash_driver fm4_flash;
265 extern const struct flash_driver jtagspi_flash;
266 extern const struct flash_driver kinetis_flash;
267 extern const struct flash_driver kinetis_ke_flash;
268 extern const struct flash_driver lpc2000_flash;
269 extern const struct flash_driver lpc288x_flash;
270 extern const struct flash_driver lpc2900_flash;
271 extern const struct flash_driver lpcspifi_flash;
272 extern const struct flash_driver max32xxx_flash;
273 extern const struct flash_driver mdr_flash;
274 extern const struct flash_driver mrvlqspi_flash;
275 extern const struct flash_driver msp432_flash;
276 extern const struct flash_driver niietcm4_flash;
277 extern const struct flash_driver npcx_flash;
278 extern const struct flash_driver nrf51_flash;
279 extern const struct flash_driver nrf5_flash;
280 extern const struct flash_driver numicro_flash;
281 extern const struct flash_driver ocl_flash;
282 extern const struct flash_driver pic32mx_flash;
283 extern const struct flash_driver psoc4_flash;
284 extern const struct flash_driver psoc5lp_eeprom_flash;
285 extern const struct flash_driver psoc5lp_flash;
286 extern const struct flash_driver psoc5lp_nvl_flash;
287 extern const struct flash_driver psoc6_flash;
288 extern const struct flash_driver qn908x_flash;
289 extern const struct flash_driver renesas_rpchf_flash;
290 extern const struct flash_driver rp2040_flash;
291 extern const struct flash_driver rsl10_flash;
292 extern const struct flash_driver sh_qspi_flash;
293 extern const struct flash_driver sim3x_flash;
294 extern const struct flash_driver stellaris_flash;
295 extern const struct flash_driver stm32f1x_flash;
296 extern const struct flash_driver stm32f2x_flash;
297 extern const struct flash_driver stm32h7x_flash;
298 extern const struct flash_driver stm32l4x_flash;
299 extern const struct flash_driver stm32lx_flash;
300 extern const struct flash_driver stmqspi_flash;
301 extern const struct flash_driver stmsmi_flash;
302 extern const struct flash_driver str7x_flash;
303 extern const struct flash_driver str9x_flash;
304 extern const struct flash_driver str9xpec_flash;
305 extern const struct flash_driver swm050_flash;
306 extern const struct flash_driver tms470_flash;
307 extern const struct flash_driver virtual_flash;
308 extern const struct flash_driver w600_flash;
309 extern const struct flash_driver xcf_flash;
310 extern const struct flash_driver xmc1xxx_flash;
311 extern const struct flash_driver xmc4xxx_flash;
312 
313 #endif /* OPENOCD_FLASH_NOR_DRIVER_H */
const char * name
Definition: armv4_5.c:76
uint8_t bank
Definition: esirisc.c:135
const struct flash_driver at91sam4l_flash
Definition: at91sam4l.c:678
const struct flash_driver xmc1xxx_flash
Definition: xmc1xxx.c:523
const struct flash_driver stm32f2x_flash
Definition: stm32f2x.c:1792
const struct flash_driver at91samd_flash
Definition: at91samd.c:1290
const struct flash_driver ambiqmicro_flash
Definition: ambiqmicro.c:853
const struct flash_driver renesas_rpchf_flash
const struct flash_driver em357_flash
Definition: em357.c:911
const struct flash_driver rsl10_flash
Definition: rsl10.c:832
const struct flash_driver at91sam7_flash
Definition: at91sam7.c:1119
const struct flash_driver str9x_flash
Definition: str9x.c:653
const struct flash_driver eneispif_flash
Definition: eneispif.c:419
const struct flash_driver sim3x_flash
Definition: sim3x.c:1094
const struct flash_driver pic32mx_flash
Definition: pic32mx.c:950
const struct flash_driver jtagspi_flash
Definition: jtagspi.c:841
const struct flash_driver fespi_flash
Definition: fespi.c:850
const struct flash_driver lpc2900_flash
Definition: lpc2900.c:1572
const struct flash_driver lpc2000_flash
Definition: lpc2000.c:1603
const struct flash_driver nrf5_flash
Definition: nrf5.c:1256
const struct flash_driver atsamv_flash
Definition: atsamv.c:687
const struct flash_driver niietcm4_flash
Definition: niietcm4.c:1718
const struct flash_driver rp2040_flash
Definition: rp2040.c:523
const struct flash_driver psoc6_flash
Definition: psoc6.c:1021
const struct flash_driver qn908x_flash
Definition: qn908x.c:1183
const struct flash_driver bluenrgx_flash
Definition: bluenrg-x.c:465
const struct flash_driver swm050_flash
Definition: swm050.c:186
const struct flash_driver msp432_flash
Definition: msp432.c:1078
const struct flash_driver stmsmi_flash
Definition: stmsmi.c:639
const struct flash_driver str9xpec_flash
Definition: str9xpec.c:1188
const struct flash_driver avr_flash
Definition: avrf.c:461
const struct flash_driver cc3220sf_flash
Definition: cc3220sf.c:480
const struct flash_driver xcf_flash
Definition: xcf.c:875
const struct flash_driver fm3_flash
Definition: fm3.c:974
const struct flash_driver sh_qspi_flash
Definition: sh_qspi.c:899
const struct flash_driver at91sam3_flash
Definition: at91sam3.c:3710
const struct flash_driver numicro_flash
Definition: numicro.c:1254
const struct flash_driver * flash_driver_find_by_name(const char *name)
Find a NOR flash driver by its name.
Definition: drivers.c:92
const struct flash_driver mrvlqspi_flash
Definition: mrvlqspi.c:943
const struct flash_driver virtual_flash
Definition: virtual.c:210
const struct flash_driver efm32_flash
Definition: efm32.c:1211
const struct flash_driver psoc5lp_flash
Definition: psoc5lp.c:1509
const struct flash_driver xmc4xxx_flash
Definition: xmc4xxx.c:1332
const struct flash_driver ath79_flash
Definition: ath79.c:882
const struct flash_driver kinetis_ke_flash
Definition: kinetis_ke.c:1257
const struct flash_driver stellaris_flash
Definition: stellaris.c:1415
const struct flash_driver kinetis_flash
Definition: kinetis.c:3435
const struct flash_driver npcx_flash
Definition: npcx.c:529
const struct flash_driver psoc4_flash
Definition: psoc4.c:920
const struct flash_driver aducm360_flash
Definition: aducm360.c:544
const struct flash_driver lpcspifi_flash
Definition: lpcspifi.c:934
const struct flash_driver dsp5680xx_flash
const struct flash_driver atsame5_flash
Definition: atsame5.c:950
const struct flash_driver stm32l4x_flash
Definition: stm32l4x.c:2620
const struct flash_driver psoc5lp_nvl_flash
Definition: psoc5lp.c:814
const struct flash_driver psoc5lp_eeprom_flash
Definition: psoc5lp.c:997
const struct flash_driver w600_flash
Definition: w600.c:367
const struct flash_driver max32xxx_flash
Definition: max32xxx.c:960
const struct flash_driver cfi_flash
Definition: cfi.c:3038
const struct flash_driver aduc702x_flash
Definition: aduc702x.c:370
const struct flash_driver lpc288x_flash
Definition: lpc288x.c:401
const struct flash_driver str7x_flash
Definition: str7x.c:786
const struct flash_driver faux_flash
Definition: faux.c:106
const struct flash_driver stm32lx_flash
Definition: stm32lx.c:938
const struct flash_driver stm32h7x_flash
Definition: stm32h7x.c:1193
const struct flash_driver fm4_flash
Definition: fm4.c:691
const struct flash_driver at91sam4_flash
Definition: at91sam4.c:3258
const struct flash_driver esirisc_flash
const struct flash_driver cc26xx_flash
Definition: cc26xx.c:536
const struct flash_driver ocl_flash
Definition: ocl.c:306
const struct flash_driver mdr_flash
Definition: mdr.c:597
const struct flash_driver tms470_flash
Definition: tms470.c:1145
const struct flash_driver stmqspi_flash
Definition: stmqspi.c:2450
const struct flash_driver stm32f1x_flash
Definition: stm32f1x.c:1729
const struct flash_driver nrf51_flash
Definition: nrf5.c:1274
When run_command is called, a new instance will be created on the stack, filled with the proper value...
Definition: command.h:76
Provides details of a flash bank, available either on-chip or through a major interface.
Definition: nor/core.h:75
Provides the implementation-independent structure that defines all of the callbacks required by OpenO...
Definition: nor/driver.h:39
const struct command_registration * commands
An array of driver-specific commands to register.
Definition: nor/driver.h:56
int(* protect)(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
Bank/sector protection routine (target-specific).
Definition: nor/driver.h:116
int(* auto_probe)(struct flash_bank *bank)
A more gentle flavor of flash_driver_s::probe, performing setup with less noise.
Definition: nor/driver.h:219
const char * usage
Gives a human-readable description of arguments.
Definition: nor/driver.h:49
int(* erase_check)(struct flash_bank *bank)
Check the erasure status of a flash bank.
Definition: nor/driver.h:179
int(* info)(struct flash_bank *bank, struct command_invocation *cmd)
Display human-readable information about the flash bank.
Definition: nor/driver.h:204
void(* free_driver_priv)(struct flash_bank *bank)
Deallocates private driver structures.
Definition: nor/driver.h:227
int(* write)(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Program data into the flash.
Definition: nor/driver.h:130
int(* probe)(struct flash_bank *bank)
Probe to determine what kind of flash is present.
Definition: nor/driver.h:168
int(* erase)(struct flash_bank *bank, unsigned int first, unsigned int last)
Bank/sector erase routine (target-specific).
Definition: nor/driver.h:96
__FLASH_BANK_COMMAND((*flash_bank_command))
Finish the "flash bank" command for bank.
int(* read)(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, uint32_t count)
Read data from the flash.
Definition: nor/driver.h:144
int(* verify)(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count)
Verify data in flash.
Definition: nor/driver.h:158
int(* protect_check)(struct flash_bank *bank)
Determine if the specific bank is "protected" or not.
Definition: nor/driver.h:193
const char * name
Gives a human-readable name of this flash driver, This field is used to select and initialize the dri...
Definition: nor/driver.h:44
uint8_t cmd
Definition: vdebug.c:1
uint8_t offset[4]
Definition: vdebug.c:9
uint8_t count[4]
Definition: vdebug.c:22