Advantech RSB-4210 Evaluation Kit User Manual Page 65

  • Download
  • Add to my manuals
  • Print
  • Page
    / 104
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 64
57 RSB-4210 User Manual
Chapter 3 Software Functionality
3.10.3 GPIO Mapping Table
3.11 Interface Device Reference Documentation
3.11.1 I2C
Usually, i2c devices are controlled by a kernel driver. But it is also possible to access
all devices on an adapter from userspace, through the /dev interface. You need to
load module i2c-dev for this. Each registered i2c adapter gets a number, counting
from 0. You can examine /sys/class/i2c-dev/ to see what number corresponds to
which adapter. Alternatively, you can run "i2cdetect -l" to obtain a formated list of all
i2c adapters present on your system at a given time. i2cdetect is part of the i2c-tools
package.
I2C device files are character device files with major device number 89 and a minor
device number corresponding to the number assigned as explained above. They
should be called "i2c-%d" (i2c-0, i2c-1, ..., i2c-10, ...). All 256 minor device numbers
are reserved for i2c.
3.11.2 C example
To access an i2c adapter from a C program. The first thing to do is "#include <linux/
i2c-dev.h>". Please note that there are two files named "i2c-dev.h" out there, one is
distributed with the Linux kernel and is meant to be included from kernel driver code,
the other one is distributed with i2c-tools and is meant to be included from user-
space programs. You obviously want the second one here.
Now, you have to decide which adapter you want to access. You should inspect /sys/
class/i2c-dev/ or run "i2cdetect -l" to decide this. Adapter numbers are assigned
ROM-1210 RSB-4210
Logical Number Physical Number Logical Number Physical Number
11491176
21482148
31473147
433433
51755224
61766225
72267226
82278227
92289228
10 229 10 229
11 230 11 230
12 231 12 231
13 232 13 232
14 233 14 233
15 234 15 234
16 235 16 235
17 236 17 236
18 237 18 237
19 238 19 238
20 239 20 239
Page view 64
1 2 ... 60 61 62 63 64 65 66 67 68 69 70 ... 103 104

Comments to this Manuals

No comments