|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /* Copyright (c) 1997 Apple Computer, Inc. All rights reserved.
26: *
27: * IOADBBus.h - This file contains the definition of the
28: * IOADBBus Class, which is an indirect driver designed to
29: * communicate with devices on the ADB bus.
30: *
31: * Note: this API is very preliminary and is expected to change drastically
32: * in future releases, caveat emptor. In the future it will probably be based
33: * on some extension to the PortDevices protocol.
34: *
35: * HISTORY
36: * 1997-12-19 Brent Schorsch (schorsch) created IOADBDevice.h
37: * 1998-01-19 Dave Suurballe transformed into IOADBBus.h (DS2)
38: */
39:
40: #import <objc/Object.h>
41: #import <driverkit/driverTypes.h>
42: #import <driverkit/IODevice.h> // DS2
43:
44: typedef void (*autopoll_callback)(int, unsigned char *, int, void *);
45:
46: #ifndef ADB_TYPES /* added so can include IOADBDevice.h also */
47: #define ADB_TYPES
48:
49: typedef unsigned long int IOADBDeviceState;
50:
51: enum
52: {
53: /*
54: * set if the adb device is available to get and object reference
55: * (and therefore get/set registers)
56: */
57: kIOADBDeviceAvailable = 0x00000001
58: };
59:
60: #define IO_ADB_MAX_DEVICE 16
61: #define IO_ADB_MAX_PACKET 8
62:
63: typedef struct _adbDeviceInfo
64: {
65: int originalAddress; // type
66: int address; // at the present moment, the adbAddress
67: int originalHandlerID; // handler ID of device when first probed
68: int handlerID; // handler ID of device at the present moment
69: long uniqueID;
70: unsigned long flags; // see previous enum for flag bits
71: } IOADBDeviceInfo;
72:
73: #endif ADB_TYPES
74:
75:
76: // DS2...
77: @protocol ADBprotocol
78:
79: - (IOReturn) GetTable: (IOADBDeviceInfo *) table
80: : (int *) lenP;
81:
82: - (IOReturn) getADBInfo: (int) whichDevice
83: : (IOADBDeviceInfo *) deviceInfo;
84:
85: - (IOReturn) flushADBDevice: (int) whichDevice;
86:
87: - (IOReturn) readADBDeviceRegister: (int) whichDevice
88: : (int) whichRegister
89: : (unsigned char *) buffer
90: : (int *) length;
91:
92: - (IOReturn) writeADBDeviceRegister: (int) whichDevice
93: : (int) whichRegister
94: : (unsigned char *) buffer
95: : (int) length;
96:
97: - (IOReturn) adb_register_handler: (int) type
98: : (autopoll_callback) handler;
99:
100: @end
101: // ...DS2
102:
103: @interface IOADBBus : IODevice <ADBprotocol> // DS2
104: {
105: void *_priv; // DS2
106: }
107:
108: // Class methods
109:
110: // DS2...
111:
112: + (BOOL) probe: (id) deviceDescription;
113:
114: - initFromDeviceDescription:(IODeviceDescription *)deviceDescription;
115:
116: + (IODeviceStyle) deviceStyle;
117:
118: + (Protocol **)requiredProtocols;
119:
120: - free;
121:
122: // ...DS2
123:
124: /*
125: * Call this class method with an array that is IO_ADB_MAX_DEVICE long.
126: */
127: - (IOReturn) GetTable: (IOADBDeviceInfo *) table
128: : (int *) lenP;
129:
130: // DS2 - initForDevice: (long) uniqueID
131: // : (IOReturn *) result;
132:
133: - (IOReturn) getADBInfo: (int) whichDevice // DS2
134: : (IOADBDeviceInfo *) deviceInfo; // DS2
135:
136: - (IOReturn) flushADBDevice: (int) whichDevice; // DS2
137:
138: /*
139: * Note, the buffers must be IO_ADM_MAX_PACKET long.
140: */
141: - (IOReturn) readADBDeviceRegister: (int) whichDevice // DS2
142: : (int) whichRegister // DS2
143: : (unsigned char *) buffer
144: : (int *) length;
145:
146: - (IOReturn) writeADBDeviceRegister: (int) whichDevice // DS2
147: : (int) whichRegister // DS2
148: : (unsigned char *) buffer
149: : (int) length;
150:
151: /* The state functions below are not currently implemented */
152: /*
153: * Set the state for the port device.
154: */
155: - (IOReturn) setState: (int) whichDevice // DS2
156: : (IOADBDeviceState) state // DS2
157: : (IOADBDeviceState) mask;
158:
159: /*
160: * Get the state for the port device.
161: */
162: - (IOADBDeviceState) getState: (int) whichDevice; // DS2
163:
164: - (IOReturn) adb_register_handler: (int) type // DS2
165: : (autopoll_callback) handler;
166: /*
167: * Wait for the atleast one of the state bits defined in mask to be equal
168: * to the value defined in state.
169: * Check on entry then sleep until necessary.
170: */
171: - (IOReturn) watchState: (int) whichDevice // DS2
172: : (IOADBDeviceState *) state // DS2
173: : (IOADBDeviceState) mask;
174:
175:
176: @end
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.