mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by Umar Naeem

Committer:
ranaumarnaeem
Date:
Tue May 23 12:54:50 2017 +0000
Revision:
165:2dd56e6daeec
Parent:
157:ff67d9f36b67
jhjg

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 157:ff67d9f36b67 1 /**
<> 157:ff67d9f36b67 2 * @file
<> 157:ff67d9f36b67 3 * @brief Timer0 & Timer1 32/16-Bit Peripheral Driver.
<> 157:ff67d9f36b67 4 */
<> 157:ff67d9f36b67 5 /* *****************************************************************************
<> 157:ff67d9f36b67 6 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
<> 157:ff67d9f36b67 7 *
<> 157:ff67d9f36b67 8 * Permission is hereby granted, free of charge, to any person obtaining a
<> 157:ff67d9f36b67 9 * copy of this software and associated documentation files (the "Software"),
<> 157:ff67d9f36b67 10 * to deal in the Software without restriction, including without limitation
<> 157:ff67d9f36b67 11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
<> 157:ff67d9f36b67 12 * and/or sell copies of the Software, and to permit persons to whom the
<> 157:ff67d9f36b67 13 * Software is furnished to do so, subject to the following conditions:
<> 157:ff67d9f36b67 14 *
<> 157:ff67d9f36b67 15 * The above copyright notice and this permission notice shall be included
<> 157:ff67d9f36b67 16 * in all copies or substantial portions of the Software.
<> 157:ff67d9f36b67 17 *
<> 157:ff67d9f36b67 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
<> 157:ff67d9f36b67 19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
<> 157:ff67d9f36b67 20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
<> 157:ff67d9f36b67 21 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
<> 157:ff67d9f36b67 22 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
<> 157:ff67d9f36b67 23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
<> 157:ff67d9f36b67 24 * OTHER DEALINGS IN THE SOFTWARE.
<> 157:ff67d9f36b67 25 *
<> 157:ff67d9f36b67 26 * Except as contained in this notice, the name of Maxim Integrated
<> 157:ff67d9f36b67 27 * Products, Inc. shall not be used except as stated in the Maxim Integrated
<> 157:ff67d9f36b67 28 * Products, Inc. Branding Policy.
<> 157:ff67d9f36b67 29 *
<> 157:ff67d9f36b67 30 * The mere transfer of this software does not imply any licenses
<> 157:ff67d9f36b67 31 * of trade secrets, proprietary technology, copyrights, patents,
<> 157:ff67d9f36b67 32 * trademarks, maskwork rights, or any other form of intellectual
<> 157:ff67d9f36b67 33 * property whatsoever. Maxim Integrated Products, Inc. retains all
<> 157:ff67d9f36b67 34 * ownership rights.
<> 157:ff67d9f36b67 35 *
<> 157:ff67d9f36b67 36 * $Date: 2016-10-10 19:49:16 -0500 (Mon, 10 Oct 2016) $
<> 157:ff67d9f36b67 37 * $Revision: 24675 $
<> 157:ff67d9f36b67 38 *
<> 157:ff67d9f36b67 39 *************************************************************************** */
<> 157:ff67d9f36b67 40
<> 157:ff67d9f36b67 41 /* Define to prevent redundant inclusion */
<> 157:ff67d9f36b67 42 #ifndef _TIMER_H
<> 157:ff67d9f36b67 43 #define _TIMER_H
<> 157:ff67d9f36b67 44
<> 157:ff67d9f36b67 45 /* **** Includes **** */
<> 157:ff67d9f36b67 46 #include "mxc_config.h"
<> 157:ff67d9f36b67 47 #include "tmr_regs.h"
<> 157:ff67d9f36b67 48 #include "mxc_sys.h"
<> 157:ff67d9f36b67 49
<> 157:ff67d9f36b67 50 /* **** Extern CPP **** */
<> 157:ff67d9f36b67 51 #ifdef __cplusplus
<> 157:ff67d9f36b67 52 extern "C" {
<> 157:ff67d9f36b67 53 #endif
<> 157:ff67d9f36b67 54
<> 157:ff67d9f36b67 55 /**
<> 157:ff67d9f36b67 56 * @ingroup periphlibs
<> 157:ff67d9f36b67 57 * @defgroup tmr Timers
<> 157:ff67d9f36b67 58 * @brief 32/16-bit Timers
<> 157:ff67d9f36b67 59 * @{
<> 157:ff67d9f36b67 60 */
<> 157:ff67d9f36b67 61
<> 157:ff67d9f36b67 62 /**
<> 157:ff67d9f36b67 63 * Enumeration type for units of time.
<> 157:ff67d9f36b67 64 */
<> 157:ff67d9f36b67 65 typedef enum {
<> 157:ff67d9f36b67 66 TMR_UNIT_NANOSEC = 0, /**< Nanosecond Unit Indicator. */
<> 157:ff67d9f36b67 67 TMR_UNIT_MICROSEC, /**< Microsecond Unit Indicator. */
<> 157:ff67d9f36b67 68 TMR_UNIT_MILLISEC, /**< Millisecond Unit Indicator. */
<> 157:ff67d9f36b67 69 TMR_UNIT_SEC, /**< Second Unit Indicator. */
<> 157:ff67d9f36b67 70 } tmr_unit_t;
<> 157:ff67d9f36b67 71
<> 157:ff67d9f36b67 72 /**
<> 157:ff67d9f36b67 73 * Enumeration type to select the 32-bit Timer Mode.
<> 157:ff67d9f36b67 74 */
<> 157:ff67d9f36b67 75 typedef enum {
<> 157:ff67d9f36b67 76 TMR32_MODE_ONE_SHOT = MXC_V_TMR_CTRL_MODE_ONE_SHOT, /**< One-shot Mode */
<> 157:ff67d9f36b67 77 TMR32_MODE_CONTINUOUS = MXC_V_TMR_CTRL_MODE_CONTINUOUS, /**< Continuous Mode */
<> 157:ff67d9f36b67 78 TMR32_MODE_COUNTER = MXC_V_TMR_CTRL_MODE_COUNTER, /**< Counter Mode */
<> 157:ff67d9f36b67 79 TMR32_MODE_PWM = MXC_V_TMR_CTRL_MODE_PWM, /**< Pulse Width Modulation Mode */
<> 157:ff67d9f36b67 80 TMR32_MODE_CAPTURE = MXC_V_TMR_CTRL_MODE_CAPTURE, /**< Capture Mode */
<> 157:ff67d9f36b67 81 TMR32_MODE_COMPARE = MXC_V_TMR_CTRL_MODE_COMPARE, /**< Compare Mode */
<> 157:ff67d9f36b67 82 TMR32_MODE_GATED = MXC_V_TMR_CTRL_MODE_GATED, /**< Gated Mode */
<> 157:ff67d9f36b67 83 TMR32_MODE_MEASURE = MXC_V_TMR_CTRL_MODE_MEASURE /**< Measure Mode */
<> 157:ff67d9f36b67 84 } tmr32_mode_t;
<> 157:ff67d9f36b67 85
<> 157:ff67d9f36b67 86 /**
<> 157:ff67d9f36b67 87 * Enumeration type to select a 16-bit Timer Mode.
<> 157:ff67d9f36b67 88 * @note 16-bit times only support One Shot and Continuous timers.
<> 157:ff67d9f36b67 89 */
<> 157:ff67d9f36b67 90 typedef enum {
<> 157:ff67d9f36b67 91 TMR16_MODE_ONE_SHOT = MXC_V_TMR_CTRL_MODE_ONE_SHOT, /**< One-Shot Mode. */
<> 157:ff67d9f36b67 92 TMR16_MODE_CONTINUOUS = MXC_V_TMR_CTRL_MODE_CONTINUOUS /**< Continuous Mode. */
<> 157:ff67d9f36b67 93 } tmr16_mode_t;
<> 157:ff67d9f36b67 94
<> 157:ff67d9f36b67 95 /**
<> 157:ff67d9f36b67 96 * Enumeration type to select the Prescale Divider for the timer module. The prescaler
<> 157:ff67d9f36b67 97 * divides the peripheral input clock to the timer by a selectable divisor.
<> 157:ff67d9f36b67 98 */
<> 157:ff67d9f36b67 99 typedef enum {
<> 157:ff67d9f36b67 100 TMR_PRESCALE_DIV_2_0 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_1, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{0} = 1 \f$ */
<> 157:ff67d9f36b67 101 TMR_PRESCALE_DIV_2_1 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_2, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{1} = 2 \f$ */
<> 157:ff67d9f36b67 102 TMR_PRESCALE_DIV_2_2 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_4, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{2} = 4 \f$ */
<> 157:ff67d9f36b67 103 TMR_PRESCALE_DIV_2_3 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_8, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{3} = 8 \f$ */
<> 157:ff67d9f36b67 104 TMR_PRESCALE_DIV_2_4 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_16, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{4} = 16 \f$ */
<> 157:ff67d9f36b67 105 TMR_PRESCALE_DIV_2_5 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_32, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{5} = 32 \f$ */
<> 157:ff67d9f36b67 106 TMR_PRESCALE_DIV_2_6 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_64, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{6} = 64 \f$ */
<> 157:ff67d9f36b67 107 TMR_PRESCALE_DIV_2_7 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_128, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{7} = 128 \f$ */
<> 157:ff67d9f36b67 108 TMR_PRESCALE_DIV_2_8 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_256, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{8} = 256 \f$ */
<> 157:ff67d9f36b67 109 TMR_PRESCALE_DIV_2_9 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_512, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{9} = 512 \f$ */
<> 157:ff67d9f36b67 110 TMR_PRESCALE_DIV_2_10 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_1024, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{10} = 1024 \f$ */
<> 157:ff67d9f36b67 111 TMR_PRESCALE_DIV_2_11 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_2048, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{11} = 2048 \f$ */
<> 157:ff67d9f36b67 112 TMR_PRESCALE_DIV_2_12 = MXC_V_TMR_CTRL_PRESCALE_DIVIDE_BY_4096, /**< Divide the peripheral input clock by \f$ TMR_{Prescaler} = 2^{12} = 4096 \f$ */
<> 157:ff67d9f36b67 113 } tmr_prescale_t;
<> 157:ff67d9f36b67 114
<> 157:ff67d9f36b67 115 /**
<> 157:ff67d9f36b67 116 * Enumeration type to set the polarity bit for pwm timer.
<> 157:ff67d9f36b67 117 */
<> 157:ff67d9f36b67 118 typedef enum {
<> 157:ff67d9f36b67 119 TMR_POLARITY_UNUSED = 0, /**< @internal Unused polarity @endinternal */
<> 157:ff67d9f36b67 120
<> 157:ff67d9f36b67 121 TMR_POLARITY_INIT_LOW = 0, /**< GPIO initial output level = low */
<> 157:ff67d9f36b67 122 TMR_POLARITY_INIT_HIGH = 1, /**< GPIO initial output level = high */
<> 157:ff67d9f36b67 123
<> 157:ff67d9f36b67 124 TMR_POLARITY_RISING_EDGE = 0, /**< timer trigger on GPIO rising edge */
<> 157:ff67d9f36b67 125 TMR_POLARITY_FALLING_EDGE = 1, /**< timer trigger on GPIO falling edge */
<> 157:ff67d9f36b67 126 } tmr_polarity_t;
<> 157:ff67d9f36b67 127
<> 157:ff67d9f36b67 128 /**
<> 157:ff67d9f36b67 129 * Enumeration type to set the polarity bit for pwm timer.
<> 157:ff67d9f36b67 130 */
<> 157:ff67d9f36b67 131 typedef enum {
<> 157:ff67d9f36b67 132 TMR_PWM_INVERTED = 0, /**< duty cycle = low pulse */
<> 157:ff67d9f36b67 133 TMR_PWM_NONINVERTED, /**< duty cycle = high pulse */
<> 157:ff67d9f36b67 134 } tmr_pwm_polarity_t;
<> 157:ff67d9f36b67 135
<> 157:ff67d9f36b67 136 /**
<> 157:ff67d9f36b67 137 * Structure type for Configuring a 32-bit timer in all modes except PWM.
<> 157:ff67d9f36b67 138 */
<> 157:ff67d9f36b67 139 typedef struct {
<> 157:ff67d9f36b67 140 tmr32_mode_t mode; /**< Desired timer mode, see #tmr32_mode_t for valid modes. @note If PWM mode is desired, setting the mode to TMR32_MODE_PWM is valid. To configure PWM Mode, see #tmr32_cfg_pwm_t. */
<> 157:ff67d9f36b67 141 tmr_polarity_t polarity; /**< Polarity for GPIO */
<> 157:ff67d9f36b67 142 uint32_t compareCount; /**< Ticks to stop, reset back to 1, or compare timer */
<> 157:ff67d9f36b67 143 } tmr32_cfg_t;
<> 157:ff67d9f36b67 144
<> 157:ff67d9f36b67 145 /**
<> 157:ff67d9f36b67 146 * Structure type for Configuring PWM Mode for a 32-bit timer.
<> 157:ff67d9f36b67 147 */
<> 157:ff67d9f36b67 148 typedef struct {
<> 157:ff67d9f36b67 149 tmr_pwm_polarity_t polarity; /**< PWM polarity selection, see #tmr_pwm_polarity_t. */
<> 157:ff67d9f36b67 150 uint32_t periodCount; /**< PWM period in number of timer ticks. */
<> 157:ff67d9f36b67 151 uint32_t dutyCount; /**< PWM duty cycle in number of timer ticks. */
<> 157:ff67d9f36b67 152 } tmr32_cfg_pwm_t;
<> 157:ff67d9f36b67 153
<> 157:ff67d9f36b67 154 /**
<> 157:ff67d9f36b67 155 * Structure type for Configuring a 16-bit Timer.
<> 157:ff67d9f36b67 156 */
<> 157:ff67d9f36b67 157 typedef struct {
<> 157:ff67d9f36b67 158 tmr16_mode_t mode; /**< 16-bit timer mode, see #tmr16_mode_t for supported modes. */
<> 157:ff67d9f36b67 159 uint16_t compareCount; /**< Number of timer ticks to either stop or reset the timer. */
<> 157:ff67d9f36b67 160 } tmr16_cfg_t;
<> 157:ff67d9f36b67 161
<> 157:ff67d9f36b67 162
<> 157:ff67d9f36b67 163
<> 157:ff67d9f36b67 164 /**
<> 157:ff67d9f36b67 165 * @brief Initializes the timer to a known state.
<> 157:ff67d9f36b67 166 * @details This function initializes the timer to a known state and saves
<> 157:ff67d9f36b67 167 * the prescaler. The timer will be left disabled. TMR_Init should
<> 157:ff67d9f36b67 168 * be called before TMR_Config.
<> 157:ff67d9f36b67 169 *
<> 157:ff67d9f36b67 170 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 171 * @param prescale clock divider for the timer clock
<> 157:ff67d9f36b67 172 * @param sysCfg Pointer to the timer system GPIO configuration. If not
<> 157:ff67d9f36b67 173 * using GPIO for the timer instance, set this parameter
<> 157:ff67d9f36b67 174 * to NULL.
<> 157:ff67d9f36b67 175 *
<> 157:ff67d9f36b67 176 * @retval #E_NO_ERROR Timer initialized successfully.
<> 157:ff67d9f36b67 177 * @retval Error Code Timer was not initialized, see @ref MXC_Error_Codes.
<> 157:ff67d9f36b67 178 */
<> 157:ff67d9f36b67 179 int TMR_Init(mxc_tmr_regs_t *tmr, tmr_prescale_t prescale, const sys_cfg_tmr_t *sysCfg);
<> 157:ff67d9f36b67 180
<> 157:ff67d9f36b67 181 /**
<> 157:ff67d9f36b67 182 * @brief Configures the timer in the specified mode.
<> 157:ff67d9f36b67 183 * @details The parameters in config structure must be set before calling
<> 157:ff67d9f36b67 184 * this function. This function should be used for configuring the
<> 157:ff67d9f36b67 185 * timer in all 32 bit modes other than PWM.
<> 157:ff67d9f36b67 186 * @note The timer cannot be running when this function is called
<> 157:ff67d9f36b67 187 *
<> 157:ff67d9f36b67 188 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 189 * @param config pointer to timer configuration
<> 157:ff67d9f36b67 190 */
<> 157:ff67d9f36b67 191 void TMR32_Config(mxc_tmr_regs_t *tmr, const tmr32_cfg_t *config);
<> 157:ff67d9f36b67 192
<> 157:ff67d9f36b67 193 /**
<> 157:ff67d9f36b67 194 * @brief Configures the timer in PWM mode.
<> 157:ff67d9f36b67 195 * @details The parameters in config structure must be set before calling
<> 157:ff67d9f36b67 196 * this function. This function should be used for configuring the
<> 157:ff67d9f36b67 197 * timer in PWM mode only.
<> 157:ff67d9f36b67 198 * @note The timer cannot be running when this function is called
<> 157:ff67d9f36b67 199 *
<> 157:ff67d9f36b67 200 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 201 * @param config pointer to timer configuration
<> 157:ff67d9f36b67 202 */
<> 157:ff67d9f36b67 203 void TMR32_PWMConfig(mxc_tmr_regs_t *tmr, const tmr32_cfg_pwm_t *config);
<> 157:ff67d9f36b67 204
<> 157:ff67d9f36b67 205 /**
<> 157:ff67d9f36b67 206 * @brief Configures the timer in the specified mode.
<> 157:ff67d9f36b67 207 * @details The parameters in config structure must be set before calling
<> 157:ff67d9f36b67 208 * this function. This function should be used for configuring the
<> 157:ff67d9f36b67 209 * timer in all 16 bit modes.
<> 157:ff67d9f36b67 210 * @note The timer cannot be running when this function is called
<> 157:ff67d9f36b67 211 *
<> 157:ff67d9f36b67 212 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 213 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 214 * @param config pointer to timer configuration
<> 157:ff67d9f36b67 215 */
<> 157:ff67d9f36b67 216 void TMR16_Config(mxc_tmr_regs_t *tmr, uint8_t index, const tmr16_cfg_t *config);
<> 157:ff67d9f36b67 217
<> 157:ff67d9f36b67 218 /**
<> 157:ff67d9f36b67 219 * @brief Starts the specified timer.
<> 157:ff67d9f36b67 220 *
<> 157:ff67d9f36b67 221 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 222 */
<> 157:ff67d9f36b67 223 void TMR32_Start(mxc_tmr_regs_t *tmr);
<> 157:ff67d9f36b67 224
<> 157:ff67d9f36b67 225 /**
<> 157:ff67d9f36b67 226 * @brief Starts the specified timer.
<> 157:ff67d9f36b67 227 *
<> 157:ff67d9f36b67 228 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 229 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 230 */
<> 157:ff67d9f36b67 231 void TMR16_Start(mxc_tmr_regs_t *tmr, uint8_t index);
<> 157:ff67d9f36b67 232
<> 157:ff67d9f36b67 233 /**
<> 157:ff67d9f36b67 234 * @brief Stops the specified 32 bit timer.
<> 157:ff67d9f36b67 235 * @details All other timer states are left unchanged.
<> 157:ff67d9f36b67 236 *
<> 157:ff67d9f36b67 237 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 238 */
<> 157:ff67d9f36b67 239 __STATIC_INLINE void TMR32_Stop(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 240 {
<> 157:ff67d9f36b67 241 tmr->ctrl &= ~MXC_F_TMR_CTRL_ENABLE0;
<> 157:ff67d9f36b67 242 }
<> 157:ff67d9f36b67 243
<> 157:ff67d9f36b67 244 /**
<> 157:ff67d9f36b67 245 * @brief Stop the specified 16 bit timer.
<> 157:ff67d9f36b67 246 * @details All other timer states are left unchanged.
<> 157:ff67d9f36b67 247 *
<> 157:ff67d9f36b67 248 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 249 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 250 */
<> 157:ff67d9f36b67 251 __STATIC_INLINE void TMR16_Stop(mxc_tmr_regs_t *tmr, uint8_t index)
<> 157:ff67d9f36b67 252 {
<> 157:ff67d9f36b67 253 if(index)
<> 157:ff67d9f36b67 254 tmr->ctrl &= ~MXC_F_TMR_CTRL_ENABLE1;
<> 157:ff67d9f36b67 255 else
<> 157:ff67d9f36b67 256 tmr->ctrl &= ~MXC_F_TMR_CTRL_ENABLE0;
<> 157:ff67d9f36b67 257 }
<> 157:ff67d9f36b67 258
<> 157:ff67d9f36b67 259 /**
<> 157:ff67d9f36b67 260 * @brief Determines if the timer is running
<> 157:ff67d9f36b67 261 *
<> 157:ff67d9f36b67 262 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 263 *
<> 157:ff67d9f36b67 264 * @return 0 = timer is off, non-zero = timer is on
<> 157:ff67d9f36b67 265 */
<> 157:ff67d9f36b67 266 __STATIC_INLINE uint32_t TMR32_IsActive(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 267 {
<> 157:ff67d9f36b67 268 return (tmr->ctrl & MXC_F_TMR_CTRL_ENABLE0);
<> 157:ff67d9f36b67 269 }
<> 157:ff67d9f36b67 270
<> 157:ff67d9f36b67 271 /**
<> 157:ff67d9f36b67 272 * @brief Determines if the timer is running
<> 157:ff67d9f36b67 273 *
<> 157:ff67d9f36b67 274 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 275 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 276 *
<> 157:ff67d9f36b67 277 * @return 0 Timer is off.
<> 157:ff67d9f36b67 278 * @return Non-zero Timer is on.
<> 157:ff67d9f36b67 279 */
<> 157:ff67d9f36b67 280 __STATIC_INLINE uint32_t TMR16_IsActive(mxc_tmr_regs_t *tmr, uint8_t index)
<> 157:ff67d9f36b67 281 {
<> 157:ff67d9f36b67 282 if(index)
<> 157:ff67d9f36b67 283 return (tmr->ctrl & MXC_F_TMR_CTRL_ENABLE1);
<> 157:ff67d9f36b67 284 else
<> 157:ff67d9f36b67 285 return (tmr->ctrl & MXC_F_TMR_CTRL_ENABLE0);
<> 157:ff67d9f36b67 286 }
<> 157:ff67d9f36b67 287
<> 157:ff67d9f36b67 288 /**
<> 157:ff67d9f36b67 289 * @brief Enables the timer's interrupt
<> 157:ff67d9f36b67 290 *
<> 157:ff67d9f36b67 291 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 292 */
<> 157:ff67d9f36b67 293 __STATIC_INLINE void TMR32_EnableINT(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 294 {
<> 157:ff67d9f36b67 295 tmr->inten |= MXC_F_TMR_INTEN_TIMER0;
<> 157:ff67d9f36b67 296 }
<> 157:ff67d9f36b67 297
<> 157:ff67d9f36b67 298 /**
<> 157:ff67d9f36b67 299 * @brief Enables the timer's interrupt
<> 157:ff67d9f36b67 300 *
<> 157:ff67d9f36b67 301 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 302 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 303 */
<> 157:ff67d9f36b67 304 __STATIC_INLINE void TMR16_EnableINT(mxc_tmr_regs_t *tmr, uint8_t index)
<> 157:ff67d9f36b67 305 {
<> 157:ff67d9f36b67 306 if(index)
<> 157:ff67d9f36b67 307 tmr->inten |= MXC_F_TMR_INTEN_TIMER1;
<> 157:ff67d9f36b67 308 else
<> 157:ff67d9f36b67 309 tmr->inten |= MXC_F_TMR_INTEN_TIMER0;
<> 157:ff67d9f36b67 310 }
<> 157:ff67d9f36b67 311
<> 157:ff67d9f36b67 312 /**
<> 157:ff67d9f36b67 313 * @brief Disables the timer's interrupt
<> 157:ff67d9f36b67 314 *
<> 157:ff67d9f36b67 315 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 316 */
<> 157:ff67d9f36b67 317 __STATIC_INLINE void TMR32_DisableINT(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 318 {
<> 157:ff67d9f36b67 319 tmr->inten &= ~MXC_F_TMR_INTEN_TIMER0;
<> 157:ff67d9f36b67 320 }
<> 157:ff67d9f36b67 321
<> 157:ff67d9f36b67 322 /**
<> 157:ff67d9f36b67 323 * @brief Disables the timer's interrupt
<> 157:ff67d9f36b67 324 *
<> 157:ff67d9f36b67 325 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 326 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 327 */
<> 157:ff67d9f36b67 328 __STATIC_INLINE void TMR16_DisableINT(mxc_tmr_regs_t *tmr, uint8_t index)
<> 157:ff67d9f36b67 329 {
<> 157:ff67d9f36b67 330 if(index)
<> 157:ff67d9f36b67 331 tmr->inten &= ~MXC_F_TMR_INTEN_TIMER1;
<> 157:ff67d9f36b67 332 else
<> 157:ff67d9f36b67 333 tmr->inten &= ~MXC_F_TMR_INTEN_TIMER0;
<> 157:ff67d9f36b67 334 }
<> 157:ff67d9f36b67 335
<> 157:ff67d9f36b67 336 /**
<> 157:ff67d9f36b67 337 * @brief Gets the timer's interrupt flag
<> 157:ff67d9f36b67 338 *
<> 157:ff67d9f36b67 339 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 340 *
<> 157:ff67d9f36b67 341 * @return 0 = flag not set, non-zero = flag is set
<> 157:ff67d9f36b67 342 */
<> 157:ff67d9f36b67 343 __STATIC_INLINE uint32_t TMR32_GetFlag(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 344 {
<> 157:ff67d9f36b67 345 return (tmr->intfl & MXC_F_TMR_INTFL_TIMER0);
<> 157:ff67d9f36b67 346 }
<> 157:ff67d9f36b67 347
<> 157:ff67d9f36b67 348 /**
<> 157:ff67d9f36b67 349 * @brief Gets the timer's interrupt flag
<> 157:ff67d9f36b67 350 *
<> 157:ff67d9f36b67 351 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 352 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 353 *
<> 157:ff67d9f36b67 354 * @return 0 = flag not set, non-zero = flag is set
<> 157:ff67d9f36b67 355 */
<> 157:ff67d9f36b67 356 __STATIC_INLINE uint32_t TMR16_GetFlag(mxc_tmr_regs_t *tmr, uint8_t index)
<> 157:ff67d9f36b67 357 {
<> 157:ff67d9f36b67 358 if(index)
<> 157:ff67d9f36b67 359 return (tmr->intfl & MXC_F_TMR_INTFL_TIMER1);
<> 157:ff67d9f36b67 360 else
<> 157:ff67d9f36b67 361 return (tmr->intfl & MXC_F_TMR_INTFL_TIMER0);
<> 157:ff67d9f36b67 362 }
<> 157:ff67d9f36b67 363
<> 157:ff67d9f36b67 364 /**
<> 157:ff67d9f36b67 365 * @brief Clears the timer interrupt flag
<> 157:ff67d9f36b67 366 *
<> 157:ff67d9f36b67 367 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 368 */
<> 157:ff67d9f36b67 369 __STATIC_INLINE void TMR32_ClearFlag(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 370 {
<> 157:ff67d9f36b67 371 tmr->intfl = MXC_F_TMR_INTFL_TIMER0;
<> 157:ff67d9f36b67 372 }
<> 157:ff67d9f36b67 373
<> 157:ff67d9f36b67 374 /**
<> 157:ff67d9f36b67 375 * @brief Clears the timer interrupt flag for the specified index
<> 157:ff67d9f36b67 376 *
<> 157:ff67d9f36b67 377 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 378 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 379 */
<> 157:ff67d9f36b67 380 __STATIC_INLINE void TMR16_ClearFlag(mxc_tmr_regs_t *tmr, uint8_t index)
<> 157:ff67d9f36b67 381 {
<> 157:ff67d9f36b67 382 if(index)
<> 157:ff67d9f36b67 383 tmr->intfl = MXC_F_TMR_INTFL_TIMER1;
<> 157:ff67d9f36b67 384 else
<> 157:ff67d9f36b67 385 tmr->intfl = MXC_F_TMR_INTFL_TIMER0;
<> 157:ff67d9f36b67 386 }
<> 157:ff67d9f36b67 387
<> 157:ff67d9f36b67 388 /**
<> 157:ff67d9f36b67 389 * @brief Set the current tick value to start counting from.
<> 157:ff67d9f36b67 390 *
<> 157:ff67d9f36b67 391 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 392 * @param count value to set the current ticks
<> 157:ff67d9f36b67 393 */
<> 157:ff67d9f36b67 394 __STATIC_INLINE void TMR32_SetCount(mxc_tmr_regs_t *tmr, uint32_t count)
<> 157:ff67d9f36b67 395 {
<> 157:ff67d9f36b67 396 tmr->count32 = count;
<> 157:ff67d9f36b67 397 }
<> 157:ff67d9f36b67 398
<> 157:ff67d9f36b67 399 /**
<> 157:ff67d9f36b67 400 * @brief Set the current tick value to start counting from.
<> 157:ff67d9f36b67 401 *
<> 157:ff67d9f36b67 402 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 403 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 404 * @param count value to set the current ticks
<> 157:ff67d9f36b67 405 */
<> 157:ff67d9f36b67 406 __STATIC_INLINE void TMR16_SetCount(mxc_tmr_regs_t *tmr, uint8_t index, uint16_t count)
<> 157:ff67d9f36b67 407 {
<> 157:ff67d9f36b67 408 if (index)
<> 157:ff67d9f36b67 409 tmr->count16_1 = count;
<> 157:ff67d9f36b67 410 else
<> 157:ff67d9f36b67 411 tmr->count16_0 = count;
<> 157:ff67d9f36b67 412 }
<> 157:ff67d9f36b67 413
<> 157:ff67d9f36b67 414 /**
<> 157:ff67d9f36b67 415 * @brief Gets the most current count value.
<> 157:ff67d9f36b67 416 *
<> 157:ff67d9f36b67 417 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 418 *
<> 157:ff67d9f36b67 419 * @return current count value in ticks
<> 157:ff67d9f36b67 420 */
<> 157:ff67d9f36b67 421 __STATIC_INLINE uint32_t TMR32_GetCount(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 422 {
<> 157:ff67d9f36b67 423 return (tmr->count32);
<> 157:ff67d9f36b67 424 }
<> 157:ff67d9f36b67 425
<> 157:ff67d9f36b67 426 /**
<> 157:ff67d9f36b67 427 * @brief Gets the most current count value.
<> 157:ff67d9f36b67 428 *
<> 157:ff67d9f36b67 429 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 430 * @param index selects which 16 bit timer(0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 431 *
<> 157:ff67d9f36b67 432 * @return current count value in ticks
<> 157:ff67d9f36b67 433 */
<> 157:ff67d9f36b67 434 __STATIC_INLINE uint32_t TMR16_GetCount(mxc_tmr_regs_t *tmr, uint8_t index)
<> 157:ff67d9f36b67 435 {
<> 157:ff67d9f36b67 436 if(index)
<> 157:ff67d9f36b67 437 return tmr->count16_1;
<> 157:ff67d9f36b67 438 else
<> 157:ff67d9f36b67 439 return tmr->count16_0;
<> 157:ff67d9f36b67 440 }
<> 157:ff67d9f36b67 441
<> 157:ff67d9f36b67 442 /**
<> 157:ff67d9f36b67 443 * @brief Gets the most recent capture value.
<> 157:ff67d9f36b67 444 * @details Used in Capture or Measure timer modes
<> 157:ff67d9f36b67 445 *
<> 157:ff67d9f36b67 446 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 447 *
<> 157:ff67d9f36b67 448 * @return capture value in ticks
<> 157:ff67d9f36b67 449 */
<> 157:ff67d9f36b67 450 __STATIC_INLINE uint32_t TMR32_GetCapture(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 451 {
<> 157:ff67d9f36b67 452 return (tmr->pwm_cap32);
<> 157:ff67d9f36b67 453 }
<> 157:ff67d9f36b67 454
<> 157:ff67d9f36b67 455 /**
<> 157:ff67d9f36b67 456 * @brief Set a new compare tick value for timer
<> 157:ff67d9f36b67 457 * @details Depending on the timer mode this is the tick value to stop the
<> 157:ff67d9f36b67 458 * timer, reset ticks to 1, or compare the timer
<> 157:ff67d9f36b67 459 *
<> 157:ff67d9f36b67 460 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 461 * @param count new terminal/compare value in timer counts
<> 157:ff67d9f36b67 462 */
<> 157:ff67d9f36b67 463 __STATIC_INLINE void TMR32_SetCompare(mxc_tmr_regs_t *tmr, uint32_t count)
<> 157:ff67d9f36b67 464 {
<> 157:ff67d9f36b67 465 tmr->term_cnt32 = count;
<> 157:ff67d9f36b67 466 }
<> 157:ff67d9f36b67 467
<> 157:ff67d9f36b67 468 /**
<> 157:ff67d9f36b67 469 * @brief Get compare tick value for timer
<> 157:ff67d9f36b67 470 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 471 * @return compare value in ticks
<> 157:ff67d9f36b67 472 */
<> 157:ff67d9f36b67 473 __STATIC_INLINE uint32_t TMR32_GetCompare(mxc_tmr_regs_t *tmr)
<> 157:ff67d9f36b67 474 {
<> 157:ff67d9f36b67 475 return tmr->term_cnt32;
<> 157:ff67d9f36b67 476 }
<> 157:ff67d9f36b67 477
<> 157:ff67d9f36b67 478 /**
<> 157:ff67d9f36b67 479 * @brief Set a new compare tick value for timer
<> 157:ff67d9f36b67 480 * @details Depending on the timer mode this is the tick value to stop the
<> 157:ff67d9f36b67 481 * timer, reset ticks to 1, or compare the timer
<> 157:ff67d9f36b67 482 *
<> 157:ff67d9f36b67 483 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 484 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 485 * @param count new terminal/compare value in timer counts
<> 157:ff67d9f36b67 486 */
<> 157:ff67d9f36b67 487 __STATIC_INLINE void TMR16_SetCompare(mxc_tmr_regs_t *tmr, uint8_t index, uint16_t count)
<> 157:ff67d9f36b67 488 {
<> 157:ff67d9f36b67 489 if (index)
<> 157:ff67d9f36b67 490 tmr->term_cnt16_1 = count;
<> 157:ff67d9f36b67 491 else
<> 157:ff67d9f36b67 492 tmr->term_cnt16_0 = count;
<> 157:ff67d9f36b67 493 }
<> 157:ff67d9f36b67 494
<> 157:ff67d9f36b67 495 /**
<> 157:ff67d9f36b67 496 * @brief Get compare tick value for timer
<> 157:ff67d9f36b67 497 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 498 * @param index selects which 16 bit timer (0 = 16_0 or 1 = 16_1)
<> 157:ff67d9f36b67 499 * @return compare value in ticks
<> 157:ff67d9f36b67 500 */
<> 157:ff67d9f36b67 501 __STATIC_INLINE uint32_t TMR16_GetCompare(mxc_tmr_regs_t *tmr, uint8_t index)
<> 157:ff67d9f36b67 502 {
<> 157:ff67d9f36b67 503 if (index)
<> 157:ff67d9f36b67 504 return tmr->term_cnt16_1;
<> 157:ff67d9f36b67 505 return tmr->term_cnt16_0;
<> 157:ff67d9f36b67 506 }
<> 157:ff67d9f36b67 507
<> 157:ff67d9f36b67 508 /**
<> 157:ff67d9f36b67 509 * @brief Returns the prescale value used by the timer
<> 157:ff67d9f36b67 510 *
<> 157:ff67d9f36b67 511 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 512 *
<> 157:ff67d9f36b67 513 * @return prescaler
<> 157:ff67d9f36b67 514 */
<> 157:ff67d9f36b67 515 uint32_t TMR_GetPrescaler(mxc_tmr_regs_t *tmr);
<> 157:ff67d9f36b67 516
<> 157:ff67d9f36b67 517 /**
<> 157:ff67d9f36b67 518 * @brief Set a new duty cycle when the timer is used in PWM mode.
<> 157:ff67d9f36b67 519 *
<> 157:ff67d9f36b67 520 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 521 * @param dutyCount duty cycle value in timer counts
<> 157:ff67d9f36b67 522 */
<> 157:ff67d9f36b67 523 __STATIC_INLINE void TMR32_SetDuty(mxc_tmr_regs_t *tmr, uint32_t dutyCount)
<> 157:ff67d9f36b67 524 {
<> 157:ff67d9f36b67 525 tmr->pwm_cap32 = dutyCount;
<> 157:ff67d9f36b67 526 }
<> 157:ff67d9f36b67 527
<> 157:ff67d9f36b67 528 /**
<> 157:ff67d9f36b67 529 * @brief Set a new duty cycle when the timer is used in PWM mode.
<> 157:ff67d9f36b67 530 *
<> 157:ff67d9f36b67 531 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 532 * @param dutyPercent duty cycle value in percent (0 to 100%)
<> 157:ff67d9f36b67 533 */
<> 157:ff67d9f36b67 534 __STATIC_INLINE void TMR32_SetDutyPer(mxc_tmr_regs_t *tmr, uint32_t dutyPercent)
<> 157:ff67d9f36b67 535 {
<> 157:ff67d9f36b67 536 uint32_t periodCount = tmr->term_cnt32;
<> 157:ff67d9f36b67 537 tmr->pwm_cap32 = ((uint64_t)periodCount * dutyPercent) / 100;
<> 157:ff67d9f36b67 538 }
<> 157:ff67d9f36b67 539
<> 157:ff67d9f36b67 540 /**
<> 157:ff67d9f36b67 541 * @brief Set a new period value for PWM timer
<> 157:ff67d9f36b67 542 *
<> 157:ff67d9f36b67 543 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 544 * @param period new period value in timer counts
<> 157:ff67d9f36b67 545 */
<> 157:ff67d9f36b67 546 __STATIC_INLINE void TMR32_SetPeriod(mxc_tmr_regs_t *tmr, uint32_t period)
<> 157:ff67d9f36b67 547 {
<> 157:ff67d9f36b67 548 tmr->term_cnt32 = period;
<> 157:ff67d9f36b67 549 }
<> 157:ff67d9f36b67 550
<> 157:ff67d9f36b67 551 /**
<> 157:ff67d9f36b67 552 * @brief Converts frequency and duty cycle % to period and duty ticks
<> 157:ff67d9f36b67 553 * @note TMR_Init should be called before this function to set the prescaler
<> 157:ff67d9f36b67 554 *
<> 157:ff67d9f36b67 555 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 556 * @param dutyPercent duty cycle in percent (0 to 100%)
<> 157:ff67d9f36b67 557 * @param freq frequency of pwm signal in Hz
<> 157:ff67d9f36b67 558 * @param dutyTicks calculated duty cycle in ticks
<> 157:ff67d9f36b67 559 * @param periodTicks calculated period in ticks
<> 157:ff67d9f36b67 560 *
<> 157:ff67d9f36b67 561 * @returns #E_NO_ERROR if everything is successful, error if unsuccessful.
<> 157:ff67d9f36b67 562 *
<> 157:ff67d9f36b67 563 */
<> 157:ff67d9f36b67 564 int TMR32_GetPWMTicks(mxc_tmr_regs_t *tmr, uint8_t dutyPercent, uint32_t freq, uint32_t *dutyTicks, uint32_t *periodTicks);
<> 157:ff67d9f36b67 565
<> 157:ff67d9f36b67 566 /**
<> 157:ff67d9f36b67 567 * @brief Converts a time and units to a number of ticks for the 32-bit timer.
<> 157:ff67d9f36b67 568 * @note TMR_Init should be called before this function to set the prescaler
<> 157:ff67d9f36b67 569 *
<> 157:ff67d9f36b67 570 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 571 * @param time time value.
<> 157:ff67d9f36b67 572 * @param units time units.
<> 157:ff67d9f36b67 573 * @param ticks calculated number of ticks.
<> 157:ff67d9f36b67 574 *
<> 157:ff67d9f36b67 575 * @returns #E_NO_ERROR if everything is successful, error if unsuccessful.
<> 157:ff67d9f36b67 576 */
<> 157:ff67d9f36b67 577 int TMR32_TimeToTicks(mxc_tmr_regs_t *tmr, uint32_t time, tmr_unit_t units, uint32_t *ticks);
<> 157:ff67d9f36b67 578
<> 157:ff67d9f36b67 579 /**
<> 157:ff67d9f36b67 580 * @brief Converts a time and units to a number of ticks for the 16-bit timer.
<> 157:ff67d9f36b67 581 * @note TMR_Init should be called before this function to set the prescaler
<> 157:ff67d9f36b67 582 *
<> 157:ff67d9f36b67 583 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 584 * @param time time value.
<> 157:ff67d9f36b67 585 * @param units time units.
<> 157:ff67d9f36b67 586 * @param ticks calculated number of ticks.
<> 157:ff67d9f36b67 587 *
<> 157:ff67d9f36b67 588 * @returns #E_NO_ERROR if everything is successful, error if unsuccessful.
<> 157:ff67d9f36b67 589 */
<> 157:ff67d9f36b67 590 int TMR16_TimeToTicks(mxc_tmr_regs_t *tmr, uint32_t time, tmr_unit_t units, uint16_t *ticks);
<> 157:ff67d9f36b67 591
<> 157:ff67d9f36b67 592 /**
<> 157:ff67d9f36b67 593 * @brief Converts a number of ticks to a time and units for the timer.
<> 157:ff67d9f36b67 594 * @note TMR_Init should be called before this function to set the prescaler
<> 157:ff67d9f36b67 595 *
<> 157:ff67d9f36b67 596 * @param tmr Pointer to timer registers for the timer instance to modify.
<> 157:ff67d9f36b67 597 * @param ticks number of ticks.
<> 157:ff67d9f36b67 598 * @param time calculated time value.
<> 157:ff67d9f36b67 599 * @param units calculated time units.
<> 157:ff67d9f36b67 600 *
<> 157:ff67d9f36b67 601 * @returns #E_NO_ERROR if everything is successful, error if unsuccessful.
<> 157:ff67d9f36b67 602 */
<> 157:ff67d9f36b67 603 int TMR_TicksToTime(mxc_tmr_regs_t *tmr, uint32_t ticks, uint32_t *time, tmr_unit_t *units);
<> 157:ff67d9f36b67 604
<> 157:ff67d9f36b67 605 /** @} */
<> 157:ff67d9f36b67 606
<> 157:ff67d9f36b67 607 #ifdef __cplusplus
<> 157:ff67d9f36b67 608 }
<> 157:ff67d9f36b67 609 #endif
<> 157:ff67d9f36b67 610
<> 157:ff67d9f36b67 611 #endif /* _TIMER_H */