AM263x MCU+ SDK  08.02.00
gpio/v0/gpio.h File Reference

Introduction

GPIO Driver API/interface file.

The GPIO pins are grouped into banks (16 pins per bank and 9 banks per GPIO instance). This means means that each GPIO module provides up to 144 dedicated general-purpose pins with input and output capabilities

Note: Not all GPIO pins and banks are present in a particular device. Refer device TRM for actual GPIO instances and pins supported

Go to the source code of this file.

Macros

#define GPIO_MAX_BANKS   (9U)
 Maximum number of banks per instance/module. More...
 
#define GPIO_MAX_PIN_PER_BANK   (16U)
 Maximum number of pins per bank. More...
 
#define GPIO_MAX_PIN_PER_INSTANCE   (GPIO_MAX_BANKS * GPIO_MAX_PIN_PER_BANK)
 Maximum number of pins per instance/module. More...
 
#define GPIO_BANKS_PER_REG   (2U)
 Number of banks per register. More...
 
#define GPIO_PINS_PER_REG   (GPIO_BANKS_PER_REG * GPIO_MAX_PIN_PER_BANK)
 Number of pins per register - 32 pins. More...
 
#define GPIO_PINS_PER_REG_SHIFT   (5U)
 Number of pins per register - shift value - used instead of divide operator. More...
 
#define GPIO_PINS_PER_BANK_SHIFT   (4U)
 Number of pins per bank - shift value - used instead of divide operator. More...
 
#define GPIO_GET_BANK_INDEX(pinNum)   (((uint32_t) pinNum) >> GPIO_PINS_PER_BANK_SHIFT)
 Returns the bank index based on pin number. More...
 
#define GPIO_GET_REG_INDEX(pinNum)   (((uint32_t) pinNum) >> GPIO_PINS_PER_REG_SHIFT)
 Returns the register index based on pin number. More...
 
#define GPIO_GET_BIT_POS(pinNum)   (pinNum - ((GPIO_GET_REG_INDEX(pinNum)) << GPIO_PINS_PER_REG_SHIFT))
 Returns the bit position within a register based on pin number. More...
 
#define GPIO_GET_BIT_MASK(pinNum)   (((uint32_t) 1U) << GPIO_GET_BIT_POS(pinNum))
 Returns the bit mask within a register based on pin number. More...
 
#define GPIO_GET_BANK_BIT_POS(pinNum)   (pinNum - ((GPIO_GET_BANK_INDEX(pinNum)) << GPIO_PINS_PER_BANK_SHIFT))
 Returns the bit position within a bank based on pin number. More...
 
#define GPIO_GET_BANK_BIT_MASK(pinNum)   (((uint32_t) 1U) << GPIO_GET_BANK_BIT_POS(pinNum))
 Returns the bit mask within a bank based on pin number. More...
 
GPIO Pin Value

#define GPIO_PIN_LOW   (0U)
 GPIO pin is at logic low. More...
 
#define GPIO_PIN_HIGH   (1U)
 GPIO pin is at logic high. More...
 
GPIO Direction

#define GPIO_DIRECTION_OUTPUT   (0U)
 
#define GPIO_DIRECTION_INPUT   (1U)
 
GPIO Trigger Type

#define GPIO_TRIG_TYPE_NONE   (0U)
 No interrupt request on either rising or falling edges on the pin. More...
 
#define GPIO_TRIG_TYPE_RISE_EDGE   (1U)
 Interrupt request on occurrence of a rising edge on the input pin. More...
 
#define GPIO_TRIG_TYPE_FALL_EDGE   (2U)
 Interrupt request on occurrence of a falling edge on the input pin. More...
 
#define GPIO_TRIG_TYPE_BOTH_EDGE   (3U)
 Interrupt request on occurrence of a rising/falling edge on the input pin. More...
 

Functions

void GPIO_setDirMode (uint32_t baseAddr, uint32_t pinNum, uint32_t pinDir)
 This API configures the direction of a specified GPIO pin as being either input or output. More...
 
static void GPIO_pinWriteHigh (uint32_t baseAddr, uint32_t pinNum)
 This API drives an output GPIO pin to a logic HIGH state. More...
 
static void GPIO_pinWriteLow (uint32_t baseAddr, uint32_t pinNum)
 This API drives an output GPIO pin to a logic LOW state. More...
 
uint32_t GPIO_pinRead (uint32_t baseAddr, uint32_t pinNum)
 This API reads the logic level(value) on a specified GPIO pin. More...
 
uint32_t GPIO_pinOutValueRead (uint32_t baseAddr, uint32_t pinNum)
 This API determines the output logic level(value) on a specified GPIO pin. More...
 
void GPIO_setTrigType (uint32_t baseAddr, uint32_t pinNum, uint32_t trigType)
 This API configures the trigger type for a specified input GPIO pin. More...
 
void GPIO_bankIntrEnable (uint32_t baseAddr, uint32_t bankNum)
 This API enables the bank interrupt. This has to be called after setting all the GPIO pin triggers of a bank to get interrupt. More...
 
void GPIO_bankIntrDisable (uint32_t baseAddr, uint32_t bankNum)
 This API disables the bank interrupt. More...
 
static uint32_t GPIO_getIntrStatus (uint32_t baseAddr, uint32_t pinNum)
 This API determines the enabled interrupt status of a specified pin. More...
 
static void GPIO_clearIntrStatus (uint32_t baseAddr, uint32_t pinNum)
 This API clears the enabled interrupt status of a specified GPIO pin. More...
 
static uint32_t GPIO_getBankIntrStatus (uint32_t baseAddr, uint32_t bankNum)
 This API returns the interrupt status of the specified bank. More...
 
static void GPIO_clearBankIntrStatus (uint32_t baseAddr, uint32_t bankNum, uint32_t intrStatus)
 This API clears the interrupt status of the specified bank. More...