mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Thu Apr 03 11:45:06 2014 +0100
Revision:
149:1fb5f62b92bd
Parent:
targets/hal/TARGET_Freescale/TARGET_KSDK_MCUS/TARGET_KSDK_CODE/hal/rtc/fsl_rtc_hal_monotonic.h@146:f64d43ff0c18
Synchronized with git revision 220c0bb39ceee40016e1e86350c058963d01ed42

Full URL: https://github.com/mbedmicro/mbed/commit/220c0bb39ceee40016e1e86350c058963d01ed42/

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 146:f64d43ff0c18 1 /*
mbed_official 146:f64d43ff0c18 2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
mbed_official 146:f64d43ff0c18 3 * All rights reserved.
mbed_official 146:f64d43ff0c18 4 *
mbed_official 146:f64d43ff0c18 5 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 146:f64d43ff0c18 6 * are permitted provided that the following conditions are met:
mbed_official 146:f64d43ff0c18 7 *
mbed_official 146:f64d43ff0c18 8 * o Redistributions of source code must retain the above copyright notice, this list
mbed_official 146:f64d43ff0c18 9 * of conditions and the following disclaimer.
mbed_official 146:f64d43ff0c18 10 *
mbed_official 146:f64d43ff0c18 11 * o Redistributions in binary form must reproduce the above copyright notice, this
mbed_official 146:f64d43ff0c18 12 * list of conditions and the following disclaimer in the documentation and/or
mbed_official 146:f64d43ff0c18 13 * other materials provided with the distribution.
mbed_official 146:f64d43ff0c18 14 *
mbed_official 146:f64d43ff0c18 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
mbed_official 146:f64d43ff0c18 16 * contributors may be used to endorse or promote products derived from this
mbed_official 146:f64d43ff0c18 17 * software without specific prior written permission.
mbed_official 146:f64d43ff0c18 18 *
mbed_official 146:f64d43ff0c18 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
mbed_official 146:f64d43ff0c18 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
mbed_official 146:f64d43ff0c18 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 146:f64d43ff0c18 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
mbed_official 146:f64d43ff0c18 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
mbed_official 146:f64d43ff0c18 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 146:f64d43ff0c18 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
mbed_official 146:f64d43ff0c18 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
mbed_official 146:f64d43ff0c18 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
mbed_official 146:f64d43ff0c18 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 146:f64d43ff0c18 29 */
mbed_official 146:f64d43ff0c18 30 #if !defined(__FSL_RTC_HAL_MONOTONIC_H__)
mbed_official 146:f64d43ff0c18 31 #define __FSL_RTC_HAL_MONOTONIC_H__
mbed_official 146:f64d43ff0c18 32
mbed_official 146:f64d43ff0c18 33
mbed_official 146:f64d43ff0c18 34 #include "fsl_rtc_features.h"
mbed_official 146:f64d43ff0c18 35 #include "device/fsl_device_registers.h"
mbed_official 146:f64d43ff0c18 36 #include <stdint.h>
mbed_official 146:f64d43ff0c18 37 #include <stdbool.h>
mbed_official 146:f64d43ff0c18 38
mbed_official 146:f64d43ff0c18 39
mbed_official 146:f64d43ff0c18 40
mbed_official 146:f64d43ff0c18 41 /*! @addtogroup rtc_hal*/
mbed_official 146:f64d43ff0c18 42 /*! @{*/
mbed_official 146:f64d43ff0c18 43
mbed_official 146:f64d43ff0c18 44
mbed_official 146:f64d43ff0c18 45 /*******************************************************************************
mbed_official 146:f64d43ff0c18 46 * Definitions
mbed_official 146:f64d43ff0c18 47 ******************************************************************************/
mbed_official 146:f64d43ff0c18 48
mbed_official 146:f64d43ff0c18 49
mbed_official 146:f64d43ff0c18 50
mbed_official 146:f64d43ff0c18 51 /*******************************************************************************
mbed_official 146:f64d43ff0c18 52 * API
mbed_official 146:f64d43ff0c18 53 ******************************************************************************/
mbed_official 146:f64d43ff0c18 54
mbed_official 146:f64d43ff0c18 55 #if FSL_FEATURE_RTC_HAS_MONOTONIC
mbed_official 146:f64d43ff0c18 56
mbed_official 146:f64d43ff0c18 57 #if defined(__cplusplus)
mbed_official 146:f64d43ff0c18 58 extern "C" {
mbed_official 146:f64d43ff0c18 59 #endif
mbed_official 146:f64d43ff0c18 60
mbed_official 146:f64d43ff0c18 61
mbed_official 146:f64d43ff0c18 62 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 63 /* RTC Monotonic Counter Register Reset Functions*/
mbed_official 146:f64d43ff0c18 64 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 65
mbed_official 146:f64d43ff0c18 66 /*! @brief Resets the RTC Monotonic Enable Register (RTC_MER).*/
mbed_official 146:f64d43ff0c18 67 static inline void rtc_hal_reset_reg_MER(void)
mbed_official 146:f64d43ff0c18 68 {
mbed_official 146:f64d43ff0c18 69 HW_RTC_MER_WR((uint32_t)0x00000000U);
mbed_official 146:f64d43ff0c18 70 }
mbed_official 146:f64d43ff0c18 71
mbed_official 146:f64d43ff0c18 72 /*! @brief Resets the RTC Monotonic Counter Low Register (RTC_MCLR).*/
mbed_official 146:f64d43ff0c18 73 static inline void rtc_hal_reset_reg_MCLR(void)
mbed_official 146:f64d43ff0c18 74 {
mbed_official 146:f64d43ff0c18 75 HW_RTC_MCLR_WR((uint32_t)0x00000000U);
mbed_official 146:f64d43ff0c18 76 }
mbed_official 146:f64d43ff0c18 77
mbed_official 146:f64d43ff0c18 78 /*! @brief Resets the RTC Monotonic Counter High Register (RTC_MCHR).*/
mbed_official 146:f64d43ff0c18 79 static inline void rtc_hal_reset_reg_MCHR(void)
mbed_official 146:f64d43ff0c18 80 {
mbed_official 146:f64d43ff0c18 81 HW_RTC_MCHR_WR((uint32_t)0x00000000U);
mbed_official 146:f64d43ff0c18 82 }
mbed_official 146:f64d43ff0c18 83
mbed_official 146:f64d43ff0c18 84 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 85 /* RTC Monotonic Enable*/
mbed_official 146:f64d43ff0c18 86 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 87
mbed_official 146:f64d43ff0c18 88 /*! @brief For the monotonic counter reads the mode writing.
mbed_official 146:f64d43ff0c18 89 * @return true: Enables writing to the monotonic counter increment the counter.
mbed_official 146:f64d43ff0c18 90 * false: Enables writing to the monotonic counter load the counter with the
mbed_official 146:f64d43ff0c18 91 * value written.
mbed_official 146:f64d43ff0c18 92 */
mbed_official 146:f64d43ff0c18 93 static inline bool rtc_hal_read_monotonic_enable(void)
mbed_official 146:f64d43ff0c18 94 {
mbed_official 146:f64d43ff0c18 95 /* reads the value of the RTC Monotonic Enable Register (RTC_MER), field
mbed_official 146:f64d43ff0c18 96 * Monotonic Counter Enable (MCE). */
mbed_official 146:f64d43ff0c18 97 return (bool)BR_RTC_MER_MCE;
mbed_official 146:f64d43ff0c18 98 }
mbed_official 146:f64d43ff0c18 99
mbed_official 146:f64d43ff0c18 100 /*! @brief Changes the state of the Monotonic Counter Enable.
mbed_official 146:f64d43ff0c18 101 * @param enable true: Writes to the monotonic counter increment the counter.
mbed_official 146:f64d43ff0c18 102 * false: Writes to the monotonic counter load the counter with the
mbed_official 146:f64d43ff0c18 103 * value written.
mbed_official 146:f64d43ff0c18 104 */
mbed_official 146:f64d43ff0c18 105 static inline void rtc_hal_config_monotonic_enable(bool enable)
mbed_official 146:f64d43ff0c18 106 {
mbed_official 146:f64d43ff0c18 107 /* writes to the RTC Monotonic Enable Register (RTC_MER), field Monotonic
mbed_official 146:f64d43ff0c18 108 * Counter Enable (MCE).*/
mbed_official 146:f64d43ff0c18 109 BW_RTC_MER_MCE((uint32_t) enable);
mbed_official 146:f64d43ff0c18 110 }
mbed_official 146:f64d43ff0c18 111
mbed_official 146:f64d43ff0c18 112 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 113 /* RTC Monotonic Counter*/
mbed_official 146:f64d43ff0c18 114 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 115
mbed_official 146:f64d43ff0c18 116 /*! @brief Reads the values of the Monotonic Counter High and the Monotonic Counter
mbed_official 146:f64d43ff0c18 117 * Low and returns them into a single value.
mbed_official 146:f64d43ff0c18 118 * @param counter [out] pointer to variable where the value is stored.
mbed_official 146:f64d43ff0c18 119 */
mbed_official 146:f64d43ff0c18 120 static inline void rtc_hal_get_monotonic_counter(uint64_t * counter)
mbed_official 146:f64d43ff0c18 121 {
mbed_official 146:f64d43ff0c18 122 /* check for null pointer*/
mbed_official 146:f64d43ff0c18 123 if(NULL == counter)
mbed_official 146:f64d43ff0c18 124 {
mbed_official 146:f64d43ff0c18 125 return;
mbed_official 146:f64d43ff0c18 126 }
mbed_official 146:f64d43ff0c18 127
mbed_official 146:f64d43ff0c18 128 uint64_t tmpCountHigh = 0;
mbed_official 146:f64d43ff0c18 129
mbed_official 146:f64d43ff0c18 130 /* store in temporal variable to avoid compile warning*/
mbed_official 146:f64d43ff0c18 131 tmpCountHigh = BR_RTC_MCHR_MCH;
mbed_official 146:f64d43ff0c18 132
mbed_official 146:f64d43ff0c18 133 *counter = (((uint64_t)(tmpCountHigh) << 32) | ((uint64_t)(BR_RTC_MCLR_MCL)));
mbed_official 146:f64d43ff0c18 134 }
mbed_official 146:f64d43ff0c18 135
mbed_official 146:f64d43ff0c18 136 /*! @brief Writes values Monotonic Counter High and Monotonic Counter Low
mbed_official 146:f64d43ff0c18 137 * by decomposing the given single value.
mbed_official 146:f64d43ff0c18 138 * @param counter [in] pointer to the variable where the value is stored.
mbed_official 146:f64d43ff0c18 139 */
mbed_official 146:f64d43ff0c18 140 static inline void rtc_hal_set_monotonic_counter(const uint64_t * counter)
mbed_official 146:f64d43ff0c18 141 {
mbed_official 146:f64d43ff0c18 142 /* check for null pointer*/
mbed_official 146:f64d43ff0c18 143 if(NULL == counter)
mbed_official 146:f64d43ff0c18 144 {
mbed_official 146:f64d43ff0c18 145 return;
mbed_official 146:f64d43ff0c18 146 }
mbed_official 146:f64d43ff0c18 147
mbed_official 146:f64d43ff0c18 148 /* enable writing to the counter*/
mbed_official 146:f64d43ff0c18 149 BW_RTC_MER_MCE(0U);
mbed_official 146:f64d43ff0c18 150
mbed_official 146:f64d43ff0c18 151 BW_RTC_MCLR_MCL((uint32_t)(*counter));
mbed_official 146:f64d43ff0c18 152
mbed_official 146:f64d43ff0c18 153 /* enable writing to the counter*/
mbed_official 146:f64d43ff0c18 154 BW_RTC_MER_MCE(0U);
mbed_official 146:f64d43ff0c18 155
mbed_official 146:f64d43ff0c18 156 BW_RTC_MCHR_MCH((uint32_t)((*counter) >> 32));
mbed_official 146:f64d43ff0c18 157 }
mbed_official 146:f64d43ff0c18 158
mbed_official 146:f64d43ff0c18 159 /*! @brief Increments one to the Monotonic Counter.*/
mbed_official 146:f64d43ff0c18 160 /*! @return true: success; false: error, time invalid flag found.*/
mbed_official 146:f64d43ff0c18 161 static inline bool rtc_hal_monotonic_counter_increment(void)
mbed_official 146:f64d43ff0c18 162 {
mbed_official 146:f64d43ff0c18 163 bool result = false;
mbed_official 146:f64d43ff0c18 164
mbed_official 146:f64d43ff0c18 165 /* Increments the Monotonic Counter (registers RTC_MCLR and RTC_MCHR
mbed_official 146:f64d43ff0c18 166 * accordingly); by setting the monotonic counter enable (MER[MCE]) and then
mbed_official 146:f64d43ff0c18 167 * writing to RTC_MCLR register. A write to monotonic counter low that causes
mbed_official 146:f64d43ff0c18 168 * it to overflow also increments the monotonic counter high. */
mbed_official 146:f64d43ff0c18 169
mbed_official 146:f64d43ff0c18 170 if((!(BR_RTC_SR_TIF)) && (!(BR_RTC_SR_MOF)))
mbed_official 146:f64d43ff0c18 171 {
mbed_official 146:f64d43ff0c18 172 /* prepare for incrementing after write*/
mbed_official 146:f64d43ff0c18 173 BW_RTC_MER_MCE(1U);
mbed_official 146:f64d43ff0c18 174
mbed_official 146:f64d43ff0c18 175 /* write anything so the counter increments*/
mbed_official 146:f64d43ff0c18 176 BW_RTC_MCLR_MCL(1U);
mbed_official 146:f64d43ff0c18 177
mbed_official 146:f64d43ff0c18 178 result = true;
mbed_official 146:f64d43ff0c18 179 }
mbed_official 146:f64d43ff0c18 180
mbed_official 146:f64d43ff0c18 181 return result;
mbed_official 146:f64d43ff0c18 182 }
mbed_official 146:f64d43ff0c18 183
mbed_official 146:f64d43ff0c18 184 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 185 /* RTC Status*/
mbed_official 146:f64d43ff0c18 186 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 187
mbed_official 146:f64d43ff0c18 188 /*! @brief Reads the value of the Monotonic Overflow Flag (MOF). This flag is
mbed_official 146:f64d43ff0c18 189 * set when the monotonic counter is enabled and the monotonic
mbed_official 146:f64d43ff0c18 190 * counter high overflows. The monotonic counter does not increment
mbed_official 146:f64d43ff0c18 191 * and reads as zero when this bit is set. This bit is cleared
mbed_official 146:f64d43ff0c18 192 * by writing the monotonic counter high register when the monotonic
mbed_official 146:f64d43ff0c18 193 * counter is disabled.
mbed_official 146:f64d43ff0c18 194 * @return true: monotonic counter overflow has occurred and monotonic
mbed_official 146:f64d43ff0c18 195 counter is read as zero.
mbed_official 146:f64d43ff0c18 196 * false: NO monotonic counter overflow has occurred.
mbed_official 146:f64d43ff0c18 197 */
mbed_official 146:f64d43ff0c18 198 static inline bool rtc_hal_is_monotonic_counter_overflow(void)
mbed_official 146:f64d43ff0c18 199 {
mbed_official 146:f64d43ff0c18 200 return (bool)BR_RTC_SR_MOF;
mbed_official 146:f64d43ff0c18 201 }
mbed_official 146:f64d43ff0c18 202
mbed_official 146:f64d43ff0c18 203 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 204 /* RTC Lock*/
mbed_official 146:f64d43ff0c18 205 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 206
mbed_official 146:f64d43ff0c18 207 /*! @brief Reads the value of the Monotonic Counter High Lock.
mbed_official 146:f64d43ff0c18 208 * @return true: Monotonic counter high register is not locked and writes
mbed_official 146:f64d43ff0c18 209 * complete normally.
mbed_official 146:f64d43ff0c18 210 * false: Monotonic counter high register is locked and writes are
mbed_official 146:f64d43ff0c18 211 * ignored.
mbed_official 146:f64d43ff0c18 212 */
mbed_official 146:f64d43ff0c18 213 static inline bool rtc_hal_read_monotonic_hcounter_lock(void)
mbed_official 146:f64d43ff0c18 214 {
mbed_official 146:f64d43ff0c18 215 /* Reads the RTC Lock Register (RTC_LR), field Monotonic Counter High Lock
mbed_official 146:f64d43ff0c18 216 * (MCHL). */
mbed_official 146:f64d43ff0c18 217 return (bool)BR_RTC_LR_MCHL;
mbed_official 146:f64d43ff0c18 218 }
mbed_official 146:f64d43ff0c18 219
mbed_official 146:f64d43ff0c18 220 /*! @brief Clears the Monotonic Counter High Lock. Once done, this
mbed_official 146:f64d43ff0c18 221 * flag can only be set by VBAT POR orthe software reset.
mbed_official 146:f64d43ff0c18 222 */
mbed_official 146:f64d43ff0c18 223 static inline void rtc_hal_clear_monotonic_hcounter_lock(void)
mbed_official 146:f64d43ff0c18 224 {
mbed_official 146:f64d43ff0c18 225 /* Writes 0 to the RTC Lock Register (RTC_LR), field Monotonic Counter High Lock
mbed_official 146:f64d43ff0c18 226 * (MCHL). Once cleared, this flag can only be set by VBAT POR or software
mbed_official 146:f64d43ff0c18 227 * reset. */
mbed_official 146:f64d43ff0c18 228 BW_RTC_LR_MCHL(0U);
mbed_official 146:f64d43ff0c18 229 }
mbed_official 146:f64d43ff0c18 230
mbed_official 146:f64d43ff0c18 231 /*! @brief Reads the value of the Monotonic Counter Low Lock.
mbed_official 146:f64d43ff0c18 232 * @return true: Monotonic counter low register is not locked and writes
mbed_official 146:f64d43ff0c18 233 * complete normally.
mbed_official 146:f64d43ff0c18 234 * false: Monotonic counter low register is locked and writes are
mbed_official 146:f64d43ff0c18 235 * ignored.
mbed_official 146:f64d43ff0c18 236 */
mbed_official 146:f64d43ff0c18 237 static inline bool rtc_hal_read_lcounter_lock(void)
mbed_official 146:f64d43ff0c18 238 {
mbed_official 146:f64d43ff0c18 239 /* Reads the value of the RTC Lock Register (RTC_LR), field Monotonic Counter
mbed_official 146:f64d43ff0c18 240 * Low Lock (MCLL). */
mbed_official 146:f64d43ff0c18 241 return (bool)BR_RTC_LR_MCLL;
mbed_official 146:f64d43ff0c18 242 }
mbed_official 146:f64d43ff0c18 243
mbed_official 146:f64d43ff0c18 244 /*! @brief Clears the Monotonic Counter Low Lock. Once done, this flag
mbed_official 146:f64d43ff0c18 245 * can only be set by the VBAT POR or the software reset.
mbed_official 146:f64d43ff0c18 246 */
mbed_official 146:f64d43ff0c18 247 static inline void rtc_hal_clear_lcounter_lock(bool set_to)
mbed_official 146:f64d43ff0c18 248 {
mbed_official 146:f64d43ff0c18 249 BW_RTC_LR_MCLL(0U);
mbed_official 146:f64d43ff0c18 250 }
mbed_official 146:f64d43ff0c18 251
mbed_official 146:f64d43ff0c18 252 /*! @brief Reads the value of the Monotonic Enable Lock.
mbed_official 146:f64d43ff0c18 253 * @return true: Monotonic enable register is not locked and writes
mbed_official 146:f64d43ff0c18 254 * complete normally.
mbed_official 146:f64d43ff0c18 255 * false: Monotonic enable register is locked and writes are
mbed_official 146:f64d43ff0c18 256 * ignored.
mbed_official 146:f64d43ff0c18 257 */
mbed_official 146:f64d43ff0c18 258 static inline bool rtc_hal_read_monotonic_enable_lock(void)
mbed_official 146:f64d43ff0c18 259 {
mbed_official 146:f64d43ff0c18 260 /* Reads the value of the RTC Lock Register (RTC_LR), field Monotonic Enable
mbed_official 146:f64d43ff0c18 261 * Lock (MEL). Once cleared, this flag can only be set by the VBAT POR or the software
mbed_official 146:f64d43ff0c18 262 * reset. */
mbed_official 146:f64d43ff0c18 263 return (bool)BR_RTC_LR_MEL;
mbed_official 146:f64d43ff0c18 264 }
mbed_official 146:f64d43ff0c18 265
mbed_official 146:f64d43ff0c18 266 /*! @brief Clears the Monotonic Enable Lock. Once done, this flag can
mbed_official 146:f64d43ff0c18 267 * only be set by the VBAT POR or the software reset.
mbed_official 146:f64d43ff0c18 268 */
mbed_official 146:f64d43ff0c18 269 static inline void rtc_hal_clear_monotonic_enable_lock(void)
mbed_official 146:f64d43ff0c18 270 {
mbed_official 146:f64d43ff0c18 271 /* Writes to the RTC Lock Register (RTC_LR), field Monotonic Enable Lock (MEL).
mbed_official 146:f64d43ff0c18 272 * Once cleared, this flag can only be set by the VBAT POR or the software reset. */
mbed_official 146:f64d43ff0c18 273 BW_RTC_LR_MEL(0U);
mbed_official 146:f64d43ff0c18 274 }
mbed_official 146:f64d43ff0c18 275
mbed_official 146:f64d43ff0c18 276 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 277 /* RTC Interrupt Enable*/
mbed_official 146:f64d43ff0c18 278 /*-------------------------------------------------------------------------------------------*/
mbed_official 146:f64d43ff0c18 279
mbed_official 146:f64d43ff0c18 280 /*! @brief Checks whether the Monotonic Overflow Interrupt is enabled/disabled.
mbed_official 146:f64d43ff0c18 281 * @return true: Monotonic overflow flag generates an interrupt.
mbed_official 146:f64d43ff0c18 282 * false: Monotonic overflow flag does not generate an interrupt.
mbed_official 146:f64d43ff0c18 283 */
mbed_official 146:f64d43ff0c18 284 static inline bool rtc_hal_read_monot_overflow_int_enable(void)
mbed_official 146:f64d43ff0c18 285 {
mbed_official 146:f64d43ff0c18 286 /* Reads the value of the RTC Interrupt Enable Register (RTC_IER), field
mbed_official 146:f64d43ff0c18 287 * Monotonic Overflow Interrupt Enable (MOIE). */
mbed_official 146:f64d43ff0c18 288 return (bool)BR_RTC_IER_MOIE;
mbed_official 146:f64d43ff0c18 289 }
mbed_official 146:f64d43ff0c18 290
mbed_official 146:f64d43ff0c18 291 /*! @brief Enables/disables the Monotonic Overflow Interrupt Enable.
mbed_official 146:f64d43ff0c18 292 * @param enable true: Monotonic overflow flag generates an interrupt.
mbed_official 146:f64d43ff0c18 293 * false: Monotonic overflow flag does not generate an interrupt.
mbed_official 146:f64d43ff0c18 294 */
mbed_official 146:f64d43ff0c18 295 static inline void rtc_hal_config_monot_overflow_int_enable(bool enable)
mbed_official 146:f64d43ff0c18 296 {
mbed_official 146:f64d43ff0c18 297 BW_RTC_IER_MOIE((uint32_t) enable);
mbed_official 146:f64d43ff0c18 298 }
mbed_official 146:f64d43ff0c18 299
mbed_official 146:f64d43ff0c18 300
mbed_official 146:f64d43ff0c18 301 #if defined(__cplusplus)
mbed_official 146:f64d43ff0c18 302 }
mbed_official 146:f64d43ff0c18 303 #endif
mbed_official 146:f64d43ff0c18 304
mbed_official 146:f64d43ff0c18 305 #endif
mbed_official 146:f64d43ff0c18 306
mbed_official 146:f64d43ff0c18 307 /*! @}*/
mbed_official 146:f64d43ff0c18 308
mbed_official 146:f64d43ff0c18 309 #endif /* __FSL_RTC_HAL_MONOTONIC_H__*/
mbed_official 146:f64d43ff0c18 310
mbed_official 146:f64d43ff0c18 311 /*******************************************************************************
mbed_official 146:f64d43ff0c18 312 * EOF
mbed_official 146:f64d43ff0c18 313 ******************************************************************************/