comparison src/nucleus/iof.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
1 /*************************************************************************/
2 /* */
3 /* Copyright Mentor Graphics Corporation 2002 */
4 /* All Rights Reserved. */
5 /* */
6 /* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS */
7 /* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS */
8 /* SUBJECT TO LICENSE TERMS. */
9 /* */
10 /*************************************************************************/
11
12 /*************************************************************************/
13 /* */
14 /* FILE NAME VERSION */
15 /* */
16 /* iof.c Nucleus PLUS 1.14 */
17 /* */
18 /* COMPONENT */
19 /* */
20 /* IO - Input/Output Driver Management */
21 /* */
22 /* DESCRIPTION */
23 /* */
24 /* This file contains routines to obtain facts about the I/O Driver */
25 /* Management component. */
26 /* */
27 /* DATA STRUCTURES */
28 /* */
29 /* None */
30 /* */
31 /* FUNCTIONS */
32 /* */
33 /* IOF_Established_Drivers Return total number of I/O */
34 /* drivers */
35 /* IOF_Driver_Pointers Return list of I/O driver */
36 /* pointers */
37 /* */
38 /* DEPENDENCIES */
39 /* */
40 /* cs_extr.h Common Service functions */
41 /* tc_extr.h Thread Control functions */
42 /* io_extr.h I/O driver functions */
43 /* hi_extr.h History functions */
44 /* */
45 /* HISTORY */
46 /* */
47 /* DATE REMARKS */
48 /* */
49 /* 03-01-1994 Initial version of I/O driver */
50 /* fact service file, version 1.1 */
51 /* */
52 /* 03-18-1994 Verified version 1.1 */
53 /* 04-17-1996 updated to version 1.2 */
54 /* 03-24-1998 Released version 1.3 */
55 /* 03-26-1999 Released 1.11m (new release */
56 /* numbering scheme) */
57 /* 04-17-2002 Released version 1.13m */
58 /* 11-07-2002 Released version 1.14 */
59 /*************************************************************************/
60 #define NU_SOURCE_FILE
61
62
63 #include "cs_extr.h" /* Common service functions */
64 #include "tc_extr.h" /* Thread control functions */
65 #include "io_extr.h" /* I/O driver functions */
66 #include "hi_extr.h" /* History functions */
67
68 /* Define external inner-component global data references. */
69
70 extern CS_NODE *IOD_Created_Drivers_List;
71 extern UNSIGNED IOD_Total_Drivers;
72 extern TC_PROTECT IOD_List_Protect;
73
74
75
76 /*************************************************************************/
77 /* */
78 /* FUNCTION */
79 /* */
80 /* IOF_Established_Drivers */
81 /* */
82 /* DESCRIPTION */
83 /* */
84 /* This function returns the current number of established I/O */
85 /* drivers. I/O drivers previously deleted are no longer */
86 /* considered established. */
87 /* */
88 /* CALLED BY */
89 /* */
90 /* Application */
91 /* */
92 /* CALLS */
93 /* */
94 /* [TCT_Check_Stack] Stack checking function */
95 /* */
96 /* INPUTS */
97 /* */
98 /* None */
99 /* */
100 /* OUTPUTS */
101 /* */
102 /* IOD_Total_Drivers Number of established I/O */
103 /* drivers */
104 /* */
105 /* HISTORY */
106 /* */
107 /* DATE REMARKS */
108 /* */
109 /* 03-01-1993 Created initial version 1.0 */
110 /* 04-19-1993 Verified version 1.0 */
111 /* 03-01-1994 Changed function interface, */
112 /* resulting in version 1.1 */
113 /* */
114 /* 03-18-1994 Verified version 1.1 */
115 /* */
116 /*************************************************************************/
117 UNSIGNED IOF_Established_Drivers(VOID)
118 {
119
120
121 #ifdef NU_ENABLE_STACK_CHECK
122
123 /* Call stack checking function to check for an overflow condition. */
124 TCT_Check_Stack();
125
126 #endif
127
128 /* Return the number of established I/O drivers. */
129 return(IOD_Total_Drivers);
130 }
131
132
133 /*************************************************************************/
134 /* */
135 /* FUNCTION */
136 /* */
137 /* IOF_Driver_Pointers */
138 /* */
139 /* DESCRIPTION */
140 /* */
141 /* This function builds a list of driver pointers, starting at the */
142 /* specified location. The number of driver pointers placed in */
143 /* the list is equivalent to the total number of drivers or the */
144 /* maximum number of pointers specified in the call. */
145 /* */
146 /* CALLED BY */
147 /* */
148 /* Application */
149 /* */
150 /* CALLS */
151 /* */
152 /* [TCT_Check_Stack] Stack checking function */
153 /* TCT_Protect Protect created list */
154 /* TCT_Unprotect Release protection */
155 /* */
156 /* INPUTS */
157 /* */
158 /* pointer_list Pointer to the list area */
159 /* maximum_pointers Maximum number of pointers */
160 /* */
161 /* OUTPUTS */
162 /* */
163 /* pointers Number of I/O driver pointers*/
164 /* placed in the list */
165 /* */
166 /* HISTORY */
167 /* */
168 /* DATE REMARKS */
169 /* */
170 /* 03-01-1993 Created initial version 1.0 */
171 /* 04-19-1993 Verified version 1.0 */
172 /* 08-09-1993 Corrected pointer retrieval */
173 /* loop, resulting in version 1.0a */
174 /* 08-09-1993 Verified version 1.0a */
175 /* 03-01-1994 Changed function interface, */
176 /* resulting in version 1.1 */
177 /* */
178 /* 03-18-1994 Verified version 1.1 */
179 /* */
180 /*************************************************************************/
181 UNSIGNED IOF_Driver_Pointers(NU_DRIVER **pointer_list,
182 UNSIGNED maximum_pointers)
183 {
184 CS_NODE *node_ptr; /* Pointer to each NU_DRIVER */
185 UNSIGNED pointers; /* Number of pointers in list*/
186 NU_SUPERV_USER_VARIABLES
187
188 /* Switch to supervisor mode */
189 NU_SUPERVISOR_MODE();
190
191 #ifdef NU_ENABLE_STACK_CHECK
192
193 /* Call stack checking function to check for an overflow condition. */
194 TCT_Check_Stack();
195
196 #endif
197
198 /* Initialize the number of pointers returned. */
199 pointers = 0;
200
201 /* Protect against access to the list of created I/O drivers. */
202 TCT_Protect(&IOD_List_Protect);
203
204 /* Loop until all driver pointers are in the list or until the maximum
205 list size is reached. */
206 node_ptr = IOD_Created_Drivers_List;
207 while ((node_ptr) && (pointers < maximum_pointers))
208 {
209
210 /* Place the node into the destination list. */
211 *pointer_list++ = (NU_DRIVER *) node_ptr;
212
213 /* Increment the pointers variable. */
214 pointers++;
215
216 /* Position the node pointer to the next node. */
217 node_ptr = node_ptr -> cs_next;
218
219 /* Determine if the pointer is at the head of the list. */
220 if (node_ptr == IOD_Created_Drivers_List)
221
222 /* The list search is complete. */
223 node_ptr = NU_NULL;
224 }
225
226 /* Release protection against access to the list of created drivers. */
227 TCT_Unprotect();
228
229 /* Return to user mode */
230 NU_USER_MODE();
231
232 /* Return the number of pointers in the list. */
233 return(pointers);
234 }
235
236
237
238
239
240