]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/adb/IOADBBus.h
4f8c3fb48319d4999ea81d6be5a40f8feccaee29
[apple/xnu.git] / iokit / IOKit / adb / IOADBBus.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 Start IOKit version.
71 * 23 Nov 1998 suurballe Port to C++
72 */
73
74 #ifndef _IOKIT_IOADBBUS_H
75 #define _IOKIT_IOADBBUS_H
76
77 #include <IOKit/IOService.h>
78 #include <IOKit/adb/adb.h>
79
80 class IOADBDevice;
81
82 #define ADB_DEVICE_COUNT 16
83
84 #define ADB_FLAGS_PRESENT 0x00000001 /* Device is present */
85 #define ADB_FLAGS_REGISTERED 0x00000002 /* Device has a handler */
86 #define ADB_FLAGS_UNRESOLVED 0x00000004 /* Device has not been fully probed */
87
88 /*
89 * ADB Commands
90 */
91
92 #define ADB_DEVCMD_SELF_TEST 0xff
93 #define ADB_DEVCMD_CHANGE_ID 0xfe
94 #define ADB_DEVCMD_CHANGE_ID_AND_ACT 0xfd
95 #define ADB_DEVCMD_CHANGE_ID_AND_ENABLE 0x00
96
97 /*
98 * ADB IORegistryEntry properties
99 */
100
101 #define ADBaddressProperty "address"
102 #define ADBhandlerIDProperty "handler id"
103 #define ADBdefAddressProperty "default address"
104 #define ADBdefHandlerProperty "default handler id"
105 #define ADBnameProperty "name"
106
107
108 struct ADBDeviceControl {
109 IOADBAddress address;
110 IOADBAddress defaultAddress;
111 UInt8 handlerID;
112 UInt8 defaultHandlerID;
113 UInt32 flags;
114 IOService * owner;
115 ADB_callback_func handler;
116 IOADBDevice * nub;
117 };
118
119 typedef struct ADBDeviceControl ADBDeviceControl;
120
121
122 class IOADBBus: public IOService
123 {
124 OSDeclareAbstractStructors(IOADBBus)
125
126 public:
127
128 ADBDeviceControl * adbDevices[ ADB_DEVICE_COUNT ];
129
130 virtual bool init ( OSDictionary * properties = 0 );
131 virtual bool matchNubWithPropertyTable( IOService * device, OSDictionary * propertyTable ) = 0;
132 virtual IOReturn setOwner ( void * device, IOService * client, ADB_callback_func handler ) = 0;
133 virtual IOReturn clearOwner ( void * device ) = 0;
134 virtual IOReturn flush ( ADBDeviceControl * busRef ) = 0;
135 virtual IOReturn readRegister ( ADBDeviceControl * busRef, IOADBRegister adbRegister,
136 UInt8 * data, IOByteCount * length ) = 0;
137 virtual IOReturn writeRegister ( ADBDeviceControl * busRef, IOADBRegister adbRegister,
138 UInt8 * data, IOByteCount * length ) = 0;
139 virtual IOADBAddress address ( ADBDeviceControl * busRef ) = 0;
140 virtual IOADBAddress defaultAddress ( ADBDeviceControl * busRef ) = 0;
141 virtual UInt8 handlerID ( ADBDeviceControl * busRef ) = 0;
142 virtual UInt8 defaultHandlerID ( ADBDeviceControl * busRef ) = 0;
143 virtual IOReturn setHandlerID ( ADBDeviceControl * busRef, UInt8 handlerID ) = 0;
144
145 };
146
147 #endif /* ! _IOKIT_IOADBBUS_H */
148