[Ada] More data rates supported on Linux
authorBob Duff <duff@adacore.com>
Mon, 8 Jul 2019 08:13:38 +0000 (08:13 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 8 Jul 2019 08:13:38 +0000 (08:13 +0000)
This patch adds additional data rates to the GNAT.Serial_Communications
package (Linux version).

2019-07-08  Bob Duff  <duff@adacore.com>

gcc/ada/

* libgnat/g-sercom.ads, libgnat/g-sercom__linux.adb (Data_Rate):
Support additional data rates.

From-SVN: r273208

gcc/ada/ChangeLog
gcc/ada/libgnat/g-sercom.ads
gcc/ada/libgnat/g-sercom__linux.adb

index 81ef99e4be57dc46b5ce10c34a2a81a34f9045bf..3bbc1cfc5da2496a8e704f0ce372a07bcb885ab2 100644 (file)
@@ -1,3 +1,8 @@
+2019-07-08  Bob Duff  <duff@adacore.com>
+
+       * libgnat/g-sercom.ads, libgnat/g-sercom__linux.adb (Data_Rate):
+       Support additional data rates.
+
 2019-07-08  Olivier Hainque  <hainque@adacore.com>
 
        * gcc-interface/trans.c (Compilation_Unit_to_gnu): Don't request
index 8550e8dd9d21d70f184336e54819c519843094c8..e807dababaa2e8703930376de51c220616f50a72 100644 (file)
@@ -100,8 +100,13 @@ package GNAT.Serial_Communications is
    --  cases, an explicit port name can be passed directly to Open.
 
    type Data_Rate is
-     (B75, B110, B150, B300, B600, B1200, B2400, B4800, B9600,
-      B19200, B38400, B57600, B115200);
+     (B75, B110, B150, B300, B600, B1200,
+      B2400, B4800, B9600,
+      B19200, B38400, B57600, B115200,
+      B230400, B460800, B500000, B576000, B921600,
+      B1000000, B1152000, B1500000,
+      B2000000, B2500000, B3000000,
+      B3500000, B4000000);
    --  Speed of the communication
 
    type Data_Bits is (CS8, CS7);
@@ -173,18 +178,31 @@ private
    end record;
 
    Data_Rate_Value : constant array (Data_Rate) of Interfaces.C.unsigned :=
-                       (B75     =>      75,
-                        B110    =>     110,
-                        B150    =>     150,
-                        B300    =>     300,
-                        B600    =>     600,
-                        B1200   =>   1_200,
-                        B2400   =>   2_400,
-                        B4800   =>   4_800,
-                        B9600   =>   9_600,
-                        B19200  =>  19_200,
-                        B38400  =>  38_400,
-                        B57600  =>  57_600,
-                        B115200 => 115_200);
+                       (B75      =>        75,
+                        B110     =>       110,
+                        B150     =>       150,
+                        B300     =>       300,
+                        B600     =>       600,
+                        B1200    =>     1_200,
+                        B2400    =>     2_400,
+                        B4800    =>     4_800,
+                        B9600    =>     9_600,
+                        B19200   =>    19_200,
+                        B38400   =>    38_400,
+                        B57600   =>    57_600,
+                        B115200  =>   115_200,
+                        B230400  =>   230_400,
+                        B460800  =>   460_800,
+                        B500000  =>   500_000,
+                        B576000  =>   576_000,
+                        B921600  =>   921_600,
+                        B1000000 => 1_000_000,
+                        B1152000 => 1_152_000,
+                        B1500000 => 1_500_000,
+                        B2000000 => 2_000_000,
+                        B2500000 => 2_500_000,
+                        B3000000 => 3_000_000,
+                        B3500000 => 3_500_000,
+                        B4000000 => 4_000_000);
 
 end GNAT.Serial_Communications;
index 93bc793a9232c43be53abd64a613d8d73edc5238..f116aeae90f5a464fe1ab56b2e211cae445e1ddd 100644 (file)
@@ -58,19 +58,32 @@ package body GNAT.Serial_Communications is
    pragma Import (C, fcntl, "fcntl");
 
    C_Data_Rate : constant array (Data_Rate) of unsigned :=
-                   (B75     => OSC.B75,
-                    B110    => OSC.B110,
-                    B150    => OSC.B150,
-                    B300    => OSC.B300,
-                    B600    => OSC.B600,
-                    B1200   => OSC.B1200,
-                    B2400   => OSC.B2400,
-                    B4800   => OSC.B4800,
-                    B9600   => OSC.B9600,
-                    B19200  => OSC.B19200,
-                    B38400  => OSC.B38400,
-                    B57600  => OSC.B57600,
-                    B115200 => OSC.B115200);
+                   (B75      => OSC.B75,
+                    B110     => OSC.B110,
+                    B150     => OSC.B150,
+                    B300     => OSC.B300,
+                    B600     => OSC.B600,
+                    B1200    => OSC.B1200,
+                    B2400    => OSC.B2400,
+                    B4800    => OSC.B4800,
+                    B9600    => OSC.B9600,
+                    B19200   => OSC.B19200,
+                    B38400   => OSC.B38400,
+                    B57600   => OSC.B57600,
+                    B115200  => OSC.B115200,
+                    B230400  => OSC.B230400,
+                    B460800  => OSC.B460800,
+                    B500000  => OSC.B500000,
+                    B576000  => OSC.B576000,
+                    B921600  => OSC.B921600,
+                    B1000000 => OSC.B1000000,
+                    B1152000 => OSC.B1152000,
+                    B1500000 => OSC.B1500000,
+                    B2000000 => OSC.B2000000,
+                    B2500000 => OSC.B2500000,
+                    B3000000 => OSC.B3000000,
+                    B3500000 => OSC.B3500000,
+                    B4000000 => OSC.B4000000);
 
    C_Bits      : constant array (Data_Bits) of unsigned :=
                    (CS7 => OSC.CS7, CS8 => OSC.CS8);