Platform/ECM3532/M3/hw/hal/common/timer/src/timer_hal.c
/**
 * hal timer init
 *
 * Initialize platform specific timer items
 *
 * @param iTmrChan HW timer comparator channel
 *
 * @return 0 on success; error code otherwise
 */
hal timer init
Initialize platform specific timer items

@param iTmrChan HW timer comparator channel

@return 0 on success; error code otherwise
hal timer init Initialize platform specific timer items @param iTmrChan HW timer comparator channel @return 0 on success ; error code otherwise
__attribute__((section(".initSection")))int32_t HalTmrChInit(tHalTmrCh iTmrChan)
{
    struct sDevTmr *sDev;
    static uint8_t ui8TmrHwInit;
    if (!ui8TmrHwInit)
    {
        EtaCspTimerInitMs();
        ui8TmrHwInit = 1;
    }
    sDev = TmrGetDev(iTmrChan);
    if (sDev == NULL)
    {
        return -EINVAL;
    }
    if (!ui8TmrIrqInit[sDev->iIrqIdx])
    {
        NVIC_DisableIRQ(TIMER0_IRQn + sDev->iIrqIdx);
        NVIC_ClearPendingIRQ(TIMER0_IRQn + sDev->iIrqIdx);
        NVIC_SetPriority(TIMER0_IRQn + sDev->iIrqIdx,
                            (1 << __NVIC_PRIO_BITS) - 1);
        NVIC_EnableIRQ(TIMER0_IRQn + sDev->iIrqIdx);
        ui8TmrIrqInit[sDev->iIrqIdx]++;
    }
    EtaCspTimerIntEnableClear(sDev->iIrqIdx, sDev->iChanIdx);
    return 0;
}
__attribute__ ( ( section ( " " ) ) ) int32_t HalTmrChInit ( tHalTmrCh iTmrChan ) { struct sDevTmr * sDev ; static uint8_t ui8TmrHwInit ; if ( ! ui8TmrHwInit ) { EtaCspTimerInitMs ( ) ; ui8TmrHwInit = 1 ; } sDev = TmrGetDev ( iTmrChan ) ; if ( sDev == NULL ) { return - EINVAL ; } if ( ! ui8TmrIrqInit [ sDev -> iIrqIdx ] ) { NVIC_DisableIRQ ( TIMER0_IRQn + sDev -> iIrqIdx ) ; NVIC_ClearPendingIRQ ( TIMER0_IRQn + sDev -> iIrqIdx ) ; NVIC_SetPriority ( TIMER0_IRQn + sDev -> iIrqIdx , ( 1 << __NVIC_PRIO_BITS ) - 1 ) ; NVIC_EnableIRQ ( TIMER0_IRQn + sDev -> iIrqIdx ) ; ui8TmrIrqInit [ sDev -> iIrqIdx ] ++ ; } EtaCspTimerIntEnableClear ( sDev -> iIrqIdx , sDev -> iChanIdx ) ; return 0 ; }
hal timer init
 Initialize platform specific timer items
hal timer init Initialize platform specific timer items