[fpc-pascal] problem setting up serial port

Marc Santhoff M.Santhoff at t-online.de
Sat Mar 11 00:51:52 CET 2006


Hi again,

from trying and decoding error messages I know the call to tcsetattr
fails with an invalid input. The problem is caused by trying to set the
field termios.c_ospeed, if left out the call is successfull. So I went
the way trough the sources and have found something.

On FreeBSD 4.11 termios is defined like this:

/usr/include/termios.h -> sys/termios.h

struct termios {
	tcflag_t	c_iflag;	/* input flags */
	tcflag_t	c_oflag;	/* output flags */
	tcflag_t	c_cflag;	/* control flags */
	tcflag_t	c_lflag;	/* local flags */
	cc_t		c_cc[NCCS];	/* control chars */
	speed_t		c_ispeed;	/* input speed */
	speed_t		c_ospeed;	/* output speed */
};


The fpc source file "" defines it as:

<fpc-2.0.2>/share/src/fpc-2.0.2/rtl/freebsd/termios.inc

type
  Termios = packed record
    c_iflag,
    c_oflag,
    c_cflag,
    c_lflag  : longint;
    c_line   : char;
    c_cc     : array[0..NCCS-1] of byte;
   {$IFDEF BSD}
    c_ispeed,
    c_ospeed : longint;
   {$endif}
  end;
  TTermios=Termios;

Note the line in pascal saying "c_line: char" which is missing in the
systems declaration. This is an error, insn't it?

Marc





More information about the fpc-pascal mailing list