/** * Delete the timer object. * * Authorized execution levels: task, fiber, ISR * * @param tmr : handler on the timer (value returned by timer_create ). * @param err (out): execution status: * E_OS_OK : timer is stopped and callback is disabled * E_OS_ERR: tmr parameter is null, invalid, or timer running */ void timer_delete(T_TIMER tmr, OS_ERR_TYPE* err) { T_TIMER_LIST_ELT* timer = (T_TIMER_LIST_ELT*) tmr; OS_ERR_TYPE localErr = E_OS_OK; if (NULL != timer) { /* check if timer is running and stop it */ if (timer->desc.status == E_TIMER_RUNNING) { timer_stop(timer, err); } #ifdef __DEBUG_OS_ABSTRACTION_TIMER _log ("\nINFO : timer_delete : deleting timer at addr = 0x%x", (uint32) timer); #endif /* free the timer */ g_TimerPool_free(timer); } else { /* tmr is not a timer from g_TimerPool_elements */ localErr = E_OS_ERR; } error_management (err, localErr); }
/** * Delete the timer object. * * Authorized execution levels: task, fiber, ISR * * @param tmr : handler on the timer (value returned by timer_create ). * */ void timer_delete(T_TIMER tmr) { T_TIMER_LIST_ELT *timer = (T_TIMER_LIST_ELT *)tmr; if (NULL != timer) { /* check if timer is running and stop it */ int flags = irq_lock(); if (timer->desc.status == E_TIMER_RUNNING) { timer_stop(timer); } irq_unlock(flags); #ifdef __DEBUG_OS_ABSTRACTION_TIMER _log("\nINFO : timer_delete : deleting timer at addr = 0x%x", (uint32)timer); #endif /* free the timer */ g_TimerPool_free(timer); } else { /* tmr is not a timer from g_TimerPool_elements */ panic(E_OS_ERR); } }