File : 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) 2009-2011, 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 3,  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.                                     --
  17 --                                                                          --
  18 --                                                                          --
  19 --                                                                          --
  20 --                                                                          --
  21 --                                                                          --
  22 -- You should have received a copy of the GNU General Public License and    --
  23 -- a copy of the GCC Runtime Library Exception along with this program;     --
  24 -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
  25 -- <http://www.gnu.org/licenses/>.                                          --
  26 --                                                                          --
  27 -- GNAT was originally developed  by the GNAT team at  New York University. --
  28 -- Extensive contributions were provided by Ada Core Technologies Inc.      --
  29 --                                                                          --
  30 ------------------------------------------------------------------------------
  31 
  32 --  This package provides the part of the low level Win32 interface which is
  33 --  not supported by RTX (but supported by regular Windows platforms).
  34 
  35 package System.Win32.Ext is
  36    pragma Pure;
  37 
  38    ---------------------
  39    -- Time Management --
  40    ---------------------
  41 
  42    function QueryPerformanceFrequency
  43      (lpFrequency : access LARGE_INTEGER) return Win32.BOOL;
  44    pragma Import
  45      (Stdcall, QueryPerformanceFrequency, "QueryPerformanceFrequency");
  46 
  47    ---------------
  48    -- Processor --
  49    ---------------
  50 
  51    function SetThreadIdealProcessor
  52      (hThread          : HANDLE;
  53       dwIdealProcessor : ProcessorId) return DWORD;
  54    pragma Import (Stdcall, SetThreadIdealProcessor, "SetThreadIdealProcessor");
  55 
  56    function SetThreadAffinityMask
  57      (hThread              : HANDLE;
  58       dwThreadAffinityMask : DWORD) return DWORD;
  59    pragma Import (Stdcall, SetThreadAffinityMask, "SetThreadAffinityMask");
  60 
  61    --------------
  62    -- Com Port --
  63    --------------
  64 
  65    DTR_CONTROL_DISABLE : constant := 16#0#;
  66    RTS_CONTROL_DISABLE : constant := 16#0#;
  67    NOPARITY            : constant := 0;
  68    ODDPARITY           : constant := 1;
  69    EVENPARITY          : constant := 2;
  70    ONESTOPBIT          : constant := 0;
  71    TWOSTOPBITS         : constant := 2;
  72 
  73    type DCB is record
  74       DCBLENGTH         : DWORD;
  75       BaudRate          : DWORD;
  76       fBinary           : Bits1;
  77       fParity           : Bits1;
  78       fOutxCtsFlow      : Bits1;
  79       fOutxDsrFlow      : Bits1;
  80       fDtrControl       : Bits2;
  81       fDsrSensitivity   : Bits1;
  82       fTXContinueOnXoff : Bits1;
  83       fOutX             : Bits1;
  84       fInX              : Bits1;
  85       fErrorChar        : Bits1;
  86       fNull             : Bits1;
  87       fRtsControl       : Bits2;
  88       fAbortOnError     : Bits1;
  89       fDummy2           : Bits17;
  90       wReserved         : WORD;
  91       XonLim            : WORD;
  92       XoffLim           : WORD;
  93       ByteSize          : BYTE;
  94       Parity            : BYTE;
  95       StopBits          : BYTE;
  96       XonChar           : CHAR;
  97       XoffChar          : CHAR;
  98       ErrorChar         : CHAR;
  99       EofChar           : CHAR;
 100       EvtChar           : CHAR;
 101       wReserved1        : WORD;
 102    end record;
 103    pragma Convention (C, DCB);
 104    pragma Pack (DCB);
 105 
 106    type COMMTIMEOUTS is record
 107       ReadIntervalTimeout         : DWORD;
 108       ReadTotalTimeoutMultiplier  : DWORD;
 109       ReadTotalTimeoutConstant    : DWORD;
 110       WriteTotalTimeoutMultiplier : DWORD;
 111       WriteTotalTimeoutConstant   : DWORD;
 112    end record;
 113    pragma Convention (C, COMMTIMEOUTS);
 114 
 115    function GetCommState
 116      (hFile : HANDLE;
 117       lpDCB : access DCB) return BOOL;
 118    pragma Import (Stdcall, GetCommState, "GetCommState");
 119 
 120    function SetCommState
 121      (hFile : HANDLE;
 122       lpDCB : access DCB) return BOOL;
 123    pragma Import (Stdcall, SetCommState, "SetCommState");
 124 
 125    function SetCommTimeouts
 126      (hFile          : HANDLE;
 127       lpCommTimeouts : access COMMTIMEOUTS) return BOOL;
 128    pragma Import (Stdcall, SetCommTimeouts, "SetCommTimeouts");
 129 
 130 end System.Win32.Ext;