Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
H/W register access using MMIO from userspace
C Objective-C
Branch: master

mmio: adds support to print uint32_t as binary values

Changes are based on sethbollinger@github idea and code.
For example:

 # mmio -x 0x10000000@4
 10000000: 30335452 20203235 00000000 00000103

 # mmio -n 0x10000000@4
 10000000: 00110000 00110011 01010100 01010010
 10000004: 00100000 00100000 00110010 00110101
 10000008: 00000000 00000000 00000000 00000000
 1000000C: 00000000 00000000 00000001 00000011

Signed-off-by: Žilvinas Valinskas <zilvinas@8devices.com>
latest commit 30618dacfd
Žilvinas Valinskas authored

README

Building and Installation:

$ cd /home/zilvinas/carambola/
$ cd packages
$ git clone git://github.com/8devices/mmio.git
$ cd /home/zilvinas/carambola/
$ make oldconfig
Collecting package info: done
...
mmio..................Memory Mapped I/O (PACKAGE_mmio) [N/m/y/?] (NEW)
...

You can choose either Y (makes part of image) or M (a separate package).

$ make

Or

$ make package/mmio/compile
$ make package/mmio/install

Final package is located under bin/ramips/packages/mmio_1_ramips.ipk.

Usage:

mmio [options] <address>[@<range>] (1)
mmio [options] <address> <value>   (2)

OPTIONS:
 -a   - 8bit hex + ascii output
 -b   - 8bit hex output
 -h   - 16bit hex output
 -n   - 32bit binary output
 -x   - 32bit hex output
 -k   - use /dev/kmem instead of /dev/mem (default)

(1) dumps specified memory range
(2) writes specified value to address


Writing memory:
# mmio 0x10000000 0xDEADBEEF

Dumping memory:
# mmio -a 0x10000000@64
10000000: 52 54 33 30 35 32 20 20 00 00 00 00 03 01 00 00 |RT3052  ........|
10000010: 00 00 44 10 00 00 00 00 00 00 00 00 00 00 00 00 |..D.............|
10000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 |...............@|
10000030: 3C 28 04 00 00 00 00 00 04 00 00 00 00 00 00 00 |<(..............|
10000040: 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 |................|
10000050: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
10000060: 9F 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
10000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
10000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
10000090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
100000A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
100000B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
100000C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
100000D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
100000E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
100000F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|

# mmio -x 0x10000000@64
10000000: 30335452 20203235 00000000 00000103
10000010: 10440000 00000000 00000000 00000000
10000020: 00000000 00000000 00000000 40000000
10000030: 0004283C 00000000 00000004 00000000
10000040: 00000000 00000000 00000001 00000000
10000050: 00000001 00000000 00000000 00000000
10000060: 0000039F 00000000 00000000 00000000
10000070: 00000000 00000000 00000000 00000000
10000080: 00000000 00000000 00000000 00000000
10000090: 00000000 00000000 00000000 00000000
100000A0: 00000000 00000000 00000000 00000000
100000B0: 00000000 00000000 00000000 00000000
100000C0: 00000000 00000000 00000000 00000000
100000D0: 00000000 00000000 00000000 00000000
100000E0: 00000000 00000000 00000000 00000000
100000F0: 00000000 00000000 00000000 00000000

# mmio -h 0x10000000@64
10000000: 5452 3033 3235 2020 0000 0000 0103 0000
10000010: 0000 1044 0000 0000 0000 0000 0000 0000
10000020: 0000 0000 0000 0000 0000 0000 0000 4000
10000030: 283C 0004 0000 0000 0004 0000 0000 0000
10000040: 0000 0000 0000 0000 0001 0000 0000 0000
10000050: 0001 0000 0000 0000 0000 0000 0000 0000
10000060: 039F 0000 0000 0000 0000 0000 0000 0000
10000070: 0000 0000 0000 0000 0000 0000 0000 0000
10000080: 0000 0000 0000 0000 0000 0000 0000 0000
10000090: 0000 0000 0000 0000 0000 0000 0000 0000
100000A0: 0000 0000 0000 0000 0000 0000 0000 0000
100000B0: 0000 0000 0000 0000 0000 0000 0000 0000
100000C0: 0000 0000 0000 0000 0000 0000 0000 0000
100000D0: 0000 0000 0000 0000 0000 0000 0000 0000
100000E0: 0000 0000 0000 0000 0000 0000 0000 0000
100000F0: 0000 0000 0000 0000 0000 0000 0000 0000

# /tmp/mmio -n 0x10000000@1
10000000: 00110000 00110011 01010100 01010010
          ^      ^                   ^      ^-- bit 0
          |      - bit 24            |
          +- 31                      +-- bit 7
Something went wrong with that request. Please try again.