Infineon Logo AIROC BTSDK v4.6 - Documentation
 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups

Data Structures

struct  GpioRegistration
 

Typedefs

typedef struct GpioRegistration GpioRegistration
 

Enumerations

enum  { GPIO_NUM_PORTS = GPIO_NUMBER_OF_PORTS, GPIO_MAX_NUM_PINS_PER_PORT = GPIO_MAX_PINS_PER_PORT, GPIO_NUM_PINS = GPIO_NUMBER_OF_PINS }
 Defines a GPIO driver class. More...
 
enum  {
  GPIO_PIN_P0 = 0, GPIO_PIN_P1, GPIO_PIN_P2, GPIO_PIN_P3,
  GPIO_PIN_P4, GPIO_PIN_P5, GPIO_PIN_P6, GPIO_PIN_P7,
  GPIO_PIN_P8, GPIO_PIN_P9, GPIO_PIN_P10, GPIO_PIN_P11,
  GPIO_PIN_P12, GPIO_PIN_P13, GPIO_PIN_P14, GPIO_PIN_P15,
  GPIO_PIN_P16, GPIO_PIN_P17, GPIO_PIN_P18, GPIO_PIN_P19,
  GPIO_PIN_P20, GPIO_PIN_P21, GPIO_PIN_P22, GPIO_PIN_P23,
  GPIO_PIN_P24, GPIO_PIN_P25, GPIO_PIN_P26, GPIO_PIN_P27,
  GPIO_PIN_P28, GPIO_PIN_P29, GPIO_PIN_P30, GPIO_PIN_P31,
  GPIO_PIN_P32, GPIO_PIN_P33, GPIO_PIN_P34, GPIO_PIN_P35,
  GPIO_PIN_P36, GPIO_PIN_P37, GPIO_PIN_P38, GPIO_PIN_P39
}
 GPIO Logical pin numbers.
 
enum  {
  GPIO_EDGE_TRIGGER_MASK = 0x0001, GPIO_EDGE_TRIGGER = 0x0001, GPIO_LEVEL_TRIGGER = 0x0000, GPIO_TRIGGER_POLARITY_MASK = 0x0002,
  GPIO_TRIGGER_NEG = 0x0002, GPIO_DUAL_EDGE_TRIGGER_MASK = 0x0004, GPIO_EDGE_TRIGGER_BOTH = 0x0004, GPIO_EDGE_TRIGGER_SINGLE = 0x0000,
  GPIO_INTERRUPT_ENABLE_MASK = 0x0008, GPIO_INTERRUPT_ENABLE = 0x0008, GPIO_INTERRUPT_DISABLE = 0x0000, GPIO_EN_INT_MASK = GPIO_EDGE_TRIGGER_MASK | GPIO_TRIGGER_POLARITY_MASK | GPIO_DUAL_EDGE_TRIGGER_MASK | GPIO_INTERRUPT_ENABLE_MASK,
  GPIO_EN_INT_LEVEL_HIGH = GPIO_INTERRUPT_ENABLE | GPIO_LEVEL_TRIGGER, GPIO_EN_INT_LEVEL_LOW = GPIO_INTERRUPT_ENABLE | GPIO_LEVEL_TRIGGER | GPIO_TRIGGER_NEG, GPIO_EN_INT_RISING_EDGE = GPIO_INTERRUPT_ENABLE | GPIO_EDGE_TRIGGER, GPIO_EN_INT_FALLING_EDGE = GPIO_INTERRUPT_ENABLE | GPIO_EDGE_TRIGGER | GPIO_TRIGGER_NEG,
  GPIO_EN_INT_BOTH_EDGE = GPIO_INTERRUPT_ENABLE | GPIO_EDGE_TRIGGER | GPIO_EDGE_TRIGGER_BOTH, GPIO_INPUT_ENABLE = 0x0000, GPIO_OUTPUT_DISABLE = 0x0000, GPIO_OUTPUT_ENABLE = 0x4000,
  GPIO_KS_OUTPUT_ENABLE = 0x0010, GPIO_OUTPUT_FN_SEL_MASK = 0x0030, GPIO_OUTPUT_FN_SEL_SHIFT = 4, GPIO_GLOBAL_INPUT_ENABLE = 0x0000,
  GPIO_GLOBAL_INPUT_DISABLE = 0x0040, GPIO_PULL_UP_DOWN_NONE = 0x0000, GPIO_PULL_UP = 0x0400, GPIO_PULL_DOWN = 0x0200,
  GPIO_INPUT_DISABLE = 0x0600, GPIO_DRIVE_SEL_MASK = 0x0800, GPIO_DRIVE_SEL_LOWEST = 0x0000, GPIO_DRIVE_SEL_MIDDLE_0 = 0x0000,
  GPIO_DRIVE_SEL_MIDDLE_1 = 0x0800, GPIO_DRIVE_SEL_HIGHEST = 0x0800, GPIO_HYSTERESIS_MASK = 0x2000, GPIO_HYSTERESIS_ON = 0x2000,
  GPIO_HYSTERESIS_OFF = 0x0000
}
 The following enum defines the constant values for the GPIO driver. More...
 
enum  tGPIO_PIN_OUTPUT_CONFIG { GPIO_PIN_OUTPUT_LOW, GPIO_PIN_OUTPUT_HIGH }
 Pin output config.
 
enum  tGPIO_PIN_INPUT_VALUE { GPIO_PIN_INPUT_LOW, GPIO_PIN_INPUT_HIGH }
 Pin input values.
 

Functions

void gpio_init (void)
 
void gpio_configurePin (BYTE port, BYTE pin, UINT16 config, BYTE outputVal)
 ConfigurePin maps a GPIO pin to a config value.
 
void gpio_configurePinWithSingleBytePortPinNum (BYTE gpio, UINT16 config, BYTE outputVal)
 
void gpio_configureAll (void)
 Configures all GPIO pins according to the values from the configuration record.
 
UINT16 gpio_getPinConfig (BYTE port, BYTE pin)
 Retrieve the configuration of the specified pin.
 
void gpio_setPinOutput (BYTE port, BYTE pin, BYTE val)
 Set pin output for a specific pin.
 
void gpio_lhlInterrupt (void)
 
void gpio_registerForInterrupt (UINT16 masks[], void(*userfn)(void *, UINT8), void *userdata)
 
BOOL32 gpio_validatePortPin (BYTE port, BYTE pin)
 
BYTE gpio_getPinOutput (BYTE port, BYTE pin)
 Get the programmed output value of a pin. More...
 
BYTE gpio_getPinInput (BYTE port, BYTE pin)
 Read the current value at a pin. More...
 
BYTE gpio_getPinInterruptStatus (BYTE port, BYTE pin)
 Get the interrupt status of a pin.
 
void gpio_clearPinInterruptStatus (BYTE port, BYTE pin)
 Clear the interrupt status of a pin.
 
UINT16 gpio_getPortOutput (BYTE port)
 Get the programmed output value of a port. More...
 
void gpio_setPortOutput (BYTE port, UINT16 val)
 Set the output value of a port. More...
 
UINT16 gpio_getPortInput (BYTE port)
 Read the current value at a port. More...
 
UINT16 gpio_getPortInterruptStatus (BYTE port)
 Get the interrupt status of a port. More...
 
void gpio_clearPortInterruptStatus (BYTE port, UINT16 mask)
 Clear the interrupt status of multiple bits in a port. More...
 
void gpio_configurePortPins (BYTE port, BYTE startPin, BYTE endPin, UINT16 Config, BYTE outputVal)
 
void gpio_inputDisableAll (void)
 

Detailed Description

Enumeration Type Documentation

anonymous enum

Defines a GPIO driver class.

Applications use this driver to obtain the status from and control the behavior of the GPIO driver.GPIO port and pin number constraints expressed in values.

anonymous enum

The following enum defines the constant values for the GPIO driver.

The first twelve entries are the configuration masks for GPIO. A combination of them might be used together; for example a value INPUT_DISABLE_MASK|OUTPUT_ENABLE_MASK can be used to set a pin. The "configValue" of the struct "GpioConfigEntry" can be set using that value (the logical or of configuration options). Each of the pin can be configured in a specific way [using the value].

Enumerator
GPIO_EDGE_TRIGGER_MASK 

iocfg_p::_adr ;

= [0,1,2....37,38,39]

Each GPIO has a set of configuration signals in one register ;

iocfg_p::_adr[0] = "edge_trigger" GPIO configuration bit 0, Interrupt type defines Comments from User Guide: none

GPIO_TRIGGER_POLARITY_MASK 

iocfg_p::_adr[1] = "neg_edge" GPIO configuration bit 1, Interrupt polarity defines Comments from User Guide: none

GPIO_DUAL_EDGE_TRIGGER_MASK 

iocfg_p::_adr[2] = "dual_edge" GPIO configuration bit 2, single/dual edge defines Comments from User Guide: none

GPIO_INTERRUPT_ENABLE_MASK 

iocfg_p::_adr[3] = "interrupt_en" GPIO configuration bit 3, interrupt enable/disable defines Comments from User Guide: This bit is used to mask GPIO asynch wake up (to Baseband PMU) and synchronous interrupt status - gpio_int_st_px

GPIO_EN_INT_MASK 

iocfg_p::_adr[0:3] GPIO configuration bit 0:3, Summary of Interrupt enabling type

GPIO_INPUT_ENABLE 

iocfg_p::_adr[4:5] = "GPIO o/p buffer control" AND iocfg_p::_adr[14] = "o/p value multiplexing control" GPIO configuration bit 4:5,and 14 output enable control and muxing control Comments from the User Guide : none

GPIO_GLOBAL_INPUT_ENABLE 

iocfg_p::_adr[6] GPIO configuration bit 6, "Global_input_disable" Disable bit This bit when set to "1" , P0 input_disable signal will control ALL GPIOs.

Default value (after power up or a reset event) is "0".

GPIO_PULL_UP_DOWN_NONE 

iocfg_p::_adr[7] GPIO configuration bit 7, reserved

iocfg_p::_adr[8] GPIO configuration bit 8, reserved iocfg_p::_adr[10:9] = "pullup/pulldown" GPIO configuration bit 9 and bit 10, pull- up and pull-down enable Comments from the User Guide: default value is [0,0] , means no pull resistor.

GPIO_DRIVE_SEL_MASK 

iocfg_p::_adr[11] = GPIO configuration bit 11, iocfg_p0[11] controls the drive strength of the following GPIOs p[0:25], p[30:39]; iocfg_p26[11] controls the drive strength of the GPIOs p[26:29]

GPIO_HYSTERESIS_MASK 

iocfg_p::_adr[12] GPIO configuration bit 12, reserved

iocfg_p::_adr[13] = "Input Hysteresis" GPIO configuration bit 13, hysteresis control iocfg_p0[13] controls the hysteresis of the following GPIOs p[0:25], p[30:39]; iocfg_p26[13] controls the hysteresis of the GPIOs p[26:29]

Function Documentation

void gpio_clearPortInterruptStatus ( BYTE  port,
UINT16  mask 
)

Clear the interrupt status of multiple bits in a port.

The mask defines which interrupt bits are cleared. Only bits that are used for edge/level detection/interrupt should be cleared. Other bits should be left alone.

Parameters
port- port id(0-4). Must be in range or results are undefined.
mask- mask of which bits are cleared
BYTE gpio_getPinInput ( BYTE  port,
BYTE  pin 
)

Read the current value at a pin.

Note that for this to be valid, the pin must be configured with input enabled.

BYTE gpio_getPinOutput ( BYTE  port,
BYTE  pin 
)

Get the programmed output value of a pin.

Note that this does not return the current pin value. It returns the value that the pin would attempt to drive if it is configured as output.

UINT16 gpio_getPortInput ( BYTE  port)

Read the current value at a port.

For this to be valid, the pins must be configured with input enabled. Pins which are configured with input disabled will always return the same value (0 or 1) but the value is not specified.

Parameters
port- port id(0-1). Must be in range or results are undefined.
Returns
Port input value.
UINT16 gpio_getPortInterruptStatus ( BYTE  port)

Get the interrupt status of a port.

Pins which are not used for interrupts and do not have input disabled may report interrupts. Its the user's responsibility to mask out these bits.

Parameters
port- port id(0-4). Must be in range or results are undefined.
Returns
Interrupt status for the port.
UINT16 gpio_getPortOutput ( BYTE  port)

Get the programmed output value of a port.

Parameters
port- port id(0-4). Must be in range or results are undefined.
Returns
Returns the value that the pins on the port would attempt to drive if they are configured as outputs. It does not return the current port value.
void gpio_setPortOutput ( BYTE  port,
UINT16  val 
)

Set the output value of a port.

This only affects pins which are configured as outputs. Pins which are not outputs will still get the specified value written in the output register, but since they are not configured as utputs, the value will not be driven out on the pin.

Parameters
port- port id(0-3). Must be in range or results are undefined.
val- value to be set