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