]> git.saurik.com Git - apple/xnu.git/blob - iokit/Drivers/hidsystem/drvApplePS2Mouse/ApplePS2Mouse.h
ae211bcf4ebbda3c23629559cdbec3760c5c38ab
[apple/xnu.git] / iokit / Drivers / hidsystem / drvApplePS2Mouse / ApplePS2Mouse.h
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 #ifndef _APPLEPS2MOUSE_H
24 #define _APPLEPS2MOUSE_H
25
26 #include <IOKit/ps2/ApplePS2MouseDevice.h>
27 #include <IOKit/hidsystem/IOHIPointing.h>
28
29 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
30 // Local Declarations
31 //
32
33 #define kPacketLengthMax 4
34 #define kPacketLengthStandard 3
35 #define kPacketLengthIntellimouse 4
36
37 typedef enum
38 {
39 kMouseTypeStandard = 0x00,
40 kMouseTypeIntellimouse = 0x03
41 } PS2MouseId;
42
43 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
44 // ApplePS2Mouse Class Declaration
45 //
46
47 class ApplePS2Mouse : public IOHIPointing
48 {
49 OSDeclareDefaultStructors(ApplePS2Mouse);
50
51 private:
52 ApplePS2MouseDevice * _device;
53 unsigned _interruptHandlerInstalled:1;
54 UInt8 _packetBuffer[kPacketLengthMax];
55 UInt32 _packetByteCount;
56 UInt32 _packetLength;
57 IOFixed _resolution; // (dots per inch)
58 PS2MouseId _type;
59
60 virtual void dispatchRelativePointerEventWithPacket(UInt8 * packet);
61 virtual UInt8 getMouseID();
62 virtual UInt32 getMouseInformation();
63 virtual void setCommandByte(UInt8 setBits, UInt8 clearBits);
64 virtual bool setIntellimouseMode();
65 virtual void setMouseEnable(bool enable);
66 virtual void setMouseSampleRate(UInt8 sampleRate);
67
68 protected:
69 virtual IOItemCount buttonCount();
70 virtual IOFixed resolution();
71
72 public:
73 virtual bool init(OSDictionary * properties);
74 virtual ApplePS2Mouse * probe(IOService * provider, SInt32 * score);
75
76 virtual bool start(IOService * provider);
77 virtual void stop(IOService * provider);
78
79 virtual void interruptOccurred(UInt8 data);
80
81 virtual UInt32 deviceType();
82 virtual UInt32 interfaceID();
83 };
84
85 #endif /* _APPLEPS2MOUSE_H */