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 * 18 June 1998 sdouglas Start IOKit version.
24 * 17 Nov 1998 suurballe Port objc to c++
27 #include <IOKit/adb/IOADBDevice.h>
29 #define super IOService
30 OSDefineMetaClassAndStructors(IOADBDevice
,IOService
)
32 // **********************************************************************************
35 // **********************************************************************************
36 bool IOADBDevice::init ( OSDictionary
* regEntry
, ADBDeviceControl
* us
)
38 if( !super::init(regEntry
))
46 // **********************************************************************************
49 // **********************************************************************************
50 bool IOADBDevice::attach ( IOADBBus
* controller
)
52 if( !super::attach(controller
))
59 // **********************************************************************************
62 // **********************************************************************************
64 bool IOADBDevice::matchPropertyTable( OSDictionary
* table
)
66 return( bus
->matchNubWithPropertyTable( this, table
));
69 // **********************************************************************************
72 // **********************************************************************************
73 bool IOADBDevice::seizeForClient ( IOService
* client
, ADB_callback_func handler
)
75 bus
->setOwner(fBusRef
,client
,handler
);
81 // **********************************************************************************
84 // **********************************************************************************
85 void IOADBDevice::releaseFromClient ( IORegistryEntry
* )
87 kprintf("IOADBDevice::releaseFromClient\n");
88 bus
->clearOwner(fBusRef
);
92 // **********************************************************************************
95 // **********************************************************************************
96 IOReturn
IOADBDevice::flush ( void )
99 return kIOReturnNotOpen
;
101 return( bus
->flush(fBusRef
) );
105 // **********************************************************************************
108 // **********************************************************************************
109 IOReturn
IOADBDevice::readRegister ( IOADBRegister adbRegister
, UInt8
* data
,
110 IOByteCount
* length
)
112 if ( isInactive() ) {
113 return kIOReturnNotOpen
;
115 return( bus
->readRegister(fBusRef
,adbRegister
,data
,length
) );
119 // **********************************************************************************
122 // **********************************************************************************
123 IOReturn
IOADBDevice::writeRegister ( IOADBRegister adbRegister
, UInt8
* data
,
124 IOByteCount
* length
)
126 if ( isInactive() ) {
127 return kIOReturnNotOpen
;
129 return( bus
->writeRegister(fBusRef
,adbRegister
,data
,length
) );
133 // **********************************************************************************
136 // **********************************************************************************
137 IOADBAddress
IOADBDevice::address ( void )
139 return( bus
->address(fBusRef
) );
143 // **********************************************************************************
146 // **********************************************************************************
147 IOADBAddress
IOADBDevice::defaultAddress ( void )
149 return( bus
->defaultAddress(fBusRef
) );
153 // **********************************************************************************
156 // **********************************************************************************
157 UInt8
IOADBDevice::handlerID ( void )
159 return( bus
->handlerID(fBusRef
) );
163 // **********************************************************************************
166 // **********************************************************************************
167 UInt8
IOADBDevice::defaultHandlerID ( void )
169 return( bus
->defaultHandlerID(fBusRef
) );
173 // **********************************************************************************
176 // **********************************************************************************
177 IOReturn
IOADBDevice::setHandlerID ( UInt8 handlerID
)
179 return( bus
->setHandlerID(fBusRef
,handlerID
) );
183 // **********************************************************************************
186 // **********************************************************************************
187 void * IOADBDevice::busRef ( void )