diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-07-05 15:41:36 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-07-05 15:41:36 -0700 |
commit | 4a770eb97fc40ec8d9f394337614ac3c2074ee01 (patch) | |
tree | 975f52729eeb9b119c624308d454b214abec91f5 /core/timer.inc | |
parent | 7072cf57e5f43449223c1fe75aebcbf82659e515 (diff) | |
download | syslinux-4a770eb97fc40ec8d9f394337614ac3c2074ee01.tar.gz |
core: add a ms-denominated timer
Add a timer denominated in milliseconds. This is still driven by the
18.2 Hz timer interrupt, but counts "real" milliseconds, including
handing the adjustment factor (which in reality means it advances by
55 for most timer ticks and 54 for some.)
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/timer.inc')
-rw-r--r-- | core/timer.inc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/core/timer.inc b/core/timer.inc index 728812b1..b01ff917 100644 --- a/core/timer.inc +++ b/core/timer.inc @@ -19,6 +19,9 @@ ;; about the BIOS_timer variable wrapping around at "midnight" and other ;; weird things. ;; +;; This also maintains a timer variable calibrated in milliseconds +;; (wraparound time = 49.7 days!) +;; section .text16 @@ -35,12 +38,20 @@ timer_cleanup: mov [BIOS_timer_hook],eax ret +; +; The specified frequency is 14.31818 MHz/12/65536; this turns out +; to be a period of 54.92542 ms, or 0x36.ece8(187c) hexadecimal. +; timer_irq: inc dword [cs:__jiffies] + add word [cs:__ms_timer_adj],0xece8 + adc dword [cs:__ms_timer],0x36 jmp 0:0 BIOS_timer_next equ $-4 section .data16 alignz 4 - global __jiffies -__jiffies dd 0 ; The actual timer variable + global __jiffies, __ms_timer +__jiffies dd 0 ; Clock tick timer +__ms_timer dd 0 ; Millisecond timer +__ms_timer_adj dw 0 ; Millisecond timer correction factor |