FreeBSD/Linux Kernel Cross Reference
sys/chips/nc.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: nc.h,v $
29 * Revision 2.2 93/08/10 15:18:35 mrt
30 * Initial check-in.
31 * [93/06/09 15:56:14 jcb]
32 *
33 *
34 */
35
36 /*** NETWORK INTERFACE IMPLEMENTATION CORE ***/
37
38 #ifndef _NC_H_
39 #define _NC_H_
40
41 #ifndef STUB
42 #include <chips/nw.h>
43 #else
44 #include "nw.h"
45 #endif
46
47 /*** Types and data structures ***/
48
49 #if PRODUCTION
50 #define MAX_EP 1024
51 #define MAX_DEV 16
52 #else
53 #define MAX_EP 32
54 #define MAX_DEV 3
55 #endif
56
57 #define MASTER_LINE_EP 0
58 #define SIGNAL_EP 1
59
60 typedef struct nw_tx_headers {
61 nw_buffer_t buffer;
62 u_int msg_length;
63 char *block;
64 u_int block_length;
65 nw_peer_s peer;
66 nw_ep sender;
67 nw_options options;
68 struct nw_tx_headers *next;
69 } nw_tx_header_s;
70
71 typedef nw_tx_header_s *nw_tx_header_t;
72
73 typedef struct nw_rx_headers {
74 nw_buffer_t buffer;
75 nw_ep receiver;
76 u_int reply;
77 int time_stamp;
78 struct nw_rx_headers *next;
79 } nw_rx_header_s, *nw_rx_header_t;
80
81 typedef enum {
82 NW_CONNECTIONLESS,
83 NW_CONNECTION_ORIENTED
84 } nw_dev_type;
85
86
87 typedef struct {
88 nw_result (*initialize)(int);
89 nw_result (*status)(int);
90 void (*slow_sweep)(int);
91 void (*fast_sweep)(int);
92 int (*poll)(int);
93 nw_result (*send)(nw_ep, nw_tx_header_t, nw_options);
94 nw_buffer_t (*rpc)(nw_ep, nw_tx_header_t, nw_options);
95 void (*signal)(nw_buffer_t);
96 nw_result (*open)(nw_ep, nw_address_1, nw_address_2, nw_ep);
97 nw_result (*accept)(nw_ep, nw_buffer_t, nw_ep_t);
98 nw_result (*close)(nw_ep);
99 nw_result (*add)(nw_ep, nw_address_1, nw_address_2, nw_ep);
100 nw_result (*drop)(nw_ep, nw_address_1, nw_address_2, nw_ep);
101 } nw_dev_entry_s, *nw_dev_entry_t;
102
103 typedef struct {
104 nw_result status;
105 nw_dev_type type;
106 char *addr;
107 nw_address_1 local_addr_1;
108 nw_address_2 local_addr_2;
109 nw_dev_entry_t entry;
110 int fast_req;
111 } nw_devcb;
112
113 extern nw_devcb devct[MAX_DEV];
114
115 typedef struct plists {
116 nw_peer_s peer;
117 struct plists *next;
118 } nw_plist_s, *nw_plist_t;
119
120 typedef struct nw_unused_buffers {
121 u_int buf_used:1;
122 u_int buf_length:31;
123 struct nw_unused_buffers *next;
124 struct nw_unused_buffers *previous;
125 } nw_unused_buffer_s, *nw_unused_buffer_t;
126
127 typedef struct ecbs{
128 nw_protocol protocol;
129 nw_acceptance accept;
130 nw_state state;
131 nw_plist_t conn;
132 char *buf_start;
133 char *buf_end;
134 nw_unused_buffer_t free_buffer;
135 nw_ep id:16;
136 u_int overrun:1;
137 u_int seqno:14;
138 nw_tx_header_t tx_first;
139 nw_tx_header_t tx_last;
140 nw_tx_header_t tx_initial;
141 nw_tx_header_t tx_current;
142 nw_rx_header_t rx_first;
143 nw_rx_header_t rx_last;
144 nw_ep next:16;
145 nw_ep previous:16;
146 } nw_ecb, *nw_ecb_t;
147
148 extern nw_ecb ect[MAX_EP];
149
150 extern int nw_free_ep_first, nw_free_ep_last;
151 extern int nw_free_line_first, nw_free_line_last;
152
153 typedef enum {
154 NW_RECEIVE,
155 NW_RECEIVE_URGENT,
156 NW_SEND,
157 NW_SIGNAL
158 } nw_delivery;
159
160
161 /*** System-independent functions implemented in core ***/
162
163 extern void nc_initialize();
164
165 extern nw_tx_header_t nc_tx_header_allocate();
166
167 extern void nc_tx_header_deallocate(nw_tx_header_t header);
168
169 extern nw_rx_header_t nc_rx_header_allocate();
170
171 extern void nc_rx_header_deallocate(nw_rx_header_t header);
172
173 extern nw_plist_t nc_peer_allocate();
174
175 extern void nc_peer_deallocate(nw_plist_t peer);
176
177 extern nw_result nc_device_register(u_int dev, nw_dev_type type,
178 char *dev_addr,
179 nw_dev_entry_t dev_entry_table);
180
181 extern nw_result nc_device_unregister(u_int dev, nw_result status);
182
183 extern void nc_fast_sweep();
184
185 extern void nc_fast_timer_set();
186
187 extern void nc_fast_timer_reset();
188
189 extern void nc_slow_sweep();
190
191 extern nw_result nc_update(nw_update_type up_type, int *up_info);
192
193 extern nw_result nc_lookup(nw_lookup_type lt, int *look_info);
194
195 extern nw_result nc_line_update(nw_peer_t peer, nw_ep line);
196
197 extern nw_ep nc_line_lookup(nw_peer_t peer);
198
199 extern nw_result nc_endpoint_allocate(nw_ep_t epp, nw_protocol protocol,
200 nw_acceptance accept,
201 char *buffer_address, u_int buffer_size);
202
203 extern nw_result nc_endpoint_deallocate(nw_ep ep);
204
205 extern nw_buffer_t nc_buffer_allocate(nw_ep ep, u_int size);
206
207 extern nw_result nc_buffer_deallocate(nw_ep ep, nw_buffer_t buffer);
208
209 extern nw_result nc_endpoint_status(nw_ep ep,
210 nw_state_t state, nw_peer_t peer);
211
212
213 /* System-dependent function implemented in wrapper*/
214
215 extern boolean_t nc_deliver_result(nw_ep ep, nw_delivery type, int result);
216
217 /* Support required in wrapper */
218
219 extern void h_initialize();
220
221 extern void h_fast_timer_set();
222
223 extern void h_fast_timer_reset();
224
225
226 /* Stubs for device table */
227
228 extern nw_result nc_succeed(int);
229 extern nw_result nc_fail(int);
230 extern void nc_null(int);
231 extern int nc_null_poll(int);
232 extern nw_result nc_null_send(nw_ep, nw_tx_header_t, nw_options);
233 extern nw_buffer_t nc_null_rpc(nw_ep, nw_tx_header_t, nw_options);
234 extern nw_result nc_local_send(nw_ep, nw_tx_header_t, nw_options);
235 extern nw_buffer_t nc_local_rpc(nw_ep, nw_tx_header_t, nw_options);
236 extern void nc_null_signal(nw_buffer_t);
237 extern nw_result nc_open_fail(nw_ep, nw_address_1, nw_address_2, nw_ep);
238 extern nw_result nc_accept_fail(nw_ep, nw_buffer_t, nw_ep_t);
239 extern nw_result nc_close_fail(nw_ep);
240
241 #endif /* _NC_H_ */
Cache object: fa091bf7e8c5f66deb0eb52524be4b9e
|