[fpc-pascal] One experience with the unit serial

"Vinzent Höfler" JeLlyFish.software at gmx.net
Thu Nov 19 21:48:08 CET 2009


Holger Bruns <holger.bruns at gmx.net>:

> > Despite queues an baud rates, you must expect data loss.  You will
> > loss data in the physical layer. You have to implement some handshake
> > to prevent it. (using google translator, excuse my english).
> 
> Which can be done through a direct port access and some lines of code in 
> assembler language.

And by configuring the device correctly (which really can get nasty sometimes). You may take a look at Synapse' source code to get an idea.

> The second idea I have is the use of the device 
> files /dev/ttySx, but how can these files be used to get access to all 
> of the registers of an uart?

By writing a device driver. That's what works behind /dev/ttySx. Someone already did it for you, you just have to use it correctly. Believe me, I know what I'm talking about, I've been on both sides of the fence.
I also successfully used serial ports ("/dev/ttyMx" for that matter, Moxa C168H multi-port devices) in a multi-threaded application written in FreePascal using Synapse.

Please, stop whining about ports, iopl, and UART registers, and using C instead - and start doing it right by reading the available documentation.

Linux is based on an operating system invented in the 60ies of the last century. That means, it does not support such modern things like direct hardware accesses, single tasking, and single users. Instead it is based on the obviously totally flawed concept of having multiple users and applications at the same time with the added overhead of task switching and all that stuff. Which also means, it has to protect things against getting garbled - like when sane, understanding and being able to learn programmers would program UARTs at the register level.

The last paragraph was pure irony, of course. Just in case, someone wondered.


Vinzent.

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the fpc-pascal mailing list