Skip to main content
The RTSS GPIO driver provides interfaces to configure, read input/output values, and write output values to a GPIO. A GPIO is configured as input/output or as a special function GPIO. The GPIO driver also supports receiving interrupts from GPIO. Interrupts are generated as level-triggered, rising-edge, falling-edge, or dual-edge-triggered interrupts. Specific GPIOs are assigned to RTSS for data input activities and receiving interrupt request. Across all SoCs, the GPIO structure remains the same and consists of the following parameters:
  • Direction
  • Drive mode
  • Drive strength
  • Function select
  • GPIO client APIs

Direction

Sets the direction of the GPIO. A GPIO configured as an input is read only, while a GPIO configured as an output can be read and written.

Drive mode

GPIOs are configured to have internal pull circuits (up, down, or no-pull) and different driving strengths. It sets the drive mode, which depends on how the pin is connected to the board. Regardless of the FUNC SEL field setting, the pad is set up to use an internal weak pull-up, pull down, keeper, or no-pull function:

Drive strength

Drive strength controls the output voltage and impedance of the GPIO pad. Configuration is based on hardware design requirements. A higher value increases pin maximum frequency, energy consumption, and EMI generation. Also, dependent on external pull-up or pull-down strength, and line characteristics. Drive strength can be:

Function select

It gives the ability to choose the module that’s routed to the GPIO pad. By default, this is set to the general purpose (function 0). Examples of pin muxing options in IQ-8275 is RTSS [48] used for CAN (func=0) or EMAC (func=1). For more information about each GPIO pin assignment and alternate functions,

GPIO client APIs

sail_gpio_config_pin (int ngpio, GPIOConfigType cfg)

The sail_gpio_config_pin() function allows the clients to configure the GPIO for GPIO transaction calls. The clients must register with the GPIO structure such as direction, drive mode, drive strength, and function selection.
  • Prototype: void sail_gpio_config_pin(int ngpio, GPIOConfigType *cfg);
  • Parameters:
  • Returns: None

sail_gpio_config_group(int *ngpio, GPIOConfigType *cfg, uint8 nSize)

Configures a group of GPIO’s pull, direction, drive strength, and function.
  • Prototype: void sail_gpio_config_group(int *ngpio, GPIOConfigType *cfg, uint8 nSize;
  • Parameters:
  • Returns: None

sail_gpio_ReadPin

The Reading function reads the programmed output value of a GPIO pin.
  • Prototype: GPIOValueType sail_gpio_ReadPin (int ngpio);
  • Parameters:
  • Returns:
    • If the input is 1, returns GPIO_HIGH
    • If the input is 0, returns GPIO_LOW

sail_gpio_WritePin

Programs or writes the output value of a GPIO pin.
  • Prototype: GPIOValueType sail_gpio_ReadPin (int ngpio);
  • Parameters:
  • Returns:
    • If the input is 1, returns GPIO_HIGH
    • If the input is 0, returns GPIO_LOW

vSailGPIOWakeUpConfig

vSailGPIOWakeUpConfig is a GPIO configuration function dedicated to setting up specific GPIO pins on the wake-up input path of the SAIL power controller.
  • Prototype: static void vSailGPIOWakeUpConfig()
  • Parameters:
  • Returns: None
For more information about wake-up-capable GPIOs,

sail_gpio_ReadPinOutput

Interface to read the output value of a GPIO.
  • Prototype: GPIOValueType sail_gpio_ReadPinOutput(int ngpio);
  • Parameters:
  • Returns:
    • If the output is 1, returns GPIO_HIGH
    • If the output is 0, returns GPIO_LOW

Interrupt configuration

The GPIO driver provides an interface to configure, enable, and trigger interrupts to read and clear the interrupt status. Before any GPIO interrupt is received, it’s configured and enabled at both the generic interrupt controller (GIC) and the top-level mode multiplexer (TLMM) hardware. The interrupt at GIC is enabled during the TLMM driver initialization as it’s not a GPIO-specific.

Direct connect

The direct connect is designed to provide a low-latency interrupt to processors that are running at higher frequencies.

GPIO interrupt configuration APIs

When necessary, clients calling uGPIOSummaryInt_EnableInterrupt enable the interrupt at TLMM. The interrupt is first configured and then registered using the uGPIOSummaryInt_RegisterInterrupt functions.

uGPIOSummaryInt_ConfigureInterrupt()

It allows clients to set the interrupt trigger on the specified GPIO pin. The trigger is one of the following: GPIO summery interrupt trigger types
  • Prototype: static void uGPIOSummaryInt_ConfigureInterrupt(int nGPIO, int nTrigger, int nRawStatusEn, int nTargetProc);
  • Parameters:
  • Returns: None

uGPIOSummaryInt_RegisterInterrupt()

It registers a GPIO interrupt at TLMM.
  • Prototype: int uGPIOSummaryInt_RegisterInterrupt( uint32 nGPIO, uGPIOIntTriggerType eTrigger, uGPIOINTISR isr, uGPIOINTISRCtx param);
  • Parameters:
  • Returns:
    • UGPIOINT_SUCCESS (0) - If the ISR registration is successful, this value is returned.
    • UGPIOINT_ERROR (-1) - An Error if the uGPIOInt driver isn’t able to register the interrupt service routine (ISR).

uGPIOSummaryInt_EnableInterrupt()

It enables the interrupt at the interrupt controller for a specific GPIO.
  • Prototype: int uGPIOSummaryInt_EnableInterrupt( uint32 nGPIO);
  • Parameters:
  • Returns:
    • UGPIOINT_SUCCESS (0) - If the ISR registration is successful, this value is returned.
    • UGPIOINT_ERROR (-1) - An Error if the uGPIOInt driver isn’t able to register the interrupt service routine (ISR).

uGPIOSummaryInt_DisableInterrupt()

It disables the interrupt at the interrupt controller for a specific GPIO.
  • Prototype: int uGPIOSummaryInt_DisableInterrupt( uint32 nGPIO);
  • Parameters:
  • Returns:
    • UGPIOINT_SUCCESS (0) - If the ISR registration is successful, this value is returned.
    • UGPIOINT_ERROR (-1) - An Error if the uGPIOInt driver wasn’t able to register the interrupt service routine (ISR).

Verify GPIO driver

For information about verifying the GPIO driver, see gpio.