Remove lots of no-op or dummy info function implementations and check if
it's implemented before invoking it.
Change-Id: I2144dad6a84a80359bb13a8a29a4614387e4c135
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1642
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
14 files changed:
-static int aduc702x_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- snprintf(buf, buf_size, "aduc702x flash driver info");
- return ERROR_OK;
-}
-
/* sets FEEMOD bit 3
* enable = 1 enables writes & erases, 0 disables them */
static int aduc702x_set_write_enable(struct target *target, int enable)
/* sets FEEMOD bit 3
* enable = 1 enables writes & erases, 0 disables them */
static int aduc702x_set_write_enable(struct target *target, int enable)
.auto_probe = aduc702x_probe,
.erase_check = default_flash_blank_check,
.protect_check = aduc702x_protect_check,
.auto_probe = aduc702x_probe,
.erase_check = default_flash_blank_check,
.protect_check = aduc702x_protect_check,
-static int sam3_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- if (bank->target->state != TARGET_HALTED) {
- LOG_ERROR("Target not halted");
- return ERROR_TARGET_NOT_HALTED;
- }
- buf[0] = 0;
- return ERROR_OK;
-}
-
static int sam3_page_read(struct sam3_bank_private *pPrivate, unsigned pagenum, uint8_t *buf)
{
uint32_t adr;
static int sam3_page_read(struct sam3_bank_private *pPrivate, unsigned pagenum, uint8_t *buf)
{
uint32_t adr;
.auto_probe = sam3_auto_probe,
.erase_check = sam3_erase_check,
.protect_check = sam3_protect_check,
.auto_probe = sam3_auto_probe,
.erase_check = sam3_erase_check,
.protect_check = sam3_protect_check,
-static int sam4_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- if (bank->target->state != TARGET_HALTED) {
- LOG_ERROR("Target not halted");
- return ERROR_TARGET_NOT_HALTED;
- }
- buf[0] = 0;
- return ERROR_OK;
-}
-
static int sam4_page_read(struct sam4_bank_private *pPrivate, unsigned pagenum, uint8_t *buf)
{
uint32_t adr;
static int sam4_page_read(struct sam4_bank_private *pPrivate, unsigned pagenum, uint8_t *buf)
{
uint32_t adr;
.auto_probe = sam4_auto_probe,
.erase_check = default_flash_blank_check,
.protect_check = sam4_protect_check,
.auto_probe = sam4_auto_probe,
.erase_check = default_flash_blank_check,
.protect_check = sam4_protect_check,
-static int dsp5680xx_flash_info(struct flash_bank *bank, char *buf,
- int buf_size)
-{
- snprintf(buf, buf_size,
- "\ndsp5680xx flash driver info:\n - See comments in code.");
- return ERROR_OK;
-}
-
/**
* The flash module (FM) on the dsp5680xx supports both individual sector
* and mass erase of the flash memory.
/**
* The flash module (FM) on the dsp5680xx supports both individual sector
* and mass erase of the flash memory.
.auto_probe = dsp5680xx_probe,
.erase_check = dsp5680xx_flash_erase_check,
.protect_check = dsp5680xx_flash_protect_check,
.auto_probe = dsp5680xx_probe,
.erase_check = dsp5680xx_flash_erase_check,
.protect_check = dsp5680xx_flash_protect_check,
- .info = dsp5680xx_flash_info
return em357_probe(bank);
}
return em357_probe(bank);
}
-
-static int get_em357_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- snprintf(buf, buf_size, "em357\n");
- return ERROR_OK;
-}
-
COMMAND_HANDLER(em357_handle_lock_command)
{
struct target *target = NULL;
COMMAND_HANDLER(em357_handle_lock_command)
{
struct target *target = NULL;
.auto_probe = em357_auto_probe,
.erase_check = default_flash_blank_check,
.protect_check = em357_protect_check,
.auto_probe = em357_auto_probe,
.erase_check = default_flash_blank_check,
.protect_check = em357_protect_check,
- .info = get_em357_info,
return fm3_probe(bank);
}
return fm3_probe(bank);
}
-static int fm3_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- snprintf(buf, buf_size, "Fujitsu fm3 Device does not support Chip-ID (Type unknown)");
- return ERROR_OK;
-}
-
/* Chip erase */
static int fm3_chip_erase(struct flash_bank *bank)
{
/* Chip erase */
static int fm3_chip_erase(struct flash_bank *bank)
{
.probe = fm3_probe,
.auto_probe = fm3_auto_probe,
.erase_check = default_flash_blank_check,
.probe = fm3_probe,
.auto_probe = fm3_auto_probe,
.erase_check = default_flash_blank_check,
-static int lpc288x_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- snprintf(buf, buf_size, "lpc288x flash driver");
- return ERROR_OK;
-}
-
static int lpc288x_protect(struct flash_bank *bank, int set, int first, int last)
{
int lockregion, status;
static int lpc288x_protect(struct flash_bank *bank, int set, int first, int last)
{
int lockregion, status;
.auto_probe = lpc288x_probe,
.erase_check = lpc288x_erase_check,
.protect_check = lpc288x_protect_check,
.auto_probe = lpc288x_probe,
.erase_check = lpc288x_erase_check,
.protect_check = lpc288x_protect_check,
return lpc2900_read_security_status(bank);
}
return lpc2900_read_security_status(bank);
}
-/**
- * Print info about the driver (not the device).
- *
- * @param bank Pointer to the flash bank descriptor
- * @param buf Buffer to take the string
- * @param buf_size Maximum number of characters that the buffer can take
- */
-static int lpc2900_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- snprintf(buf, buf_size, "lpc2900 flash driver");
- return ERROR_OK;
-}
-
struct flash_driver lpc2900_flash = {
.name = "lpc2900",
.commands = lpc2900_command_handlers,
struct flash_driver lpc2900_flash = {
.name = "lpc2900",
.commands = lpc2900_command_handlers,
.auto_probe = lpc2900_probe,
.erase_check = lpc2900_erase_check,
.protect_check = lpc2900_protect_check,
.auto_probe = lpc2900_probe,
.erase_check = lpc2900_erase_check,
.protect_check = lpc2900_protect_check,
-static int get_mini51_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- snprintf(buf, buf_size, "Mini51 flash driver");
- return ERROR_OK;
-}
-
static int mini51_probe(struct flash_bank *bank)
{
uint32_t flash_size;
static int mini51_probe(struct flash_bank *bank)
{
uint32_t flash_size;
.auto_probe = mini51_auto_probe,
.erase_check = default_flash_blank_check,
.protect_check = mini51_protect_check,
.auto_probe = mini51_auto_probe,
.erase_check = default_flash_blank_check,
.protect_check = mini51_protect_check,
- .info = get_mini51_info,
-static int ocl_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- return ERROR_OK;
-}
-
static int ocl_auto_probe(struct flash_bank *bank)
{
struct ocl_priv *ocl = bank->driver_priv;
static int ocl_auto_probe(struct flash_bank *bank)
{
struct ocl_priv *ocl = bank->driver_priv;
.probe = ocl_probe,
.erase_check = ocl_erase_check,
.protect_check = ocl_protect_check,
.probe = ocl_probe,
.erase_check = ocl_erase_check,
.protect_check = ocl_protect_check,
.auto_probe = ocl_auto_probe,
};
.auto_probe = ocl_auto_probe,
};
static int get_str7x_info(struct flash_bank *bank, char *buf, int buf_size)
{
static int get_str7x_info(struct flash_bank *bank, char *buf, int buf_size)
{
- snprintf(buf, buf_size, "str7x flash driver info");
/* STR7x flash doesn't support sector protection interrogation.
* FLASH_NVWPAR acts as a write only register; its read value
* doesn't reflect the actual protection state of the sectors.
*/
/* STR7x flash doesn't support sector protection interrogation.
* FLASH_NVWPAR acts as a write only register; its read value
* doesn't reflect the actual protection state of the sectors.
*/
- LOG_WARNING("STR7x flash lock information might not be correct "
+ snprintf(buf, buf_size, "STR7x flash lock information might not be correct "
"due to hardware limitations.");
return ERROR_OK;
}
"due to hardware limitations.");
return ERROR_OK;
}
-static int get_str9x_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- snprintf(buf, buf_size, "str9x flash driver info");
- return ERROR_OK;
-}
-
COMMAND_HANDLER(str9x_handle_flash_config_command)
{
struct target *target = NULL;
COMMAND_HANDLER(str9x_handle_flash_config_command)
{
struct target *target = NULL;
.auto_probe = str9x_probe,
.erase_check = default_flash_blank_check,
.protect_check = str9x_protect_check,
.auto_probe = str9x_probe,
.erase_check = default_flash_blank_check,
.protect_check = str9x_protect_check,
- .info = get_str9x_info,
return str9xpec_blank_check(bank, 0, bank->num_sectors - 1);
}
return str9xpec_blank_check(bank, 0, bank->num_sectors - 1);
}
-static int get_str9xpec_info(struct flash_bank *bank, char *buf, int buf_size)
-{
- snprintf(buf, buf_size, "str9xpec flash driver info");
- return ERROR_OK;
-}
-
COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
{
uint8_t status;
COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
{
uint8_t status;
.auto_probe = str9xpec_probe,
.erase_check = str9xpec_erase_check,
.protect_check = str9xpec_protect_check,
.auto_probe = str9xpec_probe,
.erase_check = str9xpec_erase_check,
.protect_check = str9xpec_protect_check,
- .info = get_str9xpec_info,
- *buf = '\0'; /* initialize buffer, otherwise it migh contain garbage if driver
- *function fails */
- retval = p->driver->info(p, buf, sizeof(buf));
- command_print(CMD_CTX, "%s", buf);
- if (retval != ERROR_OK)
- LOG_ERROR("error retrieving flash info");
+ if (p->driver->info != NULL) {
+ retval = p->driver->info(p, buf, sizeof(buf));
+ if (retval == ERROR_OK)
+ command_print(CMD_CTX, "%s", buf);
+ else
+ LOG_ERROR("error retrieving flash info");
+ }
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)