mirror of
https://github.com/zhigang1992/OS-X-Voodoo-PS2-Controller.git
synced 2026-01-12 17:32:48 +08:00
cleanup; refactoring ApplePS2Keyboard/MouseDevice
This commit is contained in:
@@ -13,15 +13,14 @@
|
||||
84045666161E3AF900D74D7F /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 84045664161E3AF900D74D7F /* InfoPlist.strings */; };
|
||||
84077EF71630080E0093D049 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 84077EF31630080E0093D049 /* InfoPlist.strings */; };
|
||||
84077EF81630080E0093D049 /* VoodooPS2synapticsPane.xib in Resources */ = {isa = PBXBuildFile; fileRef = 84077EF51630080E0093D049 /* VoodooPS2synapticsPane.xib */; };
|
||||
840F104A16EFE42600E8C116 /* ApplePS2Device.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 840F104916EFE42600E8C116 /* ApplePS2Device.cpp */; };
|
||||
84167820161B55B2002C60E6 /* VoodooPS2Controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8416781F161B55B2002C60E6 /* VoodooPS2Controller.cpp */; };
|
||||
84167836161B5613002C60E6 /* VoodooPS2Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84167835161B5613002C60E6 /* VoodooPS2Keyboard.cpp */; };
|
||||
8416784A161B56A2002C60E6 /* VoodooPS2Mouse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84167849161B56A2002C60E6 /* VoodooPS2Mouse.cpp */; };
|
||||
841FEF7E16539DDF00A4D4C8 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84833FCC161BA27700845294 /* IOKit.framework */; };
|
||||
84243ADA1698783A00BC5AEB /* org.voodoo.driver.synapticsconfigload.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84243AD91698783A00BC5AEB /* org.voodoo.driver.synapticsconfigload.plist */; };
|
||||
84833FA3161B627D00845294 /* ApplePS2Device.h in Headers */ = {isa = PBXBuildFile; fileRef = 84833F9D161B627D00845294 /* ApplePS2Device.h */; settings = {ATTRIBUTES = (); }; };
|
||||
84833FA4161B627D00845294 /* ApplePS2KeyboardDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84833F9E161B627D00845294 /* ApplePS2KeyboardDevice.cpp */; };
|
||||
84833FA5161B627D00845294 /* ApplePS2KeyboardDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 84833F9F161B627D00845294 /* ApplePS2KeyboardDevice.h */; settings = {ATTRIBUTES = (); }; };
|
||||
84833FA6161B627D00845294 /* ApplePS2MouseDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84833FA0161B627D00845294 /* ApplePS2MouseDevice.cpp */; };
|
||||
84833FA7161B627D00845294 /* ApplePS2MouseDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 84833FA1161B627D00845294 /* ApplePS2MouseDevice.h */; settings = {ATTRIBUTES = (); }; };
|
||||
84833FAA161B629500845294 /* ApplePS2ToADBMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 84833FA9161B629500845294 /* ApplePS2ToADBMap.h */; settings = {ATTRIBUTES = (); }; };
|
||||
84833FB1161B62A900845294 /* VoodooPS2ALPSGlidePoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84833FAB161B62A900845294 /* VoodooPS2ALPSGlidePoint.cpp */; };
|
||||
@@ -43,6 +42,8 @@
|
||||
84C337AB1698BC5C009B8177 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84833FCC161BA27700845294 /* IOKit.framework */; };
|
||||
84DD197B162D496E0044D061 /* AppleACPIPS2Nub.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84DD1979162D496E0044D061 /* AppleACPIPS2Nub.cpp */; };
|
||||
84DD197C162D496E0044D061 /* AppleACPIPS2Nub.h in Headers */ = {isa = PBXBuildFile; fileRef = 84DD197A162D496E0044D061 /* AppleACPIPS2Nub.h */; };
|
||||
84EB0AE316F0AD9300016108 /* ApplePS2KeyboardDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84833F9E161B627D00845294 /* ApplePS2KeyboardDevice.cpp */; };
|
||||
84EB0AE516F0AD9600016108 /* ApplePS2MouseDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84833FA0161B627D00845294 /* ApplePS2MouseDevice.cpp */; };
|
||||
84F424E3161B59E500777765 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84F424C3161B593D00777765 /* Cocoa.framework */; };
|
||||
84F424E4161B59E500777765 /* PreferencePanes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84F424C5161B593D00777765 /* PreferencePanes.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
@@ -54,6 +55,7 @@
|
||||
84045665161E3AF900D74D7F /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
84077EF41630080E0093D049 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
|
||||
84077EF61630080E0093D049 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/VoodooPS2synapticsPane.xib; sourceTree = "<group>"; };
|
||||
840F104916EFE42600E8C116 /* ApplePS2Device.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplePS2Device.cpp; sourceTree = "<group>"; };
|
||||
84167813161B55B2002C60E6 /* VoodooPS2Controller.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VoodooPS2Controller.kext; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
84167817161B55B2002C60E6 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = System/Library/Frameworks/Kernel.framework; sourceTree = SDKROOT; };
|
||||
8416781A161B55B2002C60E6 /* VoodooPS2Controller-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "VoodooPS2Controller-Info.plist"; sourceTree = "<group>"; };
|
||||
@@ -232,6 +234,7 @@
|
||||
children = (
|
||||
84DD197A162D496E0044D061 /* AppleACPIPS2Nub.h */,
|
||||
84DD1979162D496E0044D061 /* AppleACPIPS2Nub.cpp */,
|
||||
840F104916EFE42600E8C116 /* ApplePS2Device.cpp */,
|
||||
84833F9E161B627D00845294 /* ApplePS2KeyboardDevice.cpp */,
|
||||
84833FA0161B627D00845294 /* ApplePS2MouseDevice.cpp */,
|
||||
8416781E161B55B2002C60E6 /* VoodooPS2Controller.h */,
|
||||
@@ -674,9 +677,10 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
84167820161B55B2002C60E6 /* VoodooPS2Controller.cpp in Sources */,
|
||||
84833FA4161B627D00845294 /* ApplePS2KeyboardDevice.cpp in Sources */,
|
||||
84833FA6161B627D00845294 /* ApplePS2MouseDevice.cpp in Sources */,
|
||||
84DD197B162D496E0044D061 /* AppleACPIPS2Nub.cpp in Sources */,
|
||||
840F104A16EFE42600E8C116 /* ApplePS2Device.cpp in Sources */,
|
||||
84EB0AE316F0AD9300016108 /* ApplePS2KeyboardDevice.cpp in Sources */,
|
||||
84EB0AE516F0AD9600016108 /* ApplePS2MouseDevice.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -41,8 +41,6 @@ static IOPMPowerState myTwoStates[2] = {
|
||||
{1, kIOPMPowerOn, kIOPMPowerOn, kIOPMPowerOn, 0, 0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
#define super IOPlatformDevice
|
||||
|
||||
OSDefineMetaClassAndStructors(AppleACPIPS2Nub, IOPlatformDevice);
|
||||
|
||||
// We could simply ask for the PE rather than importing the global
|
||||
|
||||
@@ -51,6 +51,7 @@ class IOPlatformExpert;
|
||||
*/
|
||||
class AppleACPIPS2Nub: public IOPlatformDevice
|
||||
{
|
||||
typedef IOPlatformDevice super;
|
||||
OSDeclareDefaultStructors(AppleACPIPS2Nub);
|
||||
|
||||
private:
|
||||
|
||||
155
VoodooPS2Controller/ApplePS2Device.cpp
Normal file
155
VoodooPS2Controller/ApplePS2Device.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* The contents of this file constitute Original Code as defined in and
|
||||
* are subject to the Apple Public Source License Version 1.1 (the
|
||||
* "License"). You may not use this file except in compliance with the
|
||||
* License. Please obtain a copy of the License at
|
||||
* http://www.apple.com/publicsource and read it before using this file.
|
||||
*
|
||||
* This Original Code and all software distributed under the License are
|
||||
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
|
||||
* License for the specific language governing rights and limitations
|
||||
* under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#include "ApplePS2Device.h"
|
||||
#include "VoodooPS2Controller.h"
|
||||
|
||||
OSDefineMetaClassAndStructors(ApplePS2Device, IOService);
|
||||
|
||||
// =============================================================================
|
||||
// ApplePS2Device Class Implementation
|
||||
//
|
||||
|
||||
bool ApplePS2Device::attach(IOService * provider)
|
||||
{
|
||||
if (!super::attach(provider))
|
||||
return false;
|
||||
|
||||
assert(_controller == 0);
|
||||
_controller = (ApplePS2Controller*)provider;
|
||||
_controller->retain();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::detach( IOService * provider )
|
||||
{
|
||||
assert(_controller == provider);
|
||||
_controller->release();
|
||||
_controller = 0;
|
||||
|
||||
super::detach(provider);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
PS2Request * ApplePS2Device::allocateRequest(int max)
|
||||
{
|
||||
return _controller->allocateRequest(max);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::freeRequest(PS2Request * request)
|
||||
{
|
||||
_controller->freeRequest(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool ApplePS2Device::submitRequest(PS2Request * request)
|
||||
{
|
||||
return _controller->submitRequest(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::submitRequestAndBlock(PS2Request * request)
|
||||
{
|
||||
_controller->submitRequestAndBlock(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
UInt8 ApplePS2Device::setCommandByte(UInt8 setBits, UInt8 clearBits)
|
||||
{
|
||||
return _controller->setCommandByte(setBits, clearBits);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::lock()
|
||||
{
|
||||
_controller->lock();
|
||||
}
|
||||
|
||||
void ApplePS2Device::unlock()
|
||||
{
|
||||
_controller->unlock();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::installInterruptAction(OSObject * target,
|
||||
PS2InterruptAction interruptAction,
|
||||
PS2PacketAction packetAction)
|
||||
{
|
||||
_controller->installInterruptAction(_deviceType, target, interruptAction, packetAction);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::uninstallInterruptAction()
|
||||
{
|
||||
_controller->uninstallInterruptAction(_deviceType);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::installPowerControlAction(
|
||||
OSObject * target,
|
||||
PS2PowerControlAction action)
|
||||
{
|
||||
_controller->installPowerControlAction(_deviceType, target, action);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::uninstallPowerControlAction()
|
||||
{
|
||||
_controller->uninstallPowerControlAction(_deviceType);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2Device::installMessageAction(OSObject* target, PS2MessageAction action)
|
||||
{
|
||||
_controller->installMessageAction(_deviceType, target, action);
|
||||
}
|
||||
|
||||
void ApplePS2Device::uninstallMessageAction()
|
||||
{
|
||||
_controller->uninstallMessageAction(_deviceType);
|
||||
}
|
||||
|
||||
void ApplePS2Device::dispatchMouseMessage(int message, void *data)
|
||||
{
|
||||
_controller->dispatchMessage(kDT_Mouse, message, data);
|
||||
}
|
||||
|
||||
void ApplePS2Device::dispatchKeyboardMessage(int message, void *data)
|
||||
{
|
||||
_controller->dispatchMessage(kDT_Keyboard, message, data);
|
||||
}
|
||||
|
||||
@@ -532,6 +532,67 @@ enum
|
||||
kPS2C_EnableDevice
|
||||
};
|
||||
|
||||
// PS/2 device types.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kDT_Keyboard,
|
||||
kDT_Mouse,
|
||||
#if WATCHDOG_TIMER
|
||||
kDT_Watchdog,
|
||||
#endif
|
||||
} PS2DeviceType;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// ApplePS2Device Class Declaration
|
||||
//
|
||||
|
||||
class ApplePS2Controller;
|
||||
|
||||
class ApplePS2Device : public IOService
|
||||
{
|
||||
typedef IOService super;
|
||||
OSDeclareDefaultStructors(ApplePS2Device);
|
||||
|
||||
protected:
|
||||
ApplePS2Controller* _controller;
|
||||
PS2DeviceType _deviceType;
|
||||
|
||||
public:
|
||||
virtual bool attach(IOService * provider);
|
||||
virtual void detach(IOService * provider);
|
||||
|
||||
// Interrupt Handling Routines
|
||||
|
||||
virtual void installInterruptAction(OSObject *, PS2InterruptAction, PS2PacketAction);
|
||||
virtual void uninstallInterruptAction();
|
||||
|
||||
// Request Submission Routines
|
||||
|
||||
virtual PS2Request* allocateRequest(int max = kMaxCommands);
|
||||
virtual void freeRequest(PS2Request * request);
|
||||
virtual bool submitRequest(PS2Request * request);
|
||||
virtual void submitRequestAndBlock(PS2Request * request);
|
||||
virtual UInt8 setCommandByte(UInt8 setBits, UInt8 clearBits);
|
||||
|
||||
// Power Control Handling Routines
|
||||
|
||||
virtual void installPowerControlAction(OSObject *, PS2PowerControlAction);
|
||||
virtual void uninstallPowerControlAction();
|
||||
|
||||
// Messaging
|
||||
|
||||
virtual void installMessageAction(OSObject*, PS2MessageAction);
|
||||
virtual void uninstallMessageAction();
|
||||
virtual void dispatchMouseMessage(int message, void *data);
|
||||
virtual void dispatchKeyboardMessage(int message, void *data);
|
||||
|
||||
// Exclusive access (command byte contention)
|
||||
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
};
|
||||
|
||||
#if 0 // Note: Now using architecture/i386/pio.h (see above)
|
||||
typedef unsigned short i386_ioport_t;
|
||||
inline unsigned char inb(i386_ioport_t port)
|
||||
|
||||
@@ -27,134 +27,14 @@
|
||||
// ApplePS2KeyboardDevice Class Implementation
|
||||
//
|
||||
|
||||
#define super IOService
|
||||
OSDefineMetaClassAndStructors(ApplePS2KeyboardDevice, IOService);
|
||||
|
||||
bool ApplePS2KeyboardDevice::attach( IOService * provider )
|
||||
{
|
||||
if( !super::attach(provider) ) return false;
|
||||
|
||||
assert(_controller == 0);
|
||||
_controller = (ApplePS2Controller *)provider;
|
||||
_controller->retain();
|
||||
|
||||
return true;
|
||||
}
|
||||
OSDefineMetaClassAndStructors(ApplePS2KeyboardDevice, ApplePS2Device);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::detach( IOService * provider )
|
||||
bool ApplePS2KeyboardDevice::init()
|
||||
{
|
||||
assert(_controller == provider);
|
||||
_controller->release();
|
||||
_controller = 0;
|
||||
|
||||
super::detach(provider);
|
||||
bool result = super::init();
|
||||
_deviceType = kDT_Keyboard;
|
||||
return result;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::installInterruptAction(OSObject * target,
|
||||
PS2InterruptAction interruptAction,
|
||||
PS2PacketAction packetAction)
|
||||
{
|
||||
_controller->installInterruptAction(kDT_Keyboard, target, interruptAction, packetAction);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::uninstallInterruptAction()
|
||||
{
|
||||
_controller->uninstallInterruptAction(kDT_Keyboard);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::installPowerControlAction(
|
||||
OSObject * target,
|
||||
PS2PowerControlAction action)
|
||||
{
|
||||
_controller->installPowerControlAction(kDT_Keyboard, target, action);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::uninstallPowerControlAction()
|
||||
{
|
||||
_controller->uninstallPowerControlAction(kDT_Keyboard);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
PS2Request * ApplePS2KeyboardDevice::allocateRequest(int max)
|
||||
{
|
||||
return _controller->allocateRequest(max);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::freeRequest(PS2Request * request)
|
||||
{
|
||||
_controller->freeRequest(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool ApplePS2KeyboardDevice::submitRequest(PS2Request * request)
|
||||
{
|
||||
return _controller->submitRequest(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::submitRequestAndBlock(PS2Request * request)
|
||||
{
|
||||
_controller->submitRequestAndBlock(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::installMessageAction(OSObject* target, PS2MessageAction action)
|
||||
{
|
||||
_controller->installMessageAction(kDT_Keyboard, target, action);
|
||||
}
|
||||
|
||||
void ApplePS2KeyboardDevice::uninstallMessageAction()
|
||||
{
|
||||
_controller->uninstallMessageAction(kDT_Keyboard);
|
||||
}
|
||||
|
||||
void ApplePS2KeyboardDevice::dispatchMouseMessage(int message, void *data)
|
||||
{
|
||||
_controller->dispatchMessage(kDT_Mouse, message, data);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
UInt8 ApplePS2KeyboardDevice::setCommandByte(UInt8 setBits, UInt8 clearBits)
|
||||
{
|
||||
return _controller->setCommandByte(setBits, clearBits);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2KeyboardDevice::lock()
|
||||
{
|
||||
_controller->lock();
|
||||
}
|
||||
|
||||
void ApplePS2KeyboardDevice::unlock()
|
||||
{
|
||||
_controller->unlock();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
OSMetaClassDefineReservedUnused(ApplePS2KeyboardDevice, 0);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2KeyboardDevice, 1);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2KeyboardDevice, 2);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2KeyboardDevice, 3);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2KeyboardDevice, 4);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2KeyboardDevice, 5);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2KeyboardDevice, 6);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2KeyboardDevice, 7);
|
||||
|
||||
@@ -27,60 +27,13 @@
|
||||
|
||||
class ApplePS2Controller;
|
||||
|
||||
class ApplePS2KeyboardDevice : public IOService
|
||||
class ApplePS2KeyboardDevice : public ApplePS2Device
|
||||
{
|
||||
OSDeclareDefaultStructors(ApplePS2KeyboardDevice);
|
||||
|
||||
private:
|
||||
ApplePS2Controller * _controller;
|
||||
|
||||
protected:
|
||||
struct ExpansionData { /* */ };
|
||||
ExpansionData * _expansionData;
|
||||
typedef ApplePS2Device super;
|
||||
OSDeclareDefaultStructors(ApplePS2KeyboardDevice);
|
||||
|
||||
public:
|
||||
virtual bool attach(IOService * provider);
|
||||
virtual void detach(IOService * provider);
|
||||
|
||||
// Interrupt Handling Routines
|
||||
|
||||
virtual void installInterruptAction(OSObject *, PS2InterruptAction, PS2PacketAction);
|
||||
virtual void uninstallInterruptAction();
|
||||
|
||||
// Request Submission Routines
|
||||
|
||||
virtual PS2Request* allocateRequest(int max = kMaxCommands);
|
||||
virtual void freeRequest(PS2Request * request);
|
||||
virtual bool submitRequest(PS2Request * request);
|
||||
virtual void submitRequestAndBlock(PS2Request * request);
|
||||
virtual UInt8 setCommandByte(UInt8 setBits, UInt8 clearBits);
|
||||
|
||||
// Power Control Handling Routines
|
||||
|
||||
virtual void installPowerControlAction(OSObject *, PS2PowerControlAction);
|
||||
virtual void uninstallPowerControlAction();
|
||||
|
||||
// Messaging
|
||||
virtual void installMessageAction(OSObject*, PS2MessageAction);
|
||||
virtual void uninstallMessageAction();
|
||||
|
||||
// Mouse/Keyboard interaction
|
||||
|
||||
virtual void dispatchMouseMessage(int message, void* data);
|
||||
|
||||
// Exclusive access (command byte contention)
|
||||
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2KeyboardDevice, 0);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2KeyboardDevice, 1);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2KeyboardDevice, 2);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2KeyboardDevice, 3);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2KeyboardDevice, 4);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2KeyboardDevice, 5);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2KeyboardDevice, 6);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2KeyboardDevice, 7);
|
||||
virtual bool init();
|
||||
};
|
||||
|
||||
#endif /* !_APPLEPS2KEYBOARDDEVICE_H */
|
||||
|
||||
@@ -27,133 +27,14 @@
|
||||
// ApplePS2MouseDevice Class Implementation
|
||||
//
|
||||
|
||||
#define super IOService
|
||||
OSDefineMetaClassAndStructors(ApplePS2MouseDevice, IOService);
|
||||
|
||||
bool ApplePS2MouseDevice::attach(IOService * provider)
|
||||
{
|
||||
if( !super::attach(provider) ) return false;
|
||||
|
||||
assert(_controller == 0);
|
||||
_controller = (ApplePS2Controller *)provider;
|
||||
_controller->retain();
|
||||
|
||||
return true;
|
||||
}
|
||||
OSDefineMetaClassAndStructors(ApplePS2MouseDevice, ApplePS2Device);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::detach( IOService * provider )
|
||||
bool ApplePS2MouseDevice::init()
|
||||
{
|
||||
assert(_controller == provider);
|
||||
_controller->release();
|
||||
_controller = 0;
|
||||
|
||||
super::detach(provider);
|
||||
bool result = super::init();
|
||||
_deviceType = kDT_Mouse;
|
||||
return result;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::installInterruptAction(OSObject * target,
|
||||
PS2InterruptAction interruptAction,
|
||||
PS2PacketAction packetAction)
|
||||
{
|
||||
_controller->installInterruptAction(kDT_Mouse, target, interruptAction, packetAction);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::uninstallInterruptAction()
|
||||
{
|
||||
_controller->uninstallInterruptAction(kDT_Mouse);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::installPowerControlAction(OSObject * target,
|
||||
PS2PowerControlAction action)
|
||||
{
|
||||
_controller->installPowerControlAction(kDT_Mouse, target, action);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::uninstallPowerControlAction()
|
||||
{
|
||||
_controller->uninstallPowerControlAction(kDT_Mouse);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
PS2Request * ApplePS2MouseDevice::allocateRequest(int max)
|
||||
{
|
||||
return _controller->allocateRequest(max);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::freeRequest(PS2Request * request)
|
||||
{
|
||||
_controller->freeRequest(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
bool ApplePS2MouseDevice::submitRequest(PS2Request * request)
|
||||
{
|
||||
return _controller->submitRequest(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::submitRequestAndBlock(PS2Request * request)
|
||||
{
|
||||
_controller->submitRequestAndBlock(request);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::installMessageAction(OSObject* target, PS2MessageAction action)
|
||||
{
|
||||
_controller->installMessageAction(kDT_Mouse, target, action);
|
||||
}
|
||||
|
||||
void ApplePS2MouseDevice::uninstallMessageAction()
|
||||
{
|
||||
_controller->uninstallMessageAction(kDT_Mouse);
|
||||
}
|
||||
|
||||
void ApplePS2MouseDevice::dispatchKeyboardMessage(int message, void *data)
|
||||
{
|
||||
_controller->dispatchMessage(kDT_Keyboard, message, data);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
UInt8 ApplePS2MouseDevice::setCommandByte(UInt8 setBits, UInt8 clearBits)
|
||||
{
|
||||
return _controller->setCommandByte(setBits, clearBits);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
void ApplePS2MouseDevice::lock()
|
||||
{
|
||||
_controller->lock();
|
||||
}
|
||||
|
||||
void ApplePS2MouseDevice::unlock()
|
||||
{
|
||||
_controller->unlock();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
OSMetaClassDefineReservedUnused(ApplePS2MouseDevice, 0);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2MouseDevice, 1);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2MouseDevice, 2);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2MouseDevice, 3);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2MouseDevice, 4);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2MouseDevice, 5);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2MouseDevice, 6);
|
||||
OSMetaClassDefineReservedUnused(ApplePS2MouseDevice, 7);
|
||||
|
||||
@@ -27,60 +27,13 @@
|
||||
|
||||
class ApplePS2Controller;
|
||||
|
||||
class ApplePS2MouseDevice : public IOService
|
||||
class ApplePS2MouseDevice : public ApplePS2Device
|
||||
{
|
||||
OSDeclareDefaultStructors(ApplePS2MouseDevice);
|
||||
|
||||
private:
|
||||
ApplePS2Controller * _controller;
|
||||
|
||||
protected:
|
||||
struct ExpansionData { /* */ };
|
||||
ExpansionData * _expansionData;
|
||||
typedef ApplePS2Device super;
|
||||
OSDeclareDefaultStructors(ApplePS2MouseDevice);
|
||||
|
||||
public:
|
||||
virtual bool attach(IOService * provider);
|
||||
virtual void detach(IOService * provider);
|
||||
|
||||
// Interrupt Handling Routines
|
||||
|
||||
virtual void installInterruptAction(OSObject *, PS2InterruptAction, PS2PacketAction);
|
||||
virtual void uninstallInterruptAction();
|
||||
|
||||
// Request Submission Routines
|
||||
|
||||
virtual PS2Request* allocateRequest(int max = kMaxCommands);
|
||||
virtual void freeRequest(PS2Request * request);
|
||||
virtual bool submitRequest(PS2Request * request);
|
||||
virtual void submitRequestAndBlock(PS2Request * request);
|
||||
virtual UInt8 setCommandByte(UInt8 setBits, UInt8 clearBits);
|
||||
|
||||
// Power Control Handling Routines
|
||||
|
||||
virtual void installPowerControlAction(OSObject *, PS2PowerControlAction);
|
||||
virtual void uninstallPowerControlAction();
|
||||
|
||||
// Messaging
|
||||
virtual void installMessageAction(OSObject*, PS2MessageAction);
|
||||
virtual void uninstallMessageAction();
|
||||
|
||||
// Keyboard/Mouse interaction
|
||||
|
||||
virtual void dispatchKeyboardMessage(int message, void* data);
|
||||
|
||||
// Exclusive access (command byte contention)
|
||||
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2MouseDevice, 0);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2MouseDevice, 1);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2MouseDevice, 2);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2MouseDevice, 3);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2MouseDevice, 4);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2MouseDevice, 5);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2MouseDevice, 6);
|
||||
OSMetaClassDeclareReservedUnused(ApplePS2MouseDevice, 7);
|
||||
virtual bool init();
|
||||
};
|
||||
|
||||
#endif /* !_APPLEPS2MOUSEDEVICE_H */
|
||||
|
||||
@@ -261,7 +261,6 @@ void ApplePS2Controller::handleInterrupt(PS2DeviceType deviceType)
|
||||
// ApplePS2Controller Class Implementation
|
||||
//
|
||||
|
||||
#define super IOService
|
||||
OSDefineMetaClassAndStructors(ApplePS2Controller, IOService);
|
||||
|
||||
bool ApplePS2Controller::init(OSDictionary* dict)
|
||||
|
||||
@@ -116,17 +116,6 @@ class ApplePS2MouseDevice;
|
||||
#define HANDLE_INTERRUPT_DATA_LATER 0
|
||||
#define WATCHDOG_TIMER 0
|
||||
|
||||
// PS/2 device types.
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kDT_Keyboard,
|
||||
kDT_Mouse,
|
||||
#if WATCHDOG_TIMER
|
||||
kDT_Watchdog,
|
||||
#endif
|
||||
} PS2DeviceType;
|
||||
|
||||
// Interrupt definitions.
|
||||
|
||||
#define kIRQ_Keyboard 1
|
||||
@@ -185,6 +174,7 @@ struct KeyboardQueueElement
|
||||
|
||||
class ApplePS2Controller : public IOService
|
||||
{
|
||||
typedef IOService super;
|
||||
OSDeclareDefaultStructors(ApplePS2Controller);
|
||||
|
||||
public: // interrupt-time variables and functions
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
//#define APPLEPS2KEYBOARD_DEVICE_TYPE 205 // Generic ISO keyboard
|
||||
#define APPLEPS2KEYBOARD_DEVICE_TYPE 3 // Unknown ANSI keyboard
|
||||
|
||||
#define super IOHIKeyboard
|
||||
OSDefineMetaClassAndStructors(ApplePS2Keyboard, IOHIKeyboard);
|
||||
|
||||
UInt32 ApplePS2Keyboard::deviceType()
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
|
||||
class ApplePS2Keyboard : public IOHIKeyboard
|
||||
{
|
||||
typedef IOHIKeyboard super;
|
||||
OSDeclareDefaultStructors(ApplePS2Keyboard);
|
||||
|
||||
private:
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
// ApplePS2Mouse Class Implementation
|
||||
//
|
||||
|
||||
#define super IOHIPointing
|
||||
OSDefineMetaClassAndStructors(ApplePS2Mouse, IOHIPointing);
|
||||
|
||||
UInt32 ApplePS2Mouse::deviceType() { return NX_EVS_DEVICE_TYPE_MOUSE; };
|
||||
|
||||
@@ -49,6 +49,7 @@ typedef enum
|
||||
|
||||
class ApplePS2Mouse : public IOHIPointing
|
||||
{
|
||||
typedef IOHIPointing super;
|
||||
OSDeclareDefaultStructors(ApplePS2Mouse);
|
||||
|
||||
private:
|
||||
|
||||
@@ -35,7 +35,6 @@ enum {
|
||||
// ApplePS2ALPSGlidePoint Class Implementation
|
||||
//
|
||||
|
||||
#define super IOHIPointing
|
||||
OSDefineMetaClassAndStructors(ApplePS2ALPSGlidePoint, IOHIPointing);
|
||||
|
||||
UInt32 ApplePS2ALPSGlidePoint::deviceType()
|
||||
|
||||
@@ -47,6 +47,7 @@ typedef struct ALPSStatus
|
||||
|
||||
class ApplePS2ALPSGlidePoint : public IOHIPointing
|
||||
{
|
||||
typedef IOHIPointing super;
|
||||
OSDeclareDefaultStructors( ApplePS2ALPSGlidePoint );
|
||||
|
||||
private:
|
||||
|
||||
@@ -34,7 +34,6 @@ enum {
|
||||
// ApplePS2SentelicFSP Class Implementation
|
||||
//
|
||||
|
||||
#define super IOHIPointing
|
||||
OSDefineMetaClassAndStructors(ApplePS2SentelicFSP, IOHIPointing);
|
||||
|
||||
UInt32 ApplePS2SentelicFSP::deviceType()
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
class ApplePS2SentelicFSP : public IOHIPointing
|
||||
{
|
||||
typedef IOHIPointing super;
|
||||
OSDeclareDefaultStructors( ApplePS2SentelicFSP );
|
||||
|
||||
private:
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
// ApplePS2SynapticsTouchPad Class Implementation
|
||||
//
|
||||
|
||||
#define super IOHIPointing
|
||||
OSDefineMetaClassAndStructors(ApplePS2SynapticsTouchPad, IOHIPointing);
|
||||
|
||||
UInt32 ApplePS2SynapticsTouchPad::deviceType()
|
||||
|
||||
@@ -161,7 +161,8 @@ public:
|
||||
|
||||
class ApplePS2SynapticsTouchPad : public IOHIPointing
|
||||
{
|
||||
OSDeclareDefaultStructors( ApplePS2SynapticsTouchPad );
|
||||
typedef IOHIPointing super;
|
||||
OSDeclareDefaultStructors(ApplePS2SynapticsTouchPad);
|
||||
|
||||
private:
|
||||
ApplePS2MouseDevice * _device;
|
||||
|
||||
Reference in New Issue
Block a user