/* Get the clock cycles of EMC clock. The function is used to calculate the multiple of the 16 EMCCLKs between the timer_Ns period.  */
static uint32_t EMC_CalculateTimerCycles(EMC_Type *base, uint32_t timer_Ns, uint32_t plus)
/* Get the clock cycles of EMC clock. The function is used to calculate the multiple of the 16 EMCCLKs between the timer_Ns period.  */
static uint32_t EMC_CalculateTimerCycles(EMC_Type *base, uint32_t timer_Ns, uint32_t plus)
{
    uint32_t cycles;
    cycles = CLOCK_GetFreq(kCLOCK_EMC) / EMC_HZ_ONEMHZ * timer_Ns;
    cycles = EMC_DIV_ROUND_UP(cycles, EMC_MILLISECS_ONESEC);
    if (cycles >= plus)
    {
        cycles = cycles - plus;
    }
    else
    {
        cycles = 0;
    }
    return cycles;
}