• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 V154 HAL adc \n
16  *
17  * History: \n
18  * 2024-02-01, Create file. \n
19  */
20 #ifndef HAL_ADC_V154_H
21 #define HAL_ADC_V154_H
22 
23 #include "hal_adc.h"
24 #include "hal_adc_v154_regs_op.h"
25 
26 #ifdef __cplusplus
27 #if __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30 #endif /* __cplusplus */
31 
32 /**
33  * @defgroup drivers_hal_adc_v154 ADC V154
34  * @ingroup  drivers_hal_adc
35  * @{
36  */
37 
38 /**
39  * @if Eng
40  * @brief  ADC type infomation.
41  * @else
42  * @brief  adc类型信息。
43  * @endif
44  */
45 typedef struct {
46     adc_channel_t channel;
47     hal_adc_channel_type_t channel_type;
48     uint32_t scan_fifo_start_addr;
49 } hal_adc_type_info_t;
50 
51 /**
52  * @if Eng
53  * @brief  Get the instance of v154.
54  * @return The instance of v154.
55  * @else
56  * @brief  获取v154实例。
57  * @return v154实例。
58  * @endif
59  */
60 hal_adc_funcs_t *hal_adc_v154_funcs_get(void);
61 
62 /**
63  * @if Eng
64  * @brief  Handler of the adc interrupt request.
65  * @else
66  * @brief  adc中断处理函数。
67  * @endif
68  */
69 void hal_adc_irq_handler(void);
70 
71 /**
72  * @if Eng
73  * @brief  ADC get channel config.
74  * @retval ADC type infomation. For details, see @ref hal_adc_type_info_t.
75  * @else
76  * @brief  adc获取通道配置。
77  * @retval adc类型信息 参考 @ref hal_adc_type_info_t 。
78  * @endif
79  */
80 hal_adc_type_info_t *adc_port_get_cfg(void);
81 
82 /**
83  * @if Eng
84  * @brief  ADC get channel config.
85  * @param  [in]  ch The adc channel.
86  * @param  [in]  on Set or clear of adc channel.
87  * @retval ERRCODE_SUCC Success.
88  * @retval Other        Failure. For details, see @ref errcode_t.
89  * @else
90  * @param  [in]  ch adc通道。
91  * @param  [in]  on 设置或清除通道。
92  * @retval ERRCODE_SUCC 成功。
93  * @retval Other        失败 参考 @ref errcode_t 。
94  * @endif
95  */
96 errcode_t hal_adc_v154_channel_set(adc_channel_t ch, bool on);
97 
98 /**
99  * @}
100  */
101 
102 #ifdef __cplusplus
103 #if __cplusplus
104 }
105 #endif /* __cplusplus */
106 #endif /* __cplusplus */
107 
108 #endif