/* 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 != 0x00U);
    uint8_t clockCycles = 0;
    uint32_t tClk_ps;
    clkSrc_Hz /= 1000000U;
    tClk_ps = 1000000U / clkSrc_Hz;
    while (tClk_ps * clockCycles < time_ns * 1000U)
    {
        clockCycles++;
    }
    return (clockCycles == 0x00U) ? clockCycles : (clockCycles - 0x01U);
}