1 /**
2   ******************************************************************************
3   * @file    bl808_aon.h
4   * @version V1.0
5   * @date
6   * @brief   This file is the standard driver header file
7   ******************************************************************************
8   * @attention
9   *
10   * <h2><center>&copy; COPYRIGHT(c) 2020 Bouffalo Lab</center></h2>
11   *
12   * Redistribution and use in source and binary forms, with or without modification,
13   * are permitted provided that the following conditions are met:
14   *   1. Redistributions of source code must retain the above copyright notice,
15   *      this list of conditions and the following disclaimer.
16   *   2. Redistributions in binary form must reproduce the above copyright notice,
17   *      this list of conditions and the following disclaimer in the documentation
18   *      and/or other materials provided with the distribution.
19   *   3. Neither the name of Bouffalo Lab nor the names of its contributors
20   *      may be used to endorse or promote products derived from this software
21   *      without specific prior written permission.
22   *
23   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
27   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33   *
34   ******************************************************************************
35   */
36 #ifndef __BL808_AON_H__
37 #define __BL808_AON_H__
38 
39 #include "aon_reg.h"
40 #include "glb_reg.h"
41 #include "hbn_reg.h"
42 #include "pds_reg.h"
43 #include "bl808_ef_ctrl.h"
44 #include "bl808_common.h"
45 
46 /** @addtogroup  BL808_Peripheral_Driver
47  *  @{
48  */
49 
50 /** @addtogroup  AON
51  *  @{
52  */
53 
54 /** @defgroup  AON_Public_Types
55  *  @{
56  */
57 
58 /**
59  *  @brief AON DCDC level type definition
60  */
61 typedef enum {
62     AON_DCDC_LEVEL_0P900V = 0,  /*!< AON DCDC voltage 0.900V */
63     AON_DCDC_LEVEL_1P075V = 7,  /*!< AON DCDC voltage 1.075V */
64     AON_DCDC_LEVEL_1P100V = 8,  /*!< AON DCDC voltage 1.100V */
65     AON_DCDC_LEVEL_1P125V = 9,  /*!< AON DCDC voltage 1.125V */
66     AON_DCDC_LEVEL_1P900V = 31, /*!< AON DCDC voltage 1.900V */
67 } AON_DCDC_LEVEL_Type;
68 
69 /*@} end of group AON_Public_Types */
70 
71 /** @defgroup  AON_Public_Constants
72  *  @{
73  */
74 
75 /*@} end of group AON_Public_Constants */
76 
77 /** @defgroup  AON_Public_Macros
78  *  @{
79  */
80 /** @defgroup  HBN_LDO_LEVEL_TYPE
81  *  @{
82  */
83 #define IS_AON_DCDC_LEVEL_TYPE(type) (((type) == AON_DCDC_LEVEL_0P900V) || \
84                                       ((type) == AON_DCDC_LEVEL_1P075V) || \
85                                       ((type) == AON_DCDC_LEVEL_1P100V) || \
86                                       ((type) == AON_DCDC_LEVEL_1P125V) || \
87                                       ((type) == AON_DCDC_LEVEL_1P900V))
88 
89 /*@} end of group AON_Public_Macros */
90 
91 /** @defgroup  AON_Public_Functions
92  *  @{
93  */
94 /*----------*/
95 BL_Err_Type AON_Power_On_MBG(void);
96 BL_Err_Type AON_Power_Off_MBG(void);
97 /*----------*/
98 BL_Err_Type AON_Power_On_XTAL(void);
99 BL_Err_Type AON_Set_Xtal_CapCode(uint8_t capIn, uint8_t capOut);
100 uint8_t AON_Get_Xtal_CapCode(void);
101 BL_Err_Type AON_Power_Off_XTAL(void);
102 /*----------*/
103 BL_Err_Type AON_Power_On_BG(void);
104 BL_Err_Type AON_Power_Off_BG(void);
105 /*----------*/
106 BL_Err_Type AON_Trim_DCDC11_Vout(void);
107 BL_Err_Type AON_Trim_DCDC18_Vout(void);
108 BL_Err_Type AON_Trim_USB20_RCAL(void);
109 /*----------*/
110 BL_Err_Type AON_Power_On_LDO15_RF(void);
111 BL_Err_Type AON_Power_Off_LDO15_RF(void);
112 /*----------*/
113 BL_Err_Type AON_Power_On_SFReg(void);
114 BL_Err_Type AON_Power_Off_SFReg(void);
115 /*----------*/
116 BL_Err_Type AON_LowPower_Enter_PDS0(void);
117 BL_Err_Type AON_LowPower_Exit_PDS0(void);
118 /*----------*/
119 BL_Err_Type AON_Set_DCDC11_Top_Vout(AON_DCDC_LEVEL_Type dcdcLevel);
120 
121 /*@} end of group AON_Public_Functions */
122 
123 /*@} end of group AON */
124 
125 /*@} end of group BL808_Peripheral_Driver */
126 
127 #endif /* __BL808_AON_H__ */
128