Compare commits
46
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d01b534a3d | ||
|
|
491b0ea5c3 | ||
|
|
de6fde05cc | ||
|
|
fb675a2299 | ||
|
|
aa374b6816 | ||
|
|
f427b7bcc7 | ||
|
|
4ba3c5b524 | ||
|
|
7180ad39d8 | ||
|
|
6c7bcc1911 | ||
|
|
e09c9b5595 | ||
|
|
9476bb0c8a | ||
|
|
8f7db8507b | ||
|
|
188b1aebb0 | ||
|
|
452203b7b4 | ||
|
|
76c419336e | ||
|
|
2ad0ae8420 | ||
|
|
c0c199bfe6 | ||
|
|
7ec3bcb9b9 | ||
|
|
4bd0a2dfbf | ||
|
|
431e5bc8f4 | ||
|
|
8169d93a9c | ||
|
|
547251dbd0 | ||
|
|
7bbcc44c5e | ||
|
|
25475a88a7 | ||
|
|
db49c29627 | ||
|
|
c237553508 | ||
|
|
0c96d32754 | ||
|
|
3f83f279d7 | ||
|
|
82fe9fa6df | ||
|
|
983d9a428d | ||
|
|
2fa77d8295 | ||
|
|
f53afc1d2d | ||
|
|
cb7144f282 | ||
|
|
afdc83eaf6 | ||
|
|
2239d9c848 | ||
|
|
beb4b253ab | ||
|
|
084130da80 | ||
|
|
f752be48ce | ||
|
|
dbe6e958e2 | ||
|
|
201cda4c29 | ||
|
|
e54b34aa93 | ||
|
|
fcfe7c3204 | ||
|
|
be4b482bde | ||
|
|
6f50b053b7 | ||
|
|
ece376660c | ||
|
|
924305a1ab |
No files matched your search
@@ -1 +1,8 @@
|
|||||||
* text=auto eol=lf
|
* text=auto eol=lf
|
||||||
|
lvglh/** linguist-vendored
|
||||||
|
lvgl/** linguist-vendored
|
||||||
|
.vscode/* linguist-vendored
|
||||||
|
lib/* linguist-generated
|
||||||
|
release/* linguist-generated
|
||||||
|
iso/* linguist-generated
|
||||||
|
*.asm linguist-detectable
|
||||||
@@ -15,3 +15,4 @@ localenv.json
|
|||||||
dockerout.txt
|
dockerout.txt
|
||||||
AGENTS.md
|
AGENTS.md
|
||||||
*.log
|
*.log
|
||||||
|
/doc/*.md
|
||||||
+21
-6
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# compile_lvgl.sh — Download LVGL v9.2 source and compile into lib/liblvgl.a
|
# compile_lvgl.sh — Download LVGL v9.2 source and compile into lib/liblvgl.a
|
||||||
# Clone & compile in /tmp (fast container-local fs).
|
# Clone & compile in /tmp (fast container-local fs).
|
||||||
# Copy source + objects to /lvgl (host mount) for debugging.
|
# Cache liblvgl.a on host mount (/code/lvgl/) to skip rebuild.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
LVGL_VERSION="v9.2.2"
|
LVGL_VERSION="v9.2.2"
|
||||||
@@ -10,6 +10,7 @@ LVGL_DIR="/tmp/lvgl"
|
|||||||
OBJ_DIR="/tmp/lvgl_obj"
|
OBJ_DIR="/tmp/lvgl_obj"
|
||||||
CONF_DIR="$(pwd)/lvglh"
|
CONF_DIR="$(pwd)/lvglh"
|
||||||
OUT_DIR="$(pwd)/lib"
|
OUT_DIR="$(pwd)/lib"
|
||||||
|
CACHE_DIR="/code/lvgl"
|
||||||
|
|
||||||
CC="gcc"
|
CC="gcc"
|
||||||
CFLAGS="-m32 -march=i686 -ffreestanding \
|
CFLAGS="-m32 -march=i686 -ffreestanding \
|
||||||
@@ -26,6 +27,17 @@ echo " "
|
|||||||
echo "Compiling LVGL..."
|
echo "Compiling LVGL..."
|
||||||
echo " "
|
echo " "
|
||||||
|
|
||||||
|
# If cached liblvgl.a exists on host mount, just copy it and skip everything
|
||||||
|
if [ -f "${CACHE_DIR}/liblvgl.a" ]; then
|
||||||
|
echo "Found cached liblvgl.a in ${CACHE_DIR}, copying to ${OUT_DIR}..."
|
||||||
|
cp "${CACHE_DIR}/liblvgl.a" "${OUT_DIR}/liblvgl.a"
|
||||||
|
echo "(Delete lvgl/liblvgl.a to force a full rebuild.)"
|
||||||
|
echo " "
|
||||||
|
echo "LVGL compilation complete (cached)."
|
||||||
|
echo " "
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Clone LVGL into /tmp (container-local)
|
# Clone LVGL into /tmp (container-local)
|
||||||
rm -rf "$LVGL_DIR"
|
rm -rf "$LVGL_DIR"
|
||||||
echo "Downloading LVGL ${LVGL_VERSION}..."
|
echo "Downloading LVGL ${LVGL_VERSION}..."
|
||||||
@@ -105,11 +117,14 @@ else
|
|||||||
echo "No custom LVGL files in lvglh/."
|
echo "No custom LVGL files in lvglh/."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy source + objects to /lvgl host mount for debugging
|
# Cache liblvgl.a and source to host mount for next build
|
||||||
echo "Copying LVGL source and objects to host mount..."
|
echo "Caching LVGL to host mount..."
|
||||||
rm -rf /lvgl/* /lvgl/.[!.]* /lvgl/..?* 2>/dev/null || true
|
mkdir -p "$CACHE_DIR"
|
||||||
cp -a "$LVGL_DIR/src" /lvgl/src
|
rm -rf ${CACHE_DIR}/* ${CACHE_DIR}/.[!.]* ${CACHE_DIR}/..?* 2>/dev/null || true
|
||||||
cp -a "$OBJ_DIR" /lvgl/obj
|
cp "${OUT_DIR}/liblvgl.a" "${CACHE_DIR}/liblvgl.a"
|
||||||
|
cp -a "$LVGL_DIR/src" "${CACHE_DIR}/src"
|
||||||
|
cp -a "$LVGL_DIR"/*.h "${CACHE_DIR}/" 2>/dev/null || true
|
||||||
|
cp -a "$OBJ_DIR" "${CACHE_DIR}/obj"
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
echo " "
|
echo " "
|
||||||
|
|||||||
+1
-1
@@ -4,4 +4,4 @@ echo "======================="
|
|||||||
echo " "
|
echo " "
|
||||||
echo "Compiling FPC Sources..."
|
echo "Compiling FPC Sources..."
|
||||||
echo " "
|
echo " "
|
||||||
fpc -Aelf -gw -g -gl -n -v0ew -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/driver/* -Fusrc/driver/net/* src/kernel.pas
|
fpc -Aelf -gw -g -gl -n -v0ew -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ -Fusrc/* -Fusrc/include/* -Fusrc/driver/* -Fusrc/driver/net/* -Fusrc/driver/bus/* -Fusrc/driver/bus/usb/* -Fusrc/driver/hid/* src/kernel.pas
|
||||||
Whitespace-only changes.
@@ -3,4 +3,3 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
- .:/code
|
- .:/code
|
||||||
- ./lvgl:/lvgl
|
|
||||||
Vendored
+12886
File diff suppressed because it is too large.
Load diff
-2710
File diff suppressed because it is too large.
Load diff
+108
-2
@@ -13,14 +13,120 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
{
|
{
|
||||||
ContextSwitcher - Switch Process Contexts when preempted.
|
ContextSwitcher - Custom IRQ0 handler for preemptive context switching.
|
||||||
|
|
||||||
|
Replaces the default ISR_32 with a naked assembly stub that saves the
|
||||||
|
interrupted context (PUSHAD + segment regs), calls a Pascal helper to
|
||||||
|
dispatch timer hooks, send EOI, and run the scheduler, then restores
|
||||||
|
the next process context (or idles) via the returned ESP.
|
||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
@author(Kieron Morris <[email protected]>)
|
||||||
}
|
}
|
||||||
unit contextswitcher;
|
unit contextswitcher;
|
||||||
|
|
||||||
|
{$ASMMODE intel}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
implementation;
|
uses
|
||||||
|
idt, isrmanager, processmanager, proctypes, util, syslog, tracer;
|
||||||
|
|
||||||
|
{ Initialise: overwrite IDT gate 32 with our custom ISR. }
|
||||||
|
procedure init;
|
||||||
|
|
||||||
|
{ No idle ESP variable needed — idle is now a formal process (PID 0)
|
||||||
|
with its SavedESP managed like any other process. }
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ -----------------------------------------------------------------------
|
||||||
|
do_context_switch_work
|
||||||
|
Pascal helper called from the assembly ISR. Receives the current ESP
|
||||||
|
(pointing to the GS..EFLAGS save area), dispatches timer hooks, sends
|
||||||
|
EOI, runs the scheduler and returns the ESP for the next context.
|
||||||
|
Uses register calling convention: saved_esp in EAX, result in EAX.
|
||||||
|
----------------------------------------------------------------------- }
|
||||||
|
function do_context_switch_work(saved_esp : uint32) : uint32;
|
||||||
|
var
|
||||||
|
next : PProcessContext;
|
||||||
|
begin
|
||||||
|
{ 1. Save ESP into the current process }
|
||||||
|
processmanager.CurrentProcess^.SavedESP := saved_esp;
|
||||||
|
|
||||||
|
{ 2. Dispatch all hooks registered on interrupt 32 (timer hooks).
|
||||||
|
This fires TMR_0_ISR.Main which in turn fires BDA tick,
|
||||||
|
graphics refresh, USB hotplug, etc. }
|
||||||
|
isrmanager.dispatchHooks(32);
|
||||||
|
|
||||||
|
{ 3. Send End-Of-Interrupt to the master PIC }
|
||||||
|
outb($20, $20);
|
||||||
|
|
||||||
|
{ 4. Pick the next process to run (always returns non-nil; idle as fallback) }
|
||||||
|
next := processmanager.scheduler_pick_next;
|
||||||
|
processmanager.CurrentProcess := next;
|
||||||
|
|
||||||
|
{ 5. Return the selected process ESP }
|
||||||
|
do_context_switch_work := next^.SavedESP;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ -----------------------------------------------------------------------
|
||||||
|
context_switch_isr
|
||||||
|
Naked assembly ISR that replaces ISR_32 (IRQ0 / PIT timer).
|
||||||
|
|
||||||
|
Stack on entry (pushed by CPU):
|
||||||
|
[ESP+8] EFLAGS
|
||||||
|
[ESP+4] CS
|
||||||
|
[ESP+0] EIP
|
||||||
|
|
||||||
|
We push general-purpose and segment registers, call the Pascal helper,
|
||||||
|
switch ESP to the returned value, pop registers and IRETD.
|
||||||
|
----------------------------------------------------------------------- }
|
||||||
|
procedure context_switch_isr; assembler; nostackframe;
|
||||||
|
asm
|
||||||
|
{ Save all general-purpose registers (EAX,ECX,EDX,EBX,ESP,EBP,ESI,EDI) }
|
||||||
|
pushad
|
||||||
|
|
||||||
|
{ Save segment registers }
|
||||||
|
push ds
|
||||||
|
push es
|
||||||
|
push fs
|
||||||
|
push gs
|
||||||
|
|
||||||
|
{ Load kernel data segments }
|
||||||
|
mov ax, $10
|
||||||
|
mov ds, ax
|
||||||
|
mov es, ax
|
||||||
|
mov fs, ax
|
||||||
|
mov gs, ax
|
||||||
|
|
||||||
|
{ Call Pascal helper: EAX = current ESP (register calling convention).
|
||||||
|
Returns new ESP in EAX. }
|
||||||
|
mov eax, esp
|
||||||
|
call do_context_switch_work
|
||||||
|
mov esp, eax
|
||||||
|
|
||||||
|
{ Restore segment registers }
|
||||||
|
pop gs
|
||||||
|
pop fs
|
||||||
|
pop es
|
||||||
|
pop ds
|
||||||
|
|
||||||
|
{ Restore general-purpose registers }
|
||||||
|
popad
|
||||||
|
|
||||||
|
{ Return from interrupt }
|
||||||
|
iretd
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ -----------------------------------------------------------------------
|
||||||
|
init
|
||||||
|
Override IDT gate 32 with our custom ISR. Must be called AFTER
|
||||||
|
isrmanager.init so that the default gate has been set up first.
|
||||||
|
----------------------------------------------------------------------- }
|
||||||
|
procedure init;
|
||||||
|
begin
|
||||||
|
idt.set_gate(32, uint32(@context_switch_isr), $08, ISR_RING_0);
|
||||||
|
tracer.push_trace('contextswitcher.init');
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
+77
-70
File diff suppressed because it is too large.
Load diff
@@ -1,65 +0,0 @@
|
|||||||
// Copyright 2021 Kieron Morris
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
{
|
|
||||||
Driver->Bus->EHCI - Enhanced Host Controller Interface Driver.
|
|
||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
|
||||||
}
|
|
||||||
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
|
|
||||||
tracer.push_trace('EHCI.load');
|
|
||||||
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-EHCI 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.
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
// Copyright 2021 Kieron Morris
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
{
|
|
||||||
Driver->Bus->OHCI - Open Host Controller Interface Driver.
|
|
||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
|
||||||
}
|
|
||||||
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
|
|
||||||
tracer.push_trace('OHCI.load');
|
|
||||||
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.
|
|
||||||
+17
-17
@@ -18,14 +18,14 @@
|
|||||||
@author(Aaron Hance <[email protected]>)
|
@author(Aaron Hance <[email protected]>)
|
||||||
@author(Kieron Morris <[email protected]>)
|
@author(Kieron Morris <[email protected]>)
|
||||||
}
|
}
|
||||||
unit PCI;
|
unit pci;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
util,
|
util,
|
||||||
console,
|
syslog,
|
||||||
drivertypes,
|
drivertypes,
|
||||||
lmemorymanager,
|
lmemorymanager,
|
||||||
vmemorymanager,
|
vmemorymanager,
|
||||||
@@ -100,14 +100,14 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('PCI.load');
|
push_trace('PCI.load');
|
||||||
console.outputln('PCI', 'Scanning Bus: 0');
|
syslog.logln('PCI', 'Scanning Bus: 0');
|
||||||
scanBus(0);
|
scanBus(0);
|
||||||
//while unscanned busses scan busses
|
//while unscanned busses scan busses
|
||||||
current_bus := 1;
|
current_bus := 1;
|
||||||
while true do begin
|
while true do begin
|
||||||
if current_bus < bus_count then begin
|
if current_bus < bus_count then begin
|
||||||
console.output('PCI', 'Scanning Bus: ');
|
syslog.log('PCI', 'Scanning Bus: ');
|
||||||
console.writeintln(bus_count);
|
syslog.writeintln(bus_count);
|
||||||
scanBus(current_bus);
|
scanBus(current_bus);
|
||||||
current_bus := current_bus + 1;
|
current_bus := current_bus + 1;
|
||||||
end else break;
|
end else break;
|
||||||
@@ -122,7 +122,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('PCI.init');
|
push_trace('PCI.init');
|
||||||
console.outputln('PCI','INIT BEGIN.');
|
syslog.logln('PCI','INIT BEGIN.');
|
||||||
DevID.Bus:= biUnknown;
|
DevID.Bus:= biUnknown;
|
||||||
DevID.id0:= 0;
|
DevID.id0:= 0;
|
||||||
DevID.id1:= 0;
|
DevID.id1:= 0;
|
||||||
@@ -130,7 +130,7 @@ begin
|
|||||||
DevID.id3:= 0;
|
DevID.id3:= 0;
|
||||||
DevID.ex:= nil;
|
DevID.ex:= nil;
|
||||||
drivermanagement.register_driver_ex('PCI Driver', @DevID, @load, true);
|
drivermanagement.register_driver_ex('PCI Driver', @DevID, @load, true);
|
||||||
console.outputln('PCI', 'INIT END.');
|
syslog.logln('PCI', 'INIT END.');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -388,16 +388,16 @@ begin
|
|||||||
DevID^.id4:= device.vendor_id;
|
DevID^.id4:= device.vendor_id;
|
||||||
DevID^.ex:= nil;
|
DevID^.ex:= nil;
|
||||||
|
|
||||||
console.output('PCI', 'Found Device: ');
|
syslog.log('PCI', 'Found Device: ');
|
||||||
console.writehex(device.header_type);
|
syslog.writehex(device.header_type);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(device.device_id);
|
syslog.writehex(device.device_id);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(device.class_code);
|
syslog.writehex(device.class_code);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehex(device.subclass_class);
|
syslog.writehex(device.subclass_class);
|
||||||
console.writestring(' ');
|
syslog.writestring(' ');
|
||||||
console.writehexln(device.prog_if);
|
syslog.writehexln(device.prog_if);
|
||||||
|
|
||||||
devices[device_count] := device;
|
devices[device_count] := device;
|
||||||
device_count := device_count + 1;
|
device_count := device_count + 1;
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
// Copyright 2021 Kieron Morris
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
{
|
|
||||||
Driver->Bus->UHCI - Universal Host Controller Interface Driver.
|
|
||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
|
||||||
}
|
|
||||||
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
|
|
||||||
tracer.push_trace('UHCI.load');
|
|
||||||
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.
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
// Copyright 2021 Kieron Morris
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
{
|
|
||||||
Driver->Bus->XHCI - eXtensible Host Controller Interface Driver.
|
|
||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
|
||||||
}
|
|
||||||
unit XHCI;
|
|
||||||
|
|
||||||
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
|
|
||||||
tracer.push_trace('XHCI.load');
|
|
||||||
devices:= PCI.getDeviceInfo($0C, $03, $30, count);
|
|
||||||
console.output('USB-XHCI 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-XHCI 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.
|
|
||||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -17,19 +17,25 @@
|
|||||||
|
|
||||||
@author(Kieron Morris <[email protected]>)
|
@author(Kieron Morris <[email protected]>)
|
||||||
}
|
}
|
||||||
unit USB;
|
unit usb;
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
tracer,
|
tracer,
|
||||||
Console,
|
syslog,
|
||||||
PCI,
|
PCI,
|
||||||
drivertypes,
|
drivertypes,
|
||||||
pmemorymanager,
|
pmemorymanager,
|
||||||
vmemorymanager,
|
vmemorymanager,
|
||||||
util,
|
util,
|
||||||
drivermanagement,
|
drivermanagement,
|
||||||
|
usbtypes,
|
||||||
|
usbcore,
|
||||||
|
usbhub,
|
||||||
|
usb_keyboard,
|
||||||
|
usb_mouse,
|
||||||
|
usb_storage,
|
||||||
OHCI, UHCI, EHCI, XHCI;
|
OHCI, UHCI, EHCI, XHCI;
|
||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
@@ -40,24 +46,28 @@ function loadXHCI(ptr : void) : boolean;
|
|||||||
begin
|
begin
|
||||||
push_trace('USB.loadXHCI');
|
push_trace('USB.loadXHCI');
|
||||||
loadXHCI:= XHCI.load;
|
loadXHCI:= XHCI.load;
|
||||||
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function loadEHCI(ptr : void) : boolean;
|
function loadEHCI(ptr : void) : boolean;
|
||||||
begin
|
begin
|
||||||
push_trace('USB.loadEHCI');
|
push_trace('USB.loadEHCI');
|
||||||
loadEHCI:= EHCI.load;
|
loadEHCI:= EHCI.load;
|
||||||
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function loadOHCI(ptr : void) : boolean;
|
function loadOHCI(ptr : void) : boolean;
|
||||||
begin
|
begin
|
||||||
push_trace('USB.loadOHCI');
|
push_trace('USB.loadOHCI');
|
||||||
loadOHCI:= OHCI.load;
|
loadOHCI:= OHCI.load;
|
||||||
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function loadUHCI(ptr : void) : boolean;
|
function loadUHCI(ptr : void) : boolean;
|
||||||
begin
|
begin
|
||||||
push_trace('USB.loadUHCI');
|
push_trace('USB.loadUHCI');
|
||||||
loadUHCI:= UHCI.load;
|
loadUHCI:= UHCI.load;
|
||||||
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure init;
|
procedure init;
|
||||||
@@ -69,7 +79,20 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
push_trace('USB.init');
|
push_trace('USB.init');
|
||||||
console.outputln('USB Driver', 'INIT BEGIN.');
|
syslog.logln('USB Driver', 'INIT BEGIN.');
|
||||||
|
|
||||||
|
{ Initialize USB core (HC list, etc.) }
|
||||||
|
usbcore.init;
|
||||||
|
|
||||||
|
{ Initialize hub driver (registers class driver for $09) }
|
||||||
|
usbhub.init;
|
||||||
|
|
||||||
|
{ Initialize HID class drivers }
|
||||||
|
usb_keyboard.init;
|
||||||
|
usb_mouse.init;
|
||||||
|
|
||||||
|
{ Initialize storage class driver }
|
||||||
|
usb_storage.init;
|
||||||
|
|
||||||
UHCI_ID.Bus:= biPCI;
|
UHCI_ID.Bus:= biPCI;
|
||||||
UHCI_ID.id0:= idANY;
|
UHCI_ID.id0:= idANY;
|
||||||
@@ -108,7 +131,7 @@ begin
|
|||||||
drivermanagement.register_driver('USB-EHCI Driver', @EHCI_ID, @loadEHCI);
|
drivermanagement.register_driver('USB-EHCI Driver', @EHCI_ID, @loadEHCI);
|
||||||
drivermanagement.register_driver('USB-XHCI Driver', @XHCI_ID, @loadXHCI);
|
drivermanagement.register_driver('USB-XHCI Driver', @XHCI_ID, @loadXHCI);
|
||||||
|
|
||||||
console.outputln('USB Driver', 'INIT END.');
|
syslog.logln('USB Driver', 'INIT END.');
|
||||||
pop_trace;
|
pop_trace;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Loaded 20 of 137 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user