source: rtems/doc/bsp_howto/adaintr.t @ 017f6e5

4.104.114.84.95
Last change on this file since 017f6e5 was 017f6e5, checked in by Joel Sherrill <joel.sherrill@…>, on Apr 19, 1999 at 9:18:18 PM

New file based on notes from Jiri Gaisler <jgais@…>.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@chapter Ada95 Interrupt Support
10
11@section Introduction
12
13This chapter describes what is required to enable Ada interrupt
14and error exception handling when using GNAT over RTEMS.
15
16The GNAT Ada95 interrupt support RTEMS was developed by
17Jiri Gaisler <jgais@@ws.estec.esa.nl> who also wrote this
18chapter.
19
20@section Mapping Interrupts to POSIX Signals
21
22In Ada95, interrupts can be attached with the interrupt_attach pragma.
23For most systems, the gnat run-time will use POSIX signal to implement
24the interrupt handling, mapping one signal per interrupt. For interrupts
25to be propagated to the attached Ada handler, the corresponding signal
26must be raised when the interrupt occurs.
27
28The same mechanism is used to generate Ada error exceptions.
29Three error exceptions are defined: program, constraint and storage
30error. These are generated by raising the predefined signals: SIGILL,
31SIGFPE and SIGSEGV. These signals should be raised when a spurious
32or erroneous trap occurs.
33
34To enable gnat interrupt and error exception support for a particular
35bsp, the following has to be done:
36
37@enumerate
38
39@item Write an interrupt/trap handler that will raise the corresponding
40signal depending on the interrupt/trap number.
41
42@item Install the interrupt handler for all interrupts/traps that will be
43handled by gnat (including spurious).
44
45@item At startup, gnat calls @code{__gnat_install_handler()}. The bsp
46must provide this function which installs the interrupt/trap handlers.
47
48@end enumerate
49
50Which cpu-interrupt will generate which signal is implementation
51defined. There are 32 POSIX signals (1 - 32), and all except the
52three error signals (SIGILL, SIGFPE and SIGSEGV) can be used. I
53would suggest to use the upper 16 (17 - 32) which do not
54have an assigned POSIX name.
55
56Note that the pragma interrupt_attach will only bind a signal
57to a particular Ada handler - it will not unmask the
58interrupt or do any other things to enable it. This have to be
59done separately, typically by writing various device register.
60
61@section Example Ada95 Interrupt Program
62
63An example program is available to show how interrupts
64can be handled in Ada95. Note that generation of the test
65interrupt (irqforce.c) is bsp specific and must be edited.
66
67@section Version Requirements
68
69With RTEMS 4.0, a patch was required to psignal.c in RTEMS
70sources (to correct a bug associated to the default action of
71signals 15-32).   The SPARC/ERC32 RTEMS BSP includes the
72@code{gnatsupp} subdirectory that can be used as an example
73for other BSPs.
74
75With GNAT 3.11p, a patch is required for @code{a-init.c} to invoke
76the BSP specific routine that installs the exception handlers.
77
Note: See TracBrowser for help on using the repository browser.