DEVREGS - Is a tool to display and modify a device's registers at runtime.
Under Linux, you can access registers, or any area of physical memory through the /dev/mem pseudo-device and the wonders of the mmap system call. To use it, you open the /dev/mem device, mmap the page in which a register is located, then use the pointer returned to read and/or write the data. Boundary Devices, developed a tool known as " devregs " that allows you to put a little structure around this facility. It allows you to give names to particular physical memory areas and to describe the bits within a register in the text file /etc/devregs.dat.
How to read from register :
To read one or more registers, use devregs with a single parameter that’s either an address or a register name.
Ex : $ devregs 0x73f88000
:0x73f88000 =0x803dffaf
If a register address matches a register in /etc/devregs.dat
, you’ll see the register name:
Ex : $ devregs 0x73f88000
GPIO2_DR:0x73f88000 =0x803dffaf
If used with a register name, any bitfields defined will be shown:
Ex: devregs UART1_UFCR
UART1_UFCR: 0x73fc0090 =0x0801
UART1_UFCR:0x73fc0090 =0x0801
TXTL 10-15 =0x2
RFDIV 7 - 9 =0x0
DCEDTE 6 - 6 = 0x0
RXTL 0 - 5 = 0x1
How to write to register :
Ex : $ devregs GPIO2_GDIR
GPIO2_GDIR:0x73f88004 =0x0002c0a4
Ex: $ devregs GPIO2_GDIR 0x2c0a0
GPIO2_GDIR:0x73f88004 =0x0002c0a4
GPIO2_GDIR:0x73f88004 == 0x0002c0a4...0x0002c0a0
Ex: $ devregs GPIO2_GDIR
GPIO2_GDIR:0x73f88004 =0x0002c0a0
For more detailed information please go through the following below links :
http://boundarydevices.com/i-mx5x-device-register-access/
http://boundarydevices.com/configuring-i-mx6-machines-different-screens-nitrogen6x-sabre-lite/