Back to home page

LXR

 
 

    


Warning, /cpukit/include/adainclude/rtems-io.adb is written in an unsupported language. File is not indexed.

0001 -- SPDX-License-Identifier: BSD-2-Clause
0002 
0003 --
0004 --  RTEMS / Body
0005 --
0006 --  DESCRIPTION:
0007 --
0008 --  This package provides the interface to the RTEMS API.
0009 --
0010 --
0011 --  DEPENDENCIES:
0012 --
0013 --
0014 --
0015 --  COPYRIGHT (c) 1997-2011.
0016 --  On-Line Applications Research Corporation (OAR).
0017 --
0018 --  Redistribution and use in source and binary forms, with or without
0019 --  modification, are permitted provided that the following conditions
0020 --  are met:
0021 --  1. Redistributions of source code must retain the above copyright
0022 --     notice, this list of conditions and the following disclaimer.
0023 --  2. Redistributions in binary form must reproduce the above copyright
0024 --     notice, this list of conditions and the following disclaimer in the
0025 --     documentation and/or other materials provided with the distribution.
0026 --
0027 --  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0028 --  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0029 --  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0030 --  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0031 --  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0032 --  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0033 --  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0034 --  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0035 --  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0036 --  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0037 --  POSSIBILITY OF SUCH DAMAGE.
0038 --
0039 
0040 with Ada;
0041 with Ada.Unchecked_Conversion;
0042 with Interfaces;               use Interfaces;
0043 with Interfaces.C;             use Interfaces.C;
0044 with Interfaces.C.Strings;     use Interfaces.C.Strings;
0045 
0046 package body RTEMS.IO is
0047 
0048    --
0049    -- Input/Output Manager
0050    --
0051 
0052    procedure Register_Name
0053      (Name   : in String;
0054       Major  : in RTEMS.Device_Major_Number;
0055       Minor  : in RTEMS.Device_Minor_Number;
0056       Result : out RTEMS.Status_Codes)
0057    is
0058       function Register_Name_Base
0059         (Name  : Interfaces.C.char_array;
0060          Major : RTEMS.Device_Major_Number;
0061          Minor : RTEMS.Device_Minor_Number)
0062          return  RTEMS.Status_Codes;
0063       pragma Import (C, Register_Name_Base, "rtems_io_register_name");
0064    begin
0065 
0066       Result := Register_Name_Base (Interfaces.C.To_C (Name), Major, Minor);
0067 
0068    end Register_Name;
0069 
0070    procedure Open
0071      (Major    : in RTEMS.Device_Major_Number;
0072       Minor    : in RTEMS.Device_Minor_Number;
0073       Argument : in RTEMS.Address;
0074       Result   : out RTEMS.Status_Codes)
0075    is
0076       function Open_Base
0077         (Major    : RTEMS.Device_Major_Number;
0078          Minor    : RTEMS.Device_Minor_Number;
0079          Argument : RTEMS.Address)
0080          return     RTEMS.Status_Codes;
0081       pragma Import (C, Open_Base, "rtems_io_open");
0082    begin
0083 
0084       Result := Open_Base (Major, Minor, Argument);
0085 
0086    end Open;
0087    pragma Inline (Open);
0088 
0089    procedure Close
0090      (Major    : in RTEMS.Device_Major_Number;
0091       Minor    : in RTEMS.Device_Minor_Number;
0092       Argument : in RTEMS.Address;
0093       Result   : out RTEMS.Status_Codes)
0094    is
0095       function Close_Base
0096         (Major    : RTEMS.Device_Major_Number;
0097          Minor    : RTEMS.Device_Minor_Number;
0098          Argument : RTEMS.Address)
0099          return     RTEMS.Status_Codes;
0100       pragma Import (C, Close_Base, "rtems_io_close");
0101    begin
0102 
0103       Result := Close_Base (Major, Minor, Argument);
0104 
0105    end Close;
0106    pragma Inline (Close);
0107 
0108    procedure Read
0109      (Major    : in RTEMS.Device_Major_Number;
0110       Minor    : in RTEMS.Device_Minor_Number;
0111       Argument : in RTEMS.Address;
0112       Result   : out RTEMS.Status_Codes)
0113    is
0114       function Read_Base
0115         (Major    : RTEMS.Device_Major_Number;
0116          Minor    : RTEMS.Device_Minor_Number;
0117          Argument : RTEMS.Address)
0118          return     RTEMS.Status_Codes;
0119       pragma Import (C, Read_Base, "rtems_io_read");
0120    begin
0121 
0122       Result := Read_Base (Major, Minor, Argument);
0123 
0124    end Read;
0125    pragma Inline (Read);
0126 
0127    procedure Write
0128      (Major    : in RTEMS.Device_Major_Number;
0129       Minor    : in RTEMS.Device_Minor_Number;
0130       Argument : in RTEMS.Address;
0131       Result   : out RTEMS.Status_Codes)
0132    is
0133       function Write_Base
0134         (Major    : RTEMS.Device_Major_Number;
0135          Minor    : RTEMS.Device_Minor_Number;
0136          Argument : RTEMS.Address)
0137          return     RTEMS.Status_Codes;
0138       pragma Import (C, Write_Base, "rtems_io_write");
0139    begin
0140 
0141       Result := Write_Base (Major, Minor, Argument);
0142 
0143    end Write;
0144    pragma Inline (Write);
0145 
0146    procedure Control
0147      (Major    : in RTEMS.Device_Major_Number;
0148       Minor    : in RTEMS.Device_Minor_Number;
0149       Argument : in RTEMS.Address;
0150       Result   : out RTEMS.Status_Codes)
0151    is
0152       function Control_Base
0153         (Major    : RTEMS.Device_Major_Number;
0154          Minor    : RTEMS.Device_Minor_Number;
0155          Argument : RTEMS.Address)
0156          return     RTEMS.Status_Codes;
0157       pragma Import (C, Control_Base, "rtems_io_control");
0158    begin
0159 
0160       Result := Control_Base (Major, Minor, Argument);
0161 
0162    end Control;
0163    pragma Inline (Control);
0164 
0165 end RTEMS.IO;