OpenBIC
OpenSource Bridge-IC
hal_vw_gpio.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <drivers/espi.h>
18
19// Aspeed ESPI register definition
20#define AST_ESPI_BASE 0x7E6EE000
21#define AST_ESPI_SYSEVT 0x98
22#define AST_ESPI_GPIO_VAL 0x9C
23#define AST_ESPI_GPIO_DIR 0xC0
24
25#define VW_GPIO_ENABLE true
26#define VW_GPIO_DISABLE false
27
31};
32
37};
38
39typedef struct _vw_gpio_ {
40 uint8_t number;
42 uint8_t direction;
43 uint8_t value;
44 void (*int_cb)(uint8_t value);
46
47bool vw_gpio_get(int number, uint8_t *value);
48bool vw_gpio_set(int number, uint8_t value);
49void vw_gpio_reset(void);
50bool vw_gpio_init(vw_gpio *config, uint8_t size);
void vw_gpio_reset(void)
Definition: hal_vw_gpio.c:127
bool vw_gpio_init(vw_gpio *config, uint8_t size)
Definition: hal_vw_gpio.c:140
bool vw_gpio_get(int number, uint8_t *value)
Definition: hal_vw_gpio.c:29
vw_gpio_direction
Definition: hal_vw_gpio.h:28
@ VW_GPIO_INPUT
Definition: hal_vw_gpio.h:30
@ VW_GPIO_OUTPUT
Definition: hal_vw_gpio.h:29
vw_gpio_value
Definition: hal_vw_gpio.h:33
@ VW_GPIO_HIGH
Definition: hal_vw_gpio.h:35
@ VW_GPIO_UNKNOWN
Definition: hal_vw_gpio.h:36
@ VW_GPIO_LOW
Definition: hal_vw_gpio.h:34
struct _vw_gpio_ vw_gpio
bool vw_gpio_set(int number, uint8_t value)
Definition: hal_vw_gpio.c:44
uint16_t size
Definition: pldm_oem.h:0
Definition: hal_vw_gpio.h:39
void(* int_cb)(uint8_t value)
Definition: hal_vw_gpio.h:44
uint8_t number
Definition: hal_vw_gpio.h:40
uint8_t direction
Definition: hal_vw_gpio.h:42
uint8_t value
Definition: hal_vw_gpio.h:43
bool is_enabled
Definition: hal_vw_gpio.h:41