mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 12:49:20 +02:00
* moved the interface and implementation parts of the go32v2 ports unit to
include files portsh.inc and ports.inc in the i386 rtl directory git-svn-id: trunk@39397 -
This commit is contained in:
parent
5318a04a5b
commit
0ea3570b96
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -9317,6 +9317,8 @@ rtl/i386/makefile.cpu svneol=native#text/plain
|
|||||||
rtl/i386/math.inc svneol=native#text/plain
|
rtl/i386/math.inc svneol=native#text/plain
|
||||||
rtl/i386/mathu.inc svneol=native#text/plain
|
rtl/i386/mathu.inc svneol=native#text/plain
|
||||||
rtl/i386/mmx.pp svneol=native#text/plain
|
rtl/i386/mmx.pp svneol=native#text/plain
|
||||||
|
rtl/i386/ports.inc svneol=native#text/plain
|
||||||
|
rtl/i386/portsh.inc svneol=native#text/plain
|
||||||
rtl/i386/readme -text
|
rtl/i386/readme -text
|
||||||
rtl/i386/set.inc svneol=native#text/plain
|
rtl/i386/set.inc svneol=native#text/plain
|
||||||
rtl/i386/setjump.inc svneol=native#text/plain
|
rtl/i386/setjump.inc svneol=native#text/plain
|
||||||
|
@ -24,137 +24,10 @@ unit ports;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
type
|
{$I portsh.inc}
|
||||||
{$ifdef VER3_0}
|
|
||||||
tport = object
|
|
||||||
procedure writeport(p : word;data : byte);
|
|
||||||
function readport(p : word) : byte;
|
|
||||||
property pp[w : word] : byte read readport write writeport;default;
|
|
||||||
end;
|
|
||||||
|
|
||||||
tportw = object
|
implementation
|
||||||
procedure writeport(p : word;data : word);
|
|
||||||
function readport(p : word) : word;
|
|
||||||
property pp[w : word] : word read readport write writeport;default;
|
|
||||||
end;
|
|
||||||
|
|
||||||
tportl = object
|
{$I ports.inc}
|
||||||
procedure writeport(p : word;data : longint);
|
|
||||||
function readport(p : word) : longint;
|
|
||||||
property pp[w : word] : longint read readport write writeport;default;
|
|
||||||
end;
|
|
||||||
{$else VER3_0}
|
|
||||||
tport = object
|
|
||||||
procedure writeport(p : word;data : byte);inline;
|
|
||||||
function readport(p : word) : byte;inline;
|
|
||||||
property pp[w : word] : byte read readport write writeport;default;
|
|
||||||
end;
|
|
||||||
|
|
||||||
tportw = object
|
|
||||||
procedure writeport(p : word;data : word);inline;
|
|
||||||
function readport(p : word) : word;inline;
|
|
||||||
property pp[w : word] : word read readport write writeport;default;
|
|
||||||
end;
|
|
||||||
|
|
||||||
tportl = object
|
|
||||||
procedure writeport(p : word;data : longint);inline;
|
|
||||||
function readport(p : word) : longint;inline;
|
|
||||||
property pp[w : word] : longint read readport write writeport;default;
|
|
||||||
end;
|
|
||||||
{$endif VER3_0}
|
|
||||||
var
|
|
||||||
{ we don't need to initialize port, because neither member
|
|
||||||
variables nor virtual methods are accessed }
|
|
||||||
port,
|
|
||||||
portb : tport;
|
|
||||||
portw : tportw;
|
|
||||||
portl : tportl;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
{$asmmode ATT}
|
|
||||||
|
|
||||||
{ to give easy port access like tp with port[] }
|
|
||||||
|
|
||||||
{$ifdef VER3_0}
|
|
||||||
procedure tport.writeport(p : word;data : byte);assembler;
|
|
||||||
asm
|
|
||||||
movw p,%dx
|
|
||||||
movb data,%al
|
|
||||||
outb %al,%dx
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function tport.readport(p : word) : byte;assembler;
|
|
||||||
asm
|
|
||||||
movw p,%dx
|
|
||||||
inb %dx,%al
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure tportw.writeport(p : word;data : word);assembler;
|
|
||||||
asm
|
|
||||||
movw p,%dx
|
|
||||||
movw data,%ax
|
|
||||||
outw %ax,%dx
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function tportw.readport(p : word) : word;assembler;
|
|
||||||
asm
|
|
||||||
movw p,%dx
|
|
||||||
inw %dx,%ax
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure tportl.writeport(p : word;data : longint);assembler;
|
|
||||||
asm
|
|
||||||
movw p,%dx
|
|
||||||
movl data,%eax
|
|
||||||
outl %eax,%dx
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function tportl.readport(p : word) : longint;assembler;
|
|
||||||
asm
|
|
||||||
movw p,%dx
|
|
||||||
inl %dx,%eax
|
|
||||||
end;
|
|
||||||
{$else VER3_0}
|
|
||||||
procedure tport.writeport(p : word;data : byte);inline;
|
|
||||||
begin
|
|
||||||
fpc_x86_outportb(p,data);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function tport.readport(p : word) : byte;inline;
|
|
||||||
begin
|
|
||||||
readport:=fpc_x86_inportb(p);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure tportw.writeport(p : word;data : word);inline;
|
|
||||||
begin
|
|
||||||
fpc_x86_outportw(p,data);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function tportw.readport(p : word) : word;inline;
|
|
||||||
begin
|
|
||||||
readport:=fpc_x86_inportw(p);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure tportl.writeport(p : word;data : longint);inline;
|
|
||||||
begin
|
|
||||||
fpc_x86_outportl(p,data);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
function tportl.readport(p : word) : longint;inline;
|
|
||||||
begin
|
|
||||||
readport:=fpc_x86_inportl(p);
|
|
||||||
end;
|
|
||||||
{$endif VER3_0}
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
100
rtl/i386/ports.inc
Normal file
100
rtl/i386/ports.inc
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
This file is part of the Free Pascal run time library.
|
||||||
|
and implements some stuff for protected mode programming
|
||||||
|
Copyright (c) 1999-2000 by the Free Pascal development team.
|
||||||
|
|
||||||
|
These files adds support for TP styled port accesses
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
{$asmmode ATT}
|
||||||
|
|
||||||
|
{ to give easy port access like tp with port[] }
|
||||||
|
|
||||||
|
{$ifdef VER3_0}
|
||||||
|
procedure tport.writeport(p : word;data : byte);assembler;
|
||||||
|
asm
|
||||||
|
movw p,%dx
|
||||||
|
movb data,%al
|
||||||
|
outb %al,%dx
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tport.readport(p : word) : byte;assembler;
|
||||||
|
asm
|
||||||
|
movw p,%dx
|
||||||
|
inb %dx,%al
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tportw.writeport(p : word;data : word);assembler;
|
||||||
|
asm
|
||||||
|
movw p,%dx
|
||||||
|
movw data,%ax
|
||||||
|
outw %ax,%dx
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tportw.readport(p : word) : word;assembler;
|
||||||
|
asm
|
||||||
|
movw p,%dx
|
||||||
|
inw %dx,%ax
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tportl.writeport(p : word;data : longint);assembler;
|
||||||
|
asm
|
||||||
|
movw p,%dx
|
||||||
|
movl data,%eax
|
||||||
|
outl %eax,%dx
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tportl.readport(p : word) : longint;assembler;
|
||||||
|
asm
|
||||||
|
movw p,%dx
|
||||||
|
inl %dx,%eax
|
||||||
|
end;
|
||||||
|
{$else VER3_0}
|
||||||
|
procedure tport.writeport(p : word;data : byte);inline;
|
||||||
|
begin
|
||||||
|
fpc_x86_outportb(p,data);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tport.readport(p : word) : byte;inline;
|
||||||
|
begin
|
||||||
|
readport:=fpc_x86_inportb(p);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tportw.writeport(p : word;data : word);inline;
|
||||||
|
begin
|
||||||
|
fpc_x86_outportw(p,data);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tportw.readport(p : word) : word;inline;
|
||||||
|
begin
|
||||||
|
readport:=fpc_x86_inportw(p);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tportl.writeport(p : word;data : longint);inline;
|
||||||
|
begin
|
||||||
|
fpc_x86_outportl(p,data);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tportl.readport(p : word) : longint;inline;
|
||||||
|
begin
|
||||||
|
readport:=fpc_x86_inportl(p);
|
||||||
|
end;
|
||||||
|
{$endif VER3_0}
|
61
rtl/i386/portsh.inc
Normal file
61
rtl/i386/portsh.inc
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
This file is part of the Free Pascal run time library.
|
||||||
|
and implements some stuff for protected mode programming
|
||||||
|
Copyright (c) 1999-2000 by the Free Pascal development team.
|
||||||
|
|
||||||
|
These files adds support for TP styled port accesses
|
||||||
|
|
||||||
|
See the file COPYING.FPC, included in this distribution,
|
||||||
|
for details about the copyright.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
**********************************************************************}
|
||||||
|
|
||||||
|
type
|
||||||
|
{$ifdef VER3_0}
|
||||||
|
tport = object
|
||||||
|
procedure writeport(p : word;data : byte);
|
||||||
|
function readport(p : word) : byte;
|
||||||
|
property pp[w : word] : byte read readport write writeport;default;
|
||||||
|
end;
|
||||||
|
|
||||||
|
tportw = object
|
||||||
|
procedure writeport(p : word;data : word);
|
||||||
|
function readport(p : word) : word;
|
||||||
|
property pp[w : word] : word read readport write writeport;default;
|
||||||
|
end;
|
||||||
|
|
||||||
|
tportl = object
|
||||||
|
procedure writeport(p : word;data : longint);
|
||||||
|
function readport(p : word) : longint;
|
||||||
|
property pp[w : word] : longint read readport write writeport;default;
|
||||||
|
end;
|
||||||
|
{$else VER3_0}
|
||||||
|
tport = object
|
||||||
|
procedure writeport(p : word;data : byte);inline;
|
||||||
|
function readport(p : word) : byte;inline;
|
||||||
|
property pp[w : word] : byte read readport write writeport;default;
|
||||||
|
end;
|
||||||
|
|
||||||
|
tportw = object
|
||||||
|
procedure writeport(p : word;data : word);inline;
|
||||||
|
function readport(p : word) : word;inline;
|
||||||
|
property pp[w : word] : word read readport write writeport;default;
|
||||||
|
end;
|
||||||
|
|
||||||
|
tportl = object
|
||||||
|
procedure writeport(p : word;data : longint);inline;
|
||||||
|
function readport(p : word) : longint;inline;
|
||||||
|
property pp[w : word] : longint read readport write writeport;default;
|
||||||
|
end;
|
||||||
|
{$endif VER3_0}
|
||||||
|
var
|
||||||
|
{ we don't need to initialize port, because neither member
|
||||||
|
variables nor virtual methods are accessed }
|
||||||
|
port,
|
||||||
|
portb : tport;
|
||||||
|
portw : tportw;
|
||||||
|
portl : tportl;
|
Loading…
Reference in New Issue
Block a user