comp.lang.ada
 help / color / mirror / Atom feed
From: anon@att.net
Subject: Re: Low_Level_IO, what is it?
Date: Mon, 4 Jun 2012 11:55:03 +0000 (UTC)
Date: 2012-06-04T11:55:03+00:00	[thread overview]
Message-ID: <jqi7ml$jd0$1@speranza.aioe.org> (raw)
In-Reply-To: ddadb84d-e42c-490f-932d-dd4b5eb81708@h10g2000pbi.googlegroups.com

The Low_Level_IO (Ada 83) package was Ada to device package that was 
removed in "Ada 95" for a number of reason. One is that very few Ada's 
used the package because it is easier to use existing libraries for 
most I/O and just bind that routine to Ada. This was due perhaps because 
most Ada's in the 1980's and even today are not design for barebone 
operations. So, today most programmers just use In-line assembly to 
access Low_Level_IO devices.

A barebone version of "Send_Control" routine for Low_Level_IO could be 
easy as 

  procedure SEND_CONTROL ( DEVICE : device_type; DATA : in out data_type ) ;
    begin
      if DEVICE = KEYBOARD then
        ... -- output data to keyboard
      elsif DEVICE = VIDEO then
        ... --  output data to video
      elsif DEVICE = DISK then
        ... --  output data to disk
      elsif DEVICE = UART then
        ... --  output data to uart
      elsif DEVICE = ...  then
        ... --  output data to ...
      else
        raise IO_Error ; -- or some other exception
      end if ;
    end SEND_CONTROL ;


And a simple of "Send_Control" routine for Low_Level_IO or OS could look 
something like 

  procedure SEND_CONTROL ( DEVICE : device_type; DATA : in out data_type ) ;
    begin
      if DEVICE = KEYBOARD then
        ... --  get access rights to keyboard
        ... --  call OS library to output data to keyboard
      elsif DEVICE = VIDEO then
        ... --  get access rights to video
        ... --  call OS, library to output data to video
      elsif DEVICE = DISK then
        ... --  get access rights to disk
        ... --  call OS library to output data to disk
      elsif DEVICE = UART then
        ... --  get access rights to uart
        ... --  call OS library to output data to uart
      elsif DEVICE = ...  then
        ... --  get access rights to ...
        ... --  call OS library to output data to ...
      else
        raise IO_Error ; -- or some other exception
      end if ;
      ... --  release access rights to device
    exception
                  -- handle routine for access rights not granted
      when Denied_Error =>
          ...
    end SEND_CONTROL ;



In <ddadb84d-e42c-490f-932d-dd4b5eb81708@h10g2000pbi.googlegroups.com>, heresy-me@hotmail.com writes:
>Low_Level_IO, a Ada package name that I saw in some older Ada book.But
>I cannot found it in Ada12 Reference.
>What is Low_Level_IO?




      parent reply	other threads:[~2012-06-04 11:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-03 15:04 Low_Level_IO, what is it? heresy-me
     [not found] ` <c42ns75dn57ma9o2mr4mfealkn93d656g0@invalid.netcom.com>
2012-06-04  5:29   ` Yannick Duchêne (Hibou57)
2012-06-06 23:20     ` Randy Brukardt
2012-06-07  0:08     ` Adam Beneschan
2012-06-04 11:55 ` anon [this message]
replies disabled

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