1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 * Description: Provides V150 HAL GPIO common info definition header. \n 16 * 17 * History: \n 18 * 2023-06-01, Create file. \n 19 */ 20 21 #ifndef HAL_GPIO_V150_COMM_DEF_H 22 #define HAL_GPIO_V150_COMM_DEF_H 23 24 #include <stdint.h> 25 #include "common_def.h" 26 27 #ifdef __cplusplus 28 #if __cplusplus 29 extern "C" { 30 #endif /* __cplusplus */ 31 #endif /* __cplusplus */ 32 33 /** 34 * @defgroup drivers_hal_gpio_v150_comm_def GPIO V150 Common Info Definition 35 * @ingroup drivers_hal_gpio 36 * @{ 37 */ 38 39 /** 40 * @brief GPIO group context definition. 41 */ 42 typedef struct hal_gpio_group_context { 43 uint32_t cb_registered; /*!< Indicates whether callback is registered for each GPIO in the group. */ 44 } hal_gpio_group_context_t; 45 46 /** 47 * @brief GPIO group info definition. 48 */ 49 typedef struct hal_gpio_group_info { 50 uint32_t start_pin_id; /*!< The start ID of GPIO in this group. */ 51 uint32_t pin_num; /*!< GPIO number in this group. */ 52 uint32_t start_callback_id; /*!< The start ID of GPIO callback in g_hal_gpio_callback_list. */ 53 } hal_gpio_group_info_t; 54 55 /** 56 * @brief GPIO channel info definition. 57 */ 58 typedef struct hal_gpio_channel_info { 59 uint32_t start_pin_id; /*!< The start ID of GPIO in this channel. */ 60 uint32_t pin_num; /*!< GPIO number in this channel. */ 61 uint32_t group_num; /*!< GPIO group number in this channel. */ 62 uint32_t irq_num; /*!< IRQ number of this GPIO channel. */ 63 uintptr_t base_addr; /*!< Register base addr of this GPIO channel. */ 64 hal_gpio_group_info_t *group_list; /*!< GPIO group info list. See @ref hal_gpio_group_info_t */ 65 } hal_gpio_channel_info_t; 66 67 /** 68 * @} 69 */ 70 71 #ifdef __cplusplus 72 #if __cplusplus 73 } 74 #endif /* __cplusplus */ 75 #endif /* __cplusplus */ 76 77 #endif 78