1 ------------------------------------------------------------------------------
3 -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
5 -- I N T E R F A C E S . V X W O R K S --
9 -- Copyright (C) 1999-2024, AdaCore --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
19 -- additional permissions described in the GCC Runtime Library Exception, --
20 -- version 3.1, as published by the Free Software Foundation. --
22 -- You should have received a copy of the GNU General Public License and --
23 -- a copy of the GCC Runtime Library Exception along with this program; --
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
25 -- <http://www.gnu.org/licenses/>. --
27 -- GNARL was developed by the GNARL team at Florida State University. --
28 -- Extensive contributions were provided by Ada Core Technologies, Inc. --
30 ------------------------------------------------------------------------------
32 -- This is the x86 VxWorks version of this package
34 -- This package provides a limited binding to the VxWorks API
35 -- In particular, it interfaces with the VxWorks hardware interrupt
36 -- facilities, allowing the use of low-latency direct-vectored
37 -- interrupt handlers. Note that such handlers have a variety of
38 -- restrictions regarding system calls and language constructs. In particular,
39 -- the use of exception handlers and functions returning variable-length
40 -- objects cannot be used. Less restrictive, but higher-latency handlers can
41 -- be written using Ada protected procedures, Ada 83 style interrupt entries,
42 -- or by signalling an Ada task from within an interrupt handler using a
43 -- binary semaphore as described in the VxWorks Programmer's Manual.
45 -- For complete documentation of the operations in this package, please
46 -- consult the VxWorks Programmer's Manual and VxWorks Reference Manual.
48 pragma Warnings
(Off
, "*foreign convention*");
49 pragma Warnings
(Off
, "*add Convention pragma*");
53 package Interfaces
.VxWorks
is
56 subtype int
is Integer;
58 type STATUS
is new int
;
59 -- Equivalent of the C type STATUS
61 OK
: constant STATUS
:= 0;
62 ERROR
: constant STATUS
:= -1;
65 -- Equivalent of the C type BOOL
67 type Interrupt_Vector
is new System
.Address
;
69 function intContext
return BOOL
;
70 -- Binding to the C routine intContext. This function returns 1 (TRUE)
71 -- only if the current execution state is in interrupt context.
73 function INUM_TO_IVEC
(intNum
: int
) return Interrupt_Vector
;
74 -- Equivalent to the C macro INUM_TO_IVEC used to convert an interrupt
75 -- number to an interrupt vector
78 (fmt
: String; arg1
, arg2
, arg3
, arg4
, arg5
, arg6
: int
:= 0);
79 -- Binding to the C routine logMsg. Note that it is the caller's
80 -- responsibility to ensure that fmt is a null-terminated string
81 -- (e.g logMsg ("Interrupt" & ASCII.NUL))
83 type FP_CONTEXT
is private;
84 -- Floating point context save and restore. Handlers using floating point
85 -- must be bracketed with these calls. The pFpContext parameter should be
86 -- an object of type FP_CONTEXT that is declared local to the handler.
88 -- See the VxWorks Intel Architecture Supplement regarding these routines
90 procedure fppRestore
(pFpContext
: in out FP_CONTEXT
);
91 -- Restore floating point context - old style
93 procedure fppSave
(pFpContext
: in out FP_CONTEXT
);
94 -- Save floating point context - old style
96 procedure fppXrestore
(pFpContext
: in out FP_CONTEXT
);
97 -- Restore floating point context - new style
99 procedure fppXsave
(pFpContext
: in out FP_CONTEXT
);
100 -- Save floating point context - new style
104 type FP_CONTEXT
is new System
.VxWorks
.FP_CONTEXT
;
105 -- Target-dependent floating point context type
107 pragma Import
(C
, intContext
, "intContext");
108 pragma Import
(C
, INUM_TO_IVEC
, "__gnat_inum_to_ivec");
109 pragma Import
(C
, logMsg
, "logMsg");
110 pragma Import
(C
, fppRestore
, "fppRestore");
111 pragma Import
(C
, fppSave
, "fppSave");
112 pragma Import
(C
, fppXrestore
, "fppXrestore");
113 pragma Import
(C
, fppXsave
, "fppXsave");
114 end Interfaces
.VxWorks
;