hal_clock.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file hal_clock.h
5 * @author BLE Driver Team
6 * @brief This file contains all the functions prototypes for the HAL
7 * module driver.
8 *
9 ****************************************************************************************
10 * @attention
11 #####Copyright (c) 2019 GOODIX
12 All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions are met:
16 * Redistributions of source code must retain the above copyright
17 notice, this list of conditions and the following disclaimer.
18 * Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
21 * Neither the name of GOODIX nor the names of its contributors may be used
22 to endorse or promote products derived from this software without
23 specific prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
29 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 POSSIBILITY OF SUCH DAMAGE.
36 ****************************************************************************************
37 */
38
39 /* Define to prevent recursive inclusion -------------------------------------*/
40 #ifndef HAL_CLOCK_H
41 #define HAL_CLOCK_H
42
43 /* Includes ------------------------------------------------------------------*/
44 #include "hal_def.h"
45 #include <stdio.h>
46 #include <stdbool.h>
47
48 /**
49 * @brief XO-Requested Devices ID definition
50 */
51 /** @{
52 */
53 typedef enum
54 {
55 XO_REQUEST_DEVICE_NUM_BLE = 0,
56 XO_REQUEST_DEVICE_NUM_CALIBRATION, //NO.=1
57 XO_REQUEST_DEVICE_NUM_DDVS, //NO.=2
58 XO_REQUEST_DEVICE_NUM_USER, //NO.=3
59 XO_REQUEST_DEVICE_NUM_DCDC, //NO.=4
60 MAX_XO_REQUEST_DEVICE_NUM
61 } xo_request_device_number_t;
62 /** @} */
63
64 /**
65 * @brief xo clock request and release API
66 */
67 /** @{
68 */
69 /**
70 ****************************************************************************************
71 * @brief get which devices requested xo clock
72 *
73 * @return xo_clock_requests, each bit corresponds to xo_request_device_number_t; value 1 means requests xo, and value 0 means no need xo.
74 ****************************************************************************************
75 */
76 uint32_t hal_clock_get_xo_requests(void);
77
78 /**
79 ****************************************************************************************
80 * @brief check the specified device whether request xo clock or not
81 * @param dev_num specified device number
82 * @return value 1 means requests xo, and value 0 means no need xo.
83 ****************************************************************************************
84 */
85 uint32_t hal_clock_get_device_xo_request_status(xo_request_device_number_t dev_num);
86
87 /**
88 ****************************************************************************************
89 * @brief the specified device request xo clock resource
90 * @param dev_num specified device number
91 * @return void
92 ****************************************************************************************
93 */
94 void hal_clock_request_xo_osc(xo_request_device_number_t dev_num);
95
96 /**
97 ****************************************************************************************
98 * @brief the specified device release xo clock resource
99 * @param dev_num specified device number
100 * @return void
101 ****************************************************************************************
102 */
103 void hal_clock_release_xo_osc(xo_request_device_number_t dev_num);
104
105 /**
106 ****************************************************************************************
107 * @brief release xo clock resource for all devices.
108 * @return void
109 ****************************************************************************************
110 */
111 void hal_clock_release_xo_osc_all(void);
112
113 void hal_clock_request_xo_osc_ori(xo_request_device_number_t dev_num);
114 void hal_clock_release_xo_osc_ori(xo_request_device_number_t dev_num);
115 void hal_clock_release_xo_osc_all_ori(void);
116 extern void (*p_hal_clock_request_xo_osc)(xo_request_device_number_t dev_num);
117 extern void (*p_hal_clock_release_xo_osc)(xo_request_device_number_t dev_num);
118 extern void (*p_hal_clock_release_xo_osc_all)(void);
119
120 /** @} */
121
122 #endif /*HAL_CLOCK_H*/
123
XO_REQUEST_DEVICE_NUM_CALIBRATION
@ XO_REQUEST_DEVICE_NUM_CALIBRATION
Definition: hal_clock.h:56
hal_clock_request_xo_osc
void hal_clock_request_xo_osc(xo_request_device_number_t dev_num)
the specified device request xo clock resource
hal_clock_release_xo_osc_all_ori
void hal_clock_release_xo_osc_all_ori(void)
hal_clock_get_xo_requests
uint32_t hal_clock_get_xo_requests(void)
xo clock request and release API
XO_REQUEST_DEVICE_NUM_DCDC
@ XO_REQUEST_DEVICE_NUM_DCDC
Definition: hal_clock.h:59
p_hal_clock_release_xo_osc_all
void(* p_hal_clock_release_xo_osc_all)(void)
p_hal_clock_release_xo_osc
void(* p_hal_clock_release_xo_osc)(xo_request_device_number_t dev_num)
hal_clock_release_xo_osc_all
void hal_clock_release_xo_osc_all(void)
release xo clock resource for all devices.
hal_clock_release_xo_osc_ori
void hal_clock_release_xo_osc_ori(xo_request_device_number_t dev_num)
hal_clock_release_xo_osc
void hal_clock_release_xo_osc(xo_request_device_number_t dev_num)
the specified device release xo clock resource
p_hal_clock_request_xo_osc
void(* p_hal_clock_request_xo_osc)(xo_request_device_number_t dev_num)
hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.
XO_REQUEST_DEVICE_NUM_USER
@ XO_REQUEST_DEVICE_NUM_USER
Definition: hal_clock.h:58
hal_clock_request_xo_osc_ori
void hal_clock_request_xo_osc_ori(xo_request_device_number_t dev_num)
XO_REQUEST_DEVICE_NUM_DDVS
@ XO_REQUEST_DEVICE_NUM_DDVS
Definition: hal_clock.h:57
hal_clock_get_device_xo_request_status
uint32_t hal_clock_get_device_xo_request_status(xo_request_device_number_t dev_num)
check the specified device whether request xo clock or not
XO_REQUEST_DEVICE_NUM_BLE
@ XO_REQUEST_DEVICE_NUM_BLE
Definition: hal_clock.h:55
MAX_XO_REQUEST_DEVICE_NUM
@ MAX_XO_REQUEST_DEVICE_NUM
Definition: hal_clock.h:60
xo_request_device_number_t
xo_request_device_number_t
XO-Requested Devices ID definition.
Definition: hal_clock.h:54