[fpc-pascal] Access to RS232 ports with fpc
holger.bruns at gmx.net
Mon Nov 2 15:42:47 CET 2009
Bernd Mueller schrieb:
> Holger Bruns wrote:
>> Holger Bruns schrieb:
>>> I try to implement a direct port access. If this also leads to
>>> access errors, I should give it up. Embarassing.
>> Accessing ports is limited to ports < 03ffh, more ports cannot be
>> released with fpioperm. This means to me, successful serial port
>> access on higher addresses cannot yet be implemented with fpc. If
>> this policy can be ruled out, let me know.
> so you must use a very special serial hardware which is located on io
> address higher than $3ff. Seems unlikely to me. In your former post,
> you tried to access io address 1000 (decimal) this is $3e8
> (hexadecimal) and should be an ordinary COM3. May be you are mixing up
> decimal vs. hexadecimal notation.
No, the "1000" means the size of a buffer, not a part address. The port
address I try to use is 0xEC00, which is the base address for an UART on
a PCI card. Linux sees this UART as /dev/ttyS2. Accessing the registers
direcly should be easy, because 3 lines of assembler code should do this
function readport (portaddress: word): byte;
mov %dx, portaddress
mov readport, %al
As long as the pascal syntax and the assembler syntax (instruction
destination source) are both correct for fpc, this function should
return the value of the selected port. This is all, what I try to do.
Best regards, Holger
More information about the fpc-pascal