1 /** 2 * @file hi_clock.h 3 * 4 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /** 19 * @defgroup iot_clock Crystal Clock 20 * @ingroup drivers 21 */ 22 23 #ifndef __HI_CLOCK_H__ 24 #define __HI_CLOCK_H__ 25 #include <hi_types_base.h> 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif 30 31 #define HI_XTAL_24MHZ_VAL 24000000 32 #define HI_XTAL_40MHZ_VAL 40000000 33 34 /** 35 * @ingroup iot_clock Xtal Clock Configuration 36 * 37 * Crystal clock frequency.CNcomment:晶体时钟频率。CNend 38 */ 39 typedef enum { 40 HI_XTAL_CLOCK_24M, /**< 24M crystal clock frequency.CNcomment:24M晶体时钟CNend */ 41 HI_XTAL_CLOCK_40M, /**< 40M crystal clock frequency.CNcomment:40M晶体时钟CNend */ 42 HI_XTAL_CLOCK_MAX /**< MAX value, invalid.CNcomment:最大值,不可使用CNend */ 43 }hi_xtal_clock; 44 45 /** 46 * @ingroup iot_clock 47 * @brief Obtains the crystal clock frequency.CNcomment:获取晶体时钟频率。CNend 48 * 49 * @par 描述: 50 * Obtains the crystal clock frequency.CNcomment:获取晶体时钟频率。CNend 51 * 52 * @attention None 53 * @param None 54 * 55 * @retval #HI_XTAL_CLOCK_24M 24M crystal clock frequency.CNcomment:24M晶体时钟。CNend 56 * @retval #HI_XTAL_CLOCK_40M 40M crystal clock frequency.CNcomment:40M晶体时钟。CNend 57 * @retval #HI_XTAL_CLOCK_MAX MAX value, invalid.CNcomment:最大值,不可使用。CNend 58 * @par 依赖: 59 * @li hi_clock.h:Describes hardware clock APIS. 60 CNcomment:文件用于描述硬件时钟相关接口。CNend 61 * @see None 62 */ 63 HI_EXTERN hi_xtal_clock hi_get_xtal_clock(hi_void); 64 65 /** 66 * @ingroup iot_clock 67 * @brief Configure the frequency divider of the 24M/40M crystal oscillator to generate the 32K clock. 68 CNcomment:配置24M/40M晶体分频值,产生32K时钟。CNend 69 * 70 * @par 描述: 71 * Configure the frequency divider of the 24M/40M crystal oscillator to generate the 32K clock. 72 CNcomment:配置24M/40M晶体分频值,产生32K时钟。CNend 73 * 74 * @attention Impact Scope:systick、rtc.CNcomment:影响范围:systick、rtc。CNend 75 * @param None 76 * 77 * @retval None 78 * @par 依赖: 79 * @li hi_clock.h:Describes hardware clock APIS. 80 CNcomment:文件用于描述硬件时钟相关接口。CNend 81 * @see None 82 */ 83 HI_EXTERN hi_void hi_cfg_xtal_clk_div(hi_void); 84 85 #ifdef __cplusplus 86 } 87 #endif 88 89 #endif 90