1 (* RTint.def provides users of the COROUTINES library with the.
3 Copyright (C) 2009-2023 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
6 This file is part of GNU Modula-2.
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 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 DEFINITION MODULE RTint ;
29 (* Provides users of the COROUTINES library with the
30 ability to create interrupt sources based on
31 file descriptors and timeouts. *)
33 FROM SYSTEM IMPORT ADDRESS ;
36 DispatchVector = PROCEDURE (CARDINAL, CARDINAL, ADDRESS) ;
40 InitInputVector - returns an interrupt vector which is associated
41 with the file descriptor, fd.
44 PROCEDURE InitInputVector (fd: INTEGER; pri: CARDINAL) : CARDINAL ;
48 InitOutputVector - returns an interrupt vector which is associated
49 with the file descriptor, fd.
52 PROCEDURE InitOutputVector (fd: INTEGER; pri: CARDINAL) : CARDINAL ;
56 InitTimeVector - returns an interrupt vector associated with
60 PROCEDURE InitTimeVector (micro, secs: CARDINAL; pri: CARDINAL) : CARDINAL ;
64 ReArmTimeVector - reprimes the vector, vec, to deliver an interrupt
65 at the new relative time.
68 PROCEDURE ReArmTimeVector (vec: CARDINAL; micro, secs: CARDINAL) ;
72 GetTimeVector - assigns, micro, and, secs, with the remaining
73 time before this interrupt will expire.
74 This value is only updated when a Listen
78 PROCEDURE GetTimeVector (vec: CARDINAL; VAR micro, secs: CARDINAL) ;
82 AttachVector - adds the pointer, p, to be associated with the interrupt
83 vector. It returns the previous value attached to this
87 PROCEDURE AttachVector (vec: CARDINAL; p: ADDRESS) : ADDRESS ;
91 IncludeVector - includes, vec, into the dispatcher list of
92 possible interrupt causes.
95 PROCEDURE IncludeVector (vec: CARDINAL) ;
99 ExcludeVector - excludes, vec, from the dispatcher list of
100 possible interrupt causes.
103 PROCEDURE ExcludeVector (vec: CARDINAL) ;
107 Listen - will either block indefinitely (until an interrupt)
108 or alteratively will test to see whether any interrupts
110 If a pending interrupt was found then, call, is called
111 and then this procedure returns.
112 It only listens for interrupts > pri.
115 PROCEDURE Listen (untilInterrupt: BOOLEAN;
116 call: DispatchVector;
121 Init - allows the user to force the initialize order.