/* Covert the external timing nanosecond to internal clock cycle.  */
static uint8_t SEMC_ConvertTiming(uint32_t time_ns, uint32_t clkSrc_Hz)
/* Covert the external timing nanosecond to internal clock cycle.  */
static uint8_t SEMC_ConvertTiming(uint32_t time_ns, uint32_t clkSrc_Hz)
{
    assert(clkSrc_Hz);
    uint8_t clockCycles = 0;
    uint32_t tClk_us;
    clkSrc_Hz /= 1000000;
    tClk_us = 1000000 / clkSrc_Hz;
    while (tClk_us * clockCycles < (time_ns * 1000))
    {
        clockCycles++;
    }
    return clockCycles;
}