Hello,
I'm just testing RTLinux (and hardware).
Motivated with this thread I write small test program (appended)
for uniprocessor pentium machine to know what we are talking about.
On my test machine (K6/200) it givs stable (2-3 ppm) drift cca. 160 ppm.
gzeljko
// module for testing pentium time drift
#include <linux/mc146818rtc.h>
#include <rtl.h>
#include <rtl_sched.h>
#include <time.h>
#include <pthread.h>
pthread_t print_thread_id;
char save_cmos_B;
hrtime_t htime1, htime2;
unsigned int RTC_UI_handler(unsigned int irq, struct pt_regs *regs) {
htime2 = gethrtime();
(void) CMOS_READ(RTC_REG_C);
rtl_hard_enable_irq (8);
pthread_wakeup_np(print_thread_id);
return 0;
}
void* print_thread(void* arg){
rtl_printf("test started\n");
pthread_suspend_np(pthread_self());
htime1 = htime2;
while (1) {
pthread_suspend_np(pthread_self());
rtl_printf("%10d\n",htime2 - htime1 - 1000000000L);
htime1 = htime2;
}
}
int init_module(void){
char ctemp;
if (!I8253_channel2_free()) {
conpr("can't use cmos, test interrupted\n");
return -1;
}
save_cmos_B = CMOS_READ(RTC_REG_B);
ctemp = CMOS_READ(RTC_REG_B);
ctemp &= 0x8f;
ctemp |= RTC_UIE;
CMOS_WRITE(ctemp, RTC_REG_B);
pthread_create (&print_thread_id, NULL, print_thread, 0);
rtl_request_irq(8, RTC_UI_handler);
(void) CMOS_READ(RTC_REG_C);
rtl_hard_enable_irq (8);
return 0;
}
void cleanup_module(void){
rtl_free_irq(8);
CMOS_WRITE(save_cmos_B, RTC_REG_B);
pthread_delete_np (print_thread_id);
}
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/