运行结果如下:
root@(none):/han# ./i2c-test /dev/i2c-20
Hello i2c-test![ 5536.661954] i2c-mux.c: msgs = 51 , num = 2
enter i2c_open OK!
i2c.c: i2c_open: fd = 3
enter __i2c_set [ 5536.669209] i2c-mux.c: msgs = 51 , num = 1
OK!
__i2c_set done!
here is i2c_read_data function in main.c
[ 5536.677154] i2c-mux.c: msgs = 51 , num = 2
__i2c_send: data->msgs[0].addr = 51,data->msgs[0].buf[0] = 4
i2c_read_data success, val = 15
here is i2c_write_data function in main.c
the data to write val = 8
__i2c_send: data->msgs[0].addr = 51,data->msgs[0].buf[0] = 4
i2c_write_data success,val1 = 8
here is i2c_read_data function in main.c
__i2c_send: data->msgs[0].addr = 51,data->msgs[0].buf[0] = 4
i2c_read_data success, val = 8
root@(none):/han# date
Fri Jul 6 15:49:25 UTC 2012
root@(none):/han# hwclock -r
Fri Jul 6 08:49:28 2012 -0.628861 seconds
成功了!!!
i2c-test 成功地读写到了地址为0x51, 偏移地址为0x04的 寄存器内容!!!
