Deleted Added
full compact
atrtc.c (34617) atrtc.c (34961)
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.116 1998/03/14 03:11:50 tegge Exp $
37 * $Id: clock.c,v 1.117 1998/03/16 10:06:58 phk Exp $
38 */
39
40/*
41 * Routines to handle clock hardware.
42 */
43
44/*
45 * inittodr, settodr and support routines written

--- 186 unchanged lines hidden (view full) ---

232 timer_func = new_function;
233 timer0_state = ACQUIRED;
234 break;
235
236 case RELEASE_PENDING:
237 if ((timer0_prescaler_count += timer0_max_count)
238 >= hardclock_max_count) {
239 timer0_prescaler_count -= hardclock_max_count;
38 */
39
40/*
41 * Routines to handle clock hardware.
42 */
43
44/*
45 * inittodr, settodr and support routines written

--- 186 unchanged lines hidden (view full) ---

232 timer_func = new_function;
233 timer0_state = ACQUIRED;
234 break;
235
236 case RELEASE_PENDING:
237 if ((timer0_prescaler_count += timer0_max_count)
238 >= hardclock_max_count) {
239 timer0_prescaler_count -= hardclock_max_count;
240#ifdef FIXME
240 /*
241 /*
242 * XXX: This magic doesn't work, but It shouldn't be
243 * needed now anyway since we will not be able to
244 * aquire the i8254 if it is used for timecounting.
245 */
246 /*
241 * See microtime.s for this magic.
242 */
243 time.tv_usec += (27465 * timer0_prescaler_count) >> 15;
244 if (time.tv_usec >= 1000000)
245 time.tv_usec -= 1000000;
247 * See microtime.s for this magic.
248 */
249 time.tv_usec += (27465 * timer0_prescaler_count) >> 15;
250 if (time.tv_usec >= 1000000)
251 time.tv_usec -= 1000000;
252#endif
246 hardclock(&frame);
247 setdelayed();
248 timer0_max_count = hardclock_max_count;
249 disable_intr();
250 outb(TIMER_MODE,
251 TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
252 outb(TIMER_CNTR0, timer0_max_count & 0xff);
253 outb(TIMER_CNTR0, timer0_max_count >> 8);

--- 585 unchanged lines hidden (view full) ---

839 readrtc(RTC_HRS)) * 60 +
840 readrtc(RTC_MIN)) * 60 +
841 readrtc(RTC_SEC));
842 /* sec now contains the number of seconds, since Jan 1 1970,
843 in the local time zone */
844
845 sec += tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
846
253 hardclock(&frame);
254 setdelayed();
255 timer0_max_count = hardclock_max_count;
256 disable_intr();
257 outb(TIMER_MODE,
258 TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
259 outb(TIMER_CNTR0, timer0_max_count & 0xff);
260 outb(TIMER_CNTR0, timer0_max_count >> 8);

--- 585 unchanged lines hidden (view full) ---

846 readrtc(RTC_HRS)) * 60 +
847 readrtc(RTC_MIN)) * 60 +
848 readrtc(RTC_SEC));
849 /* sec now contains the number of seconds, since Jan 1 1970,
850 in the local time zone */
851
852 sec += tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);
853
847 y = time.tv_sec - sec;
854 y = time_second - sec;
848 if (y <= -2 || y >= 2) {
849 /* badly off, adjust it */
850 s = splclock();
851 ts.tv_sec = sec;
852 ts.tv_nsec = 0;
853 set_timecounter(&ts);
854 splx(s);
855 }

--- 12 unchanged lines hidden (view full) ---

868{
869 unsigned long tm;
870 int y, m, s;
871
872 if (disable_rtc_set)
873 return;
874
875 s = splclock();
855 if (y <= -2 || y >= 2) {
856 /* badly off, adjust it */
857 s = splclock();
858 ts.tv_sec = sec;
859 ts.tv_nsec = 0;
860 set_timecounter(&ts);
861 splx(s);
862 }

--- 12 unchanged lines hidden (view full) ---

875{
876 unsigned long tm;
877 int y, m, s;
878
879 if (disable_rtc_set)
880 return;
881
882 s = splclock();
876 tm = time.tv_sec;
883 tm = time_second;
877 splx(s);
878
879 /* Disable RTC updates and interrupts. */
880 writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
881
882 /* Calculate local time to put in RTC */
883
884 tm -= tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);

--- 284 unchanged lines hidden ---
884 splx(s);
885
886 /* Disable RTC updates and interrupts. */
887 writertc(RTC_STATUSB, RTCSB_HALT | RTCSB_24HR);
888
889 /* Calculate local time to put in RTC */
890
891 tm -= tz.tz_minuteswest * 60 + (wall_cmos_clock ? adjkerntz : 0);

--- 284 unchanged lines hidden ---