comp.lang.ada
 help / color / mirror / Atom feed
* Low Level IO
@ 1998-08-06  0:00 JOSE VICENTE
  1998-08-06  0:00 ` Samuel Tardieu
  1998-08-07  0:00 ` Tarjei Tj�stheim Jensen
  0 siblings, 2 replies; 4+ messages in thread
From: JOSE VICENTE @ 1998-08-06  0:00 UTC (permalink / raw)


Does anyone know how can I read/write the parallel port using Linux and Gnat
3.10 ?
I've been trying things like this and 'Storage Error' or 'Program Error'
raises.
    ......
    type Byte is mod 2**8;
    for Byte'Size use 8;
    Parallel_Port:Byte;
    for Parallel_Port'Address use
System.Storage_Elements.To_Address(16#3BC#);
    ......
    begin
    ......
    Parallel_Port:=value;    -- The exception raises at this point.
    ......
Thanks in advance.









^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Low Level IO
  1998-08-06  0:00 Low Level IO JOSE VICENTE
@ 1998-08-06  0:00 ` Samuel Tardieu
  1998-08-06  0:00   ` JOSE VICENTE
  1998-08-07  0:00 ` Tarjei Tj�stheim Jensen
  1 sibling, 1 reply; 4+ messages in thread
From: Samuel Tardieu @ 1998-08-06  0:00 UTC (permalink / raw)


>>>>> "Jose" == JOSE VICENTE <319089@cepsz.unizar.es> writes:

Jose> Does anyone know how can I read/write the parallel port using
Jose> Linux and Gnat 3.10 ?

It has nothing to do with GNAT. If you try the same thing in C with

   main() { *(char *)0x3bc = 0; }

you will get a segmentation fault.

When you are using a real OS (such as Linux), you have to ask the OS
to give you certain permissions (on Linux, look at ioperm() and iopl()).

Moreover, the memory space you see has nothing to do with the physical 
memory, that means that 16#3bc# doesn't point onto the parallel port.

  Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Low Level IO
  1998-08-06  0:00 ` Samuel Tardieu
@ 1998-08-06  0:00   ` JOSE VICENTE
  0 siblings, 0 replies; 4+ messages in thread
From: JOSE VICENTE @ 1998-08-06  0:00 UTC (permalink / raw)


Thanks , I see I must review my OS notes first.






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Low Level IO
  1998-08-06  0:00 Low Level IO JOSE VICENTE
  1998-08-06  0:00 ` Samuel Tardieu
@ 1998-08-07  0:00 ` Tarjei Tj�stheim Jensen
  1 sibling, 0 replies; 4+ messages in thread
From: Tarjei Tj�stheim Jensen @ 1998-08-07  0:00 UTC (permalink / raw)



JOSE VICENTE wrote :
>Does anyone know how can I read/write the parallel port using Linux and Gnat
>3.10 ?
>I've been trying things like this and 'Storage Error' or 'Program Error'
>raises.
>    ......
>    type Byte is mod 2**8;
>    for Byte'Size use 8;
>    Parallel_Port:Byte;
>    for Parallel_Port'Address use
>System.Storage_Elements.To_Address(16#3BC#);
>    ......
>    begin
>    ......
>    Parallel_Port:=value;    -- The exception raises at this point.


I believe that you are trying to write into the BIOS area.

To my knowledge the paralell port lives in I/O space. I/O space is different
from program/data space. You should use something similar to the port()
function which many C compilers have. It may very well be that this can be done
using assembly language insertion. Robert Dewar can probably tell you the
preferred method.

It may well be that this is documentet in the GNAT documentation. Please have a
go at looking it up there first.

Greetings,






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-08-07  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-06  0:00 Low Level IO JOSE VICENTE
1998-08-06  0:00 ` Samuel Tardieu
1998-08-06  0:00   ` JOSE VICENTE
1998-08-07  0:00 ` Tarjei Tj�stheim Jensen

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