]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/MSP430X_MSP430FR5969_LaunchPad/driverlib/MSP430FR5xx_6xx/rtc_c.h
Change some data types in heap_4.c to allow it to be used on hardware that has 16...
[freertos] / FreeRTOS / Demo / MSP430X_MSP430FR5969_LaunchPad / driverlib / MSP430FR5xx_6xx / rtc_c.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 // rtc_c.h - Driver for the RTC_C Module.\r
35 //\r
36 //*****************************************************************************\r
37 \r
38 #ifndef __MSP430WARE_RTC_C_H__\r
39 #define __MSP430WARE_RTC_C_H__\r
40 \r
41 #include "inc/hw_memmap.h"\r
42 \r
43 #ifdef __MSP430_HAS_RTC_C__\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 #include "inc/hw_regaccess.h"\r
57 //*****************************************************************************\r
58 //\r
59 //! \brief Used in the RTC_C_initCalendar() function as the CalendarTime\r
60 //! parameter.\r
61 //\r
62 //*****************************************************************************\r
63 typedef struct Calendar\r
64 {\r
65     //! Seconds of minute between 0-59\r
66     uint8_t Seconds;\r
67     //! Minutes of hour between 0-59\r
68     uint8_t Minutes;\r
69     //! Hour of day between 0-23\r
70     uint8_t Hours;\r
71     //! Day of week between 0-6\r
72     uint8_t DayOfWeek;\r
73     //! Day of month between 1-31\r
74     uint8_t DayOfMonth;\r
75     //! Month between 0-11\r
76     uint8_t Month;\r
77     //! Year between 0-4095\r
78     uint16_t Year;\r
79 } Calendar;\r
80 \r
81 //*****************************************************************************\r
82 //\r
83 //! \brief Used in the RTC_C_configureCalendarAlarm() function as the param\r
84 //! parameter.\r
85 //\r
86 //*****************************************************************************\r
87 typedef struct RTC_C_configureCalendarAlarmParam\r
88 {\r
89     //! Is the alarm condition for the minutes.\r
90     //! \n Valid values are:\r
91     //! - \b RTC_C_ALARMCONDITION_OFF [Default]\r
92     uint8_t minutesAlarm;\r
93     //! Is the alarm condition for the hours.\r
94     //! \n Valid values are:\r
95     //! - \b RTC_C_ALARMCONDITION_OFF [Default]\r
96     uint8_t hoursAlarm;\r
97     //! Is the alarm condition for the day of week.\r
98     //! \n Valid values are:\r
99     //! - \b RTC_C_ALARMCONDITION_OFF [Default]\r
100     uint8_t dayOfWeekAlarm;\r
101     //! Is the alarm condition for the day of the month.\r
102     //! \n Valid values are:\r
103     //! - \b RTC_C_ALARMCONDITION_OFF [Default]\r
104     uint8_t dayOfMonthAlarm;\r
105 } RTC_C_configureCalendarAlarmParam;\r
106 \r
107 //*****************************************************************************\r
108 //\r
109 // The following are values that can be passed to the frequencySelect parameter\r
110 // for functions: RTC_C_setCalibrationFrequency().\r
111 //\r
112 //*****************************************************************************\r
113 #define RTC_C_CALIBRATIONFREQ_OFF                                   (RTCCALF_0)\r
114 #define RTC_C_CALIBRATIONFREQ_512HZ                                 (RTCCALF_1)\r
115 #define RTC_C_CALIBRATIONFREQ_256HZ                                 (RTCCALF_2)\r
116 #define RTC_C_CALIBRATIONFREQ_1HZ                                   (RTCCALF_3)\r
117 \r
118 //*****************************************************************************\r
119 //\r
120 // The following are values that can be passed to the offsetDirection parameter\r
121 // for functions: RTC_C_setCalibrationData().\r
122 //\r
123 //*****************************************************************************\r
124 #define RTC_C_CALIBRATION_DOWN1PPM                                 (!(RTCCALS))\r
125 #define RTC_C_CALIBRATION_UP1PPM                                      (RTCCALS)\r
126 \r
127 //*****************************************************************************\r
128 //\r
129 // The following are values that can be passed to the offsetDirection parameter\r
130 // for functions: RTC_C_setTemperatureCompensation().\r
131 //\r
132 //*****************************************************************************\r
133 #define RTC_C_COMPENSATION_DOWN1PPM                               (!(RTCTCMPS))\r
134 #define RTC_C_COMPENSATION_UP1PPM                                    (RTCTCMPS)\r
135 \r
136 //*****************************************************************************\r
137 //\r
138 // The following are values that can be passed to the clockSelect parameter for\r
139 // functions: RTC_C_initCounter().\r
140 //\r
141 //*****************************************************************************\r
142 #define RTC_C_CLOCKSELECT_32KHZ_OSC                                 (RTCSSEL_0)\r
143 #define RTC_C_CLOCKSELECT_RT1PS                                     (RTCSSEL_2)\r
144 \r
145 //*****************************************************************************\r
146 //\r
147 // The following are values that can be passed to the counterSizeSelect\r
148 // parameter for functions: RTC_C_initCounter().\r
149 //\r
150 //*****************************************************************************\r
151 #define RTC_C_COUNTERSIZE_8BIT                                       (RTCTEV_0)\r
152 #define RTC_C_COUNTERSIZE_16BIT                                      (RTCTEV_1)\r
153 #define RTC_C_COUNTERSIZE_24BIT                                      (RTCTEV_2)\r
154 #define RTC_C_COUNTERSIZE_32BIT                                      (RTCTEV_3)\r
155 \r
156 //*****************************************************************************\r
157 //\r
158 // The following are values that can be passed to the formatSelect parameter\r
159 // for functions: RTC_C_initCalendar().\r
160 //\r
161 //*****************************************************************************\r
162 #define RTC_C_FORMAT_BINARY                                         (!(RTCBCD))\r
163 #define RTC_C_FORMAT_BCD                                               (RTCBCD)\r
164 \r
165 //*****************************************************************************\r
166 //\r
167 // The following are values that can be passed to the param parameter for\r
168 // functions: RTC_C_configureCalendarAlarm(), RTC_C_configureCalendarAlarm(),\r
169 // RTC_C_configureCalendarAlarm(), and RTC_C_configureCalendarAlarm().\r
170 //\r
171 //*****************************************************************************\r
172 #define RTC_C_ALARMCONDITION_OFF                                         (0x80)\r
173 \r
174 //*****************************************************************************\r
175 //\r
176 // The following are values that can be passed to the eventSelect parameter for\r
177 // functions: RTC_C_setCalendarEvent().\r
178 //\r
179 //*****************************************************************************\r
180 #define RTC_C_CALENDAREVENT_MINUTECHANGE                             (RTCTEV_0)\r
181 #define RTC_C_CALENDAREVENT_HOURCHANGE                               (RTCTEV_1)\r
182 #define RTC_C_CALENDAREVENT_NOON                                     (RTCTEV_2)\r
183 #define RTC_C_CALENDAREVENT_MIDNIGHT                                 (RTCTEV_3)\r
184 \r
185 //*****************************************************************************\r
186 //\r
187 // The following are values that can be passed to the prescaleDivider parameter\r
188 // for functions: RTC_C_initCounterPrescale().\r
189 //\r
190 //*****************************************************************************\r
191 #define RTC_C_PSDIVIDER_2                                          (RT0PSDIV_0)\r
192 #define RTC_C_PSDIVIDER_4                                          (RT0PSDIV_1)\r
193 #define RTC_C_PSDIVIDER_8                                          (RT0PSDIV_2)\r
194 #define RTC_C_PSDIVIDER_16                                         (RT0PSDIV_3)\r
195 #define RTC_C_PSDIVIDER_32                                         (RT0PSDIV_4)\r
196 #define RTC_C_PSDIVIDER_64                                         (RT0PSDIV_5)\r
197 #define RTC_C_PSDIVIDER_128                                        (RT0PSDIV_6)\r
198 #define RTC_C_PSDIVIDER_256                                        (RT0PSDIV_7)\r
199 \r
200 //*****************************************************************************\r
201 //\r
202 // The following are values that can be passed to the prescaleClockSelect\r
203 // parameter for functions: RTC_C_initCounterPrescale().\r
204 //\r
205 //*****************************************************************************\r
206 #define RTC_C_PSCLOCKSELECT_ACLK                                    (RT1SSEL_0)\r
207 #define RTC_C_PSCLOCKSELECT_SMCLK                                   (RT1SSEL_1)\r
208 #define RTC_C_PSCLOCKSELECT_RT0PS                                   (RT1SSEL_2)\r
209 \r
210 //*****************************************************************************\r
211 //\r
212 // The following are values that can be passed to the prescaleEventDivider\r
213 // parameter for functions: RTC_C_definePrescaleEvent().\r
214 //\r
215 //*****************************************************************************\r
216 #define RTC_C_PSEVENTDIVIDER_2                                        (RT0IP_0)\r
217 #define RTC_C_PSEVENTDIVIDER_4                                        (RT0IP_1)\r
218 #define RTC_C_PSEVENTDIVIDER_8                                        (RT0IP_2)\r
219 #define RTC_C_PSEVENTDIVIDER_16                                       (RT0IP_3)\r
220 #define RTC_C_PSEVENTDIVIDER_32                                       (RT0IP_4)\r
221 #define RTC_C_PSEVENTDIVIDER_64                                       (RT0IP_5)\r
222 #define RTC_C_PSEVENTDIVIDER_128                                      (RT0IP_6)\r
223 #define RTC_C_PSEVENTDIVIDER_256                                      (RT0IP_7)\r
224 \r
225 //*****************************************************************************\r
226 //\r
227 // The following are values that can be passed to the prescaleSelect parameter\r
228 // for functions: RTC_C_initCounterPrescale(), RTC_C_holdCounterPrescale(),\r
229 // RTC_C_startCounterPrescale(), RTC_C_definePrescaleEvent(),\r
230 // RTC_C_getPrescaleValue(), and RTC_C_setPrescaleValue().\r
231 //\r
232 //*****************************************************************************\r
233 #define RTC_C_PRESCALE_0                                                  (0x0)\r
234 #define RTC_C_PRESCALE_1                                                  (0x2)\r
235 \r
236 //*****************************************************************************\r
237 //\r
238 // The following are values that can be passed to the interruptMask parameter\r
239 // for functions: RTC_C_enableInterrupt(), and RTC_C_disableInterrupt(); the\r
240 // interruptFlagMask parameter for functions: RTC_C_getInterruptStatus(), and\r
241 // RTC_C_clearInterrupt() as well as returned by the RTC_C_getInterruptStatus()\r
242 // function.\r
243 //\r
244 //*****************************************************************************\r
245 #define RTC_C_TIME_EVENT_INTERRUPT                                     RTCTEVIE\r
246 #define RTC_C_CLOCK_ALARM_INTERRUPT                                      RTCAIE\r
247 #define RTC_C_CLOCK_READ_READY_INTERRUPT                               RTCRDYIE\r
248 #define RTC_C_PRESCALE_TIMER0_INTERRUPT                                    0x02\r
249 #define RTC_C_PRESCALE_TIMER1_INTERRUPT                                    0x01\r
250 #define RTC_C_OSCILLATOR_FAULT_INTERRUPT                                RTCOFIE\r
251 \r
252 //*****************************************************************************\r
253 //\r
254 // Prototypes for the APIs.\r
255 //\r
256 //*****************************************************************************\r
257 \r
258 //*****************************************************************************\r
259 //\r
260 //! \brief Starts the RTC.\r
261 //!\r
262 //! This function clears the RTC main hold bit to allow the RTC to function.\r
263 //!\r
264 //! \param baseAddress is the base address of the RTC_C module.\r
265 //!\r
266 //! \return None\r
267 //\r
268 //*****************************************************************************\r
269 extern void RTC_C_startClock(uint16_t baseAddress);\r
270 \r
271 //*****************************************************************************\r
272 //\r
273 //! \brief Holds the RTC.\r
274 //!\r
275 //! This function sets the RTC main hold bit to disable RTC functionality.\r
276 //!\r
277 //! \param baseAddress is the base address of the RTC_C module.\r
278 //!\r
279 //! \return None\r
280 //\r
281 //*****************************************************************************\r
282 extern void RTC_C_holdClock(uint16_t baseAddress);\r
283 \r
284 //*****************************************************************************\r
285 //\r
286 //! \brief Allows and Sets the frequency output to RTCCLK pin for calibration\r
287 //! measurement.\r
288 //!\r
289 //! This function sets a frequency to measure at the RTCCLK output pin. After\r
290 //! testing the set frequency, the calibration could be set accordingly.\r
291 //!\r
292 //! \param baseAddress is the base address of the RTC_C module.\r
293 //! \param frequencySelect is the frequency output to RTCCLK.\r
294 //!        Valid values are:\r
295 //!        - \b RTC_C_CALIBRATIONFREQ_OFF [Default] - turn off calibration\r
296 //!           output\r
297 //!        - \b RTC_C_CALIBRATIONFREQ_512HZ - output signal at 512Hz for\r
298 //!           calibration\r
299 //!        - \b RTC_C_CALIBRATIONFREQ_256HZ - output signal at 256Hz for\r
300 //!           calibration\r
301 //!        - \b RTC_C_CALIBRATIONFREQ_1HZ - output signal at 1Hz for\r
302 //!           calibration\r
303 //!        \n Modified bits are \b RTCCALF of \b RTCCTL3 register.\r
304 //!\r
305 //! \return None\r
306 //\r
307 //*****************************************************************************\r
308 extern void RTC_C_setCalibrationFrequency(uint16_t baseAddress,\r
309                                           uint16_t frequencySelect);\r
310 \r
311 //*****************************************************************************\r
312 //\r
313 //! \brief Sets the specified calibration for the RTC.\r
314 //!\r
315 //! This function sets the calibration offset to make the RTC as accurate as\r
316 //! possible. The offsetDirection can be either +4-ppm or -2-ppm, and the\r
317 //! offsetValue should be from 1-63 and is multiplied by the direction setting\r
318 //! (i.e. +4-ppm * 8 (offsetValue) = +32-ppm).\r
319 //!\r
320 //! \param baseAddress is the base address of the RTC_C module.\r
321 //! \param offsetDirection is the direction that the calibration offset will\r
322 //!        go.\r
323 //!        Valid values are:\r
324 //!        - \b RTC_C_CALIBRATION_DOWN1PPM - calibrate at steps of -1\r
325 //!        - \b RTC_C_CALIBRATION_UP1PPM - calibrate at steps of +1\r
326 //!        \n Modified bits are \b RTC0CALS of \b RTC0CAL register.\r
327 //! \param offsetValue is the value that the offset will be a factor of; a\r
328 //!        valid value is any integer from 1-240.\r
329 //!        \n Modified bits are \b RTC0CALx of \b RTC0CAL register.\r
330 //!\r
331 //! \return None\r
332 //\r
333 //*****************************************************************************\r
334 extern void RTC_C_setCalibrationData(uint16_t baseAddress,\r
335                                      uint8_t offsetDirection,\r
336                                      uint8_t offsetValue);\r
337 \r
338 //*****************************************************************************\r
339 //\r
340 //! \brief Initializes the settings to operate the RTC in Counter mode.\r
341 //!\r
342 //! This function initializes the Counter mode of the RTC_C. Setting the clock\r
343 //! source and counter size will allow an interrupt from the RTCTEVIFG once an\r
344 //! overflow to the counter register occurs.\r
345 //!\r
346 //! \param baseAddress is the base address of the RTC_C module.\r
347 //! \param clockSelect is the selected clock for the counter mode to use.\r
348 //!        Valid values are:\r
349 //!        - \b RTC_C_CLOCKSELECT_32KHZ_OSC\r
350 //!        - \b RTC_C_CLOCKSELECT_RT1PS\r
351 //!        \n Modified bits are \b RTCSSEL of \b RTCCTL1 register.\r
352 //! \param counterSizeSelect is the size of the counter.\r
353 //!        Valid values are:\r
354 //!        - \b RTC_C_COUNTERSIZE_8BIT [Default]\r
355 //!        - \b RTC_C_COUNTERSIZE_16BIT\r
356 //!        - \b RTC_C_COUNTERSIZE_24BIT\r
357 //!        - \b RTC_C_COUNTERSIZE_32BIT\r
358 //!        \n Modified bits are \b RTCTEV of \b RTCCTL1 register.\r
359 //!\r
360 //! \return None\r
361 //\r
362 //*****************************************************************************\r
363 extern void RTC_C_initCounter(uint16_t baseAddress,\r
364                               uint16_t clockSelect,\r
365                               uint16_t counterSizeSelect);\r
366 \r
367 //*****************************************************************************\r
368 //\r
369 //! \brief Sets the specified temperature compensation for the RTC.\r
370 //!\r
371 //! This function sets the calibration offset to make the RTC as accurate as\r
372 //! possible. The offsetDirection can be either +1-ppm or -1-ppm, and the\r
373 //! offsetValue should be from 1-240 and is multiplied by the direction setting\r
374 //! (i.e. +1-ppm * 8 (offsetValue) = +8-ppm).\r
375 //!\r
376 //! \param baseAddress is the base address of the RTC_C module.\r
377 //! \param offsetDirection is the direction that the calibration offset wil go\r
378 //!        Valid values are:\r
379 //!        - \b RTC_C_COMPENSATION_DOWN1PPM\r
380 //!        - \b RTC_C_COMPENSATION_UP1PPM\r
381 //!        \n Modified bits are \b RTCTCMPS of \b RTCTCMP register.\r
382 //! \param offsetValue is the value that the offset will be a factor of; a\r
383 //!        valid value is any integer from 1-240.\r
384 //!        \n Modified bits are \b RTCTCMPx of \b RTCTCMP register.\r
385 //!\r
386 //! \return STATUS_SUCCESS or STATUS_FAILURE of setting the temperature\r
387 //!         compensation\r
388 //\r
389 //*****************************************************************************\r
390 extern bool RTC_C_setTemperatureCompensation(uint16_t baseAddress,\r
391                                              uint16_t offsetDirection,\r
392                                              uint8_t offsetValue);\r
393 \r
394 //*****************************************************************************\r
395 //\r
396 //! \brief Initializes the settings to operate the RTC in calendar mode\r
397 //!\r
398 //! This function initializes the Calendar mode of the RTC module. To prevent\r
399 //! potential erroneous alarm conditions from occurring, the alarm should be\r
400 //! disabled by clearing the RTCAIE, RTCAIFG and AE bits with APIs:\r
401 //! RTC_C_disableInterrupt(), RTC_C_clearInterrupt() and\r
402 //! RTC_C_configureCalendarAlarm() before calendar initialization.\r
403 //!\r
404 //! \param baseAddress is the base address of the RTC_C module.\r
405 //! \param CalendarTime is the pointer to the structure containing the values\r
406 //!        for the Calendar to be initialized to. Valid values should be of\r
407 //!        type pointer to Calendar and should contain the following members\r
408 //!        and corresponding values: \b Seconds between 0-59 \b Minutes between\r
409 //!        0-59 \b Hours between 0-23 \b DayOfWeek between 0-6 \b DayOfMonth\r
410 //!        between 1-31 \b Year between 0-4095 NOTE: Values beyond the ones\r
411 //!        specified may result in erratic behavior.\r
412 //! \param formatSelect is the format for the Calendar registers to use.\r
413 //!        Valid values are:\r
414 //!        - \b RTC_C_FORMAT_BINARY [Default]\r
415 //!        - \b RTC_C_FORMAT_BCD\r
416 //!        \n Modified bits are \b RTCBCD of \b RTCCTL1 register.\r
417 //!\r
418 //! \return None\r
419 //\r
420 //*****************************************************************************\r
421 extern void RTC_C_initCalendar(uint16_t baseAddress,\r
422                                Calendar *CalendarTime,\r
423                                uint16_t formatSelect);\r
424 \r
425 //*****************************************************************************\r
426 //\r
427 //! \brief Returns the Calendar Time stored in the Calendar registers of the\r
428 //! RTC.\r
429 //!\r
430 //! This function returns the current Calendar time in the form of a Calendar\r
431 //! structure. The RTCRDY polling is used in this function to prevent reading\r
432 //! invalid time.\r
433 //!\r
434 //! \param baseAddress is the base address of the RTC_C module.\r
435 //!\r
436 //! \return A Calendar structure containing the current time.\r
437 //\r
438 //*****************************************************************************\r
439 extern Calendar RTC_C_getCalendarTime(uint16_t baseAddress);\r
440 \r
441 //*****************************************************************************\r
442 //\r
443 //! \brief Sets and Enables the desired Calendar Alarm settings.\r
444 //!\r
445 //! This function sets a Calendar interrupt condition to assert the RTCAIFG\r
446 //! interrupt flag. The condition is a logical and of all of the parameters.\r
447 //! For example if the minutes and hours alarm is set, then the interrupt will\r
448 //! only assert when the minutes AND the hours change to the specified setting.\r
449 //! Use the RTC_C_ALARM_OFF for any alarm settings that should not be apart of\r
450 //! the alarm condition.\r
451 //!\r
452 //! \param baseAddress is the base address of the RTC_C module.\r
453 //! \param param is the pointer to struct for calendar alarm configuration.\r
454 //!\r
455 //! \return None\r
456 //\r
457 //*****************************************************************************\r
458 extern void RTC_C_configureCalendarAlarm(uint16_t baseAddress,\r
459                                          RTC_C_configureCalendarAlarmParam *param);\r
460 \r
461 //*****************************************************************************\r
462 //\r
463 //! \brief Sets a single specified Calendar interrupt condition\r
464 //!\r
465 //! This function sets a specified event to assert the RTCTEVIFG interrupt.\r
466 //! This interrupt is independent from the Calendar alarm interrupt.\r
467 //!\r
468 //! \param baseAddress is the base address of the RTC_C module.\r
469 //! \param eventSelect is the condition selected.\r
470 //!        Valid values are:\r
471 //!        - \b RTC_C_CALENDAREVENT_MINUTECHANGE - assert interrupt on every\r
472 //!           minute\r
473 //!        - \b RTC_C_CALENDAREVENT_HOURCHANGE - assert interrupt on every hour\r
474 //!        - \b RTC_C_CALENDAREVENT_NOON - assert interrupt when hour is 12\r
475 //!        - \b RTC_C_CALENDAREVENT_MIDNIGHT - assert interrupt when hour is 0\r
476 //!        \n Modified bits are \b RTCTEV of \b RTCCTL register.\r
477 //!\r
478 //! \return None\r
479 //\r
480 //*****************************************************************************\r
481 extern void RTC_C_setCalendarEvent(uint16_t baseAddress,\r
482                                    uint16_t eventSelect);\r
483 \r
484 //*****************************************************************************\r
485 //\r
486 //! \brief Returns the value of the Counter register.\r
487 //!\r
488 //! This function returns the value of the counter register for the RTC_C\r
489 //! module. It will return the 32-bit value no matter the size set during\r
490 //! initialization. The RTC should be held before trying to use this function.\r
491 //!\r
492 //! \param baseAddress is the base address of the RTC_C module.\r
493 //!\r
494 //! \return The raw value of the full 32-bit Counter Register.\r
495 //\r
496 //*****************************************************************************\r
497 extern uint32_t RTC_C_getCounterValue(uint16_t baseAddress);\r
498 \r
499 //*****************************************************************************\r
500 //\r
501 //! \brief Sets the value of the Counter register\r
502 //!\r
503 //! This function sets the counter register of the RTC_C module.\r
504 //!\r
505 //! \param baseAddress is the base address of the RTC_C module.\r
506 //! \param counterValue is the value to set the Counter register to; a valid\r
507 //!        value may be any 32-bit integer.\r
508 //!\r
509 //! \return None\r
510 //\r
511 //*****************************************************************************\r
512 extern void RTC_C_setCounterValue(uint16_t baseAddress,\r
513                                   uint32_t counterValue);\r
514 \r
515 //*****************************************************************************\r
516 //\r
517 //! \brief Initializes the Prescaler for Counter mode.\r
518 //!\r
519 //! This function initializes the selected prescaler for the counter mode in\r
520 //! the RTC_C module. If the RTC is initialized in Calendar mode, then these\r
521 //! are automatically initialized. The Prescalers can be used to divide a clock\r
522 //! source additionally before it gets to the main RTC clock.\r
523 //!\r
524 //! \param baseAddress is the base address of the RTC_C module.\r
525 //! \param prescaleSelect is the prescaler to initialize.\r
526 //!        Valid values are:\r
527 //!        - \b RTC_C_PRESCALE_0\r
528 //!        - \b RTC_C_PRESCALE_1\r
529 //! \param prescaleClockSelect is the clock to drive the selected prescaler.\r
530 //!        Valid values are:\r
531 //!        - \b RTC_C_PSCLOCKSELECT_ACLK\r
532 //!        - \b RTC_C_PSCLOCKSELECT_SMCLK\r
533 //!        - \b RTC_C_PSCLOCKSELECT_RT0PS - use Prescaler 0 as source to\r
534 //!           Prescaler 1 (May only be used if prescaleSelect is\r
535 //!           RTC_C_PRESCALE_1)\r
536 //!        \n Modified bits are \b RTxSSEL of \b RTCPSxCTL register.\r
537 //! \param prescaleDivider is the divider for the selected clock source.\r
538 //!        Valid values are:\r
539 //!        - \b RTC_C_PSDIVIDER_2 [Default]\r
540 //!        - \b RTC_C_PSDIVIDER_4\r
541 //!        - \b RTC_C_PSDIVIDER_8\r
542 //!        - \b RTC_C_PSDIVIDER_16\r
543 //!        - \b RTC_C_PSDIVIDER_32\r
544 //!        - \b RTC_C_PSDIVIDER_64\r
545 //!        - \b RTC_C_PSDIVIDER_128\r
546 //!        - \b RTC_C_PSDIVIDER_256\r
547 //!        \n Modified bits are \b RTxPSDIV of \b RTCPSxCTL register.\r
548 //!\r
549 //! \return None\r
550 //\r
551 //*****************************************************************************\r
552 extern void RTC_C_initCounterPrescale(uint16_t baseAddress,\r
553                                       uint8_t prescaleSelect,\r
554                                       uint16_t prescaleClockSelect,\r
555                                       uint16_t prescaleDivider);\r
556 \r
557 //*****************************************************************************\r
558 //\r
559 //! \brief Holds the selected Prescaler.\r
560 //!\r
561 //! This function holds the prescale counter from continuing. This will only\r
562 //! work in counter mode, in Calendar mode, the RTC_C_holdClock() must be used.\r
563 //! In counter mode, if using both prescalers in conjunction with the main RTC\r
564 //! counter, then stopping RT0PS will stop RT1PS, but stopping RT1PS will not\r
565 //! stop RT0PS.\r
566 //!\r
567 //! \param baseAddress is the base address of the RTC_C module.\r
568 //! \param prescaleSelect is the prescaler to hold.\r
569 //!        Valid values are:\r
570 //!        - \b RTC_C_PRESCALE_0\r
571 //!        - \b RTC_C_PRESCALE_1\r
572 //!\r
573 //! \return None\r
574 //\r
575 //*****************************************************************************\r
576 extern void RTC_C_holdCounterPrescale(uint16_t baseAddress,\r
577                                       uint8_t prescaleSelect);\r
578 \r
579 //*****************************************************************************\r
580 //\r
581 //! \brief Starts the selected Prescaler.\r
582 //!\r
583 //! This function starts the selected prescale counter. This function will only\r
584 //! work if the RTC is in counter mode.\r
585 //!\r
586 //! \param baseAddress is the base address of the RTC_C module.\r
587 //! \param prescaleSelect is the prescaler to start.\r
588 //!        Valid values are:\r
589 //!        - \b RTC_C_PRESCALE_0\r
590 //!        - \b RTC_C_PRESCALE_1\r
591 //!\r
592 //! \return None\r
593 //\r
594 //*****************************************************************************\r
595 extern void RTC_C_startCounterPrescale(uint16_t baseAddress,\r
596                                        uint8_t prescaleSelect);\r
597 \r
598 //*****************************************************************************\r
599 //\r
600 //! \brief Sets up an interrupt condition for the selected Prescaler.\r
601 //!\r
602 //! This function sets the condition for an interrupt to assert based on the\r
603 //! individual prescalers.\r
604 //!\r
605 //! \param baseAddress is the base address of the RTC_C module.\r
606 //! \param prescaleSelect is the prescaler to define an interrupt for.\r
607 //!        Valid values are:\r
608 //!        - \b RTC_C_PRESCALE_0\r
609 //!        - \b RTC_C_PRESCALE_1\r
610 //! \param prescaleEventDivider is a divider to specify when an interrupt can\r
611 //!        occur based on the clock source of the selected prescaler. (Does not\r
612 //!        affect timer of the selected prescaler).\r
613 //!        Valid values are:\r
614 //!        - \b RTC_C_PSEVENTDIVIDER_2 [Default]\r
615 //!        - \b RTC_C_PSEVENTDIVIDER_4\r
616 //!        - \b RTC_C_PSEVENTDIVIDER_8\r
617 //!        - \b RTC_C_PSEVENTDIVIDER_16\r
618 //!        - \b RTC_C_PSEVENTDIVIDER_32\r
619 //!        - \b RTC_C_PSEVENTDIVIDER_64\r
620 //!        - \b RTC_C_PSEVENTDIVIDER_128\r
621 //!        - \b RTC_C_PSEVENTDIVIDER_256\r
622 //!        \n Modified bits are \b RTxIP of \b RTCPSxCTL register.\r
623 //!\r
624 //! \return None\r
625 //\r
626 //*****************************************************************************\r
627 extern void RTC_C_definePrescaleEvent(uint16_t baseAddress,\r
628                                       uint8_t prescaleSelect,\r
629                                       uint8_t prescaleEventDivider);\r
630 \r
631 //*****************************************************************************\r
632 //\r
633 //! \brief Returns the selected prescaler value.\r
634 //!\r
635 //! This function returns the value of the selected prescale counter register.\r
636 //! Note that the counter value should be held by calling RTC_C_holdClock()\r
637 //! before calling this API.\r
638 //!\r
639 //! \param baseAddress is the base address of the RTC_C module.\r
640 //! \param prescaleSelect is the prescaler to obtain the value of.\r
641 //!        Valid values are:\r
642 //!        - \b RTC_C_PRESCALE_0\r
643 //!        - \b RTC_C_PRESCALE_1\r
644 //!\r
645 //! \return The value of the specified prescaler count register\r
646 //\r
647 //*****************************************************************************\r
648 extern uint8_t RTC_C_getPrescaleValue(uint16_t baseAddress,\r
649                                       uint8_t prescaleSelect);\r
650 \r
651 //*****************************************************************************\r
652 //\r
653 //! \brief Sets the selected Prescaler value.\r
654 //!\r
655 //! This function sets the prescale counter value. Before setting the prescale\r
656 //! counter, it should be held by calling RTC_C_holdClock().\r
657 //!\r
658 //! \param baseAddress is the base address of the RTC_C module.\r
659 //! \param prescaleSelect is the prescaler to set the value for.\r
660 //!        Valid values are:\r
661 //!        - \b RTC_C_PRESCALE_0\r
662 //!        - \b RTC_C_PRESCALE_1\r
663 //! \param prescaleCounterValue is the specified value to set the prescaler to.\r
664 //!        Valid values are any integer between 0-255\r
665 //!        \n Modified bits are \b RTxPS of \b RTxPS register.\r
666 //!\r
667 //! \return None\r
668 //\r
669 //*****************************************************************************\r
670 extern void RTC_C_setPrescaleValue(uint16_t baseAddress,\r
671                                    uint8_t prescaleSelect,\r
672                                    uint8_t prescaleCounterValue);\r
673 \r
674 //*****************************************************************************\r
675 //\r
676 //! \brief Enables selected RTC interrupt sources.\r
677 //!\r
678 //! This function enables the selected RTC interrupt source.  Only the sources\r
679 //! that are enabled can be reflected to the processor interrupt; disabled\r
680 //! sources have no effect on the processor. Does not clear interrupt flags.\r
681 //!\r
682 //! \param baseAddress is the base address of the RTC_C module.\r
683 //! \param interruptMask is a bit mask of the interrupts to enable.\r
684 //!        Mask value is the logical OR of any of the following:\r
685 //!        - \b RTC_C_TIME_EVENT_INTERRUPT - asserts when counter overflows in\r
686 //!           counter mode or when Calendar event condition defined by\r
687 //!           defineCalendarEvent() is met.\r
688 //!        - \b RTC_C_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in\r
689 //!           Calendar mode is met.\r
690 //!        - \b RTC_C_CLOCK_READ_READY_INTERRUPT - asserts when Calendar\r
691 //!           registers are settled.\r
692 //!        - \b RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0\r
693 //!           event condition is met.\r
694 //!        - \b RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1\r
695 //!           event condition is met.\r
696 //!        - \b RTC_C_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a\r
697 //!           problem with the 32kHz oscillator, while the RTC is running.\r
698 //!\r
699 //! \return None\r
700 //\r
701 //*****************************************************************************\r
702 extern void RTC_C_enableInterrupt(uint16_t baseAddress,\r
703                                   uint8_t interruptMask);\r
704 \r
705 //*****************************************************************************\r
706 //\r
707 //! \brief Disables selected RTC interrupt sources.\r
708 //!\r
709 //! This function disables the selected RTC interrupt source. Only the sources\r
710 //! that are enabled can be reflected to the processor interrupt; disabled\r
711 //! sources have no effect on the processor.\r
712 //!\r
713 //! \param baseAddress is the base address of the RTC_C module.\r
714 //! \param interruptMask is a bit mask of the interrupts to disable.\r
715 //!        Mask value is the logical OR of any of the following:\r
716 //!        - \b RTC_C_TIME_EVENT_INTERRUPT - asserts when counter overflows in\r
717 //!           counter mode or when Calendar event condition defined by\r
718 //!           defineCalendarEvent() is met.\r
719 //!        - \b RTC_C_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in\r
720 //!           Calendar mode is met.\r
721 //!        - \b RTC_C_CLOCK_READ_READY_INTERRUPT - asserts when Calendar\r
722 //!           registers are settled.\r
723 //!        - \b RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0\r
724 //!           event condition is met.\r
725 //!        - \b RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1\r
726 //!           event condition is met.\r
727 //!        - \b RTC_C_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a\r
728 //!           problem with the 32kHz oscillator, while the RTC is running.\r
729 //!\r
730 //! \return None\r
731 //\r
732 //*****************************************************************************\r
733 extern void RTC_C_disableInterrupt(uint16_t baseAddress,\r
734                                    uint8_t interruptMask);\r
735 \r
736 //*****************************************************************************\r
737 //\r
738 //! \brief Returns the status of the selected interrupts flags.\r
739 //!\r
740 //! This function returns the status of the interrupt flag for the selected\r
741 //! channel.\r
742 //!\r
743 //! \param baseAddress is the base address of the RTC_C module.\r
744 //! \param interruptFlagMask is a bit mask of the interrupt flags to return the\r
745 //!        status of.\r
746 //!        Mask value is the logical OR of any of the following:\r
747 //!        - \b RTC_C_TIME_EVENT_INTERRUPT - asserts when counter overflows in\r
748 //!           counter mode or when Calendar event condition defined by\r
749 //!           defineCalendarEvent() is met.\r
750 //!        - \b RTC_C_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in\r
751 //!           Calendar mode is met.\r
752 //!        - \b RTC_C_CLOCK_READ_READY_INTERRUPT - asserts when Calendar\r
753 //!           registers are settled.\r
754 //!        - \b RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0\r
755 //!           event condition is met.\r
756 //!        - \b RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1\r
757 //!           event condition is met.\r
758 //!        - \b RTC_C_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a\r
759 //!           problem with the 32kHz oscillator, while the RTC is running.\r
760 //!\r
761 //! \return Logical OR of any of the following:\r
762 //!         - \b RTC_C_TIME_EVENT_INTERRUPT asserts when counter overflows in\r
763 //!         counter mode or when Calendar event condition defined by\r
764 //!         defineCalendarEvent() is met.\r
765 //!         - \b RTC_C_CLOCK_ALARM_INTERRUPT asserts when alarm condition in\r
766 //!         Calendar mode is met.\r
767 //!         - \b RTC_C_CLOCK_READ_READY_INTERRUPT asserts when Calendar\r
768 //!         registers are settled.\r
769 //!         - \b RTC_C_PRESCALE_TIMER0_INTERRUPT asserts when Prescaler 0 event\r
770 //!         condition is met.\r
771 //!         - \b RTC_C_PRESCALE_TIMER1_INTERRUPT asserts when Prescaler 1 event\r
772 //!         condition is met.\r
773 //!         - \b RTC_C_OSCILLATOR_FAULT_INTERRUPT asserts if there is a problem\r
774 //!         with the 32kHz oscillator, while the RTC is running.\r
775 //!         \n indicating the status of the masked interrupts\r
776 //\r
777 //*****************************************************************************\r
778 extern uint8_t RTC_C_getInterruptStatus(uint16_t baseAddress,\r
779                                         uint8_t interruptFlagMask);\r
780 \r
781 //*****************************************************************************\r
782 //\r
783 //! \brief Clears selected RTC interrupt flags.\r
784 //!\r
785 //! This function clears the RTC interrupt flag is cleared, so that it no\r
786 //! longer asserts.\r
787 //!\r
788 //! \param baseAddress is the base address of the RTC_C module.\r
789 //! \param interruptFlagMask is a bit mask of the interrupt flags to be\r
790 //!        cleared.\r
791 //!        Mask value is the logical OR of any of the following:\r
792 //!        - \b RTC_C_TIME_EVENT_INTERRUPT - asserts when counter overflows in\r
793 //!           counter mode or when Calendar event condition defined by\r
794 //!           defineCalendarEvent() is met.\r
795 //!        - \b RTC_C_CLOCK_ALARM_INTERRUPT - asserts when alarm condition in\r
796 //!           Calendar mode is met.\r
797 //!        - \b RTC_C_CLOCK_READ_READY_INTERRUPT - asserts when Calendar\r
798 //!           registers are settled.\r
799 //!        - \b RTC_C_PRESCALE_TIMER0_INTERRUPT - asserts when Prescaler 0\r
800 //!           event condition is met.\r
801 //!        - \b RTC_C_PRESCALE_TIMER1_INTERRUPT - asserts when Prescaler 1\r
802 //!           event condition is met.\r
803 //!        - \b RTC_C_OSCILLATOR_FAULT_INTERRUPT - asserts if there is a\r
804 //!           problem with the 32kHz oscillator, while the RTC is running.\r
805 //!\r
806 //! \return None\r
807 //\r
808 //*****************************************************************************\r
809 extern void RTC_C_clearInterrupt(uint16_t baseAddress,\r
810                                  uint8_t interruptFlagMask);\r
811 \r
812 //*****************************************************************************\r
813 //\r
814 //! \brief Convert the given BCD value to binary format\r
815 //!\r
816 //! This function converts BCD values to binary format. This API uses the\r
817 //! hardware registers to perform the conversion rather than a software method.\r
818 //!\r
819 //! \param baseAddress is the base address of the RTC_C module.\r
820 //! \param valueToConvert is the raw value in BCD format to convert to Binary.\r
821 //!        \n Modified bits are \b BCD2BIN of \b BCD2BIN register.\r
822 //!\r
823 //! \return The binary version of the input parameter\r
824 //\r
825 //*****************************************************************************\r
826 extern uint16_t RTC_C_convertBCDToBinary(uint16_t baseAddress,\r
827                                          uint16_t valueToConvert);\r
828 \r
829 //*****************************************************************************\r
830 //\r
831 //! \brief Convert the given binary value to BCD format\r
832 //!\r
833 //! This function converts binary values to BCD format. This API uses the\r
834 //! hardware registers to perform the conversion rather than a software method.\r
835 //!\r
836 //! \param baseAddress is the base address of the RTC_C module.\r
837 //! \param valueToConvert is the raw value in Binary format to convert to BCD.\r
838 //!        \n Modified bits are \b BIN2BCD of \b BIN2BCD register.\r
839 //!\r
840 //! \return The BCD version of the valueToConvert parameter\r
841 //\r
842 //*****************************************************************************\r
843 extern uint16_t RTC_C_convertBinaryToBCD(uint16_t baseAddress,\r
844                                          uint16_t valueToConvert);\r
845 \r
846 //*****************************************************************************\r
847 //\r
848 // Mark the end of the C bindings section for C++ compilers.\r
849 //\r
850 //*****************************************************************************\r
851 #ifdef __cplusplus\r
852 }\r
853 #endif\r
854 \r
855 #endif\r
856 #endif // __MSP430WARE_RTC_C_H__\r