]>
git.ipfire.org Git - people/ms/u-boot.git/blob - common/cmd_io.c
2 * Copyright (c) 2012 The Chromium OS Authors.
4 * See file CREDITS for list of people who contributed to this
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 * IO space access commands.
35 * iod{.b, .w, .l} {addr}
37 int do_io_iod(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *const argv
[])
45 size
= cmd_get_data_size(argv
[0], 4);
49 addr
= simple_strtoul(argv
[1], NULL
, 16);
51 printf("%04x: ", (u16
) addr
);
54 printf("%08x\n", inl(addr
));
56 printf("%04x\n", inw(addr
));
58 printf("%02x\n", inb(addr
));
63 int do_io_iow(cmd_tbl_t
*cmdtp
, int flag
, int argc
, char *const argv
[])
65 ulong addr
, size
, val
;
70 size
= cmd_get_data_size(argv
[0], 4);
74 addr
= simple_strtoul(argv
[1], NULL
, 16);
75 val
= simple_strtoul(argv
[2], NULL
, 16);
78 outl((u32
) val
, addr
);
80 outw((u16
) val
, addr
);
87 /**************************************************/
88 U_BOOT_CMD(iod
, 2, 0, do_io_iod
,
89 "IO space display", "[.b, .w, .l] address [# of objects]");
91 U_BOOT_CMD(iow
, 3, 0, do_io_iow
,
92 "IO space modify (auto-incrementing address)",
93 "[.b, .w, .l] address");