X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fflash%2Fmflash.c;h=43721280e943d0cf7bac8d78a8b984445c39d0dc;hb=c14852385fde55abc5d5ffb076510cd1814432e0;hp=289fe5ebb6af0e8a8e0e891ead178bae85fe8d3f;hpb=1a2c258ed4537ca95b50e1f9e776215d82de2a86;p=fw%2Fopenocd diff --git a/src/flash/mflash.c b/src/flash/mflash.c index 289fe5ebb..43721280e 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -209,7 +209,7 @@ static int mg_init_gpio (void) return ret; } -static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) +static int mg_dsk_wait(mg_io_type_wait wait_local, uint32_t time_var) { uint8_t status, error; struct target *target = mflash_bank->target; @@ -220,7 +220,7 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) struct duration bench; duration_start(&bench); - while (time) { + while (time_var) { ret = target_read_u8(target, mg_task_reg + MG_REG_STATUS, &status); if (ret != ERROR_OK) @@ -228,10 +228,10 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) if (status & mg_io_rbit_status_busy) { - if (wait == mg_io_wait_bsy) + if (wait_local == mg_io_wait_bsy) return ERROR_OK; } else { - switch (wait) + switch (wait_local) { case mg_io_wait_not_bsy: return ERROR_OK; @@ -259,7 +259,7 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) return ERROR_MG_IO; } - switch (wait) + switch (wait_local) { case mg_io_wait_rdy: if (status & mg_io_rbit_status_ready) @@ -280,7 +280,7 @@ static int mg_dsk_wait(mg_io_type_wait wait, uint32_t time) else LOG_ERROR("mflash: duration measurement failed: %d", ret); - if (t > time) + if (t > time_var) break; } @@ -1302,7 +1302,7 @@ static const struct command_registration mflash_exec_command_handlers[] = { COMMAND_REGISTRATION_DONE }; -int mflash_init_drivers(struct command_context *cmd_ctx) +static int mflash_init_drivers(struct command_context *cmd_ctx) { if (!mflash_bank) return ERROR_OK;