Advantech RSB-4210 Evaluation Kit User Manual Page 63

  • Download
  • Add to my manuals
  • Print
  • Page
    / 104
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 62
55 RSB-4210 User Manual
Chapter 3 Software Functionality
can be written generically, so that board setup code passes such pin configuration
data to drivers.
3.10.2 Paths in Sysfs
There are three kinds of entry in /sys/class/gpio:
Control interfaces used to get userspace control over GPIOs;
GPIOs themselves; and
GPIO controllers ("gpio_chip" instances).
That's in addition to standard files including the "device" symlink. The control inter-
faces are write-only:
/sys/class/gpio/
"export" ... Userspace may ask the kernel to export con-
trol of
a GPIO to userspace by writing its number to this
file.
#echo 19 > export
Will create a "gpio19" node for GPIO #19, if that's not
requested by kernel code.
"unexport" ... Reverses the effect of exporting to user-
space.
"echo 19 > unexport"
Will remove a "gpio19" node exported using the "export" file.
GPIO signals have paths like /sys/class/gpio/gpio42/ (for GPIO
#42)
and have the following read/write attributes:
/sys/class/gpio/gpioN/
"direction" reads as either "in" or "out". This value may normally be written. Writ-
ing as "out" defaults to initializing the value as low. To ensure glitch
free operation, values "low" and "high" may be written to configure the
GPIO as an output with that initial value. Note that this attribute *will
not exist* if the kernel doesn't support changing the direction of a
GPIO, or it was exported by kernel code that didn't explicitly allow
userspace to reconfigure this GPIO's direction.
"value" reads as either 0 (low) or 1 (high). If the GPIOis configured as an out-
put, this value may be written; any nonzero value is treated as high. If
the pin can be configured as interrupt-generating interrupt and if it has
been configured to generate interrupts (see the description of "edge"),
you can poll(2) on that file and poll(2) will return whenever the interrupt
was triggered. If you use poll(2), set the events POLLPRI and POLL-
ERR. If you use select(2), set the file descriptor in exceptfds. After
poll(2) returns, either lseek(2) to the beginning of the sysfs file and
read the new value or close the file and re-open it to read the value.
Page view 62
1 2 ... 58 59 60 61 62 63 64 65 66 67 68 ... 103 104

Comments to this Manuals

No comments