OSDN Git Service

2008-04-08 Ed Schonberg <schonberg@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-winext.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                        GNAT RUN-TIME COMPONENTS                          --
4 --                                                                          --
5 --                     S Y S T E M . W I N 3 2 . E X T                      --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --            Copyright (C) 2008, Free Software Foundation, Inc.            --
10 --                                                                          --
11 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
12 -- terms of the  GNU General Public License as published  by the Free Soft- --
13 -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
14 -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
17 -- for  more details.  You should have  received  a copy of the GNU General --
18 -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
19 -- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
20 -- Boston, MA 02110-1301, USA.                                              --
21 --                                                                          --
22 -- As a special exception,  if other files  instantiate  generics from this --
23 -- unit, or you link  this unit with other files  to produce an executable, --
24 -- this  unit  does not  by itself cause  the resulting  executable  to  be --
25 -- covered  by the  GNU  General  Public  License.  This exception does not --
26 -- however invalidate  any other reasons why  the executable file  might be --
27 -- covered by the  GNU Public License.                                      --
28 --                                                                          --
29 -- GNAT was originally developed  by the GNAT team at  New York University. --
30 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
31 --                                                                          --
32 ------------------------------------------------------------------------------
33
34 --  This package provides the part of the low level Win32 interface which is
35 --  not supported by RTX (but supported by regular Windows platforms).
36
37 package System.Win32.Ext is
38    pragma Pure;
39
40    ---------------------
41    -- Time Management --
42    ---------------------
43
44    function QueryPerformanceFrequency
45      (lpFrequency : access LARGE_INTEGER) return Win32.BOOL;
46    pragma Import
47      (Stdcall, QueryPerformanceFrequency, "QueryPerformanceFrequency");
48
49    ---------------
50    -- Processor --
51    ---------------
52
53    function SetThreadIdealProcessor
54      (hThread          : HANDLE;
55       dwIdealProcessor : ProcessorId) return DWORD;
56    pragma Import (Stdcall, SetThreadIdealProcessor, "SetThreadIdealProcessor");
57
58    --------------
59    -- Com Port --
60    --------------
61
62    DTR_CONTROL_DISABLE : constant := 16#0#;
63    RTS_CONTROL_DISABLE : constant := 16#0#;
64    NOPARITY            : constant := 0;
65    ODDPARITY           : constant := 1;
66    EVENPARITY          : constant := 2;
67    ONESTOPBIT          : constant := 0;
68    TWOSTOPBITS         : constant := 2;
69
70    type DCB is record
71       DCBLENGTH         : DWORD;
72       BaudRate          : DWORD;
73       fBinary           : Bits1;
74       fParity           : Bits1;
75       fOutxCtsFlow      : Bits1;
76       fOutxDsrFlow      : Bits1;
77       fDtrControl       : Bits2;
78       fDsrSensitivity   : Bits1;
79       fTXContinueOnXoff : Bits1;
80       fOutX             : Bits1;
81       fInX              : Bits1;
82       fErrorChar        : Bits1;
83       fNull             : Bits1;
84       fRtsControl       : Bits2;
85       fAbortOnError     : Bits1;
86       fDummy2           : Bits17;
87       wReserved         : WORD;
88       XonLim            : WORD;
89       XoffLim           : WORD;
90       ByteSize          : BYTE;
91       Parity            : BYTE;
92       StopBits          : BYTE;
93       XonChar           : CHAR;
94       XoffChar          : CHAR;
95       ErrorChar         : CHAR;
96       EofChar           : CHAR;
97       EvtChar           : CHAR;
98       wReserved1        : WORD;
99    end record;
100    pragma Convention (C, DCB);
101
102    for DCB use record
103       DCBLENGTH         at  0 range 0 .. 31;
104       BaudRate          at  4 range 0 .. 31;
105       fBinary           at  8 range 0 .. 0;
106       fParity           at  8 range 1 .. 1;
107       fOutxCtsFlow      at  8 range 2 .. 2;
108       fOutxDsrFlow      at  8 range 3 .. 3;
109       fDtrControl       at  8 range 4 .. 5;
110       fDsrSensitivity   at  8 range 6 .. 6;
111       fTXContinueOnXoff at  8 range 7 .. 7;
112       fOutX             at  9 range 0 .. 0;
113       fInX              at  9 range 1 .. 1;
114       fErrorChar        at  9 range 2 .. 2;
115       fNull             at  9 range 3 .. 3;
116       fRtsControl       at  9 range 4 .. 5;
117       fAbortOnError     at  9 range 6 .. 6;
118       fDummy2           at  9 range 7 .. 23;
119       wReserved         at 12 range 0 .. 15;
120       XonLim            at 14 range 0 .. 15;
121       XoffLim           at 16 range 0 .. 15;
122       ByteSize          at 18 range 0 .. 7;
123       Parity            at 19 range 0 .. 7;
124       StopBits          at 20 range 0 .. 7;
125       XonChar           at 21 range 0 .. 7;
126       XoffChar          at 22 range 0 .. 7;
127       ErrorChar         at 23 range 0 .. 7;
128       EofChar           at 24 range 0 .. 7;
129       EvtChar           at 25 range 0 .. 7;
130       wReserved1        at 26 range 0 .. 15;
131    end record;
132
133    type COMMTIMEOUTS is record
134       ReadIntervalTimeout         : DWORD;
135       ReadTotalTimeoutMultiplier  : DWORD;
136       ReadTotalTimeoutConstant    : DWORD;
137       WriteTotalTimeoutMultiplier : DWORD;
138       WriteTotalTimeoutConstant   : DWORD;
139    end record;
140    pragma Convention (C, COMMTIMEOUTS);
141
142    function GetCommState
143      (hFile : HANDLE;
144       lpDCB : access DCB) return BOOL;
145    pragma Import (Stdcall, GetCommState, "GetCommState");
146
147    function SetCommState
148      (hFile : HANDLE;
149       lpDCB : access DCB) return BOOL;
150    pragma Import (Stdcall, SetCommState, "SetCommState");
151
152    function SetCommTimeouts
153      (hFile          : HANDLE;
154       lpCommTimeouts : access COMMTIMEOUTS) return BOOL;
155    pragma Import (Stdcall, SetCommTimeouts, "SetCommTimeouts");
156
157 end System.Win32.Ext;