[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["gzeljko" <gzeljko@sezampro.yu>] (fwd)
- To: rtl@rtlinux.org
- Subject: BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["gzeljko" <gzeljko@sezampro.yu>] (fwd)
- From: Der Herr Hofrat <der.herr@hofr.at>
- Date: Sat, 19 May 2001 19:27:11 +0200 (CEST)
>From owner-rtl Sat May 19 11:47:28 2001
Received: from mail1.sezampro.yu (mail1.sezampro.yu [194.106.188.3])
by hq.fsmlabs.com (8.11.2/8.11.2) with SMTP id f4JHlSr02532
for <rtl@fsmlabs.com>; Sat, 19 May 2001 11:47:28 -0600
Received: from gzeljko@b174.ppp-bg.sezampro.yu by SezamPro with SMTP on Sat, 19 May 2001 19:42:42 +0200
Message-ID: <001401c0e08b$070e5670$aebd6ac2@zko>
From: "gzeljko" <gzeljko@sezampro.yu>
To: <rtl@fsmlabs.com>
References: <OF92BE28D3.68C1072A-ON88256A45.00780215@aero.org> <3AFA954A.D4BE75E0@opersys.com>
Subject: Re: [rtl] do_gettimeofday().
Date: Sat, 19 May 2001 19:42:00 +0200
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
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);
}