Document number
205065
Version
Rev. N
Issue date
2019-02-04
Sirius OBC and TCM User Manual
Page
73
of
174
5.8. GPIO
5.8.1. Description
This driver software for the GPIO IP handles the setting and reading of general purpose
input/output pins. It implements the standard set of device file operations according to [RD7].
The GPIO IP has, apart from logical pin and input/output operations, also a number of other
features.
5.8.1.1. Falling and rising edge detection
Once configured, the GPIO IP can detect rising or falling edges on a pin and alert the driver
software by the means of an interrupt.
5.8.1.2. Time stamping in SCET
Instead, or in addition to the interrupt, the GPIO IP can also signal the SCET to sample the
current timer when a rising or falling edge is detected on a pin. Reading the time of the
timestamp requires interaction with the SCET and exact register address depends on the
current board configuration. One SCET sample register is shared by all GPIOs.
5.8.1.3. RTEMS differential mode
In RTEMS, a GPIO pin can also be set to operate in differential mode on output only. This
requires two pins working in tandem and if this functionality is enabled, the driver will
automatically adjust the setting of the paired pin to output mode as well. The pins are paired
in logical sequence, which means that pin 0 and 1 are paired as are pin 2 and 3 etc. Thus, in
differential mode it is recommended to operate on the lower numbered pin only to avoid
confusion. Pins can be set in differential mode on specific pair only, i.e. both normal single
ended and differential mode pins can operate simultaneously (though not on the same pins
obviously).
5.8.1.4. Operating on pins with pull-up or pull-down
For scenarios when one or multiple pins are connected to a pull-up or pull-down (for e.g.
open-drain operation), it's recommended that the output value of such a pin should always
be set to 1 for pull-down or 0 for pull-up mode. The actual pin value should then be selected
by switching between input or output mode on the pin to comply with the external pull
feature.
5.8.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.8.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.