]> git.saurik.com Git - apple/xnu.git/blob - iokit/Families/IOADBBus/IOADBBusPriv.h
xnu-344.23.tar.gz
[apple/xnu.git] / iokit / Families / IOADBBus / IOADBBusPriv.h
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991
24 * All Rights Reserved
25 *
26 * Permission to use, copy, modify, and distribute this software and
27 * its documentation for any purpose and without fee is hereby granted,
28 * provided that the above copyright notice appears in all copies and
29 * that both the copyright notice and this permission notice appear in
30 * supporting documentation.
31 *
32 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
33 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
34 * FOR A PARTICULAR PURPOSE.
35 *
36 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
37 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
38 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
39 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
40 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
41 *
42 */
43 /*
44 * Copyright 1996 1995 by Apple Computer, Inc. 1997 1996 1995 1994 1993 1992 1991
45 * All Rights Reserved
46 *
47 * Permission to use, copy, modify, and distribute this software and
48 * its documentation for any purpose and without fee is hereby granted,
49 * provided that the above copyright notice appears in all copies and
50 * that both the copyright notice and this permission notice appear in
51 * supporting documentation.
52 *
53 * APPLE COMPUTER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
54 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
55 * FOR A PARTICULAR PURPOSE.
56 *
57 * IN NO EVENT SHALL APPLE COMPUTER BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
58 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
59 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
60 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
61 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
62 */
63 /*
64 * MKLINUX-1.0DR2
65 */
66 /*
67 * 18 June 1998 sdouglas
68 * Start IOKit version.
69 */
70
71 #define ADB_DEVICE_COUNT 16
72
73 #define ADB_FLAGS_PRESENT 0x00000001 /* Device is present */
74 #define ADB_FLAGS_REGISTERED 0x00000002 /* Device has a handler */
75 #define ADB_FLAGS_UNRESOLVED 0x00000004 /* Device has not been fully probed */
76
77 /*
78 * ADB Commands
79 */
80
81 #define ADB_DEVCMD_SELF_TEST 0xff
82 #define ADB_DEVCMD_CHANGE_ID 0xfe
83 #define ADB_DEVCMD_CHANGE_ID_AND_ACT 0xfd
84 #define ADB_DEVCMD_CHANGE_ID_AND_ENABLE 0x00
85
86 #ifndef __cplusplus
87
88 struct ADBDeviceControl {
89 IOADBAddress address;
90 IOADBAddress defaultAddress;
91 UInt8 handlerID;
92 UInt8 defaultHandlerID;
93 UInt32 flags;
94 id owner; // here for speed
95 };
96
97 typedef struct ADBDeviceControl ADBDeviceControl;
98
99
100 @class IOADBDevice;
101
102 @interface IOADBBus : IODevice <IOADBAutoPollHandler>
103 {
104 IODevice <IOADBController> * controller;
105 @public
106 ADBDeviceControl * adbDevices[ ADB_DEVICE_COUNT ];
107 }
108
109 - (IOReturn) probeBus;
110 - setUpName:(IOADBDevice *)device;
111
112 /////// nub -> bus
113
114 - (IOReturn) setOwner:owner forDevice:(void *)busRef;
115
116 - (IOReturn) flush:(void *)busRef;
117
118 - (IOReturn) readRegister:(void *)busRef
119 adbRegister:(IOADBRegister)adbRegister
120 contents:(UInt8 *)data
121 length:(IOByteCount *)length;
122
123 - (IOReturn) writeRegister:(void *)busRef
124 adbRegister:(IOADBRegister)adbRegister
125 contents:(UInt8 *)data
126 length:(IOByteCount *)length;
127
128 - (IOADBAddress) address:(void *)busRef;
129
130 - (IOADBAddress) defaultAddress:(void *)busRef;
131
132 - (UInt8) handlerID:(void *)busRef;
133
134 - (UInt8) defaultHandlerID:(void *)busRef;
135
136 - (IOReturn) setHandlerID:(void *)busRef
137 handlerID:(UInt8)handlerID;
138
139 @end
140
141 @interface IOADBDevice : IODevice <IOADBDevice>
142 {
143 IOADBBus * bus;
144 void * busRef;
145 }
146
147 - initForBus:(IOADBBus *)bus andBusRef:(void *)busRef;
148
149 - (void *) busRef;
150
151 @end
152
153 #endif