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 Sep 18 14:00:17 2014 +0100
Revision:
324:406fd2029f23
Parent:
149:1fb5f62b92bd
Synchronized with git revision a73f28e6fbca9559fbed2726410eeb4c0534a4a5

Full URL: https://github.com/mbedmicro/mbed/commit/a73f28e6fbca9559fbed2726410eeb4c0534a4a5/

Extended #476, which does not break ethernet for K64F

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 #ifndef __FSL_PIT_HAL_H__
mbed_official 146:f64d43ff0c18 31 #define __FSL_PIT_HAL_H__
mbed_official 146:f64d43ff0c18 32
mbed_official 146:f64d43ff0c18 33 #include <assert.h>
mbed_official 146:f64d43ff0c18 34 #include <stdint.h>
mbed_official 146:f64d43ff0c18 35 #include <stdbool.h>
mbed_official 146:f64d43ff0c18 36 #include "fsl_pit_features.h"
mbed_official 146:f64d43ff0c18 37 #include "fsl_device_registers.h"
mbed_official 146:f64d43ff0c18 38
mbed_official 146:f64d43ff0c18 39 /*!
mbed_official 146:f64d43ff0c18 40 * @addtogroup pit_hal
mbed_official 146:f64d43ff0c18 41 * @{
mbed_official 146:f64d43ff0c18 42 */
mbed_official 146:f64d43ff0c18 43
mbed_official 146:f64d43ff0c18 44 /*******************************************************************************
mbed_official 146:f64d43ff0c18 45 * API
mbed_official 146:f64d43ff0c18 46 ******************************************************************************/
mbed_official 146:f64d43ff0c18 47
mbed_official 146:f64d43ff0c18 48 #if defined(__cplusplus)
mbed_official 146:f64d43ff0c18 49 extern "C" {
mbed_official 146:f64d43ff0c18 50 #endif
mbed_official 146:f64d43ff0c18 51
mbed_official 146:f64d43ff0c18 52 /*!
mbed_official 146:f64d43ff0c18 53 * @name Initialization
mbed_official 146:f64d43ff0c18 54 * @{
mbed_official 146:f64d43ff0c18 55 */
mbed_official 146:f64d43ff0c18 56
mbed_official 146:f64d43ff0c18 57 /*!
mbed_official 146:f64d43ff0c18 58 * @brief Enables the PIT module.
mbed_official 146:f64d43ff0c18 59 *
mbed_official 146:f64d43ff0c18 60 * This function enables the PIT timer clock (Note: this function does not un-gate
mbed_official 146:f64d43ff0c18 61 * the system clock gating control). It should be called before any other timer
mbed_official 146:f64d43ff0c18 62 * related setup.
mbed_official 324:406fd2029f23 63 *
mbed_official 324:406fd2029f23 64 * @param baseAddr Base address for current PIT instance.
mbed_official 146:f64d43ff0c18 65 */
mbed_official 324:406fd2029f23 66 static inline void PIT_HAL_Enable(uint32_t baseAddr)
mbed_official 146:f64d43ff0c18 67 {
mbed_official 324:406fd2029f23 68 BW_PIT_MCR_MDIS(baseAddr, 0U);
mbed_official 146:f64d43ff0c18 69 }
mbed_official 146:f64d43ff0c18 70
mbed_official 146:f64d43ff0c18 71 /*!
mbed_official 146:f64d43ff0c18 72 * @brief Disables the PIT module.
mbed_official 146:f64d43ff0c18 73 *
mbed_official 146:f64d43ff0c18 74 * This function disables all PIT timer clocks(Note: it does not affect the
mbed_official 146:f64d43ff0c18 75 * SIM clock gating control).
mbed_official 324:406fd2029f23 76 *
mbed_official 324:406fd2029f23 77 * @param baseAddr Base address for current PIT instance.
mbed_official 146:f64d43ff0c18 78 */
mbed_official 324:406fd2029f23 79 static inline void PIT_HAL_Disable(uint32_t baseAddr)
mbed_official 146:f64d43ff0c18 80 {
mbed_official 324:406fd2029f23 81 BW_PIT_MCR_MDIS(baseAddr, 1U);
mbed_official 146:f64d43ff0c18 82 }
mbed_official 146:f64d43ff0c18 83
mbed_official 146:f64d43ff0c18 84 /*!
mbed_official 324:406fd2029f23 85 * @brief Configures the timers to continue running or to stop in debug mode.
mbed_official 146:f64d43ff0c18 86 *
mbed_official 146:f64d43ff0c18 87 * In debug mode, the timers may or may not be frozen, based on the configuration of
mbed_official 146:f64d43ff0c18 88 * this function. This is intended to aid software development, allowing the developer
mbed_official 146:f64d43ff0c18 89 * to halt the processor, investigate the current state of the system (for example,
mbed_official 146:f64d43ff0c18 90 * the timer values), and continue the operation.
mbed_official 146:f64d43ff0c18 91 *
mbed_official 324:406fd2029f23 92 * @param baseAddr Base address for current PIT instance.
mbed_official 146:f64d43ff0c18 93 * @param timerRun Timers run or stop in debug mode.
mbed_official 146:f64d43ff0c18 94 * - true: Timers continue to run in debug mode.
mbed_official 146:f64d43ff0c18 95 * - false: Timers stop in debug mode.
mbed_official 146:f64d43ff0c18 96 */
mbed_official 324:406fd2029f23 97 static inline void PIT_HAL_SetTimerRunInDebugCmd(uint32_t baseAddr, bool timerRun)
mbed_official 146:f64d43ff0c18 98 {
mbed_official 324:406fd2029f23 99 BW_PIT_MCR_FRZ(baseAddr, !timerRun);
mbed_official 146:f64d43ff0c18 100 }
mbed_official 146:f64d43ff0c18 101
mbed_official 146:f64d43ff0c18 102 #if FSL_FEATURE_PIT_HAS_CHAIN_MODE
mbed_official 146:f64d43ff0c18 103 /*!
mbed_official 146:f64d43ff0c18 104 * @brief Enables or disables the timer chain with the previous timer.
mbed_official 146:f64d43ff0c18 105 *
mbed_official 146:f64d43ff0c18 106 * When a timer has a chain mode enabled, it only counts after the previous
mbed_official 146:f64d43ff0c18 107 * timer has expired. If the timer n-1 has counted down to 0, counter n
mbed_official 146:f64d43ff0c18 108 * decrements the value by one. This allows the developers to chain timers together
mbed_official 146:f64d43ff0c18 109 * and form a longer timer. The first timer (timer 0) cannot be chained to any
mbed_official 146:f64d43ff0c18 110 * other timer.
mbed_official 146:f64d43ff0c18 111 *
mbed_official 324:406fd2029f23 112 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 113 * @param channel Timer channel number which is chained with the previous timer.
mbed_official 146:f64d43ff0c18 114 * @param enable Enable or disable chain.
mbed_official 146:f64d43ff0c18 115 * - true: Current timer is chained with the previous timer.
mbed_official 146:f64d43ff0c18 116 * - false: Timer doesn't chain with other timers.
mbed_official 146:f64d43ff0c18 117 */
mbed_official 324:406fd2029f23 118 static inline void PIT_HAL_SetTimerChainCmd(uint32_t baseAddr, uint32_t channel, bool enable)
mbed_official 146:f64d43ff0c18 119 {
mbed_official 324:406fd2029f23 120 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 121 BW_PIT_TCTRLn_CHN(baseAddr, channel, enable);
mbed_official 146:f64d43ff0c18 122 }
mbed_official 146:f64d43ff0c18 123
mbed_official 146:f64d43ff0c18 124 #endif /* FSL_FEATURE_PIT_HAS_CHAIN_MODE*/
mbed_official 146:f64d43ff0c18 125
mbed_official 146:f64d43ff0c18 126 /* @} */
mbed_official 146:f64d43ff0c18 127
mbed_official 146:f64d43ff0c18 128 /*!
mbed_official 146:f64d43ff0c18 129 * @name Timer Start and Stop
mbed_official 146:f64d43ff0c18 130 * @{
mbed_official 146:f64d43ff0c18 131 */
mbed_official 146:f64d43ff0c18 132
mbed_official 146:f64d43ff0c18 133 /*!
mbed_official 146:f64d43ff0c18 134 * @brief Starts the timer counting.
mbed_official 146:f64d43ff0c18 135 *
mbed_official 146:f64d43ff0c18 136 * After calling this function, timers load the start value as specified by the function
mbed_official 324:406fd2029f23 137 * PIT_HAL_SetTimerPeriodByCount(uint32_t baseAddr, uint32_t channel, uint32_t count), count down to
mbed_official 146:f64d43ff0c18 138 * 0, and load the respective start value again. Each time a timer reaches 0,
mbed_official 146:f64d43ff0c18 139 * it generates a trigger pulse and sets the time-out interrupt flag.
mbed_official 146:f64d43ff0c18 140 *
mbed_official 324:406fd2029f23 141 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 142 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 143 */
mbed_official 324:406fd2029f23 144 static inline void PIT_HAL_StartTimer(uint32_t baseAddr, uint32_t channel)
mbed_official 146:f64d43ff0c18 145 {
mbed_official 324:406fd2029f23 146 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 147 BW_PIT_TCTRLn_TEN(baseAddr, channel, 1U);
mbed_official 146:f64d43ff0c18 148 }
mbed_official 146:f64d43ff0c18 149
mbed_official 146:f64d43ff0c18 150 /*!
mbed_official 146:f64d43ff0c18 151 * @brief Stops the timer from counting.
mbed_official 146:f64d43ff0c18 152 *
mbed_official 146:f64d43ff0c18 153 * This function stops every timer from counting. Timers reload their periods
mbed_official 324:406fd2029f23 154 * respectively after they call the PIT_HAL_StartTimer the next time.
mbed_official 146:f64d43ff0c18 155 *
mbed_official 324:406fd2029f23 156 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 157 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 158 */
mbed_official 324:406fd2029f23 159 static inline void PIT_HAL_StopTimer(uint32_t baseAddr, uint32_t channel)
mbed_official 146:f64d43ff0c18 160 {
mbed_official 324:406fd2029f23 161 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 162 BW_PIT_TCTRLn_TEN(baseAddr, channel, 0U);
mbed_official 146:f64d43ff0c18 163 }
mbed_official 146:f64d43ff0c18 164
mbed_official 146:f64d43ff0c18 165 /*!
mbed_official 146:f64d43ff0c18 166 * @brief Checks to see whether the current timer is started or not.
mbed_official 146:f64d43ff0c18 167 *
mbed_official 324:406fd2029f23 168 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 169 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 170 * @return Current timer running status
mbed_official 146:f64d43ff0c18 171 * -true: Current timer is running.
mbed_official 146:f64d43ff0c18 172 * -false: Current timer has stopped.
mbed_official 146:f64d43ff0c18 173 */
mbed_official 324:406fd2029f23 174 static inline bool PIT_HAL_IsTimerRunning(uint32_t baseAddr, uint32_t channel)
mbed_official 146:f64d43ff0c18 175 {
mbed_official 324:406fd2029f23 176 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 177 return BR_PIT_TCTRLn_TEN(baseAddr, channel);
mbed_official 146:f64d43ff0c18 178 }
mbed_official 146:f64d43ff0c18 179
mbed_official 146:f64d43ff0c18 180 /* @} */
mbed_official 146:f64d43ff0c18 181
mbed_official 146:f64d43ff0c18 182 /*!
mbed_official 146:f64d43ff0c18 183 * @name Timer Period
mbed_official 146:f64d43ff0c18 184 * @{
mbed_official 146:f64d43ff0c18 185 */
mbed_official 146:f64d43ff0c18 186
mbed_official 146:f64d43ff0c18 187 /*!
mbed_official 146:f64d43ff0c18 188 * @brief Sets the timer period in units of count.
mbed_official 146:f64d43ff0c18 189 *
mbed_official 146:f64d43ff0c18 190 * Timers begin counting from the value set by this function.
mbed_official 146:f64d43ff0c18 191 * The counter period of a running timer can be modified by first stopping
mbed_official 146:f64d43ff0c18 192 * the timer, setting a new load value, and starting the timer again. If
mbed_official 146:f64d43ff0c18 193 * timers are not restarted, the new value is loaded after the next trigger
mbed_official 146:f64d43ff0c18 194 * event.
mbed_official 146:f64d43ff0c18 195 *
mbed_official 324:406fd2029f23 196 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 197 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 198 * @param count Timer period in units of count
mbed_official 146:f64d43ff0c18 199 */
mbed_official 324:406fd2029f23 200 static inline void PIT_HAL_SetTimerPeriodByCount(uint32_t baseAddr, uint32_t channel, uint32_t count)
mbed_official 146:f64d43ff0c18 201 {
mbed_official 324:406fd2029f23 202 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 203 HW_PIT_LDVALn_WR(baseAddr, channel, count);
mbed_official 146:f64d43ff0c18 204 }
mbed_official 146:f64d43ff0c18 205
mbed_official 146:f64d43ff0c18 206 /*!
mbed_official 146:f64d43ff0c18 207 * @brief Returns the current timer period in units of count.
mbed_official 146:f64d43ff0c18 208 *
mbed_official 324:406fd2029f23 209 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 210 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 211 * @return Timer period in units of count
mbed_official 146:f64d43ff0c18 212 */
mbed_official 324:406fd2029f23 213 static inline uint32_t PIT_HAL_GetTimerPeriodByCount(uint32_t baseAddr, uint32_t channel)
mbed_official 146:f64d43ff0c18 214 {
mbed_official 324:406fd2029f23 215 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 216 return HW_PIT_LDVALn_RD(baseAddr, channel);
mbed_official 146:f64d43ff0c18 217 }
mbed_official 146:f64d43ff0c18 218
mbed_official 146:f64d43ff0c18 219 /*!
mbed_official 146:f64d43ff0c18 220 * @brief Reads the current timer counting value.
mbed_official 146:f64d43ff0c18 221 *
mbed_official 146:f64d43ff0c18 222 * This function returns the real-time timer counting value, in a range from 0 to a
mbed_official 146:f64d43ff0c18 223 * timer period.
mbed_official 146:f64d43ff0c18 224 *
mbed_official 324:406fd2029f23 225 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 226 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 227 * @return Current timer counting value
mbed_official 146:f64d43ff0c18 228 */
mbed_official 324:406fd2029f23 229 static inline uint32_t PIT_HAL_ReadTimerCount(uint32_t baseAddr, uint32_t channel)
mbed_official 146:f64d43ff0c18 230 {
mbed_official 324:406fd2029f23 231 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 232 return HW_PIT_CVALn_RD(baseAddr, channel);
mbed_official 146:f64d43ff0c18 233 }
mbed_official 146:f64d43ff0c18 234
mbed_official 146:f64d43ff0c18 235 #if FSL_FEATURE_PIT_HAS_LIFETIME_TIMER
mbed_official 146:f64d43ff0c18 236 /*!
mbed_official 146:f64d43ff0c18 237 * @brief Reads the current lifetime counter value.
mbed_official 146:f64d43ff0c18 238 *
mbed_official 146:f64d43ff0c18 239 * The lifetime timer is a 64-bit timer which chains timer 0 and timer 1 together.
mbed_official 324:406fd2029f23 240 * Timer 0 and 1 are chained by calling the PIT_HAL_SetTimerChainCmd
mbed_official 146:f64d43ff0c18 241 * before using this timer. The period of lifetime timer is equal to the "period of
mbed_official 146:f64d43ff0c18 242 * timer 0 * period of timer 1". For the 64-bit value, the higher 32-bit has
mbed_official 146:f64d43ff0c18 243 * the value of timer 1, and the lower 32-bit has the value of timer 0.
mbed_official 146:f64d43ff0c18 244 *
mbed_official 324:406fd2029f23 245 * @param baseAddr Base address for current PIT instance.
mbed_official 146:f64d43ff0c18 246 * @return Current lifetime timer value
mbed_official 146:f64d43ff0c18 247 */
mbed_official 324:406fd2029f23 248 uint64_t PIT_HAL_ReadLifetimeTimerCount(uint32_t baseAddr);
mbed_official 146:f64d43ff0c18 249 #endif /*FSL_FEATURE_PIT_HAS_LIFETIME_TIMER*/
mbed_official 146:f64d43ff0c18 250
mbed_official 146:f64d43ff0c18 251 /* @} */
mbed_official 146:f64d43ff0c18 252
mbed_official 146:f64d43ff0c18 253 /*!
mbed_official 146:f64d43ff0c18 254 * @name Interrupt
mbed_official 146:f64d43ff0c18 255 * @{
mbed_official 146:f64d43ff0c18 256 */
mbed_official 146:f64d43ff0c18 257
mbed_official 146:f64d43ff0c18 258 /*!
mbed_official 146:f64d43ff0c18 259 * @brief Enables or disables the timer interrupt.
mbed_official 146:f64d43ff0c18 260 *
mbed_official 146:f64d43ff0c18 261 * If enabled, an interrupt happens when a timeout event occurs
mbed_official 146:f64d43ff0c18 262 * (Note: NVIC should be called to enable pit interrupt in system level).
mbed_official 146:f64d43ff0c18 263 *
mbed_official 324:406fd2029f23 264 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 265 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 266 * @param enable Enable or disable interrupt.
mbed_official 146:f64d43ff0c18 267 * - true: Generate interrupt when timer counts to 0.
mbed_official 146:f64d43ff0c18 268 * - false: No interrupt is generated.
mbed_official 146:f64d43ff0c18 269 */
mbed_official 324:406fd2029f23 270 static inline void PIT_HAL_SetIntCmd(uint32_t baseAddr, uint32_t channel, bool enable)
mbed_official 146:f64d43ff0c18 271 {
mbed_official 324:406fd2029f23 272 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 273 BW_PIT_TCTRLn_TIE(baseAddr, channel, enable);
mbed_official 146:f64d43ff0c18 274 }
mbed_official 146:f64d43ff0c18 275
mbed_official 146:f64d43ff0c18 276 /*!
mbed_official 146:f64d43ff0c18 277 * @brief Checks whether the timer interrupt is enabled or not.
mbed_official 146:f64d43ff0c18 278 *
mbed_official 324:406fd2029f23 279 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 280 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 281 * @return Status of enabled or disabled interrupt
mbed_official 146:f64d43ff0c18 282 * - true: Interrupt is enabled.
mbed_official 146:f64d43ff0c18 283 * - false: Interrupt is disabled.
mbed_official 146:f64d43ff0c18 284 */
mbed_official 324:406fd2029f23 285 static inline bool PIT_HAL_GetIntCmd(uint32_t baseAddr, uint32_t channel)
mbed_official 146:f64d43ff0c18 286 {
mbed_official 324:406fd2029f23 287 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 288 return BR_PIT_TCTRLn_TIE(baseAddr, channel);
mbed_official 146:f64d43ff0c18 289 }
mbed_official 146:f64d43ff0c18 290
mbed_official 146:f64d43ff0c18 291 /*!
mbed_official 146:f64d43ff0c18 292 * @brief Clears the timer interrupt flag.
mbed_official 146:f64d43ff0c18 293 *
mbed_official 146:f64d43ff0c18 294 * This function clears the timer interrupt flag after a timeout event
mbed_official 146:f64d43ff0c18 295 * occurs.
mbed_official 146:f64d43ff0c18 296 *
mbed_official 324:406fd2029f23 297 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 298 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 299 */
mbed_official 324:406fd2029f23 300 static inline void PIT_HAL_ClearIntFlag(uint32_t baseAddr, uint32_t channel)
mbed_official 146:f64d43ff0c18 301 {
mbed_official 324:406fd2029f23 302 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 146:f64d43ff0c18 303 /* Write 1 will clear the flag. */
mbed_official 324:406fd2029f23 304 HW_PIT_TFLGn_WR(baseAddr, channel, 1U);
mbed_official 146:f64d43ff0c18 305 }
mbed_official 146:f64d43ff0c18 306
mbed_official 146:f64d43ff0c18 307 /*!
mbed_official 146:f64d43ff0c18 308 * @brief Reads the current timer timeout flag.
mbed_official 146:f64d43ff0c18 309 *
mbed_official 146:f64d43ff0c18 310 * Every time the timer counts to 0, this flag is set.
mbed_official 146:f64d43ff0c18 311 *
mbed_official 324:406fd2029f23 312 * @param baseAddr Base address for current PIT instance.
mbed_official 324:406fd2029f23 313 * @param channel Timer channel number
mbed_official 146:f64d43ff0c18 314 * @return Current status of the timeout flag
mbed_official 146:f64d43ff0c18 315 * - true: Timeout has occurred.
mbed_official 146:f64d43ff0c18 316 * - false: Timeout has not yet occurred.
mbed_official 146:f64d43ff0c18 317 */
mbed_official 324:406fd2029f23 318 static inline bool PIT_HAL_IsIntPending(uint32_t baseAddr, uint32_t channel)
mbed_official 146:f64d43ff0c18 319 {
mbed_official 324:406fd2029f23 320 assert(channel < FSL_FEATURE_PIT_TIMER_COUNT);
mbed_official 324:406fd2029f23 321 return HW_PIT_TFLGn_RD(baseAddr, channel);
mbed_official 146:f64d43ff0c18 322 }
mbed_official 146:f64d43ff0c18 323
mbed_official 146:f64d43ff0c18 324 /* @} */
mbed_official 146:f64d43ff0c18 325
mbed_official 146:f64d43ff0c18 326 #if defined(__cplusplus)
mbed_official 146:f64d43ff0c18 327 }
mbed_official 146:f64d43ff0c18 328 #endif
mbed_official 146:f64d43ff0c18 329
mbed_official 146:f64d43ff0c18 330 /*! @}*/
mbed_official 146:f64d43ff0c18 331
mbed_official 146:f64d43ff0c18 332 #endif /* __FSL_PIT_HAL_H__*/
mbed_official 146:f64d43ff0c18 333 /*******************************************************************************
mbed_official 146:f64d43ff0c18 334 * EOF
mbed_official 146:f64d43ff0c18 335 *******************************************************************************/
mbed_official 146:f64d43ff0c18 336