memeka wrote:you can always read the contents of the sysfs files (in C)
though i guess this will be slower than mmap. for mmap i'm not sure the address is published anywhere... maybe you need to look in the kernel sources?
Hi memeka. thanks for your response. I've tried using mmap and i2c-dev interface. I just want to read/write the configuration register of ina231 in order to use more averaging samples. I looked to the source code and saw that the averaging sampes are set to 16. However they can set up to 1024 according to ina231 datasheet. In particular, the configuration ina231 register value set by the kernel, is 0x46FF. This is my only reference in order to check if I am accessing corectly through userspace the device. Below are my attempts:
mmap: I used mmap to map the device files (such as ../ina231/sensor_W) with no result. Also I mmaped the physical adresses of 12c60000 (s3c2440-i2c.0), 12c70000(s3c2440-i2c.1),12c80000( s3c2440-i2c.2),12ca0000(exynos5-hs-i2c.0) but I couldn't found any "0x46FF" value. Maybe I am doing it with the wrong way as it is like looking i2c bus's transactions instead of device's register values.
ioctl: I made an ioctl using 0x40,0x41,0x41,0x45 as device numbers and /dev/i2c-4 as file descriptor, and "I2C_SLAVE" as i2c's slave adress and fails.
I use prebuilt kernel 3.4.75 ubuntu