Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
431e5bc8f4 | ||
|
|
983d9a428d |
No files matched your search
@@ -1,52 +0,0 @@
|
|||||||
{
|
|
||||||
Driver->Timer->GraphicsRefresh - Timer-driven graphics refresh at ~120FPS.
|
|
||||||
|
|
||||||
Hooks into the 1024Hz timer (TMR_0_ISR) and calls the desktop, uidebug,
|
|
||||||
LVGL and video flush routines every ~9 ticks (1024/9 ≈ 113.8 FPS).
|
|
||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
|
||||||
}
|
|
||||||
unit graphicsrefresh;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
procedure init;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
uses
|
|
||||||
util,
|
|
||||||
TMR_0_ISR,
|
|
||||||
desktop,
|
|
||||||
uidebug,
|
|
||||||
lvgl,
|
|
||||||
video,
|
|
||||||
syslog;
|
|
||||||
|
|
||||||
const
|
|
||||||
{ 1024 / 4 ≈ 256 FPS }
|
|
||||||
TICKS_PER_FRAME = 4;
|
|
||||||
|
|
||||||
var
|
|
||||||
TickCounter : uint32;
|
|
||||||
|
|
||||||
procedure on_tick(data : void);
|
|
||||||
begin
|
|
||||||
TickCounter := TickCounter + 1;
|
|
||||||
if TickCounter >= TICKS_PER_FRAME then begin
|
|
||||||
TickCounter := 0;
|
|
||||||
desktop.update;
|
|
||||||
uidebug.update;
|
|
||||||
lvgl_handler;
|
|
||||||
video.Flush;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure init;
|
|
||||||
begin
|
|
||||||
TickCounter := 0;
|
|
||||||
TMR_0_ISR.hook(uint32(@on_tick));
|
|
||||||
syslog.logln('GFXREFRESH', 'Hooked into 1024Hz timer (~120 FPS).');
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
{
|
|
||||||
Driver->Timer->USBHotplug - Timer-driven USB hotplug polling at ~1Hz.
|
|
||||||
|
|
||||||
Hooks into the 1024Hz timer (TMR_0_ISR) and calls
|
|
||||||
usbcore.usb_check_hotplug every 1024 ticks (approximately once per second).
|
|
||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
|
||||||
}
|
|
||||||
unit usbhotplug;
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
procedure init;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
uses
|
|
||||||
util,
|
|
||||||
TMR_0_ISR,
|
|
||||||
usbcore,
|
|
||||||
syslog;
|
|
||||||
|
|
||||||
const
|
|
||||||
{ 1024 ticks at 1024Hz ≈ 1 second }
|
|
||||||
TICKS_PER_POLL = 1024;
|
|
||||||
|
|
||||||
var
|
|
||||||
TickCounter : uint32;
|
|
||||||
|
|
||||||
procedure on_tick(data : void);
|
|
||||||
begin
|
|
||||||
TickCounter := TickCounter + 1;
|
|
||||||
if TickCounter >= TICKS_PER_POLL then begin
|
|
||||||
TickCounter := 0;
|
|
||||||
usbcore.usb_check_hotplug;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure init;
|
|
||||||
begin
|
|
||||||
TickCounter := 0;
|
|
||||||
TMR_0_ISR.hook(uint32(@on_tick));
|
|
||||||
syslog.logln('USBHOTPLUG', 'Hooked into 1024Hz timer (~1Hz polling).');
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
|
||||||
+24
-17
@@ -66,8 +66,7 @@ uses
|
|||||||
rand,
|
rand,
|
||||||
hashmap, vfs,
|
hashmap, vfs,
|
||||||
video, vesa, doublebuffer, color, lvgl, desktop, uidebug,
|
video, vesa, doublebuffer, color, lvgl, desktop, uidebug,
|
||||||
vterminal,
|
vterminal;
|
||||||
graphicsrefresh, usbhotplug;
|
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||||
|
|
||||||
@@ -104,14 +103,18 @@ begin
|
|||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure yield();
|
procedure myUserLandFunction;
|
||||||
|
var
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
asm
|
i:=0;
|
||||||
sti
|
while true do begin
|
||||||
@idle:
|
i:=i+1;
|
||||||
hlt
|
asm
|
||||||
jmp @idle
|
MOV EAX, i
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
|
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain'];
|
||||||
@@ -129,7 +132,6 @@ begin
|
|||||||
|
|
||||||
{ Syslog Init — right after serial so log hooks work }
|
{ Syslog Init — right after serial so log hooks work }
|
||||||
syslog.init();
|
syslog.init();
|
||||||
syslog.writestringln('Booting Asuro...');
|
|
||||||
|
|
||||||
{ Store Multiboot info }
|
{ Store Multiboot info }
|
||||||
multibootinfo:= mbinfo;
|
multibootinfo:= mbinfo;
|
||||||
@@ -138,8 +140,10 @@ begin
|
|||||||
{ Ensure tracer is frozen }
|
{ Ensure tracer is frozen }
|
||||||
tracer.freeze();
|
tracer.freeze();
|
||||||
|
|
||||||
{ Check for Multiboot }
|
syslog.writestringln('Booting Asuro...');
|
||||||
|
|
||||||
syslog.writestringln('Checking for Multiboot Compliance');
|
syslog.writestringln('Checking for Multiboot Compliance');
|
||||||
|
{ Check for Multiboot }
|
||||||
if (multibootmagic <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
if (multibootmagic <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
||||||
syslog.logln('KERNEL', 'Multiboot Compliant Boot-Loader Needed!');
|
syslog.logln('KERNEL', 'Multiboot Compliant Boot-Loader Needed!');
|
||||||
syslog.logln('KERNEL', 'HALTING.');
|
syslog.logln('KERNEL', 'HALTING.');
|
||||||
@@ -272,13 +276,16 @@ begin
|
|||||||
usb_keyboard.UnitTest;
|
usb_keyboard.UnitTest;
|
||||||
usb_mouse.UnitTest;
|
usb_mouse.UnitTest;
|
||||||
|
|
||||||
{ Register timer-driven tasks }
|
{ Main render loop — USB completions are now interrupt-driven }
|
||||||
graphicsrefresh.init;
|
syslog.logln('KERNEL', 'Entering main render loop.');
|
||||||
usbhotplug.init;
|
while true do begin
|
||||||
|
desktop.update;
|
||||||
|
uidebug.update;
|
||||||
|
lvgl_handler;
|
||||||
|
usbcore.usb_check_hotplug;
|
||||||
|
video.Flush();
|
||||||
|
end;
|
||||||
|
|
||||||
{ All work is now driven by timer interrupts — idle the CPU }
|
|
||||||
syslog.logln('KERNEL', 'All tasks registered. Halting into idle.');
|
|
||||||
kernel.yield();
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
Reference in new issue
Block a user