omapreg-debug - OMAP register space read / write access DebugFS interface.
Mansoor Ahamed : email@example.com
It is possible to access the system space locations from userspace using tools like devmem2. But there are certain regions which could be written / read only in supervisor mode. This tool provides a DebugFS interface using which user can read / write to any system space.
- Please make sure DebugFS support is enabled in the kernel. This could done during kernel configuration (i.e. make menuconfig) from "Kernel hacking ---> *? Debug Filesystem"
- Build the kernel uImage (or zimage) first and then build the omapreg_module.
- The build script build.sh could be used to build the omapreg_debug module.
- Before that, modify the KDIR variable in the build script to point your kernel source directory.
- Run ./build.sh to build the module
- The output module file "omapreg_debug.ko" should be available in the project root folder (where the omapreg_debug.c is present).
* Make sure sysfs is mounted. If not follow steps below to mount it.
mount -t sysfs sysfs sys
* Make sure DebugFS is mounted. If not follow steps below to mount it.
mount -t debugfs null /sys/kernel/debug
* Now you should see the omapreg_debug entry in the following location
* To write to system space
echo "w <start_address> <data> <count>" > /sys/kernel/debug/omapreg/mem
start_address : From where to start writing (in hex format i.e. 0x480a1000)
data : 32-bit data to be written (in hex format i.e. 0xAA55AA55)
count : Number of location to repeat the data (in decimal format)
1. echo "w 0x48140b34 0x2 1" > /sys/kernel/debug/omapreg/mem
This would write 0x2 to one location starting from 0x48140b34
2. echo "w 0x48140b34 0x2 10" > /sys/kernel/debug/omapreg/mem
This would write 0x2 to ten locations starting from 0x48140b34. So locations 0x48140b34 through 0x48140b58 would have 0x2
* To read from system space
echo "r <start_address> <count>" > /sys/kernel/debug/omapreg/mem
Start printing the contents starting from <start_address> and end after <count> times.
1. echo "r 0x48140b34 1" > /sys/kernel/debug/omapreg/mem
Print the contents of location 0x48140b34
2. echo "r 0x48140b34 10" > /sys/kernel/debug/omapreg/mem
Print contents of 10 location starting from 0x48140b34. So locations 0x48140b34 through 0x48140b58 will be printed.
- Currently supports only 32-bit access.
- Conditional printing of output while sending read command