FreeCalypso > hg > freecalypso-hwlab
changeset 102:29cc5612797a
fc-simtool: update-rec command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 25 Jan 2021 02:16:16 +0000 |
parents | 454ff8bd0b83 |
children | 90eff13a72fd |
files | simtool/dispatch.c simtool/writecmd.c |
diffstat | 2 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/simtool/dispatch.c Mon Jan 25 01:54:43 2021 +0000 +++ b/simtool/dispatch.c Mon Jan 25 02:16:16 2021 +0000 @@ -22,6 +22,7 @@ extern int cmd_select(); extern int cmd_telecom_sum(); extern int cmd_update_bin(); +extern int cmd_update_rec(); extern int display_sim_resp_in_hex(); @@ -51,6 +52,7 @@ {"sim-resp", 0, 0, display_sim_resp_in_hex}, {"telecom-sum", 0, 0, cmd_telecom_sum}, {"update-bin", 2, 2, cmd_update_bin}, + {"update-rec", 2, 2, cmd_update_rec}, {0, 0, 0, 0} };
--- a/simtool/writecmd.c Mon Jan 25 01:54:43 2021 +0000 +++ b/simtool/writecmd.c Mon Jan 25 02:16:16 2021 +0000 @@ -23,3 +23,26 @@ len = rc; return update_bin_op(offset, data, len); } + +cmd_update_rec(argc, argv) + char **argv; +{ + unsigned recno; + u_char data[255]; + int rc; + + recno = strtoul(argv[1], 0, 0); + if (recno < 1 || recno > 255) { + fprintf(stderr, + "error: record number argument is out of range\n"); + return(-1); + } + rc = read_hex_data_file(argv[2], data); + if (rc < 0) + return(rc); + if (rc != curfile_record_len) { + fprintf(stderr, "error: hex data length != EF record length\n"); + return(-1); + } + return update_rec_op(recno, 0x04, data, curfile_record_len); +}