/* Initializes the TIMER Time base Unit according to the specified parameters in the timer_handle_t and create the associated handle.  */
ald_status_t ald_timer_base_init(ald_timer_handle_t *hperh)
/* Initializes the TIMER Time base Unit according to the specified parameters in the timer_handle_t and create the associated handle.  */
ald_status_t ald_timer_base_init(ald_timer_handle_t *hperh)
{
    if (hperh == NULL)
        return ALD_ERROR;
    assert_param(IS_TIMER_INSTANCE(hperh->perh));
    assert_param(IS_TIMER_COUNTER_MODE(hperh->init.mode));
    assert_param(IS_TIMER_CLOCK_DIVISION(hperh->init.clk_div));
    if (hperh->state == ALD_TIMER_STATE_RESET)
        hperh->lock = UNLOCK;
    hperh->state = ALD_TIMER_STATE_BUSY;
    timer_base_set_config(hperh->perh, &hperh->init);
    hperh->state = ALD_TIMER_STATE_READY;
    return ALD_OK;
}