This is an automated email from Gerrit. Hsiangkai Wang ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/1321
-- gerrit commit 59acdf19bb18efdd5e3055ae3284acd25edbe5ce Author: Hsiangkai <[email protected]> Date: Mon Apr 1 22:04:25 2013 +0800 nds32: add nds command multi_write Sometimes users need to write multiple words into multiple different memory locations. To improve performance, nds32_cmd adds a new command, multi_write, to pack multiple write-memory operations into one usb packet and send it to AICE at once. Change-Id: I7816eabe1f3fc5bc0c62ca7d1e12acd00e460a5a Signed-off-by: Hsiangkai <[email protected]> diff --git a/src/target/nds32_cmd.c b/src/target/nds32_cmd.c index 6145d91..8905847 100644 --- a/src/target/nds32_cmd.c +++ b/src/target/nds32_cmd.c @@ -559,6 +559,58 @@ static int jim_nds32_bulk_write(Jim_Interp *interp, int argc, Jim_Obj * const *a return result; } +static int jim_nds32_multi_write(Jim_Interp *interp, int argc, Jim_Obj * const *argv) +{ + const char *cmd_name = Jim_GetString(argv[0], NULL); + + Jim_GetOptInfo goi; + Jim_GetOpt_Setup(&goi, interp, argc - 1, argv + 1); + + if (goi.argc < 3) { + Jim_SetResultFormatted(goi.interp, + "usage: %s # of pairs [<address> <data>]+", cmd_name); + return JIM_ERR; + } + + int e; + jim_wide num_of_pairs; + e = Jim_GetOpt_Wide(&goi, &num_of_pairs); + if (e != JIM_OK) + return e; + + struct target *target = Jim_CmdPrivData(goi.interp); + struct aice_port_s *aice = target_to_aice(target); + int result; + uint32_t address; + uint32_t data; + jim_wide i; + + aice->port->api->pack_command(true); + for (i = 0; i < num_of_pairs; i++) { + jim_wide tmp; + e = Jim_GetOpt_Wide(&goi, &tmp); + if (e != JIM_OK) + break; + address = (uint32_t)tmp; + + e = Jim_GetOpt_Wide(&goi, &tmp); + if (e != JIM_OK) + break; + data = (uint32_t)tmp; + + result = target_write_buffer(target, address, 4, (const uint8_t *)&data); + if (result != ERROR_OK) + break; + } + aice->port->api->pack_command(false); + + /* all args must be consumed */ + if (goi.argc != 0) + return JIM_ERR; + + return ERROR_OK; +} + static int jim_nds32_bulk_read(Jim_Interp *interp, int argc, Jim_Obj * const *argv) { const char *cmd_name = Jim_GetString(argv[0], NULL); @@ -831,6 +883,13 @@ static const struct command_registration nds32_exec_command_handlers[] = { .usage = "address count data", }, { + .name = "multi_write", + .jim_handler = jim_nds32_multi_write, + .mode = COMMAND_EXEC, + .help = "Write multiple addresses/words to target memory", + .usage = "num_of_pairs [address data]+", + }, + { .name = "bulk_read", .jim_handler = jim_nds32_bulk_read, .mode = COMMAND_EXEC, -- ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
