gr55xx_hal_clock.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr55xx_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 /** @addtogroup PERIPHERAL Peripheral Driver
40 * @{
41 */
42
43 /** @addtogroup HAL_DRIVER HAL Driver
44 * @{
45 */
46
47 /** @defgroup HAL_CLK CLOCK
48 * @brief CLOCK CALIBRATION HAL module driver.
49 * @{
50 */
51
52 /* Define to prevent recursive inclusion -------------------------------------*/
53 #ifndef __GR55xx_HAL_CLOCK_H__
54 #define __GR55xx_HAL_CLOCK_H__
55
56 /* Includes ------------------------------------------------------------------*/
57 #include "gr55xx_hal_def.h"
58 #include <stdio.h>
59 #include <stdbool.h>
60
61 /** @addtogroup HAL_CLK_ENUMERATIONS Enumerations
62 * @{
63 */
64 /**
65 * @brief XO-Requested Devices ID definition
66 */
67 /** @{
68 */
69 typedef enum
70 {
71 XO_REQUEST_DEVICE_NUM_BLE = 0,
72 XO_REQUEST_DEVICE_NUM_CALIBRATION, //NO.=1
73 XO_REQUEST_DEVICE_NUM_USB, //NO.=2
74 XO_REQUEST_DEVICE_NUM_DDVS //NO.=3
75 } xo_request_device_number_t;
76 /** @} */
77 /** @} */
78
79 /** @addtogroup HAL_CLK_FUNCTIONS Functions
80 * @brief xo clock request and release API
81 * @{
82 */
83
84 /**
85 ****************************************************************************************
86 * @brief get which devices requested xo clock
87 *
88 * @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.
89 ****************************************************************************************
90 */
91 uint32_t hal_clock_get_xo_requests(void);
92
93 /**
94 ****************************************************************************************
95 * @brief check the specified device whether request xo clock or not
96 * @param[in] dev_num: specified device number
97 * @return value 1 means requests xo, and value 0 means no need xo.
98 ****************************************************************************************
99 */
100 uint32_t hal_clock_get_device_xo_request_status(xo_request_device_number_t dev_num);
101
102 /**
103 ****************************************************************************************
104 * @brief the specified device request xo clock resource
105 * @param[in] dev_num: specified device number
106 * @return void
107 ****************************************************************************************
108 */
109 void hal_clock_request_xo_osc(xo_request_device_number_t dev_num);
110
111 /**
112 ****************************************************************************************
113 * @brief the specified device release xo clock resource
114 * @param[in] dev_num: specified device number
115 * @return void
116 ****************************************************************************************
117 */
118 void hal_clock_release_xo_osc(xo_request_device_number_t dev_num);
119
120 /**
121 ****************************************************************************************
122 * @brief release xo clock resource for all devices.
123 * @return void
124 ****************************************************************************************
125 */
126 void hal_clock_release_xo_osc_all(void);
127 /** @} */
128
129 #endif /*__GR55xx_HAL_CLOCK_H__*/
130 /** @} */
131 /** @} */
132 /** @} */
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_release_xo_osc
void hal_clock_release_xo_osc(xo_request_device_number_t dev_num)
the specified device release xo clock resource
XO_REQUEST_DEVICE_NUM_BLE
@ XO_REQUEST_DEVICE_NUM_BLE
Definition: gr55xx_hal_clock.h:71
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
XO_REQUEST_DEVICE_NUM_USB
@ XO_REQUEST_DEVICE_NUM_USB
Definition: gr55xx_hal_clock.h:73
hal_clock_get_xo_requests
uint32_t hal_clock_get_xo_requests(void)
get which devices requested xo clock
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_CALIBRATION
@ XO_REQUEST_DEVICE_NUM_CALIBRATION
Definition: gr55xx_hal_clock.h:72
xo_request_device_number_t
xo_request_device_number_t
XO-Requested Devices ID definition.
Definition: gr55xx_hal_clock.h:70
XO_REQUEST_DEVICE_NUM_DDVS
@ XO_REQUEST_DEVICE_NUM_DDVS
Definition: gr55xx_hal_clock.h:74
gr55xx_hal_def.h
This file contains HAL common definitions, enumeration, macros and structures definitions.