mirror of
https://github.com/vapaamies/KolibriOS.git
synced 2025-09-21 02:30:07 +02:00
Debug board support in KoW
This commit is contained in:
@@ -14,10 +14,50 @@ type
|
||||
szCSDVersion: array[0..127] of KolibriChar;
|
||||
end;
|
||||
|
||||
const
|
||||
BoardLog = 'BOARDLOG.TXT';
|
||||
|
||||
var
|
||||
hBoard: THandle;
|
||||
DebugReadPos: UInt64;
|
||||
|
||||
function GetFileSizeEx(hFile: THandle; var FileSize: UInt64): LongBool; stdcall;
|
||||
external kernel32 name 'GetFileSizeEx';
|
||||
function GetVersionExA(var Info: TOSVersionInfoA): LongBool; stdcall;
|
||||
external kernel32 name 'GetVersionExA';
|
||||
function SetFilePointerEx(hFile: THandle; Distance: Int64; NewFilePtr: PUInt64; Method: LongWord): LongBool; stdcall;
|
||||
external kernel32 name 'SetFilePointerEx';
|
||||
|
||||
function InitBoard: Boolean;
|
||||
begin
|
||||
if hBoard = 0 then
|
||||
begin
|
||||
hBoard := CreateFileA(BoardLog, GENERIC_READ or GENERIC_WRITE,
|
||||
FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_ALWAYS, 0, 0);
|
||||
Result := hBoard <> INVALID_HANDLE_VALUE;
|
||||
end
|
||||
else
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function DebugRead(var Data: KolibriChar): Boolean; stdcall;
|
||||
var
|
||||
BytesRead: LongWord;
|
||||
begin
|
||||
Result := InitBoard and SetFilePointerEx(hBoard, DebugReadPos, @DebugReadPos, FILE_BEGIN) and
|
||||
ReadFile(hBoard, Data, SizeOf(Data), BytesRead, nil) and (BytesRead <> 0);
|
||||
Inc(DebugReadPos, BytesRead);
|
||||
end;
|
||||
|
||||
procedure DebugWrite(Data: KolibriChar); stdcall;
|
||||
var
|
||||
BytesWritten: LongWord;
|
||||
begin
|
||||
if not InitBoard or not SetFilePointerEx(hBoard, 0, nil, FILE_END) or
|
||||
not System.WriteFile(hBoard, Data, SizeOf(Data), BytesWritten, nil) or (BytesWritten = 0)
|
||||
then
|
||||
RunError(ERROR_ACCESS_DENIED);
|
||||
end;
|
||||
|
||||
procedure ExitThread; stdcall;
|
||||
begin
|
||||
|
@@ -543,8 +543,10 @@ const
|
||||
{62.8} function WritePCIByte(Bus, Device, Func, Reg: Byte; Data: Byte): LongWord; stdcall;
|
||||
{62.9} function WritePCIWord(Bus, Device, Func, Reg: Byte; Data: Word): LongWord; stdcall;
|
||||
{62.10} function WritePCILongWord(Bus, Device, Func, Reg: Byte; Data: LongWord): LongWord; stdcall;
|
||||
{$ENDIF}
|
||||
{63.1} procedure DebugWrite(Data: KolibriChar); stdcall;
|
||||
{63.2} function DebugRead(var Data: KolibriChar): Boolean; stdcall;
|
||||
{$IFDEF KolibriOS}
|
||||
{64} function ReallocAppMemory(Count: LongWord): LongInt; stdcall;
|
||||
{65} procedure DrawImageEx(const Image; Left, Top: LongInt; Width, Height, BPP: LongWord; Palette: Pointer; Padding: LongWord); stdcall;
|
||||
{66.1} procedure SetKeyboardInputMode(Mode: LongWord); stdcall;
|
||||
|
Reference in New Issue
Block a user