comp.lang.ada
 help / color / mirror / Atom feed
* hardware interfacing in linux with gnat
@ 2001-06-21 21:56 Jaap van Erk
  2001-06-21 23:43 ` B. Douglas Hilton
  2001-06-22 14:32 ` Jerry van Dijk
  0 siblings, 2 replies; 4+ messages in thread
From: Jaap van Erk @ 2001-06-21 21:56 UTC (permalink / raw)


Dear all,

I have an hardware interface card with relay's and  8255's.
It's published in Elektuur several years ago (a Dutch electronics
magazine)
this card can be steered with io adresses 792 to 800 (decimal).
In C we use the inb and outb commands (see the io-port mini howto)
Because we must also use ioperm(), and a optimizing flag -O we can
access the hardware in linux.

I tried Jerry van Dijk's clock.adb program to do it also; it's compiling

without errors, but it give a coredump when accessing the ports.
How can I use ioperm() in gnat?  (3.11 for linux 2.0 and 3.13 for 2.2)
clock.adb works ok when i'm using Dos.(Bedankt, Jerry voor dit programma
)

Any idea what's going wrong?

Best regards,

Jaap van Erk
Rotterdam





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

* Re: hardware interfacing in linux with gnat
  2001-06-21 21:56 hardware interfacing in linux with gnat Jaap van Erk
@ 2001-06-21 23:43 ` B. Douglas Hilton
  2001-06-22 14:34   ` Jerry van Dijk
  2001-06-22 14:32 ` Jerry van Dijk
  1 sibling, 1 reply; 4+ messages in thread
From: B. Douglas Hilton @ 2001-06-21 23:43 UTC (permalink / raw)


Perhaps you could just use pure inline assembly to use the card,
that's what I would do. X86 assembly really isn't all that mysterious.
Small inline ASM routines are pretty cool, and unless I am mistaken
Ada95 pushes your registers and such onto the stack so you have
free reign other than you must not modify CS or DS and probably
a couple other registers. To return values you just push it onto the
stack ( I think ). I have used inline ASM with C, but not yet Ada,
so I'm guessing here, but I know it can easily be done.

- Doug

Jaap van Erk wrote:

> this card can be steered with io adresses 792 to 800 (decimal).
> In C we use the inb and outb commands (see the io-port mini howto)
> Because we must also use ioperm(), and a optimizing flag -O we can
> access the hardware in linux.
>
> I tried Jerry van Dijk's clock.adb program to do it also; it's compiling
>
> without errors, but it give a coredump when accessing the ports.
> How can I use ioperm() in gnat?  (3.11 for linux 2.0 and 3.13 for 2.2)
> clock.adb works ok when i'm using Dos.(Bedankt, Jerry voor dit programma
> )




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

* Re: hardware interfacing in linux with gnat
  2001-06-21 21:56 hardware interfacing in linux with gnat Jaap van Erk
  2001-06-21 23:43 ` B. Douglas Hilton
@ 2001-06-22 14:32 ` Jerry van Dijk
  1 sibling, 0 replies; 4+ messages in thread
From: Jerry van Dijk @ 2001-06-22 14:32 UTC (permalink / raw)



Jaap van Erk <j.h.van.erk@hccnet.nl> writes:

> I have an hardware interface card with relay's and  8255's.
> It's published in Elektuur several years ago (a Dutch electronics
> magazine)

Can you really still get the 8255 PIO ? That's a blast from the past...

Ohh, oops, that's off-topic, I know, I know... :-)

> Because we must also use ioperm(), and a optimizing flag -O we can
> access the hardware in linux.
> 
> I tried Jerry van Dijk's clock.adb program to do it also; it's compiling 
> without errors, but it give a coredump when accessing the ports.

I wouldn't expect a coredump, but on linux you need to do it the unix way.

> How can I use ioperm() in gnat?  (3.11 for linux 2.0 and 3.13 for 2.2)
> clock.adb works ok when i'm using Dos.(Bedankt, Jerry voor dit programma
> )

As for ioperm, just import it and call it. I'll see if I can come up with
an example tonight.


-- 
--  Jerry van Dijk   | email: jvandyk@attglobal.net
--  Leiden, Holland  | web:   home.trouwweb.nl/Jerry



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

* Re: hardware interfacing in linux with gnat
  2001-06-21 23:43 ` B. Douglas Hilton
@ 2001-06-22 14:34   ` Jerry van Dijk
  0 siblings, 0 replies; 4+ messages in thread
From: Jerry van Dijk @ 2001-06-22 14:34 UTC (permalink / raw)



"B. Douglas Hilton" <doug.hilton@engineer.com> writes:

> Perhaps you could just use pure inline assembly to use the card,
> that's what I would do.

Well, yes, you can do everything in assembler, but why would you
when you do not really need to ?

> stack ( I think ). I have used inline ASM with C, but not yet Ada,
> so I'm guessing here, but I know it can easily be done.

See my GNAT inline assembler tutorial on AdaPower.

-- 
--  Jerry van Dijk   | email: jvandyk@attglobal.net
--  Leiden, Holland  | web:   home.trouwweb.nl/Jerry



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

end of thread, other threads:[~2001-06-22 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-21 21:56 hardware interfacing in linux with gnat Jaap van Erk
2001-06-21 23:43 ` B. Douglas Hilton
2001-06-22 14:34   ` Jerry van Dijk
2001-06-22 14:32 ` Jerry van Dijk

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