6 gpio example, Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual

Page 64

Advertising
background image

KTD-S0057-I

Page 60 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide

10.6 GPIO Example

An easy way to design an application with GPIO access consists in use of the

sysfs

interface. The directory

/sys/class/gpio

contains the following entries:

export

gpiochip0

TI

®

AM3874 SoC

32 GPIOs

gpiochip32

TI

®

AM3874 SoC

32 GPIOs

gpiochip64

TI

®

AM3874 SoC

32 GPIOs

gpiochip96

TI

®

AM3874 SoC

32 GPIOs

gpiochip128

PMU

9

GPIOs

unexport

ATTENTION

Do not use other GPIO pins as are described in

the User's Guide chapter 'Digital I/O Interface'.


The kernel occupies some GPIO pins but not all are declared (for example GP1[0] and GP1[1] comprise the
first CAN bus interface). The command line below shows incomplete information (debugfs is already
mounted):

#

cat

/sys/kernel/debug/gpio

GPIOs

0-31,

gpio:

GPIOs

32-63,

gpio:

gpio-38 (mmc_cd ) in lo irq-198 edge-both

GPIOs

64-95,

gpio:

GPIOs

96-127,

gpio:

gpio-111 (PWR_RS485 ) out hi

gpio-112 (EN_RS485 ) out lo

gpio-113 (HALF_DUPLEX ) out lo

GPIOs 128-136, i2c/1-002d, tps65911, can sleep:

gpio-129 (tps65910:led1 ) out lo

gpio-131 (tps65910:led2 ) out lo


Further information about GPIO programming is available on

https://www.kernel.org/doc/Documentation/

gpio.txt

Advertising
This manual is related to the following products: