[fpc-pascal] accessing hardware ports in FPC

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Tue May 22 09:48:54 CEST 2007


On 5/18/07, Daniƫl Mantione <daniel.mantione at freepascal.org> wrote:
> Can you please implement a ports unit for Windows then?

This requires writing a Device Driver for NT.... and later you need to
take it with your executable somehow.

> The last thing we need is people to start using OS specific code.

OS specific code is not a devil. Sometimes it's necessary. Ports alone
won't work on linux also, by the way. You also need to call ioperm and
run your software as root. (some docs say you need to do one or the
other, but I tested with real hardware, and it never worked unless I
did both).

To make ports work on linux without ioperm you would need to make the
ioperm call inside ports getter and setter methods, which can be
significant overhead for software that need to reliably access
hardware every microsecond for example.

-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list