aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/niietcm4.c
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2019-04-03 10:37:24 +0200
committerTomas Vanek <vanekt@fbl.cz>2019-05-14 19:37:11 +0100
commit6cb5ba6f1136df2986850f5c176cb38e34ca1795 (patch)
tree0cbc15e5119fe4d60760cd2cff7c13834c92942c /src/flash/nor/niietcm4.c
parent69165509386efffc2848ac3b345be750f1ddbe56 (diff)
helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should switch to CMD as first parameter. Change prototype of command_print() and command_print_sameline() to pass CMD instead of CMD_CTX. Since the first parameter is currently not used, the change can be done though scripts without manual coding. This patch is created using the command: sed -i PATTERN $(find src/ doc/ -type f) with all the following patters: 's/\(command_print(cmd\)->ctx,/\1,/' 's/\(command_print(CMD\)_CTX,/\1,/' 's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/' 's/\(command_print_sameline(cmd\)->ctx,/\1,/' 's/\(command_print_sameline(CMD\)_CTX,/\1,/' 's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/' This change is inspired by http://openocd.zylin.com/1815 from Paul Fertser but is now done through scripting. Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5081 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Diffstat (limited to 'src/flash/nor/niietcm4.c')
-rw-r--r--src/flash/nor/niietcm4.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/flash/nor/niietcm4.c b/src/flash/nor/niietcm4.c
index b034ee12..62549f20 100644
--- a/src/flash/nor/niietcm4.c
+++ b/src/flash/nor/niietcm4.c
@@ -425,7 +425,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_read_byte_command)
retval = target_read_u32(target, UFMD, &uflash_data);
if (retval != ERROR_OK)
return retval;
- command_print(CMD_CTX, "Read userflash %s region:\n"
+ command_print(CMD, "Read userflash %s region:\n"
"address = 0x%04x,\n"
"value = 0x%02x.", CMD_ARGV[0], uflash_addr, uflash_data);
return retval;
@@ -467,7 +467,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_write_byte_command)
int page_num = uflash_addr/USERFLASH_PAGE_SIZE;
- command_print(CMD_CTX, "Write userflash %s region:\n"
+ command_print(CMD, "Write userflash %s region:\n"
"address = 0x%04x,\n"
"value = 0x%02x.\n"
"Please wait ... ", CMD_ARGV[0], uflash_addr, uflash_data);
@@ -483,7 +483,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_write_byte_command)
/* write dump to userflash */
niietcm4_load_uflash_page(bank, uflash_dump, page_num, mem_type);
- command_print(CMD_CTX, "done!");
+ command_print(CMD, "done!");
return retval;
}
@@ -520,7 +520,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_full_erase_command)
retval = niietcm4_uopstatus_check(bank);
if (retval != ERROR_OK)
return retval;
- command_print(CMD_CTX, "Userflash full erase done!");
+ command_print(CMD, "Userflash full erase done!");
return retval;
}
@@ -563,7 +563,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_erase_command)
return retval;
}
- command_print(CMD_CTX, "Erase %s userflash pages %d through %d done!", CMD_ARGV[0], first, last);
+ command_print(CMD, "Erase %s userflash pages %d through %d done!", CMD_ARGV[0], first, last);
return retval;
}
@@ -621,9 +621,9 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_check_command)
return retval;
if (uflash_data & INFOWORD3_LOCK_IFB_UF)
- command_print(CMD_CTX, "All sectors of info userflash are not protected!");
+ command_print(CMD, "All sectors of info userflash are not protected!");
else
- command_print(CMD_CTX, "All sectors of info userflash are protected!");
+ command_print(CMD, "All sectors of info userflash are protected!");
} else {
uflash_addr = UF_LOCK_ADDR;
uflash_cmd = UFMC_MAGIC_KEY | UFMC_READ_IFB;
@@ -645,10 +645,10 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_check_command)
for (j = 0; j < 8; j++) {
if (uflash_data & 0x1)
- command_print(CMD_CTX, "Userflash sector #%03d: 0x%04x (0x100) is not protected!",
+ command_print(CMD, "Userflash sector #%03d: 0x%04x (0x100) is not protected!",
i*8+j, (i*8+j)*USERFLASH_PAGE_SIZE);
else
- command_print(CMD_CTX, "Userflash sector #%03d: 0x%04x (0x100) is protected!",
+ command_print(CMD, "Userflash sector #%03d: 0x%04x (0x100) is protected!",
i*8+j, (i*8+j)*USERFLASH_PAGE_SIZE);
uflash_data = uflash_data >> 1;
}
@@ -693,11 +693,11 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_command)
int set;
if (strcmp("on", CMD_ARGV[3]) == 0) {
- command_print(CMD_CTX, "Try to enable %s userflash sectors %d through %d protection. Please wait ... ",
+ command_print(CMD, "Try to enable %s userflash sectors %d through %d protection. Please wait ... ",
CMD_ARGV[0], first, last);
set = 1;
} else if (strcmp("off", CMD_ARGV[3]) == 0) {
- command_print(CMD_CTX, "Try to disable %s userflash sectors %d through %d protection. Please wait ... ",
+ command_print(CMD, "Try to disable %s userflash sectors %d through %d protection. Please wait ... ",
CMD_ARGV[0], first, last);
set = 0;
} else
@@ -707,7 +707,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_command)
if (retval != ERROR_OK)
return retval;
- command_print(CMD_CTX, "done!");
+ command_print(CMD, "done!");
return retval;
}
@@ -733,10 +733,10 @@ COMMAND_HANDLER(niietcm4_handle_bflash_info_remap_command)
int set;
if (strcmp("on", CMD_ARGV[0]) == 0) {
- command_print(CMD_CTX, "Try to enable bootflash info region remap. Please wait ...");
+ command_print(CMD, "Try to enable bootflash info region remap. Please wait ...");
set = 1;
} else if (strcmp("off", CMD_ARGV[0]) == 0) {
- command_print(CMD_CTX, "Try to disable bootflash info region remap. Please wait ...");
+ command_print(CMD, "Try to disable bootflash info region remap. Please wait ...");
set = 0;
} else
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -756,7 +756,7 @@ COMMAND_HANDLER(niietcm4_handle_bflash_info_remap_command)
/* write dump to userflash */
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
- command_print(CMD_CTX, "done!");
+ command_print(CMD, "done!");
return retval;
}
@@ -814,7 +814,7 @@ COMMAND_HANDLER(niietcm4_handle_extmem_cfg_command)
else
return ERROR_COMMAND_SYNTAX_ERROR;
- command_print(CMD_CTX, "Try to configure external memory boot interface:\n"
+ command_print(CMD, "Try to configure external memory boot interface:\n"
"port = %s\n"
"pin = %s\n"
"func = %s\n"
@@ -833,7 +833,7 @@ COMMAND_HANDLER(niietcm4_handle_extmem_cfg_command)
/* write dump to userflash */
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
- command_print(CMD_CTX, "done!");
+ command_print(CMD, "done!");
return retval;
}
@@ -861,10 +861,10 @@ COMMAND_HANDLER(niietcm4_handle_extmem_boot_command)
int set;
if (strcmp("on", CMD_ARGV[0]) == 0) {
- command_print(CMD_CTX, "Try to enable boot from external memory. Please wait ...");
+ command_print(CMD, "Try to enable boot from external memory. Please wait ...");
set = 1;
} else if (strcmp("off", CMD_ARGV[0]) == 0) {
- command_print(CMD_CTX, "Try to disable boot from external memory. Please wait ...");
+ command_print(CMD, "Try to disable boot from external memory. Please wait ...");
set = 0;
} else
return ERROR_COMMAND_SYNTAX_ERROR;
@@ -884,7 +884,7 @@ COMMAND_HANDLER(niietcm4_handle_extmem_boot_command)
/* write dump to userflash */
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
- command_print(CMD_CTX, "done!");
+ command_print(CMD, "done!");
return retval;
}
@@ -900,7 +900,7 @@ COMMAND_HANDLER(niietcm4_handle_service_mode_erase_command)
return retval;
struct target *target = bank->target;
- command_print(CMD_CTX, "Try to perform service mode erase. Please wait ...");
+ command_print(CMD, "Try to perform service mode erase. Please wait ...");
retval = target_write_u32(target, SERVICE_MODE_ERASE_ADDR, 1);
if (retval != ERROR_OK)
@@ -923,7 +923,7 @@ COMMAND_HANDLER(niietcm4_handle_service_mode_erase_command)
}
busy_sleep(1); /* can use busy sleep for short times. */
}
- command_print(CMD_CTX, "done! All data erased.");
+ command_print(CMD, "done! All data erased.");
return retval;
}
@@ -938,7 +938,7 @@ COMMAND_HANDLER(niietcm4_handle_driver_info_command)
if (retval != ERROR_OK)
return retval;
- command_print(CMD_CTX, "niietcm4 flash driver\n"
+ command_print(CMD, "niietcm4 flash driver\n"
"version: %d.%d\n"
"author: Bogdan Kolbov\n"
"mail: kolbov@niiet.ru",