git-svn-id: https://spexeah.com:8443/svn/Asuro@524 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron
2018-04-14 15:25:03 +00:00
parent 49a25c904f
commit 76754d34df
12 changed files with 119 additions and 4 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+108
View File
@@ -0,0 +1,108 @@
unit RTC;
interface
uses
console, isrmanager, util;
type
TDateTime = record
Seconds : uint8;
Minutes : uint8;
Hours : uint8;
Weekday : uint8;
Day : uint8;
Month : uint8;
Year : uint8;
Century : uint8;
end;
var
DateTime : TDateTime;
procedure init;
implementation
function is_update_in_progress : boolean;
var
bin : uint8;
begin
outb($70, $0A);
io_wait();
bin:= inb($71);
is_update_in_progress:= (bin AND ($1 SHL 7)) <> 0;
end;
procedure update();
begin
outb($70, $0C); // select register C
io_wait();
inb($71);
console.writestringln('RTC Update');
while not is_update_in_progress do begin
end;
while is_update_in_progress do begin
end;
outb($70, $00);
io_wait();
DateTime.Seconds:= inb($71);
io_wait();
outb($70, $02);
io_wait();
DateTime.Minutes:= inb($71);
io_wait();
outb($70, $04);
io_wait();
DateTime.Hours:= inb($71);
io_wait();
outb($70, $06);
io_wait();
DateTime.Weekday:= inb($71);
io_wait();
outb($70, $07);
io_wait();
DateTime.Day:= inb($71);
io_wait();
outb($70, $08);
io_wait();
DateTime.Month:= inb($71);
io_wait();
outb($70, $09);
io_wait();
DateTime.Year:= inb($71);
io_wait();
outb($70, $32);
io_wait();
DateTime.Century:= inb($71);
io_wait();
end;
procedure init;
var
prev : uint8;
begin
CLI;
//setup RTC
outb($70, $8A);
io_wait();
outb($71, $20);
io_wait();
//enable ints
outb($70, $8B);
io_wait();
prev:= inb($71);
io_wait();
outb($70, $8B);
io_wait();
outb($71, prev OR $40);
STI;
outb($70, $00);
isrmanager.registerISR(32 + 8, @update);
//TMR_0_ISR.hook(uint32(@update));
end;
end.
+8 -1
View File
@@ -43,7 +43,8 @@ uses
fat32,
isrmanager,
faults,
fonts;
fonts,
RTC;
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
@@ -230,6 +231,8 @@ begin
storagemanagement.init();
tracer.pop_trace;
//RTC.init();
{ Hook Timer for Ticks }
tracer.push_trace('kmain.TMR');
STI;
@@ -274,6 +277,10 @@ begin
console.writestringln('Press any key to boot in to Asuro Terminal...');
tracer.pop_trace;
writeint(DateTime.Hours);
writestring(':');
writeintln(DateTime.Minutes);
tracer.push_trace('kmain.KEYHOOK');
keyboard.hook(@temphook);
tracer.pop_trace;
+3 -3
View File
@@ -36,8 +36,8 @@ MULTIBOOT_HEADER_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEA
; Kernel stack size
;
KERNEL_STACKSIZE equ 0x4000
KERNEL_VIRTUAL_BASE equ 0xC0000000
KERNEL_PAGE_NUMBER equ (KERNEL_VIRTUAL_BASE >> 22)
KERNEL_VIRTUAL_BASE equ 0xC0000000
KERNEL_PAGE_NUMBER equ (KERNEL_VIRTUAL_BASE >> 22)
section .data
align 0x1000
@@ -90,7 +90,7 @@ _loader:
jmp ecx
kstart:
mov dword [BootPageDirectory], 0
mov dword [BootPageDirectory], 0
invlpg [0]
mov esp, KERNEL_STACK+KERNEL_STACKSIZE ;Create kernel stack
push eax ;Multiboot magic number