1 /* 2 * Copyright 2021 QuickLogic 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 * SPDX-License-Identifier: Apache-2.0 17 */ 18 19 #ifndef HAL_INCLUDE_HAL_GPIO_H_ 20 #define HAL_INCLUDE_HAL_GPIO_H_ 21 22 typedef enum { 23 CLEAR, 24 SET, 25 TOGGLE 26 }efpgaio_enum_typedef; 27 28 typedef struct { 29 uint8_t mode; 30 uint32_t int_type; 31 uint8_t in_val; 32 uint8_t out_val; 33 uint32_t int_en; 34 uint32_t number; 35 }gpio_hal_typedef; 36 37 void hal_write_gpio(uint8_t gpio_num, uint8_t value); 38 void hal_set_gpio(uint8_t gpio_num); 39 void hal_clr_gpio(uint8_t gpio_num); 40 void hal_toggle_gpio(uint8_t gpio_num); 41 void hal_gpio_int_ack (uint8_t int_gpio_num); 42 void hal_set_gpio_num(uint8_t gpio_num); 43 void hal_read_gpio_status(gpio_hal_typedef *hgpio); 44 void hal_read_gpio_status_raw(uint8_t gpio_num, uint32_t* register_value); 45 void hal_set_gpio_mode(uint8_t gpio_num, uint8_t gpio_mode); 46 void hal_set_gpio_interrupt(uint8_t gpio_num, uint8_t interrupt_type, uint8_t interrupt_enable); 47 void hal_enable_gpio_interrupt(uint8_t gpio_num); 48 void hal_disable_gpio_interrupt(uint8_t gpio_num); 49 50 void hal_efpgaio_output(uint8_t gpio_num, efpgaio_enum_typedef value); 51 void hal_efpgaio_outen(uint8_t gpio_num, efpgaio_enum_typedef value); 52 void hal_efpgaio_event(uint8_t gpio_num); 53 void hal_efpgaio_status(gpio_hal_typedef *efpgaio); 54 55 #endif /* HAL_INCLUDE_HAL_GPIO_H_ */ 56