2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
23 * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991
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.
32 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
33 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
34 * FOR A PARTICULAR PURPOSE.
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.
44 * Copyright 1996 1995 by Apple Computer, Inc. 1997 1996 1995 1994 1993 1992 1991
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.
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.
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.
67 * 18 June 1998 sdouglas Start IOKit version.
68 * 23 Nov 1998 suurballe Port to C++
71 #ifndef _IOKIT_IOADBBUS_H
72 #define _IOKIT_IOADBBUS_H
74 #include <IOKit/IOService.h>
75 #include <IOKit/adb/adb.h>
79 #define ADB_DEVICE_COUNT 16
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 */
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
95 * ADB IORegistryEntry properties
98 #define ADBaddressProperty "address"
99 #define ADBhandlerIDProperty "handler id"
100 #define ADBdefAddressProperty "default address"
101 #define ADBdefHandlerProperty "default handler id"
102 #define ADBnameProperty "name"
105 struct ADBDeviceControl
{
106 IOADBAddress address
;
107 IOADBAddress defaultAddress
;
109 UInt8 defaultHandlerID
;
112 ADB_callback_func handler
;
116 typedef struct ADBDeviceControl ADBDeviceControl
;
119 class IOADBBus
: public IOService
121 OSDeclareAbstractStructors(IOADBBus
)
125 ADBDeviceControl
* adbDevices
[ ADB_DEVICE_COUNT
];
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;
144 #endif /* ! _IOKIT_IOADBBUS_H */