MSP430 DriverLib for MSP430F5xx_6xx Devices  2.91.13.01
ucs.h
1 //*****************************************************************************
2 //
3 // ucs.h - Driver for the UCS Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_UCS_H__
8 #define __MSP430WARE_UCS_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #if defined(__MSP430_HAS_UCS__) || defined(__MSP430_HAS_UCS_RF__)
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 // Internal very low power VLOCLK, low frequency oscillator with 10 kHz typical
28 // frequency
29 //
30 //*****************************************************************************
31 #define UCS_VLOCLK_FREQUENCY 10000
32 
33 //*****************************************************************************
34 //
35 // Internal, trimmed, low-frequency oscillator with 32768 Hz typical frequency
36 //
37 //*****************************************************************************
38 #define UCS_REFOCLK_FREQUENCY 32768
39 
40 //*****************************************************************************
41 //
42 // The following are values that can be passed to the clockSourceDivider
43 // parameter for functions: UCS_initClockSignal().
44 //
45 //*****************************************************************************
46 #define UCS_CLOCK_DIVIDER_1 DIVM__1
47 #define UCS_CLOCK_DIVIDER_2 DIVM__2
48 #define UCS_CLOCK_DIVIDER_4 DIVM__4
49 #define UCS_CLOCK_DIVIDER_8 DIVM__8
50 #define UCS_CLOCK_DIVIDER_12 DIVM__32
51 #define UCS_CLOCK_DIVIDER_16 DIVM__16
52 #define UCS_CLOCK_DIVIDER_32 DIVM__32
53 
54 //*****************************************************************************
55 //
56 // The following are values that can be passed to the selectedClockSignal
57 // parameter for functions: UCS_initClockSignal().
58 //
59 //*****************************************************************************
60 #define UCS_ACLK 0x01
61 #define UCS_MCLK 0x02
62 #define UCS_SMCLK 0x04
63 #define UCS_FLLREF 0x08
64 
65 //*****************************************************************************
66 //
67 // The following are values that can be passed to the clockSource parameter for
68 // functions: UCS_initClockSignal().
69 //
70 //*****************************************************************************
71 #define UCS_XT1CLK_SELECT SELM__XT1CLK
72 #define UCS_VLOCLK_SELECT SELM__VLOCLK
73 #define UCS_REFOCLK_SELECT SELM__REFOCLK
74 #define UCS_DCOCLK_SELECT SELM__DCOCLK
75 #define UCS_DCOCLKDIV_SELECT SELM__DCOCLKDIV
76 #define UCS_XT2CLK_SELECT SELM__XT2CLK
77 
78 //*****************************************************************************
79 //
80 // The following are values that can be passed to the xcap parameter for
81 // functions: UCS_turnOnLFXT1(), and UCS_turnOnLFXT1WithTimeout().
82 //
83 //*****************************************************************************
84 #define UCS_XCAP_0 XCAP_0
85 #define UCS_XCAP_1 XCAP_1
86 #define UCS_XCAP_2 XCAP_2
87 #define UCS_XCAP_3 XCAP_3
88 
89 //*****************************************************************************
90 //
91 // The following are values that can be passed to the xt1drive parameter for
92 // functions: UCS_turnOnLFXT1(), UCS_turnOnHFXT1(),
93 // UCS_turnOnLFXT1WithTimeout(), and UCS_turnOnHFXT1WithTimeout().
94 //
95 //*****************************************************************************
96 #define UCS_XT1_DRIVE_0 XT1DRIVE_0
97 #define UCS_XT1_DRIVE_1 XT1DRIVE_1
98 #define UCS_XT1_DRIVE_2 XT1DRIVE_2
99 #define UCS_XT1_DRIVE_3 XT1DRIVE_3
100 
101 //*****************************************************************************
102 //
103 // The following are values that can be passed to the highOrLowFrequency
104 // parameter for functions: UCS_bypassXT1(), and UCS_bypassXT1WithTimeout().
105 //
106 //*****************************************************************************
107 #define UCS_XT1_HIGH_FREQUENCY XTS
108 #define UCS_XT1_LOW_FREQUENCY 0x00
109 
110 //*****************************************************************************
111 //
112 // The following are values that can be passed to the xt2drive parameter for
113 // functions: UCS_turnOnXT2(), and UCS_turnOnXT2WithTimeout().
114 //
115 //*****************************************************************************
116 #define UCS_XT2_DRIVE_4MHZ_8MHZ XT2DRIVE_0
117 #define UCS_XT2_DRIVE_8MHZ_16MHZ XT2DRIVE_1
118 #define UCS_XT2_DRIVE_16MHZ_24MHZ XT2DRIVE_2
119 #define UCS_XT2_DRIVE_24MHZ_32MHZ XT2DRIVE_3
120 
121 //*****************************************************************************
122 //
123 // The following are values that can be passed to the selectClock parameter for
124 // functions: UCS_enableClockRequest(), and UCS_disableClockRequest().
125 //
126 //*****************************************************************************
127 #define UCS_ACLK 0x01
128 #define UCS_SMCLK 0x04
129 #define UCS_MCLK 0x02
130 #define UCS_MODOSC MODOSCREQEN
131 
132 //*****************************************************************************
133 //
134 // The following are values that can be passed to the mask parameter for
135 // functions: UCS_getFaultFlagStatus(), and UCS_clearFaultFlag() as well as
136 // returned by the UCS_clearAllOscFlagsWithTimeout() function.
137 //
138 //*****************************************************************************
139 #define UCS_XT2OFFG XT2OFFG
140 #define UCS_XT1HFOFFG XT1HFOFFG
141 #define UCS_XT1LFOFFG XT1LFOFFG
142 #define UCS_DCOFFG DCOFFG
143 
144 //*****************************************************************************
145 //
146 // Prototypes for the APIs.
147 //
148 //*****************************************************************************
149 
150 //*****************************************************************************
151 //
152 //! \brief Sets the external clock source
153 //!
154 //! This function sets the external clock sources XT1 and XT2 crystal
155 //! oscillator frequency values. This function must be called if an external
156 //! crystal XT1 or XT2 is used and the user intends to call UCS_getMCLK,
157 //! UCS_getSMCLK or UCS_getACLK APIs. If not, it is not necessary to invoke
158 //! this API.
159 //!
160 //! \param XT1CLK_frequency is the XT1 crystal frequencies in Hz
161 //! \param XT2CLK_frequency is the XT2 crystal frequencies in Hz
162 //!
163 //! \return None
164 //
165 //*****************************************************************************
166 extern void UCS_setExternalClockSource(uint32_t XT1CLK_frequency,
167  uint32_t XT2CLK_frequency);
168 
169 //*****************************************************************************
170 //
171 //! \brief Initializes a clock signal
172 //!
173 //! This function initializes each of the clock signals. The user must ensure
174 //! that this function is called for each clock signal. If not, the default
175 //! state is assumed for the particular clock signal. Refer MSP430Ware
176 //! documentation for UCS module or Device Family User's Guide for details of
177 //! default clock signal states.
178 //!
179 //! \param selectedClockSignal selected clock signal
180 //! Valid values are:
181 //! - \b UCS_ACLK
182 //! - \b UCS_MCLK
183 //! - \b UCS_SMCLK
184 //! - \b UCS_FLLREF
185 //! \param clockSource is clock source for the selectedClockSignal
186 //! Valid values are:
187 //! - \b UCS_XT1CLK_SELECT
188 //! - \b UCS_VLOCLK_SELECT
189 //! - \b UCS_REFOCLK_SELECT
190 //! - \b UCS_DCOCLK_SELECT
191 //! - \b UCS_DCOCLKDIV_SELECT
192 //! - \b UCS_XT2CLK_SELECT
193 //! \param clockSourceDivider selected the clock divider to calculate
194 //! clocksignal from clock source.
195 //! Valid values are:
196 //! - \b UCS_CLOCK_DIVIDER_1 [Default]
197 //! - \b UCS_CLOCK_DIVIDER_2
198 //! - \b UCS_CLOCK_DIVIDER_4
199 //! - \b UCS_CLOCK_DIVIDER_8
200 //! - \b UCS_CLOCK_DIVIDER_12 - [Valid only for UCS_FLLREF]
201 //! - \b UCS_CLOCK_DIVIDER_16
202 //! - \b UCS_CLOCK_DIVIDER_32 - [Not valid for UCS_FLLREF]
203 //!
204 //! Modified bits of \b UCSCTL5 register, bits of \b UCSCTL4 register and bits
205 //! of \b UCSCTL3 register.
206 //!
207 //! \return None
208 //
209 //*****************************************************************************
210 extern void UCS_initClockSignal(uint8_t selectedClockSignal,
211  uint16_t clockSource,
212  uint16_t clockSourceDivider);
213 
214 //*****************************************************************************
215 //
216 //! \brief Initializes the XT1 crystal oscillator in low frequency mode
217 //!
218 //! Initializes the XT1 crystal oscillator in low frequency mode. Loops until
219 //! all oscillator fault flags are cleared, with no timeout. See the device-
220 //! specific data sheet for appropriate drive settings.
221 //!
222 //! \param xt1drive is the target drive strength for the XT1 crystal
223 //! oscillator.
224 //! Valid values are:
225 //! - \b UCS_XT1_DRIVE_0
226 //! - \b UCS_XT1_DRIVE_1
227 //! - \b UCS_XT1_DRIVE_2
228 //! - \b UCS_XT1_DRIVE_3 [Default]
229 //! \n Modified bits are \b XT1DRIVE of \b UCSCTL6 register.
230 //! \param xcap is the selected capacitor value. This parameter selects the
231 //! capacitors applied to the LF crystal (XT1) or resonator in the LF
232 //! mode. The effective capacitance (seen by the crystal) is Ceff. (CXIN
233 //! + 2 pF)/2. It is assumed that CXIN = CXOUT and that a parasitic
234 //! capacitance of 2 pF is added by the package and the printed circuit
235 //! board. For details about the typical internal and the effective
236 //! capacitors, refer to the device-specific data sheet.
237 //! Valid values are:
238 //! - \b UCS_XCAP_0
239 //! - \b UCS_XCAP_1
240 //! - \b UCS_XCAP_2
241 //! - \b UCS_XCAP_3 [Default]
242 //!
243 //! Modified bits are \b XCAP of \b UCSCTL6 register.
244 //!
245 //! \return None
246 //
247 //*****************************************************************************
248 extern void UCS_turnOnLFXT1(uint16_t xt1drive,
249  uint8_t xcap);
250 
251 //*****************************************************************************
252 //
253 //! \brief Initializes the XT1 crystal oscillator in high frequency mode
254 //!
255 //! Initializes the XT1 crystal oscillator in high frequency mode. Loops until
256 //! all oscillator fault flags are cleared, with no timeout. See the device-
257 //! specific data sheet for appropriate drive settings.
258 //!
259 //! \param xt1drive is the target drive strength for the XT1 crystal
260 //! oscillator.
261 //! Valid values are:
262 //! - \b UCS_XT1_DRIVE_0
263 //! - \b UCS_XT1_DRIVE_1
264 //! - \b UCS_XT1_DRIVE_2
265 //! - \b UCS_XT1_DRIVE_3 [Default]
266 //!
267 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
268 //! of \b SFRIFG register.
269 //!
270 //! \return None
271 //
272 //*****************************************************************************
273 extern void UCS_turnOnHFXT1(uint16_t xt1drive);
274 
275 //*****************************************************************************
276 //
277 //! \brief Bypass the XT1 crystal oscillator
278 //!
279 //! Bypasses the XT1 crystal oscillator. Loops until all oscillator fault flags
280 //! are cleared, with no timeout.
281 //!
282 //! \param highOrLowFrequency selects high frequency or low frequency mode for
283 //! XT1.
284 //! Valid values are:
285 //! - \b UCS_XT1_HIGH_FREQUENCY
286 //! - \b UCS_XT1_LOW_FREQUENCY [Default]
287 //!
288 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
289 //! of \b SFRIFG register.
290 //!
291 //! \return None
292 //
293 //*****************************************************************************
294 extern void UCS_bypassXT1(uint8_t highOrLowFrequency);
295 
296 //*****************************************************************************
297 //
298 //! \brief Initializes the XT1 crystal oscillator in low frequency mode with
299 //! timeout
300 //!
301 //! Initializes the XT1 crystal oscillator in low frequency mode with timeout.
302 //! Loops until all oscillator fault flags are cleared or until a timeout
303 //! counter is decremented and equals to zero. See the device-specific
304 //! datasheet for appropriate drive settings.
305 //!
306 //! \param xt1drive is the target drive strength for the XT1 crystal
307 //! oscillator.
308 //! Valid values are:
309 //! - \b UCS_XT1_DRIVE_0
310 //! - \b UCS_XT1_DRIVE_1
311 //! - \b UCS_XT1_DRIVE_2
312 //! - \b UCS_XT1_DRIVE_3 [Default]
313 //! \param xcap is the selected capacitor value. This parameter selects the
314 //! capacitors applied to the LF crystal (XT1) or resonator in the LF
315 //! mode. The effective capacitance (seen by the crystal) is Ceff. (CXIN
316 //! + 2 pF)/2. It is assumed that CXIN = CXOUT and that a parasitic
317 //! capacitance of 2 pF is added by the package and the printed circuit
318 //! board. For details about the typical internal and the effective
319 //! capacitors, refer to the device-specific data sheet.
320 //! Valid values are:
321 //! - \b UCS_XCAP_0
322 //! - \b UCS_XCAP_1
323 //! - \b UCS_XCAP_2
324 //! - \b UCS_XCAP_3 [Default]
325 //! \param timeout is the count value that gets decremented every time the loop
326 //! that clears oscillator fault flags gets executed.
327 //!
328 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
329 //! of \b SFRIFG register.
330 //!
331 //! \return STATUS_SUCCESS or STATUS_FAIL
332 //
333 //*****************************************************************************
334 extern bool UCS_turnOnLFXT1WithTimeout(uint16_t xt1drive,
335  uint8_t xcap,
336  uint16_t timeout);
337 
338 //*****************************************************************************
339 //
340 //! \brief Initializes the XT1 crystal oscillator in high frequency mode with
341 //! timeout
342 //!
343 //! Initializes the XT1 crystal oscillator in high frequency mode with timeout.
344 //! Loops until all oscillator fault flags are cleared or until a timeout
345 //! counter is decremented and equals to zero. See the device-specific data
346 //! sheet for appropriate drive settings.
347 //!
348 //! \param xt1drive is the target drive strength for the XT1 crystal
349 //! oscillator.
350 //! Valid values are:
351 //! - \b UCS_XT1_DRIVE_0
352 //! - \b UCS_XT1_DRIVE_1
353 //! - \b UCS_XT1_DRIVE_2
354 //! - \b UCS_XT1_DRIVE_3 [Default]
355 //! \param timeout is the count value that gets decremented every time the loop
356 //! that clears oscillator fault flags gets executed.
357 //!
358 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
359 //! of \b SFRIFG register.
360 //!
361 //! \return STATUS_SUCCESS or STATUS_FAIL
362 //
363 //*****************************************************************************
364 extern bool UCS_turnOnHFXT1WithTimeout(uint16_t xt1drive,
365  uint16_t timeout);
366 
367 //*****************************************************************************
368 //
369 //! \brief Bypasses the XT1 crystal oscillator with time out
370 //!
371 //! Bypasses the XT1 crystal oscillator with time out. Loops until all
372 //! oscillator fault flags are cleared or until a timeout counter is
373 //! decremented and equals to zero.
374 //!
375 //! \param highOrLowFrequency selects high frequency or low frequency mode for
376 //! XT1.
377 //! Valid values are:
378 //! - \b UCS_XT1_HIGH_FREQUENCY
379 //! - \b UCS_XT1_LOW_FREQUENCY [Default]
380 //! \param timeout is the count value that gets decremented every time the loop
381 //! that clears oscillator fault flags gets executed.
382 //!
383 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
384 //! of \b SFRIFG register.
385 //!
386 //! \return STATUS_SUCCESS or STATUS_FAIL
387 //
388 //*****************************************************************************
389 extern bool UCS_bypassXT1WithTimeout(uint8_t highOrLowFrequency,
390  uint16_t timeout);
391 
392 //*****************************************************************************
393 //
394 //! \brief Stops the XT1 oscillator using the XT1OFF bit.
395 //!
396 //!
397 //! \return None
398 //
399 //*****************************************************************************
400 extern void UCS_turnOffXT1(void);
401 
402 //*****************************************************************************
403 //
404 //! \brief Initializes the XT2 crystal oscillator
405 //!
406 //! Initializes the XT2 crystal oscillator, which supports crystal frequencies
407 //! between 4 MHz and 32 MHz, depending on the selected drive strength. Loops
408 //! until all oscillator fault flags are cleared, with no timeout. See the
409 //! device-specific data sheet for appropriate drive settings.
410 //!
411 //! \param xt2drive is the target drive strength for the XT2 crystal
412 //! oscillator.
413 //! Valid values are:
414 //! - \b UCS_XT2_DRIVE_4MHZ_8MHZ
415 //! - \b UCS_XT2_DRIVE_8MHZ_16MHZ
416 //! - \b UCS_XT2_DRIVE_16MHZ_24MHZ
417 //! - \b UCS_XT2_DRIVE_24MHZ_32MHZ [Default]
418 //!
419 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
420 //! of \b SFRIFG register.
421 //!
422 //! \return None
423 //
424 //*****************************************************************************
425 extern void UCS_turnOnXT2(uint16_t xt2drive);
426 
427 //*****************************************************************************
428 //
429 //! \brief Bypasses the XT2 crystal oscillator
430 //!
431 //! Bypasses the XT2 crystal oscillator, which supports crystal frequencies
432 //! between 4 MHz and 32 MHz. Loops until all oscillator fault flags are
433 //! cleared, with no timeout.
434 //!
435 //!
436 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
437 //! of \b SFRIFG register.
438 //!
439 //! \return None
440 //
441 //*****************************************************************************
442 extern void UCS_bypassXT2(void);
443 
444 //*****************************************************************************
445 //
446 //! \brief Initializes the XT2 crystal oscillator with timeout
447 //!
448 //! Initializes the XT2 crystal oscillator, which supports crystal frequencies
449 //! between 4 MHz and 32 MHz, depending on the selected drive strength. Loops
450 //! until all oscillator fault flags are cleared or until a timeout counter is
451 //! decremented and equals to zero. See the device-specific data sheet for
452 //! appropriate drive settings.
453 //!
454 //! \param xt2drive is the target drive strength for the XT2 crystal
455 //! oscillator.
456 //! Valid values are:
457 //! - \b UCS_XT2_DRIVE_4MHZ_8MHZ
458 //! - \b UCS_XT2_DRIVE_8MHZ_16MHZ
459 //! - \b UCS_XT2_DRIVE_16MHZ_24MHZ
460 //! - \b UCS_XT2_DRIVE_24MHZ_32MHZ [Default]
461 //! \param timeout is the count value that gets decremented every time the loop
462 //! that clears oscillator fault flags gets executed.
463 //!
464 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
465 //! of \b SFRIFG register.
466 //!
467 //! \return STATUS_SUCCESS or STATUS_FAIL
468 //
469 //*****************************************************************************
470 extern bool UCS_turnOnXT2WithTimeout(uint16_t xt2drive,
471  uint16_t timeout);
472 
473 //*****************************************************************************
474 //
475 //! \brief Bypasses the XT2 crystal oscillator with timeout
476 //!
477 //! Bypasses the XT2 crystal oscillator, which supports crystal frequencies
478 //! between 4 MHz and 32 MHz. Loops until all oscillator fault flags are
479 //! cleared or until a timeout counter is decremented and equals to zero.
480 //!
481 //! \param timeout is the count value that gets decremented every time the loop
482 //! that clears oscillator fault flags gets executed.
483 //!
484 //! Modified bits of \b UCSCTL7 register, bits of \b UCSCTL6 register and bits
485 //! of \b SFRIFG register.
486 //!
487 //! \return STATUS_SUCCESS or STATUS_FAIL
488 //
489 //*****************************************************************************
490 extern bool UCS_bypassXT2WithTimeout(uint16_t timeout);
491 
492 //*****************************************************************************
493 //
494 //! \brief Stops the XT2 oscillator using the XT2OFF bit.
495 //!
496 //!
497 //! Modified bits of \b UCSCTL6 register.
498 //!
499 //! \return None
500 //
501 //*****************************************************************************
502 extern void UCS_turnOffXT2(void);
503 
504 //*****************************************************************************
505 //
506 //! \brief Initializes the DCO to operate a frequency that is a multiple of the
507 //! reference frequency into the FLL
508 //!
509 //! Initializes the DCO to operate a frequency that is a multiple of the
510 //! reference frequency into the FLL. Loops until all oscillator fault flags
511 //! are cleared, with a timeout. If the frequency is greater than 16 MHz, the
512 //! function sets the MCLK and SMCLK source to the undivided DCO frequency.
513 //! Otherwise, the function sets the MCLK and SMCLK source to the DCOCLKDIV
514 //! frequency. This function executes a software delay that is proportional in
515 //! length to the ratio of the target FLL frequency and the FLL reference. The
516 //! function PMM_setVCore() is required to call first if the target frequency
517 //! is beyond current Vcore supported frequency range.
518 //!
519 //! \param fsystem is the target frequency for MCLK in kHz
520 //! \param ratio is the ratio x/y, where x = fsystem and y = FLL reference
521 //! frequency.
522 //!
523 //! Modified bits of \b UCSCTL0 register, bits of \b UCSCTL4 register, bits of
524 //! \b UCSCTL7 register, bits of \b UCSCTL1 register, bits of \b SFRIFG1
525 //! register and bits of \b UCSCTL2 register.
526 //!
527 //! \return None
528 //
529 //*****************************************************************************
530 extern void UCS_initFLLSettle(uint16_t fsystem,
531  uint16_t ratio);
532 
533 //*****************************************************************************
534 //
535 //! \brief Initializes the DCO to operate a frequency that is a multiple of the
536 //! reference frequency into the FLL
537 //!
538 //! Initializes the DCO to operate a frequency that is a multiple of the
539 //! reference frequency into the FLL. Loops until all oscillator fault flags
540 //! are cleared, with no timeout. If the frequency is greater than 16 MHz, the
541 //! function sets the MCLK and SMCLK source to the undivided DCO frequency.
542 //! Otherwise, the function sets the MCLK and SMCLK source to the DCOCLKDIV
543 //! frequency. The function PMM_setVCore() is required to call first if the
544 //! target frequency is beyond current Vcore supported frequency range.
545 //!
546 //! \param fsystem is the target frequency for MCLK in kHz
547 //! \param ratio is the ratio x/y, where x = fsystem and y = FLL reference
548 //! frequency.
549 //!
550 //! Modified bits of \b UCSCTL0 register, bits of \b UCSCTL4 register, bits of
551 //! \b UCSCTL7 register, bits of \b UCSCTL1 register, bits of \b SFRIFG1
552 //! register and bits of \b UCSCTL2 register.
553 //!
554 //! \return None
555 //
556 //*****************************************************************************
557 extern void UCS_initFLL(uint16_t fsystem,
558  uint16_t ratio);
559 
560 //*****************************************************************************
561 //
562 //! \brief Enables conditional module requests
563 //!
564 //! \param selectClock selects specific request enables
565 //! Valid values are:
566 //! - \b UCS_ACLK
567 //! - \b UCS_SMCLK
568 //! - \b UCS_MCLK
569 //! - \b UCS_MODOSC
570 //!
571 //! Modified bits of \b UCSCTL8 register.
572 //!
573 //! \return None
574 //
575 //*****************************************************************************
576 extern void UCS_enableClockRequest(uint8_t selectClock);
577 
578 //*****************************************************************************
579 //
580 //! \brief Disables conditional module requests
581 //!
582 //! \param selectClock selects specific request disable
583 //! Valid values are:
584 //! - \b UCS_ACLK
585 //! - \b UCS_SMCLK
586 //! - \b UCS_MCLK
587 //! - \b UCS_MODOSC
588 //!
589 //! Modified bits of \b UCSCTL8 register.
590 //!
591 //! \return None
592 //
593 //*****************************************************************************
594 extern void UCS_disableClockRequest(uint8_t selectClock);
595 
596 //*****************************************************************************
597 //
598 //! \brief Gets the current UCS fault flag status.
599 //!
600 //! \param mask is the masked interrupt flag status to be returned. Mask
601 //! parameter can be either any of the following selection.
602 //! Valid values are:
603 //! - \b UCS_XT2OFFG - XT2 oscillator fault flag
604 //! - \b UCS_XT1HFOFFG - XT1 oscillator fault flag (HF mode)
605 //! - \b UCS_XT1LFOFFG - XT1 oscillator fault flag (LF mode)
606 //! - \b UCS_DCOFFG - DCO fault flag
607 //!
608 //
609 //*****************************************************************************
610 extern uint8_t UCS_getFaultFlagStatus(uint8_t mask);
611 
612 //*****************************************************************************
613 //
614 //! \brief Clears the current UCS fault flag status for the masked bit.
615 //!
616 //! \param mask is the masked interrupt flag status to be returned. mask
617 //! parameter can be any one of the following
618 //! Valid values are:
619 //! - \b UCS_XT2OFFG - XT2 oscillator fault flag
620 //! - \b UCS_XT1HFOFFG - XT1 oscillator fault flag (HF mode)
621 //! - \b UCS_XT1LFOFFG - XT1 oscillator fault flag (LF mode)
622 //! - \b UCS_DCOFFG - DCO fault flag
623 //!
624 //! Modified bits of \b UCSCTL7 register.
625 //!
626 //! \return None
627 //
628 //*****************************************************************************
629 extern void UCS_clearFaultFlag(uint8_t mask);
630 
631 //*****************************************************************************
632 //
633 //! \brief Turns off SMCLK using the SMCLKOFF bit
634 //!
635 //!
636 //! Modified bits of \b UCSCTL6 register.
637 //!
638 //! \return None
639 //
640 //*****************************************************************************
641 extern void UCS_turnOffSMCLK(void);
642 
643 //*****************************************************************************
644 //
645 //! \brief Turns ON SMCLK using the SMCLKOFF bit
646 //!
647 //!
648 //! Modified bits of \b UCSCTL6 register.
649 //!
650 //! \return None
651 //
652 //*****************************************************************************
653 extern void UCS_turnOnSMCLK(void);
654 
655 //*****************************************************************************
656 //
657 //! \brief Get the current ACLK frequency
658 //!
659 //! Get the current ACLK frequency. The user of this API must ensure that
660 //! UCS_setExternalClockSource API was invoked before in case XT1 or XT2 is
661 //! being used.
662 //!
663 //!
664 //! \return Current ACLK frequency in Hz
665 //
666 //*****************************************************************************
667 extern uint32_t UCS_getACLK(void);
668 
669 //*****************************************************************************
670 //
671 //! \brief Get the current SMCLK frequency
672 //!
673 //! Get the current SMCLK frequency. The user of this API must ensure that
674 //! UCS_setExternalClockSource API was invoked before in case XT1 or XT2 is
675 //! being used.
676 //!
677 //!
678 //! \return Current SMCLK frequency in Hz
679 //
680 //*****************************************************************************
681 extern uint32_t UCS_getSMCLK(void);
682 
683 //*****************************************************************************
684 //
685 //! \brief Get the current MCLK frequency
686 //!
687 //! Get the current MCLK frequency. The user of this API must ensure that
688 //! UCS_setExternalClockSource API was invoked before in case XT1 or XT2 is
689 //! being used.
690 //!
691 //!
692 //! \return Current MCLK frequency in Hz
693 //
694 //*****************************************************************************
695 extern uint32_t UCS_getMCLK(void);
696 
697 //*****************************************************************************
698 //
699 //! \brief Clears all the Oscillator Flags
700 //!
701 //! \param timeout is the count value that gets decremented every time the loop
702 //! that clears oscillator fault flags gets executed.
703 //!
704 //! \return Logical OR of any of the following:
705 //! - \b UCS_XT2OFFG XT2 oscillator fault flag
706 //! - \b UCS_XT1HFOFFG XT1 oscillator fault flag (HF mode)
707 //! - \b UCS_XT1LFOFFG XT1 oscillator fault flag (LF mode)
708 //! - \b UCS_DCOFFG DCO fault flag
709 //! \n indicating the status of the oscillator fault flags
710 //
711 //*****************************************************************************
712 extern uint16_t UCS_clearAllOscFlagsWithTimeout(uint16_t timeout);
713 
714 //*****************************************************************************
715 //
716 // Mark the end of the C bindings section for C++ compilers.
717 //
718 //*****************************************************************************
719 #ifdef __cplusplus
720 }
721 #endif
722 
723 #endif
724 #endif // __MSP430WARE_UCS_H__
void UCS_initFLLSettle(uint16_t fsystem, uint16_t ratio)
Initializes the DCO to operate a frequency that is a multiple of the reference frequency into the FLL...
Definition: ucs.c:710
void UCS_bypassXT1(uint8_t highOrLowFrequency)
Bypass the XT1 crystal oscillator.
Definition: ucs.c:383
void UCS_clearFaultFlag(uint8_t mask)
Clears the current UCS fault flag status for the masked bit.
Definition: ucs.c:830
void UCS_turnOnSMCLK(void)
Turns ON SMCLK using the SMCLKOFF bit.
Definition: ucs.c:842
void UCS_turnOnXT2(uint16_t xt2drive)
Initializes the XT2 crystal oscillator.
Definition: ucs.c:567
void UCS_turnOnLFXT1(uint16_t xt1drive, uint8_t xcap)
Initializes the XT1 crystal oscillator in low frequency mode.
Definition: ucs.c:312
uint8_t UCS_getFaultFlagStatus(uint8_t mask)
Gets the current UCS fault flag status.
Definition: ucs.c:823
void UCS_initClockSignal(uint8_t selectedClockSignal, uint16_t clockSource, uint16_t clockSourceDivider)
Initializes a clock signal.
Definition: ucs.c:238
void UCS_bypassXT2(void)
Bypasses the XT2 crystal oscillator.
Definition: ucs.c:603
uint16_t UCS_clearAllOscFlagsWithTimeout(uint16_t timeout)
Clears all the Oscillator Flags.
Definition: ucs.c:892
void UCS_turnOnHFXT1(uint16_t xt1drive)
Initializes the XT1 crystal oscillator in high frequency mode.
Definition: ucs.c:353
bool UCS_turnOnHFXT1WithTimeout(uint16_t xt1drive, uint16_t timeout)
Initializes the XT1 crystal oscillator in high frequency mode with timeout.
Definition: ucs.c:469
void UCS_initFLL(uint16_t fsystem, uint16_t ratio)
Initializes the DCO to operate a frequency that is a multiple of the reference frequency into the FLL...
Definition: ucs.c:724
void UCS_disableClockRequest(uint8_t selectClock)
Disables conditional module requests.
Definition: ucs.c:817
bool UCS_bypassXT2WithTimeout(uint16_t timeout)
Bypasses the XT2 crystal oscillator with timeout.
Definition: ucs.c:671
uint32_t UCS_getACLK(void)
Get the current ACLK frequency.
Definition: ucs.c:847
void UCS_turnOffSMCLK(void)
Turns off SMCLK using the SMCLKOFF bit.
Definition: ucs.c:837
void UCS_turnOffXT2(void)
Stops the XT2 oscillator using the XT2OFF bit.
Definition: ucs.c:704
bool UCS_turnOnXT2WithTimeout(uint16_t xt2drive, uint16_t timeout)
Initializes the XT2 crystal oscillator with timeout.
Definition: ucs.c:627
uint32_t UCS_getMCLK(void)
Get the current MCLK frequency.
Definition: ucs.c:879
uint32_t UCS_getSMCLK(void)
Get the current SMCLK frequency.
Definition: ucs.c:863
void UCS_setExternalClockSource(uint32_t XT1CLK_frequency, uint32_t XT2CLK_frequency)
Sets the external clock source.
Definition: ucs.c:230
bool UCS_bypassXT1WithTimeout(uint8_t highOrLowFrequency, uint16_t timeout)
Bypasses the XT1 crystal oscillator with time out.
Definition: ucs.c:514
bool UCS_turnOnLFXT1WithTimeout(uint16_t xt1drive, uint8_t xcap, uint16_t timeout)
Initializes the XT1 crystal oscillator in low frequency mode with timeout.
Definition: ucs.c:421
void UCS_turnOffXT1(void)
Stops the XT1 oscillator using the XT1OFF bit.
Definition: ucs.c:561
void UCS_enableClockRequest(uint8_t selectClock)
Enables conditional module requests.
Definition: ucs.c:811

Copyright 2020, Texas Instruments Incorporated