Document number
204911
Version
Rev. K
Issue date
2016-10-11
Sirius Breadboard User Manual
www.aacmicrotec.com
Page
55
of
106
5.9.2. RTEMS API
This API represents the driver interface of the module from an RTEMS user application's
perspective.
The driver functionality is accessed through the RTEMS POSIX API for ease of use. In case
of a failure on a function call, the
errno
value is set for determining the cause.
5.9.2.1. Function int open(...)
Opens access to the specified GPIO pin, but do not reset the pin interface and instead
retains the settings from any previous access.
Argument name
Type
Direction
Description
pathname
const char *
in
The absolute path to the GPIO pin to be
opened. All possible paths are given by
"/dev/gpioX" where X matches 0-31. The actual
number of devices available depends on the
current hardware configuration.
flags
int
in
Access mode flag, O_RDONLY, O_WRONLY
or O_RDWR.
Return value
Description
Fildes
A file descriptor for the device on
success
-1
See
errno
values
errno values
EALREADY
Device is already open
EINVAL
Invalid options
5.9.2.2. Function int close(...)
Closes access to the GPIO pin.
Argument name
Type
Direction
Description
fd
int
in
File descriptor received at open.
Return value
Description
0
Device closed successfully
-1
See
errno
values
errno values
EINVAL
Invalid options
5.9.2.3. Function ssize_t read(...)
Reads the current value of the specified GPIO pin. If no edge detection have been enabled,
this call will return immediately. With edge detection enabled, this call will block with a
timeout until the pin changes status such that it triggers the edge detection. The timeout can
be adjusted using an ioctl command, but defaults to zero - blocking indefinitely, see also
5.9.2.5.