From owner-FreeBSD-users-jp@jp.FreeBSD.org Mon Jul 15 01:34:13 2002
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) id g6EGYDc12463;
	Mon, 15 Jul 2002 01:34:13 +0900 (JST)
	(envelope-from owner-FreeBSD-users-jp@jp.FreeBSD.org)
Received: from serio.al.rim.or.jp (serio.al.rim.or.jp [202.247.191.123])
	by castle.jp.FreeBSD.org (8.11.6+3.4W/8.11.3) with ESMTP/inet id g6EGY7n12283
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 15 Jul 2002 01:34:07 +0900 (JST)
	(envelope-from yoshiaki@kt.rim.or.jp)
Received: from mail1.rim.or.jp
	by serio.al.rim.or.jp (3.7W/HMX-13) id BAA17494
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 15 Jul 2002 01:34:07 +0900 (JST)
Received: from yoshiaki_kt.rim.or.jp (yoshiaki.st.rim.or.jp [202.247.140.34]) by mail1.rim.or.jp (3.7W)
	id BAA05949 for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 15 Jul 2002 01:34:06 +0900 (JST)
Received: from localhost (localhost [127.0.0.1])
	by yoshiaki_kt.rim.or.jp (8.12.5/8.12.2) with ESMTP id g6EGY2Y5001110
	for <FreeBSD-users-jp@jp.FreeBSD.org>; Mon, 15 Jul 2002 01:34:02 +0900 (JST)
	(envelope-from yoshiaki@kt.rim.or.jp)
Date: Mon, 15 Jul 2002 01:34:02 +0900 (JST)
Message-Id: <20020715.013402.74753087.yoshiaki@kt.rim.or.jp>
To: FreeBSD-users-jp@jp.FreeBSD.org
From: Yoshiaki Uchikawa <yoshiaki@kt.rim.or.jp>
In-Reply-To: <s7fheqdi2fh.fsf@xxx.kgc.co.jp>
References: <20011120.110327.41676493.ishizuka@ish.org>
	<20011120205754T.matusita@jp.FreeBSD.org>
	<s7fheqdi2fh.fsf@xxx.kgc.co.jp>
X-Mailer: Mew version 2.2 on Emacs 20.7 / Mule 4.0 (HANANOEN)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit
Reply-To: FreeBSD-users-jp@jp.FreeBSD.org
Precedence: list
X-Sequence: FreeBSD-users-jp 69884
Subject: [FreeBSD-users-jp 69884] Re: How to correct CMOS clock ?
Errors-To: owner-FreeBSD-users-jp@jp.FreeBSD.org
Sender: owner-FreeBSD-users-jp@jp.FreeBSD.org
X-Originator: yoshiaki@kt.rim.or.jp
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+020714

$B$&$A$+$o$G$9!#(B

>>>>> From: KANDA Toshihiro <candy@kgc.co.jp>
>>>>> Date: 27 Dec 2001 15:48:18 +0900

 > 
 > $B$3$l3NG'$7$?$$$N$G$9$,!"(B
 > CMOS clock $B$rFI$_=P$9J}K!$O$"$j$^$9$G$7$g$&$+(B?
 > 

$B$9!<$4$/@N$NOC$J$N$G62=L$G$9$,!"$?$^$?$^3NG'$9$kI,MW$,$G$-$?$N$G(B
$B$d$C$F$_$^$7$?!#(B
$BK\Mh$O%?%$%^3d$j9~$_$J$I$r6X;_$9$kI,MW$,$"$k$i$7$$$G$9$7!"$/$j>e$,$j(B
$B$NLdBj$,$"$k$N$G(B2$B2sFI$_=P$7$r9T$C$FLdBj$N$"$k%?%$%_%s%0$K$+$+$C$F$$$J(B
$B$$$3$H$r3NG'$9$kI,MW$O$"$j$^$9$,!"4JC1$J3NG'DxEY$NL\E*$J$i$3$l$G$b(B
$B$$$$$G$7$g$&!#(Broot$B$G<B9T$9$kI,MW$,$"$j$^$9!#(B
-----------------
#include <stdio.h>

#include <unistd.h>
#include <machine/sysarch.h>
#include <machine/cpufunc.h>
#define RTC_ADDR (0x70)
#define RTC_DATA (0x71)
#define ENABLE   (1)

#define RTC_SEC_REG     (0x0)
#define RTC_MIN_REG     (0x2)
#define RTC_TIME_REG    (0x4)

main()
{
    int enable;
    int len;
    unsigned int sec,min,time;

    if (i386_get_ioperm(RTC_ADDR, &len, &enable) < 0){
        printf("i386_get_ioperm Error\n");
    }
    printf ("enable = %d : %d\n",enable,len);
    len = 2;
    if (i386_set_ioperm(RTC_ADDR, len, ENABLE) < 0){
        printf("i386_set_ioperm Error\n");
        exit(1);
    }
    if (i386_get_ioperm(RTC_ADDR, &len, &enable) < 0){
        printf("i386_get_ioperm Error\n");
    }
    printf ("enable = %d : %d\n",enable,len);
    outb(RTC_ADDR,RTC_SEC_REG);
    sec = inb(RTC_DATA);
    outb(RTC_ADDR,RTC_MIN_REG);
    min = inb(RTC_DATA);
    outb(RTC_ADDR,RTC_TIME_REG);
    time = inb(RTC_DATA);
    printf("%02d:%02d:%02d\n", time, min, sec);
}
-----------------
-- 
  yoshiaki@kt.rim.or.jp
 ($B$&(B)  
