From c2ed251ca6a2c143e72f922c115f3696806c2914 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 26 Nov 2022 23:29:41 +0000 Subject: util/nvmutil: move cmd brick to own function --- util/nvmutil/nvmutil.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 7ea39537..8052bca8 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -42,6 +42,7 @@ void cmd_dump(void); void showmac(int partnum); void hexdump(int partnum); void cmd_setchecksum(void); +void cmd_brick(void); int validChecksum(int partnum); uint16_t word(int pos16, int partnum); void setWord(int pos16, int partnum, uint16_t val); @@ -244,8 +245,7 @@ cmd(const char *command) } else if (strcmp(command, "setchecksum") == 0) { cmd_setchecksum(); } else if (strcmp(command, "brick") == 0) { - if (validChecksum(part)) - setWord(0x3F, part, (word(0x3F, part)) ^ 0xFF); + cmd_brick(); } else if (strcmp(command, "swap") == 0) { part0 = validChecksum(0); part1 = validChecksum(1); @@ -332,6 +332,13 @@ cmd_setchecksum(void) setWord(0x3F, part, 0xBABA - val16); } +void +cmd_brick(void) +{ + if (validChecksum(part)) + setWord(0x3F, part, (word(0x3F, part)) ^ 0xFF); +} + int validChecksum(int partnum) { -- cgit v1.2.1