clock.c (5722) | clock.c (7090) |
---|---|
1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz and Don Ahn. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 | 1/*- 2 * Copyright (c) 1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * William Jolitz and Don Ahn. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * from: @(#)clock.c 7.2 (Berkeley) 5/12/91 |
37 * $Id: clock.c,v 1.29 1994/12/30 12:43:34 bde Exp $ | 37 * $Id: clock.c,v 1.31 1995/01/19 22:05:27 ats Exp $ |
38 */ 39 40/* 41 * inittodr, settodr and support routines written 42 * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at> 43 * 44 * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94 45 */ --- 4 unchanged lines hidden (view full) --- 50#include <sys/param.h> 51#include <sys/systm.h> 52#include <sys/time.h> 53#include <sys/kernel.h> 54#include <machine/clock.h> 55#include <machine/frame.h> 56#include <i386/isa/icu.h> 57#include <i386/isa/isa.h> | 38 */ 39 40/* 41 * inittodr, settodr and support routines written 42 * by Christoph Robitschko <chmr@edvz.tu-graz.ac.at> 43 * 44 * reintroduced and updated by Chris Stenton <chris@gnome.co.uk> 8/10/94 45 */ --- 4 unchanged lines hidden (view full) --- 50#include <sys/param.h> 51#include <sys/systm.h> 52#include <sys/time.h> 53#include <sys/kernel.h> 54#include <machine/clock.h> 55#include <machine/frame.h> 56#include <i386/isa/icu.h> 57#include <i386/isa/isa.h> |
58#include <i386/isa/isa_device.h> |
|
58#include <i386/isa/rtc.h> 59#include <i386/isa/timerreg.h> 60 61/* 62 * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we 63 * can use a simple formula for leap years. 64 */ 65#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) --- 487 unchanged lines hidden (view full) --- 553cpu_initclocks() 554{ 555 int diag; 556 557 stathz = RTC_NOPROFRATE; 558 profhz = RTC_PROFRATE; 559 560 /* Finish initializing 8253 timer 0. */ | 59#include <i386/isa/rtc.h> 60#include <i386/isa/timerreg.h> 61 62/* 63 * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we 64 * can use a simple formula for leap years. 65 */ 66#define LEAPYEAR(y) ((u_int)(y) % 4 == 0) --- 487 unchanged lines hidden (view full) --- 554cpu_initclocks() 555{ 556 int diag; 557 558 stathz = RTC_NOPROFRATE; 559 profhz = RTC_PROFRATE; 560 561 /* Finish initializing 8253 timer 0. */ |
561 register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0, clkintr, 562 &clk_imask, /* unit */ 0); | 562 register_intr(/* irq */ 0, /* XXX id */ 0, /* flags */ 0, 563 /* XXX */ (inthand2_t *)clkintr, &clk_imask, 564 /* unit */ 0); |
563 INTREN(IRQ0); 564 565 /* Initialize RTC. */ 566 writertc(RTC_STATUSA, rtc_statusa); 567 writertc(RTC_STATUSB, RTCSB_24HR); 568 diag = rtcin(RTC_DIAG); 569 if (diag != 0) 570 printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); | 565 INTREN(IRQ0); 566 567 /* Initialize RTC. */ 568 writertc(RTC_STATUSA, rtc_statusa); 569 writertc(RTC_STATUSB, RTCSB_24HR); 570 diag = rtcin(RTC_DIAG); 571 if (diag != 0) 572 printf("RTC BIOS diagnostic error %b\n", diag, RTCDG_BITS); |
571 register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, rtcintr, 572 &stat_imask, /* unit */ 0); | 573 register_intr(/* irq */ 8, /* XXX id */ 1, /* flags */ 0, 574 /* XXX */ (inthand2_t *)rtcintr, &stat_imask, 575 /* unit */ 0); |
573 INTREN(IRQ8); 574 writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR); 575} 576 577void 578setstatclockrate(int newhz) 579{ 580 if (newhz == RTC_PROFRATE) 581 rtc_statusa = RTCSA_DIVIDER | RTCSA_PROF; 582 else 583 rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; 584 writertc(RTC_STATUSA, rtc_statusa); 585} | 576 INTREN(IRQ8); 577 writertc(RTC_STATUSB, RTCSB_24HR | RTCSB_PINTR); 578} 579 580void 581setstatclockrate(int newhz) 582{ 583 if (newhz == RTC_PROFRATE) 584 rtc_statusa = RTCSA_DIVIDER | RTCSA_PROF; 585 else 586 rtc_statusa = RTCSA_DIVIDER | RTCSA_NOPROF; 587 writertc(RTC_STATUSA, rtc_statusa); 588} |