功能:
用 IO 指令可以实时读取或写入每个 IO 口的状态,这里简单介绍 IO 指令的使用。
配置:
make menuconfig -->utilities ---->打开 io
make menuconfig -->Global build settings --> kernel build option -->打开 /dev/mem virtual device support
root@OpenWrt:~# io --help
Unknown option: ?
Raw memory i/o utility - $Revision: 2.0 $
io -v -1|2|4 -r|w|a|o [-l <len>] [-f <file>] <addr> [<value>]
-v Verbose, asks for confirmation
-1|2|4 Sets memory access size in bytes (default byte)
-l <len> Length in bytes of area to access (defaults to
one access, or whole file length)
-r|w|a|o Read from or Write to memory (default read)
optional write with modify (and/or)
-f <file> File to write on memory read, or
to read on memory write
<addr> The memory address to access
<val> The value to write (implies -w)
Examples:
io 0x1000 Reads one byte from 0x1000
io 0x1000 0x12 Writes 0x12 to location 0x1000
io -2 -l 8 0x1000 Reads 8 words from 0x1000
io -r -f dmp -l 100 200 Reads 100 bytes from addr 200 to file
io -w -f img 0x10000 Writes the whole of file to memory
Note access size (-1|2|4) does not apply to file based accesses.