diff --git a/Asuro.iso b/Asuro.iso index 3e9a970c..53cf45c6 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index 2ce9b2bf..c966f5c5 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index 2ce9b2bf..c966f5c5 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/EHCI.ppu b/lib/EHCI.ppu new file mode 100644 index 00000000..c1f1a29d Binary files /dev/null and b/lib/EHCI.ppu differ diff --git a/lib/OHCI.ppu b/lib/OHCI.ppu new file mode 100644 index 00000000..e654cfe5 Binary files /dev/null and b/lib/OHCI.ppu differ diff --git a/lib/UHCI.ppu b/lib/UHCI.ppu new file mode 100644 index 00000000..0cb03cca Binary files /dev/null and b/lib/UHCI.ppu differ diff --git a/lib/USB.ppu b/lib/USB.ppu index d8ba240b..3c44a501 100644 Binary files a/lib/USB.ppu and b/lib/USB.ppu differ diff --git a/lib/asuro.ppu b/lib/asuro.ppu index 30a033f2..6266556b 100644 Binary files a/lib/asuro.ppu and b/lib/asuro.ppu differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index 6c474e9d..eed39bad 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index 63545f01..843272de 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index d11317ac..a78aa690 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index ce00401e..c9002045 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/shell.ppu b/lib/shell.ppu index 2b90ada8..221b795b 100644 Binary files a/lib/shell.ppu and b/lib/shell.ppu differ diff --git a/lib/terminal.ppu b/lib/terminal.ppu index f77d0afe..9c375a6e 100644 Binary files a/lib/terminal.ppu and b/lib/terminal.ppu differ diff --git a/lib/themer.ppu b/lib/themer.ppu new file mode 100644 index 00000000..c00a6e76 Binary files /dev/null and b/lib/themer.ppu differ diff --git a/src/driver/bus/EHCI.pas b/src/driver/bus/EHCI.pas new file mode 100644 index 00000000..70a2b3a1 --- /dev/null +++ b/src/driver/bus/EHCI.pas @@ -0,0 +1,45 @@ +unit EHCI; + +interface + +uses + tracer, + Console, + PCI, + drivertypes, + pmemorymanager, + vmemorymanager, + util, + drivermanagement; + +function load : boolean; + +implementation + +function load : boolean; +var + devices : TDeviceArray; + count : uint32; + i : uint32; + +begin + devices:= PCI.getDeviceInfo($0C, $03, $20, count); + console.output('USB-EHCI Driver', 'Found '); + console.writeint(count); + console.writestringln(' USB Controller(s).'); + if count > 0 then begin + for i:=0 to count-1 do begin + console.output('USB-OHCI Driver', 'Controller['); + console.writeint(i); + console.writestring(']: '); + console.writehex(devices[i].device_id); + console.writestring(' '); + console.writehex(devices[i].vendor_id); + console.writestring(' '); + console.writehexln(devices[i].prog_if); + end; + end; + load:= true; +end; + +end. \ No newline at end of file diff --git a/src/driver/bus/OHCI.pas b/src/driver/bus/OHCI.pas new file mode 100644 index 00000000..22e2b758 --- /dev/null +++ b/src/driver/bus/OHCI.pas @@ -0,0 +1,76 @@ +unit OHCI; + +interface + +uses + tracer, + Console, + PCI, + drivertypes, + pmemorymanager, + vmemorymanager, + util, + drivermanagement; + +type + POHCI_MMR = ^TOHCI_MMR; + TOHCI_MMR = packed record + HcRevision : uint32; + HcControl : uint32; + HcCommandStatus : uint32; + HcIntStatus : uint32; + HcIntEnable : uint32; + HcIntDisable : uint32; + HcHCCA : uint32; + HcPeriodCurrentED : uint32; + HcControlHeadED : uint32; + HcControlCurrentED : uint32; + HcBulkHeadED : uint32; + HcBulkCurrentED : uint32; + HcDoneHead : uint32; + HcFmRemaining : uint32; + HcFmNumber : uint32; + HcPeriodicStart : uint32; + HcLSThreshold : uint32; + HcRhDescriptorA : uint32; + HcRhDescriptorB : uint32; + HcRhStatus : uint32; + end; + +function load : boolean; + +implementation + +function load : boolean; +var + devices : TDeviceArray; + count : uint32; + i : uint32; + block : uint32; + MMR : POHCI_MMR; + +begin + devices:= PCI.getDeviceInfo($0C, $03, $10, count); + console.output('USB-OHCI Driver', 'Found '); + console.writeint(count); + console.writestringln(' USB Controller(s).'); + if count > 0 then begin + for i:=0 to count-1 do begin + console.output('USB-OHCI Driver', 'Controller['); + console.writeint(i); + console.writestring(']: '); + console.writehex(devices[i].device_id); + console.writestring(' '); + console.writehex(devices[i].vendor_id); + console.writestring(' '); + console.writehexln(devices[i].prog_if); + block:= devices[i].address0 SHR 22; + force_alloc_block(block, 0); + map_page(block, block); + MMR:= POHCI_MMR(devices[i].address0); + end; + end; + load:= true; +end; + +end. \ No newline at end of file diff --git a/src/driver/bus/UHCI.pas b/src/driver/bus/UHCI.pas new file mode 100644 index 00000000..b5d97941 --- /dev/null +++ b/src/driver/bus/UHCI.pas @@ -0,0 +1,45 @@ +unit UHCI; + +interface + +uses + tracer, + Console, + PCI, + drivertypes, + pmemorymanager, + vmemorymanager, + util, + drivermanagement; + +function load : boolean; + +implementation + +function load : boolean; +var + devices : TDeviceArray; + count : uint32; + i : uint32; + +begin + devices:= PCI.getDeviceInfo($0C, $03, $00, count); + console.output('USB-UHCI Driver','Found '); + console.writeint(count); + console.writestringln(' USB Controller(s).'); + if count > 0 then begin + for i:=0 to count-1 do begin + console.output('USB-UHCI Driver','Controller['); + console.writeint(i); + console.writestring(']: '); + console.writehex(devices[i].device_id); + console.writestring(' '); + console.writehex(devices[i].vendor_id); + console.writestring(' '); + console.writehexln(devices[i].prog_if); + end; + end; + load:= true; +end; + +end. \ No newline at end of file diff --git a/src/driver/bus/USB.pas b/src/driver/bus/USB.pas index d586fffd..3eaffc66 100644 --- a/src/driver/bus/USB.pas +++ b/src/driver/bus/USB.pas @@ -10,102 +10,34 @@ uses pmemorymanager, vmemorymanager, util, - drivermanagement; - -type - POHCI_MMR = ^TOHCI_MMR; - TOHCI_MMR = packed record - HcRevision : uint32; - HcControl : uint32; - HcCommandStatus : uint32; - HcIntStatus : uint32; - HcIntEnable : uint32; - HcIntDisable : uint32; - HcHCCA : uint32; - HcPeriodCurrentED : uint32; - HcControlHeadED : uint32; - HcControlCurrentED : uint32; - HcBulkHeadED : uint32; - HcBulkCurrentED : uint32; - HcDoneHead : uint32; - HcFmRemaining : uint32; - HcFmNumber : uint32; - HcPeriodicStart : uint32; - HcLSThreshold : uint32; - HcRhDescriptorA : uint32; - HcRhDescriptorB : uint32; - HcRhStatus : uint32; - end; + drivermanagement, + OHCI, UHCI, EHCI; procedure init; implementation -function loadOHCI(ptr : void) : boolean; -var - devices : TDeviceArray; - count : uint32; - i : uint32; - block : uint32; - MMR : POHCI_MMR; +function loadEHCI(ptr : void) : boolean; +begin + push_trace('USB.loadEHCI'); + loadEHCI:= EHCI.load; +end; +function loadOHCI(ptr : void) : boolean; begin push_trace('USB.loadOHCI'); - devices:= PCI.getDeviceInfo($0C, $03, $10, count); - console.output('USB-OHCI Driver', 'Found '); - console.writeint(count); - console.writestringln(' USB Controller(s).'); - if count > 0 then begin - for i:=0 to count-1 do begin - console.output('USB-OHCI Driver', 'Controller['); - console.writeint(i); - console.writestring(']: '); - console.writehex(devices[i].device_id); - console.writestring(' '); - console.writehex(devices[i].vendor_id); - console.writestring(' '); - console.writehexln(devices[i].prog_if); - block:= devices[i].address0 SHR 22; - force_alloc_block(block, 0); - map_page(block, block); - MMR:= POHCI_MMR(devices[i].address0); - end; - end; - loadOHCI:= true; - pop_trace; + loadOHCI:= OHCI.load; end; function loadUHCI(ptr : void) : boolean; -var - devices : TDeviceArray; - count : uint32; - i : uint32; - begin push_trace('USB.loadUHCI'); - devices:= PCI.getDeviceInfo($0C, $03, $00, count); - console.output('USB-UHCI Driver','Found '); - console.writeint(count); - console.writestringln(' USB Controller(s).'); - if count > 0 then begin - for i:=0 to count-1 do begin - console.output('USB-UHCI Driver','Controller['); - console.writeint(i); - console.writestring(']: '); - console.writehex(devices[i].device_id); - console.writestring(' '); - console.writehex(devices[i].vendor_id); - console.writestring(' '); - console.writehexln(devices[i].prog_if); - end; - end; - loadUHCI:= true; - pop_trace; + loadUHCI:= UHCI.load; end; procedure init; var - UHCI_ID, OHCI_ID : TDeviceIdentifier; + UHCI_ID, OHCI_ID, EHCI_ID: TDeviceIdentifier; begin push_trace('USB.init'); @@ -127,8 +59,17 @@ begin OHCI_ID.id4:= $FFFFFFFF; OHCI_ID.ex:= nil; + EHCI_ID.Bus:= biPCI; + EHCI_ID.id0:= idANY; + EHCI_ID.id1:= $0000000C; + EHCI_ID.id2:= $00000003; + EHCI_ID.id3:= $00000020; + EHCI_ID.id4:= $FFFFFFFF; + EHCI_ID.ex:= nil; + drivermanagement.register_driver('USB-UHCI Driver', @UHCI_ID, @loadUHCI); drivermanagement.register_driver('USB-OHCI Driver', @OHCI_ID, @loadOHCI); + drivermanagement.register_driver('USB-EHCI Driver', @EHCI_ID, @loadEHCI); console.outputln('USB Driver', 'INIT END.'); pop_trace; diff --git a/src/include/asuro.pas b/src/include/asuro.pas index 94b53279..993bb7da 100644 --- a/src/include/asuro.pas +++ b/src/include/asuro.pas @@ -3,20 +3,20 @@ unit asuro; interface const - VERSION = '1.0.1-664ia'; + VERSION = '1.0.1-668ia'; VERSION_MAJOR = '1'; VERSION_MINOR = '0'; VERSION_SUB = '1'; - REVISION = '664'; + REVISION = '668'; RELEASE = 'ia'; - LINE_COUNT = 27361; - FILE_COUNT = 84; - DRIVER_COUNT = 28; + LINE_COUNT = 27480; + FILE_COUNT = 87; + DRIVER_COUNT = 31; FPC_VERSION = '2.6.4'; NASM_VERSION = '2.10.09'; MAKE_VERSION = '3.81'; - COMPILE_DATE = '06/05/18'; - COMPILE_TIME = '06:55:52'; + COMPILE_DATE = '07/05/18'; + COMPILE_TIME = '22:47:28'; implementation diff --git a/src/prog/themer.pas b/src/prog/themer.pas new file mode 100644 index 00000000..82faacf0 --- /dev/null +++ b/src/prog/themer.pas @@ -0,0 +1,199 @@ +unit themer; + +interface + +uses + console, terminal, keyboard, shell, strings, tracer; + +procedure init(); + +implementation + +type + TThemeThing = record + ThemeName : PChar; + Colors : PRGB565Pair; + end; + +var + Handle : HWND = 0; + Colors : uint32; + Themes : Array[0..3] of TThemeThing; + Selected : uint32; + ForeBack : uint32; + Changing : Boolean = false; + +procedure OnClose(); +begin + Handle:= 0; +end; + +procedure Draw(); +var + i, j : uint32; + longest, len : uint32; + +begin + tracer.push_trace('themer.draw'); + if Handle <> 0 then begin + clearWNDEx(Handle, Colors); + writestringlnexWND(' ', Colors, Handle); + writestringlnexWND(' ', Colors, Handle); + writestringlnexWND(' ', Colors, Handle); + writestringlnexWND(' ', Colors, Handle); + longest:= 0; + for i:=0 to 3 do begin + if stringSize(Themes[i].ThemeName) > longest then longest:= stringSize(Themes[i].ThemeName); + end; + for j:=0 to longest do begin + writeStringexWND(' ', Colors, Handle); + end; + writestringexWND(' Foreground ', Colors, Handle); + writestringexWND(#6, Colors, Handle); + writestringlnexWND(' Background', Colors, Handle); + for i:=0 to 3 do begin + len:= longest - StringSize(Themes[i].ThemeName); + for j:=0 to len do begin + writeStringexWND(' ', Colors, Handle); + end; + writestringexWND(' ', Colors, Handle); + writeStringexWND(Themes[i].ThemeName, Colors, Handle); + writeStringexWND(':', Colors, Handle); + if (ForeBack = 0) and (Selected = i) and (Changing) then writeStringexWND(' *R:', Colors, Handle) else if (ForeBack = 0) and (Selected = i) then writeStringexWND(' >R:', Colors, Handle) else writeStringexWND(' R:', Colors, Handle); + if Themes[i].Colors^.Foreground.R < 10 then writeintexWND(0, Colors, Handle); + writeintexWND(Themes[i].Colors^.Foreground.R, Colors, Handle); + if (ForeBack = 1) and (Selected = i) and (Changing) then writeStringexWND(' *G:', Colors, Handle) else if (ForeBack = 1) and (Selected = i) then writeStringexWND(' >G:', Colors, Handle) else writeStringexWND(' G:', Colors, Handle); + if Themes[i].Colors^.Foreground.G < 10 then writeintexWND(0, Colors, Handle); + writeintexWND(Themes[i].Colors^.Foreground.G, Colors, Handle); + if (ForeBack = 2) and (Selected = i) and (Changing) then writeStringexWND(' *B:', Colors, Handle) else if (ForeBack = 2) and (Selected = i) then writeStringexWND(' >B:', Colors, Handle) else writeStringexWND(' B:', Colors, Handle); + if Themes[i].Colors^.Foreground.B < 10 then writeintexWND(0, Colors, Handle); + writeintexWND(Themes[i].Colors^.Foreground.B, Colors, Handle); + writestringexWND(' ', Colors, Handle); + writestringexWND(#6, Colors, Handle); + if (ForeBack = 3) and (Selected = i) and (Changing) then writeStringexWND(' *R:', Colors, Handle) else if (ForeBack = 3) and (Selected = i) then writeStringexWND(' >R:', Colors, Handle) else writeStringexWND(' R:', Colors, Handle); + if Themes[i].Colors^.Background.R < 10 then writeintexWND(0, Colors, Handle); + writeintexWND(Themes[i].Colors^.Background.R, Colors, Handle); + if (ForeBack = 4) and (Selected = i) and (Changing) then writeStringexWND(' *G:', Colors, Handle) else if (ForeBack = 4) and (Selected = i) then writeStringexWND(' >G:', Colors, Handle) else writeStringexWND(' G:', Colors, Handle); + if Themes[i].Colors^.Background.G < 10 then writeintexWND(0, Colors, Handle); + writeintexWND(Themes[i].Colors^.Background.G, Colors, Handle); + if (ForeBack = 5) and (Selected = i) and (Changing) then writeStringexWND(' *B:', Colors, Handle) else if (ForeBack = 5) and (Selected = i) then writeStringexWND(' >B:', Colors, Handle) else writeStringexWND(' B:', Colors, Handle); + if Themes[i].Colors^.Background.B < 10 then writeintexWND(0, Colors, Handle); + writeintexWND(Themes[i].Colors^.Background.B, Colors, Handle); + writestringlnexWND(' ', Colors, Handle); + end; + len:= longest - StringSize('Color16'); + for j:=0 to len do begin + writeStringexWND(' ', Colors, Handle); + end; + writestringexWND(' ', Colors, Handle); + writestringexWND('Color16:', Colors, Handle); + writestringexWND(' ', Colors, Handle); + writehexexWND(puint16(@Themes[Selected].Colors^.Foreground)^, Colors, Handle); + writestringexWND(' '+#6, Colors, Handle); + writestringexWND(' ', Colors, Handle); + writehexlnexWND(puint16(@Themes[Selected].Colors^.Background)^, Colors, Handle); + writestringlnexWND(' ', Colors, Handle); + writestringlnexWND(' Press ''d'' to dump color values.', Colors, Handle); + end; +end; + +procedure incrementSelected; +begin + case ForeBack of + 0:Themes[Selected].Colors^.Foreground.R:= Themes[Selected].Colors^.Foreground.R + 1; + 1:Themes[Selected].Colors^.Foreground.G:= Themes[Selected].Colors^.Foreground.G + 1; + 2:Themes[Selected].Colors^.Foreground.B:= Themes[Selected].Colors^.Foreground.B + 1; + 3:Themes[Selected].Colors^.Background.R:= Themes[Selected].Colors^.Background.R + 1; + 4:Themes[Selected].Colors^.Background.G:= Themes[Selected].Colors^.Background.G + 1; + 5:Themes[Selected].Colors^.Background.B:= Themes[Selected].Colors^.Background.B + 1; + end; +end; + +procedure decrementSelected; +begin + case ForeBack of + 0:Themes[Selected].Colors^.Foreground.R:= Themes[Selected].Colors^.Foreground.R - 1; + 1:Themes[Selected].Colors^.Foreground.G:= Themes[Selected].Colors^.Foreground.G - 1; + 2:Themes[Selected].Colors^.Foreground.B:= Themes[Selected].Colors^.Foreground.B - 1; + 3:Themes[Selected].Colors^.Background.R:= Themes[Selected].Colors^.Background.R - 1; + 4:Themes[Selected].Colors^.Background.G:= Themes[Selected].Colors^.Background.G - 1; + 5:Themes[Selected].Colors^.Background.B:= Themes[Selected].Colors^.Background.B - 1; + end; +end; + +procedure OnKeyPressed(info : TKeyInfo); +var + i : uint32; + +begin + case info.key_code of + 13:begin + Changing:= not Changing; + end; + 16:begin //Up + if changing then begin + incrementSelected; + end else begin + if Selected > 0 then dec(Selected); + end; + end; + 18:begin //Down + if changing then begin + decrementSelected; + end else begin + if Selected < 3 then inc(Selected); + end; + end; + 20:begin //Right + if not changing then begin + if ForeBack < 5 then inc(ForeBack); + end; + end; + 19:begin //Left + if not changing then begin + if ForeBack > 0 then dec(ForeBack); + end; + end; + uint8('d'):begin + writestringlnWND(' ', getTerminalHWND); + for i:=0 to 3 do begin + writestringWND(Themes[i].ThemeName, getTerminalHWND); + writestringWND(': Foreground: ', getTerminalHWND); + writehexWND(puint16(@Themes[i].Colors^.Foreground)^, getTerminalHWND); + writestringWND(' Background: ', getTerminalHWND); + writehexlnWND(puint16(@Themes[i].Colors^.Background)^, getTerminalHWND); + end; + end; + end; +end; + +procedure run(Params : PParamList); +begin + tracer.push_trace('themer.run'); + if Handle = 0 then begin + Handle:= newWindow(20, 40, 65, 14, 'THEMER'); + registerEventHandler(Handle, EVENT_DRAW, void(@Draw)); + registerEventHandler(Handle, EVENT_CLOSE, void(@OnClose)); + registerEventHandler(Handle, EVENT_KEY_PRESSED, void(@OnKeyPressed)); + writestringlnWND('Themer Started.', getTerminalHWND); + Themes[0].ThemeName:= 'Windows'; + Themes[0].Colors:= PRGB565Pair(getWindowColorPtr); + Themes[1].ThemeName:= 'Background'; + Themes[1].Colors:= PRGB565Pair(getDesktopColorsPtr); + Themes[2].ThemeName:= 'Explore Button'; + Themes[2].Colors:= PRGB565Pair(getExploreColorsPtr); + Themes[3].ThemeName:= 'Taskbar'; + Themes[3].Colors:= PRGB565Pair(getTaskbarColorsPtr); + Selected:= 0; + ForeBack:= 0; + end; +end; + +procedure init(); +begin + Colors:= combineColors($0000, $FFFF); + tracer.push_trace('themer.init'); + terminal.registerCommand('THEMER', @Run, 'Themer, for your themez.'); +end; + +end. \ No newline at end of file