/* This function will detach a timer from timer management.  */
rt_err_t rt_timer_detach(rt_timer_t timer)
/* This function will detach a timer from timer management.  */
rt_err_t rt_timer_detach(rt_timer_t timer)
{
    register rt_base_t level;
    RT_ASSERT(timer != RT_NULL);
    RT_ASSERT(rt_object_get_type(&timer->parent) == RT_Object_Class_Timer);
    RT_ASSERT(rt_object_is_systemobject(&timer->parent));
    level = rt_hw_interrupt_disable();
    _rt_timer_remove(timer);
    timer->parent.flag &= ~RT_TIMER_FLAG_ACTIVATED;
    rt_hw_interrupt_enable(level);
    rt_object_detach(&(timer->parent));
    return RT_EOK;
}