MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.91.13.01
hspll.h
1 //*****************************************************************************
2 //
3 // hspll.h - Driver for the HSPLL Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_HSPLL_H__
8 #define __MSP430WARE_HSPLL_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_HSPLL__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be returned by the
28 // HSPLL_getInterruptStatus(), HSPLL_getInterruptMaskStatus() API
29 //
30 //*****************************************************************************
31 #define HSPLL_PLL_STATE_UNCHANGED PLLUNLOCK_0
32 #define HSPLL_PLL_STATE_CHANGED_LOCK_TO_UNLOCK PLLUNLOCK_1
33 
34 //*****************************************************************************
35 //
36 // The following are values that can be passed to the param parameter for
37 // functions: HSPLL_init(); the frequency parameter for
38 // functions: HSPLL_init().
39 
40 //
41 //*****************************************************************************
42 #define HSPLL_LESSER_OR_EQUAL_TO_6MHZ PLLINFREQ_0
43 #define HSPLL_GREATER_THAN_6MHZ PLLINFREQ_1
44 
45 //*****************************************************************************
46 //
47 // The following are values that can be passed to the param parameter for
48 // functions: HSPLL_init(); the lockStatus parameter for
49 // functions: HSPLL_init(). As well as returned by the
50 // HSPLL_isLocked() function.
51 //
52 //*****************************************************************************
53 #define HSPLL_UNLOCKED PLL_LOCK_0
54 #define HSPLL_LOCKED PLL_LOCK_1
55 
56 //*****************************************************************************
57 //
58 // The following are values that can be passed to the param parameter for
59 // functions: HSPLL_xtalInit(); the oscillatorType parameter for
60 // functions: HSPLL_xtalInit().
61 //
62 //*****************************************************************************
63 #define HSPLL_XTAL_GATING_COUNTER_LENGTH_4096 OSCTYPE_0
64 #define HSPLL_XTAL_GATING_COUNTER_LENGTH_512 OSCTYPE_1
65 #define HSPLL_XTAL_OSCTYPE_XTAL OSCTYPE__XTAL
66 #define HSPLL_XTAL_OSCTYPE_CERAMIC OSCTYPE__CERAMIC
67 
68 //*****************************************************************************
69 //
70 // The following are values that can be passed to the param parameter for
71 // functions: HSPLL_xtalInit(); the xtlOutput parameter for
72 // functions: HSPLL_xtalInit().
73 //
74 //*****************************************************************************
75 #define HSPLL_XTAL_OUTPUT_DISABLE XTOUTOFF_1
76 #define HSPLL_XTAL_OUTPUT_ENABLE XTOUTOFF_0
77 
78 //*****************************************************************************
79 //
80 // The following are values that can be passed to the param parameter for
81 // functions: HSPLL_xtalInit(); the oscillatorEnable parameter for
82 // functions: HSPLL_xtalInit().
83 //
84 //*****************************************************************************
85 #define HSPLL_XTAL_ENABLE USSXTEN_1
86 #define HSPLL_XTAL_DISABLE USSXTEN_0
87 
88 //*****************************************************************************
89 //
90 // The following are values that can be returned by HSPLL_getOscillatorStatus()
91 //
92 //*****************************************************************************
93 #define HSPLL_OSCILLATOR_STABILIZED OSCSTATE_0
94 #define HSPLL_OSCILLATOR_NOT_STABILIZED OSCSTATE_1
95 #define HSPLL_OSCILLATOR_NOT_STARTED OSCSTATE_0
96 #define HSPLL_OSCILLATOR_STARTED OSCSTATE_1
97 
98 //*****************************************************************************
99 //
100 //! \brief Used in the HSPLL_init() function as the param parameter.
101 //
102 //*****************************************************************************
103 typedef struct HSPLL_initParam
104 {
105  //! PLL Multiplier
106  //! \n Valid values are 16 thru 39. Default value is 16
107  //! \n Alternative valid values are any OR of PLLM_x_H bits
108  uint16_t multiplier;
109  //! Selects MSB shift from filter out
110  //! - \b HSPLL_LESSER_OR_EQUAL_TO_6MHZ [Default]
111  //! - \b HSPLL_GREATER_THAN_6MHZ
112  uint16_t frequency;
113  //! Selects the output bit resolution
114  //! \n Valid values are:
115  //! - \b HSPLL_UNLOCKED [Default]
116  //! - \b HSPLL_LOCKED
117  uint16_t lockStatus;
119 
120 //*****************************************************************************
121 //
122 //! \brief Used in the HSPLL_xtalInit() function as the param parameter.
123 //
124 //*****************************************************************************
125 typedef struct HSPLL_xtalInitParam
126 {
127  //! Selects the oscillator type
128  //! \n Valid values are:
129  //! - \b HSPLL_XTAL_GATING_COUNTER_LENGTH_4096 [Default]
130  //! - \b HSPLL_XTAL_GATING_COUNTER_LENGTH_512
131  //! - \b HSPLL_XTAL_OSCTYPE_XTAL [Default]
132  //! - \b HSPLL_XTAL_OSCTYPE_CERAMIC
133  uint16_t oscillatorType;
134  //! Disables/Enables the oscillator output
135  //! \n Valid values are:
136  //! - \b HSPLL_XTAL_OUTPUT_DISABLE [Default]
137  //! - \b HSPLL_XTAL_OUTPUT_ENABLE
138  uint16_t xtlOutput;
139  //! Selects the Auto Sample Start
140  //! \n Valid values are:
141  //! - \b HSPLL_XTAL_DISABLE [Default]
142  //! - \b HSPLL_XTAL_ENABLE
145 
146 //*****************************************************************************
147 //
148 //! \brief Initializes the HSPLL module
149 //!
150 //! Initializes the HSPLL module
151 //!
152 //! \param baseAddress is the base address of the HSPLL module.
153 //!
154 //! \param params is the pointer to the initialization structure
155 //!
156 //! \return None
157 //
158 //*****************************************************************************
159 extern void HSPLL_init(uint16_t baseAddress, HSPLL_initParam *param);
160 
161 //*****************************************************************************
162 //
163 //! \brief Initializes the HSPLL XTAL module
164 //!
165 //! Initializes the HSPLL XTAL module
166 //!
167 //! \param baseAddress is the base address of the HSPLL XTAL module.
168 //!
169 //! \param params is the pointer to the initialization structure
170 //!
171 //! \return None
172 //
173 //*****************************************************************************
174 extern void HSPLL_xtalInit(uint16_t baseAddress, HSPLL_xtalInitParam *param);
175 
176 //*****************************************************************************
177 //
178 //! \brief Returns the status of the selected interrupt flags.
179 //!
180 //! Returns the status of the selected interrupt flag.
181 //!
182 //! \param baseAddress is the base address of the HSPLL module.
183 //!
184 //! \return \b HSPLL_PLL_STATE_UNCHANGED or
185 //! \b HSPLL_PLL_STATE_CHANGED_LOCK_TO_UNLOCK
186 //!
187 //
188 //*****************************************************************************
189 extern uint16_t HSPLL_getInterruptStatus(uint16_t baseAddress);
190 
191 //*****************************************************************************
192 //
193 //! \brief Returns the mask status of the selected interrupt flags.
194 //!
195 //! Returns the mask status of the selected interrupt flag.
196 //!
197 //! \param baseAddress is the base address of the HSPLL module.
198 //!
199 //! \return \b HSPLL_PLL_STATE_UNCHANGED or
200 //! \b HSPLL_PLL_STATE_CHANGED_LOCK_TO_UNLOCK
201 //!
202 //
203 //*****************************************************************************
204 extern uint16_t HSPLL_getInterruptMaskStatus(uint16_t baseAddress);
205 
206 //*****************************************************************************
207 //
208 ///! \brief Enable HSPLL PLLUNLOCK interrupt.
209 //!
210 //! \param baseAddress is the base address of the HSPLL module.
211 //!
212 //! Modified registers are HSPLLIMSC
213 //!
214 //! \return None
215 //
216 //*****************************************************************************
217 extern void HSPLL_enableInterrupt(uint16_t baseAddress);
218 
219 //*****************************************************************************
220 //
221 ///! \brief Disable HSPLL PLLUNLOCK interrupt.
222 //!
223 //! \param baseAddress is the base address of the HSPLL module.
224 //!
225 //! Modified registers are HSPLLIMSC
226 //!
227 //! \return None
228 //
229 //*****************************************************************************
230 extern void HSPLL_disableInterrupt(uint16_t baseAddress);
231 
232 //*****************************************************************************
233 //
234 ///! \brief Clear HSPLL PLLUNLOCK interrupt.
235 //!
236 //! \param baseAddress is the base address of the HSPLL module.
237 //!
238 //! Modified registers are HSPLLICR
239 //!
240 //! \return None
241 //
242 //*****************************************************************************
243 extern void HSPLL_clearInterrupt(uint16_t baseAddress);
244 
245 //*****************************************************************************
246 //
247 ///! \brief Set HSPLL PLLUNLOCK interrupt.
248 //!
249 //! \param baseAddress is the base address of the HSPLL module.
250 //!
251 //! Modified registers are HSPLLISR
252 //!
253 //! \return None
254 //
255 //*****************************************************************************
256 extern void HSPLL_setInterrupt(uint16_t baseAddress);
257 
258 //*****************************************************************************
259 //
260 //! \brief Returns the oscillator status
261 //!
262 //! Returns the oscillator status
263 //!
264 //! \param baseAddress is the base address of the HSPLL module.
265 //!
266 //! \return \b HSPLL_OSCILLATOR_NOT_STARTED or
267 //! \b HSPLL_OSCILLATOR_STARTED
268 //!
269 //
270 //*****************************************************************************
271 extern uint16_t HSPLL_getOscillatorStatus(uint16_t baseAddress);
272 
273 //*****************************************************************************
274 //
275 //! \brief Returns the PLL status
276 //!
277 //! Returns the PLL status
278 //!
279 //! \param baseAddress is the base address of the HSPLL module.
280 //!
281 //! \return \b HSPLL_UNLOCKED or
282 //! \b HSPLL_LOCKED
283 //!
284 //
285 //*****************************************************************************
286 extern uint16_t HSPLL_isLocked(uint16_t baseAddress);
287 
288 //*****************************************************************************
289 //
290 // Mark the end of the C bindings section for C++ compilers.
291 //
292 //*****************************************************************************
293 #ifdef __cplusplus
294 }
295 #endif
296 
297 #endif
298 #endif // __MSP430WARE_HSPLL_H__
299 
void HSPLL_init(uint16_t baseAddress, HSPLL_initParam *param)
Initializes the HSPLL module.
Definition: hspll.c:21
void HSPLL_xtalInit(uint16_t baseAddress, HSPLL_xtalInitParam *param)
Initializes the HSPLL XTAL module.
Definition: hspll.c:32
uint16_t HSPLL_getInterruptMaskStatus(uint16_t baseAddress)
Returns the mask status of the selected interrupt flags.
Definition: hspll.c:45
void HSPLL_clearInterrupt(uint16_t baseAddress)
Clear HSPLL PLLUNLOCK interrupt.
Definition: hspll.c:60
uint16_t HSPLL_getInterruptStatus(uint16_t baseAddress)
Returns the status of the selected interrupt flags.
Definition: hspll.c:40
uint16_t xtlOutput
Definition: hspll.h:138
uint16_t oscillatorEnable
Definition: hspll.h:143
uint16_t frequency
Definition: hspll.h:112
uint16_t oscillatorType
Definition: hspll.h:133
uint16_t HSPLL_getOscillatorStatus(uint16_t baseAddress)
Returns the oscillator status.
Definition: hspll.c:70
Used in the HSPLL_xtalInit() function as the param parameter.
Definition: hspll.h:125
Used in the HSPLL_init() function as the param parameter.
Definition: hspll.h:103
void HSPLL_disableInterrupt(uint16_t baseAddress)
Disable HSPLL PLLUNLOCK interrupt.
Definition: hspll.c:55
uint16_t HSPLL_isLocked(uint16_t baseAddress)
Returns the PLL status.
Definition: hspll.c:75
void HSPLL_enableInterrupt(uint16_t baseAddress)
Enable HSPLL PLLUNLOCK interrupt.
Definition: hspll.c:50
uint16_t lockStatus
Definition: hspll.h:117
void HSPLL_setInterrupt(uint16_t baseAddress)
Set HSPLL PLLUNLOCK interrupt.
Definition: hspll.c:65
uint16_t multiplier
Definition: hspll.h:108

Copyright 2020, Texas Instruments Incorporated