/* Setup the systick timer to generate the tick interrupts at the required frequency.  */
static void start_sys_timer(void)
/* Setup the systick timer to generate the tick interrupts at the required frequency.  */
static void start_sys_timer(void)
{
    struct itimerval itimer, oitimer;
    int us;
    us = 1000000 / RT_TICK_PER_SECOND - 1;
    TRACE("start system tick!\n");
    if (0 != getitimer(TIMER_TYPE, &itimer))
    {
        TRACE("get timer failed.\n");
        exit(EXIT_FAILURE);
    }
    itimer.it_interval.tv_sec = 0;
    itimer.it_interval.tv_usec = us;
    itimer.it_value.tv_sec = 0;
    itimer.it_value.tv_usec = us;
    if (0 != setitimer(TIMER_TYPE, &itimer, &oitimer))
    {
        TRACE("set timer failed.\n");
        exit(EXIT_FAILURE);
    }
}