gr533x_hal_clock.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr533x_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 __GR533x_HAL_CLOCK_H__
41 #define __GR533x_HAL_CLOCK_H__
42
43 /* Includes ------------------------------------------------------------------*/
44 #include "gr533x_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 MAX_XO_REQUEST_DEVICE_NUM
59 } xo_request_device_number_t;
60 /** @} */
61
62 /**
63 * @brief xo clock request and release API
64 */
65 /** @{
66 */
67 /**
68 ****************************************************************************************
69 * @brief get which devices requested xo clock
70 *
71 * @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.
72 ****************************************************************************************
73 */
74 uint32_t hal_clock_get_xo_requests(void);
75
76 /**
77 ****************************************************************************************
78 * @brief check the specified device whether request xo clock or not
79 * @param dev_num specified device number
80 * @return value 1 means requests xo, and value 0 means no need xo.
81 ****************************************************************************************
82 */
83 uint32_t hal_clock_get_device_xo_request_status(xo_request_device_number_t dev_num);
84
85 /**
86 ****************************************************************************************
87 * @brief the specified device request xo clock resource
88 * @param dev_num specified device number
89 * @return void
90 ****************************************************************************************
91 */
92 void hal_clock_request_xo_osc(xo_request_device_number_t dev_num);
93
94 /**
95 ****************************************************************************************
96 * @brief the specified device release xo clock resource
97 * @param dev_num specified device number
98 * @return void
99 ****************************************************************************************
100 */
101 void hal_clock_release_xo_osc(xo_request_device_number_t dev_num);
102
103 /**
104 ****************************************************************************************
105 * @brief release xo clock resource for all devices.
106 * @return void
107 ****************************************************************************************
108 */
109 void hal_clock_release_xo_osc_all(void);
110
111 /** @} */
112
113 #endif /*__GR533x_HAL_CLOCK_H__*/
114
XO_REQUEST_DEVICE_NUM_CALIBRATION
@ XO_REQUEST_DEVICE_NUM_CALIBRATION
Definition: gr533x_hal_clock.h:56
hal_clock_get_xo_requests
uint32_t hal_clock_get_xo_requests(void)
xo clock request and release API
XO_REQUEST_DEVICE_NUM_DDVS
@ XO_REQUEST_DEVICE_NUM_DDVS
Definition: gr533x_hal_clock.h:57
xo_request_device_number_t
xo_request_device_number_t
XO-Requested Devices ID definition.
Definition: gr533x_hal_clock.h:54
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
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
void hal_clock_release_xo_osc(xo_request_device_number_t dev_num)
the specified device release xo clock resource
MAX_XO_REQUEST_DEVICE_NUM
@ MAX_XO_REQUEST_DEVICE_NUM
Definition: gr533x_hal_clock.h:58
hal_clock_release_xo_osc_all
void hal_clock_release_xo_osc_all(void)
release xo clock resource for all devices.
XO_REQUEST_DEVICE_NUM_BLE
@ XO_REQUEST_DEVICE_NUM_BLE
Definition: gr533x_hal_clock.h:55
gr533x_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.