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 * 18 June 1998 sdouglas Start IOKit version.
27 * 17 Nov 1998 suurballe Port objc to c++
30 #include <IOKit/adb/IOADBDevice.h>
32 #define super IOService
33 OSDefineMetaClassAndStructors(IOADBDevice
,IOService
)
35 // **********************************************************************************
38 // **********************************************************************************
39 bool IOADBDevice::init ( OSDictionary
* regEntry
, ADBDeviceControl
* us
)
41 if( !super::init(regEntry
))
49 // **********************************************************************************
52 // **********************************************************************************
53 bool IOADBDevice::attach ( IOADBBus
* controller
)
55 if( !super::attach(controller
))
62 // **********************************************************************************
65 // **********************************************************************************
67 bool IOADBDevice::matchPropertyTable( OSDictionary
* table
)
69 return( bus
->matchNubWithPropertyTable( this, table
));
72 // **********************************************************************************
75 // **********************************************************************************
76 bool IOADBDevice::seizeForClient ( IOService
* client
, ADB_callback_func handler
)
78 bus
->setOwner(fBusRef
,client
,handler
);
84 // **********************************************************************************
87 // **********************************************************************************
88 void IOADBDevice::releaseFromClient ( IORegistryEntry
* )
90 kprintf("IOADBDevice::releaseFromClient\n");
91 bus
->clearOwner(fBusRef
);
95 // **********************************************************************************
98 // **********************************************************************************
99 IOReturn
IOADBDevice::flush ( void )
101 if ( isInactive() ) {
102 return kIOReturnNotOpen
;
104 return( bus
->flush(fBusRef
) );
108 // **********************************************************************************
111 // **********************************************************************************
112 IOReturn
IOADBDevice::readRegister ( IOADBRegister adbRegister
, UInt8
* data
,
113 IOByteCount
* length
)
115 if ( isInactive() ) {
116 return kIOReturnNotOpen
;
118 return( bus
->readRegister(fBusRef
,adbRegister
,data
,length
) );
122 // **********************************************************************************
125 // **********************************************************************************
126 IOReturn
IOADBDevice::writeRegister ( IOADBRegister adbRegister
, UInt8
* data
,
127 IOByteCount
* length
)
129 if ( isInactive() ) {
130 return kIOReturnNotOpen
;
132 return( bus
->writeRegister(fBusRef
,adbRegister
,data
,length
) );
136 // **********************************************************************************
139 // **********************************************************************************
140 IOADBAddress
IOADBDevice::address ( void )
142 return( bus
->address(fBusRef
) );
146 // **********************************************************************************
149 // **********************************************************************************
150 IOADBAddress
IOADBDevice::defaultAddress ( void )
152 return( bus
->defaultAddress(fBusRef
) );
156 // **********************************************************************************
159 // **********************************************************************************
160 UInt8
IOADBDevice::handlerID ( void )
162 return( bus
->handlerID(fBusRef
) );
166 // **********************************************************************************
169 // **********************************************************************************
170 UInt8
IOADBDevice::defaultHandlerID ( void )
172 return( bus
->defaultHandlerID(fBusRef
) );
176 // **********************************************************************************
179 // **********************************************************************************
180 IOReturn
IOADBDevice::setHandlerID ( UInt8 handlerID
)
182 return( bus
->setHandlerID(fBusRef
,handlerID
) );
186 // **********************************************************************************
189 // **********************************************************************************
190 void * IOADBDevice::busRef ( void )