Mail Archives: djgpp/2003/10/13/10:16:30
How can I speed up the timer so that my signal handler (on SIGALRM) is
called more often than the default 18.2Hz?
I have tried to reprogram the 8254 PIT, but that doesn't do anything.
Here is my code:
/* timer struct */
struct itimerval timeout;
void tickSignal()
{
counter++;
}
/* set tick interrupt to 200Hz */
outportb(0x43, 0x36);
outportb(0x40, ((1193180L / 200) & 0x00ff));
outportb(0x40, (((1193180L / 200) >> 8) & 0x00ff));
/* Initialise timer structure */
timeout.it_interval.tv_sec = 0;
timeout.it_interval.tv_usec = 5000;
timeout.it_value.tv_sec = 0;
timeout.it_value.tv_usec = 5000;
__djgpp_clock_tick_interval = 5000;
signal(SIGALRM, tickSignal);
setitimer(ITIMER_REAL, &timeout, NULL);
Thanks
Arne
- Raw text -