# HG changeset patch # User Mychaela Falconia # Date 1615092517 0 # Node ID a462012c9e6788f549c7f5e534fcceb14174cf37 # Parent 647267e39c2196308d54ddaaae1b93e659ebb9d0 fc-simtool: update-rec-fill command implemented diff -r 647267e39c21 -r a462012c9e67 simtool/dispatch.c --- a/simtool/dispatch.c Sun Mar 07 04:11:28 2021 +0000 +++ b/simtool/dispatch.c Sun Mar 07 04:48:37 2021 +0000 @@ -92,6 +92,7 @@ extern int cmd_update_bin(); extern int cmd_update_bin_imm(); extern int cmd_update_rec(); +extern int cmd_update_rec_fill(); extern int cmd_update_rec_imm(); extern int cmd_user_sum(); extern int cmd_verify_chv(); @@ -220,6 +221,7 @@ {"update-bin", 2, 2, 0, cmd_update_bin}, {"update-bin-imm", 2, 2, 0, cmd_update_bin_imm}, {"update-rec", 2, 2, 0, cmd_update_rec}, + {"update-rec-fill", 2, 2, 0, cmd_update_rec_fill}, {"update-rec-imm", 2, 2, 0, cmd_update_rec_imm}, {"user-sum", 0, 0, 1, cmd_user_sum}, {"verify-chv1", 1, 1, 0, cmd_verify_chv}, diff -r 647267e39c21 -r a462012c9e67 simtool/writecmd.c --- a/simtool/writecmd.c Sun Mar 07 04:11:28 2021 +0000 +++ b/simtool/writecmd.c Sun Mar 07 04:48:37 2021 +0000 @@ -100,3 +100,30 @@ } return update_rec_op(recno, mode, data, curfile_record_len); } + +cmd_update_rec_fill(argc, argv) + char **argv; +{ + unsigned recno, mode, fill_byte; + u_char data[255]; + + if (!strcmp(argv[1], "prev")) { + recno = 0; + mode = 0x03; + } else { + recno = strtoul(argv[1], 0, 0); + if (recno < 1 || recno > 255) { + fprintf(stderr, + "error: record number argument is out of range\n"); + return(-1); + } + mode = 0x04; + } + fill_byte = strtoul(argv[2], 0, 0); + if (fill_byte > 0xFF) { + fprintf(stderr, "error: invalid fill byte argument\n"); + return(-1); + } + memset(data, fill_byte, curfile_record_len); + return update_rec_op(recno, mode, data, curfile_record_len); +}