/ * @brief * Reset TIMER to same state as after a HW reset. * * @note * The ROUTE register is NOT reset by this function, in order to allow for * centralized setup of this feature. * * @param[in] timer * Pointer to TIMER peripheral register block. ******************************************************************************/
| 240 | * Pointer to TIMER peripheral register block. |
| 241 | ******************************************************************************/ |
| 242 | void TIMER_Reset(TIMER_TypeDef *timer) |
| 243 | { |
| 244 | int i; |
| 245 | |
| 246 | EFM_ASSERT(TIMER_REF_VALID(timer)); |
| 247 | |
| 248 | /* Make sure disabled first, before resetting other registers */ |
| 249 | timer->CMD = TIMER_CMD_STOP; |
| 250 | |
| 251 | timer->CTRL = _TIMER_CTRL_RESETVALUE; |
| 252 | timer->IEN = _TIMER_IEN_RESETVALUE; |
| 253 | timer->IFC = _TIMER_IFC_MASK; |
| 254 | timer->TOP = _TIMER_TOP_RESETVALUE; |
| 255 | timer->TOPB = _TIMER_TOPB_RESETVALUE; |
| 256 | timer->CNT = _TIMER_CNT_RESETVALUE; |
| 257 | /* Do not reset route register, setting should be done independently */ |
| 258 | /* (Note: ROUTE register may be locked by DTLOCK register.) */ |
| 259 | |
| 260 | for (i = 0; TIMER_CH_VALID(i); i++) |
| 261 | { |
| 262 | timer->CC[i].CTRL = _TIMER_CC_CTRL_RESETVALUE; |
| 263 | timer->CC[i].CCV = _TIMER_CC_CCV_RESETVALUE; |
| 264 | timer->CC[i].CCVB = _TIMER_CC_CCVB_RESETVALUE; |
| 265 | } |
| 266 | |
| 267 | /* Reset dead time insertion module, no effect on timers without DTI */ |
| 268 | |
| 269 | #ifdef TIMER_DTLOCK_LOCKKEY_UNLOCK |
| 270 | /* Unlock DTI registers first in case locked */ |
| 271 | timer->DTLOCK = TIMER_DTLOCK_LOCKKEY_UNLOCK; |
| 272 | |
| 273 | timer->DTCTRL = _TIMER_DTCTRL_RESETVALUE; |
| 274 | timer->DTTIME = _TIMER_DTTIME_RESETVALUE; |
| 275 | timer->DTFC = _TIMER_DTFC_RESETVALUE; |
| 276 | timer->DTOGEN = _TIMER_DTOGEN_RESETVALUE; |
| 277 | timer->DTFAULTC = _TIMER_DTFAULTC_MASK; |
| 278 | #endif |
| 279 | } |
| 280 | |
| 281 | |
| 282 | #ifdef TIMER_DTLOCK_LOCKKEY_UNLOCK |
no outgoing calls
no test coverage detected