source: rtems/doc/bsp_howto/adaintr.t @ e4ca8d7

4.104.114.84.95
Last change on this file since e4ca8d7 was e4ca8d7, checked in by Joel Sherrill <joel.sherrill@…>, on 04/20/99 at 13:08:47

Updated to reflect inclusion of IRQ test in ada examples.

  • Property mode set to 100644
File size: 2.8 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 (@code{irq_test}) is included in the
64Ada examples package to show how interrupts can be handled
65in Ada95. Note that generation of the test interrupt
66(@code{irqforce.c}) is bsp specific and must be edited.
67
68NOTE: The @code{irq_test} example was written for the SPARC/ERC32
69BSP.
70
71@section Version Requirements
72
73With RTEMS 4.0, a patch was required to psignal.c in RTEMS
74sources (to correct a bug associated to the default action of
75signals 15-32).   The SPARC/ERC32 RTEMS BSP includes the
76@code{gnatsupp} subdirectory that can be used as an example
77for other BSPs.
78
79With GNAT 3.11p, a patch is required for @code{a-init.c} to invoke
80the BSP specific routine that installs the exception handlers.
81
Note: See TracBrowser for help on using the repository browser.