InPlay API
Platform gpio configuration

HAL_GPIO. More...

Functions

void hal_gpio_init (void)
 Initialize GPIO port values. More...
 
void hal_gpio_pin_cfg (uint32_t pin_cfg)
 Config GPIO from the user's configuration settings . More...
 
void hal_gpio_pin_dft (uint32_t pin_cfg)
 Restore GPIO pin to its default state. More...
 
int hal_gpio_pin_mux (int port, int pin, int mux)
 Config GPIO pin mux. More...
 
int hal_gpio_pad_oe_ie (int port, int pin, int oe, int ie)
 Config GPIO PAD as output or input. More...
 
int hal_gpio_pad_pd_pu (int port, int pin, int pd, int pu)
 Config GPIO PAD as pull up or pull down. More...
 
int hal_gpio_sleep_pad_mask (int port, int pin, int mask)
 Enable GPIO pad input during deep sleep. More...
 
int hal_gpio_sleep_wup_mask (int port, int pin, int mask)
 Config GPIO pin as wake up pin during deep sleep. More...
 
int hal_gpio_sleep_wup_polarity (int port, int pin, int pol)
 Change wake up GPIO pin polarity. More...
 
int hal_gpio_sleep_wup_edge (int port, int pin, int rise, int fall)
 Wake up GPIO edge selection. More...
 
int hal_gpio_sleep_wup_edge_clear_manual (int port, int pin)
 Manually clear wake up GPIO edge. More...
 
int hal_gpio_sleep_wup_edge_clear_auto (int port, int pin, int en)
 Clear the wake up GPIO edge automatically. More...
 
int hal_gpio_sleep_wup_edge_detect (int port, int pin, int en)
 Detect the wake up GPIO edge. More...
 
int hal_gpio_sleep_wup_edge_latch (int port, int pin, int en)
 Latch the wake up GPIO edge. More...
 
void hal_gpio_suspend (void)
 GPIO pin configuration store before power down. More...
 
void hal_gpio_resume (void)
 GPIO pin configuration restore after power up. More...
 
int hal_gpio_cfg_output (int port, int pin)
 Config pin to GPIO output. More...
 
int hal_gpio_cfg_input (int port, int pin, int pull_cfg)
 Config pin to GPIO input. More...
 
int hal_gpio_output_status (int port, int pin)
 GPIO output status. : The status is only valid if the output is enabled. More...
 
int hal_gpio_input_status (int port, int pin)
 Get GPIO input value. More...
 
int hal_gpio_pad_pc (int port, int pin, int on)
 Config GPIO PAD drive strength. More...
 
int hal_gpio_output (int port, int pin, int high)
 Config GPIO output level. More...
 
int hal_gpio_pin_inv (int port, int pin, int inv)
 Config GPIO pin invert. More...
 
int hal_gpio_ext_int_prio (int port, int prio)
 Set GPIO interrupt polarity. One port only have one polarity. More...
 
int hal_gpio_ext_int_reg (int port, int pin, void *arg, void(*callback)(void *, int, int, int))
 Register external GPIO pin as interrupt. More...
 
int hal_gpio_ext_int_unreg (int port, int pin)
 Unregister external GPIO pin as interrupt. More...
 
int hal_gpio_ext_int_mask (int port, int pin, int rise, int fall, int wup)
 Mask GPIO pin interrupt. More...
 
int hal_gpio_ext_int_unmask (int port, int pin, int rise, int fall, int wup)
 Unmask GPIO pin interrupt. More...
 
int hal_gpio_cfg_wup_level (int port, int pin, int polarity)
 Config GPIO pin to level wake up. More...
 
int hal_gpio_cfg_wup_edge (int port, int pin, int rise, int fall)
 Config GPIO pin to edge wake up. More...
 
int hal_gpio_wup_dis (int port, int pin)
 Disable GPIO pin wake up. More...
 
int hal_gpio_sleep_pad_latch (int port, int pin, int latch, int manual)
 Enable GPIO pad during deep sleep. More...
 
int hal_gpio_sleep_output_grp_0 (int en, int port, int pin, int mux)
 Output always on domain (AON) signals thru GPIO mux. : The mux are divided into 4 group (see enum gpio_slp_grp_X_pin_mux) and different pins are assoicated with each group. More...
 
void hal_gpio_reset_chip (int idx, int en, int port, int pin, int fall, int deb)
 Reset chip's PD1 domain by exteranl GPIO rise/fall edge. : This can reset cpu and peripherals but not always on domain (AON) HW. More...
 
void hal_gpio_reset_arm (int en, int port, int pin, int fall, int deb, int sys_rst)
 Reset ARM CPU by exteranl GPIO rise/fall edge. : This can reset only cpu but not other HW. More...
 

Detailed Description

HAL_GPIO.

Function Documentation

◆ hal_gpio_cfg_input()

int hal_gpio_cfg_input ( int  port,
int  pin,
int  pull_cfg 
)

Config pin to GPIO input.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]pull_cfgPull up or down configuration,
See also
enum gpio_pull.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_cfg_output()

int hal_gpio_cfg_output ( int  port,
int  pin 
)

Config pin to GPIO output.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_cfg_wup_edge()

int hal_gpio_cfg_wup_edge ( int  port,
int  pin,
int  rise,
int  fall 
)

Config GPIO pin to edge wake up.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]rise1: rising; 0: otherwise
[in]fall1: falling; 0: otherwise
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_cfg_wup_level()

int hal_gpio_cfg_wup_level ( int  port,
int  pin,
int  polarity 
)

Config GPIO pin to level wake up.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]polarity1: high; 0: low
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_ext_int_mask()

int hal_gpio_ext_int_mask ( int  port,
int  pin,
int  rise,
int  fall,
int  wup 
)

Mask GPIO pin interrupt.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]rise1: rising edge; 0: otherwise
[in]fall1: falling edge; 0: otherwise
[in]wup1: wake up; 0: otherwise
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_ext_int_prio()

int hal_gpio_ext_int_prio ( int  port,
int  prio 
)

Set GPIO interrupt polarity. One port only have one polarity.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]prioGPIO interrupt priority,
See also
in_irq.h.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_ext_int_reg()

int hal_gpio_ext_int_reg ( int  port,
int  pin,
void *  arg,
void(*)(void *, int, int, int)  callback 
)

Register external GPIO pin as interrupt.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]argUser provided interrupt callback parameter
[in]callbackUser provided interrupt callback function
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_ext_int_unmask()

int hal_gpio_ext_int_unmask ( int  port,
int  pin,
int  rise,
int  fall,
int  wup 
)

Unmask GPIO pin interrupt.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]rise1: rising edge; 0: otherwise
[in]fall1: falling edge; 0: otherwise
[in]wup1: wake up; 0: otherwise
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_ext_int_unreg()

int hal_gpio_ext_int_unreg ( int  port,
int  pin 
)

Unregister external GPIO pin as interrupt.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_init()

void hal_gpio_init ( void  )

Initialize GPIO port values.

Returns
This function has no return.

◆ hal_gpio_input_status()

int hal_gpio_input_status ( int  port,
int  pin 
)

Get GPIO input value.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Returns
1 when GPIO is high, 0 when GPIO is low or has error.

◆ hal_gpio_output()

int hal_gpio_output ( int  port,
int  pin,
int  high 
)

Config GPIO output level.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]high1: HIGH output, 0: LOW output.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_output_status()

int hal_gpio_output_status ( int  port,
int  pin 
)

GPIO output status. : The status is only valid if the output is enabled.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Returns
1 when GPIO is high, 0 when GPIO is low or has error.

◆ hal_gpio_pad_oe_ie()

int hal_gpio_pad_oe_ie ( int  port,
int  pin,
int  oe,
int  ie 
)

Config GPIO PAD as output or input.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]oe1: Ouput enable, 0: otherwise.
[in]ie1: Input enable, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_pad_pc()

int hal_gpio_pad_pc ( int  port,
int  pin,
int  on 
)

Config GPIO PAD drive strength.

Note
There are two drive strength. Pick the one that is suitable.
Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]on1: Change it, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_pad_pd_pu()

int hal_gpio_pad_pd_pu ( int  port,
int  pin,
int  pd,
int  pu 
)

Config GPIO PAD as pull up or pull down.

Note
If neither pull up or down, then the pin is floating
Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]pd1: Pull down, 0: otherwise.
[in]pu1: Pull up, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_pin_cfg()

void hal_gpio_pin_cfg ( uint32_t  pin_cfg)

Config GPIO from the user's configuration settings .

Parameters
[in]pin_cfgPin configuration from the configuration tool.
Returns
This function has no return.

◆ hal_gpio_pin_dft()

void hal_gpio_pin_dft ( uint32_t  pin_cfg)

Restore GPIO pin to its default state.

Parameters
[in]pin_cfgPin configuration from the configuration tool.
Returns
This function has no return.

◆ hal_gpio_pin_inv()

int hal_gpio_pin_inv ( int  port,
int  pin,
int  inv 
)

Config GPIO pin invert.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]invInvert pin, 1: inverted, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_pin_mux()

int hal_gpio_pin_mux ( int  port,
int  pin,
int  mux 
)

Config GPIO pin mux.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]muxMux number,
See also
enum gpio_mux.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_reset_arm()

void hal_gpio_reset_arm ( int  en,
int  port,
int  pin,
int  fall,
int  deb,
int  sys_rst 
)

Reset ARM CPU by exteranl GPIO rise/fall edge. : This can reset only cpu but not other HW.

Parameters
[in]en1: Enable, 0: otherwise
[in]portPort number
[in]pinPin number
[in]fall1: falling edge, 0: otherwise
[in]debDebounce limit; from 0 ~255.
[in]sys_rst1: Arm's Debug core is not reset, 0: otherwise.
Returns
This function has no return

◆ hal_gpio_reset_chip()

void hal_gpio_reset_chip ( int  idx,
int  en,
int  port,
int  pin,
int  fall,
int  deb 
)

Reset chip's PD1 domain by exteranl GPIO rise/fall edge. : This can reset cpu and peripherals but not always on domain (AON) HW.

Parameters
[in]idxFrom 0~2; At most 3 gpio pin can be used to reset the chip.
[in]en1: Enable, 0: otherwise
[in]portPort number
[in]pinPin number
[in]fall1: falling edge, 0: otherwise
[in]debDebounce limit; from 0 ~255.
Returns
This function has no return

◆ hal_gpio_resume()

void hal_gpio_resume ( void  )

GPIO pin configuration restore after power up.

Returns
This function has no return.

◆ hal_gpio_sleep_output_grp_0()

int hal_gpio_sleep_output_grp_0 ( int  en,
int  port,
int  pin,
int  mux 
)

Output always on domain (AON) signals thru GPIO mux. : The mux are divided into 4 group (see enum gpio_slp_grp_X_pin_mux) and different pins are assoicated with each group.

Parameters
[in]en1: output enable, 0: otherwise
[in]portPort number,
See also
enum gpio_slp_grp_X_port
Parameters
[in]pinPin number,
See also
enum gpio_slp_grp_X_port_X_pins
Parameters
[in]muxPin mux,
See also
enum gpio_slp_grp_X_pin_mux
Returns
GPIO_ERR_NO_ERROR if successful, otherwise failed.
See also
enum gpio_err.

◆ hal_gpio_sleep_pad_latch()

int hal_gpio_sleep_pad_latch ( int  port,
int  pin,
int  latch,
int  manual 
)

Enable GPIO pad during deep sleep.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]latch1: latch, 0: otherwise
[in]manual1: latch clear by user, 0: auto clear after wake up
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_sleep_pad_mask()

int hal_gpio_sleep_pad_mask ( int  port,
int  pin,
int  mask 
)

Enable GPIO pad input during deep sleep.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]mask1: mask input, 0: otherwise
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_sleep_wup_edge()

int hal_gpio_sleep_wup_edge ( int  port,
int  pin,
int  rise,
int  fall 
)

Wake up GPIO edge selection.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]rise1: Rising edge, 0: otherwise.
[in]fall1: Falling edge, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_sleep_wup_edge_clear_auto()

int hal_gpio_sleep_wup_edge_clear_auto ( int  port,
int  pin,
int  en 
)

Clear the wake up GPIO edge automatically.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]en1: Enable, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_sleep_wup_edge_clear_manual()

int hal_gpio_sleep_wup_edge_clear_manual ( int  port,
int  pin 
)

Manually clear wake up GPIO edge.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_sleep_wup_edge_detect()

int hal_gpio_sleep_wup_edge_detect ( int  port,
int  pin,
int  en 
)

Detect the wake up GPIO edge.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]en1: Enable, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_sleep_wup_edge_latch()

int hal_gpio_sleep_wup_edge_latch ( int  port,
int  pin,
int  en 
)

Latch the wake up GPIO edge.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]en1: Enable, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_sleep_wup_mask()

int hal_gpio_sleep_wup_mask ( int  port,
int  pin,
int  mask 
)

Config GPIO pin as wake up pin during deep sleep.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]mask1: mask, 0: unmask
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_sleep_wup_polarity()

int hal_gpio_sleep_wup_polarity ( int  port,
int  pin,
int  pol 
)

Change wake up GPIO pin polarity.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Parameters
[in]pol1: Pin level high as wake up, 0: otherwise.
Returns
See also
enum gpio_err for the possible return code.

◆ hal_gpio_suspend()

void hal_gpio_suspend ( void  )

GPIO pin configuration store before power down.

Returns
This function has no return.

◆ hal_gpio_wup_dis()

int hal_gpio_wup_dis ( int  port,
int  pin 
)

Disable GPIO pin wake up.

Parameters
[in]portPort number,
See also
enum gpio_port.
Parameters
[in]pinPin number,
See also
enum gpio_pin.
Returns
See also
enum gpio_err for the possible return code.