Investigating USB
git-svn-id: https://spexeah.com:8443/svn/Asuro@260 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
38a2363051
commit
faf1471f32
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
Binary file not shown.
BIN
lib/PCI.ppu
BIN
lib/PCI.ppu
Binary file not shown.
BIN
lib/isr33.ppu
BIN
lib/isr33.ppu
Binary file not shown.
BIN
lib/isr40.ppu
BIN
lib/isr40.ppu
Binary file not shown.
BIN
lib/isr44.ppu
BIN
lib/isr44.ppu
Binary file not shown.
BIN
lib/kernel.ppu
BIN
lib/kernel.ppu
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/libpsystem.a
BIN
lib/libpsystem.a
Binary file not shown.
BIN
lib/mouse.ppu
BIN
lib/mouse.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/terminal.ppu
BIN
lib/terminal.ppu
Binary file not shown.
@ -410,6 +410,11 @@ begin
|
|||||||
if tmp.class_code = 3 then begin
|
if tmp.class_code = 3 then begin
|
||||||
console.writestringln('-Device is DISPLAY_CONTROLLER ');
|
console.writestringln('-Device is DISPLAY_CONTROLLER ');
|
||||||
end;
|
end;
|
||||||
|
if tmp.class_code = $0C then begin
|
||||||
|
if tmp.subclass_class = $03 then begin
|
||||||
|
console.writestringln('-Device is USB Controller');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//psleep(300);
|
//psleep(300);
|
||||||
|
@ -14,16 +14,93 @@ interface
|
|||||||
uses
|
uses
|
||||||
console,
|
console,
|
||||||
util,
|
util,
|
||||||
isr44;
|
isr44,
|
||||||
|
lmemorymanager,
|
||||||
|
strings;
|
||||||
|
|
||||||
|
type
|
||||||
|
PMousePacket = ^TMousePacket;
|
||||||
|
TMousePacket = record
|
||||||
|
x_movement : byte;
|
||||||
|
y_movement : byte;
|
||||||
|
y_overflow : boolean;
|
||||||
|
x_overflow : boolean;
|
||||||
|
y_sign : boolean;
|
||||||
|
x_sign : boolean;
|
||||||
|
MMB_Down : Boolean;
|
||||||
|
RMB_Down : Boolean;
|
||||||
|
LMB_Down : Boolean;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure callback(packet : void);
|
procedure callback(raw : void);
|
||||||
|
var
|
||||||
|
packet : PMousePacket;
|
||||||
|
x, y, f : byte;
|
||||||
|
r : pchar;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
packet:= PMousePacket(kalloc(sizeof(TMousePacket)));
|
||||||
|
f:= (uint32(raw) AND $FF000000) SHR 24;
|
||||||
|
x:= (uint32(raw) AND $00FF0000) SHR 16;
|
||||||
|
y:= (uint32(raw) AND $0000FF00) SHR 8;
|
||||||
|
packet^.x_movement:= x;
|
||||||
|
packet^.y_movement:= y;
|
||||||
|
packet^.y_overflow:= (f AND $80) = $80;
|
||||||
|
packet^.x_overflow:= (f AND $40) = $40;
|
||||||
|
packet^.y_sign:= (f AND $20) = $20;
|
||||||
|
packet^.x_sign:= (f AND $10) = $10;
|
||||||
|
packet^.MMB_Down:= (f AND $4) = $4;
|
||||||
|
packet^.RMB_Down:= (f AND $2) = $2;
|
||||||
|
packet^.LMB_Down:= (f AND $1) = $1;
|
||||||
|
//Do Hook here
|
||||||
|
// console.writestring('X Movement: ');
|
||||||
|
// console.writeintln(packet^.x_movement);
|
||||||
|
|
||||||
|
// console.writestring('Y Movement: ');
|
||||||
|
// console.writeintln(packet^.y_movement);
|
||||||
|
|
||||||
|
// console.writestring('Y Overflow: ');
|
||||||
|
// r:= boolToString(packet^.y_overflow, true);
|
||||||
|
// console.writestringln(r);
|
||||||
|
// kfree(void(r));
|
||||||
|
|
||||||
|
// console.writestring('X Overflow: ');
|
||||||
|
// r:= boolToString(packet^.x_overflow, true);
|
||||||
|
// console.writestringln(r);
|
||||||
|
// kfree(void(r));
|
||||||
|
|
||||||
|
// console.writestring('Y Sign: ');
|
||||||
|
// r:= boolToString(packet^.y_sign, true);
|
||||||
|
// console.writestringln(r);
|
||||||
|
// kfree(void(r));
|
||||||
|
|
||||||
|
// console.writestring('X Sign: ');
|
||||||
|
// r:= boolToString(packet^.x_sign, true);
|
||||||
|
// console.writestringln(r);
|
||||||
|
// kfree(void(r));
|
||||||
|
|
||||||
|
// console.writestring('Middle Button Down: ');
|
||||||
|
// r:= boolToString(packet^.MMB_Down, true);
|
||||||
|
// console.writestringln(r);
|
||||||
|
// kfree(void(r));
|
||||||
|
|
||||||
|
// console.writestring('Right Button Down: ');
|
||||||
|
// r:= boolToString(packet^.RMB_Down, true);
|
||||||
|
// console.writestringln(r);
|
||||||
|
// kfree(void(r));
|
||||||
|
|
||||||
|
// console.writestring('Left Button Down: ');
|
||||||
|
// r:= boolToString(packet^.LMB_Down, true);
|
||||||
|
// console.writestringln(r);
|
||||||
|
// kfree(void(r));
|
||||||
|
|
||||||
|
kfree(void(packet));
|
||||||
//console.writestring('Mouse Packet: ');
|
//console.writestring('Mouse Packet: ');
|
||||||
//console.writehexln(DWORD(packet));
|
//console.writehexln(DWORD(raw));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
|
@ -34,6 +34,7 @@ var
|
|||||||
begin
|
begin
|
||||||
//writechar('!'); // Bug traces all the way back to here - when the keyboard randomly doesn't work, this inturrupt isn't even called...
|
//writechar('!'); // Bug traces all the way back to here - when the keyboard randomly doesn't work, this inturrupt isn't even called...
|
||||||
// This needs further investigation... Is there something that can go wrong when setting up the PIC?
|
// This needs further investigation... Is there something that can go wrong when setting up the PIC?
|
||||||
|
CLI;
|
||||||
b:= inb($60);
|
b:= inb($60);
|
||||||
//console.writehexln(b);
|
//console.writehexln(b);
|
||||||
for i:=0 to MAX_HOOKS-1 do begin
|
for i:=0 to MAX_HOOKS-1 do begin
|
||||||
|
@ -25,7 +25,7 @@ implementation
|
|||||||
|
|
||||||
var
|
var
|
||||||
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
|
Hooks : Array[1..MAX_HOOKS] of pp_hook_method;
|
||||||
Cycle : uint8 = 0;
|
Cycle : uint32 = 0;
|
||||||
Mouse_Byte : Array[0..2] of uint8;
|
Mouse_Byte : Array[0..2] of uint8;
|
||||||
Packet : uint32;
|
Packet : uint32;
|
||||||
|
|
||||||
@ -65,12 +65,27 @@ end;
|
|||||||
procedure Main(); interrupt;
|
procedure Main(); interrupt;
|
||||||
var
|
var
|
||||||
i : integer;
|
i : integer;
|
||||||
|
b : byte;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Mouse_Byte[Cycle]:= mouse_read;
|
b:= mouse_read;
|
||||||
inc(Cycle);
|
if Cycle = 0 then begin
|
||||||
|
if (b AND $08) = $08 then begin
|
||||||
|
Mouse_Byte[Cycle]:= b;
|
||||||
|
inc(Cycle);
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
Mouse_Byte[Cycle]:= b;
|
||||||
|
inc(Cycle);
|
||||||
|
end;
|
||||||
if Cycle > 2 then begin
|
if Cycle > 2 then begin
|
||||||
Cycle:= 0;
|
Cycle:= 0;
|
||||||
|
// console.writestring('Packet[0]: ');
|
||||||
|
// console.writeintln(Mouse_Byte[0]);
|
||||||
|
// console.writestring('Packet[1]: ');
|
||||||
|
// console.writeintln(Mouse_Byte[1]);
|
||||||
|
// console.writestring('Packet[2]: ');
|
||||||
|
// console.writeintln(Mouse_Byte[2]);
|
||||||
Packet:= (Mouse_Byte[0] SHL 24) OR (Mouse_Byte[1] SHL 16) OR (Mouse_Byte[2] SHL 8) OR ($FF);
|
Packet:= (Mouse_Byte[0] SHL 24) OR (Mouse_Byte[1] SHL 16) OR (Mouse_Byte[2] SHL 8) OR ($FF);
|
||||||
for i:=0 to MAX_HOOKS-1 do begin
|
for i:=0 to MAX_HOOKS-1 do begin
|
||||||
if uint32(Hooks[i]) <> 0 then Hooks[i](void(Packet));
|
if uint32(Hooks[i]) <> 0 then Hooks[i](void(Packet));
|
||||||
|
@ -25,6 +25,7 @@ function stringConcat(str1, str2 : pchar) : pchar;
|
|||||||
function stringContains(str : pchar; sub : pchar) : boolean;
|
function stringContains(str : pchar; sub : pchar) : boolean;
|
||||||
function stringToInt(str : pchar) : uint32;
|
function stringToInt(str : pchar) : uint32;
|
||||||
function intToString(i : uint32) : pchar;
|
function intToString(i : uint32) : pchar;
|
||||||
|
function boolToString(b : boolean; ext : boolean) : pchar;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -150,4 +151,26 @@ begin
|
|||||||
intToString:= ' ';
|
intToString:= ' ';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function boolToString(b : boolean; ext : boolean) : pchar;
|
||||||
|
var
|
||||||
|
t : pchar;
|
||||||
|
f : pchar;
|
||||||
|
|
||||||
|
begin
|
||||||
|
if ext then begin
|
||||||
|
t:= stringCopy('true');
|
||||||
|
f:= stringCopy('false');
|
||||||
|
end else begin
|
||||||
|
t:= stringCopy('1');
|
||||||
|
f:= stringCopy('0');
|
||||||
|
end;
|
||||||
|
if b then begin
|
||||||
|
kfree(void(f));
|
||||||
|
boolToString:= t;
|
||||||
|
end else begin
|
||||||
|
kfree(void(t));
|
||||||
|
boolToString:= f;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
@ -106,6 +106,7 @@ function getParam(index : uint32; params : PParamList) : pchar;
|
|||||||
var
|
var
|
||||||
result : pchar;
|
result : pchar;
|
||||||
search : PParamList;
|
search : PParamList;
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
result:= nil;
|
result:= nil;
|
||||||
@ -182,7 +183,7 @@ end;
|
|||||||
procedure test(params : PParamList);
|
procedure test(params : PParamList);
|
||||||
begin
|
begin
|
||||||
if paramCount(params) > 0 then begin
|
if paramCount(params) > 0 then begin
|
||||||
console.writeintln(stringToInt(params^.next^.param));
|
console.writeintln(stringToInt(getParam(0, params)));
|
||||||
end else begin
|
end else begin
|
||||||
console.writestringln('Invalid number of params');
|
console.writestringln('Invalid number of params');
|
||||||
end;
|
end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user