2 * -------------------------------------------
3 * MSP432 DriverLib - v01_04_00_18
4 * -------------------------------------------
6 * --COPYRIGHT--,BSD,BSD
7 * Copyright (c) 2015, Texas Instruments Incorporated
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * * Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * * Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * * Neither the name of Texas Instruments Incorporated nor the names of
22 * its contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
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,
27 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
29 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
32 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
33 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
34 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
35 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 //*****************************************************************************
42 //! \addtogroup cs_api
45 //*****************************************************************************
47 //*****************************************************************************
49 // If building with a C++ compiler, make all of the definitions in this header
52 //*****************************************************************************
62 //*****************************************************************************
64 // Control specific variables
66 //*****************************************************************************
67 #define CS_CLOCK_DIVIDER_1 DIVS_0
68 #define CS_CLOCK_DIVIDER_2 DIVS_1
69 #define CS_CLOCK_DIVIDER_4 DIVS_2
70 #define CS_CLOCK_DIVIDER_8 DIVS_3
71 #define CS_CLOCK_DIVIDER_16 DIVS_4
72 #define CS_CLOCK_DIVIDER_32 DIVS_5
73 #define CS_CLOCK_DIVIDER_64 DIVS_6
74 #define CS_CLOCK_DIVIDER_128 DIVS_7
76 #define CS_LFXTCLK_SELECT SELM_0
77 #define CS_HFXTCLK_SELECT SELM_5
78 #define CS_VLOCLK_SELECT SELM_1
79 #define CS_REFOCLK_SELECT SELM_2
80 #define CS_DCOCLK_SELECT SELM_3
81 #define CS_MODOSC_SELECT SELM_4
85 /* Number of positions to shift for divider calculation */
86 #define CS_ACLK_DIV_BITPOS 0x04
87 #define CS_MCLK_DIV_BITPOS 0x0C
88 #define CS_SMCLK_DIV_BITPOS 0x00
89 #define CS_HSMCLK_DIV_BITPOS 0x08
91 /* Number of positions to shift for source calculation */
92 #define CS_ACLK_SRC_BITPOS 0x08
93 #define CS_MCLK_SRC_BITPOS 0x00
94 #define CS_SMCLK_SRC_BITPOS 0x04
95 #define CS_HSMCLK_SRC_BITPOS 0x04
97 /* REFO Clock Values */
98 #define CS_REFO_32KHZ 0x00
99 #define CS_REFO_128KHZ 0x01
101 /* Frequency Values */
102 #define CS_VLOCLK_FREQUENCY 10000
103 #define CS_MODCLK_FREQUENCY 24000000
106 #define CS_LFXT_FAULT LFXTIE
107 #define CS_HFXT_FAULT HFXTIE
108 #define CS_DCOMIN_FAULT DCOMINIE
109 #define CS_DCOMAX_FAULT DCOMAXIE
110 #define CS_DCORESISTOR_FAULT DCORIE
111 #define CS_STARTCOUNT_LFXT_FAULT FCNTLFIE
112 #define CS_STARTCOUNT_HFXT_FAULT FCNTHFIE
113 #define CS_PLL_OUTOFLOCK PLLOOLIE
114 #define CS_PLL_OUTOFSIGNAL PLLLOSIE
115 #define CS_PLL_OUTOFRANGE PLLOORIE
116 #define CS_REFCNT_PERIOD_COUNTER CALIE
118 #define CS_HFXT_DRIVE0 CS_CTL2_HFXTDRIVE_0
119 #define CS_HFXT_DRIVE1 CS_CTL2_HFXTDRIVE_1
120 #define CS_HFXT_BYPASS CS_CTL2_HFXTBYPASS
122 #define CS_LFXT_DRIVE0 LFXTDRIVE_0
123 #define CS_LFXT_DRIVE1 LFXTDRIVE_1
124 #define CS_LFXT_DRIVE2 LFXTDRIVE_2
125 #define CS_LFXT_DRIVE3 LFXTDRIVE_3
126 #define CS_LFXT_BYPASS LFXTBYPASS
128 #define CS_ACLK ACLK_EN
129 #define CS_MCLK MCLK_EN
130 #define CS_SMCLK SMCLK_EN
131 #define CS_HSMCLK HSMCLK_EN
132 #define CS_BCLK BCLK_READY
134 #define CS_LFXTCLK 0x01
136 #define CS_1MHZ 1000000
137 #define CS_15MHZ 1500000
138 #define CS_3MHZ 3000000
139 #define CS_4MHZ 4000000
140 #define CS_6MHZ 6000000
141 #define CS_8MHZ 8000000
142 #define CS_12MHZ 12000000
143 #define CS_16MHZ 16000000
144 #define CS_24MHZ 24000000
145 #define CS_32MHZ 32000000
146 #define CS_40MHZ 40000000
147 #define CS_48MHZ 48000000
149 #define CS_DCO_FREQUENCY_1_5 DCORSEL_0
150 #define CS_DCO_FREQUENCY_3 DCORSEL_1
151 #define CS_DCO_FREQUENCY_6 DCORSEL_2
152 #define CS_DCO_FREQUENCY_12 DCORSEL_3
153 #define CS_DCO_FREQUENCY_24 DCORSEL_4
154 #define CS_DCO_FREQUENCY_48 DCORSEL_5
156 #define CS_HFXT_FAULT_COUNTER 0x01
157 #define CS_LFXT_FAULT_COUNTER 0x02
159 #define CS_FAULT_COUNTER_4096_CYCLES FCNTLF_0
160 #define CS_FAULT_COUNTER_8192_CYCLES FCNTLF_1
161 #define CS_FAULT_COUNTER_16384_CYCLES FCNTLF_2
162 #define CS_FAULT_COUNTER_32768_CYCLES FCNTLF_3
164 //******************************************************************************
166 //! This function sets the external clock sources LFXT and HFXT crystal
167 //! oscillator frequency values. This function must be called if an external
168 //! crystal LFXT or HFXT is used and the user intends to call
169 //! CS_getSMCLK, CS_getMCLK, CS_getBCLK, CS_getHSMCLK, CS_getACLK and
170 //! any of the HFXT oscillator control functions
172 //! \param lfxt_XT_CLK_frequency is the LFXT crystal frequencies in Hz
173 //! \param hfxt_XT_CLK_frequency is the HFXT crystal frequencies in Hz
177 //******************************************************************************
178 extern void CS_setExternalClockSourceFrequency(uint32_t lfxt_XT_CLK_frequency,
179 uint32_t hfxt_XT_CLK_frequency);
181 //******************************************************************************
183 //! This function initializes each of the clock signals. The user must ensure
184 //! that this function is called for each clock signal. If not, the default
185 //! state is assumed for the particular clock signal. Refer to DriverLib
186 //! documentation for CS module or Device Family User's Guide for details of
187 //! default clock signal states.
189 //! Note that this function is blocking and will wait on the appropriate bit
190 //! to be set in the CSSTAT READY register to be set before setting the clock
193 //! HFXTCLK is not available for BCLK or ACLK.
195 //! \param selectedClockSignal Clock signal to initialize.
200 //! - \b CS_BCLK [clockSourceDivider is ignored for this parameter]
201 //! \param clockSource Clock source for the selectedClockSignal signal.
202 //! - \b CS_LFXTCLK_SELECT,
203 //! - \b CS_HFXTCLK_SELECT,
204 //! - \b CS_VLOCLK_SELECT, [Not available for BCLK]
205 //! - \b CS_DCOCLK_SELECT, [Not available for ACLK, BCLK]
206 //! - \b CS_REFOCLK_SELECT,
207 //! - \b CS_MODOSC_SELECT [Not available for ACLK, BCLK]
208 //! \param clockSourceDivider - selected the clock divider to calculate
209 //! clock signal from clock source. This parameter is ignored when
210 //! setting BLCK. Valid values are:
211 //! - \b CS_CLOCK_DIVIDER_1,
212 //! - \b CS_CLOCK_DIVIDER_2,
213 //! - \b CS_CLOCK_DIVIDER_4,
214 //! - \b CS_CLOCK_DIVIDER_8,
215 //! - \b CS_CLOCK_DIVIDER_16,
216 //! - \b CS_CLOCK_DIVIDER_32,
217 //! - \b CS_CLOCK_DIVIDER_64,
218 //! - \b CS_CLOCK_DIVIDER_128
222 //******************************************************************************
223 extern void CS_initClockSignal(uint32_t selectedClockSignal,
224 uint32_t clockSource, uint32_t clockSourceDivider);
226 //******************************************************************************
228 //! Initializes the HFXT crystal oscillator, which supports crystal frequencies
229 //! between 0 MHz and 48 MHz, depending on the selected drive strength. Loops
230 //! until all oscillator fault flags are cleared, with no timeout. See the
231 //! device-specific data sheet for appropriate drive settings. NOTE: User must
232 //! call CS_setExternalClockSourceFrequency to set frequency of external clocks
233 //! before calling this function.
235 //! \param bypassMode When this variable is set, the oscillator will start
236 //! in bypass mode and the signal can be generated by a digital square wave.
241 //******************************************************************************
242 extern void CS_startHFXT(bool bypassMode);
244 //******************************************************************************
246 //! Initializes the HFXT crystal oscillator, which supports crystal frequencies
247 //! between 0 MHz and 48 MHz, depending on the selected drive strength. Loops
248 //! until all oscillator fault flags are cleared, with no timeout. See the
249 //! device-specific data sheet for appropriate drive settings. NOTE: User must
250 //! call CS_setExternalClockSourceFrequency to set frequency of external clocks
251 //! before calling this function. This function has a timeout associated with
252 //! stabilizing the oscillator.
254 //! \param bypassMode When this variable is set, the oscillator will start
255 //! in bypass mode and the signal can be generated by a digital square wave.
257 //! \param timeout is the count value that gets decremented every time the loop
258 //! that clears oscillator fault flags gets executed.
262 //******************************************************************************
263 extern void CS_startHFXTWithTimeout(bool bypassMode, uint32_t timeout);
265 //******************************************************************************
267 //! Initializes the LFXT crystal oscillator, which supports crystal frequencies
268 //! up to 50kHz, depending on the selected drive strength. Loops
269 //! until all oscillator fault flags are cleared, with no timeout. See the
270 //! device-specific data sheet for appropriate drive settings. NOTE: User must
271 //! call CS_setExternalClockSourceFrequency to set frequency of external clocks
272 //! before calling this function.
274 //! \param xtDrive is the target drive strength for the LFXT crystal
276 //! Valid values are:
277 //! - \b CS_LFXT_DRIVE0,
278 //! - \b CS_LFXT_DRIVE1,
279 //! - \b CS_LFXT_DRIVE2,
280 //! - \b CS_LFXT_DRIVE3, [Default Value]
281 //! - \b CS_LFXT_BYPASS
283 //! \note When CS_LFXT_BYPASS is passed as a parameter the oscillator will start
284 //! in bypass mode and the signal can be generated by a digital square wave.
289 //******************************************************************************
290 extern void CS_startLFXT(uint32_t xtDrive);
292 //******************************************************************************
294 //! Initializes the LFXT crystal oscillator, which supports crystal frequencies
295 //! up to 50kHz, depending on the selected drive strength. Loops
296 //! until all oscillator fault flags are cleared. See the
297 //! device-specific data sheet for appropriate drive settings. NOTE: User must
298 //! call CS_setExternalClockSourceFrequency to set frequency of external clocks
299 //! before calling this function. This function has a timeout associated with
300 //! stabilizing the oscillator.
302 //! \param xtDrive is the target drive strength for the LFXT crystal
304 //! Valid values are:
305 //! - \b CS_LFXT_DRIVE0,
306 //! - \b CS_LFXT_DRIVE1,
307 //! - \b CS_LFXT_DRIVE2,
308 //! - \b CS_LFXT_DRIVE3, [Default Value]
309 //! - \b CS_LFXT_BYPASS
311 //! \note When CS_LFXT_BYPASS is passed as a parameter the oscillator will
312 //! start in bypass mode and the signal can be generated by a digital square
315 //! \param timeout is the count value that gets decremented every time the loop
316 //! that clears oscillator fault flags gets executed.
320 //******************************************************************************
321 extern void CS_startLFXTWithTimeout(uint32_t xtDrive, uint32_t timeout);
323 //******************************************************************************
325 //! Selects between the frequency of the internal REFO clock source
327 //! \param referenceFrequency selects between the valid frequencies:
328 //! - \b CS_REFO_32KHZ,
329 //! - \b CS_REFO_128KHZ,
333 //******************************************************************************
334 extern void CS_setReferenceOscillatorFrequency(uint8_t referenceFrequency);
336 //******************************************************************************
338 //! Enables conditional module requests
340 //! \param selectClock selects specific request enables. Valid values are
341 //! are a logical OR of the following values:
349 //******************************************************************************
350 extern void CS_enableClockRequest(uint32_t selectClock);
352 //******************************************************************************
354 //! Disables conditional module requests
356 //! \param selectClock selects specific request disables. Valid values are
357 //! are a logical OR of the following values:
365 //******************************************************************************
366 extern void CS_disableClockRequest(uint32_t selectClock);
368 //******************************************************************************
370 //! Get the current ACLK frequency.
372 //! If a oscillator fault is set, the frequency returned will be based on the
373 //! fail safe mechanism of CS module. The user of this API must ensure that
374 //! \link CS_setExternalClockSourceFrequency() \endlink API was invoked before
375 //! in case LFXT is being used.
377 //! \return Current ACLK frequency in Hz
379 //******************************************************************************
380 extern uint32_t CS_getACLK(void);
382 //******************************************************************************
384 //! Get the current SMCLK frequency.
386 //! If a oscillator fault is set, the frequency returned will be based on the
387 //! fail safe mechanism of CS module. The user of this API must ensure that
388 //! CS_setExternalClockSourceFrequency API was invoked before in case LFXT or
389 //! HFXT is being used.
391 //! \return Current SMCLK frequency in Hz
393 //******************************************************************************
394 extern uint32_t CS_getSMCLK(void);
396 //******************************************************************************
398 //! Get the current MCLK frequency.
400 //! If a oscillator fault is set, the frequency returned will be based on the
401 //! fail safe mechanism of CS module. The user of this API must ensure that
402 //! CS_setExternalClockSourceFrequency API was invoked before in case LFXT or
403 //! HFXT is being used.
405 //! \return Current MCLK frequency in Hz
407 //******************************************************************************
408 extern uint32_t CS_getMCLK(void);
410 //******************************************************************************
412 //! Get the current BCLK frequency.
414 //! If a oscillator fault is set, the frequency returned will be based on the
415 //! fail safe mechanism of CS module. The user of this API must ensure that
416 //! \link CS_setExternalClockSourceFrequency \endlink API was invoked before in
417 //! case LFXT or HFXT is being used.
419 //! \return Current BCLK frequency in Hz
421 //******************************************************************************
422 extern uint32_t CS_getBCLK(void);
424 //******************************************************************************
426 //! Get the current HSMCLK frequency.
428 //! If a oscillator fault is set, the frequency returned will be based on the
429 //! fail safe mechanism of CS module. The user of this API must ensure that
430 //! \link CS_setExternalClockSourceFrequency \endlink API was invoked before in
431 //! case LFXT or HFXT is being used.
433 //! \return Current HSMCLK frequency in Hz
435 //******************************************************************************
436 extern uint32_t CS_getHSMCLK(void);
438 //******************************************************************************
440 //! Sets the centered frequency of DCO operation. Each frequency represents
441 //! the centred frequency of a particular frequency range. Further tuning can
442 //! be achieved by using the CS_tuneDCOFrequency function. Note that setting
443 //! the nominal frequency will reset the tuning parameters.
445 //! \param dcoFreq selects between the valid frequencies:
446 //! - \b CS_DCO_FREQUENCY_1_5, [1MHz to 2MHz]
447 //! - \b CS_DCO_FREQUENCY_3, [2MHz to 4MHz]
448 //! - \b CS_DCO_FREQUENCY_6, [4MHz to 8MHz]
449 //! - \b CS_DCO_FREQUENCY_12, [8MHz to 16MHz]
450 //! - \b CS_DCO_FREQUENCY_24, [16MHz to 32MHz]
451 //! - \b CS_DCO_FREQUENCY_48 [32MHz to 64MHz]
455 //******************************************************************************
456 extern void CS_setDCOCenteredFrequency(uint32_t dcoFreq);
458 //******************************************************************************
460 //! Automatically sets/tunes the DCO to the given frequency. Any valid value
461 //! up to max frequency in the spec can be given to this function and the API
462 //! will do its best to determine the correct tuning parameter.
464 //! \note The frequency ranges that can be custom tuned on early release MSP432
465 //! devices is limited. For further details on supported tunable frequencies,
466 //! please refer to the device errata sheet or data sheet.
468 //! \param dcoFrequency Frequency in Hz that the user wants to set the DCO to.
470 //! \note This function uses floating point math to calculate the DCO tuning
471 //! parameter. If efficiency is a concern, the user should use the
472 //! \link FPU_enableModule \endlink function (if available) to enable
473 //! the floating point co-processor.
477 //******************************************************************************
478 extern void CS_setDCOFrequency(uint32_t dcoFrequency);
480 //******************************************************************************
482 //! Tunes the DCO to a specific frequency. Tuning of the DCO is based off of the
483 //! following equation in the user's guide:
485 //! See the user's guide for more detailed information about DCO tuning.
487 //! \note This function is not currently available on pre-release MSP432 devices.
488 //! On early release versions of MSP432, the DCO calibration information has not been
489 //! populated making the DCO only able to operate at the pre-calibrated centered
490 //! frequencies accessible by the \link CS_setDCOCenteredFrequency \endlink
491 //! function. While this function will be added on the final devices being released,
492 //! for early silicon please default to the pre-calibrated DCO center frequencies.
494 //! \param tuneParameter Tuning parameter in 2's Compliment representation.
495 //! Can be negative or positive.
499 //******************************************************************************
500 extern void CS_tuneDCOFrequency(int16_t tuneParameter);
502 //******************************************************************************
504 //! Enables the external resistor for DCO operation
508 //******************************************************************************
509 extern void CS_enableDCOExternalResistor(void);
511 //******************************************************************************
513 //! Disables the external resistor for DCO operation
517 //******************************************************************************
518 extern void CS_disableDCOExternalResistor(void);
520 //******************************************************************************
522 //! Sets the calibration value for the DCO when using the external resistor
523 //! mode. This value is used for tuning the DCO to custom frequencies. By
524 //! default, the value in the CS module is populated by the calibration
525 //! data of the suggested external resistor (see device datasheet).
527 //! \param uiCalData is the calibration data constant for the external resistor.
531 //******************************************************************************
532 extern void CS_setDCOExternalResistorCalibration(uint_fast8_t uiCalData);
534 //******************************************************************************
536 //! Gets the current tuned DCO frequency. If no tuning has been done, this
537 //! returns the nominal DCO frequency of the current DCO range. Note that this
538 //! function will grab any constant/calibration data from the DDDS table
539 //! without any user interaction needed.
541 //! \note This function uses floating point math to calculate the DCO tuning
542 //! parameter. If efficiency is a concern, the user should use the
543 //! \link FPU_enableModule \endlink function (if available) to enable
544 //! the floating point co-processor.
546 //! \return Current DCO frequency in Hz
548 //******************************************************************************
549 extern uint32_t CS_getDCOFrequency(void);
551 //******************************************************************************
553 //! Automatically sets/tunes the DCO to the given frequency. Any valid value
554 //! up to (and including) 64Mhz can be given to this function and the API
555 //! will do its best to determine the correct tuning parameter.
558 //! \note This function is not currently available on pre-release MSP432 devices.
559 //! On early release versions of MSP432, the DCO calibration information has not been
560 //! populated making the DCO only able to operate at the pre-calibrated centered
561 //! frequencies accessible by the \link CS_setDCOCenteredFrequency \endlink
562 //! function. While this function will be added on the final devices being released,
563 //! for early silicon please default to the pre-calibrated DCO center frequencies.
565 //! \param dcoFrequency Frequency in Hz (1500000 - 64000000) that the user wants
566 //! to set the DCO to.
568 //! \note This function uses floating point math to calculate the DCO tuning
569 //! parameter. If efficiency is a concern, the user should use the
570 //! \link FPU_enableModule \endlink function (if available) to enable
571 //! the floating point co-processor.
575 //******************************************************************************
576 extern void CS_setDCOFrequency(uint32_t dcoFrequency);
578 //******************************************************************************
580 //! Enables the fault counter for the CS module. This function can enable
581 //! either the HFXT fault counter or the LFXT fault counter.
583 //! \param counterSelect selects the fault counter to enable
584 //! - \b CS_HFXT_FAULT_COUNTER
585 //! - \b CS_LFXT_FAULT_COUNTER
589 //******************************************************************************
590 extern void CS_enableFaultCounter(uint_fast8_t counterSelect);
592 //******************************************************************************
594 //! Disables the fault counter for the CS module. This function can disable
595 //! either the HFXT fault counter or the LFXT fault counter.
597 //! \param counterSelect selects the fault counter to disable
598 //! - \b CS_HFXT_FAULT_COUNTER
599 //! - \b CS_LFXT_FAULT_COUNTER
603 //******************************************************************************
604 extern void CS_disableFaultCounter(uint_fast8_t counterSelect);
606 //******************************************************************************
608 //! Resets the fault counter for the CS module. This function can reset
609 //! either the HFXT fault counter or the LFXT fault counter.
611 //! \param counterSelect selects the fault counter to reset
612 //! - \b CS_HFXT_FAULT_COUNTER
613 //! - \b CS_LFXT_FAULT_COUNTER
617 //******************************************************************************
618 extern void CS_resetFaultCounter(uint_fast8_t counterSelect);
620 //******************************************************************************
622 //! Sets the count for the start value of the fault counter. This function can
623 //! be used to set either the HFXT count or the LFXT count.
625 //! \param counterSelect selects the fault counter to reset
626 //! - \b CS_HFXT_FAULT_COUNTER
627 //! - \b CS_LFXT_FAULT_COUNTER
628 //! \param countValue selects the cycles to set the fault counter to
629 //! - \b CS_FAULT_COUNTER_4096_CYCLES
630 //! - \b CS_FAULT_COUNTER_8192_CYCLES
631 //! - \b CS_FAULT_COUNTER_16384_CYCLES
632 //! - \b CS_FAULT_COUNTER_32768_CYCLES
636 //******************************************************************************
637 extern void CS_startFaultCounter(uint_fast8_t counterSelect,
638 uint_fast8_t countValue);
640 //*****************************************************************************
642 //! Enables individual clock control interrupt sources.
644 //! \param flags is a bit mask of the interrupt sources to be enabled. Must
645 //! be a logical OR of:
646 //! - \b CS_LFXT_FAULT,
647 //! - \b CS_HFXT_FAULT,
648 //! - \b CS_DCOMIN_FAULT,
649 //! - \b CS_DCOMAX_FAULT,
650 //! - \b CS_DCORESISTOR_FAULT,
651 //! - \b CS_STARTCOUNT_LFXT_FAULT,
652 //! - \b CS_STARTCOUNT_HFXT_FAULT,
653 //! - \b CS_PLL_OUTOFLOCK,
654 //! - \b CS_PLL_OUTOFSIGNAL,
655 //! - \b CS_PLL_OUTOFRANGE,
656 //! - \b CS_REFCNT_PERIOD_COUNTER
658 //! This function enables the indicated clock system interrupt sources. Only
659 //! the sources that are enabled can be reflected to the processor interrupt;
660 //! disabled sources have no effect on the processor.
662 //! \note The interrupt sources vary based on the part in use.
663 //! Please consult the data sheet for the part you are using to determine
664 //! which interrupt sources are available.
668 //*****************************************************************************
669 extern void CS_enableInterrupt(uint32_t flags);
671 //*****************************************************************************
673 //! Disables individual clock system interrupt sources.
675 //! \param flags is a bit mask of the interrupt sources to be disabled. Must
676 //! be a logical OR of:
677 //! - \b CS_LFXT_FAULT,
678 //! - \b CS_HFXT_FAULT,
679 //! - \b CS_DCOMIN_FAULT,
680 //! - \b CS_DCOMAX_FAULT,
681 //! - \b CS_DCORESISTOR_FAULT,
682 //! - \b CS_STARTCOUNT_LFXT_FAULT,
683 //! - \b CS_STARTCOUNT_HFXT_FAULT,
684 //! - \b CS_PLL_OUTOFLOCK,
685 //! - \b CS_PLL_OUTOFSIGNAL,
686 //! - \b CS_PLL_OUTOFRANGE,
687 //! - \b CS_REFCNT_PERIOD_COUNTER
689 //! \note The interrupt sources vary based on the part in use.
690 //! Please consult the data sheet for the part you are using to determine
691 //! which interrupt sources are available.
695 //*****************************************************************************
696 extern void CS_disableInterrupt(uint32_t flags);
698 //*****************************************************************************
700 //! Gets the current interrupt status masked with the enabled interrupts.
701 //! This function is useful to call in ISRs to get a list of pending interrupts
702 //! that are actually enabled and could have caused the ISR.
704 //! \return The current interrupt status, enumerated as a bit field of
705 //! - \b CS_LFXT_FAULT,
706 //! - \b CS_HFXT_FAULT,
707 //! - \b CS_DCOMIN_FAULT,
708 //! - \b CS_DCOMAX_FAULT,
709 //! - \b CS_DCORESISTOR_FAULT,
710 //! - \b CS_STARTCOUNT_LFXT_FAULT,
711 //! - \b CS_STARTCOUNT_HFXT_FAULT,
712 //! - \b CS_PLL_OUTOFLOCK,
713 //! - \b CS_PLL_OUTOFSIGNAL,
714 //! - \b CS_PLL_OUTOFRANGE,
715 //! - \b CS_REFCNT_PERIOD_COUNTER
717 //! \note The interrupt sources vary based on the part in use.
718 //! Please consult the data sheet for the part you are using to determine
719 //! which interrupt sources are available.
721 //*****************************************************************************
722 extern uint32_t CS_getEnabledInterruptStatus(void);
724 //*****************************************************************************
726 //! Gets the current interrupt status.
728 //! \return The current interrupt status, enumerated as a bit field of:
729 //! - \b CS_LFXT_FAULT,
730 //! - \b CS_HFXT_FAULT,
731 //! - \b CS_DCOMIN_FAULT,
732 //! - \b CS_DCOMAX_FAULT,
733 //! - \b CS_DCORESISTOR_FAULT,
734 //! - \b CS_STARTCOUNT_LFXT_FAULT,
735 //! - \b CS_STARTCOUNT_HFXT_FAULT,
736 //! - \b CS_PLL_OUTOFLOCK,
737 //! - \b CS_PLL_OUTOFSIGNAL,
738 //! - \b CS_PLL_OUTOFRANGE,
739 //! - \b CS_REFCNT_PERIOD_COUNTER
741 //! \note The interrupt sources vary based on the part in use.
742 //! Please consult the data sheet for the part you are using to determine
743 //! which interrupt sources are available.
745 //*****************************************************************************
746 extern uint32_t CS_getInterruptStatus(void);
748 //*****************************************************************************
750 //! Clears clock system interrupt sources.
752 //! \param flags is a bit mask of the interrupt sources to be cleared. Must
753 //! be a logical OR of:
754 //! - \b CS_LFXT_FAULT,
755 //! - \b CS_HFXT_FAULT,
756 //! - \b CS_DCOMIN_FAULT,
757 //! - \b CS_DCOMAX_FAULT,
758 //! - \b CS_DCORESISTOR_FAULT,
759 //! - \b CS_STARTCOUNT_LFXT_FAULT,
760 //! - \b CS_STARTCOUNT_HFXT_FAULT,
761 //! - \b CS_PLL_OUTOFLOCK,
762 //! - \b CS_PLL_OUTOFSIGNAL,
763 //! - \b CS_PLL_OUTOFRANGE,
764 //! - \b CS_REFCNT_PERIOD_COUNTER
766 //! The specified clock system interrupt sources are cleared, so that they no
767 //! longer assert. This function must be called in the interrupt handler to
768 //! keep it from being called again immediately upon exit.
770 //! \note Because there is a write buffer in the Cortex-M processor, it may
771 //! take several clock cycles before the interrupt source is actually cleared.
772 //! Therefore, it is recommended that the interrupt source be cleared early in
773 //! the interrupt handler (as opposed to the very last action) to avoid
774 //! returning from the interrupt handler before the interrupt source is
775 //! actually cleared. Failure to do so may result in the interrupt handler
776 //! being immediately reentered (because the interrupt controller still sees
777 //! the interrupt source asserted).
779 //! \note The interrupt sources vary based on the part in use.
780 //! Please consult the data sheet for the part you are using to determine
781 //! which interrupt sources are available.
785 //*****************************************************************************
786 extern void CS_clearInterruptFlag(uint32_t flags);
788 //*****************************************************************************
790 //! Registers an interrupt handler for the clock system interrupt.
792 //! \param intHandler is a pointer to the function to be called when the clock
793 //! system interrupt occurs.
795 //! This function registers the handler to be called when a clock system
796 //! interrupt occurs. This function enables the global interrupt in the
797 //! interrupt controller; specific clock system interrupts must be enabled
798 //! via CS_enableInterrupt(). It is the interrupt handler's responsibility to
799 //! clear the interrupt source via CS_clearInterruptFlag().
801 //! Clock System can generate interrupts when
803 //! \sa Interrupt_registerInterrupt() for important information about
804 //! registering interrupt handlers.
808 //*****************************************************************************
809 extern void CS_registerInterrupt(void (*intHandler)(void));
811 //*****************************************************************************
813 //! Unregisters the interrupt handler for the clock system.
815 //! This function unregisters the handler to be called when a clock system
816 //! interrupt occurs. This function also masks off the interrupt in the
817 //! interrupt controller so that the interrupt handler no longer is called.
819 //! \sa Interrupt_registerInterrupt() for important information about
820 //! registering interrupt handlers.
824 //*****************************************************************************
825 extern void CS_unregisterInterrupt(void);
827 //*****************************************************************************
829 // Mark the end of the C bindings section for C++ compilers.
831 //*****************************************************************************
836 //*****************************************************************************
838 // Close the Doxygen group.
841 //*****************************************************************************