summaryrefslogtreecommitdiffstats
path: root/commands/mw.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-05-27 11:21:10 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-05-28 12:32:59 +0200
commitd7050d1a9d2b13a24421e13b2f5cdada6bf90182 (patch)
tree31f47666c99f72a66950e19dfecfac625611f1ef /commands/mw.c
parent14221b676d7e8569b1c0fb487efe7251dd00be2e (diff)
downloadbarebox-d7050d1a9d2b13a24421e13b2f5cdada6bf90182.tar.gz
mw command: Add 64bit support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/mw.c')
-rw-r--r--commands/mw.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/commands/mw.c b/commands/mw.c
index f0384f6..8ca3c61 100644
--- a/commands/mw.c
+++ b/commands/mw.c
@@ -42,7 +42,7 @@ static int do_mem_mw(int argc, char *argv[])
loff_t adr;
int swab = 0;
- if (mem_parse_options(argc, argv, "bwld:x", &mode, NULL, &filename,
+ if (mem_parse_options(argc, argv, "bwlqd:x", &mode, NULL, &filename,
&swab) < 0)
return 1;
@@ -59,6 +59,7 @@ static int do_mem_mw(int argc, char *argv[])
u8 val8;
u16 val16;
u32 val32;
+ u64 val64;
switch (mode) {
case O_RWSIZE_1:
val8 = simple_strtoul(argv[optind], NULL, 0);
@@ -76,6 +77,12 @@ static int do_mem_mw(int argc, char *argv[])
val32 = __swab32(val32);
ret = write(fd, &val32, 4);
break;
+ case O_RWSIZE_8:
+ val64 = simple_strtoull(argv[optind], NULL, 0);
+ if (swab)
+ val64 = __swab64(val64);
+ ret = write(fd, &val64, 8);
+ break;
}
if (ret < 0) {
perror("write");
@@ -97,6 +104,7 @@ BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT ("-b", "byte access")
BAREBOX_CMD_HELP_OPT ("-w", "word access (16 bit)")
BAREBOX_CMD_HELP_OPT ("-l", "long access (32 bit)")
+BAREBOX_CMD_HELP_OPT ("-q", "quad access (64 bit)")
BAREBOX_CMD_HELP_OPT ("-d FILE", "write file (default /dev/mem)")
BAREBOX_CMD_HELP_END