• 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 TCXO driver api \n
16  *
17  * History: \n
18  * 2022-08-16, Create file. \n
19  */
20 
21 #ifndef TCXO_H
22 #define TCXO_H
23 
24 #include <stdint.h>
25 #include "errcode.h"
26 
27 #ifdef __cplusplus
28 #if __cplusplus
29 extern "C" {
30 #endif /* __cplusplus */
31 #endif /* __cplusplus */
32 
33 /**
34  * @defgroup drivers_driver_tcxo TCXO
35  * @ingroup  drivers_driver
36  * @{
37  */
38 
39 /**
40  * @if Eng
41  * @brief  Initialize TCXO.
42  * @retval ERRCODE_SUCC Success.
43  * @retval Other        Failure. For details, see @ref errcode_t.
44  * @else
45  * @brief  初始化TCXO。
46  * @retval ERRCODE_SUCC 成功。
47  * @retval Other        失败,参考 @ref errcode_t 。
48  * @endif
49  */
50 errcode_t uapi_tcxo_init(void);
51 
52 /**
53  * @if Eng
54  * @brief  Deinitialize TCXO.
55  * @retval ERRCODE_SUCC Success.
56  * @retval Other        Failure. For details, see @ref errcode_t.
57  * @else
58  * @brief  去初始化TCXO。
59  * @retval ERRCODE_SUCC 成功。
60  * @retval Other        失败,参考 @ref errcode_t 。
61  * @endif
62  */
63 errcode_t uapi_tcxo_deinit(void);
64 
65 /**
66  * @if Eng
67  * @brief  Get TCXO count.
68  * @retval TCXO current count.
69  * @else
70  * @brief  获取TCXO计数值。
71  * @retval TCXO当前计数值。
72  * @endif
73  */
74 uint64_t uapi_tcxo_get_count(void);
75 
76  /**
77  * @if Eng
78  * @brief  Get the TCXO ms.
79  * @retval The current ms of TCXO.
80  * @else
81  * @brief  获取TCXO计数毫秒值。
82  * @retval TCXO当前计数毫秒值。
83  * @endif
84  */
85 uint64_t uapi_tcxo_get_ms(void);
86 
87 /**
88  * @if Eng
89  * @brief  Get the TCXO us.
90  * @retval The current us of TCXO.
91  * @else
92  * @brief  获取TCXO计数微秒值。
93  * @retval TCXO当前计数微秒值。
94  * @endif
95  */
96 uint64_t uapi_tcxo_get_us(void);
97 
98 /**
99  * @if Eng
100  * @brief  Sets the delay time of ms.
101  * @param  [in]  m_delay The ms times to delay.
102  * @retval ERRCODE_SUCC Success.
103  * @retval Other        Failure. For details, see @ref errcode_t.
104  * @else
105  * @brief  设置延迟毫秒数。
106  * @param  [in]  m_delay 延迟毫秒数。
107  * @retval ERRCODE_SUCC 成功。
108  * @retval Other        失败,参考 @ref errcode_t 。
109  * @endif
110  */
111 errcode_t uapi_tcxo_delay_ms(uint32_t m_delay);
112 
113 /**
114  * @if Eng
115  * @brief  Sets the delay time of us.
116  * @param  [in]  u_delay The us times to delay.
117  * @retval ERRCODE_SUCC Success.
118  * @retval Other        Failure. For details, see @ref errcode_t.
119  * @else
120  * @brief  设置延迟微秒数。
121  * @param  [in]  u_delay 延迟微秒数。
122  * @retval ERRCODE_SUCC 成功。
123  * @retval Other        失败,参考 @ref errcode_t 。
124  * @endif
125  */
126 errcode_t uapi_tcxo_delay_us(uint32_t u_delay);
127 
128 #if defined(CONFIG_TCXO_SUPPORT_LPM)
129 /**
130  * @if Eng
131  * @brief  Suspend the TCXO.
132  * @param  [in]  arg Argument for suspend.
133  * @retval ERRCODE_SUCC Success.
134  * @retval Other        Failure. For details, see @ref errcode_t.
135  * @else
136  * @brief  挂起TCXO。
137  * @param  [in]  arg 挂起所需要的参数。
138  * @retval ERRCODE_SUCC 成功。
139  * @retval Other        失败,参考 @ref errcode_t 。
140  * @endif
141  */
142 errcode_t uapi_tcxo_suspend(uintptr_t arg);
143 
144 /**
145  * @if Eng
146  * @brief  Resume the TCXO.
147  * @param  [in]  arg Argument for resume.
148  * @retval ERRCODE_SUCC Success.
149  * @retval Other        Failure. For details, see @ref errcode_t.
150  * @else
151  * @brief  恢复TCXO。
152  * @param  [in]  arg 恢复所需要的参数。
153  * @retval ERRCODE_SUCC 成功。
154  * @retval Other        失败,参考 @ref errcode_t 。
155  * @endif
156  */
157 errcode_t uapi_tcxo_resume(uintptr_t arg);
158 #endif  /* CONFIG_TCXO_SUPPORT_LPM */
159 
160 /**
161  * @}
162  */
163 
164 #ifdef __cplusplus
165 #if __cplusplus
166 }
167 #endif /* __cplusplus */
168 #endif /* __cplusplus */
169 
170 #endif
171