2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
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
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.
23 * @APPLE_LICENSE_HEADER_END@
26 * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991
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.
35 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
36 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
37 * FOR A PARTICULAR PURPOSE.
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.
47 * Copyright 1996 1995 by Apple Computer, Inc. 1997 1996 1995 1994 1993 1992 1991
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.
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.
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.
70 * 18 June 1998 sdouglas Start IOKit version.
71 * 23 Nov 1998 suurballe Port to C++
74 #ifndef _IOKIT_IOADBBUS_H
75 #define _IOKIT_IOADBBUS_H
77 #include <IOKit/IOService.h>
78 #include <IOKit/adb/adb.h>
82 #define ADB_DEVICE_COUNT 16
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 */
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
98 * ADB IORegistryEntry properties
101 #define ADBaddressProperty "address"
102 #define ADBhandlerIDProperty "handler id"
103 #define ADBdefAddressProperty "default address"
104 #define ADBdefHandlerProperty "default handler id"
105 #define ADBnameProperty "name"
108 struct ADBDeviceControl
{
109 IOADBAddress address
;
110 IOADBAddress defaultAddress
;
112 UInt8 defaultHandlerID
;
115 ADB_callback_func handler
;
119 typedef struct ADBDeviceControl ADBDeviceControl
;
122 class IOADBBus
: public IOService
124 OSDeclareAbstractStructors(IOADBBus
)
128 ADBDeviceControl
* adbDevices
[ ADB_DEVICE_COUNT
];
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;
147 #endif /* ! _IOKIT_IOADBBUS_H */