added prescaler for 16 bit pwm in LPC1347 target
Fork of mbed-dev by
targets/hal/TARGET_Silicon_Labs/TARGET_EFM32/emlib/src/em_timer.c@50:a417edff4437, 2016-01-15 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Jan 15 07:45:16 2016 +0000
- Revision:
- 50:a417edff4437
- Parent:
- 0:9b334a45a8ff
- Child:
- 144:ef7eb2e8f9f7
Synchronized with git revision 6010f32619bfcbb01cc73747d4ff9040863482d9
Full URL: https://github.com/mbedmicro/mbed/commit/6010f32619bfcbb01cc73747d4ff9040863482d9/
Remove doubling of buffer size in realiseEndpoint()
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 0:9b334a45a8ff | 1 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 2 | * @file em_timer.c |
bogdanm | 0:9b334a45a8ff | 3 | * @brief Timer/counter (TIMER) Peripheral API |
mbed_official | 50:a417edff4437 | 4 | * @version 4.2.1 |
bogdanm | 0:9b334a45a8ff | 5 | ******************************************************************************* |
bogdanm | 0:9b334a45a8ff | 6 | * @section License |
mbed_official | 50:a417edff4437 | 7 | * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> |
bogdanm | 0:9b334a45a8ff | 8 | ******************************************************************************* |
bogdanm | 0:9b334a45a8ff | 9 | * |
bogdanm | 0:9b334a45a8ff | 10 | * Permission is granted to anyone to use this software for any purpose, |
bogdanm | 0:9b334a45a8ff | 11 | * including commercial applications, and to alter it and redistribute it |
bogdanm | 0:9b334a45a8ff | 12 | * freely, subject to the following restrictions: |
bogdanm | 0:9b334a45a8ff | 13 | * |
bogdanm | 0:9b334a45a8ff | 14 | * 1. The origin of this software must not be misrepresented; you must not |
bogdanm | 0:9b334a45a8ff | 15 | * claim that you wrote the original software. |
bogdanm | 0:9b334a45a8ff | 16 | * 2. Altered source versions must be plainly marked as such, and must not be |
bogdanm | 0:9b334a45a8ff | 17 | * misrepresented as being the original software. |
bogdanm | 0:9b334a45a8ff | 18 | * 3. This notice may not be removed or altered from any source distribution. |
bogdanm | 0:9b334a45a8ff | 19 | * |
bogdanm | 0:9b334a45a8ff | 20 | * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no |
bogdanm | 0:9b334a45a8ff | 21 | * obligation to support this Software. Silicon Labs is providing the |
bogdanm | 0:9b334a45a8ff | 22 | * Software "AS IS", with no express or implied warranties of any kind, |
bogdanm | 0:9b334a45a8ff | 23 | * including, but not limited to, any implied warranties of merchantability |
bogdanm | 0:9b334a45a8ff | 24 | * or fitness for any particular purpose or warranties against infringement |
bogdanm | 0:9b334a45a8ff | 25 | * of any proprietary rights of a third party. |
bogdanm | 0:9b334a45a8ff | 26 | * |
bogdanm | 0:9b334a45a8ff | 27 | * Silicon Labs will not be liable for any consequential, incidental, or |
bogdanm | 0:9b334a45a8ff | 28 | * special damages, or any other relief, or for any claim by any third party, |
bogdanm | 0:9b334a45a8ff | 29 | * arising from your use of this Software. |
bogdanm | 0:9b334a45a8ff | 30 | * |
bogdanm | 0:9b334a45a8ff | 31 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 32 | |
bogdanm | 0:9b334a45a8ff | 33 | #include "em_timer.h" |
bogdanm | 0:9b334a45a8ff | 34 | #if defined(TIMER_COUNT) && (TIMER_COUNT > 0) |
bogdanm | 0:9b334a45a8ff | 35 | |
bogdanm | 0:9b334a45a8ff | 36 | #include "em_assert.h" |
bogdanm | 0:9b334a45a8ff | 37 | |
bogdanm | 0:9b334a45a8ff | 38 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 39 | * @addtogroup EM_Library |
bogdanm | 0:9b334a45a8ff | 40 | * @{ |
bogdanm | 0:9b334a45a8ff | 41 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 42 | |
bogdanm | 0:9b334a45a8ff | 43 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 44 | * @addtogroup TIMER |
bogdanm | 0:9b334a45a8ff | 45 | * @brief Timer/Counter (TIMER) Peripheral API |
bogdanm | 0:9b334a45a8ff | 46 | * @details |
bogdanm | 0:9b334a45a8ff | 47 | * The timer module consists of three main parts: |
bogdanm | 0:9b334a45a8ff | 48 | * @li General timer config and enable control. |
bogdanm | 0:9b334a45a8ff | 49 | * @li Compare/capture control. |
bogdanm | 0:9b334a45a8ff | 50 | * @li Dead time insertion control (may not be available for all timers). |
bogdanm | 0:9b334a45a8ff | 51 | * @{ |
bogdanm | 0:9b334a45a8ff | 52 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 53 | |
bogdanm | 0:9b334a45a8ff | 54 | |
bogdanm | 0:9b334a45a8ff | 55 | /******************************************************************************* |
bogdanm | 0:9b334a45a8ff | 56 | ************************** GLOBAL FUNCTIONS ******************************* |
bogdanm | 0:9b334a45a8ff | 57 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 58 | |
bogdanm | 0:9b334a45a8ff | 59 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 60 | * @brief |
bogdanm | 0:9b334a45a8ff | 61 | * Initialize TIMER. |
bogdanm | 0:9b334a45a8ff | 62 | * |
bogdanm | 0:9b334a45a8ff | 63 | * @details |
bogdanm | 0:9b334a45a8ff | 64 | * Notice that counter top must be configured separately with for instance |
bogdanm | 0:9b334a45a8ff | 65 | * TIMER_TopSet(). In addition, compare/capture and dead-time insertion |
bogdanm | 0:9b334a45a8ff | 66 | * init must be initialized separately if used. That should probably |
bogdanm | 0:9b334a45a8ff | 67 | * be done prior to the use of this function if configuring the TIMER to |
bogdanm | 0:9b334a45a8ff | 68 | * start when initialization is completed. |
bogdanm | 0:9b334a45a8ff | 69 | * |
bogdanm | 0:9b334a45a8ff | 70 | * @param[in] timer |
bogdanm | 0:9b334a45a8ff | 71 | * Pointer to TIMER peripheral register block. |
bogdanm | 0:9b334a45a8ff | 72 | * |
bogdanm | 0:9b334a45a8ff | 73 | * @param[in] init |
bogdanm | 0:9b334a45a8ff | 74 | * Pointer to TIMER initialization structure. |
bogdanm | 0:9b334a45a8ff | 75 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 76 | void TIMER_Init(TIMER_TypeDef *timer, const TIMER_Init_TypeDef *init) |
bogdanm | 0:9b334a45a8ff | 77 | { |
bogdanm | 0:9b334a45a8ff | 78 | EFM_ASSERT(TIMER_REF_VALID(timer)); |
bogdanm | 0:9b334a45a8ff | 79 | |
bogdanm | 0:9b334a45a8ff | 80 | /* Stop timer if specified to be disabled (dosn't hurt if already stopped) */ |
bogdanm | 0:9b334a45a8ff | 81 | if (!(init->enable)) |
bogdanm | 0:9b334a45a8ff | 82 | { |
bogdanm | 0:9b334a45a8ff | 83 | timer->CMD = TIMER_CMD_STOP; |
bogdanm | 0:9b334a45a8ff | 84 | } |
bogdanm | 0:9b334a45a8ff | 85 | |
bogdanm | 0:9b334a45a8ff | 86 | /* Reset counter */ |
bogdanm | 0:9b334a45a8ff | 87 | timer->CNT = _TIMER_CNT_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 88 | |
mbed_official | 50:a417edff4437 | 89 | timer->CTRL = ((uint32_t)(init->prescale) << _TIMER_CTRL_PRESC_SHIFT) |
mbed_official | 50:a417edff4437 | 90 | | ((uint32_t)(init->clkSel) << _TIMER_CTRL_CLKSEL_SHIFT) |
mbed_official | 50:a417edff4437 | 91 | | ((uint32_t)(init->fallAction) << _TIMER_CTRL_FALLA_SHIFT) |
mbed_official | 50:a417edff4437 | 92 | | ((uint32_t)(init->riseAction) << _TIMER_CTRL_RISEA_SHIFT) |
mbed_official | 50:a417edff4437 | 93 | | ((uint32_t)(init->mode) << _TIMER_CTRL_MODE_SHIFT) |
mbed_official | 50:a417edff4437 | 94 | | (init->debugRun ? TIMER_CTRL_DEBUGRUN : 0) |
mbed_official | 50:a417edff4437 | 95 | | (init->dmaClrAct ? TIMER_CTRL_DMACLRACT : 0) |
mbed_official | 50:a417edff4437 | 96 | | (init->quadModeX4 ? TIMER_CTRL_QDM_X4 : 0) |
mbed_official | 50:a417edff4437 | 97 | | (init->oneShot ? TIMER_CTRL_OSMEN : 0) |
bogdanm | 0:9b334a45a8ff | 98 | |
mbed_official | 50:a417edff4437 | 99 | #if defined(TIMER_CTRL_X2CNT) && defined(TIMER_CTRL_ATI) |
mbed_official | 50:a417edff4437 | 100 | | (init->count2x ? TIMER_CTRL_X2CNT : 0) |
mbed_official | 50:a417edff4437 | 101 | | (init->ati ? TIMER_CTRL_ATI : 0) |
bogdanm | 0:9b334a45a8ff | 102 | #endif |
mbed_official | 50:a417edff4437 | 103 | | (init->sync ? TIMER_CTRL_SYNC : 0); |
bogdanm | 0:9b334a45a8ff | 104 | |
bogdanm | 0:9b334a45a8ff | 105 | /* Start timer if specified to be enabled (dosn't hurt if already started) */ |
bogdanm | 0:9b334a45a8ff | 106 | if (init->enable) |
bogdanm | 0:9b334a45a8ff | 107 | { |
bogdanm | 0:9b334a45a8ff | 108 | timer->CMD = TIMER_CMD_START; |
bogdanm | 0:9b334a45a8ff | 109 | } |
bogdanm | 0:9b334a45a8ff | 110 | } |
bogdanm | 0:9b334a45a8ff | 111 | |
bogdanm | 0:9b334a45a8ff | 112 | |
bogdanm | 0:9b334a45a8ff | 113 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 114 | * @brief |
bogdanm | 0:9b334a45a8ff | 115 | * Initialize TIMER compare/capture channel. |
bogdanm | 0:9b334a45a8ff | 116 | * |
bogdanm | 0:9b334a45a8ff | 117 | * @details |
bogdanm | 0:9b334a45a8ff | 118 | * Notice that if operating channel in compare mode, the CCV and CCVB register |
bogdanm | 0:9b334a45a8ff | 119 | * must be set separately as required. |
bogdanm | 0:9b334a45a8ff | 120 | * |
bogdanm | 0:9b334a45a8ff | 121 | * @param[in] timer |
bogdanm | 0:9b334a45a8ff | 122 | * Pointer to TIMER peripheral register block. |
bogdanm | 0:9b334a45a8ff | 123 | * |
bogdanm | 0:9b334a45a8ff | 124 | * @param[in] ch |
bogdanm | 0:9b334a45a8ff | 125 | * Compare/capture channel to init for. |
bogdanm | 0:9b334a45a8ff | 126 | * |
bogdanm | 0:9b334a45a8ff | 127 | * @param[in] init |
bogdanm | 0:9b334a45a8ff | 128 | * Pointer to TIMER initialization structure. |
bogdanm | 0:9b334a45a8ff | 129 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 130 | void TIMER_InitCC(TIMER_TypeDef *timer, |
bogdanm | 0:9b334a45a8ff | 131 | unsigned int ch, |
bogdanm | 0:9b334a45a8ff | 132 | const TIMER_InitCC_TypeDef *init) |
bogdanm | 0:9b334a45a8ff | 133 | { |
bogdanm | 0:9b334a45a8ff | 134 | EFM_ASSERT(TIMER_REF_VALID(timer)); |
bogdanm | 0:9b334a45a8ff | 135 | EFM_ASSERT(TIMER_CH_VALID(ch)); |
bogdanm | 0:9b334a45a8ff | 136 | |
bogdanm | 0:9b334a45a8ff | 137 | timer->CC[ch].CTRL = |
mbed_official | 50:a417edff4437 | 138 | ((uint32_t)(init->eventCtrl) << _TIMER_CC_CTRL_ICEVCTRL_SHIFT) |
mbed_official | 50:a417edff4437 | 139 | | ((uint32_t)(init->edge) << _TIMER_CC_CTRL_ICEDGE_SHIFT) |
mbed_official | 50:a417edff4437 | 140 | | ((uint32_t)(init->prsSel) << _TIMER_CC_CTRL_PRSSEL_SHIFT) |
mbed_official | 50:a417edff4437 | 141 | | ((uint32_t)(init->cufoa) << _TIMER_CC_CTRL_CUFOA_SHIFT) |
mbed_official | 50:a417edff4437 | 142 | | ((uint32_t)(init->cofoa) << _TIMER_CC_CTRL_COFOA_SHIFT) |
mbed_official | 50:a417edff4437 | 143 | | ((uint32_t)(init->cmoa) << _TIMER_CC_CTRL_CMOA_SHIFT) |
mbed_official | 50:a417edff4437 | 144 | | ((uint32_t)(init->mode) << _TIMER_CC_CTRL_MODE_SHIFT) |
mbed_official | 50:a417edff4437 | 145 | | (init->filter ? TIMER_CC_CTRL_FILT_ENABLE : 0) |
mbed_official | 50:a417edff4437 | 146 | | (init->prsInput ? TIMER_CC_CTRL_INSEL_PRS : 0) |
mbed_official | 50:a417edff4437 | 147 | | (init->coist ? TIMER_CC_CTRL_COIST : 0) |
mbed_official | 50:a417edff4437 | 148 | | (init->outInvert ? TIMER_CC_CTRL_OUTINV : 0); |
bogdanm | 0:9b334a45a8ff | 149 | } |
bogdanm | 0:9b334a45a8ff | 150 | |
bogdanm | 0:9b334a45a8ff | 151 | |
mbed_official | 50:a417edff4437 | 152 | #if defined(_TIMER_DTCTRL_MASK) |
bogdanm | 0:9b334a45a8ff | 153 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 154 | * @brief |
bogdanm | 0:9b334a45a8ff | 155 | * Initialize the TIMER DTI unit. |
bogdanm | 0:9b334a45a8ff | 156 | * |
bogdanm | 0:9b334a45a8ff | 157 | * @param[in] timer |
bogdanm | 0:9b334a45a8ff | 158 | * Pointer to TIMER peripheral register block. |
bogdanm | 0:9b334a45a8ff | 159 | * |
bogdanm | 0:9b334a45a8ff | 160 | * @param[in] init |
bogdanm | 0:9b334a45a8ff | 161 | * Pointer to TIMER DTI initialization structure. |
bogdanm | 0:9b334a45a8ff | 162 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 163 | void TIMER_InitDTI(TIMER_TypeDef *timer, const TIMER_InitDTI_TypeDef *init) |
bogdanm | 0:9b334a45a8ff | 164 | { |
bogdanm | 0:9b334a45a8ff | 165 | EFM_ASSERT(TIMER0 == timer); |
bogdanm | 0:9b334a45a8ff | 166 | |
bogdanm | 0:9b334a45a8ff | 167 | /* Make sure the DTI unit is disabled while initializing. */ |
bogdanm | 0:9b334a45a8ff | 168 | TIMER_EnableDTI (timer, false); |
bogdanm | 0:9b334a45a8ff | 169 | |
bogdanm | 0:9b334a45a8ff | 170 | /* Setup the DTCTRL register. |
bogdanm | 0:9b334a45a8ff | 171 | The enable bit will be set at the end of the function if specified. */ |
bogdanm | 0:9b334a45a8ff | 172 | timer->DTCTRL = |
mbed_official | 50:a417edff4437 | 173 | (init->autoRestart ? TIMER_DTCTRL_DTDAS : 0) |
mbed_official | 50:a417edff4437 | 174 | | (init->activeLowOut ? TIMER_DTCTRL_DTIPOL : 0) |
mbed_official | 50:a417edff4437 | 175 | | (init->invertComplementaryOut ? TIMER_DTCTRL_DTCINV : 0) |
mbed_official | 50:a417edff4437 | 176 | | (init->enablePrsSource ? TIMER_DTCTRL_DTPRSEN : 0) |
mbed_official | 50:a417edff4437 | 177 | | ((uint32_t)(init->prsSel) << _TIMER_DTCTRL_DTPRSSEL_SHIFT); |
bogdanm | 0:9b334a45a8ff | 178 | |
bogdanm | 0:9b334a45a8ff | 179 | /* Setup the DTTIME register. */ |
bogdanm | 0:9b334a45a8ff | 180 | timer->DTTIME = |
mbed_official | 50:a417edff4437 | 181 | ((uint32_t)(init->prescale) << _TIMER_DTTIME_DTPRESC_SHIFT) |
mbed_official | 50:a417edff4437 | 182 | | ((uint32_t)(init->riseTime) << _TIMER_DTTIME_DTRISET_SHIFT) |
mbed_official | 50:a417edff4437 | 183 | | ((uint32_t)(init->fallTime) << _TIMER_DTTIME_DTFALLT_SHIFT); |
bogdanm | 0:9b334a45a8ff | 184 | |
bogdanm | 0:9b334a45a8ff | 185 | /* Setup the DTFC register. */ |
bogdanm | 0:9b334a45a8ff | 186 | timer->DTFC = |
mbed_official | 50:a417edff4437 | 187 | (init->enableFaultSourceCoreLockup ? TIMER_DTFC_DTLOCKUPFEN : 0) |
mbed_official | 50:a417edff4437 | 188 | | (init->enableFaultSourceDebugger ? TIMER_DTFC_DTDBGFEN : 0) |
mbed_official | 50:a417edff4437 | 189 | | (init->enableFaultSourcePrsSel0 ? TIMER_DTFC_DTPRS0FEN : 0) |
mbed_official | 50:a417edff4437 | 190 | | (init->enableFaultSourcePrsSel1 ? TIMER_DTFC_DTPRS1FEN : 0) |
mbed_official | 50:a417edff4437 | 191 | | ((uint32_t)(init->faultAction) << _TIMER_DTFC_DTFA_SHIFT) |
mbed_official | 50:a417edff4437 | 192 | | ((uint32_t)(init->faultSourcePrsSel0) << _TIMER_DTFC_DTPRS0FSEL_SHIFT) |
mbed_official | 50:a417edff4437 | 193 | | ((uint32_t)(init->faultSourcePrsSel1) << _TIMER_DTFC_DTPRS1FSEL_SHIFT); |
bogdanm | 0:9b334a45a8ff | 194 | |
bogdanm | 0:9b334a45a8ff | 195 | /* Setup the DTOGEN register. */ |
bogdanm | 0:9b334a45a8ff | 196 | timer->DTOGEN = init->outputsEnableMask; |
bogdanm | 0:9b334a45a8ff | 197 | |
bogdanm | 0:9b334a45a8ff | 198 | /* Clear any previous DTI faults. */ |
bogdanm | 0:9b334a45a8ff | 199 | TIMER_ClearDTIFault(timer, TIMER_GetDTIFault(timer)); |
bogdanm | 0:9b334a45a8ff | 200 | |
bogdanm | 0:9b334a45a8ff | 201 | /* Enable/disable before returning. */ |
bogdanm | 0:9b334a45a8ff | 202 | TIMER_EnableDTI (timer, init->enable); |
bogdanm | 0:9b334a45a8ff | 203 | } |
bogdanm | 0:9b334a45a8ff | 204 | #endif |
bogdanm | 0:9b334a45a8ff | 205 | |
bogdanm | 0:9b334a45a8ff | 206 | |
bogdanm | 0:9b334a45a8ff | 207 | /***************************************************************************//** |
bogdanm | 0:9b334a45a8ff | 208 | * @brief |
bogdanm | 0:9b334a45a8ff | 209 | * Reset TIMER to same state as after a HW reset. |
bogdanm | 0:9b334a45a8ff | 210 | * |
bogdanm | 0:9b334a45a8ff | 211 | * @note |
bogdanm | 0:9b334a45a8ff | 212 | * The ROUTE register is NOT reset by this function, in order to allow for |
bogdanm | 0:9b334a45a8ff | 213 | * centralized setup of this feature. |
bogdanm | 0:9b334a45a8ff | 214 | * |
bogdanm | 0:9b334a45a8ff | 215 | * @param[in] timer |
bogdanm | 0:9b334a45a8ff | 216 | * Pointer to TIMER peripheral register block. |
bogdanm | 0:9b334a45a8ff | 217 | ******************************************************************************/ |
bogdanm | 0:9b334a45a8ff | 218 | void TIMER_Reset(TIMER_TypeDef *timer) |
bogdanm | 0:9b334a45a8ff | 219 | { |
bogdanm | 0:9b334a45a8ff | 220 | int i; |
bogdanm | 0:9b334a45a8ff | 221 | |
bogdanm | 0:9b334a45a8ff | 222 | EFM_ASSERT(TIMER_REF_VALID(timer)); |
bogdanm | 0:9b334a45a8ff | 223 | |
bogdanm | 0:9b334a45a8ff | 224 | /* Make sure disabled first, before resetting other registers */ |
bogdanm | 0:9b334a45a8ff | 225 | timer->CMD = TIMER_CMD_STOP; |
bogdanm | 0:9b334a45a8ff | 226 | |
bogdanm | 0:9b334a45a8ff | 227 | timer->CTRL = _TIMER_CTRL_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 228 | timer->IEN = _TIMER_IEN_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 229 | timer->IFC = _TIMER_IFC_MASK; |
bogdanm | 0:9b334a45a8ff | 230 | timer->TOP = _TIMER_TOP_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 231 | timer->TOPB = _TIMER_TOPB_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 232 | timer->CNT = _TIMER_CNT_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 233 | /* Do not reset route register, setting should be done independently */ |
bogdanm | 0:9b334a45a8ff | 234 | /* (Note: ROUTE register may be locked by DTLOCK register.) */ |
bogdanm | 0:9b334a45a8ff | 235 | |
bogdanm | 0:9b334a45a8ff | 236 | for (i = 0; TIMER_CH_VALID(i); i++) |
bogdanm | 0:9b334a45a8ff | 237 | { |
bogdanm | 0:9b334a45a8ff | 238 | timer->CC[i].CTRL = _TIMER_CC_CTRL_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 239 | timer->CC[i].CCV = _TIMER_CC_CCV_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 240 | timer->CC[i].CCVB = _TIMER_CC_CCVB_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 241 | } |
bogdanm | 0:9b334a45a8ff | 242 | |
bogdanm | 0:9b334a45a8ff | 243 | /* Reset dead time insertion module, no effect on timers without DTI */ |
bogdanm | 0:9b334a45a8ff | 244 | |
mbed_official | 50:a417edff4437 | 245 | #if defined(TIMER_DTLOCK_LOCKKEY_UNLOCK) |
bogdanm | 0:9b334a45a8ff | 246 | /* Unlock DTI registers first in case locked */ |
bogdanm | 0:9b334a45a8ff | 247 | timer->DTLOCK = TIMER_DTLOCK_LOCKKEY_UNLOCK; |
bogdanm | 0:9b334a45a8ff | 248 | |
bogdanm | 0:9b334a45a8ff | 249 | timer->DTCTRL = _TIMER_DTCTRL_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 250 | timer->DTTIME = _TIMER_DTTIME_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 251 | timer->DTFC = _TIMER_DTFC_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 252 | timer->DTOGEN = _TIMER_DTOGEN_RESETVALUE; |
bogdanm | 0:9b334a45a8ff | 253 | timer->DTFAULTC = _TIMER_DTFAULTC_MASK; |
bogdanm | 0:9b334a45a8ff | 254 | #endif |
bogdanm | 0:9b334a45a8ff | 255 | } |
bogdanm | 0:9b334a45a8ff | 256 | |
bogdanm | 0:9b334a45a8ff | 257 | |
bogdanm | 0:9b334a45a8ff | 258 | /** @} (end addtogroup TIMER) */ |
bogdanm | 0:9b334a45a8ff | 259 | /** @} (end addtogroup EM_Library) */ |
bogdanm | 0:9b334a45a8ff | 260 | #endif /* defined(TIMER_COUNT) && (TIMER_COUNT > 0) */ |