www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/14/02:15:20

Xref: news2.mv.net comp.lang.ada:24210 comp.os.msdos.djgpp:7229
From: Greg Bond <bond AT ee DOT ubc DOT ca>
Newsgroups: comp.lang.ada,comp.os.msdos.djgpp
Subject: GNAT and interrupts with DJGPP and CWSPR0
Date: Tue, 13 Aug 1996 15:26:49 -0700
Organization: Dept. of Electrical Eng., UBC
Lines: 37
Message-ID: <32110129.3C6E@ee.ubc.ca>
NNTP-Posting-Host: bug.ee.ubc.ca
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 AT ee DOT ubc DOT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019