-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathADSP.h
370 lines (333 loc) · 15.5 KB
/
ADSP.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
/*
File: ADSP.h
Contains: AppleTalk Data Stream Protocol (ADSP) Interfaces.
Version: Technology: System 7.5
Release: Universal Interfaces 3.4
Copyright: © 1986-2001 by Apple Computer, Inc., all rights reserved
Bugs?: For bug reports, consult the following page on
the World Wide Web:
http://developer.apple.com/bugreporter/
*/
#ifndef __ADSP__
#define __ADSP__
#ifndef __MACERRORS__
#include <MacErrors.h>
#endif
#ifndef __APPLETALK__
#include <AppleTalk.h>
#endif
#if PRAGMA_ONCE
#pragma once
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if PRAGMA_IMPORT
#pragma import on
#endif
#if PRAGMA_STRUCT_ALIGN
#pragma options align=mac68k
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(push, 2)
#elif PRAGMA_STRUCT_PACK
#pragma pack(2)
#endif
/*driver control csCodes*/
enum {
dspInit = 255, /* create a new connection end */
dspRemove = 254, /* remove a connection end */
dspOpen = 253, /* open a connection */
dspClose = 252, /* close a connection */
dspCLInit = 251, /* create a connection listener */
dspCLRemove = 250, /* remove a connection listener */
dspCLListen = 249, /* post a listener request */
dspCLDeny = 248, /* deny an open connection request */
dspStatus = 247, /* get status of connection end */
dspRead = 246, /* read data from the connection */
dspWrite = 245, /* write data on the connection */
dspAttention = 244, /* send an attention message */
dspOptions = 243, /* set connection end options */
dspReset = 242, /* forward reset the connection */
dspNewCID = 241 /* generate a cid for a connection end */
};
enum {
/* connection opening modes */
ocRequest = 1, /* request a connection with remote */
ocPassive = 2, /* wait for a connection request from remote */
ocAccept = 3, /* accept request as delivered by listener */
ocEstablish = 4 /* consider connection to be open */
};
enum {
/* connection end states */
sListening = 1, /* for connection listeners */
sPassive = 2, /* waiting for a connection request from remote */
sOpening = 3, /* requesting a connection with remote */
sOpen = 4, /* connection is open */
sClosing = 5, /* connection is being torn down */
sClosed = 6 /* connection end state is closed */
};
enum {
/* client event flags */
eClosed = 0x80, /* received connection closed advice */
eTearDown = 0x40, /* connection closed due to broken connection */
eAttention = 0x20, /* received attention message */
eFwdReset = 0x10 /* received forward reset advice */
};
enum {
/* miscellaneous constants */
attnBufSize = 570, /* size of client attention buffer */
minDSPQueueSize = 100 /* Minimum size of receive or send Queue */
};
/* connection control block */
typedef struct TRCCB TRCCB;
typedef TRCCB * TPCCB;
struct TRCCB {
TPCCB ccbLink; /* link to next ccb */
UInt16 refNum; /* user reference number */
UInt16 state; /* state of the connection end */
UInt8 userFlags; /* flags for unsolicited connection events */
UInt8 localSocket; /* socket number of this connection end */
AddrBlock remoteAddress; /* internet address of remote end */
UInt16 attnCode; /* attention code received */
UInt16 attnSize; /* size of received attention data */
void * attnPtr; /* ptr to received attention data */
UInt8 reserved[220]; /* for adsp internal use */
};
typedef CALLBACK_API_REGISTER68K( void , ADSPConnectionEventProcPtr, (TPCCB sourceCCB) );
typedef struct DSPParamBlock DSPParamBlock;
typedef DSPParamBlock * DSPPBPtr;
typedef CALLBACK_API_REGISTER68K( void , ADSPCompletionProcPtr, (DSPPBPtr thePBPtr) );
typedef REGISTER_UPP_TYPE(ADSPConnectionEventProcPtr) ADSPConnectionEventUPP;
typedef REGISTER_UPP_TYPE(ADSPCompletionProcPtr) ADSPCompletionUPP;
struct TRinitParams {
TPCCB ccbPtr; /* pointer to connection control block */
ADSPConnectionEventUPP userRoutine; /* client routine to call on event */
UInt16 sendQSize; /* size of send queue (0..64K bytes) */
void * sendQueue; /* client passed send queue buffer */
UInt16 recvQSize; /* size of receive queue (0..64K bytes) */
void * recvQueue; /* client passed receive queue buffer */
void * attnPtr; /* client passed receive attention buffer */
UInt8 localSocket; /* local socket number */
UInt8 filler1; /* filler for proper byte alignment */
};
typedef struct TRinitParams TRinitParams;
struct TRopenParams {
UInt16 localCID; /* local connection id */
UInt16 remoteCID; /* remote connection id */
AddrBlock remoteAddress; /* address of remote end */
AddrBlock filterAddress; /* address filter */
UInt32 sendSeq; /* local send sequence number */
UInt16 sendWindow; /* send window size */
UInt32 recvSeq; /* receive sequence number */
UInt32 attnSendSeq; /* attention send sequence number */
UInt32 attnRecvSeq; /* attention receive sequence number */
UInt8 ocMode; /* open connection mode */
UInt8 ocInterval; /* open connection request retry interval */
UInt8 ocMaximum; /* open connection request retry maximum */
UInt8 filler2; /* filler for proper byte alignment */
};
typedef struct TRopenParams TRopenParams;
struct TRcloseParams {
UInt8 abort; /* abort connection immediately if non-zero */
UInt8 filler3; /* filler for proper byte alignment */
};
typedef struct TRcloseParams TRcloseParams;
struct TRioParams {
UInt16 reqCount; /* requested number of bytes */
UInt16 actCount; /* actual number of bytes */
void * dataPtr; /* pointer to data buffer */
UInt8 eom; /* indicates logical end of message */
UInt8 flush; /* send data now */
};
typedef struct TRioParams TRioParams;
struct TRattnParams {
UInt16 attnCode; /* client attention code */
UInt16 attnSize; /* size of attention data */
void * attnData; /* pointer to attention data */
UInt8 attnInterval; /* retransmit timer in 10-tick intervals */
UInt8 filler4; /* filler for proper byte alignment */
};
typedef struct TRattnParams TRattnParams;
struct TRstatusParams {
TPCCB statusCCB; /* pointer to ccb */
UInt16 sendQPending; /* pending bytes in send queue */
UInt16 sendQFree; /* available buffer space in send queue */
UInt16 recvQPending; /* pending bytes in receive queue */
UInt16 recvQFree; /* available buffer space in receive queue */
};
typedef struct TRstatusParams TRstatusParams;
struct TRoptionParams {
UInt16 sendBlocking; /* quantum for data packets */
UInt8 sendTimer; /* send timer in 10-tick intervals */
UInt8 rtmtTimer; /* retransmit timer in 10-tick intervals */
UInt8 badSeqMax; /* threshold for sending retransmit advice */
UInt8 useCheckSum; /* use ddp packet checksum */
};
typedef struct TRoptionParams TRoptionParams;
struct TRnewcidParams {
UInt16 newcid; /* new connection id returned */
};
typedef struct TRnewcidParams TRnewcidParams;
struct DSPParamBlock {
QElem * qLink;
short qType;
short ioTrap;
Ptr ioCmdAddr;
ADSPCompletionUPP ioCompletion;
OSErr ioResult;
StringPtr ioNamePtr;
short ioVRefNum;
short ioCRefNum; /* adsp driver refNum */
short csCode; /* adsp driver control code */
long qStatus; /* adsp internal use */
short ccbRefNum;
union {
TRinitParams initParams;
TRopenParams openParams;
TRcloseParams closeParams; /*dspClose, dspRemove*/
TRioParams ioParams; /*dspRead, dspWrite*/
TRattnParams attnParams; /*dspAttention*/
TRstatusParams statusParams; /*dspStatus*/
TRoptionParams optionParams; /*dspOptions*/
TRnewcidParams newCIDParams; /*dspNewCID*/
} u;
};
#if CALL_NOT_IN_CARBON
/*
* NewADSPConnectionEventUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( ADSPConnectionEventUPP )
NewADSPConnectionEventUPP(ADSPConnectionEventProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppADSPConnectionEventProcInfo = 0x0000B802 }; /* register no_return_value Func(4_bytes:A1) */
#ifdef __cplusplus
inline ADSPConnectionEventUPP NewADSPConnectionEventUPP(ADSPConnectionEventProcPtr userRoutine) { return (ADSPConnectionEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppADSPConnectionEventProcInfo, GetCurrentArchitecture()); }
#else
#define NewADSPConnectionEventUPP(userRoutine) (ADSPConnectionEventUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppADSPConnectionEventProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* NewADSPCompletionUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( ADSPCompletionUPP )
NewADSPCompletionUPP(ADSPCompletionProcPtr userRoutine);
#if !OPAQUE_UPP_TYPES
enum { uppADSPCompletionProcInfo = 0x00009802 }; /* register no_return_value Func(4_bytes:A0) */
#ifdef __cplusplus
inline ADSPCompletionUPP NewADSPCompletionUPP(ADSPCompletionProcPtr userRoutine) { return (ADSPCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppADSPCompletionProcInfo, GetCurrentArchitecture()); }
#else
#define NewADSPCompletionUPP(userRoutine) (ADSPCompletionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppADSPCompletionProcInfo, GetCurrentArchitecture())
#endif
#endif
/*
* DisposeADSPConnectionEventUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeADSPConnectionEventUPP(ADSPConnectionEventUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeADSPConnectionEventUPP(ADSPConnectionEventUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeADSPConnectionEventUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* DisposeADSPCompletionUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
EXTERN_API_C( void )
DisposeADSPCompletionUPP(ADSPCompletionUPP userUPP);
#if !OPAQUE_UPP_TYPES
#ifdef __cplusplus
inline void DisposeADSPCompletionUPP(ADSPCompletionUPP userUPP) { DisposeRoutineDescriptor((UniversalProcPtr)userUPP); }
#else
#define DisposeADSPCompletionUPP(userUPP) DisposeRoutineDescriptor(userUPP)
#endif
#endif
/*
* InvokeADSPConnectionEventUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter InvokeADSPConnectionEventUPP(__A1, __A0)
#endif
EXTERN_API_C( void )
InvokeADSPConnectionEventUPP(
TPCCB sourceCCB,
ADSPConnectionEventUPP userUPP) ONEWORDINLINE(0x4E90);
#if !OPAQUE_UPP_TYPES && (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
#ifdef __cplusplus
inline void InvokeADSPConnectionEventUPP(TPCCB sourceCCB, ADSPConnectionEventUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppADSPConnectionEventProcInfo, sourceCCB); }
#else
#define InvokeADSPConnectionEventUPP(sourceCCB, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppADSPConnectionEventProcInfo, (sourceCCB))
#endif
#endif
/*
* InvokeADSPCompletionUPP()
*
* Availability:
* Non-Carbon CFM: available as macro/inline
* CarbonLib: not available
* Mac OS X: not available
*/
#if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
#pragma parameter InvokeADSPCompletionUPP(__A0, __A1)
#endif
EXTERN_API_C( void )
InvokeADSPCompletionUPP(
DSPPBPtr thePBPtr,
ADSPCompletionUPP userUPP) ONEWORDINLINE(0x4E91);
#if !OPAQUE_UPP_TYPES && (!TARGET_OS_MAC || !TARGET_CPU_68K || TARGET_RT_MAC_CFM)
#ifdef __cplusplus
inline void InvokeADSPCompletionUPP(DSPPBPtr thePBPtr, ADSPCompletionUPP userUPP) { CALL_ONE_PARAMETER_UPP(userUPP, uppADSPCompletionProcInfo, thePBPtr); }
#else
#define InvokeADSPCompletionUPP(thePBPtr, userUPP) CALL_ONE_PARAMETER_UPP((userUPP), uppADSPCompletionProcInfo, (thePBPtr))
#endif
#endif
#endif /* CALL_NOT_IN_CARBON */
#if CALL_NOT_IN_CARBON || OLDROUTINENAMES
/* support for pre-Carbon UPP routines: New...Proc and Call...Proc */
#define NewADSPConnectionEventProc(userRoutine) NewADSPConnectionEventUPP(userRoutine)
#define NewADSPCompletionProc(userRoutine) NewADSPCompletionUPP(userRoutine)
#define CallADSPConnectionEventProc(userRoutine, sourceCCB) InvokeADSPConnectionEventUPP(sourceCCB, userRoutine)
#define CallADSPCompletionProc(userRoutine, thePBPtr) InvokeADSPCompletionUPP(thePBPtr, userRoutine)
#endif /* CALL_NOT_IN_CARBON */
#if PRAGMA_STRUCT_ALIGN
#pragma options align=reset
#elif PRAGMA_STRUCT_PACKPUSH
#pragma pack(pop)
#elif PRAGMA_STRUCT_PACK
#pragma pack()
#endif
#ifdef PRAGMA_IMPORT_OFF
#pragma import off
#elif PRAGMA_IMPORT
#pragma import reset
#endif
#ifdef __cplusplus
}
#endif
#endif /* __ADSP__ */