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