diff options
Diffstat (limited to 'FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/gpio.c')
-rw-r--r-- | FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/gpio.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/gpio.c b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/gpio.c new file mode 100644 index 000000000..02a6582c9 --- /dev/null +++ b/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/src/gpio.c @@ -0,0 +1,22 @@ +/* Copyright 2019 SiFive, Inc */ +/* SPDX-License-Identifier: Apache-2.0 */ + +#include <metal/machine.h> +#include <metal/gpio.h> + +extern inline int metal_gpio_disable_input(struct metal_gpio *gpio, int pin); +extern inline int metal_gpio_enable_output(struct metal_gpio *gpio, int pin); +extern inline int metal_gpio_set_pin(struct metal_gpio *, int pin, int value); +extern inline int metal_gpio_get_pin(struct metal_gpio *, int pin); +extern inline int metal_gpio_clear_pin(struct metal_gpio *, int pin); +extern inline int metal_gpio_toggle_pin(struct metal_gpio *, int pin); +extern inline int metal_gpio_enable_pinmux(struct metal_gpio *, int pin, int io_function); + +struct metal_gpio *metal_gpio_get_device(int device_num) +{ + if(device_num > __MEE_DT_MAX_GPIOS) { + return NULL; + } + + return (struct metal_gpio *) __metal_gpio_table[device_num]; +} |