this is the code i want to excute every 5 msec with signal
but the gdb can't running it a give me an error
please help me
void timer_handler (int signum)
{
RxHdlcPkt();
}
void HardInitTimer(void)
{
struct sigaction sa;
struct itimerval timer;
/* Install timer_handler as the signal handler for SIGVTALRM. */
memset (&sa, 0, sizeof (sa));
sa.sa_handler = &timer_handler;
sigaction (SIGALRM, &sa, NULL);
/* Configure the timer to expire after 1 sec... */
timer.it_value.tv_sec = 0;
timer.it_value.tv_usec = 5000;
/* ... and every 5 msec after that. */
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = 5000;
/* Start a real timer. It counts down whenever this process is
executing. */
setitimer (ITIMER_REAL, &timer, NULL);
}
void InitOS(void)
{
HardInitTimer();
}
|