]> git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/platform/drvApplePS2Controller/ApplePS2KeyboardDevice.cpp
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / Drivers / platform / drvApplePS2Controller / ApplePS2KeyboardDevice.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/ApplePS2KeyboardDevice.h>
25 #include "ApplePS2Controller.h"
26
27 // =============================================================================
28 // ApplePS2KeyboardDevice Class Implementation
29 //
30
31 #define super IOService
32 OSDefineMetaClassAndStructors(ApplePS2KeyboardDevice, IOService);
33
34 bool ApplePS2KeyboardDevice::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 ApplePS2KeyboardDevice::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 ApplePS2KeyboardDevice::installInterruptAction(OSObject * target,
59 PS2InterruptAction action)
60 {
61 _controller->installInterruptAction(kDT_Keyboard, target, action);
62 }
63
64 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
65
66 void ApplePS2KeyboardDevice::uninstallInterruptAction()
67 {
68 _controller->uninstallInterruptAction(kDT_Keyboard);
69 }
70
71 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72
73 PS2Request * ApplePS2KeyboardDevice::allocateRequest()
74 {
75 return _controller->allocateRequest();
76 }
77
78 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
79
80 void ApplePS2KeyboardDevice::freeRequest(PS2Request * request)
81 {
82 _controller->freeRequest(request);
83 }
84
85 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
86
87 bool ApplePS2KeyboardDevice::submitRequest(PS2Request * request)
88 {
89 return _controller->submitRequest(request);
90 }
91
92 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
93
94 void ApplePS2KeyboardDevice::submitRequestAndBlock(PS2Request * request)
95 {
96 _controller->submitRequestAndBlock(request);
97 }