PDK API Guide for J721E
GPIO CSL-FL

Introduction

Sub Modules

 GPIO AUX
 

Files

file  gpio.h
 File provides functional level API prototypes for GPIO interface.
 

Data Structures

struct  gpioContext_t
 Structure holding the GPIO context. More...
 

Functions

void GPIOSetDirMode_v0 (uint32_t baseAddr, uint32_t pinNumber, uint32_t pinDirection)
 This API configures the direction of a specified GPIO pin as being either input or output. More...
 
void GPIOPinWrite_v0 (uint32_t baseAddr, uint32_t pinNumber, uint32_t pinValue)
 This API drives an output GPIO pin to a logic HIGH or a logic LOW state. More...
 
uint32_t GPIOPinRead_v0 (uint32_t baseAddr, uint32_t pinNumber)
 This API determines the logic level(value) on a specified GPIO pin. More...
 
uint32_t GPIOPinOutValueRead_v0 (uint32_t baseAddr, uint32_t pinNumber)
 This API determines the output logic level(value) on a specified GPIO pin. More...
 
void GPIOSetIntrType_v0 (uint32_t baseAddr, uint32_t pinNumber, uint32_t eventType)
 This API configures the event type for a specified input GPIO pin. Whenever the selected event occurs on that GPIO pin and if interrupt generation is enabled for that pin, the GPIO module will send an interrupt to CPU. More...
 
void GPIOIntrEnable_v0 (uint32_t baseAddr, uint32_t pinNumber, uint32_t eventType)
 This API enables the configured interrupt event on a specified input GPIO pin to trigger an interrupt request. More...
 
void GPIOIntrDisable_v0 (uint32_t baseAddr, uint32_t pinNumber)
 This API disables interrupt generation due to the detection of any event on a specified input GPIO pin. More...
 
uint32_t GPIOIntrStatus_v0 (uint32_t baseAddr, uint32_t pinNumber)
 This API determines the enabled interrupt status of a specified pin. More...
 
void GPIOIntrStatusMask_v0 (uint32_t baseAddr, uint32_t bankIdx, uint32_t *intrStatusMask)
 This API determines the enabled interrupt status of a specified pin. More...
 
void GPIOIntrClear_v0 (uint32_t baseAddr, uint32_t pinNumber)
 This API clears the enabled interrupt status of a specified GPIO pin. More...
 
void GPIOIntrClearMask_v0 (uint32_t baseAddr, uint32_t bankIdx, uint32_t pinMask)
 This API clears the enabled interrupt status of specified GPIO pins. More...
 

Macros

#define GPIO_PIN_LOW   (0x0U)
 GPIO pin is at logic low. More...
 
#define GPIO_PIN_HIGH   (0x1U)
 GPIO pin is at logic high. More...
 
#define GPIO_OE_OUTPUTEN_N_ENABLED   (0U)
 Macro to configure GPIO pin as output. More...
 
#define GPIO_OE_OUTPUTEN_N_DISABLED   (1U)
 Macro to configure GPIO pin as input. More...
 
#define GPIO_PIN_MASK_ALL   0xFF
 Mask for all pins of single gpio port. More...
 

GPIO Interrupt mask

typedef uint32_t gpioIntrMask_t
 Enumerates the possible GPIO interrupt generation events. More...
 
#define GPIO_INTR_MASK_NO_EDGE   (0x01U)
 
#define GPIO_INTR_MASK_RISE_EDGE   (0x02U)
 
#define GPIO_INTR_MASK_FALL_EDGE   (0x04U)
 
#define GPIO_INTR_MASK_BOTH_EDGE   (0x08U)
 

GPIO Direction

typedef uint32_t gpioDirection_t
 Enumerates the direction of GPIO pin. More...
 
#define GPIO_DIRECTION_INPUT   (GPIO_OE_OUTPUTEN_N_DISABLED)
 
#define GPIO_DIRECTION_OUTPUT   (GPIO_OE_OUTPUTEN_N_ENABLED)
 

Macro Definition Documentation

◆ GPIO_PIN_LOW

#define GPIO_PIN_LOW   (0x0U)

GPIO pin is at logic low.

◆ GPIO_PIN_HIGH

#define GPIO_PIN_HIGH   (0x1U)

GPIO pin is at logic high.

◆ GPIO_OE_OUTPUTEN_N_ENABLED

#define GPIO_OE_OUTPUTEN_N_ENABLED   (0U)

Macro to configure GPIO pin as output.

◆ GPIO_OE_OUTPUTEN_N_DISABLED

#define GPIO_OE_OUTPUTEN_N_DISABLED   (1U)

Macro to configure GPIO pin as input.

◆ GPIO_PIN_MASK_ALL

#define GPIO_PIN_MASK_ALL   0xFF

Mask for all pins of single gpio port.

◆ GPIO_INTR_MASK_NO_EDGE

#define GPIO_INTR_MASK_NO_EDGE   (0x01U)

No interrupt request on either rising or falling edges on the pin.

◆ GPIO_INTR_MASK_RISE_EDGE

#define GPIO_INTR_MASK_RISE_EDGE   (0x02U)

Interrupt request on occurrence of a rising edge on the input GPIO pin.

◆ GPIO_INTR_MASK_FALL_EDGE

#define GPIO_INTR_MASK_FALL_EDGE   (0x04U)

Interrupt request on occurrence of a falling edge on the input GPIO pin.

◆ GPIO_INTR_MASK_BOTH_EDGE

#define GPIO_INTR_MASK_BOTH_EDGE   (0x08U)

Interrupt request on occurrence of both a rising and a falling edge on the pin.

◆ GPIO_DIRECTION_INPUT

#define GPIO_DIRECTION_INPUT   (GPIO_OE_OUTPUTEN_N_DISABLED)

Input pin.

◆ GPIO_DIRECTION_OUTPUT

#define GPIO_DIRECTION_OUTPUT   (GPIO_OE_OUTPUTEN_N_ENABLED)

Output pin.

Typedef Documentation

◆ gpioIntrMask_t

typedef uint32_t gpioIntrMask_t

Enumerates the possible GPIO interrupt generation events.

◆ gpioDirection_t

typedef uint32_t gpioDirection_t

Enumerates the direction of GPIO pin.

Function Documentation

◆ GPIOSetDirMode_v0()

void GPIOSetDirMode_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber,
uint32_t  pinDirection 
)

This API configures the direction of a specified GPIO pin as being either input or output.

Parameters
baseAddrThe memory address of the GPIO instance being used.
pinNumberThe number of the pin in the GPIO instance. 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63).
pinDirectionThe required direction for the GPIO pin. pinDirection' can take one of the value from the following enum:

◆ GPIOPinWrite_v0()

void GPIOPinWrite_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber,
uint32_t  pinValue 
)

This API drives an output GPIO pin to a logic HIGH or a logic LOW state.

Parameters
baseAddrThe memory address of the GPIO instance being used
pinNumberThe number of the pin in the GPIO instance 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63).
pinValueThis specifies whether a logic HIGH or a logic LOW should be driven on the output pin. 'pinValue' can take one of the following values:
  • GPIO_PIN_LOW - indicating to drive a logic LOW(0) on the pin.
  • GPIO_PIN_HIGH - indicating to drive a logic HIGH(1) on the pin.

◆ GPIOPinRead_v0()

uint32_t GPIOPinRead_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber 
)

This API determines the logic level(value) on a specified GPIO pin.

Parameters
baseAddrThe memory address of the GPIO instance being used
pinNumberThe number of the pin in the GPIO instance 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63)
Return values
GPIO_PIN_LOW- indicating to drive a logic LOW(0) on the pin.
GPIO_PIN_HIGH- indicating to drive a logic HIGH(1) on the pin.

◆ GPIOPinOutValueRead_v0()

uint32_t GPIOPinOutValueRead_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber 
)

This API determines the output logic level(value) on a specified GPIO pin.

Parameters
baseAddrThe memory address of the GPIO instance being used
pinNumberThe number of the pin in the GPIO instance 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63)
Return values
GPIO_PIN_LOW- indicating to drive a logic LOW(0) on the pin.
GPIO_PIN_HIGH- indicating to drive a logic HIGH(1) on the pin.

◆ GPIOSetIntrType_v0()

void GPIOSetIntrType_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber,
uint32_t  eventType 
)

This API configures the event type for a specified input GPIO pin. Whenever the selected event occurs on that GPIO pin and if interrupt generation is enabled for that pin, the GPIO module will send an interrupt to CPU.

Parameters
baseAddrThe memory address of the GPIO instance being used
pinNumberThe number of the pin in the GPIO instance 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63).
eventTypeThis specifies the event type on whose detection, the GPIO module will send an interrupt to CPU, provided interrupt generation for that pin is enabled. 'eventType' can take one of the following values following enum:
  • gpioIntrMask_t.
Note
A typical use case of this API is explained below: If it is initially required that interrupt should be generated on a LOW level only, then this API can be called with GPIO_INTR_MASK_LEVEL_LOW as the parameter. At a later point of time, if logic HIGH level only should be made as the interrupt generating event, then this API has to be first called with GPIO_INTR_MASK_NO_LEVEL as the parameter and later with GPIO_INTR_MASK_LEVEL_HIGH as the parameter. Doing this ensures that logic LOW level trigger for interrupts is disabled.

◆ GPIOIntrEnable_v0()

void GPIOIntrEnable_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber,
uint32_t  eventType 
)

This API enables the configured interrupt event on a specified input GPIO pin to trigger an interrupt request.

Parameters
baseAddrThe memory address of the GPIO instance being used
pinNumberThe number of the pin in the GPIO instance 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63)
eventTypeThis specifies the event type on whose detection, the GPIO module will send an interrupt to CPU, provided interrupt generation for that pin is enabled. 'eventType' can take one of the following values following enum:
  • gpioIntrMask_t.

◆ GPIOIntrDisable_v0()

void GPIOIntrDisable_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber 
)

This API disables interrupt generation due to the detection of any event on a specified input GPIO pin.

Parameters
baseAddrThe memory address of the GPIO instance being used
pinNumberThe number of the pin in the GPIO instance 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63)

◆ GPIOIntrStatus_v0()

uint32_t GPIOIntrStatus_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber 
)

This API determines the enabled interrupt status of a specified pin.

Parameters
baseAddrThe memory address of the GPIO instance being used
pinNumberThe number of the pin in the GPIO instance 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63)
Return values
int_statusThe enabled interrupt status of the pin on the specified interrupt line. This could either be a non-zero or a zero value.

◆ GPIOIntrStatusMask_v0()

void GPIOIntrStatusMask_v0 ( uint32_t  baseAddr,
uint32_t  bankIdx,
uint32_t *  intrStatusMask 
)

This API determines the enabled interrupt status of a specified pin.

Parameters
baseAddrThe memory address of the GPIO instance being used
bankIdxBank index of the GPIO instance
intrStatusMaskpointer of the interrupt status for the GPIO bank

◆ GPIOIntrClear_v0()

void GPIOIntrClear_v0 ( uint32_t  baseAddr,
uint32_t  pinNumber 
)

This API clears the enabled interrupt status of a specified GPIO pin.

Parameters
baseAddrThe memory address of the GPIO instance being used
pinNumberThe number of the pin in the GPIO instance 'pinNumber' can take one of the following values: (0 <= pinNumber <= 63)

◆ GPIOIntrClearMask_v0()

void GPIOIntrClearMask_v0 ( uint32_t  baseAddr,
uint32_t  bankIdx,
uint32_t  pinMask 
)

This API clears the enabled interrupt status of specified GPIO pins.

Parameters
baseAddrThe memory address of the GPIO instance being used
bankIdxBank index of the GPIO instance
pinMaskMask of pins whose interrupts need to be cleared for the GPIO bank.