]>
Commit | Line | Data |
---|---|---|
1 | /* do not edit automatically generated by mc from RTint. */ | |
2 | /* RTint.def provides users of the COROUTINES library with the. | |
3 | ||
4 | Copyright (C) 2009-2024 Free Software Foundation, Inc. | |
5 | Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>. | |
6 | ||
7 | This file is part of GNU Modula-2. | |
8 | ||
9 | GNU Modula-2 is free software; you can redistribute it and/or modify | |
10 | it under the terms of the GNU General Public License as published by | |
11 | the Free Software Foundation; either version 3, or (at your option) | |
12 | any later version. | |
13 | ||
14 | GNU Modula-2 is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | General Public License for more details. | |
18 | ||
19 | Under Section 7 of GPL version 3, you are granted additional | |
20 | permissions described in the GCC Runtime Library Exception, version | |
21 | 3.1, as published by the Free Software Foundation. | |
22 | ||
23 | You should have received a copy of the GNU General Public License and | |
24 | a copy of the GCC Runtime Library Exception along with this program; | |
25 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
26 | <http://www.gnu.org/licenses/>. */ | |
27 | ||
28 | ||
29 | #if !defined (_RTint_H) | |
30 | # define _RTint_H | |
31 | ||
32 | #include "config.h" | |
33 | #include "system.h" | |
34 | # ifdef __cplusplus | |
35 | extern "C" { | |
36 | # endif | |
37 | #include <stdbool.h> | |
38 | # if !defined (PROC_D) | |
39 | # define PROC_D | |
40 | typedef void (*PROC_t) (void); | |
41 | typedef struct { PROC_t proc; } PROC; | |
42 | # endif | |
43 | ||
44 | # include "GSYSTEM.h" | |
45 | ||
46 | # if defined (_RTint_C) | |
47 | # define EXTERN | |
48 | # else | |
49 | # define EXTERN extern | |
50 | # endif | |
51 | ||
52 | typedef struct RTint_DispatchVector_p RTint_DispatchVector; | |
53 | ||
54 | typedef void (*RTint_DispatchVector_t) (unsigned int, unsigned int, void *); | |
55 | struct RTint_DispatchVector_p { RTint_DispatchVector_t proc; }; | |
56 | ||
57 | ||
58 | /* | |
59 | InitInputVector - returns an interrupt vector which is associated | |
60 | with the file descriptor, fd. | |
61 | */ | |
62 | ||
63 | EXTERN unsigned int RTint_InitInputVector (int fd, unsigned int pri); | |
64 | ||
65 | /* | |
66 | InitOutputVector - returns an interrupt vector which is associated | |
67 | with the file descriptor, fd. | |
68 | */ | |
69 | ||
70 | EXTERN unsigned int RTint_InitOutputVector (int fd, unsigned int pri); | |
71 | ||
72 | /* | |
73 | InitTimeVector - returns an interrupt vector associated with | |
74 | the relative time. | |
75 | */ | |
76 | ||
77 | EXTERN unsigned int RTint_InitTimeVector (unsigned int micro, unsigned int secs, unsigned int pri); | |
78 | ||
79 | /* | |
80 | ReArmTimeVector - reprimes the vector, vec, to deliver an interrupt | |
81 | at the new relative time. | |
82 | */ | |
83 | ||
84 | EXTERN void RTint_ReArmTimeVector (unsigned int vec, unsigned int micro, unsigned int secs); | |
85 | ||
86 | /* | |
87 | GetTimeVector - assigns, micro, and, secs, with the remaining | |
88 | time before this interrupt will expire. | |
89 | This value is only updated when a Listen | |
90 | occurs. | |
91 | */ | |
92 | ||
93 | EXTERN void RTint_GetTimeVector (unsigned int vec, unsigned int *micro, unsigned int *secs); | |
94 | ||
95 | /* | |
96 | AttachVector - adds the pointer, p, to be associated with the interrupt | |
97 | vector. It returns the previous value attached to this | |
98 | vector. | |
99 | */ | |
100 | ||
101 | EXTERN void * RTint_AttachVector (unsigned int vec, void * ptr); | |
102 | ||
103 | /* | |
104 | IncludeVector - includes, vec, into the dispatcher list of | |
105 | possible interrupt causes. | |
106 | */ | |
107 | ||
108 | EXTERN void RTint_IncludeVector (unsigned int vec); | |
109 | ||
110 | /* | |
111 | ExcludeVector - excludes, vec, from the dispatcher list of | |
112 | possible interrupt causes. | |
113 | */ | |
114 | ||
115 | EXTERN void RTint_ExcludeVector (unsigned int vec); | |
116 | ||
117 | /* | |
118 | Listen - will either block indefinitely (until an interrupt) | |
119 | or alteratively will test to see whether any interrupts | |
120 | are pending. | |
121 | If a pending interrupt was found then, call, is called | |
122 | and then this procedure returns. | |
123 | It only listens for interrupts > pri. | |
124 | */ | |
125 | ||
126 | EXTERN void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, unsigned int pri); | |
127 | ||
128 | /* | |
129 | Init - allows the user to force the initialize order. | |
130 | */ | |
131 | ||
132 | EXTERN void RTint_Init (void); | |
133 | # ifdef __cplusplus | |
134 | } | |
135 | # endif | |
136 | ||
137 | # undef EXTERN | |
138 | #endif |