]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - cmd/io.c
1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2012 The Chromium OS Authors.
7 * IO space access commands.
18 * iod{.b, .w, .l} {addr}
20 int do_io_iod(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *const argv
[])
28 size
= cmd_get_data_size(argv
[0], 4);
32 addr
= simple_strtoul(argv
[1], NULL
, 16);
34 printf("%04x: ", (u16
) addr
);
37 printf("%08x\n", inl(addr
));
39 printf("%04x\n", inw(addr
));
41 printf("%02x\n", inb(addr
));
46 int do_io_iow(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *const argv
[])
54 size
= cmd_get_data_size(argv
[0], 4);
58 addr
= simple_strtoul(argv
[1], NULL
, 16);
59 val
= simple_strtoul(argv
[2], NULL
, 16);
62 outl((u32
) val
, addr
);
64 outw((u16
) val
, addr
);
71 /**************************************************/
72 U_BOOT_CMD(iod
, 2, 0, do_io_iod
,
73 "IO space display", "[.b, .w, .l] address");
75 U_BOOT_CMD(iow
, 3, 0, do_io_iow
,
77 "[.b, .w, .l] address value");