Compare commits
60
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c70c0b52c3 | ||
|
|
452cc0c8c8 | ||
|
|
3d334b8e8b | ||
|
|
b9643a7b56 | ||
|
|
6902a406b0 | ||
|
|
36ec7bfdb6 | ||
|
|
6c3c0e63d5 | ||
|
|
df71c59aea | ||
|
|
97244a2b95 | ||
|
|
ecca496978 | ||
|
|
e52b4a9763 | ||
|
|
f78eaa3811 | ||
|
|
acb4a15e41 | ||
|
|
d3581eea2e | ||
|
|
1fc00e3e7c | ||
|
|
2f837ace6e | ||
|
|
f8182b24b3 | ||
|
|
f0531ff861 | ||
|
|
3d9c4cb49a | ||
|
|
3a733b1559 | ||
|
|
deb513c925 | ||
|
|
789fb7971a | ||
|
|
4e3acd6af7 | ||
|
|
262d064b6d | ||
|
|
738e5828f6 | ||
|
|
9fa1c859ac | ||
|
|
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 |
+8
-1
@@ -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
|
||||
@@ -14,4 +14,6 @@ localenv.json
|
||||
/lvgl/
|
||||
dockerout.txt
|
||||
AGENTS.md
|
||||
lessons_learnt.md
|
||||
*.log
|
||||
/doc/*.md
|
||||
+22
-8
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# compile_lvgl.sh — Download LVGL v9.2 source and compile into lib/liblvgl.a
|
||||
# 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
|
||||
|
||||
LVGL_VERSION="v9.2.2"
|
||||
@@ -10,6 +10,7 @@ LVGL_DIR="/tmp/lvgl"
|
||||
OBJ_DIR="/tmp/lvgl_obj"
|
||||
CONF_DIR="$(pwd)/lvglh"
|
||||
OUT_DIR="$(pwd)/lib"
|
||||
CACHE_DIR="/code/lvgl"
|
||||
|
||||
CC="gcc"
|
||||
CFLAGS="-m32 -march=i686 -ffreestanding \
|
||||
@@ -26,6 +27,17 @@ echo " "
|
||||
echo "Compiling LVGL..."
|
||||
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)
|
||||
rm -rf "$LVGL_DIR"
|
||||
echo "Downloading LVGL ${LVGL_VERSION}..."
|
||||
@@ -105,14 +117,16 @@ else
|
||||
echo "No custom LVGL files in lvglh/."
|
||||
fi
|
||||
|
||||
# Copy source + objects to /lvgl host mount for debugging
|
||||
echo "Copying LVGL source and objects to host mount..."
|
||||
mkdir /code/lvgl 2>/dev/null || true
|
||||
rm -rf /code/lvgl/* /code/lvgl/.[!.]* /code/lvgl/..?* 2>/dev/null || true
|
||||
cp -a "$LVGL_DIR/src" /code/lvgl/src
|
||||
cp -a "$OBJ_DIR" /code/lvgl/obj
|
||||
# Cache liblvgl.a and source to host mount for next build
|
||||
echo "Caching LVGL to host mount..."
|
||||
mkdir -p "$CACHE_DIR"
|
||||
rm -rf ${CACHE_DIR}/* ${CACHE_DIR}/.[!.]* ${CACHE_DIR}/..?* 2>/dev/null || true
|
||||
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 " "
|
||||
echo "LVGL compilation complete."
|
||||
echo " "
|
||||
echo " "
|
||||
+7
-1
@@ -4,4 +4,10 @@ echo "======================="
|
||||
echo " "
|
||||
echo "Compiling FPC Sources..."
|
||||
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
|
||||
# Build -Fu flags for all directories under src/ and wasuro/
|
||||
FU_PATHS="-Fusrc -Fuwasuro"
|
||||
for dir in $(find src wasuro -type d 2>/dev/null); do
|
||||
FU_PATHS="$FU_PATHS -Fu$dir"
|
||||
done
|
||||
|
||||
fpc -Aelf -gw -g -gl -n -v0e -O3 -OpPENTIUM3 -Si -Sc -Sg -Xd -CX -XXs -CfSSE -CfSSE2 -Rintel -Pi386 -Tlinux -FElib/ $FU_PATHS src/kernel.pas
|
||||
+2
-1
@@ -4,4 +4,5 @@ echo "======================="
|
||||
echo " "
|
||||
echo "Compiling Stub..."
|
||||
echo " "
|
||||
nasm -f elf src/stub/stub.asm -o lib/stub.o
|
||||
nasm -f elf src/stub/stub.asm -o lib/stub.o
|
||||
nasm -f elf src/stub/splash_tga.asm -o lib/splash_tga.o
|
||||
@@ -0,0 +1,32 @@
|
||||
#Flat filesystem
|
||||
|
||||
A super simple filesystem for asuro. Folders are emulated in filenames.
|
||||
|
||||
Starts with disk info sector, sector 0 of volume
|
||||
|
||||
---
|
||||
#### disk info
|
||||
|
||||
jmp2boot : ubit24;
|
||||
OEMName : array[0..7] of char;
|
||||
version : uint16 // numerical version of filesystem
|
||||
sectorCount : uint16;
|
||||
fileCount : uint16
|
||||
signature : uint32 = 0x0B00B1E5
|
||||
|
||||
|
||||
the Rest of the sector is reserved
|
||||
|
||||
---
|
||||
|
||||
Starting from sector 1 is the file table. Table size is determined by entry size (64) * fileCount
|
||||
|
||||
---
|
||||
####File entry
|
||||
|
||||
name : array[0..59] of char //file name max 60 chars
|
||||
fileStart : 16bit // start sector of data
|
||||
fileSize : 16bit // data size in sectors
|
||||
|
||||
---
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.0 MiB |
Generated
+1
@@ -0,0 +1 @@
|
||||
Hello from the Asuro ISO!
|
||||
+108
-5
@@ -12,15 +12,118 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
{
|
||||
ContextSwitcher - Switch Process Contexts when preempted.
|
||||
|
||||
@author(Kieron Morris <[email protected]>)
|
||||
{
|
||||
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]>)
|
||||
}
|
||||
unit contextswitcher;
|
||||
|
||||
{$ASMMODE intel}
|
||||
|
||||
interface
|
||||
|
||||
implementation;
|
||||
uses
|
||||
idt, isrmanager, processmanager, proctypes, util, tracer;
|
||||
|
||||
{ Initialise: overwrite IDT gate 32 with our custom ISR. }
|
||||
procedure init;
|
||||
|
||||
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.
|
||||
+2
-5
@@ -22,7 +22,7 @@ unit cpu;
|
||||
interface
|
||||
|
||||
uses
|
||||
util, RTC;
|
||||
util, RTC, stdio;
|
||||
|
||||
type
|
||||
PCapabilities_Old = ^TCapabilities_Old;
|
||||
@@ -113,12 +113,10 @@ var
|
||||
CAP_OLD, CAP_NEW : uint32;
|
||||
|
||||
procedure init();
|
||||
procedure Terminal_Command_CPU(Params : PParamList; stdin_buf, stdout_buf, stderr_buf : POutBuf);
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
stdio;
|
||||
|
||||
procedure getCPUIdentifier;
|
||||
var
|
||||
id0, id1, id2 : uint32;
|
||||
@@ -325,7 +323,6 @@ end;
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
stdio.registerCommand('CPU', @Terminal_Command_CPU, 'CPU Info.');
|
||||
CPUID.Capabilities0:= PCapabilities_Old(@CAP_OLD);
|
||||
CPUID.Capabilities1:= PCapabilities_New(@CAP_NEW);
|
||||
getCPUIdentifier;
|
||||
|
||||
@@ -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,
|
||||
syslog,
|
||||
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);
|
||||
syslog.log('USB-EHCI Driver', 'Found ');
|
||||
syslog.writeint(count);
|
||||
syslog.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
syslog.log('USB-EHCI Driver', 'Controller[');
|
||||
syslog.writeint(i);
|
||||
syslog.writestring(']: ');
|
||||
syslog.writehex(devices[i].device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(devices[i].vendor_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.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,
|
||||
syslog,
|
||||
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);
|
||||
syslog.log('USB-OHCI Driver', 'Found ');
|
||||
syslog.writeint(count);
|
||||
syslog.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
syslog.log('USB-OHCI Driver', 'Controller[');
|
||||
syslog.writeint(i);
|
||||
syslog.writestring(']: ');
|
||||
syslog.writehex(devices[i].device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(devices[i].vendor_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.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.
|
||||
+32
-1
@@ -18,7 +18,7 @@
|
||||
@author(Aaron Hance <[email protected]>)
|
||||
@author(Kieron Morris <[email protected]>)
|
||||
}
|
||||
unit PCI;
|
||||
unit pci;
|
||||
|
||||
interface
|
||||
|
||||
@@ -91,6 +91,7 @@ function getDeviceInfo(class_code : uint8; subclass_code : uint8; prog_if : uint
|
||||
procedure requestConfig(bus : uint8; slot : uint8; func : uint8; row : uint8);
|
||||
procedure writeConfig(bus: uint8; slot : uint8; func : uint8; row : uint8; val : uint32);
|
||||
procedure setBusMaster(bus : uint8; slot : uint8; func : uint8; master : boolean);
|
||||
procedure enableDevice(bus : uint8; slot : uint8; func : uint8);
|
||||
|
||||
implementation
|
||||
|
||||
@@ -442,4 +443,34 @@ begin
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
//Enable device inturrupts and set bus master
|
||||
procedure enableDevice(bus : uint8; slot : uint8; func : uint8);
|
||||
var
|
||||
addr : uint32;
|
||||
cmd : uint32;
|
||||
begin
|
||||
push_trace('PCI.enableDevice');
|
||||
|
||||
addr := ($1 shl 31);
|
||||
addr := addr or (bus shl 16);
|
||||
addr := addr or ((slot) shl 11);
|
||||
addr := addr or ((func) shl 8);
|
||||
addr := addr or ($04 and $FC);
|
||||
|
||||
outl(PCI_CONFIG_ADDRESS_PORT, addr);
|
||||
cmd := inl(PCI_CONFIG_DATA_PORT);
|
||||
cmd := cmd or PCI_COMMAND_MEM_SPACE;
|
||||
cmd := cmd or PCI_COMMAND_BUS_MASTER;
|
||||
cmd := cmd or (3 shl 1);
|
||||
|
||||
//enable interrupts, remove disable interrupt bit maybe
|
||||
cmd := cmd and not PCI_COMMAND_INT_DISABLE;
|
||||
// cmd := cmd and not (1 shl 9);
|
||||
|
||||
outl(PCI_CONFIG_ADDRESS_PORT, addr);
|
||||
outl(PCI_CONFIG_DATA_PORT, cmd);
|
||||
|
||||
pop_trace;
|
||||
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->UHCI - Universal Host Controller Interface Driver.
|
||||
|
||||
@author(Kieron Morris <[email protected]>)
|
||||
}
|
||||
unit UHCI;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
tracer,
|
||||
syslog,
|
||||
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);
|
||||
syslog.log('USB-UHCI Driver','Found ');
|
||||
syslog.writeint(count);
|
||||
syslog.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
syslog.log('USB-UHCI Driver','Controller[');
|
||||
syslog.writeint(i);
|
||||
syslog.writestring(']: ');
|
||||
syslog.writehex(devices[i].device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(devices[i].vendor_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.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,
|
||||
syslog,
|
||||
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);
|
||||
syslog.log('USB-XHCI Driver', 'Found ');
|
||||
syslog.writeint(count);
|
||||
syslog.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
syslog.log('USB-XHCI Driver', 'Controller[');
|
||||
syslog.writeint(i);
|
||||
syslog.writestring(']: ');
|
||||
syslog.writehex(devices[i].device_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.writehex(devices[i].vendor_id);
|
||||
syslog.writestring(' ');
|
||||
syslog.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,7 +17,7 @@
|
||||
|
||||
@author(Kieron Morris <kjm@kieronmorris.me>)
|
||||
}
|
||||
unit USB;
|
||||
unit usb;
|
||||
|
||||
interface
|
||||
|
||||
@@ -30,6 +30,12 @@ uses
|
||||
vmemorymanager,
|
||||
util,
|
||||
drivermanagement,
|
||||
usbtypes,
|
||||
usbcore,
|
||||
usbhub,
|
||||
usb_keyboard,
|
||||
usb_mouse,
|
||||
usb_storage,
|
||||
OHCI, UHCI, EHCI, XHCI;
|
||||
|
||||
procedure init;
|
||||
@@ -40,24 +46,28 @@ function loadXHCI(ptr : void) : boolean;
|
||||
begin
|
||||
push_trace('USB.loadXHCI');
|
||||
loadXHCI:= XHCI.load;
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
function loadEHCI(ptr : void) : boolean;
|
||||
begin
|
||||
push_trace('USB.loadEHCI');
|
||||
loadEHCI:= EHCI.load;
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
function loadOHCI(ptr : void) : boolean;
|
||||
begin
|
||||
push_trace('USB.loadOHCI');
|
||||
loadOHCI:= OHCI.load;
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
function loadUHCI(ptr : void) : boolean;
|
||||
begin
|
||||
push_trace('USB.loadUHCI');
|
||||
loadUHCI:= UHCI.load;
|
||||
pop_trace;
|
||||
end;
|
||||
|
||||
procedure init;
|
||||
@@ -70,6 +80,19 @@ var
|
||||
begin
|
||||
push_trace('USB.init');
|
||||
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.id0:= idANY;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user