Document number
205065
Version
Rev. N
Issue date
2019-02-04
Sirius OBC and TCM User Manual
Page
74
of
174
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.8.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.8.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.8.2.5.
Argument name
Type
Direction Description
fd
int
in
File descriptor received at open.
buf
void*
in
Pointer to character buffer to put the read data
in.
count
size_t
in
Number of bytes to read, must be set to 1.
Return value
Description
>=0
Number of bytes that were read.
-1
See
errno
values