]> git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/platform/drvApplePS2Controller/ApplePS2MouseDevice.cpp
7294baba0c8f97e170b68b6ec86dfb79ae3c719c
[apple/xnu.git] / iokit / Drivers / platform / drvApplePS2Controller / ApplePS2MouseDevice.cpp
1 /*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
11 *
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
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 #include <IOKit/assert.h>
24 #include <IOKit/ps2/ApplePS2MouseDevice.h>
25 #include "ApplePS2Controller.h"
26
27 // =============================================================================
28 // ApplePS2MouseDevice Class Implementation
29 //
30
31 #define super IOService
32 OSDefineMetaClassAndStructors(ApplePS2MouseDevice, IOService);
33
34 bool ApplePS2MouseDevice::attach(IOService * provider)
35 {
36 if( !super::attach(provider) ) return false;
37
38 assert(_controller == 0);
39 _controller = (ApplePS2Controller *)provider;
40 _controller->retain();
41
42 return true;
43 }
44
45 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46
47 void ApplePS2MouseDevice::detach( IOService * provider )
48 {
49 assert(_controller == provider);
50 _controller->release();
51 _controller = 0;
52
53 super::detach(provider);
54 }
55
56 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
57
58 void ApplePS2MouseDevice::installInterruptAction(OSObject * target,
59 PS2InterruptAction action)
60 {
61 _controller->installInterruptAction(kDT_Mouse, target, action);
62 }
63
64 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
65
66 void ApplePS2MouseDevice::uninstallInterruptAction()
67 {
68 _controller->uninstallInterruptAction(kDT_Mouse);
69 }
70
71 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72
73 PS2Request * ApplePS2MouseDevice::allocateRequest()
74 {
75 return _controller->allocateRequest();
76 }
77
78 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
79
80 void ApplePS2MouseDevice::freeRequest(PS2Request * request)
81 {
82 _controller->freeRequest(request);
83 }
84
85 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86
87 bool ApplePS2MouseDevice::submitRequest(PS2Request * request)
88 {
89 return _controller->submitRequest(request);
90 }
91
92 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
93
94 void ApplePS2MouseDevice::submitRequestAndBlock(PS2Request * request)
95 {
96 _controller->submitRequestAndBlock(request);
97 }