]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/MSP430FR5969_LaunchPad/driverlib/MSP430FR5xx_6xx/cs.h
3a5c1a5d8f994508c4904cce44bd14e69c82a126
[freertos] / FreeRTOS / Demo / MSP430FR5969_LaunchPad / driverlib / MSP430FR5xx_6xx / cs.h
1 /* --COPYRIGHT--,BSD\r
2  * Copyright (c) 2014, Texas Instruments Incorporated\r
3  * All rights reserved.\r
4  *\r
5  * Redistribution and use in source and binary forms, with or without\r
6  * modification, are permitted provided that the following conditions\r
7  * are met:\r
8  *\r
9  * *  Redistributions of source code must retain the above copyright\r
10  *    notice, this list of conditions and the following disclaimer.\r
11  *\r
12  * *  Redistributions in binary form must reproduce the above copyright\r
13  *    notice, this list of conditions and the following disclaimer in the\r
14  *    documentation and/or other materials provided with the distribution.\r
15  *\r
16  * *  Neither the name of Texas Instruments Incorporated nor the names of\r
17  *    its contributors may be used to endorse or promote products derived\r
18  *    from this software without specific prior written permission.\r
19  *\r
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\r
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\r
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\r
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
31  * --/COPYRIGHT--*/\r
32 //*****************************************************************************\r
33 //\r
34 // cs.h - Driver for the CS Module.\r
35 //\r
36 //*****************************************************************************\r
37 \r
38 #ifndef __MSP430WARE_CS_H__\r
39 #define __MSP430WARE_CS_H__\r
40 \r
41 #include "inc/hw_memmap.h"\r
42 \r
43 #if defined(__MSP430_HAS_CS__) || defined(__MSP430_HAS_SFR__)\r
44 \r
45 //*****************************************************************************\r
46 //\r
47 // If building with a C++ compiler, make all of the definitions in this header\r
48 // have a C binding.\r
49 //\r
50 //*****************************************************************************\r
51 #ifdef __cplusplus\r
52 extern "C"\r
53 {\r
54 #endif\r
55 \r
56 //*****************************************************************************\r
57 //\r
58 // The following are values that can be passed to the clockSourceDivider\r
59 // parameter for functions: CS_initClockSignal().\r
60 //\r
61 //*****************************************************************************\r
62 #define CS_CLOCK_DIVIDER_1                                              DIVM__1\r
63 #define CS_CLOCK_DIVIDER_2                                              DIVM__2\r
64 #define CS_CLOCK_DIVIDER_4                                              DIVM__4\r
65 #define CS_CLOCK_DIVIDER_8                                              DIVM__8\r
66 #define CS_CLOCK_DIVIDER_16                                            DIVM__16\r
67 #define CS_CLOCK_DIVIDER_32                                            DIVM__32\r
68 \r
69 //*****************************************************************************\r
70 //\r
71 // The following are values that can be passed to the selectClock parameter for\r
72 // functions: CS_enableClockRequest(), and CS_disableClockRequest(); the\r
73 // selectedClockSignal parameter for functions: CS_initClockSignal().\r
74 //\r
75 //*****************************************************************************\r
76 #define CS_ACLK                                                            0x01\r
77 #define CS_MCLK                                                            0x02\r
78 #define CS_SMCLK                                                           0x04\r
79 #define CS_MODOSC                                                   MODCLKREQEN\r
80 \r
81 //*****************************************************************************\r
82 //\r
83 // The following are values that can be passed to the clockSource parameter for\r
84 // functions: CS_initClockSignal().\r
85 //\r
86 //*****************************************************************************\r
87 #define CS_VLOCLK_SELECT                                           SELM__VLOCLK\r
88 #define CS_DCOCLK_SELECT                                           SELM__DCOCLK\r
89 #define CS_LFXTCLK_SELECT                                         SELM__LFXTCLK\r
90 #define CS_HFXTCLK_SELECT                                         SELM__HFXTCLK\r
91 #define CS_LFMODOSC_SELECT                                       SELM__LFMODOSC\r
92 #define CS_MODOSC_SELECT                                           SELM__MODOSC\r
93 \r
94 //*****************************************************************************\r
95 //\r
96 // The following are values that can be passed to the lfxtdrive parameter for\r
97 // functions: CS_turnOnLFXT(), and CS_turnOnLFXTWithTimeout().\r
98 //\r
99 //*****************************************************************************\r
100 #define CS_LFXT_DRIVE_0                                             LFXTDRIVE_0\r
101 #define CS_LFXT_DRIVE_1                                             LFXTDRIVE_1\r
102 #define CS_LFXT_DRIVE_2                                             LFXTDRIVE_2\r
103 #define CS_LFXT_DRIVE_3                                             LFXTDRIVE_3\r
104 \r
105 //*****************************************************************************\r
106 //\r
107 // The following are values that can be passed to the hfxtdrive parameter for\r
108 // functions: CS_turnOnHFXT(), and CS_turnOnHFXTWithTimeout().\r
109 //\r
110 //*****************************************************************************\r
111 #define CS_HFXT_DRIVE_4MHZ_8MHZ                                     HFXTDRIVE_0\r
112 #define CS_HFXT_DRIVE_8MHZ_16MHZ                                    HFXTDRIVE_1\r
113 #define CS_HFXT_DRIVE_16MHZ_24MHZ                                   HFXTDRIVE_2\r
114 #define CS_HFXT_DRIVE_24MHZ_32MHZ                                   HFXTDRIVE_3\r
115 \r
116 //*****************************************************************************\r
117 //\r
118 // The following are values that can be passed to the mask parameter for\r
119 // functions: CS_getFaultFlagStatus(), and CS_clearFaultFlag() as well as\r
120 // returned by the CS_getFaultFlagStatus() function.\r
121 //\r
122 //*****************************************************************************\r
123 #define CS_LFXTOFFG                                                    LFXTOFFG\r
124 #define CS_HFXTOFFG                                                    HFXTOFFG\r
125 \r
126 //*****************************************************************************\r
127 //\r
128 // The following are values that can be passed to the dcorsel parameter for\r
129 // functions: CS_setDCOFreq().\r
130 //\r
131 //*****************************************************************************\r
132 #define CS_DCORSEL_0                                                       0x00\r
133 #define CS_DCORSEL_1                                                    DCORSEL\r
134 \r
135 //*****************************************************************************\r
136 //\r
137 // The following are values that can be passed to the dcofsel parameter for\r
138 // functions: CS_setDCOFreq().\r
139 //\r
140 //*****************************************************************************\r
141 #define CS_DCOFSEL_0                                                  DCOFSEL_0\r
142 #define CS_DCOFSEL_1                                                  DCOFSEL_1\r
143 #define CS_DCOFSEL_2                                                  DCOFSEL_2\r
144 #define CS_DCOFSEL_3                                                  DCOFSEL_3\r
145 #define CS_DCOFSEL_4                                                  DCOFSEL_4\r
146 #define CS_DCOFSEL_5                                                  DCOFSEL_5\r
147 #define CS_DCOFSEL_6                                                  DCOFSEL_6\r
148 \r
149 //*****************************************************************************\r
150 //\r
151 // Prototypes for the APIs.\r
152 //\r
153 //*****************************************************************************\r
154 \r
155 //*****************************************************************************\r
156 //\r
157 //! \brief Sets the external clock source\r
158 //!\r
159 //! This function sets the external clock sources LFXT and HFXT crystal\r
160 //! oscillator frequency values. This function must be called if an external\r
161 //! crystal LFXT or HFXT is used and the user intends to call CS_getMCLK,\r
162 //! CS_getSMCLK, CS_getACLK and CS_turnOnLFXT, CS_LFXTByPass,\r
163 //! CS_turnOnLFXTWithTimeout, CS_LFXTByPassWithTimeout, CS_turnOnHFXT,\r
164 //! CS_HFXTByPass, CS_turnOnHFXTWithTimeout, CS_HFXTByPassWithTimeout.\r
165 //!\r
166 //! \param LFXTCLK_frequency is the LFXT crystal frequencies in Hz\r
167 //! \param HFXTCLK_frequency is the HFXT crystal frequencies in Hz\r
168 //!\r
169 //! \return None\r
170 //\r
171 //*****************************************************************************\r
172 extern void CS_setExternalClockSource(uint32_t LFXTCLK_frequency,\r
173                                       uint32_t HFXTCLK_frequency);\r
174 \r
175 //*****************************************************************************\r
176 //\r
177 //! \brief Initializes clock signal\r
178 //!\r
179 //! This function initializes each of the clock signals. The user must ensure\r
180 //! that this function is called for each clock signal. If not, the default\r
181 //! state is assumed for the particular clock signal. Refer to MSP430ware\r
182 //! documentation for CS module or Device Family User's Guide for details of\r
183 //! default clock signal states.\r
184 //!\r
185 //! \param selectedClockSignal Selected clock signal\r
186 //!        Valid values are:\r
187 //!        - \b CS_ACLK\r
188 //!        - \b CS_MCLK\r
189 //!        - \b CS_SMCLK\r
190 //!        - \b CS_MODOSC\r
191 //! \param clockSource is the selected clock signal\r
192 //!        Valid values are:\r
193 //!        - \b CS_VLOCLK_SELECT\r
194 //!        - \b CS_DCOCLK_SELECT - [Not available for ACLK]\r
195 //!        - \b CS_LFXTCLK_SELECT\r
196 //!        - \b CS_HFXTCLK_SELECT - [Not available for ACLK]\r
197 //!        - \b CS_LFMODOSC_SELECT\r
198 //!        - \b CS_MODOSC_SELECT - [Not available for ACLK]\r
199 //! \param clockSourceDivider is the selected clock divider to calculate clock\r
200 //!        signal from clock source.\r
201 //!        Valid values are:\r
202 //!        - \b CS_CLOCK_DIVIDER_1 - [Default for ACLK]\r
203 //!        - \b CS_CLOCK_DIVIDER_2\r
204 //!        - \b CS_CLOCK_DIVIDER_4\r
205 //!        - \b CS_CLOCK_DIVIDER_8 - [Default for SMCLK and MCLK]\r
206 //!        - \b CS_CLOCK_DIVIDER_16\r
207 //!        - \b CS_CLOCK_DIVIDER_32\r
208 //!\r
209 //! Modified bits of \b CSCTL0 register, bits of \b CSCTL3 register and bits of\r
210 //! \b CSCTL2 register.\r
211 //!\r
212 //! \return None\r
213 //\r
214 //*****************************************************************************\r
215 extern void CS_initClockSignal(uint8_t selectedClockSignal,\r
216                                uint16_t clockSource,\r
217                                uint16_t clockSourceDivider);\r
218 \r
219 //*****************************************************************************\r
220 //\r
221 //! \brief Initializes the LFXT crystal in low frequency mode.\r
222 //!\r
223 //! Initializes the LFXT crystal oscillator in low frequency mode. Loops until\r
224 //! all oscillator fault flags are cleared, with no timeout. See the device-\r
225 //! specific data sheet for appropriate drive settings. IMPORTANT: User must\r
226 //! call CS_setExternalClockSource function to set frequency of external clocks\r
227 //! before calling this function.\r
228 //!\r
229 //! \param lfxtdrive is the target drive strength for the LFXT crystal\r
230 //!        oscillator.\r
231 //!        Valid values are:\r
232 //!        - \b CS_LFXT_DRIVE_0\r
233 //!        - \b CS_LFXT_DRIVE_1\r
234 //!        - \b CS_LFXT_DRIVE_2\r
235 //!        - \b CS_LFXT_DRIVE_3 [Default]\r
236 //!\r
237 //! Modified bits of \b CSCTL0 register, bits of \b CSCTL5 register, bits of \b\r
238 //! CSCTL4 register and bits of \b SFRIFG1 register.\r
239 //!\r
240 //! \return None\r
241 //\r
242 //*****************************************************************************\r
243 extern void CS_turnOnLFXT(uint16_t lfxtdrive);\r
244 \r
245 //*****************************************************************************\r
246 //\r
247 //! \brief Bypasses the LFXT crystal oscillator.\r
248 //!\r
249 //! Bypasses the LFXT crystal oscillator. Loops until all oscillator fault\r
250 //! flags are cleared, with no timeout. IMPORTANT: User must call\r
251 //! CS_setExternalClockSource function to set frequency of external clocks\r
252 //! before calling this function.\r
253 //!\r
254 //!\r
255 //! Modified bits of \b CSCTL0 register, bits of \b CSCTL5 register, bits of \b\r
256 //! CSCTL4 register and bits of \b SFRIFG register.\r
257 //!\r
258 //! \return None\r
259 //\r
260 //*****************************************************************************\r
261 extern void CS_bypassLFXT(void);\r
262 \r
263 //*****************************************************************************\r
264 //\r
265 //! \brief Initializes the LFXT crystal oscillator in low frequency mode with\r
266 //! timeout.\r
267 //!\r
268 //! Initializes the LFXT crystal oscillator in low frequency mode with timeout.\r
269 //! Loops until all oscillator fault flags are cleared or until a timeout\r
270 //! counter is decremented and equals to zero. See the device-specific\r
271 //! datasheet for appropriate drive settings. IMPORTANT: User must call\r
272 //! CS_setExternalClockSource to set frequency of external clocks before\r
273 //! calling this function.\r
274 //!\r
275 //! \param lfxtdrive is the target drive strength for the LFXT crystal\r
276 //!        oscillator.\r
277 //!        Valid values are:\r
278 //!        - \b CS_LFXT_DRIVE_0\r
279 //!        - \b CS_LFXT_DRIVE_1\r
280 //!        - \b CS_LFXT_DRIVE_2\r
281 //!        - \b CS_LFXT_DRIVE_3 [Default]\r
282 //! \param timeout is the count value that gets decremented every time the loop\r
283 //!        that clears oscillator fault flags gets executed.\r
284 //!\r
285 //! Modified bits of \b CSCTL0 register, bits of \b CSCTL5 register, bits of \b\r
286 //! CSCTL4 register and bits of \b SFRIFG1 register.\r
287 //!\r
288 //! \return STATUS_SUCCESS or STATUS_FAIL indicating if the LFXT crystal\r
289 //!         oscillator was initialized successfully\r
290 //\r
291 //*****************************************************************************\r
292 extern bool CS_turnOnLFXTWithTimeout(uint16_t lfxtdrive,\r
293                                      uint32_t timeout);\r
294 \r
295 //*****************************************************************************\r
296 //\r
297 //! \brief Bypass the LFXT crystal oscillator with timeout.\r
298 //!\r
299 //! Bypasses the LFXT crystal oscillator with timeout. Loops until all\r
300 //! oscillator fault flags are cleared or until a timeout counter is\r
301 //! decremented and equals to zero. NOTE: User must call\r
302 //! CS_setExternalClockSource to set frequency of external clocks before\r
303 //! calling this function.\r
304 //!\r
305 //! \param timeout is the count value that gets decremented every time the loop\r
306 //!        that clears oscillator fault flags gets executed.\r
307 //!\r
308 //! Modified bits of \b CSCTL0 register, bits of \b CSCTL5 register, bits of \b\r
309 //! CSCTL4 register and bits of \b SFRIFG register.\r
310 //!\r
311 //! \return STATUS_SUCCESS or STATUS_FAIL\r
312 //\r
313 //*****************************************************************************\r
314 extern bool CS_bypassLFXTWithTimeout(uint32_t timeout);\r
315 \r
316 //*****************************************************************************\r
317 //\r
318 //! \brief Stops the LFXT oscillator using the LFXTOFF bit.\r
319 //!\r
320 //!\r
321 //! Modified bits of \b CSCTL4 register.\r
322 //!\r
323 //! \return None\r
324 //\r
325 //*****************************************************************************\r
326 extern void CS_turnOffLFXT(void);\r
327 \r
328 //*****************************************************************************\r
329 //\r
330 //! \brief Starts the HFXFT crystal\r
331 //!\r
332 //! Initializes the HFXT crystal oscillator, which supports crystal frequencies\r
333 //! between 0 MHz and 24 MHz, depending on the selected drive strength. Loops\r
334 //! until all oscillator fault flags are cleared, with no timeout. See the\r
335 //! device-specific data sheet for appropriate drive settings. NOTE: User must\r
336 //! call CS_setExternalClockSource to set frequency of external clocks before\r
337 //! calling this function.\r
338 //!\r
339 //! \param hfxtdrive is the target drive strength for the HFXT crystal\r
340 //!        oscillator.\r
341 //!        Valid values are:\r
342 //!        - \b CS_HFXT_DRIVE_4MHZ_8MHZ\r
343 //!        - \b CS_HFXT_DRIVE_8MHZ_16MHZ\r
344 //!        - \b CS_HFXT_DRIVE_16MHZ_24MHZ\r
345 //!        - \b CS_HFXT_DRIVE_24MHZ_32MHZ [Default]\r
346 //!\r
347 //! Modified bits of \b CSCTL5 register, bits of \b CSCTL4 register and bits of\r
348 //! \b SFRIFG1 register.\r
349 //!\r
350 //! \return None\r
351 //\r
352 //*****************************************************************************\r
353 extern void CS_turnOnHFXT(uint16_t hfxtdrive);\r
354 \r
355 //*****************************************************************************\r
356 //\r
357 //! \brief Bypasses the HFXT crystal oscillator\r
358 //!\r
359 //! Bypasses the HFXT crystal oscillator, which supports crystal frequencies\r
360 //! between 0 MHz and 24 MHz. Loops until all oscillator fault flags are\r
361 //! cleared, with no timeout.NOTE: User must call CS_setExternalClockSource to\r
362 //! set frequency of external clocks before calling this function.\r
363 //!\r
364 //!\r
365 //! Modified bits of \b CSCTL5 register, bits of \b CSCTL4 register and bits of\r
366 //! \b SFRIFG register.\r
367 //!\r
368 //! \return None\r
369 //\r
370 //*****************************************************************************\r
371 extern void CS_bypassHFXT(void);\r
372 \r
373 //*****************************************************************************\r
374 //\r
375 //! \brief Initializes the HFXT crystal oscillator with timeout.\r
376 //!\r
377 //! Initializes the HFXT crystal oscillator, which supports crystal frequencies\r
378 //! between 0 MHz and 24 MHz, depending on the selected drive strength. Loops\r
379 //! until all oscillator fault flags are cleared or until a timeout counter is\r
380 //! decremented and equals to zero. See the device-specific data sheet for\r
381 //! appropriate drive settings. NOTE: User must call CS_setExternalClockSource\r
382 //! to set frequency of external clocks before calling this function.\r
383 //!\r
384 //! \param hfxtdrive is the target drive strength for the HFXT crystal\r
385 //!        oscillator.\r
386 //!        Valid values are:\r
387 //!        - \b CS_HFXT_DRIVE_4MHZ_8MHZ\r
388 //!        - \b CS_HFXT_DRIVE_8MHZ_16MHZ\r
389 //!        - \b CS_HFXT_DRIVE_16MHZ_24MHZ\r
390 //!        - \b CS_HFXT_DRIVE_24MHZ_32MHZ [Default]\r
391 //! \param timeout is the count value that gets decremented every time the loop\r
392 //!        that clears oscillator fault flags gets executed.\r
393 //!\r
394 //! Modified bits of \b CSCTL5 register, bits of \b CSCTL4 register and bits of\r
395 //! \b SFRIFG1 register.\r
396 //!\r
397 //! \return STATUS_SUCCESS or STATUS_FAIL\r
398 //\r
399 //*****************************************************************************\r
400 extern bool CS_turnOnHFXTWithTimeout(uint16_t hfxtdrive,\r
401                                      uint32_t timeout);\r
402 \r
403 //*****************************************************************************\r
404 //\r
405 //! \brief Bypasses the HFXT crustal oscillator with timeout\r
406 //!\r
407 //! Bypasses the HFXT crystal oscillator, which supports crystal frequencies\r
408 //! between 0 MHz and 24 MHz. Loops until all oscillator fault flags are\r
409 //! cleared or until a timeout counter is decremented and equals to zero. NOTE:\r
410 //! User must call CS_setExternalClockSource to set frequency of external\r
411 //! clocks before calling this function.\r
412 //!\r
413 //! \param timeout is the count value that gets decremented every time the loop\r
414 //!        that clears oscillator fault flags gets executed.\r
415 //!\r
416 //! Modified bits of \b CSCTL5 register, bits of \b CSCTL4 register and bits of\r
417 //! \b SFRIFG1 register.\r
418 //!\r
419 //! \return STATUS_SUCCESS or STATUS_FAIL\r
420 //\r
421 //*****************************************************************************\r
422 extern bool CS_bypassHFXTWithTimeout(uint32_t timeout);\r
423 \r
424 //*****************************************************************************\r
425 //\r
426 //! \brief Stops the HFXT oscillator using the HFXTOFF bit.\r
427 //!\r
428 //!\r
429 //! Modified bits of \b CSCTL4 register.\r
430 //!\r
431 //! \return None\r
432 //\r
433 //*****************************************************************************\r
434 extern void CS_turnOffHFXT(void);\r
435 \r
436 //*****************************************************************************\r
437 //\r
438 //! \brief Enables conditional module requests\r
439 //!\r
440 //! \param selectClock selects specific request enables.\r
441 //!        Valid values are:\r
442 //!        - \b CS_ACLK\r
443 //!        - \b CS_MCLK\r
444 //!        - \b CS_SMCLK\r
445 //!        - \b CS_MODOSC\r
446 //!\r
447 //! Modified bits of \b CSCTL6 register.\r
448 //!\r
449 //! \return None\r
450 //\r
451 //*****************************************************************************\r
452 extern void CS_enableClockRequest(uint8_t selectClock);\r
453 \r
454 //*****************************************************************************\r
455 //\r
456 //! \brief Disables conditional module requests\r
457 //!\r
458 //! \param selectClock selects specific request enables.\r
459 //!        Valid values are:\r
460 //!        - \b CS_ACLK\r
461 //!        - \b CS_MCLK\r
462 //!        - \b CS_SMCLK\r
463 //!        - \b CS_MODOSC\r
464 //!\r
465 //! Modified bits of \b CSCTL6 register.\r
466 //!\r
467 //! \return None\r
468 //\r
469 //*****************************************************************************\r
470 extern void CS_disableClockRequest(uint8_t selectClock);\r
471 \r
472 //*****************************************************************************\r
473 //\r
474 //! \brief Gets the current CS fault flag status.\r
475 //!\r
476 //! \param mask is the masked interrupt flag status to be returned. Mask\r
477 //!        parameter can be either any of the following selection.\r
478 //!        Mask value is the logical OR of any of the following:\r
479 //!        - \b CS_LFXTOFFG - LFXT oscillator fault flag\r
480 //!        - \b CS_HFXTOFFG - HFXT oscillator fault flag\r
481 //!\r
482 //! \return Logical OR of any of the following:\r
483 //!         - \b CS_LFXTOFFG LFXT oscillator fault flag\r
484 //!         - \b CS_HFXTOFFG HFXT oscillator fault flag\r
485 //!         \n indicating the status of the masked interrupts\r
486 //\r
487 //*****************************************************************************\r
488 extern uint8_t CS_getFaultFlagStatus(uint8_t mask);\r
489 \r
490 //*****************************************************************************\r
491 //\r
492 //! \brief Clears the current CS fault flag status for the masked bit.\r
493 //!\r
494 //! \param mask is the masked interrupt flag status to be returned. mask\r
495 //!        parameter can be any one of the following\r
496 //!        Mask value is the logical OR of any of the following:\r
497 //!        - \b CS_LFXTOFFG - LFXT oscillator fault flag\r
498 //!        - \b CS_HFXTOFFG - HFXT oscillator fault flag\r
499 //!\r
500 //! Modified bits of \b CSCTL5 register.\r
501 //!\r
502 //! \return None\r
503 //\r
504 //*****************************************************************************\r
505 extern void CS_clearFaultFlag(uint8_t mask);\r
506 \r
507 //*****************************************************************************\r
508 //\r
509 //! \brief Get the current ACLK frequency.\r
510 //!\r
511 //! If a oscillator fault is set, the frequency returned will be based on the\r
512 //! fail safe mechanism of CS module. The user of this API must ensure that\r
513 //! CS_externalClockSourceInit API was invoked before in case LFXT or HFXT is\r
514 //! being used.\r
515 //!\r
516 //!\r
517 //! \return Current ACLK frequency in Hz\r
518 //\r
519 //*****************************************************************************\r
520 extern uint32_t CS_getACLK(void);\r
521 \r
522 //*****************************************************************************\r
523 //\r
524 //! \brief Get the current SMCLK frequency.\r
525 //!\r
526 //! If a oscillator fault is set, the frequency returned will be based on the\r
527 //! fail safe mechanism of CS module. The user of this API must ensure that\r
528 //! CS_externalClockSourceInit API was invoked before in case LFXT or HFXT is\r
529 //! being used.\r
530 //!\r
531 //!\r
532 //! \return Current SMCLK frequency in Hz\r
533 //\r
534 //*****************************************************************************\r
535 extern uint32_t CS_getSMCLK(void);\r
536 \r
537 //*****************************************************************************\r
538 //\r
539 //! \brief Get the current MCLK frequency.\r
540 //!\r
541 //! If a oscillator fault is set, the frequency returned will be based on the\r
542 //! fail safe mechanism of CS module. The user of this API must ensure that\r
543 //! CS_externalClockSourceInit API was invoked before in case LFXT or HFXT is\r
544 //! being used.\r
545 //!\r
546 //!\r
547 //! \return Current MCLK frequency in Hz\r
548 //\r
549 //*****************************************************************************\r
550 extern uint32_t CS_getMCLK(void);\r
551 \r
552 //*****************************************************************************\r
553 //\r
554 //! \brief Turns off VLO\r
555 //!\r
556 //!\r
557 //! Modified bits of \b CSCTL4 register.\r
558 //!\r
559 //! \return None\r
560 //\r
561 //*****************************************************************************\r
562 extern void CS_turnOffVLO(void);\r
563 \r
564 //*****************************************************************************\r
565 //\r
566 //! \brief Clears all the Oscillator Flags\r
567 //!\r
568 //! \param timeout is the count value that gets decremented every time the loop\r
569 //!        that clears oscillator fault flags gets executed.\r
570 //!\r
571 //! Modified bits of \b CSCTL5 register and bits of \b SFRIFG1 register.\r
572 //!\r
573 //! \return the mask of the oscillator flag status\r
574 //\r
575 //*****************************************************************************\r
576 extern uint16_t CS_clearAllOscFlagsWithTimeout(uint32_t timeout);\r
577 \r
578 //*****************************************************************************\r
579 //\r
580 //! \brief Set DCO frequency\r
581 //!\r
582 //! \param dcorsel selects frequency range option.\r
583 //!        Valid values are:\r
584 //!        - \b CS_DCORSEL_0 [Default] - Low Frequency Option\r
585 //!        - \b CS_DCORSEL_1 - High Frequency Option\r
586 //! \param dcofsel selects valid frequency options based on dco frequency range\r
587 //!        selection (dcorsel)\r
588 //!        Valid values are:\r
589 //!        - \b CS_DCOFSEL_0 - Low frequency option 1MHz. High frequency option\r
590 //!           1MHz.\r
591 //!        - \b CS_DCOFSEL_1 - Low frequency option 2.67MHz. High frequency\r
592 //!           option 5.33MHz.\r
593 //!        - \b CS_DCOFSEL_2 - Low frequency option 3.33MHz. High frequency\r
594 //!           option 6.67MHz.\r
595 //!        - \b CS_DCOFSEL_3 - Low frequency option 4MHz. High frequency option\r
596 //!           8MHz.\r
597 //!        - \b CS_DCOFSEL_4 - Low frequency option 5.33MHz. High frequency\r
598 //!           option 16MHz.\r
599 //!        - \b CS_DCOFSEL_5 - Low frequency option 6.67MHz. High frequency\r
600 //!           option 20MHz.\r
601 //!        - \b CS_DCOFSEL_6 - Low frequency option 8MHz. High frequency option\r
602 //!           24MHz.\r
603 //!\r
604 //! \return None\r
605 //\r
606 //*****************************************************************************\r
607 extern void CS_setDCOFreq(uint16_t dcorsel,\r
608                           uint16_t dcofsel);\r
609 \r
610 //*****************************************************************************\r
611 //\r
612 // Mark the end of the C bindings section for C++ compilers.\r
613 //\r
614 //*****************************************************************************\r
615 #ifdef __cplusplus\r
616 }\r
617 #endif\r
618 \r
619 #endif\r
620 #endif // __MSP430WARE_CS_H__\r