// 16bit code to handle system clocks.
//
-// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2008-2010 Kevin O'Connor <kevin@koconnor.net>
// Copyright (C) 2002 MandrakeSoft S.A.
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
u32 ticks = (hours * 60 + minutes) * 60 + seconds;
ticks = ((u64)ticks * PIT_TICK_RATE) / PIT_TICK_INTERVAL;
SET_BDA(timer_counter, ticks);
- SET_BDA(timer_rollover, 0);
- enable_hwirq(0, entry_08);
- enable_hwirq(8, entry_70);
+ enable_hwirq(0, FUNC16(entry_08));
+ enable_hwirq(8, FUNC16(entry_70));
}
{
return (GET_BDA(timer_counter) + count + 1) % TICKS_PER_DAY;
}
+
// Return the timer value that is 'msecs' time in the future.
u32
calc_future_timer(u32 msecs)
{
- u32 kticks = DIV_ROUND_UP((u64)(msecs * PIT_TICK_RATE), PIT_TICK_INTERVAL);
+ if (!msecs)
+ return GET_BDA(timer_counter);
+ u32 kticks = DIV_ROUND_UP((u64)msecs * PIT_TICK_RATE, PIT_TICK_INTERVAL);
u32 ticks = DIV_ROUND_UP(kticks, 1000);
return calc_future_timer_ticks(ticks);
}
+
// Check if the given timer value has passed.
int
check_timer(u32 end)