[fpc-pascal] How to use UART of ARM platforms (e.g. Raspberry Pi ) through free Pascal?

Graeme Geldenhuys graeme at geldenhuys.co.uk
Wed Jul 3 18:00:28 CEST 2013


On 2013-07-03 16:44, Dennis Poon wrote:
> Michael,
> I used the synapser.pas unit but the compiler choked at line 232 at the 
> identifier 'B500000', 'B576000' .... not found.
> Any idea ?


I believe you have an outdated version on Synapse then... Here is my
version of the code snippet you posted - and it compiles fine under
Windows, Linux and FreeBSD. I must confess, I had to make a minor tweak
to my synapser.pas unit for FPC 2.6.2 under FreeBSD to compile that unit
- but that change was in a different place in the synapser.pas unit you
mentioned.


-----------------------------
const
{$IFDEF UNIX}
  {$IFDEF BSD}
  MaxRates = 18;  //MAC
  {$ELSE}
   MaxRates = 30; //UNIX
  {$ENDIF}
{$ELSE}
  MaxRates = 19;  //WIN
{$ENDIF}
  Rates: array[0..MaxRates, 0..1] of cardinal =
  (
    (0, B0),
    (50, B50),
    (75, B75),
    (110, B110),
    (134, B134),
    (150, B150),
    (200, B200),
    (300, B300),
    (600, B600),
    (1200, B1200),
    (1800, B1800),
    (2400, B2400),
    (4800, B4800),
    (9600, B9600),
    (19200, B19200),
    (38400, B38400),
    (57600, B57600),
    (115200, B115200),
    (230400, B230400)
{$IFNDEF BSD}
    ,(460800, B460800)
  {$IFDEF UNIX}
    ,(500000, B500000),
    (576000, B576000),
    (921600, B921600),
    (1000000, B1000000),
    (1152000, B1152000),
    (1500000, B1500000),
    (2000000, B2000000),
    (2500000, B2500000),
    (3000000, B3000000),
    (3500000, B3500000),
    (4000000, B4000000)
  {$ENDIF}
{$ENDIF}
    );
{$ENDIF}

{$IFDEF BSD}
const // From fcntl.h
  O_SYNC = $0080;  { synchronous writes }
{$ENDIF}

-----------------------------


Regards,
  - Graeme -




More information about the fpc-pascal mailing list