Intel® Quark™ Microcontroller Software Interface  1.4.0
Intel® Quark™ Microcontroller BSP
SS GPIO

General Purpose IO for Sensor Subsystem. More...

Data Structures

struct  qm_ss_gpio_port_config_t
 SS GPIO port configuration type. More...
 

Enumerations

enum  qm_ss_gpio_state_t { QM_SS_GPIO_LOW = 0, QM_SS_GPIO_HIGH, QM_SS_GPIO_STATE_NUM }
 GPIO SS pin states. More...
 

Functions

int qm_ss_gpio_set_config (const qm_ss_gpio_t gpio, const qm_ss_gpio_port_config_t *const cfg)
 Set SS GPIO port configuration. More...
 
int qm_ss_gpio_read_pin (const qm_ss_gpio_t gpio, const uint8_t pin, qm_ss_gpio_state_t *const state)
 Read the current value of a single pin on a given SS GPIO port. More...
 
int qm_ss_gpio_set_pin (const qm_ss_gpio_t gpio, const uint8_t pin)
 Set a single pin on a given SS GPIO port. More...
 
int qm_ss_gpio_clear_pin (const qm_ss_gpio_t gpio, const uint8_t pin)
 Clear a single pin on a given SS GPIO port. More...
 
int qm_ss_gpio_set_pin_state (const qm_ss_gpio_t gpio, const uint8_t pin, const qm_ss_gpio_state_t state)
 Set or clear a single SS GPIO pin using a state variable. More...
 
int qm_ss_gpio_read_port (const qm_ss_gpio_t gpio, uint32_t *const port)
 Get SS GPIO port values. More...
 
int qm_ss_gpio_write_port (const qm_ss_gpio_t gpio, const uint32_t val)
 Get SS GPIO port values. More...
 
int qm_ss_gpio_save_context (const qm_ss_gpio_t gpio, qm_ss_gpio_context_t *const ctx)
 Save SS GPIO context. More...
 
int qm_ss_gpio_restore_context (const qm_ss_gpio_t gpio, const qm_ss_gpio_context_t *const ctx)
 Restore SS GPIO context. More...
 

Detailed Description

General Purpose IO for Sensor Subsystem.

Enumeration Type Documentation

GPIO SS pin states.

Enumerator
QM_SS_GPIO_LOW 

Pin level high.

QM_SS_GPIO_HIGH 

Pin level low.

QM_SS_GPIO_STATE_NUM 

Number of states.

Definition at line 21 of file qm_ss_gpio.h.

Function Documentation

int qm_ss_gpio_clear_pin ( const qm_ss_gpio_t  gpio,
const uint8_t  pin 
)

Clear a single pin on a given SS GPIO port.

Parameters
[in]gpioSS GPIO port index.
[in]pinPin of SS GPIO port to clear.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 111 of file qm_ss_gpio.c.

int qm_ss_gpio_read_pin ( const qm_ss_gpio_t  gpio,
const uint8_t  pin,
qm_ss_gpio_state_t *const  state 
)

Read the current value of a single pin on a given SS GPIO port.

Parameters
[in]gpioSS GPIO port index.
[in]pinPin of SS GPIO port to read.
[out]stateQM_GPIO_LOW for low or QM_GPIO_HIGH for high. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 84 of file qm_ss_gpio.c.

int qm_ss_gpio_read_port ( const qm_ss_gpio_t  gpio,
uint32_t *const  port 
)

Get SS GPIO port values.

Read entire SS GPIO port. Each bit of the val parameter is set to the current value of each pin on the port. Maximum 32 pins per port.

Parameters
[in]gpioSS GPIO port index.
[out]portValue of all pins on GPIO port. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 138 of file qm_ss_gpio.c.

int qm_ss_gpio_restore_context ( const qm_ss_gpio_t  gpio,
const qm_ss_gpio_context_t *const  ctx 
)

Restore SS GPIO context.

Restore the configuration of the specified GPIO peripheral after exiting sleep.

Parameters
[in]gpioSS GPIO port index.
[in]ctxSS GPIO context structure. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 184 of file qm_ss_gpio.c.

References qm_ss_gpio_context_t::gpio_debounce, qm_ss_gpio_context_t::gpio_int_polarity, qm_ss_gpio_context_t::gpio_inten, qm_ss_gpio_context_t::gpio_intmask, qm_ss_gpio_context_t::gpio_inttype_level, qm_ss_gpio_context_t::gpio_ls_sync, qm_ss_gpio_context_t::gpio_swporta_ddr, and qm_ss_gpio_context_t::gpio_swporta_dr.

int qm_ss_gpio_save_context ( const qm_ss_gpio_t  gpio,
qm_ss_gpio_context_t *const  ctx 
)

Save SS GPIO context.

Save the configuration of the specified GPIO peripheral before entering sleep.

Parameters
[in]gpioSS GPIO port index.
[out]ctxSS GPIO context structure. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 158 of file qm_ss_gpio.c.

References qm_ss_gpio_context_t::gpio_debounce, qm_ss_gpio_context_t::gpio_int_polarity, qm_ss_gpio_context_t::gpio_inten, qm_ss_gpio_context_t::gpio_intmask, qm_ss_gpio_context_t::gpio_inttype_level, qm_ss_gpio_context_t::gpio_ls_sync, qm_ss_gpio_context_t::gpio_swporta_ddr, and qm_ss_gpio_context_t::gpio_swporta_dr.

int qm_ss_gpio_set_config ( const qm_ss_gpio_t  gpio,
const qm_ss_gpio_port_config_t *const  cfg 
)

Set SS GPIO port configuration.

This includes the direction of the pins, if interrupts are enabled or not, the level on which an interrupt is generated, the polarity of interrupts and if GPIO-debounce is enabled or not. If interrupts are enabled it also registers the user defined callback function.

Parameters
[in]gpioSS GPIO port index to configure.
[in]cfgNew configuration for SS GPIO port. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 37 of file qm_ss_gpio.c.

References qm_ss_gpio_port_config_t::callback, qm_ss_gpio_port_config_t::callback_data, qm_ss_gpio_port_config_t::direction, qm_ss_gpio_port_config_t::int_bothedge, qm_ss_gpio_port_config_t::int_debounce, qm_ss_gpio_port_config_t::int_en, qm_ss_gpio_port_config_t::int_polarity, and qm_ss_gpio_port_config_t::int_type.

int qm_ss_gpio_set_pin ( const qm_ss_gpio_t  gpio,
const uint8_t  pin 
)

Set a single pin on a given SS GPIO port.

Parameters
[in]gpioSS GPIO port index.
[in]pinPin of SS GPIO port to set.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 98 of file qm_ss_gpio.c.

int qm_ss_gpio_set_pin_state ( const qm_ss_gpio_t  gpio,
const uint8_t  pin,
const qm_ss_gpio_state_t  state 
)

Set or clear a single SS GPIO pin using a state variable.

Parameters
[in]gpioGPIO port index.
[in]pinPin of GPIO port to update.
[in]stateQM_GPIO_LOW for low or QM_GPIO_HIGH for high.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 124 of file qm_ss_gpio.c.

References QM_SS_GPIO_STATE_NUM.

int qm_ss_gpio_write_port ( const qm_ss_gpio_t  gpio,
const uint32_t  val 
)

Get SS GPIO port values.

Write entire SS GPIO port. Each pin on the SS GPIO port is set to the corresponding value set in the val parameter. Maximum 32 pins per port.

Parameters
[in]gpioSS GPIO port index.
[in]valValue of all pins on SS GPIO port.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 148 of file qm_ss_gpio.c.