comp.lang.ada
 help / color / mirror / Atom feed
From: Greg Bond <bond@ee.ubc.ca>
Subject: GNAT and interrupts with DJGPP and CWSPR0
Date: 1996/08/13
Date: 1996-08-13T00:00:00+00:00	[thread overview]
Message-ID: <32110129.3C6E@ee.ubc.ca> (raw)


According to the "features" file supplied with GNAT 3.05 for DJGPP, 
language support for interrupts and inline assembly are not implemented. 

Nevertheless, I want to write an Ada program that uses interrupts so 
I've been thinking about how I might get around GNAT's restrictions.

Since I'm using CWSPR0 (a ring 0, no frills DPMI server that disables 
virtual memory) I believe I still might be able to access memory 
locations directly (anyone know enough to disagree?). 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. 
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. Not an efficient interrupt 
handler, but when GNAT does support in-line assembly I'll only have to 
re-write the C code as part of the Ada handler.

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). When an interrupt 
occurs, the handler will call an un-guarded entry of the protected 
object to un-block the interrupt task. However, I fear that this might 
not work since there is no explicit support for interrupt handling in 
GNAT. 

Does anyone know whether or not this will work? 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, and forgetting about using 
interrupt handlers altogether (an absolutely repulsive alternative, 
real-time in Windows 95 GNAT would be more palatable).

--
* Greg Bond                         * Dept. of Electrical Eng.  
* email: bond@ee.ubc.ca             * Univ. of British Columbia      
* voice: (604) 822 0899             * 2356 Main Mall                 
* fax:   (604) 822 5949             * Vancouver, BC              
* web: http://www.ee.ubc.ca/~bond   * Canada, V6T 1Z4




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

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