1 /***************************************************************************//**
2 * \file cy_syspm_btss.h
3 * \version 5.150
4 *
5 * Provides the API declarations of the BTSS driver.
6 *
7 ********************************************************************************
8 * \copyright
9 * Copyright 2016-2021 Cypress Semiconductor Corporation
10 * SPDX-License-Identifier: Apache-2.0
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 *     http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *******************************************************************************/
24 
25 /**
26 * \addtogroup group_syspm_btss BTSS Host API(Bluetooth Sub System Host API)
27 * \{
28 * BTSS PDL Driver helps in controlling the BTSS from the MCU side.
29 *
30 * For more information on the BTSS , refer to
31 * the technical reference manual (TRM).
32 *
33 * \section group_syspm_btss_MISRA MISRA-C Compliance
34 * The BTSS driver does not have any specific deviations.
35 *
36 * \section group_syspm_btss_changelog Changelog
37 * <table class="doxtable">
38 *   <tr><th>Version</th><th>Changes</th><th>Reason for Change</th></tr>
39 *   <tr>
40 *     <td>5.150</td>
41 *     <td>Version updated to match SYSPM driver.</td>
42 *     <td></td>
43 *   </tr>
44 *   <tr>
45 *     <td>1.0</td>
46 *     <td>Initial version</td>
47 *     <td></td>
48 *   </tr>
49 * </table>
50 *
51 * \defgroup group_syspm_btss_macros Macros
52 * \defgroup group_syspm_btss_functions Functions
53 * \defgroup group_syspm_btss_data_structures Data Structures
54 * \defgroup group_syspm_btss_enums           General Enumerated Types
55 * \{
56 *   \defgroup group_syspm_btss_returns         Function return values
57 * \}
58 */
59 
60 #ifndef CY_BTSS_H
61 #define CY_BTSS_H
62 
63 #include "cy_device.h"
64 
65 #if defined (CY_IP_MXS40BLE52SS)
66 
67 #include <stdint.h>
68 #include <stdbool.h>
69 #include <stddef.h>
70 #include "cy_syslib.h"
71 #include "cy_device_headers.h"
72 #include "cy_sysclk.h"
73 #include "cy_syspm_pdcm.h"
74 
75 #ifdef __cplusplus
76 extern "C" {
77 #endif
78 
79 /**
80 * \addtogroup group_syspm_btss_macros
81 * \{
82 */
83 
84 /** Driver major version */
85 #define CY_BTSS_DRV_VERSION_MAJOR       5
86 /** Driver minor version */
87 #define CY_BTSS_DRV_VERSION_MINOR       150
88 /** Timeout for SL CTL3 register wait in micro seconds */
89 #define CY_BTSS_SL_CTL3_WAIT_DELAY_US   500000UL
90 /** \} group_syspm_btss_macros */
91 
92 /**
93 * \addtogroup group_syspm_btss_returns
94 * \{
95 */
96 /** Defines general-purpose function return values */
97 typedef enum
98 {
99     CY_BTSS_SUCCESS           = CY_SYSPM_SUCCESS, /**< Command completed with no errors */
100     CY_BTSS_BAD_PARAM         = CY_SYSPM_BAD_PARAM, /**< Invalid function input parameter */
101     CY_BTSS_TIMEOUT           = CY_SYSPM_TIMEOUT, /**< Timeout occurred */
102     CY_BTSS_INVALID_STATE     = CY_SYSPM_INVALID_STATE, /**< BTSS is in an invalid state */
103 } cy_en_btss_status_t;
104 /** \} group_syspm_btss_returns */
105 
106 /**
107 * \addtogroup group_syspm_btss_functions
108 * \{
109 */
110 
111 /*******************************************************************************
112 * Function Name: Cy_BTSS_GetXtalOscFreq
113 ****************************************************************************//**
114 *
115 * Gets the Crystal Oscillator Frequency(Hz) generated by Radio Hard IP
116 *
117 * \return Frequency(Hz) of Crystal Oscillator generated by Radio Hard IP
118 *
119 *******************************************************************************/
120 uint32_t Cy_BTSS_GetXtalOscFreq(void);
121 
122 /*******************************************************************************
123 * Function Name: Cy_BTSS_PowerDep
124 ****************************************************************************//**
125 *
126 * Enable/Disable the Power dependency of BTSS on CPUSS.
127 * If enabled, BTSS will wake up and will be ON as long as CPUSS is ON.
128 *
129 * \param enable TRUE-Enable, FASLE-Disable
130 *
131 * \return \ref cy_en_btss_status_t
132 *
133 * \note
134 * This API needs to be used to wake and keep the BTSS ON , while CPUSS is ON.
135 *
136 *******************************************************************************/
137 cy_en_btss_status_t Cy_BTSS_PowerDep(bool enable);
138 
139 /*******************************************************************************
140 * Function Name: Cy_BTSS_CPUSSPowerDep
141 ****************************************************************************//**
142 *
143 * Enable/Disable the Power dependency of CPUSS on BTSS.
144 * If enabled, CPUSS will be ON as long as BTSS is ON.
145 *
146 * \param enable TRUE-Enable, FASLE-Disable
147 *
148 * \return \ref cy_en_btss_status_t
149 *
150 * \note
151 * This API needs to be used if we need to keep the CPUSS ON , while BTSS is ON.
152 *
153 *******************************************************************************/
154 cy_en_btss_status_t Cy_BTSS_CPUSSPowerDep(bool enable);
155 
156 /*******************************************************************************
157 * Function Name: Cy_BTSS_PowerDepResetCount
158 ****************************************************************************//**
159 *
160 * Reset Power dependency use count.
161 *
162 * \note
163 * This API can be used to reset use count to Zero when BT Reset happens.
164 *
165 *******************************************************************************/
166 void Cy_BTSS_PowerDepResetCount(void);
167 
168 /*******************************************************************************
169 * Function Name: Cy_BTSS_AssertReset
170 ****************************************************************************//**
171 *
172 * Asserts/De-Asserts Reset of BTSS IP.
173 *
174 * \param assertEn TRUE-Enable, FALSE-Disable
175 *
176 *******************************************************************************/
177 void Cy_BTSS_AssertReset(bool assertEn);
178 
179 /*******************************************************************************
180 * Function Name: Cy_BTSS_IsResetAsserted
181 ****************************************************************************//**
182 *
183 * Checks if BTSS IP Reset is Asserted or not.
184 *
185 * \return TRUE- if Assert Enabled, FALSE- if Assert Disabled.
186 *
187 *******************************************************************************/
188 bool Cy_BTSS_IsResetAsserted(void);
189 
190 /** \} group_syspm_btss_functions */
191 
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif /* CY_IP_MXS40BLE52SS */
198 
199 #endif /* CY_BTSS_H */
200 
201 /** \} group_syspm_btss */
202 
203 /* [] END OF FILE */
204 
205