comp.lang.ada
 help / color / mirror / Atom feed
From: Per Sandberg <per.s.sandberg@bahnhof.se>
Subject: Re: file descriptor of a serial port
Date: Mon, 20 Aug 2018 21:52:26 +0200
Date: 2018-08-20T21:52:26+02:00	[thread overview]
Message-ID: <_ZEeD.60176$4w.12143@fx44.am4> (raw)
In-Reply-To: <e74e035c-0790-4800-975c-15d621798049@googlegroups.com>

Why don't patch your own "GNAT.Serial_Communications" and put in your 
own projects sources.
--------------------------------------------------------------------
package GNAT.Serial_Communications is
...
    type Data_Rate is
      (B75, B110, B150, B300, B600, B1200, B2400, B4800, B9600,
       B19200, B38400, B57600, B100000, B115200);
...
private
...
    Data_Rate_Value : constant array (Data_Rate) of 
Interfaces.C.unsigned ...
                         B57600  =>  57_600,
                         B100000 => 100_000,
                         B115200 => 115_200);

end GNAT.Serial_Communications;
--------------------------------------------------------------------
package body GNAT.Serial_Communications is
...
    C_Data_Rate : constant array (Data_Rate) of unsigned :=
...
                     B57600  => OSC.B57600,
                     B100000 => 0010010, --<<bits/termios.h:162
                     B115200 => OSC.B115200);
...
end GNAT.Serial_Communications;
--------------------------------------------------------------------
project Serial_Mess is
    for Source_Dirs use ("src");
    for Object_Dir use ".obj";
    for Main use ("main.adb");

    package Compiler is
       for Switches ("g-sercom.adb") use ("-gnatg");
    end Compiler;
end Serial_Mess;
--------------------------------------------------------------------
And you are done.

Did the same thing some years ago for B75 before it was implemented in 
the distributed Run-times.
/P



On 08/20/18 15:56, jan.de.kruyf@gmail.com wrote:
> Hallo,
> 
> I try to set up a custom baudrate on a serial port, which I believe is done with the C ioctl procedure.
> 
> However, for that I need the fd of the serial port which is hidden in the private part of GNAT.Serial_Communications.
> 
> I tried to construct a child package of GNAT.Serial_Communications but the compiler does not like that, since it does not actually compile that package.
> 
> Has anybody any idea?
> 
> Thanks,
> 
> Jan de Kruijf.
> 

  parent reply	other threads:[~2018-08-20 19:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-20 13:56 file descriptor of a serial port jan.de.kruyf
2018-08-20 14:21 ` J-P. Rosen
2018-08-20 14:33   ` jan.de.kruyf
2018-08-20 14:58     ` joakimds
2018-08-20 15:12       ` jan.de.kruyf
2018-08-20 16:36     ` Dmitry A. Kazakov
2018-08-20 19:10       ` jan.de.kruyf
2018-08-20 19:26         ` Dmitry A. Kazakov
2018-08-21  7:09           ` jan.de.kruyf
2018-08-20 15:17 ` Björn Lundin
2018-08-20 15:41   ` jan.de.kruyf
2018-08-20 19:52 ` Per Sandberg [this message]
2018-08-21  7:19   ` jan.de.kruyf
2018-08-22  7:03     ` jan.de.kruyf
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox