comp.lang.ada
 help / color / mirror / Atom feed
From: jerry@jvdsys.nextjk.stuyts.nl (Jerry van Dijk)
Subject: Re: GNAT and interrupts with DJGPP and CWSPR0
Date: 1996/08/15
Date: 1996-08-15T00:00:00+00:00	[thread overview]
Message-ID: <Dw78v1.6L@jvdsys.nextjk.stuyts.nl> (raw)
In-Reply-To: 32110129.3C6E@ee.ubc.ca


I'm not sure whether this will go out...

Greg Bond (bond@ee.ubc.ca) wrote:

: Since I'm using CWSPR0 (a ring 0, no frills DPMI server that disables 
: virtual memory)

This solves the problem of not being able to lock all memory used by
the interrupt handler, but still leaves the problem of real mode interrupt
defection by DPMI, if you access the first megabyte.

> I believe I still might be able to access memory 
: locations directly (anyone know enough to disagree?).

Accessing memory locations directly will work anyway by using the djgpp
library. 

: So my thought was 
: that I could install a (mostly) Ada interrupt handler in Ada using the 
: 'for', 'use' keywords to assign an address to the interrupt handler. 

Yep, in theory this should work, if you tell GNAT that this is a callback
function (so its C-style callable). However, you run into problems if you
try to use arguments. And don't forget using the right stack :-)

: Since I've got to include some assembly language in the handler itself, 
: I could use the Ada handler as a wrapper to call a C/assembly handler 
: via Ada's foreign language interface.

If that's the case, why not write the whole handler in C ?

: The design I have in mind is to have an Ada interrupt task wait on a 
: guarded entry of a protected object for interrupt events (the 
: recommended way of handling interrupts in GNAT).

Oops, that changes things a bit. I'm not sure how interrupt safe the DOS
port of pthreads really is....

: If it won't work, what 
: are my alternatives? The only alternative I can think of is polling the 
: hardware directly from the interrupt task

This depends on what you are trying to archive. And the interrupt frequency
you are looking at.

Jerry.





  reply	other threads:[~1996-08-15  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-13  0:00 GNAT and interrupts with DJGPP and CWSPR0 Greg Bond
1996-08-15  0:00 ` Jerry van Dijk [this message]
1996-08-16  0:00   ` Greg Bond
1996-08-16  0:00 ` Jerry van Dijk
1996-08-19  0:00   ` Greg Bond
replies disabled

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