coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
gpio_ftns.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <stdint.h>
6 #include "gpio_ftns.h"
7 
8 void configure_gpio(u8 gpio, u8 iomux_ftn, u8 setting)
9 {
10  u8 bdata;
11 
12  iomux_write8(gpio, iomux_ftn);
13 
14  bdata = gpio_100_read8(gpio);
15  bdata &= 0x07;
16  bdata |= setting; /* set direction and data value */
17  gpio_100_write8(gpio, bdata);
18 }
19 
21 {
22  return (gpio_100_read8(gpio) & GPIO_DATA_IN) ? 1 : 0;
23 }
24 
25 int get_spd_offset(void)
26 {
27  u8 spd_offset = read_gpio(GPIO_16);
28  return spd_offset;
29 }
static void gpio_100_write8(uint8_t reg, uint8_t value)
static uint8_t gpio_100_read8(uint8_t reg)
static void iomux_write8(uint8_t reg, uint8_t value)
void configure_gpio(u8 gpio, u8 iomux_ftn, u8 setting)
Definition: gpio_ftns.c:8
int get_spd_offset(void)
Definition: gpio_ftns.c:25
u8 read_gpio(u8 gpio)
Definition: gpio_ftns.c:20
#define GPIO_16
Definition: gpio_ftns.h:15
#define GPIO_DATA_IN
Definition: gpio_ftns.h:25
uint8_t u8
Definition: stdint.h:45
Definition: pinmux.c:36