coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio.c File Reference
#include <device/mmio.h>
#include <gpio.h>
Include dependency graph for gpio.c:

Go to the source code of this file.

Enumerations

enum  { GPIO_DIRECTION_IN = 0 , GPIO_DIRECTION_OUT = 1 }
 
enum  { GPIO_MODE = 0 }
 
enum  { MAX_EINT_REG_BITS = 32 }
 

Functions

static void pos_bit_calc (gpio_t gpio, u32 *pos, u32 *bit)
 
static void pos_bit_calc_for_mode (gpio_t gpio, u32 *pos, u32 *bit)
 
static s32 gpio_set_dir (gpio_t gpio, u32 dir)
 
void gpio_set_mode (gpio_t gpio, int mode)
 
int gpio_get (gpio_t gpio)
 
void gpio_set (gpio_t gpio, int output)
 
void gpio_input_pulldown (gpio_t gpio)
 
void gpio_input_pullup (gpio_t gpio)
 
void gpio_input (gpio_t gpio)
 
void gpio_output (gpio_t gpio, int value)
 
static void pos_bit_calc_for_eint (gpio_t gpio, u32 *pos, u32 *bit)
 
int gpio_eint_poll (gpio_t gpio)
 
void gpio_eint_configure (gpio_t gpio, enum gpio_irq_type type)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
GPIO_DIRECTION_IN 
GPIO_DIRECTION_OUT 

Definition at line 6 of file gpio.c.

◆ anonymous enum

anonymous enum
Enumerator
GPIO_MODE 

Definition at line 11 of file gpio.c.

◆ anonymous enum

anonymous enum
Enumerator
MAX_EINT_REG_BITS 

Definition at line 116 of file gpio.c.

Function Documentation

◆ gpio_eint_configure()

void gpio_eint_configure ( gpio_t  gpio,
enum gpio_irq_type  type 
)

◆ gpio_eint_poll()

int gpio_eint_poll ( gpio_t  gpio)

Definition at line 126 of file gpio.c.

References eint_regs::ack, mtk_eint, pos_bit_calc_for_eint(), read32(), eint_section::regs, eint_regs::sta, and write32().

Referenced by tis_plat_irq_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpio_get()

int gpio_get ( gpio_t  gpio)

Definition at line 56 of file gpio.c.

References gpio_regs::din, mtk_gpio, pos_bit_calc(), read32(), and val_regs::val.

Here is the call graph for this function:

◆ gpio_input()

void gpio_input ( gpio_t  gpio)

Definition at line 101 of file gpio.c.

References GPIO_DIRECTION_IN, GPIO_MODE, GPIO_PULL_DISABLE, GPIO_PULL_DOWN, gpio_set_dir(), gpio_set_mode(), and gpio_set_pull().

Here is the call graph for this function:

◆ gpio_input_pulldown()

void gpio_input_pulldown ( gpio_t  gpio)

Definition at line 87 of file gpio.c.

References GPIO_DIRECTION_IN, GPIO_MODE, GPIO_PULL_DOWN, GPIO_PULL_ENABLE, gpio_set_dir(), gpio_set_mode(), and gpio_set_pull().

Here is the call graph for this function:

◆ gpio_input_pullup()

void gpio_input_pullup ( gpio_t  gpio)

Definition at line 94 of file gpio.c.

References GPIO_DIRECTION_IN, GPIO_MODE, GPIO_PULL_ENABLE, GPIO_PULL_UP, gpio_set_dir(), gpio_set_mode(), and gpio_set_pull().

Here is the call graph for this function:

◆ gpio_output()

void gpio_output ( gpio_t  gpio,
int  value 
)

Definition at line 108 of file gpio.c.

References GPIO_DIRECTION_OUT, GPIO_MODE, GPIO_PULL_DISABLE, GPIO_PULL_DOWN, gpio_set(), gpio_set_dir(), gpio_set_mode(), gpio_set_pull(), and value.

Here is the call graph for this function:

◆ gpio_set()

void gpio_set ( gpio_t  gpio,
int  output 
)

Definition at line 71 of file gpio.c.

References gpio_regs::dout, mtk_gpio, pos_bit_calc(), val_regs::rst, val_regs::set, and write32().

Here is the call graph for this function:

◆ gpio_set_dir()

static s32 gpio_set_dir ( gpio_t  gpio,
u32  dir 
)
static

Definition at line 27 of file gpio.c.

References gpio_regs::dir, GPIO_DIRECTION_IN, mtk_gpio, pos_bit_calc(), val_regs::rst, val_regs::set, and write32().

Referenced by gpio_input(), gpio_input_pulldown(), gpio_input_pullup(), and gpio_output().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gpio_set_mode()

◆ pos_bit_calc()

static void pos_bit_calc ( gpio_t  gpio,
u32 pos,
u32 bit 
)
static

Definition at line 15 of file gpio.c.

References MAX_GPIO_REG_BITS.

Referenced by gpio_get(), gpio_set(), and gpio_set_dir().

Here is the caller graph for this function:

◆ pos_bit_calc_for_eint()

static void pos_bit_calc_for_eint ( gpio_t  gpio,
u32 pos,
u32 bit 
)
static

Definition at line 120 of file gpio.c.

References MAX_EINT_REG_BITS.

Referenced by gpio_eint_configure(), and gpio_eint_poll().

Here is the caller graph for this function:

◆ pos_bit_calc_for_mode()

static void pos_bit_calc_for_mode ( gpio_t  gpio,
u32 pos,
u32 bit 
)
static

Definition at line 21 of file gpio.c.

References GPIO_MODE_BITS, and MAX_GPIO_MODE_PER_REG.

Referenced by gpio_set_mode().

Here is the caller graph for this function: