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 (c) 1999 Apple Computer, Inc. All rights reserved.
27 #include <IOKit/assert.h>
28 #include <IOKit/IOLib.h>
29 #include <IOKit/IOBufferMemoryDescriptor.h>
30 #include "IOADBControllerUserClient.h"
32 #define super IOUserClient
34 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
36 OSDefineMetaClassAndStructors(IOADBControllerUserClient
, IOUserClient
)
38 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
40 IOADBControllerUserClient
*IOADBControllerUserClient::withTask(task_t owningTask
)
42 IOADBControllerUserClient
* me
;
44 me
= new IOADBControllerUserClient
;
50 me
->fTask
= owningTask
;
55 bool IOADBControllerUserClient::start( IOService
* provider
)
57 assert(OSDynamicCast(IOADBController
, provider
));
58 if(!super::start(provider
))
60 fOwner
= (IOADBController
*)provider
;
62 // Got the owner, so initialize the call structures
63 fMethods
[kADBReadDevice
].object
= provider
;
64 fMethods
[kADBReadDevice
].func
= (IOMethod
)&IOADBController::readDeviceForUser
;
65 fMethods
[kADBReadDevice
].count0
= 2;
66 fMethods
[kADBReadDevice
].count1
= 8;
67 fMethods
[kADBReadDevice
].flags
= kIOUCScalarIStructO
;
69 fMethods
[kADBWriteDevice
].object
= provider
;
70 fMethods
[kADBWriteDevice
].func
= (IOMethod
)&IOADBController::writeDeviceForUser
;
71 fMethods
[kADBWriteDevice
].count0
= 4;
72 fMethods
[kADBWriteDevice
].count1
= 0;
73 fMethods
[kADBWriteDevice
].flags
= kIOUCScalarIScalarO
;
75 fMethods
[kADBClaimDevice
].object
= provider
;
76 fMethods
[kADBClaimDevice
].func
= (IOMethod
)&IOADBController::claimDevice
;
77 fMethods
[kADBClaimDevice
].count0
= 1;
78 fMethods
[kADBClaimDevice
].count1
= 0;
79 fMethods
[kADBClaimDevice
].flags
= kIOUCScalarIScalarO
;
81 fMethods
[kADBReleaseDevice
].object
= provider
;
82 fMethods
[kADBReleaseDevice
].func
= (IOMethod
)&IOADBController::releaseDevice
;
83 fMethods
[kADBReleaseDevice
].count0
= 1;
84 fMethods
[kADBReleaseDevice
].count1
= 0;
85 fMethods
[kADBReleaseDevice
].flags
= kIOUCScalarIScalarO
;
90 IOReturn
IOADBControllerUserClient::clientMemoryForType( UInt32 type
,
91 UInt32
* flags
, IOLogicalAddress
* address
, IOByteCount
* size
)
93 return kIOReturnUnsupported
;
96 IOReturn
IOADBControllerUserClient::clientClose( void )
100 return kIOReturnSuccess
;
103 IOReturn
IOADBControllerUserClient::clientDied( void )
105 return( clientClose());
108 IOReturn
IOADBControllerUserClient::connectClient( IOUserClient
* client
)
110 return kIOReturnSuccess
;
113 IOExternalMethod
* IOADBControllerUserClient::getExternalMethodForIndex( UInt32 index
)
115 if(index
>= kNumADBMethods
)
118 return &fMethods
[index
];
121 IOReturn
IOADBControllerUserClient::registerNotificationPort ( mach_port_t port
, UInt32 type
)
123 return kIOReturnUnsupported
;