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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 145:64910690c574 1 /*
AnnaBridge 145:64910690c574 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
AnnaBridge 145:64910690c574 3 * All rights reserved.
AnnaBridge 145:64910690c574 4 *
AnnaBridge 145:64910690c574 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 145:64910690c574 6 * are permitted provided that the following conditions are met:
AnnaBridge 145:64910690c574 7 *
AnnaBridge 145:64910690c574 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 145:64910690c574 9 * of conditions and the following disclaimer.
AnnaBridge 145:64910690c574 10 *
AnnaBridge 145:64910690c574 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 145:64910690c574 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 145:64910690c574 13 * other materials provided with the distribution.
AnnaBridge 145:64910690c574 14 *
AnnaBridge 145:64910690c574 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 145:64910690c574 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 145:64910690c574 17 * software without specific prior written permission.
AnnaBridge 145:64910690c574 18 *
AnnaBridge 145:64910690c574 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 145:64910690c574 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 145:64910690c574 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 145:64910690c574 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 145:64910690c574 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 145:64910690c574 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 145:64910690c574 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 145:64910690c574 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 145:64910690c574 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 145:64910690c574 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 145:64910690c574 29 */
AnnaBridge 145:64910690c574 30 #ifndef _FSL_PIT_H_
AnnaBridge 145:64910690c574 31 #define _FSL_PIT_H_
AnnaBridge 145:64910690c574 32
AnnaBridge 145:64910690c574 33 #include "fsl_common.h"
AnnaBridge 145:64910690c574 34
AnnaBridge 145:64910690c574 35 /*!
AnnaBridge 145:64910690c574 36 * @addtogroup pit
AnnaBridge 145:64910690c574 37 * @{
AnnaBridge 145:64910690c574 38 */
AnnaBridge 145:64910690c574 39
AnnaBridge 145:64910690c574 40
AnnaBridge 145:64910690c574 41 /*******************************************************************************
AnnaBridge 145:64910690c574 42 * Definitions
AnnaBridge 145:64910690c574 43 ******************************************************************************/
AnnaBridge 145:64910690c574 44
AnnaBridge 145:64910690c574 45 /*! @name Driver version */
AnnaBridge 145:64910690c574 46 /*@{*/
AnnaBridge 145:64910690c574 47 #define FSL_PIT_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) /*!< Version 2.0.0 */
AnnaBridge 145:64910690c574 48 /*@}*/
AnnaBridge 145:64910690c574 49
AnnaBridge 145:64910690c574 50 /*!
AnnaBridge 145:64910690c574 51 * @brief List of PIT channels
AnnaBridge 145:64910690c574 52 * @note Actual number of available channels is SoC dependent
AnnaBridge 145:64910690c574 53 */
AnnaBridge 145:64910690c574 54 typedef enum _pit_chnl
AnnaBridge 145:64910690c574 55 {
AnnaBridge 145:64910690c574 56 kPIT_Chnl_0 = 0U, /*!< PIT channel number 0*/
AnnaBridge 145:64910690c574 57 kPIT_Chnl_1, /*!< PIT channel number 1 */
AnnaBridge 145:64910690c574 58 kPIT_Chnl_2, /*!< PIT channel number 2 */
AnnaBridge 145:64910690c574 59 kPIT_Chnl_3, /*!< PIT channel number 3 */
AnnaBridge 145:64910690c574 60 } pit_chnl_t;
AnnaBridge 145:64910690c574 61
AnnaBridge 145:64910690c574 62 /*! @brief List of PIT interrupts */
AnnaBridge 145:64910690c574 63 typedef enum _pit_interrupt_enable
AnnaBridge 145:64910690c574 64 {
AnnaBridge 145:64910690c574 65 kPIT_TimerInterruptEnable = PIT_TCTRL_TIE_MASK, /*!< Timer interrupt enable*/
AnnaBridge 145:64910690c574 66 } pit_interrupt_enable_t;
AnnaBridge 145:64910690c574 67
AnnaBridge 145:64910690c574 68 /*! @brief List of PIT status flags */
AnnaBridge 145:64910690c574 69 typedef enum _pit_status_flags
AnnaBridge 145:64910690c574 70 {
AnnaBridge 145:64910690c574 71 kPIT_TimerFlag = PIT_TFLG_TIF_MASK, /*!< Timer flag */
AnnaBridge 145:64910690c574 72 } pit_status_flags_t;
AnnaBridge 145:64910690c574 73
AnnaBridge 145:64910690c574 74 /*!
AnnaBridge 145:64910690c574 75 * @brief PIT config structure
AnnaBridge 145:64910690c574 76 *
AnnaBridge 145:64910690c574 77 * This structure holds the configuration settings for the PIT peripheral. To initialize this
AnnaBridge 145:64910690c574 78 * structure to reasonable defaults, call the PIT_GetDefaultConfig() function and pass a
AnnaBridge 145:64910690c574 79 * pointer to your config structure instance.
AnnaBridge 145:64910690c574 80 *
AnnaBridge 145:64910690c574 81 * The config struct can be made const so it resides in flash
AnnaBridge 145:64910690c574 82 */
AnnaBridge 145:64910690c574 83 typedef struct _pit_config
AnnaBridge 145:64910690c574 84 {
AnnaBridge 145:64910690c574 85 bool enableRunInDebug; /*!< true: Timers run in debug mode; false: Timers stop in debug mode */
AnnaBridge 145:64910690c574 86 } pit_config_t;
AnnaBridge 145:64910690c574 87
AnnaBridge 145:64910690c574 88 /*******************************************************************************
AnnaBridge 145:64910690c574 89 * API
AnnaBridge 145:64910690c574 90 ******************************************************************************/
AnnaBridge 145:64910690c574 91
AnnaBridge 145:64910690c574 92 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 93 extern "C" {
AnnaBridge 145:64910690c574 94 #endif
AnnaBridge 145:64910690c574 95
AnnaBridge 145:64910690c574 96 /*!
AnnaBridge 145:64910690c574 97 * @name Initialization and deinitialization
AnnaBridge 145:64910690c574 98 * @{
AnnaBridge 145:64910690c574 99 */
AnnaBridge 145:64910690c574 100
AnnaBridge 145:64910690c574 101 /*!
AnnaBridge 145:64910690c574 102 * @brief Ungates the PIT clock, enables the PIT module and configures the peripheral for basic operation.
AnnaBridge 145:64910690c574 103 *
AnnaBridge 145:64910690c574 104 * @note This API should be called at the beginning of the application using the PIT driver.
AnnaBridge 145:64910690c574 105 *
AnnaBridge 145:64910690c574 106 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 107 * @param config Pointer to user's PIT config structure
AnnaBridge 145:64910690c574 108 */
AnnaBridge 145:64910690c574 109 void PIT_Init(PIT_Type *base, const pit_config_t *config);
AnnaBridge 145:64910690c574 110
AnnaBridge 145:64910690c574 111 /*!
AnnaBridge 145:64910690c574 112 * @brief Gate the PIT clock and disable the PIT module
AnnaBridge 145:64910690c574 113 *
AnnaBridge 145:64910690c574 114 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 115 */
AnnaBridge 145:64910690c574 116 void PIT_Deinit(PIT_Type *base);
AnnaBridge 145:64910690c574 117
AnnaBridge 145:64910690c574 118 /*!
AnnaBridge 145:64910690c574 119 * @brief Fill in the PIT config struct with the default settings
AnnaBridge 145:64910690c574 120 *
AnnaBridge 145:64910690c574 121 * The default values are:
AnnaBridge 145:64910690c574 122 * @code
AnnaBridge 145:64910690c574 123 * config->enableRunInDebug = false;
AnnaBridge 145:64910690c574 124 * @endcode
AnnaBridge 145:64910690c574 125 * @param config Pointer to user's PIT config structure.
AnnaBridge 145:64910690c574 126 */
AnnaBridge 145:64910690c574 127 static inline void PIT_GetDefaultConfig(pit_config_t *config)
AnnaBridge 145:64910690c574 128 {
AnnaBridge 145:64910690c574 129 assert(config);
AnnaBridge 145:64910690c574 130
AnnaBridge 145:64910690c574 131 /* Timers are stopped in Debug mode */
AnnaBridge 145:64910690c574 132 config->enableRunInDebug = false;
AnnaBridge 145:64910690c574 133 }
AnnaBridge 145:64910690c574 134
AnnaBridge 145:64910690c574 135 #if defined(FSL_FEATURE_PIT_HAS_CHAIN_MODE) && FSL_FEATURE_PIT_HAS_CHAIN_MODE
AnnaBridge 145:64910690c574 136
AnnaBridge 145:64910690c574 137 /*!
AnnaBridge 145:64910690c574 138 * @brief Enables or disables chaining a timer with the previous timer.
AnnaBridge 145:64910690c574 139 *
AnnaBridge 145:64910690c574 140 * When a timer has a chain mode enabled, it only counts after the previous
AnnaBridge 145:64910690c574 141 * timer has expired. If the timer n-1 has counted down to 0, counter n
AnnaBridge 145:64910690c574 142 * decrements the value by one. Each timer is 32-bits, this allows the developers
AnnaBridge 145:64910690c574 143 * to chain timers together and form a longer timer (64-bits and larger). The first timer
AnnaBridge 145:64910690c574 144 * (timer 0) cannot be chained to any other timer.
AnnaBridge 145:64910690c574 145 *
AnnaBridge 145:64910690c574 146 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 147 * @param channel Timer channel number which is chained with the previous timer
AnnaBridge 145:64910690c574 148 * @param enable Enable or disable chain.
AnnaBridge 145:64910690c574 149 * true: Current timer is chained with the previous timer.
AnnaBridge 145:64910690c574 150 * false: Timer doesn't chain with other timers.
AnnaBridge 145:64910690c574 151 */
AnnaBridge 145:64910690c574 152 static inline void PIT_SetTimerChainMode(PIT_Type *base, pit_chnl_t channel, bool enable)
AnnaBridge 145:64910690c574 153 {
AnnaBridge 145:64910690c574 154 if (enable)
AnnaBridge 145:64910690c574 155 {
AnnaBridge 145:64910690c574 156 base->CHANNEL[channel].TCTRL |= PIT_TCTRL_CHN_MASK;
AnnaBridge 145:64910690c574 157 }
AnnaBridge 145:64910690c574 158 else
AnnaBridge 145:64910690c574 159 {
AnnaBridge 145:64910690c574 160 base->CHANNEL[channel].TCTRL &= ~PIT_TCTRL_CHN_MASK;
AnnaBridge 145:64910690c574 161 }
AnnaBridge 145:64910690c574 162 }
AnnaBridge 145:64910690c574 163
AnnaBridge 145:64910690c574 164 #endif /* FSL_FEATURE_PIT_HAS_CHAIN_MODE */
AnnaBridge 145:64910690c574 165
AnnaBridge 145:64910690c574 166 /*! @}*/
AnnaBridge 145:64910690c574 167
AnnaBridge 145:64910690c574 168 /*!
AnnaBridge 145:64910690c574 169 * @name Interrupt Interface
AnnaBridge 145:64910690c574 170 * @{
AnnaBridge 145:64910690c574 171 */
AnnaBridge 145:64910690c574 172
AnnaBridge 145:64910690c574 173 /*!
AnnaBridge 145:64910690c574 174 * @brief Enables the selected PIT interrupts.
AnnaBridge 145:64910690c574 175 *
AnnaBridge 145:64910690c574 176 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 177 * @param channel Timer channel number
AnnaBridge 145:64910690c574 178 * @param mask The interrupts to enable. This is a logical OR of members of the
AnnaBridge 145:64910690c574 179 * enumeration ::pit_interrupt_enable_t
AnnaBridge 145:64910690c574 180 */
AnnaBridge 145:64910690c574 181 static inline void PIT_EnableInterrupts(PIT_Type *base, pit_chnl_t channel, uint32_t mask)
AnnaBridge 145:64910690c574 182 {
AnnaBridge 145:64910690c574 183 base->CHANNEL[channel].TCTRL |= mask;
AnnaBridge 145:64910690c574 184 }
AnnaBridge 145:64910690c574 185
AnnaBridge 145:64910690c574 186 /*!
AnnaBridge 145:64910690c574 187 * @brief Disables the selected PIT interrupts.
AnnaBridge 145:64910690c574 188 *
AnnaBridge 145:64910690c574 189 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 190 * @param channel Timer channel number
AnnaBridge 145:64910690c574 191 * @param mask The interrupts to disable. This is a logical OR of members of the
AnnaBridge 145:64910690c574 192 * enumeration ::pit_interrupt_enable_t
AnnaBridge 145:64910690c574 193 */
AnnaBridge 145:64910690c574 194 static inline void PIT_DisableInterrupts(PIT_Type *base, pit_chnl_t channel, uint32_t mask)
AnnaBridge 145:64910690c574 195 {
AnnaBridge 145:64910690c574 196 base->CHANNEL[channel].TCTRL &= ~mask;
AnnaBridge 145:64910690c574 197 }
AnnaBridge 145:64910690c574 198
AnnaBridge 145:64910690c574 199 /*!
AnnaBridge 145:64910690c574 200 * @brief Gets the enabled PIT interrupts.
AnnaBridge 145:64910690c574 201 *
AnnaBridge 145:64910690c574 202 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 203 * @param channel Timer channel number
AnnaBridge 145:64910690c574 204 *
AnnaBridge 145:64910690c574 205 * @return The enabled interrupts. This is the logical OR of members of the
AnnaBridge 145:64910690c574 206 * enumeration ::pit_interrupt_enable_t
AnnaBridge 145:64910690c574 207 */
AnnaBridge 145:64910690c574 208 static inline uint32_t PIT_GetEnabledInterrupts(PIT_Type *base, pit_chnl_t channel)
AnnaBridge 145:64910690c574 209 {
AnnaBridge 145:64910690c574 210 return (base->CHANNEL[channel].TCTRL & PIT_TCTRL_TIE_MASK);
AnnaBridge 145:64910690c574 211 }
AnnaBridge 145:64910690c574 212
AnnaBridge 145:64910690c574 213 /*! @}*/
AnnaBridge 145:64910690c574 214
AnnaBridge 145:64910690c574 215 /*!
AnnaBridge 145:64910690c574 216 * @name Status Interface
AnnaBridge 145:64910690c574 217 * @{
AnnaBridge 145:64910690c574 218 */
AnnaBridge 145:64910690c574 219
AnnaBridge 145:64910690c574 220 /*!
AnnaBridge 145:64910690c574 221 * @brief Gets the PIT status flags
AnnaBridge 145:64910690c574 222 *
AnnaBridge 145:64910690c574 223 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 224 * @param channel Timer channel number
AnnaBridge 145:64910690c574 225 *
AnnaBridge 145:64910690c574 226 * @return The status flags. This is the logical OR of members of the
AnnaBridge 145:64910690c574 227 * enumeration ::pit_status_flags_t
AnnaBridge 145:64910690c574 228 */
AnnaBridge 145:64910690c574 229 static inline uint32_t PIT_GetStatusFlags(PIT_Type *base, pit_chnl_t channel)
AnnaBridge 145:64910690c574 230 {
AnnaBridge 145:64910690c574 231 return (base->CHANNEL[channel].TFLG & PIT_TFLG_TIF_MASK);
AnnaBridge 145:64910690c574 232 }
AnnaBridge 145:64910690c574 233
AnnaBridge 145:64910690c574 234 /*!
AnnaBridge 145:64910690c574 235 * @brief Clears the PIT status flags.
AnnaBridge 145:64910690c574 236 *
AnnaBridge 145:64910690c574 237 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 238 * @param channel Timer channel number
AnnaBridge 145:64910690c574 239 * @param mask The status flags to clear. This is a logical OR of members of the
AnnaBridge 145:64910690c574 240 * enumeration ::pit_status_flags_t
AnnaBridge 145:64910690c574 241 */
AnnaBridge 145:64910690c574 242 static inline void PIT_ClearStatusFlags(PIT_Type *base, pit_chnl_t channel, uint32_t mask)
AnnaBridge 145:64910690c574 243 {
AnnaBridge 145:64910690c574 244 base->CHANNEL[channel].TFLG = mask;
AnnaBridge 145:64910690c574 245 }
AnnaBridge 145:64910690c574 246
AnnaBridge 145:64910690c574 247 /*! @}*/
AnnaBridge 145:64910690c574 248
AnnaBridge 145:64910690c574 249 /*!
AnnaBridge 145:64910690c574 250 * @name Read and Write the timer period
AnnaBridge 145:64910690c574 251 * @{
AnnaBridge 145:64910690c574 252 */
AnnaBridge 145:64910690c574 253
AnnaBridge 145:64910690c574 254 /*!
AnnaBridge 145:64910690c574 255 * @brief Sets the timer period in units of count.
AnnaBridge 145:64910690c574 256 *
AnnaBridge 145:64910690c574 257 * Timers begin counting from the value set by this function until it reaches 0,
AnnaBridge 145:64910690c574 258 * then it generates an interrupt and load this register value again.
AnnaBridge 145:64910690c574 259 * Writing a new value to this register does not restart the timer. Instead, the value
AnnaBridge 145:64910690c574 260 * is loaded after the timer expires.
AnnaBridge 145:64910690c574 261 *
AnnaBridge 145:64910690c574 262 * @note User can call the utility macros provided in fsl_common.h to convert to ticks
AnnaBridge 145:64910690c574 263 *
AnnaBridge 145:64910690c574 264 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 265 * @param channel Timer channel number
AnnaBridge 145:64910690c574 266 * @param count Timer period in units of ticks
AnnaBridge 145:64910690c574 267 */
AnnaBridge 145:64910690c574 268 static inline void PIT_SetTimerPeriod(PIT_Type *base, pit_chnl_t channel, uint32_t count)
AnnaBridge 145:64910690c574 269 {
AnnaBridge 145:64910690c574 270 base->CHANNEL[channel].LDVAL = count;
AnnaBridge 145:64910690c574 271 }
AnnaBridge 145:64910690c574 272
AnnaBridge 145:64910690c574 273 /*!
AnnaBridge 145:64910690c574 274 * @brief Reads the current timer counting value.
AnnaBridge 145:64910690c574 275 *
AnnaBridge 145:64910690c574 276 * This function returns the real-time timer counting value, in a range from 0 to a
AnnaBridge 145:64910690c574 277 * timer period.
AnnaBridge 145:64910690c574 278 *
AnnaBridge 145:64910690c574 279 * @note User can call the utility macros provided in fsl_common.h to convert ticks to usec or msec
AnnaBridge 145:64910690c574 280 *
AnnaBridge 145:64910690c574 281 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 282 * @param channel Timer channel number
AnnaBridge 145:64910690c574 283 *
AnnaBridge 145:64910690c574 284 * @return Current timer counting value in ticks
AnnaBridge 145:64910690c574 285 */
AnnaBridge 145:64910690c574 286 static inline uint32_t PIT_GetCurrentTimerCount(PIT_Type *base, pit_chnl_t channel)
AnnaBridge 145:64910690c574 287 {
AnnaBridge 145:64910690c574 288 return base->CHANNEL[channel].CVAL;
AnnaBridge 145:64910690c574 289 }
AnnaBridge 145:64910690c574 290
AnnaBridge 145:64910690c574 291 /*! @}*/
AnnaBridge 145:64910690c574 292
AnnaBridge 145:64910690c574 293 /*!
AnnaBridge 145:64910690c574 294 * @name Timer Start and Stop
AnnaBridge 145:64910690c574 295 * @{
AnnaBridge 145:64910690c574 296 */
AnnaBridge 145:64910690c574 297
AnnaBridge 145:64910690c574 298 /*!
AnnaBridge 145:64910690c574 299 * @brief Starts the timer counting.
AnnaBridge 145:64910690c574 300 *
AnnaBridge 145:64910690c574 301 * After calling this function, timers load period value, count down to 0 and
AnnaBridge 145:64910690c574 302 * then load the respective start value again. Each time a timer reaches 0,
AnnaBridge 145:64910690c574 303 * it generates a trigger pulse and sets the timeout interrupt flag.
AnnaBridge 145:64910690c574 304 *
AnnaBridge 145:64910690c574 305 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 306 * @param channel Timer channel number.
AnnaBridge 145:64910690c574 307 */
AnnaBridge 145:64910690c574 308 static inline void PIT_StartTimer(PIT_Type *base, pit_chnl_t channel)
AnnaBridge 145:64910690c574 309 {
AnnaBridge 145:64910690c574 310 base->CHANNEL[channel].TCTRL |= PIT_TCTRL_TEN_MASK;
AnnaBridge 145:64910690c574 311 }
AnnaBridge 145:64910690c574 312
AnnaBridge 145:64910690c574 313 /*!
AnnaBridge 145:64910690c574 314 * @brief Stops the timer counting.
AnnaBridge 145:64910690c574 315 *
AnnaBridge 145:64910690c574 316 * This function stops every timer counting. Timers reload their periods
AnnaBridge 145:64910690c574 317 * respectively after the next time they call the PIT_DRV_StartTimer.
AnnaBridge 145:64910690c574 318 *
AnnaBridge 145:64910690c574 319 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 320 * @param channel Timer channel number.
AnnaBridge 145:64910690c574 321 */
AnnaBridge 145:64910690c574 322 static inline void PIT_StopTimer(PIT_Type *base, pit_chnl_t channel)
AnnaBridge 145:64910690c574 323 {
AnnaBridge 145:64910690c574 324 base->CHANNEL[channel].TCTRL &= ~PIT_TCTRL_TEN_MASK;
AnnaBridge 145:64910690c574 325 }
AnnaBridge 145:64910690c574 326
AnnaBridge 145:64910690c574 327 /*! @}*/
AnnaBridge 145:64910690c574 328
AnnaBridge 145:64910690c574 329 #if defined(FSL_FEATURE_PIT_HAS_LIFETIME_TIMER) && FSL_FEATURE_PIT_HAS_LIFETIME_TIMER
AnnaBridge 145:64910690c574 330
AnnaBridge 145:64910690c574 331 /*!
AnnaBridge 145:64910690c574 332 * @brief Reads the current lifetime counter value.
AnnaBridge 145:64910690c574 333 *
AnnaBridge 145:64910690c574 334 * The lifetime timer is a 64-bit timer which chains timer 0 and timer 1 together.
AnnaBridge 145:64910690c574 335 * Timer 0 and 1 are chained by calling the PIT_SetTimerChainMode before using this timer.
AnnaBridge 145:64910690c574 336 * The period of lifetime timer is equal to the "period of timer 0 * period of timer 1".
AnnaBridge 145:64910690c574 337 * For the 64-bit value, the higher 32-bit has the value of timer 1, and the lower 32-bit
AnnaBridge 145:64910690c574 338 * has the value of timer 0.
AnnaBridge 145:64910690c574 339 *
AnnaBridge 145:64910690c574 340 * @param base PIT peripheral base address
AnnaBridge 145:64910690c574 341 *
AnnaBridge 145:64910690c574 342 * @return Current lifetime timer value
AnnaBridge 145:64910690c574 343 */
AnnaBridge 145:64910690c574 344 uint64_t PIT_GetLifetimeTimerCount(PIT_Type *base);
AnnaBridge 145:64910690c574 345
AnnaBridge 145:64910690c574 346 #endif /* FSL_FEATURE_PIT_HAS_LIFETIME_TIMER */
AnnaBridge 145:64910690c574 347
AnnaBridge 145:64910690c574 348 #if defined(__cplusplus)
AnnaBridge 145:64910690c574 349 }
AnnaBridge 145:64910690c574 350 #endif
AnnaBridge 145:64910690c574 351
AnnaBridge 145:64910690c574 352 /*! @}*/
AnnaBridge 145:64910690c574 353
AnnaBridge 145:64910690c574 354 #endif /* _FSL_PIT_H_ */