[Fwd: [fpc-devel]Ports under Linux]
    Luis R. Hilario 
    luis at luis-digital.8m.com
       
    Tue Feb  6 04:43:27 CET 2001
    
    
  
Uses linux, ports;
// Program based on:
http://www.linuxdoc.org/HOWTO/mini/IO-Port-Programming-9.html
Const
 BASEPORT = $0378;  // Normally it is LPT1
begin
 // Get access to the ports: $0378..$037A
 if not (ioperm(BASEPORT, 3, 1)) then Halt(1);
 // Set the data signals (D0-7) of the port to all low (0)
 Port[$378] := 0;
 // Read the port of data. It must read the previous value, in this case
a zero.
 Writeln(Port[$378]);
 // We don't need the ports anymore.
 if not (ioperm(BASEPORT, 3, 0)) then Halt(1);
// Important note:
// Bit 5 of the control port ($37A) selects the direction (In or Out) of
the port of data.
end.
"Under LINUX, your program must be run as root, or the IOPerm call..."
In the documentation it must go "and" instead of "or".
-- 
 |-----------------------------|
| Luis R. Hilario               |
| http://www.luisdigital.2y.net |
 |-----------------------------|
-------------- next part --------------
An embedded message was scrubbed...
From: "Luis R. Hilario" <luis at luis-digital.8m.com>
Subject: Re: [fpc-devel]Ports under Linux
Date: Mon, 05 Feb 2001 23:04:41 -0300
Size: 2776
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20010206/7afaaa76/attachment.mht>
    
    
More information about the fpc-devel
mailing list