Constify struct flash_driver instances

Instances of struct flash_driver are never written to at runtime. For a
small amount of memory saving and also robustness (fewer things for
stray pointer writes to hit), mark them const.

Change-Id: Iadbbbc2fac0976d892699200000c5f02856729f3
Signed-off-by: Christopher Head <chead@zaber.com>
Reviewed-on: http://openocd.zylin.com/4803
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
reverse-resume-order
Christopher Head 2018-12-13 11:53:59 -08:00 committed by Matthias Welwarsky
parent 84a2cab596
commit a7479fa89d
64 changed files with 135 additions and 135 deletions

View File

@ -378,7 +378,7 @@ static int aduc702x_check_flash_completion(struct target *target, unsigned int t
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver aduc702x_flash = { const struct flash_driver aduc702x_flash = {
.name = "aduc702x", .name = "aduc702x",
.flash_bank_command = aduc702x_flash_bank_command, .flash_bank_command = aduc702x_flash_bank_command,
.erase = aduc702x_erase, .erase = aduc702x_erase,

View File

@ -554,7 +554,7 @@ static int aducm360_check_flash_completion(struct target *target, unsigned int t
} }
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
struct flash_driver aducm360_flash = { const struct flash_driver aducm360_flash = {
.name = "aducm360", .name = "aducm360",
.flash_bank_command = aducm360_flash_bank_command, .flash_bank_command = aducm360_flash_bank_command,
.erase = aducm360_erase, .erase = aducm360_erase,

View File

@ -888,7 +888,7 @@ static const struct command_registration ambiqmicro_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver ambiqmicro_flash = { const struct flash_driver ambiqmicro_flash = {
.name = "ambiqmicro", .name = "ambiqmicro",
.commands = ambiqmicro_command_handlers, .commands = ambiqmicro_command_handlers,
.flash_bank_command = ambiqmicro_flash_bank_command, .flash_bank_command = ambiqmicro_flash_bank_command,

View File

@ -109,7 +109,7 @@
#define offset_EFC_FSR 8 #define offset_EFC_FSR 8
#define offset_EFC_FRR 12 #define offset_EFC_FRR 12
extern struct flash_driver at91sam3_flash; extern const struct flash_driver at91sam3_flash;
static float _tomhz(uint32_t freq_hz) static float _tomhz(uint32_t freq_hz)
{ {
@ -3753,7 +3753,7 @@ static const struct command_registration at91sam3_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver at91sam3_flash = { const struct flash_driver at91sam3_flash = {
.name = "at91sam3", .name = "at91sam3",
.commands = at91sam3_command_handlers, .commands = at91sam3_command_handlers,
.flash_bank_command = sam3_flash_bank_command, .flash_bank_command = sam3_flash_bank_command,

View File

@ -103,7 +103,7 @@
#define offset_EFC_FSR 8 #define offset_EFC_FSR 8
#define offset_EFC_FRR 12 #define offset_EFC_FRR 12
extern struct flash_driver at91sam4_flash; extern const struct flash_driver at91sam4_flash;
static float _tomhz(uint32_t freq_hz) static float _tomhz(uint32_t freq_hz)
{ {
@ -3234,7 +3234,7 @@ static const struct command_registration at91sam4_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver at91sam4_flash = { const struct flash_driver at91sam4_flash = {
.name = "at91sam4", .name = "at91sam4",
.commands = at91sam4_command_handlers, .commands = at91sam4_command_handlers,
.flash_bank_command = sam4_flash_bank_command, .flash_bank_command = sam4_flash_bank_command,

View File

@ -684,7 +684,7 @@ static const struct command_registration at91sam4l_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver at91sam4l_flash = { const struct flash_driver at91sam4l_flash = {
.name = "at91sam4l", .name = "at91sam4l",
.commands = at91sam4l_command_handlers, .commands = at91sam4l_command_handlers,
.flash_bank_command = sam4l_flash_bank_command, .flash_bank_command = sam4l_flash_bank_command,

View File

@ -1140,7 +1140,7 @@ static const struct command_registration at91sam7_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver at91sam7_flash = { const struct flash_driver at91sam7_flash = {
.name = "at91sam7", .name = "at91sam7",
.usage = "gpnvm <bit> <set | clear>", .usage = "gpnvm <bit> <set | clear>",
.commands = at91sam7_command_handlers, .commands = at91sam7_command_handlers,

View File

@ -1287,7 +1287,7 @@ static const struct command_registration at91samd_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver at91samd_flash = { const struct flash_driver at91samd_flash = {
.name = "at91samd", .name = "at91samd",
.commands = at91samd_command_handlers, .commands = at91samd_command_handlers,
.flash_bank_command = samd_flash_bank_command, .flash_bank_command = samd_flash_bank_command,

View File

@ -895,7 +895,7 @@ static int get_ath79_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver ath79_flash = { const struct flash_driver ath79_flash = {
.name = "ath79", .name = "ath79",
.flash_bank_command = ath79_flash_bank_command, .flash_bank_command = ath79_flash_bank_command,
.erase = ath79_erase, .erase = ath79_erase,

View File

@ -938,7 +938,7 @@ static const struct command_registration same5_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver atsame5_flash = { const struct flash_driver atsame5_flash = {
.name = "atsame5", .name = "atsame5",
.commands = same5_command_handlers, .commands = same5_command_handlers,
.flash_bank_command = same5_flash_bank_command, .flash_bank_command = same5_flash_bank_command,

View File

@ -94,7 +94,7 @@
#define SAMV_PAGE_SIZE 512 #define SAMV_PAGE_SIZE 512
#define SAMV_FLASH_BASE 0x00400000 #define SAMV_FLASH_BASE 0x00400000
extern struct flash_driver atsamv_flash; extern const struct flash_driver atsamv_flash;
struct samv_flash_bank { struct samv_flash_bank {
int probed; int probed;
@ -726,7 +726,7 @@ static const struct command_registration atsamv_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver atsamv_flash = { const struct flash_driver atsamv_flash = {
.name = "atsamv", .name = "atsamv",
.commands = atsamv_command_handlers, .commands = atsamv_command_handlers,
.flash_bank_command = samv_flash_bank_command, .flash_bank_command = samv_flash_bank_command,

View File

@ -462,7 +462,7 @@ static const struct command_registration avrf_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver avr_flash = { const struct flash_driver avr_flash = {
.name = "avr", .name = "avr",
.commands = avrf_command_handlers, .commands = avrf_command_handlers,
.flash_bank_command = avrf_flash_bank_command, .flash_bank_command = avrf_flash_bank_command,

View File

@ -539,7 +539,7 @@ static int bluenrgx_get_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver bluenrgx_flash = { const struct flash_driver bluenrgx_flash = {
.name = "bluenrg-x", .name = "bluenrg-x",
.flash_bank_command = bluenrgx_flash_bank_command, .flash_bank_command = bluenrgx_flash_bank_command,
.erase = bluenrgx_erase, .erase = bluenrgx_erase,

View File

@ -535,7 +535,7 @@ static int cc26xx_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver cc26xx_flash = { const struct flash_driver cc26xx_flash = {
.name = "cc26xx", .name = "cc26xx",
.flash_bank_command = cc26xx_flash_bank_command, .flash_bank_command = cc26xx_flash_bank_command,
.erase = cc26xx_erase, .erase = cc26xx_erase,

View File

@ -489,7 +489,7 @@ static int cc3220sf_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver cc3220sf_flash = { const struct flash_driver cc3220sf_flash = {
.name = "cc3220sf", .name = "cc3220sf",
.flash_bank_command = cc3220sf_flash_bank_command, .flash_bank_command = cc3220sf_flash_bank_command,
.erase = cc3220sf_erase, .erase = cc3220sf_erase,

View File

@ -3112,7 +3112,7 @@ static void cfi_fixup_0002_write_buffer(struct flash_bank *bank, const void *par
cfi_info->buf_write_timeout_typ = 0; cfi_info->buf_write_timeout_typ = 0;
} }
struct flash_driver cfi_flash = { const struct flash_driver cfi_flash = {
.name = "cfi", .name = "cfi",
.flash_bank_command = cfi_flash_bank_command, .flash_bank_command = cfi_flash_bank_command,
.erase = cfi_erase, .erase = cfi_erase,

View File

@ -87,7 +87,7 @@ struct flash_bank {
struct target *target; /**< Target to which this bank belongs. */ struct target *target; /**< Target to which this bank belongs. */
struct flash_driver *driver; /**< Driver for this bank. */ const struct flash_driver *driver; /**< Driver for this bank. */
void *driver_priv; /**< Private driver storage pointer */ void *driver_priv; /**< Private driver storage pointer */
int bank_number; /**< The 'bank' (or chip number) of this instance. */ int bank_number; /**< The 'bank' (or chip number) of this instance. */

View File

@ -231,6 +231,6 @@ struct flash_driver {
* @param name The name of the requested driver. * @param name The name of the requested driver.
* @returns The flash_driver called @c name, or NULL if not found. * @returns The flash_driver called @c name, or NULL if not found.
*/ */
struct flash_driver *flash_driver_find_by_name(const char *name); const struct flash_driver *flash_driver_find_by_name(const char *name);
#endif /* OPENOCD_FLASH_NOR_DRIVER_H */ #endif /* OPENOCD_FLASH_NOR_DRIVER_H */

View File

@ -20,75 +20,75 @@
#endif #endif
#include "imp.h" #include "imp.h"
extern struct flash_driver aduc702x_flash; extern const struct flash_driver aduc702x_flash;
extern struct flash_driver aducm360_flash; extern const struct flash_driver aducm360_flash;
extern struct flash_driver ambiqmicro_flash; extern const struct flash_driver ambiqmicro_flash;
extern struct flash_driver at91sam3_flash; extern const struct flash_driver at91sam3_flash;
extern struct flash_driver at91sam4_flash; extern const struct flash_driver at91sam4_flash;
extern struct flash_driver at91sam4l_flash; extern const struct flash_driver at91sam4l_flash;
extern struct flash_driver at91sam7_flash; extern const struct flash_driver at91sam7_flash;
extern struct flash_driver at91samd_flash; extern const struct flash_driver at91samd_flash;
extern struct flash_driver ath79_flash; extern const struct flash_driver ath79_flash;
extern struct flash_driver atsame5_flash; extern const struct flash_driver atsame5_flash;
extern struct flash_driver atsamv_flash; extern const struct flash_driver atsamv_flash;
extern struct flash_driver avr_flash; extern const struct flash_driver avr_flash;
extern struct flash_driver bluenrgx_flash; extern const struct flash_driver bluenrgx_flash;
extern struct flash_driver cc3220sf_flash; extern const struct flash_driver cc3220sf_flash;
extern struct flash_driver cc26xx_flash; extern const struct flash_driver cc26xx_flash;
extern struct flash_driver cfi_flash; extern const struct flash_driver cfi_flash;
extern struct flash_driver dsp5680xx_flash; extern const struct flash_driver dsp5680xx_flash;
extern struct flash_driver efm32_flash; extern const struct flash_driver efm32_flash;
extern struct flash_driver em357_flash; extern const struct flash_driver em357_flash;
extern struct flash_driver esirisc_flash; extern const struct flash_driver esirisc_flash;
extern struct flash_driver faux_flash; extern const struct flash_driver faux_flash;
extern struct flash_driver fm3_flash; extern const struct flash_driver fm3_flash;
extern struct flash_driver fm4_flash; extern const struct flash_driver fm4_flash;
extern struct flash_driver fespi_flash; extern const struct flash_driver fespi_flash;
extern struct flash_driver jtagspi_flash; extern const struct flash_driver jtagspi_flash;
extern struct flash_driver kinetis_flash; extern const struct flash_driver kinetis_flash;
extern struct flash_driver kinetis_ke_flash; extern const struct flash_driver kinetis_ke_flash;
extern struct flash_driver lpc2000_flash; extern const struct flash_driver lpc2000_flash;
extern struct flash_driver lpc288x_flash; extern const struct flash_driver lpc288x_flash;
extern struct flash_driver lpc2900_flash; extern const struct flash_driver lpc2900_flash;
extern struct flash_driver lpcspifi_flash; extern const struct flash_driver lpcspifi_flash;
extern struct flash_driver max32xxx_flash; extern const struct flash_driver max32xxx_flash;
extern struct flash_driver mdr_flash; extern const struct flash_driver mdr_flash;
extern struct flash_driver mrvlqspi_flash; extern const struct flash_driver mrvlqspi_flash;
extern struct flash_driver msp432_flash; extern const struct flash_driver msp432_flash;
extern struct flash_driver niietcm4_flash; extern const struct flash_driver niietcm4_flash;
extern struct flash_driver nrf5_flash; extern const struct flash_driver nrf5_flash;
extern struct flash_driver nrf51_flash; extern const struct flash_driver nrf51_flash;
extern struct flash_driver numicro_flash; extern const struct flash_driver numicro_flash;
extern struct flash_driver ocl_flash; extern const struct flash_driver ocl_flash;
extern struct flash_driver pic32mx_flash; extern const struct flash_driver pic32mx_flash;
extern struct flash_driver psoc4_flash; extern const struct flash_driver psoc4_flash;
extern struct flash_driver psoc5lp_flash; extern const struct flash_driver psoc5lp_flash;
extern struct flash_driver psoc5lp_eeprom_flash; extern const struct flash_driver psoc5lp_eeprom_flash;
extern struct flash_driver psoc5lp_nvl_flash; extern const struct flash_driver psoc5lp_nvl_flash;
extern struct flash_driver psoc6_flash; extern const struct flash_driver psoc6_flash;
extern struct flash_driver sim3x_flash; extern const struct flash_driver sim3x_flash;
extern struct flash_driver stellaris_flash; extern const struct flash_driver stellaris_flash;
extern struct flash_driver stm32f1x_flash; extern const struct flash_driver stm32f1x_flash;
extern struct flash_driver stm32f2x_flash; extern const struct flash_driver stm32f2x_flash;
extern struct flash_driver stm32lx_flash; extern const struct flash_driver stm32lx_flash;
extern struct flash_driver stm32l4x_flash; extern const struct flash_driver stm32l4x_flash;
extern struct flash_driver stm32h7x_flash; extern const struct flash_driver stm32h7x_flash;
extern struct flash_driver stmsmi_flash; extern const struct flash_driver stmsmi_flash;
extern struct flash_driver str7x_flash; extern const struct flash_driver str7x_flash;
extern struct flash_driver str9x_flash; extern const struct flash_driver str9x_flash;
extern struct flash_driver str9xpec_flash; extern const struct flash_driver str9xpec_flash;
extern struct flash_driver tms470_flash; extern const struct flash_driver tms470_flash;
extern struct flash_driver virtual_flash; extern const struct flash_driver virtual_flash;
extern struct flash_driver w600_flash; extern const struct flash_driver w600_flash;
extern struct flash_driver xcf_flash; extern const struct flash_driver xcf_flash;
extern struct flash_driver xmc1xxx_flash; extern const struct flash_driver xmc1xxx_flash;
extern struct flash_driver xmc4xxx_flash; extern const struct flash_driver xmc4xxx_flash;
/** /**
* The list of built-in flash drivers. * The list of built-in flash drivers.
* @todo Make this dynamically extendable with loadable modules. * @todo Make this dynamically extendable with loadable modules.
*/ */
static struct flash_driver *flash_drivers[] = { static const struct flash_driver * const flash_drivers[] = {
&aduc702x_flash, &aduc702x_flash,
&aducm360_flash, &aducm360_flash,
&ambiqmicro_flash, &ambiqmicro_flash,
@ -155,7 +155,7 @@ static struct flash_driver *flash_drivers[] = {
NULL, NULL,
}; };
struct flash_driver *flash_driver_find_by_name(const char *name) const struct flash_driver *flash_driver_find_by_name(const char *name)
{ {
for (unsigned i = 0; flash_drivers[i]; i++) { for (unsigned i = 0; flash_drivers[i]; i++) {
if (strcmp(name, flash_drivers[i]->name) == 0) if (strcmp(name, flash_drivers[i]->name) == 0)

View File

@ -256,7 +256,7 @@ static int dsp5680xx_flash_erase_check(struct flash_bank *bank)
return retval; return retval;
} }
struct flash_driver dsp5680xx_flash = { const struct flash_driver dsp5680xx_flash = {
.name = "dsp5680xx_flash", .name = "dsp5680xx_flash",
.flash_bank_command = dsp5680xx_flash_bank_command, .flash_bank_command = dsp5680xx_flash_bank_command,
.erase = dsp5680xx_flash_erase, .erase = dsp5680xx_flash_erase,

View File

@ -1120,7 +1120,7 @@ static const struct command_registration efm32x_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver efm32_flash = { const struct flash_driver efm32_flash = {
.name = "efm32", .name = "efm32",
.commands = efm32x_command_handlers, .commands = efm32x_command_handlers,
.flash_bank_command = efm32x_flash_bank_command, .flash_bank_command = efm32x_flash_bank_command,

View File

@ -929,7 +929,7 @@ static const struct command_registration em357_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver em357_flash = { const struct flash_driver em357_flash = {
.name = "em357", .name = "em357",
.commands = em357_command_handlers, .commands = em357_command_handlers,
.flash_bank_command = em357_flash_bank_command, .flash_bank_command = em357_flash_bank_command,

View File

@ -571,7 +571,7 @@ static const struct command_registration esirisc_flash_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver esirisc_flash = { const struct flash_driver esirisc_flash = {
.name = "esirisc", .name = "esirisc",
.usage = "flash bank bank_id 'esirisc' base_address size_bytes 0 0 target " .usage = "flash bank bank_id 'esirisc' base_address size_bytes 0 0 target "
"cfg_address clock_hz wait_states", "cfg_address clock_hz wait_states",

View File

@ -113,7 +113,7 @@ static const struct command_registration faux_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver faux_flash = { const struct flash_driver faux_flash = {
.name = "faux", .name = "faux",
.commands = faux_command_handlers, .commands = faux_command_handlers,
.flash_bank_command = faux_flash_bank_command, .flash_bank_command = faux_flash_bank_command,

View File

@ -1038,7 +1038,7 @@ static int get_fespi_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver fespi_flash = { const struct flash_driver fespi_flash = {
.name = "fespi", .name = "fespi",
.flash_bank_command = fespi_flash_bank_command, .flash_bank_command = fespi_flash_bank_command,
.erase = fespi_erase, .erase = fespi_erase,

View File

@ -988,7 +988,7 @@ static const struct command_registration fm3_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver fm3_flash = { const struct flash_driver fm3_flash = {
.name = "fm3", .name = "fm3",
.commands = fm3_command_handlers, .commands = fm3_command_handlers,
.flash_bank_command = fm3_flash_bank_command, .flash_bank_command = fm3_flash_bank_command,

View File

@ -702,7 +702,7 @@ static const struct command_registration fm4_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver fm4_flash = { const struct flash_driver fm4_flash = {
.name = "fm4", .name = "fm4",
.commands = fm4_command_handlers, .commands = fm4_command_handlers,
.flash_bank_command = fm4_flash_bank_command, .flash_bank_command = fm4_flash_bank_command,

View File

@ -427,7 +427,7 @@ static int jtagspi_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver jtagspi_flash = { const struct flash_driver jtagspi_flash = {
.name = "jtagspi", .name = "jtagspi",
.flash_bank_command = jtagspi_flash_bank_command, .flash_bank_command = jtagspi_flash_bank_command,
.erase = jtagspi_erase, .erase = jtagspi_erase,

View File

@ -393,7 +393,7 @@ static bool fcf_fopt_configured;
static bool create_banks; static bool create_banks;
struct flash_driver kinetis_flash; const struct flash_driver kinetis_flash;
static int kinetis_write_inner(struct flash_bank *bank, const uint8_t *buffer, static int kinetis_write_inner(struct flash_bank *bank, const uint8_t *buffer,
uint32_t offset, uint32_t count); uint32_t offset, uint32_t count);
static int kinetis_probe_chip(struct kinetis_chip *k_chip); static int kinetis_probe_chip(struct kinetis_chip *k_chip);
@ -3143,7 +3143,7 @@ static const struct command_registration kinetis_command_handler[] = {
struct flash_driver kinetis_flash = { const struct flash_driver kinetis_flash = {
.name = "kinetis", .name = "kinetis",
.commands = kinetis_command_handler, .commands = kinetis_command_handler,
.flash_bank_command = kinetis_flash_bank_command, .flash_bank_command = kinetis_flash_bank_command,

View File

@ -1297,7 +1297,7 @@ static const struct command_registration kinetis_ke_command_handler[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver kinetis_ke_flash = { const struct flash_driver kinetis_ke_flash = {
.name = "kinetis_ke", .name = "kinetis_ke",
.commands = kinetis_ke_command_handler, .commands = kinetis_ke_command_handler,
.flash_bank_command = kinetis_ke_flash_bank_command, .flash_bank_command = kinetis_ke_flash_bank_command,

View File

@ -1609,7 +1609,7 @@ static const struct command_registration lpc2000_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver lpc2000_flash = { const struct flash_driver lpc2000_flash = {
.name = "lpc2000", .name = "lpc2000",
.commands = lpc2000_command_handlers, .commands = lpc2000_command_handlers,
.flash_bank_command = lpc2000_flash_bank_command, .flash_bank_command = lpc2000_flash_bank_command,

View File

@ -412,7 +412,7 @@ static int lpc288x_protect(struct flash_bank *bank, int set, int first, int last
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver lpc288x_flash = { const struct flash_driver lpc288x_flash = {
.name = "lpc288x", .name = "lpc288x",
.flash_bank_command = lpc288x_flash_bank_command, .flash_bank_command = lpc288x_flash_bank_command,
.erase = lpc288x_erase, .erase = lpc288x_erase,

View File

@ -1581,7 +1581,7 @@ static int lpc2900_protect_check(struct flash_bank *bank)
return lpc2900_read_security_status(bank); return lpc2900_read_security_status(bank);
} }
struct flash_driver lpc2900_flash = { const struct flash_driver lpc2900_flash = {
.name = "lpc2900", .name = "lpc2900",
.commands = lpc2900_command_handlers, .commands = lpc2900_command_handlers,
.flash_bank_command = lpc2900_flash_bank_command, .flash_bank_command = lpc2900_flash_bank_command,

View File

@ -946,7 +946,7 @@ static int get_lpcspifi_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver lpcspifi_flash = { const struct flash_driver lpcspifi_flash = {
.name = "lpcspifi", .name = "lpcspifi",
.flash_bank_command = lpcspifi_flash_bank_command, .flash_bank_command = lpcspifi_flash_bank_command,
.erase = lpcspifi_erase, .erase = lpcspifi_erase,

View File

@ -981,7 +981,7 @@ static const struct command_registration max32xxx_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver max32xxx_flash = { const struct flash_driver max32xxx_flash = {
.name = "max32xxx", .name = "max32xxx",
.commands = max32xxx_command_handlers, .commands = max32xxx_command_handlers,
.flash_bank_command = max32xxx_flash_bank_command, .flash_bank_command = max32xxx_flash_bank_command,

View File

@ -609,7 +609,7 @@ static int get_mdr_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver mdr_flash = { const struct flash_driver mdr_flash = {
.name = "mdr", .name = "mdr",
.usage = "flash bank <name> mdr <base> <size> 0 0 <target#> <type> <page_count> <sec_count>\n" .usage = "flash bank <name> mdr <base> <size> 0 0 <target#> <type> <page_count> <sec_count>\n"
"<type>: 0 for main memory, 1 for info memory", "<type>: 0 for main memory, 1 for info memory",

View File

@ -953,7 +953,7 @@ FLASH_BANK_COMMAND_HANDLER(mrvlqspi_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver mrvlqspi_flash = { const struct flash_driver mrvlqspi_flash = {
.name = "mrvlqspi", .name = "mrvlqspi",
.flash_bank_command = mrvlqspi_flash_bank_command, .flash_bank_command = mrvlqspi_flash_bank_command,
.erase = mrvlqspi_flash_erase, .erase = mrvlqspi_flash_erase,

View File

@ -1075,7 +1075,7 @@ static const struct command_registration msp432_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver msp432_flash = { const struct flash_driver msp432_flash = {
.name = "msp432", .name = "msp432",
.commands = msp432_command_handlers, .commands = msp432_command_handlers,
.flash_bank_command = msp432_flash_bank_command, .flash_bank_command = msp432_flash_bank_command,

View File

@ -1729,7 +1729,7 @@ static int get_niietcm4_info(struct flash_bank *bank, char *buf, int buf_size)
} }
struct flash_driver niietcm4_flash = { const struct flash_driver niietcm4_flash = {
.name = "niietcm4", .name = "niietcm4",
.usage = "flash bank <name> niietcm4 <base> <size> 0 0 <target#>", .usage = "flash bank <name> niietcm4 <base> <size> 0 0 <target#>",
.commands = niietcm4_command_handlers, .commands = niietcm4_command_handlers,

View File

@ -1140,7 +1140,7 @@ static const struct command_registration nrf5_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver nrf5_flash = { const struct flash_driver nrf5_flash = {
.name = "nrf5", .name = "nrf5",
.commands = nrf5_command_handlers, .commands = nrf5_command_handlers,
.flash_bank_command = nrf5_flash_bank_command, .flash_bank_command = nrf5_flash_bank_command,
@ -1158,7 +1158,7 @@ struct flash_driver nrf5_flash = {
/* We need to retain the flash-driver name as well as the commands /* We need to retain the flash-driver name as well as the commands
* for backwards compatability */ * for backwards compatability */
struct flash_driver nrf51_flash = { const struct flash_driver nrf51_flash = {
.name = "nrf51", .name = "nrf51",
.commands = nrf5_command_handlers, .commands = nrf5_command_handlers,
.flash_bank_command = nrf5_flash_bank_command, .flash_bank_command = nrf5_flash_bank_command,

View File

@ -1871,7 +1871,7 @@ static const struct command_registration numicro_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver numicro_flash = { const struct flash_driver numicro_flash = {
.name = "numicro", .name = "numicro",
.commands = numicro_command_handlers, .commands = numicro_command_handlers,
.flash_bank_command = numicro_flash_bank_command, .flash_bank_command = numicro_flash_bank_command,

View File

@ -314,7 +314,7 @@ static int ocl_auto_probe(struct flash_bank *bank)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver ocl_flash = { const struct flash_driver ocl_flash = {
.name = "ocl", .name = "ocl",
.flash_bank_command = ocl_flash_bank_command, .flash_bank_command = ocl_flash_bank_command,
.erase = ocl_erase, .erase = ocl_erase,

View File

@ -967,7 +967,7 @@ static const struct command_registration pic32mx_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver pic32mx_flash = { const struct flash_driver pic32mx_flash = {
.name = "pic32mx", .name = "pic32mx",
.commands = pic32mx_command_handlers, .commands = pic32mx_command_handlers,
.flash_bank_command = pic32mx_flash_bank_command, .flash_bank_command = pic32mx_flash_bank_command,

View File

@ -950,7 +950,7 @@ static const struct command_registration psoc4_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver psoc4_flash = { const struct flash_driver psoc4_flash = {
.name = "psoc4", .name = "psoc4",
.commands = psoc4_command_handlers, .commands = psoc4_command_handlers,
.flash_bank_command = psoc4_flash_bank_command, .flash_bank_command = psoc4_flash_bank_command,

View File

@ -838,7 +838,7 @@ static const struct command_registration psoc5lp_nvl_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver psoc5lp_nvl_flash = { const struct flash_driver psoc5lp_nvl_flash = {
.name = "psoc5lp_nvl", .name = "psoc5lp_nvl",
.commands = psoc5lp_nvl_command_handlers, .commands = psoc5lp_nvl_command_handlers,
.flash_bank_command = psoc5lp_nvl_flash_bank_command, .flash_bank_command = psoc5lp_nvl_flash_bank_command,
@ -1036,7 +1036,7 @@ static const struct command_registration psoc5lp_eeprom_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver psoc5lp_eeprom_flash = { const struct flash_driver psoc5lp_eeprom_flash = {
.name = "psoc5lp_eeprom", .name = "psoc5lp_eeprom",
.commands = psoc5lp_eeprom_command_handlers, .commands = psoc5lp_eeprom_command_handlers,
.flash_bank_command = psoc5lp_eeprom_flash_bank_command, .flash_bank_command = psoc5lp_eeprom_flash_bank_command,
@ -1548,7 +1548,7 @@ static const struct command_registration psoc5lp_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver psoc5lp_flash = { const struct flash_driver psoc5lp_flash = {
.name = "psoc5lp", .name = "psoc5lp",
.commands = psoc5lp_command_handlers, .commands = psoc5lp_command_handlers,
.flash_bank_command = psoc5lp_flash_bank_command, .flash_bank_command = psoc5lp_flash_bank_command,

View File

@ -1048,7 +1048,7 @@ static const struct command_registration psoc6_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver psoc6_flash = { const struct flash_driver psoc6_flash = {
.name = "psoc6", .name = "psoc6",
.commands = psoc6_command_handlers, .commands = psoc6_command_handlers,
.flash_bank_command = psoc6_flash_bank_command, .flash_bank_command = psoc6_flash_bank_command,

View File

@ -1110,7 +1110,7 @@ static const struct command_registration sim3x_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver sim3x_flash = { const struct flash_driver sim3x_flash = {
.name = "sim3x", .name = "sim3x",
.commands = sim3x_command_handlers, .commands = sim3x_command_handlers,
.flash_bank_command = sim3x_flash_bank_command, .flash_bank_command = sim3x_flash_bank_command,

View File

@ -1441,7 +1441,7 @@ static const struct command_registration stellaris_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver stellaris_flash = { const struct flash_driver stellaris_flash = {
.name = "stellaris", .name = "stellaris",
.commands = stellaris_command_handlers, .commands = stellaris_command_handlers,
.flash_bank_command = stellaris_flash_bank_command, .flash_bank_command = stellaris_flash_bank_command,

View File

@ -1570,7 +1570,7 @@ static const struct command_registration stm32x_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver stm32f1x_flash = { const struct flash_driver stm32f1x_flash = {
.name = "stm32f1x", .name = "stm32f1x",
.commands = stm32x_command_handlers, .commands = stm32x_command_handlers,
.flash_bank_command = stm32x_flash_bank_command, .flash_bank_command = stm32x_flash_bank_command,

View File

@ -1792,7 +1792,7 @@ static const struct command_registration stm32x_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver stm32f2x_flash = { const struct flash_driver stm32f2x_flash = {
.name = "stm32f2x", .name = "stm32f2x",
.commands = stm32x_command_handlers, .commands = stm32x_command_handlers,
.flash_bank_command = stm32x_flash_bank_command, .flash_bank_command = stm32x_flash_bank_command,

View File

@ -1114,7 +1114,7 @@ static const struct command_registration stm32x_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver stm32h7x_flash = { const struct flash_driver stm32h7x_flash = {
.name = "stm32h7x", .name = "stm32h7x",
.commands = stm32x_command_handlers, .commands = stm32x_command_handlers,
.flash_bank_command = stm32x_flash_bank_command, .flash_bank_command = stm32x_flash_bank_command,

View File

@ -1053,7 +1053,7 @@ static const struct command_registration stm32l4_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver stm32l4x_flash = { const struct flash_driver stm32l4x_flash = {
.name = "stm32l4x", .name = "stm32l4x",
.commands = stm32l4_command_handlers, .commands = stm32l4_command_handlers,
.flash_bank_command = stm32l4_flash_bank_command, .flash_bank_command = stm32l4_flash_bank_command,

View File

@ -944,7 +944,7 @@ static const struct command_registration stm32lx_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver stm32lx_flash = { const struct flash_driver stm32lx_flash = {
.name = "stm32lx", .name = "stm32lx",
.commands = stm32lx_command_handlers, .commands = stm32lx_command_handlers,
.flash_bank_command = stm32lx_flash_bank_command, .flash_bank_command = stm32lx_flash_bank_command,

View File

@ -652,7 +652,7 @@ static int get_stmsmi_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver stmsmi_flash = { const struct flash_driver stmsmi_flash = {
.name = "stmsmi", .name = "stmsmi",
.flash_bank_command = stmsmi_flash_bank_command, .flash_bank_command = stmsmi_flash_bank_command,
.erase = stmsmi_erase, .erase = stmsmi_erase,

View File

@ -799,7 +799,7 @@ static const struct command_registration str7x_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver str7x_flash = { const struct flash_driver str7x_flash = {
.name = "str7x", .name = "str7x",
.commands = str7x_command_handlers, .commands = str7x_command_handlers,
.flash_bank_command = str7x_flash_bank_command, .flash_bank_command = str7x_flash_bank_command,

View File

@ -667,7 +667,7 @@ static const struct command_registration str9x_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver str9x_flash = { const struct flash_driver str9x_flash = {
.name = "str9x", .name = "str9x",
.commands = str9x_command_handlers, .commands = str9x_command_handlers,
.flash_bank_command = str9x_flash_bank_command, .flash_bank_command = str9x_flash_bank_command,

View File

@ -1195,7 +1195,7 @@ static const struct command_registration str9xpec_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver str9xpec_flash = { const struct flash_driver str9xpec_flash = {
.name = "str9xpec", .name = "str9xpec",
.commands = str9xpec_command_handlers, .commands = str9xpec_command_handlers,
.flash_bank_command = str9xpec_flash_bank_command, .flash_bank_command = str9xpec_flash_bank_command,

View File

@ -1107,7 +1107,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
} }
const char *driver_name = CMD_ARGV[0]; const char *driver_name = CMD_ARGV[0];
struct flash_driver *driver = flash_driver_find_by_name(driver_name); const struct flash_driver *driver = flash_driver_find_by_name(driver_name);
if (NULL == driver) { if (NULL == driver) {
/* no matching flash driver found */ /* no matching flash driver found */
LOG_ERROR("flash driver '%s' not found", driver_name); LOG_ERROR("flash driver '%s' not found", driver_name);

View File

@ -1162,7 +1162,7 @@ FLASH_BANK_COMMAND_HANDLER(tms470_flash_bank_command)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver tms470_flash = { const struct flash_driver tms470_flash = {
.name = "tms470", .name = "tms470",
.commands = tms470_command_handlers, .commands = tms470_command_handlers,
.flash_bank_command = tms470_flash_bank_command, .flash_bank_command = tms470_flash_bank_command,

View File

@ -224,7 +224,7 @@ static int virtual_flash_read(struct flash_bank *bank,
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver virtual_flash = { const struct flash_driver virtual_flash = {
.name = "virtual", .name = "virtual",
.flash_bank_command = virtual_flash_bank_command, .flash_bank_command = virtual_flash_bank_command,
.erase = virtual_erase, .erase = virtual_erase,

View File

@ -376,7 +376,7 @@ static int get_w600_info(struct flash_bank *bank, char *buf, int buf_size)
return ERROR_OK; return ERROR_OK;
} }
struct flash_driver w600_flash = { const struct flash_driver w600_flash = {
.name = "w600", .name = "w600",
.flash_bank_command = w600_flash_bank_command, .flash_bank_command = w600_flash_bank_command,
.erase = w600_erase, .erase = w600_erase,

View File

@ -881,7 +881,7 @@ static const struct command_registration xcf_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver xcf_flash = { const struct flash_driver xcf_flash = {
.name = "xcf", .name = "xcf",
.usage = NULL, .usage = NULL,
.commands = xcf_command_handlers, .commands = xcf_command_handlers,

View File

@ -534,7 +534,7 @@ static const struct command_registration xmc1xxx_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver xmc1xxx_flash = { const struct flash_driver xmc1xxx_flash = {
.name = "xmc1xxx", .name = "xmc1xxx",
.commands = xmc1xxx_command_handlers, .commands = xmc1xxx_command_handlers,
.flash_bank_command = xmc1xxx_flash_bank_command, .flash_bank_command = xmc1xxx_flash_bank_command,

View File

@ -1343,7 +1343,7 @@ static const struct command_registration xmc4xxx_command_handlers[] = {
COMMAND_REGISTRATION_DONE COMMAND_REGISTRATION_DONE
}; };
struct flash_driver xmc4xxx_flash = { const struct flash_driver xmc4xxx_flash = {
.name = "xmc4xxx", .name = "xmc4xxx",
.commands = xmc4xxx_command_handlers, .commands = xmc4xxx_command_handlers,
.flash_bank_command = xmc4xxx_flash_bank_command, .flash_bank_command = xmc4xxx_flash_bank_command,