chore(macos): vendor system-sdk dependency
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef _IOBSD_H
|
||||
#define _IOBSD_H
|
||||
|
||||
/*
|
||||
* bsd-related registry properties
|
||||
*/
|
||||
|
||||
#define kIOBSDKey "IOBSD" // (BSD subsystem resource)
|
||||
#define kIOBSDNameKey "BSD Name" // (an OSString)
|
||||
#define kIOBSDNamesKey "BSD Names" // (an OSDictionary of OSString's, for links)
|
||||
#define kIOBSDMajorKey "BSD Major" // (an OSNumber)
|
||||
#define kIOBSDMinorKey "BSD Minor" // (an OSNumber)
|
||||
#define kIOBSDUnitKey "BSD Unit" // (an OSNumber)
|
||||
|
||||
|
||||
|
||||
#endif /* !_IOBSD_H */
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef __IOKIT_IOCFBUNDLE_H
|
||||
#define __IOKIT_IOCFBUNDLE_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#define kIOBundleInfoDictionaryVersionKey CFSTR("CFBundleInfoDictionaryVersion")
|
||||
#define kIOBundleExecutableKey CFSTR("CFBundleExecutable")
|
||||
#define kIOBundleIdentifierKey CFSTR("CFBundleIdentifier")
|
||||
#define kIOBundleVersionKey CFSTR("CFBundleVersion")
|
||||
#define kIOBundleDevelopmentRegionKey CFSTR("CFBundleDevelopmentRegion")
|
||||
#define kIOBundleNameKey CFSTR("CFBundleName")
|
||||
|
||||
#endif /* __IOKIT_IOCFBUNDLE_H */
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef _IOKIT_IOCFPLUGIN_H_
|
||||
#define _IOKIT_IOCFPLUGIN_H_
|
||||
|
||||
/* IOCFPlugIn.h
|
||||
*/
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <CoreFoundation/CFPlugIn.h>
|
||||
#if COREFOUNDATION_CFPLUGINCOM_SEPARATE
|
||||
#include <CoreFoundation/CFPlugInCOM.h>
|
||||
#endif
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
|
||||
/* C244E858-109C-11D4-91D4-0050E4C6426F */
|
||||
#define kIOCFPlugInInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xC2, 0x44, 0xE8, 0x58, 0x10, 0x9C, 0x11, 0xD4, \
|
||||
0x91, 0xD4, 0x00, 0x50, 0xE4, 0xC6, 0x42, 0x6F)
|
||||
|
||||
|
||||
#define IOCFPLUGINBASE \
|
||||
UInt16 version; \
|
||||
UInt16 revision; \
|
||||
IOReturn (*Probe)(void *thisPointer, CFDictionaryRef propertyTable, \
|
||||
io_service_t service, SInt32 * order); \
|
||||
IOReturn (*Start)(void *thisPointer, CFDictionaryRef propertyTable, \
|
||||
io_service_t service); \
|
||||
IOReturn (*Stop)(void *thisPointer)
|
||||
|
||||
typedef struct IOCFPlugInInterfaceStruct {
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOCFPLUGINBASE;
|
||||
} IOCFPlugInInterface;
|
||||
|
||||
|
||||
kern_return_t
|
||||
IOCreatePlugInInterfaceForService(io_service_t service,
|
||||
CFUUIDRef pluginType, CFUUIDRef interfaceType,
|
||||
IOCFPlugInInterface *** theInterface, SInt32 * theScore);
|
||||
|
||||
kern_return_t
|
||||
IODestroyPlugInInterface(IOCFPlugInInterface ** interface);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_IOKIT_IOCFPLUGIN_H_ */
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* HISTORY
|
||||
*
|
||||
*/
|
||||
|
||||
/* IOCFSerialize serializes CFObjects to a format suitable for passing
|
||||
* to the kernel. */
|
||||
|
||||
#ifndef __IOKIT_IOCFSERIALIZE_H
|
||||
#define __IOKIT_IOCFSERIALIZE_H
|
||||
|
||||
#include <CoreFoundation/CFBase.h>
|
||||
#include <CoreFoundation/CFData.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum {
|
||||
kIOCFSerializeToBinary = 0x00000001
|
||||
};
|
||||
|
||||
CF_RETURNS_RETAINED
|
||||
CFDataRef
|
||||
IOCFSerialize( CFTypeRef object, CFOptionFlags options );
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __IOKIT_IOCFSERIALIZE_H */
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef __IOKIT_IOCFURLACCESS_H
|
||||
#define __IOKIT_IOCFURLACCESS_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
CFTypeRef IOURLCreatePropertyFromResource(CFAllocatorRef alloc, CFURLRef url, CFStringRef property, SInt32 *errorCode);
|
||||
|
||||
Boolean IOURLCreateDataAndPropertiesFromResource(CFAllocatorRef alloc, CFURLRef url, CFDataRef *resourceData, CFDictionaryRef *properties, CFArrayRef desiredProperties, SInt32 *errorCode);
|
||||
|
||||
Boolean IOURLWriteDataAndPropertiesToResource(CFURLRef url, CFDataRef dataToWrite, CFDictionaryRef propertiesToWrite, int32_t *errorCode);
|
||||
|
||||
#ifdef HAVE_CFURLACCESS
|
||||
|
||||
#define kIOURLFileExists kCFURLFileExists
|
||||
#define kIOURLFileDirectoryContents kCFURLFileDirectoryContents
|
||||
#define kIOURLFileLength kCFURLFileLength
|
||||
#define kIOURLFileLastModificationTime kCFURLFileLastModificationTime
|
||||
#define kIOURLFilePOSIXMode kCFURLFilePOSIXMode
|
||||
#define kIOURLFileOwnerID kCFURLFileOwnerID
|
||||
|
||||
/* Common error codes; this list is expected to grow */
|
||||
|
||||
typedef CFURLError IOURLError;
|
||||
|
||||
enum {
|
||||
kIOURLUnknownError = kCFURLUnknownError,
|
||||
kIOURLUnknownSchemeError = kCFURLUnknownSchemeError,
|
||||
kIOURLResourceNotFoundError = kCFURLResourceNotFoundError,
|
||||
kIOURLResourceAccessViolationError = kCFURLResourceAccessViolationError,
|
||||
kIOURLRemoteHostUnavailableError = kCFURLRemoteHostUnavailableError,
|
||||
kIOURLImproperArgumentsError = kCFURLImproperArgumentsError,
|
||||
kIOURLUnknownPropertyKeyError = kCFURLUnknownPropertyKeyError,
|
||||
kIOURLPropertyKeyUnavailableError = kCFURLPropertyKeyUnavailableError,
|
||||
kIOURLTimeoutError = kCFURLTimeoutError
|
||||
};
|
||||
|
||||
#else /* !HAVE_CFURLACCESS */
|
||||
|
||||
#define kIOURLFileExists CFSTR("kIOURLFileExists")
|
||||
#define kIOURLFileDirectoryContents CFSTR("kIOURLFileDirectoryContents")
|
||||
#define kIOURLFileLength CFSTR("kIOURLFileLength")
|
||||
#define kIOURLFileLastModificationTime CFSTR("kIOURLFileLastModificationTime")
|
||||
#define kIOURLFilePOSIXMode CFSTR("kIOURLFilePOSIXMode")
|
||||
#define kIOURLFileOwnerID CFSTR("kIOURLFileOwnerID")
|
||||
|
||||
/* Common error codes; this list is expected to grow */
|
||||
|
||||
typedef enum {
|
||||
kIOURLUnknownError = -10,
|
||||
kIOURLUnknownSchemeError = -11,
|
||||
kIOURLResourceNotFoundError = -12,
|
||||
kIOURLResourceAccessViolationError = -13,
|
||||
kIOURLRemoteHostUnavailableError = -14,
|
||||
kIOURLImproperArgumentsError = -15,
|
||||
kIOURLUnknownPropertyKeyError = -16,
|
||||
kIOURLPropertyKeyUnavailableError = -17,
|
||||
kIOURLTimeoutError = -18
|
||||
} IOURLError;
|
||||
|
||||
#endif /* !HAVE_CFURLACCESS */
|
||||
|
||||
#endif /* __IOKIT_IOCFURLACCESS_H */
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* IOUnserialize.h created by rsulack on Mon 23-Nov-1998 */
|
||||
/* IOCFUnserialize.h creates CF collections Mon 30-Aug-1999 */
|
||||
|
||||
#ifndef __IOKIT_IOCFUNSERIALIZE_H
|
||||
#define __IOKIT_IOCFUNSERIALIZE_H
|
||||
|
||||
#include <CoreFoundation/CFBase.h>
|
||||
#include <CoreFoundation/CFString.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// on success IOCFUnserialize sets errorString to 0 and returns
|
||||
// the unserialized object.
|
||||
|
||||
// on failure IOCFUnserialize sets errorString to a CFString object
|
||||
// containing a error message suitable for logging and returns 0
|
||||
|
||||
CF_RETURNS_RETAINED
|
||||
CFTypeRef
|
||||
IOCFUnserialize(const char *buffer,
|
||||
CFAllocatorRef allocator,
|
||||
CFOptionFlags options,
|
||||
CFStringRef *errorString);
|
||||
|
||||
CF_RETURNS_RETAINED
|
||||
CFTypeRef
|
||||
IOCFUnserializeBinary(const char * buffer,
|
||||
size_t bufferSize,
|
||||
CFAllocatorRef allocator,
|
||||
CFOptionFlags options,
|
||||
CFStringRef * errorString);
|
||||
|
||||
CF_RETURNS_RETAINED
|
||||
CFTypeRef
|
||||
IOCFUnserializeWithSize(const char * buffer,
|
||||
size_t bufferSize,
|
||||
CFAllocatorRef allocator,
|
||||
CFOptionFlags options,
|
||||
CFStringRef * errorString);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __IOKIT_IOCFUNSERIALIZE_H */
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKITUSER_IODATAQUEUE_H
|
||||
#define _IOKITUSER_IODATAQUEUE_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <libkern/OSTypes.h>
|
||||
#include <mach/port.h>
|
||||
#include <IOKit/IOReturn.h>
|
||||
#include <IOKit/IODataQueueShared.h>
|
||||
#include <stdint.h> /* uint32_t */
|
||||
|
||||
/*!
|
||||
* @function IODataQueueDataAvailable
|
||||
* @abstract Used to determine if more data is avilable on the queue.
|
||||
* @param dataQueue The IODataQueueMemory region mapped from the kenel.
|
||||
* @result Returns true if data is available and false if not.
|
||||
*/
|
||||
Boolean IODataQueueDataAvailable(IODataQueueMemory *dataQueue);
|
||||
|
||||
/*!
|
||||
* @function IODataQueuePeek
|
||||
* @abstract Used to peek at the next entry on the queue.
|
||||
* @discussion This function can be used to look at the next entry which allows the entry to be received without having to copy it with IODataQueueDequeue. In order to do this, call IODataQueuePeek to get the entry. Then call IODataQueueDequeue with a NULL data pointer. That will cause the head to be moved to the next entry, but no memory to be copied.
|
||||
* @param dataQueue The IODataQueueMemory region mapped from the kernel.
|
||||
* @result Returns a pointer to the next IODataQueueEntry if one is available. Zero is returned if the queue is empty.
|
||||
*/
|
||||
IODataQueueEntry *IODataQueuePeek(IODataQueueMemory *dataQueue);
|
||||
|
||||
/*!
|
||||
* @function IODataQueueDequeue
|
||||
* @abstract Dequeues the next available entry on the queue and copies it into the given data pointer.
|
||||
* @discussion This function will dequeue the next available entry on the queue. If a data pointer is provided, it will copy the data into the memory region if there is enough space available as specified in the dataSize parameter. If no data pointer is provided, it will simply move the head value past the current entry.
|
||||
* @param dataQueue The IODataQueueMemory region mapped from the kernel.
|
||||
* @param data A pointer to the data memory region in which to copy the next entry data on the queue. If this parameter is 0 (NULL), it will simply move to the next entry.
|
||||
* @param dataSize A pointer to the size of the data parameter. On return, this contains the size of the actual entry data - even if the original size was not large enough.
|
||||
* @result Returns kIOReturnSuccess on success. Other return values possible are: kIOReturnUnderrun - queue is empty, kIOReturnBadArgument - no dataQueue or no dataSize, kIOReturnNoSpace - dataSize is too small for entry.
|
||||
*/
|
||||
IOReturn IODataQueueDequeue(IODataQueueMemory *dataQueue, void *data, uint32_t *dataSize);
|
||||
|
||||
/*!
|
||||
* @function IODataQueueWaitForAvailableData
|
||||
* @abstract Wait for an incoming dataAvailable message on the given notifyPort.
|
||||
* @discussion This method will simply wait for an incoming message on the given notifyPort. Once it is received, the return from mach_msg() is returned.
|
||||
* @param dataQueue The IODataQueueMemory region mapped from the kernel.
|
||||
* @param notificationPort Mach port on which to listen for incoming messages.
|
||||
* @result Returns kIOReturnSuccess on success. Returns kIOReturnBadArgument if either dataQueue is 0 (NULL) or notiryPort is MACH_PORT_NULL. Returns the result of the mach_msg() listen call on the given port.
|
||||
*/
|
||||
IOReturn IODataQueueWaitForAvailableData(IODataQueueMemory *dataQueue, mach_port_t notificationPort);
|
||||
|
||||
/*!
|
||||
* @function IODataQueueAllocateNotificationPort
|
||||
* @abstract Allocates and returns a new mach port able to receive data available notifications from an IODataQueue.
|
||||
* @discussion This port is intended to be passed down into the kernel and into an IODataQueue to allow it to send the appropriate notification. The returned mach port is allocated with a queue limit of one message. This allows only one mach message to be queued up at a time. The IODataQueue code is written with the restriction in mind and will only queue up a message if no messages alread have been sent.
|
||||
* @result Returns a newly allocated mach port on success. On failure, it returns MACH_PORT_NULL.
|
||||
*/
|
||||
mach_port_t IODataQueueAllocateNotificationPort();
|
||||
|
||||
/*!
|
||||
* @function IODataQueueEnqueue
|
||||
* @abstract Enqueues a new entry on the queue.
|
||||
* @discussion This method adds a new data entry of dataSize to the queue. It sets the size parameter of the entry pointed to by the tail value and copies the memory pointed to by the data parameter in place in the queue. Once that is done, it moves the tail to the next available location. When attempting to add a new entry towards the end of the queue and there isn't enough space at the end, it wraps back to the beginning.<br> If the queue is empty when a new entry is added, the port specified in IODataQueueSetNotificationPort will be used to send a message to the client process that data is now available. <br> <b>Please note that using this method without mapped memory create from an IOSharedDataQueue will result in undefined behavior. </b>
|
||||
* @param dataQueue The IODataQueueMemory region mapped from the kernel created from an IOSharedDataQueue.
|
||||
* @param data Pointer to the data to be added to the queue.
|
||||
* @param dataSize Size of the data pointed to by data.
|
||||
* @result Returns kIOReturnSuccess on success. Other return values possible are: kIOReturnOverrun - queue is full.
|
||||
*/
|
||||
IOReturn IODataQueueEnqueue(IODataQueueMemory *dataQueue, void *data, uint32_t dataSize) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
* @function IODataQueueSetNotificationPort
|
||||
* @abstract Creates a simple mach message targeting the mach port specified in port.
|
||||
* @discussion This message is sent when data is added to an empty queue. It is to notify another user process that new data has become available. <b>Please note that using this method without mapped memory create from an IOSharedDataQueue will result in undefined behavior. </b>
|
||||
* @param dataQueue The IODataQueueMemory region mapped from the kernel created from an IOSharedDataQueue.
|
||||
* @param notifyPort The mach port to target with the notification message.
|
||||
* @result Returns kIOReturnSuccess on success. Returns kIOReturnBadArgument if either dataQueue is 0 (NULL).
|
||||
*/
|
||||
IOReturn IODataQueueSetNotificationPort(IODataQueueMemory *dataQueue, mach_port_t notifyPort) AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKITUSER_IODATAQUEUE_H */
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IODATAQUEUESHARED_H
|
||||
#define _IOKIT_IODATAQUEUESHARED_H
|
||||
|
||||
#include <libkern/OSTypes.h>
|
||||
#include <mach/port.h>
|
||||
#include <mach/message.h>
|
||||
|
||||
/*!
|
||||
* @typedef IODataQueueEntry
|
||||
* @abstract Represents an entry within the data queue
|
||||
* @discussion This is a variable sized struct. The data field simply represents the start of the data region. The size of the data region is stored in the size field. The whole size of the specific entry is the size of a UInt32 plus the size of the data region.
|
||||
* @field size The size of the following data region.
|
||||
* @field data Represents the beginning of the data region. The address of the data field is a pointer to the start of the data region.
|
||||
*/
|
||||
typedef struct _IODataQueueEntry {
|
||||
UInt32 size;
|
||||
UInt8 data[4];
|
||||
} IODataQueueEntry;
|
||||
|
||||
/*!
|
||||
* @typedef IODataQueueMemory
|
||||
* @abstract A struct mapping to the header region of a data queue.
|
||||
* @discussion This struct is variable sized. The struct represents the data queue header information plus a pointer to the actual data queue itself. The size of the struct is the combined size of the header fields (3 * sizeof(UInt32)) plus the actual size of the queue region. This size is stored in the queueSize field.
|
||||
* @field queueSize The size of the queue region pointed to by the queue field.
|
||||
* @field head The location of the queue head. This field is represented as a byte offset from the beginning of the queue memory region.
|
||||
* @field tail The location of the queue tail. This field is represented as a byte offset from the beginning of the queue memory region.
|
||||
* @field queue Represents the beginning of the queue memory region. The size of the region pointed to by queue is stored in the queueSize field.
|
||||
*/
|
||||
typedef struct _IODataQueueMemory {
|
||||
UInt32 queueSize;
|
||||
volatile UInt32 head;
|
||||
volatile UInt32 tail;
|
||||
IODataQueueEntry queue[1];
|
||||
} IODataQueueMemory;
|
||||
|
||||
/*!
|
||||
* @typedef IODataQueueAppendix
|
||||
* @abstract A struct mapping to the appendix region of a data queue.
|
||||
* @discussion This struct is variable sized dependent on the version. The struct represents the data queue appendix information.
|
||||
* @field version The version of the queue appendix.
|
||||
* @field msgh Mach message header containing the notification mach port associated with this queue.
|
||||
*/
|
||||
typedef struct _IODataQueueAppendix {
|
||||
UInt32 version;
|
||||
mach_msg_header_t msgh;
|
||||
} IODataQueueAppendix;
|
||||
|
||||
/*!
|
||||
* @defined DATA_QUEUE_ENTRY_HEADER_SIZE Represents the size of the data queue entry header independent of the actual size of the data in the entry. This is the overhead of each entry in the queue. The total size of an entry is equal to this value plus the size stored in the entry's size field (in IODataQueueEntry).
|
||||
*/
|
||||
#define DATA_QUEUE_ENTRY_HEADER_SIZE (sizeof(IODataQueueEntry) - 4)
|
||||
|
||||
/*!
|
||||
* @defined DATA_QUEUE_MEMORY_HEADER_SIZE Represents the size of the data queue memory header independent of the actual size of the queue data itself. The total size of the queue memory is equal to this value plus the size of the queue appendix and the size of the queue data region which is stored in the queueSize field of IODataQueueMeory.
|
||||
*/
|
||||
#define DATA_QUEUE_MEMORY_HEADER_SIZE (sizeof(IODataQueueMemory) - sizeof(IODataQueueEntry))
|
||||
|
||||
/*!
|
||||
* @defined DATA_QUEUE_MEMORY_APPENDIX_SIZE Represents the size of the data queue memory appendix independent of the actual size of the queue data itself. The total size of the queue memory is equal to this value plus the size of queue header and size of the queue data region which is stored in the queueSize field of IODataQueueMeory.
|
||||
*/
|
||||
#define DATA_QUEUE_MEMORY_APPENDIX_SIZE (sizeof(IODataQueueAppendix))
|
||||
|
||||
#endif /* _IOKIT_IODATAQUEUESHARED_H */
|
||||
@@ -0,0 +1,269 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* Common symbol definitions for IOKit.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _IOKIT_IOKITKEYS_H
|
||||
#define _IOKIT_IOKITKEYS_H
|
||||
|
||||
// properties found in the registry root
|
||||
#define kIOKitBuildVersionKey "IOKitBuildVersion"
|
||||
#define kIOKitDiagnosticsKey "IOKitDiagnostics"
|
||||
// a dictionary keyed by plane name
|
||||
#define kIORegistryPlanesKey "IORegistryPlanes"
|
||||
#define kIOCatalogueKey "IOCatalogue"
|
||||
|
||||
// registry plane names
|
||||
#define kIOServicePlane "IOService"
|
||||
#define kIOPowerPlane "IOPower"
|
||||
#define kIODeviceTreePlane "IODeviceTree"
|
||||
#define kIOAudioPlane "IOAudio"
|
||||
#define kIOFireWirePlane "IOFireWire"
|
||||
#define kIOUSBPlane "IOUSB"
|
||||
|
||||
// registry ID number
|
||||
#define kIORegistryEntryIDKey "IORegistryEntryID"
|
||||
// property name to get array of property names
|
||||
#define kIORegistryEntryPropertyKeysKey "IORegistryEntryPropertyKeys"
|
||||
|
||||
// IOService class name
|
||||
#define kIOServiceClass "IOService"
|
||||
|
||||
// IOResources class name
|
||||
#define kIOResourcesClass "IOResources"
|
||||
|
||||
// IOService driver probing property names
|
||||
#define kIOClassKey "IOClass"
|
||||
#define kIOProbeScoreKey "IOProbeScore"
|
||||
#define kIOKitDebugKey "IOKitDebug"
|
||||
|
||||
// Properties to be supported as API
|
||||
#define kIOSupportedPropertiesKey "IOSupportedProperties"
|
||||
// Properties writable by dexts
|
||||
#define kIOUserServicePropertiesKey "IOUserServiceProperties"
|
||||
|
||||
|
||||
// IOService matching property names
|
||||
#define kIOProviderClassKey "IOProviderClass"
|
||||
#define kIONameMatchKey "IONameMatch"
|
||||
#define kIOPropertyMatchKey "IOPropertyMatch"
|
||||
#define kIOPropertyExistsMatchKey "IOPropertyExistsMatch"
|
||||
#define kIOPathMatchKey "IOPathMatch"
|
||||
#define kIOLocationMatchKey "IOLocationMatch"
|
||||
#define kIOParentMatchKey "IOParentMatch"
|
||||
#define kIOResourceMatchKey "IOResourceMatch"
|
||||
#define kIOResourceMatchedKey "IOResourceMatched"
|
||||
#define kIOMatchedServiceCountKey "IOMatchedServiceCountMatch"
|
||||
|
||||
#define kIONameMatchedKey "IONameMatched"
|
||||
|
||||
#define kIOMatchCategoryKey "IOMatchCategory"
|
||||
#define kIODefaultMatchCategoryKey "IODefaultMatchCategory"
|
||||
|
||||
#define kIOMatchedPersonalityKey "IOMatchedPersonality"
|
||||
#define kIORematchPersonalityKey "IORematchPersonality"
|
||||
#define kIORematchCountKey "IORematchCount"
|
||||
#define kIODEXTMatchCountKey "IODEXTMatchCount"
|
||||
|
||||
// Entitlements to check against dext process
|
||||
// Property is an array, one or more of which may match, of:
|
||||
// an array of entitlement strings, all must be present
|
||||
// Any array can be a single string.
|
||||
#define kIOServiceDEXTEntitlementsKey "IOServiceDEXTEntitlements"
|
||||
|
||||
// Entitlement required to open dext connection
|
||||
#define kIODriverKitEntitlementKey "com.apple.developer.driverkit"
|
||||
|
||||
// Entitlements required to open dext IOUserClient
|
||||
// Property is an array of strings containing CFBundleIdentifiers of service being opened
|
||||
#define kIODriverKitUserClientEntitlementsKey "com.apple.developer.driverkit.userclient-access"
|
||||
|
||||
// Allows the entitled process to open a user client connection to any dext that has specific entitlements
|
||||
// Property is an array of strings containing entitlements, one of which needs to be present
|
||||
// in the dext providing the user client being opened
|
||||
#define kIODriverKitRequiredEntitlementsKey "com.apple.private.driverkit.driver-access"
|
||||
|
||||
// Entitlement of a dext that allows any task to open one of its IOUserClients
|
||||
#define kIODriverKitUserClientEntitlementAllowAnyKey "com.apple.developer.driverkit.allow-any-userclient-access"
|
||||
|
||||
#define kIODriverKitUserClientEntitlementAdministratorKey "com.apple.developer.driverkit.administrator"
|
||||
|
||||
// Other DriverKit entitlements
|
||||
#define kIODriverKitUSBTransportEntitlementKey "com.apple.developer.driverkit.transport.usb"
|
||||
#define kIODriverKitHIDTransportEntitlementKey "com.apple.developer.driverkit.transport.hid"
|
||||
#define kIODriverKitHIDFamilyDeviceEntitlementKey "com.apple.developer.driverkit.family.hid.device"
|
||||
#define kIODriverKitHIDFamilyEventServiceEntitlementKey "com.apple.developer.driverkit.family.hid.eventservice"
|
||||
#define kIODriverKitTransportBuiltinEntitlementKey "com.apple.developer.driverkit.builtin"
|
||||
|
||||
// Entitlement required to read nvram root-only properties as non-root user
|
||||
#define kIONVRAMReadAccessKey "com.apple.private.iokit.nvram-read-access"
|
||||
// Entitlement required to write nvram properties as non-root user
|
||||
#define kIONVRAMWriteAccessKey "com.apple.private.iokit.nvram-write-access"
|
||||
// Entitlement required to set properties on the IOResources object as non-root user
|
||||
#define kIOResourcesSetPropertyKey "com.apple.private.iokit.ioresources.setproperty"
|
||||
// Entitlement required to read/write to the system nvram region
|
||||
#define kIONVRAMSystemAllowKey "com.apple.private.iokit.system-nvram-allow"
|
||||
|
||||
// When possible, defer matching of this driver until kextd has started.
|
||||
#define kIOMatchDeferKey "IOMatchDefer"
|
||||
|
||||
// Published after processor_start() has been called on all CPUs at boot time.
|
||||
#define kIOAllCPUInitializedKey "IOAllCPUInitialized"
|
||||
|
||||
// IOService default user client class, for loadable user clients
|
||||
#define kIOUserClientClassKey "IOUserClientClass"
|
||||
|
||||
// key to find IOMappers
|
||||
#define kIOMapperIDKey "IOMapperID"
|
||||
|
||||
|
||||
#define kIOUserClientCrossEndianKey "IOUserClientCrossEndian"
|
||||
#define kIOUserClientCrossEndianCompatibleKey "IOUserClientCrossEndianCompatible"
|
||||
#define kIOUserClientSharedInstanceKey "IOUserClientSharedInstance"
|
||||
#define kIOUserClientDefaultLockingKey "IOUserClientDefaultLocking"
|
||||
// diagnostic string describing the creating task
|
||||
#define kIOUserClientCreatorKey "IOUserClientCreator"
|
||||
// the expected cdhash value of the userspace driver executable
|
||||
#define kIOUserServerCDHashKey "IOUserServerCDHash"
|
||||
|
||||
#define kIOUserUserClientKey "IOUserUserClient"
|
||||
|
||||
#define kIOUserServerOneProcessKey "IOUserServerOneProcess"
|
||||
|
||||
|
||||
// IOService notification types
|
||||
#define kIOPublishNotification "IOServicePublish"
|
||||
#define kIOFirstPublishNotification "IOServiceFirstPublish"
|
||||
#define kIOMatchedNotification "IOServiceMatched"
|
||||
#define kIOFirstMatchNotification "IOServiceFirstMatch"
|
||||
#define kIOTerminatedNotification "IOServiceTerminate"
|
||||
#define kIOWillTerminateNotification "IOServiceWillTerminate"
|
||||
|
||||
// IOService interest notification types
|
||||
#define kIOGeneralInterest "IOGeneralInterest"
|
||||
#define kIOBusyInterest "IOBusyInterest"
|
||||
#define kIOAppPowerStateInterest "IOAppPowerStateInterest"
|
||||
#define kIOPriorityPowerStateInterest "IOPriorityPowerStateInterest"
|
||||
|
||||
#define kIOPlatformDeviceMessageKey "IOPlatformDeviceMessage"
|
||||
|
||||
// IOService interest notification types
|
||||
#define kIOCFPlugInTypesKey "IOCFPlugInTypes"
|
||||
|
||||
#define kIOCompatibilityMatchKey "IOCompatibilityMatch"
|
||||
#define kIOCompatibilityPropertiesKey "IOCompatibilityProperties"
|
||||
#define kIOPathKey "IOPath"
|
||||
|
||||
|
||||
// properties found in services that implement command pooling
|
||||
#define kIOCommandPoolSizeKey "IOCommandPoolSize" // (OSNumber)
|
||||
|
||||
// properties found in services that implement priority
|
||||
#define kIOMaximumPriorityCountKey "IOMaximumPriorityCount" // (OSNumber)
|
||||
|
||||
// properties found in services that have transfer constraints
|
||||
#define kIOMaximumBlockCountReadKey "IOMaximumBlockCountRead" // (OSNumber)
|
||||
#define kIOMaximumBlockCountWriteKey "IOMaximumBlockCountWrite" // (OSNumber)
|
||||
#define kIOMaximumByteCountReadKey "IOMaximumByteCountRead" // (OSNumber)
|
||||
#define kIOMaximumByteCountWriteKey "IOMaximumByteCountWrite" // (OSNumber)
|
||||
#define kIOMaximumSegmentCountReadKey "IOMaximumSegmentCountRead" // (OSNumber)
|
||||
#define kIOMaximumSegmentCountWriteKey "IOMaximumSegmentCountWrite" // (OSNumber)
|
||||
#define kIOMaximumSegmentByteCountReadKey "IOMaximumSegmentByteCountRead" // (OSNumber)
|
||||
#define kIOMaximumSegmentByteCountWriteKey "IOMaximumSegmentByteCountWrite" // (OSNumber)
|
||||
#define kIOMinimumSegmentAlignmentByteCountKey "IOMinimumSegmentAlignmentByteCount" // (OSNumber)
|
||||
#define kIOMaximumSegmentAddressableBitCountKey "IOMaximumSegmentAddressableBitCount" // (OSNumber)
|
||||
#define kIOMinimumSaturationByteCountKey "IOMinimumSaturationByteCount" // (OSNumber)
|
||||
#define kIOMaximumSwapWriteKey "IOMaximumSwapWrite" // (OSNumber)
|
||||
|
||||
// properties found in services that wish to describe an icon
|
||||
//
|
||||
// IOIcon =
|
||||
// {
|
||||
// CFBundleIdentifier = "com.example.driver.example";
|
||||
// IOBundleResourceFile = "example.icns";
|
||||
// };
|
||||
//
|
||||
// where IOBundleResourceFile is the filename of the resource
|
||||
|
||||
#define kIOIconKey "IOIcon" // (OSDictionary)
|
||||
#define kIOBundleResourceFileKey "IOBundleResourceFile" // (OSString)
|
||||
|
||||
#define kIOBusBadgeKey "IOBusBadge" // (OSDictionary)
|
||||
#define kIODeviceIconKey "IODeviceIcon" // (OSDictionary)
|
||||
|
||||
// property of root that describes the machine's serial number as a string
|
||||
#define kIOPlatformSerialNumberKey "IOPlatformSerialNumber" // (OSString)
|
||||
|
||||
// property of root that describes the machine's UUID as a string
|
||||
#define kIOPlatformUUIDKey "IOPlatformUUID" // (OSString)
|
||||
|
||||
// IODTNVRAM property keys
|
||||
#define kIONVRAMBootArgsKey "boot-args"
|
||||
#define kIONVRAMDeletePropertyKey "IONVRAM-DELETE-PROPERTY"
|
||||
#define kIONVRAMSyncNowPropertyKey "IONVRAM-SYNCNOW-PROPERTY"
|
||||
#define kIONVRAMActivateCSRConfigPropertyKey "IONVRAM-ARMCSR-PROPERTY"
|
||||
#define kIODTNVRAMPanicInfoKey "aapl,panic-info"
|
||||
|
||||
// keys for complex boot information
|
||||
#define kIOBootDeviceKey "IOBootDevice" // dict | array of dicts
|
||||
#define kIOBootDevicePathKey "IOBootDevicePath" // arch-neutral OSString
|
||||
#define kIOBootDeviceSizeKey "IOBootDeviceSize" // OSNumber of bytes
|
||||
|
||||
// keys for OS Version information
|
||||
#define kOSBuildVersionKey "OS Build Version"
|
||||
|
||||
//
|
||||
#define kIOStateNotificationItemCreateKey "com.apple.iokit.statenotification.create"
|
||||
#define kIOStateNotificationItemSetKey "com.apple.iokit.statenotification.set"
|
||||
#define kIOStateNotificationItemCopyKey "com.apple.iokit.statenotification.copy"
|
||||
|
||||
#define kIOStateNotificationNameKey "com.apple.iokit.statenotification.name"
|
||||
#define kIOStateNotificationEntitlementSetKey "com.apple.iokit.statenotification.entitlement-set"
|
||||
#define kIOStateNotificationEntitlementGetKey "com.apple.iokit.statenotification.entitlement-get"
|
||||
|
||||
//
|
||||
#define kIOSystemStateClamshellKey "com.apple.iokit.pm.clamshell"
|
||||
|
||||
#define kIOSystemStateSleepDescriptionKey "com.apple.iokit.pm.sleepdescription"
|
||||
#define kIOSystemStateSleepDescriptionReasonKey "com.apple.iokit.pm.sleepreason"
|
||||
#define kIOSystemStateSleepDescriptionHibernateStateKey "com.apple.iokit.pm.hibernatestate"
|
||||
|
||||
#define kIOSystemStateHaltDescriptionKey "com.apple.iokit.pm.haltdescription"
|
||||
#define kIOSystemStateHaltDescriptionHaltStateKey "com.apple.iokit.pm.haltstate"
|
||||
|
||||
#define kIOSystemStatePowerSourceDescriptionKey "com.apple.iokit.pm.powersourcedescription"
|
||||
#define kIOSystemStatePowerSourceDescriptionACAttachedKey "com.apple.iokit.pm.acattached"
|
||||
|
||||
#endif /* ! _IOKIT_IOKITKEYS_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2011 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Internal definitions used between the iokit user library and
|
||||
* server routines.
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOKITSERVER_H
|
||||
#define _IOKIT_IOKITSERVER_H
|
||||
|
||||
#include <IOKit/IOTypes.h>
|
||||
#include <IOKit/IOKitKeys.h>
|
||||
#include <IOKit/OSMessageNotification.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include <mach/kmod.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// IOCatalogueSendData
|
||||
/*!
|
||||
* @enum IOCatalogueSendData user-client flags.
|
||||
* @constant kIOCatalogAddDrivers Signals a call to the addDrivers function in IOCatalogue.
|
||||
* @constant kIOCatalogAddDriversNoMatch Signals a call to the addDrivers function in IOCatalogue but does not start a matching thread.
|
||||
* @constant kIOCatalogRemoveDrivers Signals a call to the removeDrivers function in IOCatalogue.
|
||||
* @constant kIOCatalogRemoveDriversNoMatch Signals a call to the removedrivers function in IOCatalogue but does not start a matching thread.
|
||||
* @constant kIOCatalogStartMatching Signals the IOCatalogue to start an IOService matching thread.
|
||||
* @constant kIOCatalogRemoveKernelLinker Deprecated; does nothing.
|
||||
* @constant kIOCatalogKextdActive Signals the kernel that kextd is running.
|
||||
* @constant kIOCatalogKextdFinishedLaunching Signals the IOCatalogue that kextd has finished sending it information at startup.
|
||||
* @constant kIOCatalogResetDrivers Resets the IOCatalogue with a new set of personalities.
|
||||
* @constant kIOCatalogResetDriversNoMatch Resets the IOCatalogue with a new set of personalities but does not start a matching thread.
|
||||
*/
|
||||
enum {
|
||||
kIOCatalogAddDrivers = 1,
|
||||
kIOCatalogAddDriversNoMatch,
|
||||
kIOCatalogRemoveDrivers,
|
||||
kIOCatalogRemoveDriversNoMatch,
|
||||
kIOCatalogStartMatching__Removed,
|
||||
kIOCatalogRemoveKernelLinker__Removed,
|
||||
kIOCatalogKextdActive,
|
||||
kIOCatalogKextdFinishedLaunching,
|
||||
kIOCatalogResetDrivers,
|
||||
kIOCatalogResetDriversNoMatch
|
||||
};
|
||||
|
||||
// IOCatalogueGetData
|
||||
/*!
|
||||
* @enum IOCatalogueGetData user-client flags
|
||||
* @constant kIOCatalogGetContents Returns a snapshot of the database to the caller.
|
||||
*/
|
||||
enum {
|
||||
kIOCatalogGetContents = 1,
|
||||
kIOCatalogGetModuleDemandList = 2,
|
||||
kIOCatalogGetCacheMissList = 3,
|
||||
kIOCatalogGetROMMkextList = 4
|
||||
};
|
||||
|
||||
// IOCatalogueReset
|
||||
/*!
|
||||
* @enum IOCatalogueReset user-client flag
|
||||
* @constant kIOCatalogResetDefault Removes all entries from IOCatalogue except those used for booting the system.
|
||||
*/
|
||||
enum {
|
||||
kIOCatalogResetDefault = 1
|
||||
};
|
||||
|
||||
// IOCatalogueTerminate
|
||||
/*!
|
||||
* @enum IOCatalogueTerminate user-client flags.
|
||||
* @constant kIOCatalogModuleUnload Terminates all services which depend on a particular module and unloads the module.
|
||||
* @constant kIOCatalogModuleTerminate Terminates all services which depend on a particular module but does not unload the module.
|
||||
* @constant kIOCatalogServiceTerminate Terminates a particular service by name.
|
||||
*/
|
||||
enum {
|
||||
kIOCatalogModuleUnload = 1,
|
||||
kIOCatalogModuleTerminate,
|
||||
kIOCatalogServiceTerminate
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* ! _IOKIT_IOKITSERVER_H */
|
||||
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2021 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __IOKIT_IOMAPTYPES_H
|
||||
#define __IOKIT_IOMAPTYPES_H
|
||||
|
||||
// IOConnectMapMemory memoryTypes
|
||||
enum {
|
||||
kIODefaultMemoryType = 0
|
||||
};
|
||||
|
||||
enum {
|
||||
kIODefaultCache = 0,
|
||||
kIOInhibitCache = 1,
|
||||
kIOWriteThruCache = 2,
|
||||
kIOCopybackCache = 3,
|
||||
kIOWriteCombineCache = 4,
|
||||
kIOCopybackInnerCache = 5,
|
||||
kIOPostedWrite = 6,
|
||||
kIORealTimeCache = 7,
|
||||
kIOPostedReordered = 8,
|
||||
kIOPostedCombinedReordered = 9,
|
||||
};
|
||||
|
||||
// IOMemory mapping options
|
||||
enum {
|
||||
kIOMapAnywhere = 0x00000001,
|
||||
|
||||
kIOMapCacheMask = 0x00000f00,
|
||||
kIOMapCacheShift = 8,
|
||||
kIOMapDefaultCache = kIODefaultCache << kIOMapCacheShift,
|
||||
kIOMapInhibitCache = kIOInhibitCache << kIOMapCacheShift,
|
||||
kIOMapWriteThruCache = kIOWriteThruCache << kIOMapCacheShift,
|
||||
kIOMapCopybackCache = kIOCopybackCache << kIOMapCacheShift,
|
||||
kIOMapWriteCombineCache = kIOWriteCombineCache << kIOMapCacheShift,
|
||||
kIOMapCopybackInnerCache = kIOCopybackInnerCache << kIOMapCacheShift,
|
||||
kIOMapPostedWrite = kIOPostedWrite << kIOMapCacheShift,
|
||||
kIOMapRealTimeCache = kIORealTimeCache << kIOMapCacheShift,
|
||||
kIOMapPostedReordered = kIOPostedReordered << kIOMapCacheShift,
|
||||
kIOMapPostedCombinedReordered = kIOPostedCombinedReordered << kIOMapCacheShift,
|
||||
|
||||
kIOMapUserOptionsMask = 0x00000fff,
|
||||
|
||||
kIOMapReadOnly = 0x00001000,
|
||||
|
||||
kIOMapStatic = 0x01000000,
|
||||
kIOMapReference = 0x02000000,
|
||||
kIOMapUnique = 0x04000000,
|
||||
kIOMapPrefault = 0x10000000,
|
||||
kIOMapOverwrite = 0x20000000,
|
||||
kIOMapGuardedMask = 0xC0000000,
|
||||
kIOMapGuardedSmall = 0x40000000,
|
||||
kIOMapGuardedLarge = 0x80000000
|
||||
};
|
||||
|
||||
#endif /* ! __IOKIT_IOMAPTYPES_H */
|
||||
@@ -0,0 +1,220 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef __IOKIT_IOMESSAGE_H
|
||||
#define __IOKIT_IOMESSAGE_H
|
||||
|
||||
#include <IOKit/IOReturn.h>
|
||||
#include <IOKit/IOTypes.h>
|
||||
|
||||
/*!
|
||||
* @header IOMessage.h
|
||||
*
|
||||
* Defines message type constants for several IOKit messaging API's.
|
||||
*
|
||||
*/
|
||||
|
||||
typedef UInt32 IOMessage;
|
||||
|
||||
#define iokit_common_msg(message) (UInt32)(sys_iokit|sub_iokit_common|message)
|
||||
#define iokit_family_msg(sub, message) (UInt32)(sys_iokit|sub|message)
|
||||
|
||||
/*!
|
||||
* @defined iokit_vendor_specific_msg
|
||||
* @discussion iokit_vendor_specific_msg passes messages in the sub_iokit_vendor_specific
|
||||
* subsystem. It can be used to generate messages that are used for private
|
||||
* communication between vendor specific code with the IOService::message() etc. APIs.
|
||||
*/
|
||||
#define iokit_vendor_specific_msg(message) (UInt32)(sys_iokit|sub_iokit_vendor_specific|message)
|
||||
|
||||
#define kIOMessageServiceIsTerminated iokit_common_msg(0x010)
|
||||
#define kIOMessageServiceIsSuspended iokit_common_msg(0x020)
|
||||
#define kIOMessageServiceIsResumed iokit_common_msg(0x030)
|
||||
|
||||
#define kIOMessageServiceIsRequestingClose iokit_common_msg(0x100)
|
||||
#define kIOMessageServiceIsAttemptingOpen iokit_common_msg(0x101)
|
||||
#define kIOMessageServiceWasClosed iokit_common_msg(0x110)
|
||||
|
||||
#define kIOMessageServiceBusyStateChange iokit_common_msg(0x120)
|
||||
|
||||
#define kIOMessageConsoleSecurityChange iokit_common_msg(0x128)
|
||||
|
||||
#define kIOMessageServicePropertyChange iokit_common_msg(0x130)
|
||||
|
||||
#define kIOMessageCopyClientID iokit_common_msg(0x330)
|
||||
|
||||
#define kIOMessageSystemCapabilityChange iokit_common_msg(0x340)
|
||||
#define kIOMessageDeviceSignaledWakeup iokit_common_msg(0x350)
|
||||
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageDeviceWillPowerOff
|
||||
* @discussion Indicates the device is about to move to a lower power state.
|
||||
* Sent to IOKit interest notification clients of type <code>kIOAppPowerStateInterest</code>
|
||||
* and <code>kIOGeneralInterest</code>.
|
||||
*/
|
||||
#define kIOMessageDeviceWillPowerOff iokit_common_msg(0x210)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageDeviceHasPoweredOn
|
||||
* @discussion Indicates the device has just moved to a higher power state.
|
||||
* Sent to IOKit interest notification clients of type <code>kIOAppPowerStateInterest</code>
|
||||
* and <code>kIOGeneralInterest</code>.
|
||||
*/
|
||||
#define kIOMessageDeviceHasPoweredOn iokit_common_msg(0x230)
|
||||
|
||||
/*! @group In-kernel system shutdown and restart notifications
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageSystemWillPowerOff
|
||||
* @discussion Indicates an imminent system shutdown. Recipients have a limited
|
||||
* amount of time to respond, otherwise the system will timeout and
|
||||
* shutdown even without a response.
|
||||
* Delivered to in-kernel IOKit drivers via <code>IOService::systemWillShutdown()</code>,
|
||||
* and to clients of <code>registerPrioritySleepWakeInterest()</code>.
|
||||
* Never delivered to user space notification clients.
|
||||
*/
|
||||
#define kIOMessageSystemWillPowerOff iokit_common_msg(0x250)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageSystemWillRestart
|
||||
* @discussion Indicates an imminent system restart. Recipients have a limited
|
||||
* amount of time to respond, otherwise the system will timeout and
|
||||
* restart even without a response.
|
||||
* Delivered to in-kernel IOKit drivers via <code>IOService::systemWillShutdown()</code>,
|
||||
* and to clients of <code>registerPrioritySleepWakeInterest()</code>.
|
||||
* Never delivered to user space notification clients.
|
||||
*/
|
||||
#define kIOMessageSystemWillRestart iokit_common_msg(0x310)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageSystemPagingOff
|
||||
* @discussion Indicates an imminent system shutdown, paging device now unavailable.
|
||||
* Recipients have a limited amount of time to respond, otherwise the
|
||||
* system will timeout and shutdown even without a response.
|
||||
* Delivered to clients of <code>registerPrioritySleepWakeInterest()</code>.
|
||||
* Never delivered to user space notification clients.
|
||||
*/
|
||||
#define kIOMessageSystemPagingOff iokit_common_msg(0x255)
|
||||
|
||||
|
||||
/*! @group System sleep and wake notifications
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageCanSystemSleep
|
||||
* @discussion Announces/Requests permission to proceed to system sleep.
|
||||
* Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
|
||||
* and <code>kIOPriorityPowerStateInterest</code>.
|
||||
* Delivered to user clients of <code>IORegisterForSystemPower</code>.
|
||||
*/
|
||||
#define kIOMessageCanSystemSleep iokit_common_msg(0x270)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageSystemWillNotSleep
|
||||
* @discussion Announces that the system has retracted a previous attempt to sleep;
|
||||
* it follows <code>kIOMessageCanSystemSleep</code>.
|
||||
* Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
|
||||
* and <code>kIOPriorityPowerStateInterest</code>.
|
||||
* Delivered to user clients of <code>IORegisterForSystemPower</code>.
|
||||
*/
|
||||
#define kIOMessageSystemWillNotSleep iokit_common_msg(0x290)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageSystemWillSleep
|
||||
* @discussion Announces that sleep is beginning.
|
||||
* Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
|
||||
* and <code>kIOPriorityPowerStateInterest</code>.
|
||||
* Delivered to user clients of <code>IORegisterForSystemPower</code>.
|
||||
*/
|
||||
#define kIOMessageSystemWillSleep iokit_common_msg(0x280)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageSystemWillPowerOn
|
||||
* @discussion Announces that the system is beginning to power the device tree; most
|
||||
* devices are unavailable at this point..
|
||||
* Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
|
||||
* and <code>kIOPriorityPowerStateInterest</code>.
|
||||
* Delivered to user clients of <code>IORegisterForSystemPower</code>.
|
||||
*/
|
||||
#define kIOMessageSystemWillPowerOn iokit_common_msg(0x320)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageSystemHasPoweredOn
|
||||
* @discussion Announces that the system and its devices have woken up.
|
||||
* Delivered to in-kernel IOKit drivers via <code>kIOGeneralInterest</code>
|
||||
* and <code>kIOPriorityPowerStateInterest</code>.
|
||||
* Delivered to user clients of <code>IORegisterForSystemPower</code>.
|
||||
*/
|
||||
#define kIOMessageSystemHasPoweredOn iokit_common_msg(0x300)
|
||||
|
||||
/*! @group Unused and deprecated notifications
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageCanDevicePowerOff
|
||||
* @discussion Delivered to <code>kIOAppPowerStateInterest</code> clients of
|
||||
* devices that implement their own idle timeouts.
|
||||
* This message type is almost never used.
|
||||
*/
|
||||
#define kIOMessageCanDevicePowerOff iokit_common_msg(0x200)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageDeviceWillNotPowerOff
|
||||
* @discussion This IOKit interest notification is largely unused;
|
||||
* it's not very interesting.
|
||||
*/
|
||||
#define kIOMessageDeviceWillNotPowerOff iokit_common_msg(0x220)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageSystemWillNotPowerOff
|
||||
* @deprecated This IOKit message is unused.
|
||||
*/
|
||||
#define kIOMessageSystemWillNotPowerOff iokit_common_msg(0x260)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageCanSystemPowerOff
|
||||
* @deprecated This IOKit message is unused.
|
||||
*/
|
||||
#define kIOMessageCanSystemPowerOff iokit_common_msg(0x240)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageDeviceWillPowerOn
|
||||
* @discussion IOService power mgt does not send kIOMessageDeviceWillPowerOn.
|
||||
*/
|
||||
#define kIOMessageDeviceWillPowerOn iokit_common_msg(0x215)
|
||||
|
||||
/*!
|
||||
* @defined kIOMessageDeviceHasPoweredOff
|
||||
* @discussion IOService power mgt does not send kIOMessageDeviceHasPoweredOff.
|
||||
*/
|
||||
#define kIOMessageDeviceHasPoweredOff iokit_common_msg(0x225)
|
||||
|
||||
|
||||
#endif /* ! __IOKIT_IOMESSAGE_H */
|
||||
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* Copyright (c) 2018 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _IORPC_H
|
||||
#define _IORPC_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
#include <mach/message.h>
|
||||
|
||||
|
||||
|
||||
typedef uint64_t OSObjectRef;
|
||||
|
||||
enum {
|
||||
kIORPCVersion190615 = (mach_msg_id_t) 0x4da2b68c,
|
||||
kIORPCVersion190615Reply = (mach_msg_id_t) 0x4da2b68d,
|
||||
|
||||
#if DRIVERKIT_PRIVATE
|
||||
kIORPCVersion190501 = (mach_msg_id_t) 0xfe316a7a,
|
||||
kIORPCVersion190501Reply = (mach_msg_id_t) 0xfe316a7b,
|
||||
|
||||
kIORPCVersionCurrent = kIORPCVersion190615,
|
||||
kIORPCVersionCurrentReply = kIORPCVersion190615Reply
|
||||
#endif /* DRIVERKIT_PRIVATE */
|
||||
};
|
||||
|
||||
enum{
|
||||
kIORPCMessageRemote = 0x00000001,
|
||||
kIORPCMessageLocalHost = 0x00000002,
|
||||
kIORPCMessageKernel = 0x00000004,
|
||||
kIORPCMessageOneway = 0x00000008,
|
||||
kIORPCMessageObjectRefs = 0x00000010,
|
||||
kIORPCMessageOnqueue = 0x00000020,
|
||||
kIORPCMessageError = 0x00000040,
|
||||
kIORPCMessageSimpleReply = 0x00000080,
|
||||
};
|
||||
|
||||
enum{
|
||||
kIORPCMessageIDKernel = (1ULL << 63),
|
||||
};
|
||||
|
||||
struct IORPCMessageMach {
|
||||
mach_msg_header_t msgh;
|
||||
mach_msg_body_t msgh_body;
|
||||
mach_msg_port_descriptor_t objects[0];
|
||||
};
|
||||
typedef struct IORPCMessageMach IORPCMessageMach;
|
||||
|
||||
struct IORPCMessage {
|
||||
uint64_t msgid;
|
||||
uint64_t flags;
|
||||
uint64_t objectRefs;
|
||||
OSObjectRef objects[0];
|
||||
};
|
||||
typedef struct IORPCMessage IORPCMessage;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C"
|
||||
#else
|
||||
extern
|
||||
#endif
|
||||
IORPCMessage *
|
||||
IORPCMessageFromMach(IORPCMessageMach * msg, bool reply);
|
||||
|
||||
struct IORPCMessageErrorReturnContent {
|
||||
IORPCMessage hdr;
|
||||
kern_return_t result;
|
||||
uint32_t pad;
|
||||
};
|
||||
typedef struct IORPCMessageErrorReturnContent IORPCMessageErrorReturnContent;
|
||||
|
||||
#pragma pack(4)
|
||||
struct IORPCMessageErrorReturn {
|
||||
IORPCMessageMach mach;
|
||||
IORPCMessageErrorReturnContent content;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
class OSMetaClassBase;
|
||||
struct IORPC;
|
||||
typedef kern_return_t (*OSDispatchMethod)(OSMetaClassBase * self, const IORPC rpc);
|
||||
#endif
|
||||
|
||||
struct IORPC {
|
||||
IORPCMessageMach * message;
|
||||
IORPCMessageMach * reply;
|
||||
uint32_t sendSize;
|
||||
uint32_t replySize;
|
||||
};
|
||||
typedef struct IORPC IORPC;
|
||||
|
||||
enum {
|
||||
kOSClassCanRemote = 0x00000001,
|
||||
};
|
||||
|
||||
struct OSClassDescription {
|
||||
uint32_t descriptionSize;
|
||||
|
||||
char name[96];
|
||||
char superName[96];
|
||||
|
||||
uint32_t methodOptionsSize;
|
||||
uint32_t methodOptionsOffset;
|
||||
uint32_t metaMethodOptionsSize;
|
||||
uint32_t metaMethodOptionsOffset;
|
||||
uint32_t queueNamesSize;
|
||||
uint32_t queueNamesOffset;
|
||||
uint32_t methodNamesSize;
|
||||
uint32_t methodNamesOffset;
|
||||
uint32_t metaMethodNamesSize;
|
||||
uint32_t metaMethodNamesOffset;
|
||||
|
||||
uint64_t flags;
|
||||
|
||||
uint64_t resv1[8];
|
||||
|
||||
uint64_t methodOptions[0];
|
||||
uint64_t metaMethodOptions[0];
|
||||
|
||||
char dispatchNames[0];
|
||||
char methodNames[0];
|
||||
char metaMethodNames[0];
|
||||
};
|
||||
|
||||
#endif /* _IORPC_H */
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2002 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* HISTORY
|
||||
*/
|
||||
|
||||
/*
|
||||
* Core IOReturn values. Others may be family defined.
|
||||
*/
|
||||
|
||||
#ifndef __IOKIT_IORETURN_H
|
||||
#define __IOKIT_IORETURN_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#include <mach/error.h>
|
||||
|
||||
|
||||
typedef kern_return_t IOReturn;
|
||||
|
||||
#ifndef sys_iokit
|
||||
#define sys_iokit err_system(0x38)
|
||||
#endif /* sys_iokit */
|
||||
#define sub_iokit_common err_sub(0)
|
||||
#define sub_iokit_usb err_sub(1)
|
||||
#define sub_iokit_firewire err_sub(2)
|
||||
#define sub_iokit_block_storage err_sub(4)
|
||||
#define sub_iokit_graphics err_sub(5)
|
||||
#define sub_iokit_networking err_sub(6)
|
||||
#define sub_iokit_bluetooth err_sub(8)
|
||||
#define sub_iokit_pmu err_sub(9)
|
||||
#define sub_iokit_acpi err_sub(10)
|
||||
#define sub_iokit_smbus err_sub(11)
|
||||
#define sub_iokit_ahci err_sub(12)
|
||||
#define sub_iokit_powermanagement err_sub(13)
|
||||
#define sub_iokit_hidsystem err_sub(14)
|
||||
#define sub_iokit_scsi err_sub(16)
|
||||
#define sub_iokit_usbaudio err_sub(17)
|
||||
#define sub_iokit_wirelesscharging err_sub(18)
|
||||
//#define sub_iokit_pccard err_sub(21)
|
||||
#define sub_iokit_thunderbolt err_sub(29)
|
||||
#define sub_iokit_graphics_acceleration err_sub(30)
|
||||
#define sub_iokit_keystore err_sub(31)
|
||||
#define sub_iokit_apfs err_sub(33)
|
||||
#define sub_iokit_acpiec err_sub(34)
|
||||
#define sub_iokit_timesync_avb err_sub(35)
|
||||
|
||||
#define sub_iokit_platform err_sub(0x2A)
|
||||
#define sub_iokit_audio_video err_sub(0x45)
|
||||
#define sub_iokit_cec err_sub(0x46)
|
||||
#define sub_iokit_baseband err_sub(0x80)
|
||||
#define sub_iokit_HDA err_sub(0xFE)
|
||||
#define sub_iokit_hsic err_sub(0x147)
|
||||
#define sub_iokit_sdio err_sub(0x174)
|
||||
#define sub_iokit_wlan err_sub(0x208)
|
||||
#define sub_iokit_appleembeddedsleepwakehandler err_sub(0x209)
|
||||
#define sub_iokit_appleppm err_sub(0x20A)
|
||||
|
||||
#define sub_iokit_vendor_specific err_sub(-2)
|
||||
#define sub_iokit_reserved err_sub(-1)
|
||||
|
||||
#define iokit_common_err(return ) (sys_iokit|sub_iokit_common|return)
|
||||
#define iokit_family_err(sub, return ) (sys_iokit|sub|return)
|
||||
#define iokit_vendor_specific_err(return ) (sys_iokit|sub_iokit_vendor_specific|return)
|
||||
|
||||
#define kIOReturnSuccess KERN_SUCCESS // OK
|
||||
#define kIOReturnError iokit_common_err(0x2bc) // general error
|
||||
#define kIOReturnNoMemory iokit_common_err(0x2bd) // can't allocate memory
|
||||
#define kIOReturnNoResources iokit_common_err(0x2be) // resource shortage
|
||||
#define kIOReturnIPCError iokit_common_err(0x2bf) // error during IPC
|
||||
#define kIOReturnNoDevice iokit_common_err(0x2c0) // no such device
|
||||
#define kIOReturnNotPrivileged iokit_common_err(0x2c1) // privilege violation
|
||||
#define kIOReturnBadArgument iokit_common_err(0x2c2) // invalid argument
|
||||
#define kIOReturnLockedRead iokit_common_err(0x2c3) // device read locked
|
||||
#define kIOReturnLockedWrite iokit_common_err(0x2c4) // device write locked
|
||||
#define kIOReturnExclusiveAccess iokit_common_err(0x2c5) // exclusive access and
|
||||
// device already open
|
||||
#define kIOReturnBadMessageID iokit_common_err(0x2c6) // sent/received messages
|
||||
// had different msg_id
|
||||
#define kIOReturnUnsupported iokit_common_err(0x2c7) // unsupported function
|
||||
#define kIOReturnVMError iokit_common_err(0x2c8) // misc. VM failure
|
||||
#define kIOReturnInternalError iokit_common_err(0x2c9) // internal error
|
||||
#define kIOReturnIOError iokit_common_err(0x2ca) // General I/O error
|
||||
//#define kIOReturn???Error iokit_common_err(0x2cb) // ???
|
||||
#define kIOReturnCannotLock iokit_common_err(0x2cc) // can't acquire lock
|
||||
#define kIOReturnNotOpen iokit_common_err(0x2cd) // device not open
|
||||
#define kIOReturnNotReadable iokit_common_err(0x2ce) // read not supported
|
||||
#define kIOReturnNotWritable iokit_common_err(0x2cf) // write not supported
|
||||
#define kIOReturnNotAligned iokit_common_err(0x2d0) // alignment error
|
||||
#define kIOReturnBadMedia iokit_common_err(0x2d1) // Media Error
|
||||
#define kIOReturnStillOpen iokit_common_err(0x2d2) // device(s) still open
|
||||
#define kIOReturnRLDError iokit_common_err(0x2d3) // rld failure
|
||||
#define kIOReturnDMAError iokit_common_err(0x2d4) // DMA failure
|
||||
#define kIOReturnBusy iokit_common_err(0x2d5) // Device Busy
|
||||
#define kIOReturnTimeout iokit_common_err(0x2d6) // I/O Timeout
|
||||
#define kIOReturnOffline iokit_common_err(0x2d7) // device offline
|
||||
#define kIOReturnNotReady iokit_common_err(0x2d8) // not ready
|
||||
#define kIOReturnNotAttached iokit_common_err(0x2d9) // device not attached
|
||||
#define kIOReturnNoChannels iokit_common_err(0x2da) // no DMA channels left
|
||||
#define kIOReturnNoSpace iokit_common_err(0x2db) // no space for data
|
||||
//#define kIOReturn???Error iokit_common_err(0x2dc) // ???
|
||||
#define kIOReturnPortExists iokit_common_err(0x2dd) // port already exists
|
||||
#define kIOReturnCannotWire iokit_common_err(0x2de) // can't wire down
|
||||
// physical memory
|
||||
#define kIOReturnNoInterrupt iokit_common_err(0x2df) // no interrupt attached
|
||||
#define kIOReturnNoFrames iokit_common_err(0x2e0) // no DMA frames enqueued
|
||||
#define kIOReturnMessageTooLarge iokit_common_err(0x2e1) // oversized msg received
|
||||
// on interrupt port
|
||||
#define kIOReturnNotPermitted iokit_common_err(0x2e2) // not permitted
|
||||
#define kIOReturnNoPower iokit_common_err(0x2e3) // no power to device
|
||||
#define kIOReturnNoMedia iokit_common_err(0x2e4) // media not present
|
||||
#define kIOReturnUnformattedMedia iokit_common_err(0x2e5)// media not formatted
|
||||
#define kIOReturnUnsupportedMode iokit_common_err(0x2e6) // no such mode
|
||||
#define kIOReturnUnderrun iokit_common_err(0x2e7) // data underrun
|
||||
#define kIOReturnOverrun iokit_common_err(0x2e8) // data overrun
|
||||
#define kIOReturnDeviceError iokit_common_err(0x2e9) // the device is not working properly!
|
||||
#define kIOReturnNoCompletion iokit_common_err(0x2ea) // a completion routine is required
|
||||
#define kIOReturnAborted iokit_common_err(0x2eb) // operation aborted
|
||||
#define kIOReturnNoBandwidth iokit_common_err(0x2ec) // bus bandwidth would be exceeded
|
||||
#define kIOReturnNotResponding iokit_common_err(0x2ed) // device not responding
|
||||
#define kIOReturnIsoTooOld iokit_common_err(0x2ee) // isochronous I/O request for distant past!
|
||||
#define kIOReturnIsoTooNew iokit_common_err(0x2ef) // isochronous I/O request for distant future
|
||||
#define kIOReturnNotFound iokit_common_err(0x2f0) // data was not found
|
||||
#define kIOReturnInvalid iokit_common_err(0x1) // should never be seen
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! __IOKIT_IORETURN_H */
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2010 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOSHAREDLOCK_H
|
||||
#define _IOKIT_IOSHAREDLOCK_H
|
||||
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
||||
#define IOSharedLockData OSSpinLock
|
||||
#define ev_lock_data_t OSSpinLock
|
||||
|
||||
|
||||
#endif /* ! _IOKIT_IOSHAREDLOCK_H */
|
||||
@@ -0,0 +1,219 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2012 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef __IOKIT_IOTYPES_H
|
||||
#define __IOKIT_IOTYPES_H
|
||||
|
||||
|
||||
#ifndef IOKIT
|
||||
#define IOKIT 1
|
||||
#endif /* !IOKIT */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <mach/message.h>
|
||||
#include <mach/vm_types.h>
|
||||
|
||||
#include <IOKit/IOReturn.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#if defined (__cplusplus)
|
||||
#if __cplusplus >= 201103L && (defined(__arm__) || defined(__arm64__))
|
||||
#define NULL nullptr
|
||||
#else
|
||||
#define NULL 0
|
||||
#endif
|
||||
#else
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Simple data types.
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
#include <libkern/OSTypes.h>
|
||||
|
||||
|
||||
typedef UInt32 IOOptionBits;
|
||||
typedef SInt32 IOFixed;
|
||||
typedef UInt32 IOVersion;
|
||||
typedef UInt32 IOItemCount;
|
||||
typedef UInt32 IOCacheMode;
|
||||
|
||||
typedef UInt32 IOByteCount32;
|
||||
typedef UInt64 IOByteCount64;
|
||||
|
||||
typedef UInt32 IOPhysicalAddress32;
|
||||
typedef UInt64 IOPhysicalAddress64;
|
||||
typedef UInt32 IOPhysicalLength32;
|
||||
typedef UInt64 IOPhysicalLength64;
|
||||
|
||||
#if !defined(__arm__) && !defined(__i386__)
|
||||
typedef mach_vm_address_t IOVirtualAddress __kernel_ptr_semantics;
|
||||
#else
|
||||
typedef vm_address_t IOVirtualAddress __kernel_ptr_semantics;
|
||||
#endif
|
||||
|
||||
#if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL)) && !(defined(__arm64__) && !defined(__LP64__))
|
||||
typedef IOByteCount64 IOByteCount;
|
||||
#define PRIIOByteCount PRIu64
|
||||
#else
|
||||
typedef IOByteCount32 IOByteCount;
|
||||
#define PRIIOByteCount PRIu32
|
||||
#endif
|
||||
|
||||
typedef IOVirtualAddress IOLogicalAddress;
|
||||
|
||||
#if !defined(__arm__) && !defined(__i386__) && !(defined(__x86_64__) && !defined(KERNEL))
|
||||
|
||||
typedef IOPhysicalAddress64 IOPhysicalAddress;
|
||||
typedef IOPhysicalLength64 IOPhysicalLength;
|
||||
#define IOPhysical32( hi, lo ) ((UInt64) lo + ((UInt64)(hi) << 32))
|
||||
#define IOPhysSize 64
|
||||
|
||||
#else
|
||||
|
||||
typedef IOPhysicalAddress32 IOPhysicalAddress;
|
||||
typedef IOPhysicalLength32 IOPhysicalLength;
|
||||
#define IOPhysical32( hi, lo ) (lo)
|
||||
#define IOPhysSize 32
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct{
|
||||
IOPhysicalAddress address;
|
||||
IOByteCount length;
|
||||
} IOPhysicalRange;
|
||||
|
||||
typedef struct{
|
||||
IOVirtualAddress address;
|
||||
IOByteCount length;
|
||||
} IOVirtualRange;
|
||||
|
||||
#if !defined(__arm__) && !defined(__i386__)
|
||||
typedef IOVirtualRange IOAddressRange;
|
||||
#else
|
||||
typedef struct{
|
||||
mach_vm_address_t address;
|
||||
mach_vm_size_t length;
|
||||
} IOAddressRange;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Map between #defined or enum'd constants and text description.
|
||||
*/
|
||||
typedef struct {
|
||||
int value;
|
||||
const char *name;
|
||||
} IONamedValue;
|
||||
|
||||
|
||||
/*
|
||||
* Memory alignment -- specified as a power of two.
|
||||
*/
|
||||
typedef unsigned int IOAlignment;
|
||||
|
||||
#define IO_NULL_VM_TASK ((vm_task_t)0)
|
||||
|
||||
|
||||
/*
|
||||
* Pull in machine specific stuff.
|
||||
*/
|
||||
|
||||
//#include <IOKit/machine/IOTypes.h>
|
||||
|
||||
#ifndef MACH_KERNEL
|
||||
|
||||
#ifndef __IOKIT_PORTS_DEFINED__
|
||||
#define __IOKIT_PORTS_DEFINED__
|
||||
typedef mach_port_t io_object_t;
|
||||
#endif /* __IOKIT_PORTS_DEFINED__ */
|
||||
|
||||
#include <device/device_types.h>
|
||||
|
||||
typedef io_object_t io_connect_t;
|
||||
typedef io_object_t io_enumerator_t;
|
||||
typedef io_object_t io_ident_t;
|
||||
typedef io_object_t io_iterator_t;
|
||||
typedef io_object_t io_registry_entry_t;
|
||||
typedef io_object_t io_service_t;
|
||||
typedef io_object_t uext_object_t;
|
||||
|
||||
#define IO_OBJECT_NULL ((io_object_t) 0)
|
||||
|
||||
#endif /* MACH_KERNEL */
|
||||
|
||||
#include <IOKit/IOMapTypes.h>
|
||||
|
||||
/*! @enum Scale Factors
|
||||
* @discussion Used when a scale_factor parameter is required to define a unit of time.
|
||||
* @constant kNanosecondScale Scale factor for nanosecond based times.
|
||||
* @constant kMicrosecondScale Scale factor for microsecond based times.
|
||||
* @constant kMillisecondScale Scale factor for millisecond based times.
|
||||
* @constant kTickScale Scale factor for the standard (100Hz) tick.
|
||||
* @constant kSecondScale Scale factor for second based times. */
|
||||
|
||||
enum {
|
||||
kNanosecondScale = 1,
|
||||
kMicrosecondScale = 1000,
|
||||
kMillisecondScale = 1000 * 1000,
|
||||
kSecondScale = 1000 * 1000 * 1000,
|
||||
kTickScale = (kSecondScale / 100)
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOConnectMethodVarOutputSize = -3
|
||||
};
|
||||
|
||||
/* compatibility types */
|
||||
|
||||
|
||||
typedef unsigned int IODeviceNumber;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
enum {
|
||||
kIOMaxBusStall40usec = 40000,
|
||||
kIOMaxBusStall30usec = 30000,
|
||||
kIOMaxBusStall25usec = 25000,
|
||||
kIOMaxBusStall20usec = 20000,
|
||||
kIOMaxBusStall10usec = 10000,
|
||||
kIOMaxBusStall5usec = 5000,
|
||||
kIOMaxBusStallNone = 0,
|
||||
};
|
||||
|
||||
#endif /* ! __IOKIT_IOTYPES_H */
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _IOUSERSERVER_H
|
||||
#define _IOUSERSERVER_H
|
||||
|
||||
#include <IOKit/IORPC.h>
|
||||
|
||||
#define kIOUserClassKey "IOUserClass"
|
||||
#define kIOUserServerClassKey "IOUserServer"
|
||||
#define kIOUserServerNameKey "IOUserServerName"
|
||||
#define kIOUserServerTagKey "IOUserServerTag"
|
||||
// the expected cdhash value of the userspace driver executable
|
||||
#define kIOUserServerCDHashKey "IOUserServerCDHash"
|
||||
|
||||
#if DRIVERKIT_PRIVATE
|
||||
|
||||
enum{
|
||||
kIOKitUserServerClientType = 0x99000003,
|
||||
};
|
||||
|
||||
enum{
|
||||
kIOUserServerMethodRegisterClass = 0x0001000,
|
||||
kIOUserServerMethodStart = 0x0001001,
|
||||
kIOUserServerMethodRegister = 0x0001002,
|
||||
};
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#define OSObject_Instantiate_ID 0x0000000100000001ULL
|
||||
|
||||
enum {
|
||||
kOSObjectRPCRemote = 0x00000001,
|
||||
kOSObjectRPCKernel = 0x00000002,
|
||||
};
|
||||
|
||||
struct OSObject_Instantiate_Msg_Content {
|
||||
IORPCMessage __hdr;
|
||||
OSObjectRef __object;
|
||||
};
|
||||
|
||||
struct OSObject_Instantiate_Rpl_Content {
|
||||
IORPCMessage __hdr;
|
||||
kern_return_t __result;
|
||||
uint32_t __pad;
|
||||
uint64_t flags;
|
||||
char classname[128];
|
||||
uint64_t methods[0];
|
||||
};
|
||||
|
||||
#pragma pack(4)
|
||||
struct OSObject_Instantiate_Msg {
|
||||
IORPCMessageMach mach;
|
||||
mach_msg_port_descriptor_t __object__descriptor;
|
||||
OSObject_Instantiate_Msg_Content content;
|
||||
};
|
||||
struct OSObject_Instantiate_Rpl {
|
||||
IORPCMessageMach mach;
|
||||
OSObject_Instantiate_Rpl_Content content;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
typedef uint64_t IOTrapMessageBuffer[256];
|
||||
|
||||
#endif /* DRIVERKIT_PRIVATE */
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#endif /* _IOUSERSERVER_H */
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __OS_OSMESSAGENOTIFICATION_H
|
||||
#define __OS_OSMESSAGENOTIFICATION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <mach/mach_types.h>
|
||||
#include <device/device_types.h>
|
||||
#include <IOKit/IOReturn.h>
|
||||
|
||||
enum {
|
||||
kFirstIOKitNotificationType = 100,
|
||||
kIOServicePublishNotificationType = 100,
|
||||
kIOServiceMatchedNotificationType = 101,
|
||||
kIOServiceTerminatedNotificationType = 102,
|
||||
kIOAsyncCompletionNotificationType = 150,
|
||||
kIOServiceMessageNotificationType = 160,
|
||||
kLastIOKitNotificationType = 199,
|
||||
|
||||
// reserved bits
|
||||
kIOKitNoticationTypeMask = 0x00000FFF,
|
||||
kIOKitNoticationTypeSizeAdjShift = 30,
|
||||
kIOKitNoticationMsgSizeMask = 3,
|
||||
};
|
||||
|
||||
enum {
|
||||
kOSNotificationMessageID = 53,
|
||||
kOSAsyncCompleteMessageID = 57,
|
||||
kMaxAsyncArgs = 16
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAsyncReservedIndex = 0,
|
||||
kIOAsyncReservedCount,
|
||||
|
||||
kIOAsyncCalloutFuncIndex = kIOAsyncReservedCount,
|
||||
kIOAsyncCalloutRefconIndex,
|
||||
kIOAsyncCalloutCount,
|
||||
|
||||
kIOMatchingCalloutFuncIndex = kIOAsyncReservedCount,
|
||||
kIOMatchingCalloutRefconIndex,
|
||||
kIOMatchingCalloutCount,
|
||||
|
||||
kIOInterestCalloutFuncIndex = kIOAsyncReservedCount,
|
||||
kIOInterestCalloutRefconIndex,
|
||||
kIOInterestCalloutServiceIndex,
|
||||
kIOInterestCalloutCount
|
||||
};
|
||||
|
||||
|
||||
|
||||
// --------------
|
||||
enum {
|
||||
kOSAsyncRef64Count = 8,
|
||||
kOSAsyncRef64Size = kOSAsyncRef64Count * ((int) sizeof(io_user_reference_t))
|
||||
};
|
||||
typedef io_user_reference_t OSAsyncReference64[kOSAsyncRef64Count];
|
||||
|
||||
struct OSNotificationHeader64 {
|
||||
mach_msg_size_t size; /* content size */
|
||||
natural_t type;
|
||||
OSAsyncReference64 reference;
|
||||
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
unsigned char content[];
|
||||
#else
|
||||
unsigned char content[0];
|
||||
#endif
|
||||
};
|
||||
|
||||
#pragma pack(4)
|
||||
struct IOServiceInterestContent64 {
|
||||
natural_t messageType;
|
||||
io_user_reference_t messageArgument[1];
|
||||
};
|
||||
#pragma pack()
|
||||
// --------------
|
||||
|
||||
#if !KERNEL_USER32
|
||||
|
||||
enum {
|
||||
kOSAsyncRefCount = 8,
|
||||
kOSAsyncRefSize = 32
|
||||
};
|
||||
typedef natural_t OSAsyncReference[kOSAsyncRefCount] __kernel_ptr_semantics;
|
||||
|
||||
struct OSNotificationHeader {
|
||||
mach_msg_size_t size; /* content size */
|
||||
natural_t type;
|
||||
OSAsyncReference reference;
|
||||
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
unsigned char content[];
|
||||
#else
|
||||
unsigned char content[0];
|
||||
#endif
|
||||
};
|
||||
|
||||
#pragma pack(4)
|
||||
struct IOServiceInterestContent {
|
||||
natural_t messageType;
|
||||
void * messageArgument[1];
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
#endif /* KERNEL_USER32 */
|
||||
|
||||
struct IOAsyncCompletionContent {
|
||||
IOReturn result;
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
void * args[] __attribute__ ((packed));
|
||||
#else
|
||||
void * args[0] __attribute__ ((packed));
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef struct OSNotificationHeader OSNotificationHeader;
|
||||
typedef struct IOServiceInterestContent IOServiceInterestContent;
|
||||
typedef struct IOAsyncCompletionContent IOAsyncCompletionContent;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OS_OSMESSAGENOTIFICATION_H */
|
||||
@@ -0,0 +1,494 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2013 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOAUDIODEFINES_H
|
||||
#define _IOAUDIODEFINES_H
|
||||
|
||||
#define kIOAudioDeviceClassName "IOAudioDevice"
|
||||
#define kIOAudioEngineClassName "IOAudioEngine"
|
||||
#define kIOAudioStreamClassName "IOAudioStream"
|
||||
#define kIOAudioPortClassName "IOAudioPort"
|
||||
#define kIOAudioControlClassName "IOAudioControl"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioSampleRateKey
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine sample rate attribute
|
||||
* @discussion This value is represented as an integer in samples per second.
|
||||
*/
|
||||
#define kIOAudioSampleRateKey "IOAudioSampleRate"
|
||||
|
||||
#define kIOAudioSampleRateWholeNumberKey "IOAudioSampleRateWholeNumber"
|
||||
#define kIOAudioSampleRateFractionKey "IOAudioSampleRateFraction"
|
||||
|
||||
|
||||
|
||||
/******
|
||||
*
|
||||
* IOAudioDevice defines
|
||||
*
|
||||
*****/
|
||||
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioDeviceNameKey
|
||||
* @abstract The key in the IORegistry for the IOAudioDevice name attribute.
|
||||
*/
|
||||
#define kIOAudioDeviceNameKey "IOAudioDeviceName"
|
||||
|
||||
#define kIOAudioDeviceShortNameKey "IOAudioDeviceShortName"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioDeviceManufacturerNameKey
|
||||
* @abstract The key in the IORegistry for the IOAudioDevice manufacturer name attribute.
|
||||
*/
|
||||
#define kIOAudioDeviceManufacturerNameKey "IOAudioDeviceManufacturerName"
|
||||
|
||||
#define kIOAudioDeviceLocalizedBundleKey "IOAudioDeviceLocalizedBundle"
|
||||
|
||||
#define kIOAudioDeviceTransportTypeKey "IOAudioDeviceTransportType"
|
||||
|
||||
#define kIOAudioDeviceConfigurationAppKey "IOAudioDeviceConfigurationApplication"
|
||||
|
||||
#define kIOAudioDeviceCanBeDefaults "IOAudioDeviceCanBeDefaults"
|
||||
|
||||
#define kIOAudioDeviceModelIDKey "IOAudioDeviceModelID"
|
||||
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioDeviceIconName
|
||||
* @abstract The key in the IORegistry for the IOAudioDevice icon name attribute.
|
||||
*/
|
||||
#define kIOAudioDeviceIconNameKey "IOAudioDeviceIconName"
|
||||
|
||||
#define kIOAudioDeviceIconTypeKey "IOAudioDeviceIconType"
|
||||
|
||||
#define kIOAudioDeviceIconSubDirKey "IOAudioDeviceIconSubDir"
|
||||
|
||||
/*****
|
||||
*
|
||||
* IOAudioEngine defines
|
||||
*
|
||||
*****/
|
||||
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineStateKey
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine state atrribute
|
||||
* @discussion The value for this key may be one of: "Running", "Stopped" or "Paused". Currently the "Paused"
|
||||
* state is unimplemented.
|
||||
*/
|
||||
#define kIOAudioEngineStateKey "IOAudioEngineState"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineOutputSampleLatencyKey
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine output sample latency key
|
||||
* @discussion
|
||||
*/
|
||||
#define kIOAudioEngineOutputSampleLatencyKey "IOAudioEngineOutputSampleLatency"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioStreamSampleLatencyKey
|
||||
* @abstract The key in the IORegistry for the IOAudioStream output sample latency key
|
||||
* @discussion Tells the HAL how much latency is on a particular stream. If two streams
|
||||
* on the same engine have different latencies (e.g. one is analog, one is digital), then
|
||||
* set this property on both streams to inform the HAL of the latency differences. Alternately,
|
||||
* you can set the engine latency, and just include the latency additional to that for the particular
|
||||
* stream. The HAL will add the engine and stream latency numbers together to get the total latency.
|
||||
*/
|
||||
#define kIOAudioStreamSampleLatencyKey "IOAudioStreamSampleLatency"
|
||||
|
||||
#define kIOAudioEngineInputSampleLatencyKey "IOAudioEngineInputSampleLatency"
|
||||
|
||||
#define kIOAudioEngineSampleOffsetKey "IOAudioEngineSampleOffset"
|
||||
|
||||
#define kIOAudioEngineInputSampleOffsetKey "IOAudioEngineInputSampleOffset"
|
||||
|
||||
#define kIOAudioEngineNumSampleFramesPerBufferKey "IOAudioEngineNumSampleFramesPerBuffer"
|
||||
|
||||
#define kIOAudioEngineCoreAudioPlugInKey "IOAudioEngineCoreAudioPlugIn"
|
||||
|
||||
#define kIOAudioEngineNumActiveUserClientsKey "IOAudioEngineNumActiveUserClients"
|
||||
|
||||
#define kIOAudioEngineUserClientActiveKey "IOAudioEngineUserClientActive"
|
||||
|
||||
#define kIOAudioEngineGlobalUniqueIDKey "IOAudioEngineGlobalUniqueID"
|
||||
|
||||
#define kIOAudioEngineDescriptionKey "IOAudioEngineDescription"
|
||||
|
||||
#define kIOAudioEngineClockIsStableKey "IOAudioEngineClockIsStable"
|
||||
|
||||
#define kIOAudioEngineClockDomainKey "IOAudioEngineClockDomain"
|
||||
|
||||
#define kIOAudioEngineIsHiddenKey "IOAudioEngineIsHidden"
|
||||
|
||||
#define kIOAudioEngineOutputAutoRouteKey "NoAutoRoute"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineUseHiResSampleInterval
|
||||
* @abstract The key in the IORegistry to tell the HAL to use "Hi Resolution" sampleInterval values in performClientIO
|
||||
* @discussion The HAL has always passed two 32 bit values to the performClientIO trap. sampleIntervalHi is the upper
|
||||
* 32 bits and sampleIntervalLo the lower 32 bits of an AbsoluteTime representing the time between two consecutive audio
|
||||
* samples on this Engine's running clock. This time is always very small, meaning that the upper 32 bits are always 0
|
||||
* but the value is also rounded, meaning that there could be error in the amount of time, especially at higher sample rates
|
||||
* where the value is pretty small (e.g. at a nominal rate of 768kHz, sampleInterval is 1302.0833 nanoseconds which will come
|
||||
* into performClientIO as (0, 1302) thus losing some precision
|
||||
* when kIOAudioEngineUseHiResSampleInterval is set, the HAL will send the sampleInterval as a 32.32 Fixed Point number.
|
||||
* sampleIntervalHi will contain the integer part of the sampleInterval (1302) abd sampleIntervalLo will contain the fractional
|
||||
* part encoded as a standard binary fixed point decimal
|
||||
*/
|
||||
#define kIOAudioEngineUseHiResSampleIntervalKey "IOAudioEngineUseHiResSampleInterval"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineFullChannelNamesKey
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine's dictionary of fully constructed names for each channel keyed by the device channel
|
||||
* @discussion
|
||||
*/
|
||||
#define kIOAudioEngineFullChannelNamesKey "IOAudioEngineChannelNames"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineFullChannelCategoryNamesKey
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine's dictionary of category names for each channel keyed by the device channel
|
||||
* @discussion
|
||||
*/
|
||||
#define kIOAudioEngineFullChannelCategoryNamesKey "IOAudioEngineChannelCategoryNames"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineFullChannelNamesKey
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine's dictionary of number names for each channel keyed by the device channel
|
||||
* @discussion
|
||||
*/
|
||||
#define kIOAudioEngineFullChannelNumberNamesKey "IOAudioEngineChannelNumberNames"
|
||||
|
||||
#define kIOAudioEngineFullChannelNameKeyInputFormat "InputChannel%u"
|
||||
|
||||
#define kIOAudioEngineFullChannelNameKeyOutputFormat "OutputChannel%u"
|
||||
|
||||
#define kIOAudioEngineFlavorKey "IOAudioEngineFlavor"
|
||||
|
||||
#define kIOAudioEngineAlwaysLoadCoreAudioPlugInKey "IOAudioEngineAlwaysLoadCoreAudioPlugIn"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineInputChannelLayoutKey
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine's dictionary describes an array of OSNumber data that describe the spatial position of each channel. See IOAudioTypes.h.
|
||||
* @discussion
|
||||
*/
|
||||
|
||||
#ifndef __OPEN_SOURCE__
|
||||
// <rdar://6868206>
|
||||
#endif
|
||||
#define kIOAudioEngineInputChannelLayoutKey "IOAudioEngineInputChannelLayout"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineOutputChannelLayoutKey
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine's dictionary describes an array of OSNumber data that describe the spatial position of each channel. See IOAudioTypes.h.
|
||||
* @discussion
|
||||
*/
|
||||
|
||||
#ifndef __OPEN_SOURCE__
|
||||
// <rdar://6868206>
|
||||
#endif
|
||||
#define kIOAudioEngineOutputChannelLayoutKey "IOAudioEngineOutputChannelLayout"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineDisableClockBoundsCheck
|
||||
* @abstract The key in the IORegistry for the IOAudioEngine's dictionary implemented as an OSBoolean that is used to disable the bounds checking on timestamps being passed to the HAL.
|
||||
* @discussion By using this key and setting the value to true the driver is asserting that it guarantees that all zero timestamps passed to the HAL increment appropriately at the
|
||||
correct period. This key is used to disable the HAL test that the timestamp is within 1ms of the current time, so that a driver may pass a timestamp that is more than
|
||||
1ms in the future. This may be useful when a timestamp is based on a large DMA read/write which encompasses the wrap point but occurs many samples before the end of that point.
|
||||
*/
|
||||
#define kIOAudioEngineDisableClockBoundsCheck "IOAudioEngineDisableClockBoundsCheck"
|
||||
|
||||
/*****
|
||||
*
|
||||
* IOAudioStream defines
|
||||
*
|
||||
*****/
|
||||
|
||||
|
||||
#define kIOAudioStreamIDKey "IOAudioStreamID"
|
||||
#define kIOAudioStreamDescriptionKey "IOAudioStreamDescription"
|
||||
#define kIOAudioStreamNumClientsKey "IOAudioStreamNumClients"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioStreamDirectionKey
|
||||
* @abstract The key in the IORegistry for the IOAudioStream direction attribute.
|
||||
* @discussion The value for this key may be either "Output" or "Input".
|
||||
*/
|
||||
#define kIOAudioStreamDirectionKey "IOAudioStreamDirection"
|
||||
|
||||
#define kIOAudioStreamStartingChannelIDKey "IOAudioStreamStartingChannelID"
|
||||
#define kIOAudioStreamStartingChannelNumberKey "IOAudioStreamStartingChannelNumber"
|
||||
#define kIOAudioStreamAvailableKey "IOAudioStreamAvailable"
|
||||
|
||||
#define kIOAudioStreamFormatKey "IOAudioStreamFormat"
|
||||
#define kIOAudioStreamAvailableFormatsKey "IOAudioStreamAvailableFormats"
|
||||
|
||||
#define kIOAudioStreamNumChannelsKey "IOAudioStreamNumChannels"
|
||||
#define kIOAudioStreamSampleFormatKey "IOAudioStreamSampleFormat"
|
||||
|
||||
#define kIOAudioStreamNumericRepresentationKey "IOAudioStreamNumericRepresentation"
|
||||
|
||||
#define kIOAudioStreamFormatFlagsKey "IOAudioStreamFormatFlags"
|
||||
#define kIOAudioStreamFramesPerPacketKey "IOAudioStreamFramesPerPacket"
|
||||
#define kIOAudioStreamBytesPerPacketKey "IOAudioStreamBytesPerPacket"
|
||||
|
||||
|
||||
#define kIOAudioStreamBitDepthKey "IOAudioStreamBitDepth"
|
||||
#define kIOAudioStreamBitWidthKey "IOAudioStreamBitWidth"
|
||||
|
||||
#define kIOAudioStreamAlignmentKey "IOAudioStreamAlignment"
|
||||
|
||||
#define kIOAudioStreamByteOrderKey "IOAudioStreamByteOrder"
|
||||
|
||||
#define kIOAudioStreamIsMixableKey "IOAudioStreamIsMixable"
|
||||
|
||||
#define kIOAudioStreamMinimumSampleRateKey "IOAudioStreamMinimumSampleRate"
|
||||
#define kIOAudioStreamMaximumSampleRateKey "IOAudioStreamMaximumSampleRate"
|
||||
|
||||
#define kIOAudioStreamDriverTagKey "IOAudioStreamDriverTag"
|
||||
|
||||
#define kIOAudioStreamTerminalTypeKey "IOAudioStreamTerminalType"
|
||||
|
||||
/*****
|
||||
*
|
||||
* IOAudioPort defines
|
||||
*
|
||||
*****/
|
||||
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioPortTypeKey
|
||||
* @abstract The key in the IORegistry for the IOAudioPort type attribute.
|
||||
* @discussion This is a driver-defined text attribute that may contain any type.
|
||||
* Common types are defined as: "Speaker", "Headphones", "Microphone", "CD", "Line", "Digital", "Mixer", "PassThru".
|
||||
*/
|
||||
#define kIOAudioPortTypeKey "IOAudioPortType"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioPortSubTypeKey
|
||||
* @abstract The key in the IORegistry for the IOAudioPort subtype attribute.
|
||||
* @discussion The IOAudioPort subtype is a driver-defined text attribute designed to complement the type
|
||||
* attribute.
|
||||
*/
|
||||
#define kIOAudioPortSubTypeKey "IOAudioPortSubType"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioPortNameKey
|
||||
* @abstract The key in the IORegistry for the IOAudioPort name attribute.
|
||||
*/
|
||||
#define kIOAudioPortNameKey "IOAudioPortName"
|
||||
|
||||
|
||||
|
||||
/*****
|
||||
*
|
||||
* IOAudioControl defines
|
||||
*
|
||||
*****/
|
||||
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlTypeKey
|
||||
* @abstract The key in the IORegistry for the IOAudioCntrol type attribute.
|
||||
* @discussion The value of this text attribute may be defined by the driver, however system-defined
|
||||
* types recognized by the upper-level software are "Level", "Mute", "Selector".
|
||||
*/
|
||||
#define kIOAudioControlTypeKey "IOAudioControlType"
|
||||
|
||||
#define kIOAudioControlSubTypeKey "IOAudioControlSubType"
|
||||
|
||||
#define kIOAudioControlUsageKey "IOAudioControlUsage"
|
||||
|
||||
#define kIOAudioControlIDKey "IOAudioControlID"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelIDKey
|
||||
* @abstract The key in the IORegistry for the IOAudioControl channel ID attribute
|
||||
* @discussion The value for this key is an integer which may be driver defined. Default values for
|
||||
* common channel types are provided in the following defines.
|
||||
*/
|
||||
#define kIOAudioControlChannelIDKey "IOAudioControlChannelID"
|
||||
|
||||
#define kIOAudioControlChannelNumberKey "IOAudioControlChannelNumber"
|
||||
|
||||
#define kIOAudioControlCoreAudioPropertyIDKey "IOAudioControlCoreAudioPropertyID"
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameKey
|
||||
* @abstract The key in the IORegistry for the IOAudioControl name attribute.
|
||||
* @discussion This name should be a human-readable name for the channel(s) represented by the port.
|
||||
* *** NOTE *** We really need to make all of the human-readable attributes that have potential to
|
||||
* be used in a GUI localizable. There will need to be localized strings in the kext bundle matching
|
||||
* the text.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameKey "IOAudioControlChannelName"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameAll
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for all channels.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameAll "All Channels"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameLeft
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the left channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameLeft "Left"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameRight
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the right channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameRight "Right"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameCenter
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the center channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameCenter "Center"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameLeftRear
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the left rear channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameLeftRear "LeftRear"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameRightRear
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the right rear channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameRightRear "RightRear"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameSub
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the sub/LFE channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameSub "Sub"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameFrontLeftCenter
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the FrontLeftCenter channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameFrontLeftCenter "FrontLeftCenter"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameFrontRightCenter
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the FrontRightCenter channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameFrontRightCenter "FrontRightCenter"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameRearCenter
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the RearCenter channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameRearCenter "RearCenter"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameSurroundLeft
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the SurroundLeft channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameSurroundLeft "SurroundLeft"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlChannelNameSurroundRight
|
||||
* @abstract The value for the kIOAudioControlChannelNameKey in the IORegistry representing
|
||||
* the channel name for the SurroundRight channel.
|
||||
*/
|
||||
#define kIOAudioControlChannelNameSurroundRight "SurroundRight"
|
||||
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlValueKey
|
||||
* @abstract The key in the IORegistry for the IOAudioControl value attribute.
|
||||
* @discussion The value returned by this key is a 32-bit integer representing the current value of the IOAudioControl.
|
||||
*/
|
||||
#define kIOAudioControlValueKey "IOAudioControlValue"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioControlValueIsReadOnlyKey
|
||||
* @abstract The key in the IORegistry for the IOAudioControl value-is-read-only attribute.
|
||||
* @discussion The value returned by this key is a 32-bit integer but the value doesn't have any direct meaning.
|
||||
* Instead, the presence of this key indicates that the value for the control is read-only
|
||||
*/
|
||||
#define kIOAudioControlValueIsReadOnlyKey "IOAudioControlValueIsReadOnly"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioLevelControlMinValueKey
|
||||
* @abstract The key in the IORegistry for the IOAudioControl minimum value attribute.
|
||||
* @discussion The value returned by this key is a 32-bit integer representing the minimum value for the IOAudioControl.
|
||||
* This is currently only valid for Level controls or other driver-defined controls that have a minimum and maximum
|
||||
* value.
|
||||
*/
|
||||
#define kIOAudioLevelControlMinValueKey "IOAudioLevelControlMinValue"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioLevelControlMaxValueKey
|
||||
* @abstract The key in the IORegistry for the IOAudioControl maximum value attribute.
|
||||
* @discussion The value returned by this key is a 32-bit integer representing the maximum value for the IOAudioControl.
|
||||
* This is currently only valid for Level controls or other driver-defined controls that have a minimum and maximum
|
||||
* value.
|
||||
*/
|
||||
#define kIOAudioLevelControlMaxValueKey "IOAudioLevelControlMaxValue"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioLevelControlMinDBKey
|
||||
* @abstract The key in the IORgistry for the IOAudioControl minimum db value attribute.
|
||||
* @discussion The value returned by this key is a fixed point value in 16.16 format represented as a 32-bit
|
||||
* integer. It represents the minimum value in db for the IOAudioControl. This value matches the minimum
|
||||
* value attribute. This is currently valid for Level controls or other driver-defined controls that have a
|
||||
* minimum and maximum db value.
|
||||
*/
|
||||
#define kIOAudioLevelControlMinDBKey "IOAudioLevelControlMinDB"
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioLevelControlMaxDBKey
|
||||
* @abstract The key in the IORgistry for the IOAudioControl maximum db value attribute.
|
||||
* @discussion The value returned by this key is a fixed point value in 16.16 format represented as a 32-bit
|
||||
* integer. It represents the maximum value in db for the IOAudioControl. This value matches the maximum
|
||||
* value attribute. This is currently valid for Level controls or other driver-defined controls that have a
|
||||
* minimum and maximum db value.
|
||||
*/
|
||||
#define kIOAudioLevelControlMaxDBKey "IOAudioLevelControlMaxDB"
|
||||
|
||||
#define kIOAudioLevelControlRangesKey "IOAudioLevelControlRanges"
|
||||
|
||||
#define kIOAudioLevelControlUseLinearScale "IOAudioLevelControlUseLinearScale"
|
||||
|
||||
#define kIOAudioSelectorControlAvailableSelectionsKey "IOAudioSelectorControlAvailableSelections"
|
||||
#define kIOAudioSelectorControlSelectionValueKey "IOAudioSelectorControlSelectionValue"
|
||||
#define kIOAudioSelectorControlSelectionDescriptionKey "IOAudioSelectorControlSelectionDescriptionKey"
|
||||
#define kIOAudioSelectorControlTransportValueKey "IOAudioSelectorControlTransportValue" // <rdar://8202424>
|
||||
|
||||
#define kIOAudioSelectorControlClockSourceKey "IOAudioSelectorControlClockSourceKey"
|
||||
|
||||
|
||||
#endif /* _IOAUDIODEFINES_H */
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @header IOAudioLib
|
||||
* C interface to IOAudio functions
|
||||
*/
|
||||
|
||||
#ifndef _IOAUDIOLIB_H
|
||||
#define _IOAUDIOLIB_H
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
#include <IOKit/audio/IOAudioTypes.h>
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @function IOAudioIsOutput
|
||||
* @abstract Determines if the audio stream is an output stream
|
||||
* @param service
|
||||
* @param out
|
||||
* @result kern_return_t
|
||||
*/
|
||||
kern_return_t IOAudioIsOutput(io_service_t service, int *out);
|
||||
|
||||
/*!
|
||||
* @function IOAudioFlush
|
||||
* @abstract Indicate the position at which the audio stream can be stopped.
|
||||
* @param connect the audio stream
|
||||
* @param end the position
|
||||
* @result kern_return_t
|
||||
*/
|
||||
kern_return_t IOAudioFlush(io_connect_t connect, IOAudioStreamPosition *end);
|
||||
|
||||
/*!
|
||||
* @function IOAudioSetErase
|
||||
* @abstract Set autoerase flag, returns old value
|
||||
* @param connect the audio stream
|
||||
* @param erase true to turn off, false otherwise
|
||||
* @param oldVal previous value
|
||||
* @result kern_return_t
|
||||
*/
|
||||
kern_return_t IOAudioSetErase(io_connect_t connect, int erase, int *oldVal);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
#endif /* ! _IOAUDIOLIB_H */
|
||||
@@ -0,0 +1,685 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2013 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOAUDIOTYPES_H
|
||||
#define _IOKIT_IOAUDIOTYPES_H
|
||||
|
||||
#include <libkern/OSTypes.h>
|
||||
#include <mach/message.h>
|
||||
|
||||
|
||||
/*!
|
||||
* @enum IOAudioEngineMemory
|
||||
* @abstract Used to identify the type of memory requested by a client process to be mapped into its process space
|
||||
* @discussion This is the parameter to the type field of IOMapMemory when called on an IOAudioEngine. This is
|
||||
* only intended for use by the Audio Device API library.
|
||||
* @constant kIOAudioSampleBuffer This requests the IOAudioEngine's sample buffer
|
||||
* @constant kIOAudioStatusBuffer This requests the IOAudioEngine's status buffer. It's type is IOAudioEngineStatus.
|
||||
* @constant kIOAudioMixBuffer This requests the IOAudioEngine's mix buffer
|
||||
*/
|
||||
typedef enum _IOAudioEngineMemory {
|
||||
kIOAudioStatusBuffer = 0,
|
||||
kIOAudioSampleBuffer = 1,
|
||||
kIOAudioMixBuffer = 2,
|
||||
kIOAudioBytesInInputBuffer = 3,
|
||||
kIOAudioBytesInOutputBuffer = 4
|
||||
} IOAudioEngineMemory;
|
||||
|
||||
/*!
|
||||
* @enum IOAudioEngineCalls
|
||||
* @abstract The set of constants passed to IOAudioEngineUserClient::getExternalMethodForIndex() when making calls
|
||||
* from the IOAudioFamily user client code.
|
||||
*/
|
||||
typedef enum _IOAudioEngineCalls {
|
||||
kIOAudioEngineCallRegisterClientBuffer = 0,
|
||||
kIOAudioEngineCallUnregisterClientBuffer = 1,
|
||||
kIOAudioEngineCallGetConnectionID = 2,
|
||||
kIOAudioEngineCallStart = 3,
|
||||
kIOAudioEngineCallStop = 4,
|
||||
kIOAudioEngineCallGetNearestStartTime = 5
|
||||
} IOAudioEngineCalls;
|
||||
|
||||
/*! @defined kIOAudioEngineNumCalls The number of elements in the IOAudioEngineCalls enum. */
|
||||
#define kIOAudioEngineNumCalls 6
|
||||
|
||||
typedef enum _IOAudioEngineTraps {
|
||||
kIOAudioEngineTrapPerformClientIO = 0
|
||||
} IOAudioEngineTraps;
|
||||
|
||||
typedef enum _IOAudioEngineNotifications {
|
||||
kIOAudioEngineAllNotifications = 0,
|
||||
kIOAudioEngineStreamFormatChangeNotification = 1,
|
||||
kIOAudioEngineChangeNotification = 2,
|
||||
kIOAudioEngineStartedNotification = 3,
|
||||
kIOAudioEngineStoppedNotification = 4,
|
||||
kIOAudioEnginePausedNotification = 5,
|
||||
kIOAudioEngineResumedNotification = 6
|
||||
} IOAudioEngineNotifications;
|
||||
|
||||
/*!
|
||||
* @enum IOAudioEngineState
|
||||
* @abstract Represents the state of an IOAudioEngine
|
||||
* @constant kIOAudioEngineRunning The IOAudioEngine is currently running - it is transferring data to or
|
||||
* from the device.
|
||||
* @constant kIOAudioEngineStopped The IOAudioEngine is currently stopped - no activity is occurring.
|
||||
*/
|
||||
|
||||
typedef enum _IOAudioEngineState {
|
||||
kIOAudioEngineStopped = 0,
|
||||
kIOAudioEngineRunning = 1,
|
||||
kIOAudioEnginePaused = 2,
|
||||
kIOAudioEngineResumed = 3
|
||||
} IOAudioEngineState;
|
||||
|
||||
|
||||
/*!
|
||||
* @typedef IOAudioEngineStatus
|
||||
* @abstract Shared-memory structure giving audio engine status
|
||||
* @discussion
|
||||
* @field fVersion Indicates version of this structure
|
||||
* @field fCurrentLoopCount Number of times around the ring buffer since the audio engine started
|
||||
* @field fLastLoopTime Timestamp of the last time the ring buffer wrapped
|
||||
* @field fEraseHeadSampleFrame Location of the erase head in sample frames - erased up to but not
|
||||
* including the given sample frame
|
||||
*/
|
||||
|
||||
typedef struct _IOAudioEngineStatus {
|
||||
UInt32 fVersion;
|
||||
volatile UInt32 fCurrentLoopCount;
|
||||
volatile AbsoluteTime fLastLoopTime;
|
||||
volatile UInt32 fEraseHeadSampleFrame;
|
||||
} IOAudioEngineStatus;
|
||||
|
||||
#define kIOAudioEngineCurrentStatusStructVersion 2
|
||||
|
||||
typedef struct _IOAudioStreamFormat {
|
||||
UInt32 fNumChannels;
|
||||
UInt32 fSampleFormat;
|
||||
UInt32 fNumericRepresentation;
|
||||
UInt8 fBitDepth;
|
||||
UInt8 fBitWidth;
|
||||
UInt8 fAlignment;
|
||||
UInt8 fByteOrder;
|
||||
UInt8 fIsMixable;
|
||||
UInt32 fDriverTag;
|
||||
} IOAudioStreamFormat;
|
||||
|
||||
#define kFormatExtensionInvalidVersion 0
|
||||
#define kFormatExtensionCurrentVersion 1
|
||||
|
||||
typedef struct _IOAudioStreamFormatExtension {
|
||||
UInt32 fVersion;
|
||||
UInt32 fFlags;
|
||||
UInt32 fFramesPerPacket;
|
||||
UInt32 fBytesPerPacket;
|
||||
} IOAudioStreamFormatExtension;
|
||||
|
||||
typedef struct _IOAudioBufferDataDescriptor {
|
||||
UInt32 fActualDataByteSize;
|
||||
UInt32 fActualNumSampleFrames;
|
||||
UInt32 fTotalDataByteSize;
|
||||
UInt32 fNominalDataByteSize;
|
||||
UInt8 fData[1];
|
||||
} IOAudioBufferDataDescriptor;
|
||||
|
||||
#define kStreamDataDescriptorInvalidVersion 0
|
||||
#define kStreamDataDescriptorCurrentVersion 1
|
||||
|
||||
typedef struct _IOAudioStreamDataDescriptor {
|
||||
UInt32 fVersion;
|
||||
UInt32 fNumberOfStreams;
|
||||
UInt32 fStreamLength[1]; // Array with fNumberOfStreams number of entries
|
||||
} IOAudioStreamDataDescriptor;
|
||||
|
||||
typedef struct _IOAudioSampleIntervalDescriptor {
|
||||
UInt32 sampleIntervalHi;
|
||||
UInt32 sampleIntervalLo;
|
||||
} IOAudioSampleIntervalDescriptor;
|
||||
|
||||
/*!
|
||||
@struct SMPTETime
|
||||
@abstract A structure for holding a SMPTE time.
|
||||
@field fSubframes
|
||||
The number of subframes in the full message.
|
||||
@field fSubframeDivisor
|
||||
The number of subframes per frame (typically 80).
|
||||
@field fCounter
|
||||
The total number of messages received.
|
||||
@field fType
|
||||
The kind of SMPTE time using the SMPTE time type constants.
|
||||
@field fFlags
|
||||
A set of flags that indicate the SMPTE state.
|
||||
@field fHours
|
||||
The number of hourse in the full message.
|
||||
@field fMinutes
|
||||
The number of minutes in the full message.
|
||||
@field fSeconds
|
||||
The number of seconds in the full message.
|
||||
@field fFrames
|
||||
The number of frames in the full message.
|
||||
*/
|
||||
typedef struct _IOAudioSMPTETime
|
||||
{
|
||||
SInt16 fSubframes;
|
||||
SInt16 fSubframeDivisor;
|
||||
UInt32 fCounter;
|
||||
UInt32 fType;
|
||||
UInt32 fFlags;
|
||||
SInt16 fHours;
|
||||
SInt16 fMinutes;
|
||||
SInt16 fSeconds;
|
||||
SInt16 fFrames;
|
||||
|
||||
} IOAudioSMPTETime;
|
||||
|
||||
// constants describing SMPTE types (taken from the MTC spec), <rdar://11955717>
|
||||
enum
|
||||
{
|
||||
kIOAudioSMPTETimeType24 = 0,
|
||||
kIOAudioSMPTETimeType25 = 1,
|
||||
kIOAudioSMPTETimeType30Drop = 2,
|
||||
kIOAudioSMPTETimeType30 = 3,
|
||||
kIOAudioSMPTETimeType2997 = 4,
|
||||
kIOAudioSMPTETimeType2997Drop = 5,
|
||||
kIOAudioSMPTETimeType60 = 6,
|
||||
kIOAudioSMPTETimeType5994 = 7,
|
||||
kIOAudioSMPTETimeType60Drop = 8,
|
||||
kIOAudioSMPTETimeType5994Drop = 9,
|
||||
kIOAudioSMPTETimeType50 = 10,
|
||||
kIOAudioSMPTETimeType2398 = 11
|
||||
};
|
||||
|
||||
// flags describing a SMPTE time stamp
|
||||
enum
|
||||
{
|
||||
kIOAudioSMPTETimeValid = (1L << 0), // the full time is valid
|
||||
kIOAudioSMPTETimeRunning = (1L << 1) // time is running
|
||||
};
|
||||
|
||||
// A struct for encapsulating the parts of a time stamp. The flags
|
||||
// say which fields are valid.
|
||||
typedef struct _IOAudioTimeStamp
|
||||
{
|
||||
UInt64 fSampleTime; // the absolute sample time, was a Float64
|
||||
UInt64 fHostTime; // the host's root timebase's time
|
||||
UInt64 fRateScalar; // the system rate scalar, was a Float64
|
||||
UInt64 fWordClockTime; // the word clock time
|
||||
IOAudioSMPTETime fSMPTETime; // the SMPTE time
|
||||
UInt32 fFlags; // the flags indicate which fields are valid
|
||||
UInt32 fReserved; // reserved, pads the structure out to force 8 byte alignment
|
||||
} IOAudioTimeStamp;
|
||||
|
||||
// flags for the AudioTimeStamp sturcture
|
||||
enum
|
||||
{
|
||||
kIOAudioTimeStampSampleTimeValid = (1L << 0),
|
||||
kIOAudioTimeStampHostTimeValid = (1L << 1),
|
||||
kIOAudioTimeStampRateScalarValid = (1L << 2),
|
||||
kIOAudioTimeStampWordClockTimeValid = (1L << 3),
|
||||
kIOAudioTimeStampSMPTETimeValid = (1L << 4)
|
||||
};
|
||||
|
||||
// Some commonly used combinations of timestamp flags
|
||||
enum
|
||||
{
|
||||
kIOAudioTimeStampSampleHostTimeValid = (kIOAudioTimeStampSampleTimeValid | kIOAudioTimeStampHostTimeValid)
|
||||
};
|
||||
|
||||
/*!
|
||||
* @enum IOAudioStreamDirection
|
||||
* @abstract Represents the direction of an IOAudioStream
|
||||
* @constant kIOAudioStreamDirectionOutput Output buffer
|
||||
* @constant kIOAudioStreamDirectionInput Input buffer
|
||||
*/
|
||||
|
||||
typedef enum _IOAudioStreamDirection {
|
||||
kIOAudioStreamDirectionOutput = 0,
|
||||
kIOAudioStreamDirectionInput = 1
|
||||
} IOAudioStreamDirection;
|
||||
|
||||
enum {
|
||||
kIOAudioDeviceCanBeDefaultNothing = 0,
|
||||
kIOAudioDeviceCanBeDefaultInput = (1L << 0),
|
||||
kIOAudioDeviceCanBeDefaultOutput = (1L << 1),
|
||||
kIOAudioDeviceCanBeSystemOutput = (1L << 2)
|
||||
};
|
||||
|
||||
/*!
|
||||
* @defined kIOAudioEngineDefaultMixBufferSampleSize
|
||||
*/
|
||||
|
||||
#define kIOAudioEngineDefaultMixBufferSampleSize sizeof(float)
|
||||
|
||||
/* The following are for use only by the IOKit.framework audio family code */
|
||||
|
||||
/*!
|
||||
* @enum IOAudioControlCalls
|
||||
* @abstract The set of constants passed to IOAudioControlUserClient::getExternalMethodForIndex() when making calls
|
||||
* from the IOAudioFamily user client code.
|
||||
* @constant kIOAudioControlCallSetValue Used to set the value of an IOAudioControl.
|
||||
* @constant kIOAudioControlCallGetValue Used to get the value of an IOAudioControl.
|
||||
*/
|
||||
typedef enum _IOAudioControlCalls {
|
||||
kIOAudioControlCallSetValue = 0,
|
||||
kIOAudioControlCallGetValue = 1
|
||||
} IOAudioControlCalls;
|
||||
|
||||
/*! @defined kIOAudioControlNumCalls The number of elements in the IOAudioControlCalls enum. */
|
||||
#define kIOAudioControlNumCalls 2
|
||||
|
||||
/*!
|
||||
* @enum IOAudioControlNotifications
|
||||
* @abstract The set of constants passed in the type field of IOAudioControlUserClient::registerNotificaitonPort().
|
||||
* @constant kIOAudioControlValueChangeNotification Used to request value change notifications.
|
||||
* @constant kIOAudioControlRangeChangeNotification Used to request range change notifications.
|
||||
*/
|
||||
typedef enum _IOAudioControlNotifications {
|
||||
kIOAudioControlValueChangeNotification = 0,
|
||||
kIOAudioControlRangeChangeNotification = 1
|
||||
} IOAudioControlNotifications;
|
||||
|
||||
/*!
|
||||
* @struct IOAudioNotificationMessage
|
||||
* @abstract Used in the mach message for IOAudio notifications.
|
||||
* @field messageHeader Standard mach message header
|
||||
* @field ref The param passed to registerNotificationPort() in refCon.
|
||||
*/
|
||||
typedef struct _IOAudioNotificationMessage {
|
||||
mach_msg_header_t messageHeader;
|
||||
UInt32 type;
|
||||
UInt32 ref;
|
||||
void * sender;
|
||||
} IOAudioNotificationMessage;
|
||||
|
||||
typedef struct _IOAudioSampleRate {
|
||||
UInt32 whole;
|
||||
UInt32 fraction;
|
||||
} IOAudioSampleRate;
|
||||
|
||||
#define kNoIdleAudioPowerDown 0xffffffffffffffffULL
|
||||
|
||||
enum {
|
||||
kIOAudioPortTypeOutput = 'outp',
|
||||
kIOAudioPortTypeInput = 'inpt',
|
||||
kIOAudioPortTypeMixer = 'mixr',
|
||||
kIOAudioPortTypePassThru = 'pass',
|
||||
kIOAudioPortTypeProcessing = 'proc'
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioOutputPortSubTypeInternalSpeaker = 'ispk',
|
||||
kIOAudioOutputPortSubTypeExternalSpeaker = 'espk',
|
||||
kIOAudioOutputPortSubTypeHeadphones = 'hdpn',
|
||||
kIOAudioOutputPortSubTypeLine = 'line',
|
||||
kIOAudioOutputPortSubTypeSPDIF = 'spdf',
|
||||
|
||||
kIOAudioInputPortSubTypeInternalMicrophone = 'imic',
|
||||
kIOAudioInputPortSubTypeExternalMicrophone = 'emic',
|
||||
kIOAudioInputPortSubTypeCD = 'cd ',
|
||||
kIOAudioInputPortSubTypeLine = 'line',
|
||||
kIOAudioInputPortSubTypeSPDIF = 'spdf'
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioControlTypeLevel = 'levl',
|
||||
kIOAudioControlTypeToggle = 'togl',
|
||||
kIOAudioControlTypeJack = 'jack',
|
||||
kIOAudioControlTypeSelector = 'slct'
|
||||
};
|
||||
|
||||
// <rdar://8325563> Added kIOAudioToggleControlSubTypePhantomPower, kIOAudioToggleControlSubTypePhaseInvert &
|
||||
// kIOAudioSelectorControlSubTypeChannelHighPassFilter
|
||||
enum {
|
||||
kIOAudioLevelControlSubTypeVolume = 'vlme',
|
||||
kIOAudioLevelControlSubTypeLFEVolume = 'subv',
|
||||
kIOAudioLevelControlSubTypePRAMVolume = 'pram',
|
||||
kIOAudioToggleControlSubTypeMute = 'mute',
|
||||
kIOAudioToggleControlSubTypeSolo = 'solo',
|
||||
kIOAudioToggleControlSubTypeLFEMute = 'subm',
|
||||
kIOAudioToggleControlSubTypeiSubAttach = 'atch',
|
||||
kIOAudioToggleControlSubTypePhantomPower = 'phan',
|
||||
kIOAudioToggleControlSubTypePhaseInvert = 'phsi',
|
||||
kIOAudioSelectorControlSubTypeOutput = 'outp',
|
||||
kIOAudioSelectorControlSubTypeInput = 'inpt',
|
||||
kIOAudioSelectorControlSubTypeClockSource = 'clck',
|
||||
kIOAudioSelectorControlSubTypeDestination = 'dest',
|
||||
kIOAudioSelectorControlSubTypeChannelNominalLineLevel = 'nlev',
|
||||
kIOAudioSelectorControlSubTypeChannelLevelPlus4dBu = '4dbu',
|
||||
kIOAudioSelectorControlSubTypeChannelLevelMinus10dBV = '10db',
|
||||
kIOAudioSelectorControlSubTypeChannelLevelMinus20dBV = '20db',
|
||||
kIOAudioSelectorControlSubTypeChannelLevelMicLevel = 'micl',
|
||||
kIOAudioSelectorControlSubTypeChannelLevelInstrumentLevel = 'istl',
|
||||
kIOAudioSelectorControlSubTypeChannelHighPassFilter = 'hipf'
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioControlUsageOutput = 'outp',
|
||||
kIOAudioControlUsageInput = 'inpt',
|
||||
kIOAudioControlUsagePassThru = 'pass',
|
||||
kIOAudioControlUsageCoreAudioProperty = 'prop'
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioControlChannelNumberInactive = -1,
|
||||
kIOAudioControlChannelIDAll = 0,
|
||||
kIOAudioControlChannelIDDefaultLeft = 1,
|
||||
kIOAudioControlChannelIDDefaultRight = 2,
|
||||
kIOAudioControlChannelIDDefaultCenter = 3,
|
||||
kIOAudioControlChannelIDDefaultLeftRear = 4,
|
||||
kIOAudioControlChannelIDDefaultRightRear = 5,
|
||||
kIOAudioControlChannelIDDefaultSub = 6,
|
||||
kIOAudioControlChannelIDDefaultFrontLeftCenter = 7,
|
||||
kIOAudioControlChannelIDDefaultFrontRightCenter = 8,
|
||||
kIOAudioControlChannelIDDefaultRearCenter = 9,
|
||||
kIOAudioControlChannelIDDefaultSurroundLeft = 10,
|
||||
kIOAudioControlChannelIDDefaultSurroundRight = 11
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioSelectorControlSelectionValueNone = 'none',
|
||||
|
||||
// Output-specific selection IDs
|
||||
kIOAudioSelectorControlSelectionValueInternalSpeaker = 'ispk',
|
||||
kIOAudioSelectorControlSelectionValueExternalSpeaker = 'espk',
|
||||
kIOAudioSelectorControlSelectionValueHeadphones = 'hdpn',
|
||||
|
||||
// Input-specific selection IDs
|
||||
kIOAudioSelectorControlSelectionValueInternalMicrophone = 'imic',
|
||||
kIOAudioSelectorControlSelectionValueExternalMicrophone = 'emic',
|
||||
kIOAudioSelectorControlSelectionValueCD = 'cd ',
|
||||
|
||||
// Common selection IDs
|
||||
kIOAudioSelectorControlSelectionValueLine = 'line',
|
||||
kIOAudioSelectorControlSelectionValueSPDIF = 'spdf'
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioStreamSampleFormatLinearPCM = 'lpcm',
|
||||
kIOAudioStreamSampleFormatIEEEFloat = 'ieee',
|
||||
kIOAudioStreamSampleFormatALaw = 'alaw',
|
||||
kIOAudioStreamSampleFormatMuLaw = 'ulaw',
|
||||
kIOAudioStreamSampleFormatMPEG = 'mpeg',
|
||||
kIOAudioStreamSampleFormatAC3 = 'ac-3',
|
||||
kIOAudioStreamSampleFormat1937AC3 = 'cac3',
|
||||
kIOAudioStreamSampleFormat1937MPEG1 = 'mpg1',
|
||||
kIOAudioStreamSampleFormat1937MPEG2 = 'mpg2',
|
||||
kIOAudioStreamSampleFormatTimeCode = 'time' // a stream of IOAudioTimeStamp structures that capture any incoming time code information
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioStreamNumericRepresentationSignedInt = 'sint',
|
||||
kIOAudioStreamNumericRepresentationUnsignedInt = 'uint',
|
||||
kIOAudioStreamNumericRepresentationIEEE754Float = 'flot'
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioClockSelectorTypeInternal = 'int ',
|
||||
kIOAudioClockSelectorTypeExternal = 'ext ',
|
||||
kIOAudioClockSelectorTypeAESEBU = 'asbu',
|
||||
kIOAudioClockSelectorTypeTOSLink = 'tosl',
|
||||
kIOAudioClockSelectorTypeSPDIF = 'spdf',
|
||||
kIOAudioClockSelectorTypeADATOptical = 'adto',
|
||||
kIOAudioClockSelectorTypeADAT9Pin = 'adt9',
|
||||
kIOAudioClockSelectorTypeSMPTE = 'smpt',
|
||||
kIOAudioClockSelectorTypeVideo = 'vdeo',
|
||||
kIOAudioClockSelectorTypeControl = 'cnrl',
|
||||
kIOAudioClockSelectorTypeOther = 'othr',
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioStreamAlignmentLowByte = 0,
|
||||
kIOAudioStreamAlignmentHighByte = 1
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioStreamByteOrderBigEndian = 0,
|
||||
kIOAudioStreamByteOrderLittleEndian = 1
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOAudioLevelControlNegativeInfinity = 0xffffffff
|
||||
};
|
||||
|
||||
enum {
|
||||
#ifndef __OPEN_SOURCE__
|
||||
kIOAudioBuiltInSystemClockDomain = 0x737973,
|
||||
#endif
|
||||
kIOAudioNewClockDomain = 0xffffffff
|
||||
};
|
||||
|
||||
// Device connection types
|
||||
#ifndef __OPEN_SOURCE__
|
||||
// <rdar://7130813> Added kIOAudioDeviceTransportTypeDisplayPort
|
||||
#endif
|
||||
enum {
|
||||
kIOAudioDeviceTransportTypeBuiltIn = 'bltn',
|
||||
kIOAudioDeviceTransportTypePCI = 'pci ',
|
||||
kIOAudioDeviceTransportTypeUSB = 'usb ',
|
||||
kIOAudioDeviceTransportTypeFireWire = '1394',
|
||||
kIOAudioDeviceTransportTypeNetwork = 'ntwk',
|
||||
kIOAudioDeviceTransportTypeWireless = 'wrls',
|
||||
kIOAudioDeviceTransportTypeOther = 'othr',
|
||||
kIOAudioDeviceTransportTypeBluetooth = 'blue',
|
||||
kIOAudioDeviceTransportTypeVirtual = 'virt',
|
||||
kIOAudioDeviceTransportTypeDisplayPort = 'dprt',
|
||||
kIOAudioDeviceTransportTypeHdmi = 'hdmi',
|
||||
kIOAudioDeviceTransportTypeAVB = 'eavb', //<rdar://10874672>
|
||||
kIOAudioDeviceTransportTypeThunderbolt = 'thun' //<rdar://10874672>
|
||||
};
|
||||
|
||||
// types that go nowhere
|
||||
enum {
|
||||
OUTPUT_NULL = 0x0100,
|
||||
INPUT_NULL = 0x0101
|
||||
};
|
||||
|
||||
// Input terminal types
|
||||
enum {
|
||||
INPUT_UNDEFINED = 0x0200,
|
||||
INPUT_MICROPHONE = 0x0201,
|
||||
INPUT_DESKTOP_MICROPHONE = 0x0202,
|
||||
INPUT_PERSONAL_MICROPHONE = 0x0203,
|
||||
INPUT_OMNIDIRECTIONAL_MICROPHONE = 0x0204,
|
||||
INPUT_MICROPHONE_ARRAY = 0x0205,
|
||||
INPUT_PROCESSING_MICROPHONE_ARRAY = 0x0206,
|
||||
INPUT_MODEM_AUDIO = 0x207
|
||||
};
|
||||
|
||||
// Output terminal types
|
||||
enum {
|
||||
OUTPUT_UNDEFINED = 0x0300,
|
||||
OUTPUT_SPEAKER = 0x0301,
|
||||
OUTPUT_HEADPHONES = 0x0302,
|
||||
OUTPUT_HEAD_MOUNTED_DISPLAY_AUDIO = 0x0303,
|
||||
OUTPUT_DESKTOP_SPEAKER = 0x0304,
|
||||
OUTPUT_ROOM_SPEAKER = 0x0305,
|
||||
OUTPUT_COMMUNICATION_SPEAKER = 0x0306,
|
||||
OUTPUT_LOW_FREQUENCY_EFFECTS_SPEAKER = 0x0307
|
||||
};
|
||||
|
||||
// Bi-directional terminal types
|
||||
enum {
|
||||
BIDIRECTIONAL_UNDEFINED = 0x0400,
|
||||
BIDIRECTIONAL_HANDSET = 0x0401,
|
||||
BIDIRECTIONAL_HEADSET = 0x0402,
|
||||
BIDIRECTIONAL_SPEAKERPHONE_NO_ECHO_REDX = 0x0403,
|
||||
BIDIRECTIONAL_ECHO_SUPPRESSING_SPEAKERPHONE = 0x0404,
|
||||
BIDIRECTIONAL_ECHO_CANCELING_SPEAKERPHONE = 0x0405
|
||||
};
|
||||
|
||||
// Telephony terminal types
|
||||
enum {
|
||||
TELEPHONY_UNDEFINED = 0x0500,
|
||||
TELEPHONY_PHONE_LINE = 0x0501,
|
||||
TELEPHONY_TELEPHONE = 0x0502,
|
||||
TELEPHONY_DOWN_LINE_PHONE = 0x0503
|
||||
};
|
||||
|
||||
// External terminal types
|
||||
enum {
|
||||
EXTERNAL_UNDEFINED = 0x0600,
|
||||
EXTERNAL_ANALOG_CONNECTOR = 0x0601,
|
||||
EXTERNAL_DIGITAL_AUDIO_INTERFACE = 0x0602,
|
||||
EXTERNAL_LINE_CONNECTOR = 0x0603,
|
||||
EXTERNAL_LEGACY_AUDIO_CONNECTOR = 0x0604,
|
||||
EXTERNAL_SPDIF_INTERFACE = 0x0605,
|
||||
EXTERNAL_1394_DA_STREAM = 0x0606,
|
||||
EXTERNAL_1394_DV_STREAM_SOUNDTRACK = 0x0607,
|
||||
EXTERNAL_ADAT = 0x0608,
|
||||
EXTERNAL_TDIF = 0x0609,
|
||||
EXTERNAL_MADI = 0x060A
|
||||
};
|
||||
|
||||
// Embedded terminal types
|
||||
enum {
|
||||
EMBEDDED_UNDEFINED = 0x0700,
|
||||
EMBEDDED_LEVEL_CALIBRATION_NOISE_SOURCE = 0x0701,
|
||||
EMBEDDED_EQUALIZATION_NOISE = 0x0702,
|
||||
EMBEDDED_CD_PLAYER = 0x0703,
|
||||
EMBEDDED_DAT = 0x0704,
|
||||
EMBEDDED_DCC = 0x0705,
|
||||
EMBEDDED_MINIDISK = 0x0706,
|
||||
EMBEDDED_ANALOG_TAPE = 0x0707,
|
||||
EMBEDDED_PHONOGRAPH = 0x0708,
|
||||
EMBEDDED_VCR_AUDIO = 0x0709,
|
||||
EMBEDDED_VIDEO_DISC_AUDIO = 0x070A,
|
||||
EMBEDDED_DVD_AUDIO = 0x070B,
|
||||
EMBEDDED_TV_TUNER_AUDIO = 0x070C,
|
||||
EMBEDDED_SATELLITE_RECEIVER_AUDIO = 0x070D,
|
||||
EMBEDDED_CABLE_TUNER_AUDIO = 0x070E,
|
||||
EMBEDDED_DSS_AUDIO = 0x070F,
|
||||
EMBEDDED_RADIO_RECEIVER = 0x0710,
|
||||
EMBEDDED_RADIO_TRANSMITTER = 0x0711,
|
||||
EMBEDDED_MULTITRACK_RECORDER = 0x0712,
|
||||
EMBEDDED_SYNTHESIZER = 0x0713
|
||||
};
|
||||
|
||||
// Processing terminal types
|
||||
enum {
|
||||
PROCESSOR_UNDEFINED = 0x0800,
|
||||
PROCESSOR_GENERAL = 0x0801
|
||||
};
|
||||
|
||||
// Channel spatial position types
|
||||
|
||||
#ifndef __OPEN_SOURCE__
|
||||
// <rdar://6868206> NOTE: the following are derived from CoreAudioTypes.h
|
||||
#endif
|
||||
|
||||
#define kIOAudioChannelLabel_Discrete_field_ba 16
|
||||
enum {
|
||||
kIOAudioChannelLabel_Unknown = 0xFFFFFFFF, // unknown or unspecified other use
|
||||
kIOAudioChannelLabel_Unused = 0, // channel is present, but has no intended use or destination
|
||||
kIOAudioChannelLabel_UseCoordinates = 100, // channel is described by the mCoordinates fields.
|
||||
|
||||
kIOAudioChannelLabel_Left = 1,
|
||||
kIOAudioChannelLabel_Right = 2,
|
||||
kIOAudioChannelLabel_Center = 3,
|
||||
kIOAudioChannelLabel_LFEScreen = 4,
|
||||
kIOAudioChannelLabel_LeftSurround = 5, // WAVE: "Back Left"
|
||||
kIOAudioChannelLabel_RightSurround = 6, // WAVE: "Back Right"
|
||||
kIOAudioChannelLabel_LeftCenter = 7,
|
||||
kIOAudioChannelLabel_RightCenter = 8,
|
||||
kIOAudioChannelLabel_CenterSurround = 9, // WAVE: "Back Center" or plain "Rear Surround"
|
||||
kIOAudioChannelLabel_LeftSurroundDirect = 10, // WAVE: "Side Left"
|
||||
kIOAudioChannelLabel_RightSurroundDirect = 11, // WAVE: "Side Right"
|
||||
kIOAudioChannelLabel_TopCenterSurround = 12,
|
||||
kIOAudioChannelLabel_VerticalHeightLeft = 13, // WAVE: "Top Front Left"
|
||||
kIOAudioChannelLabel_VerticalHeightCenter = 14, // WAVE: "Top Front Center"
|
||||
kIOAudioChannelLabel_VerticalHeightRight = 15, // WAVE: "Top Front Right"
|
||||
|
||||
kIOAudioChannelLabel_TopBackLeft = 16,
|
||||
kIOAudioChannelLabel_TopBackCenter = 17,
|
||||
kIOAudioChannelLabel_TopBackRight = 18,
|
||||
|
||||
kIOAudioChannelLabel_RearSurroundLeft = 33,
|
||||
kIOAudioChannelLabel_RearSurroundRight = 34,
|
||||
kIOAudioChannelLabel_LeftWide = 35,
|
||||
kIOAudioChannelLabel_RightWide = 36,
|
||||
kIOAudioChannelLabel_LFE2 = 37,
|
||||
kIOAudioChannelLabel_LeftTotal = 38, // matrix encoded 4 channels
|
||||
kIOAudioChannelLabel_RightTotal = 39, // matrix encoded 4 channels
|
||||
kIOAudioChannelLabel_HearingImpaired = 40,
|
||||
kIOAudioChannelLabel_Narration = 41,
|
||||
kIOAudioChannelLabel_Mono = 42,
|
||||
kIOAudioChannelLabel_DialogCentricMix = 43,
|
||||
|
||||
kIOAudioChannelLabel_CenterSurroundDirect = 44, // back center, non diffuse
|
||||
|
||||
kIOAudioChannelLabel_Haptic = 45,
|
||||
|
||||
kIOAudioChannelLabel_LeftTopFront = kIOAudioChannelLabel_VerticalHeightLeft,
|
||||
kIOAudioChannelLabel_CenterTopFront = kIOAudioChannelLabel_VerticalHeightCenter,
|
||||
kIOAudioChannelLabel_RightTopFront = kIOAudioChannelLabel_VerticalHeightRight,
|
||||
kIOAudioChannelLabel_LeftTopMiddle = 49,
|
||||
kIOAudioChannelLabel_CenterTopMiddle = kIOAudioChannelLabel_TopCenterSurround,
|
||||
kIOAudioChannelLabel_RightTopMiddle = 51,
|
||||
kIOAudioChannelLabel_LeftTopRear = 52,
|
||||
kIOAudioChannelLabel_CenterTopRear = 53,
|
||||
kIOAudioChannelLabel_RightTopRear = 54,
|
||||
|
||||
// first order ambisonic channels
|
||||
kIOAudioChannelLabel_Ambisonic_W = 200,
|
||||
kIOAudioChannelLabel_Ambisonic_X = 201,
|
||||
kIOAudioChannelLabel_Ambisonic_Y = 202,
|
||||
kIOAudioChannelLabel_Ambisonic_Z = 203,
|
||||
|
||||
// Mid/Side Recording
|
||||
kIOAudioChannelLabel_MS_Mid = 204,
|
||||
kIOAudioChannelLabel_MS_Side = 205,
|
||||
|
||||
// X-Y Recording
|
||||
kIOAudioChannelLabel_XY_X = 206,
|
||||
kIOAudioChannelLabel_XY_Y = 207,
|
||||
|
||||
// other
|
||||
kIOAudioChannelLabel_HeadphonesLeft = 301,
|
||||
kIOAudioChannelLabel_HeadphonesRight = 302,
|
||||
kIOAudioChannelLabel_ClickTrack = 304,
|
||||
kIOAudioChannelLabel_ForeignLanguage = 305,
|
||||
|
||||
// generic discrete channel
|
||||
kIOAudioChannelLabel_Discrete = 400,
|
||||
|
||||
// numbered discrete channel
|
||||
kIOAudioChannelLabel_Discrete_0 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 0,
|
||||
kIOAudioChannelLabel_Discrete_1 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 1,
|
||||
kIOAudioChannelLabel_Discrete_2 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 2,
|
||||
kIOAudioChannelLabel_Discrete_3 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 3,
|
||||
kIOAudioChannelLabel_Discrete_4 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 4,
|
||||
kIOAudioChannelLabel_Discrete_5 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 5,
|
||||
kIOAudioChannelLabel_Discrete_6 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 6,
|
||||
kIOAudioChannelLabel_Discrete_7 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 7,
|
||||
kIOAudioChannelLabel_Discrete_8 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 8,
|
||||
kIOAudioChannelLabel_Discrete_9 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 9,
|
||||
kIOAudioChannelLabel_Discrete_10 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 10,
|
||||
kIOAudioChannelLabel_Discrete_11 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 11,
|
||||
kIOAudioChannelLabel_Discrete_12 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 12,
|
||||
kIOAudioChannelLabel_Discrete_13 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 13,
|
||||
kIOAudioChannelLabel_Discrete_14 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 14,
|
||||
kIOAudioChannelLabel_Discrete_15 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 15,
|
||||
kIOAudioChannelLabel_Discrete_65535 = ( 1 << kIOAudioChannelLabel_Discrete_field_ba ) | 65535
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* _IOKIT_IOAUDIOTYPES_H */
|
||||
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2001 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@
|
||||
*/
|
||||
#ifndef _IOKIT_IOFIREWIREAVCCONSTS_H
|
||||
#define _IOKIT_IOFIREWIREAVCCONSTS_H
|
||||
|
||||
// Fields of AVC frame
|
||||
typedef enum {
|
||||
kAVCCommandResponse = 0,
|
||||
kAVCAddress = 1,
|
||||
kAVCOpcode = 2,
|
||||
kAVCOperand0 = 3,
|
||||
kAVCOperand1 = 4,
|
||||
kAVCOperand2 = 5,
|
||||
kAVCOperand3 = 6,
|
||||
kAVCOperand4 = 7,
|
||||
kAVCOperand5 = 8,
|
||||
kAVCOperand6 = 9,
|
||||
kAVCOperand7 = 10,
|
||||
kAVCOperand8 = 11
|
||||
} IOAVCFrameFields;
|
||||
|
||||
// Command/Response values
|
||||
typedef enum {
|
||||
kAVCControlCommand = 0x00,
|
||||
kAVCStatusInquiryCommand = 0x01,
|
||||
kAVCSpecificInquiryCommand = 0x02,
|
||||
kAVCNotifyCommand = 0x03,
|
||||
kAVCGeneralInquiryCommand = 0x04,
|
||||
kAVCNotImplementedStatus = 0x08,
|
||||
kAVCAcceptedStatus = 0x09,
|
||||
kAVCRejectedStatus = 0x0a,
|
||||
kAVCInTransitionStatus = 0x0b,
|
||||
kAVCImplementedStatus = 0x0c,
|
||||
kAVCChangedStatus = 0x0d,
|
||||
kAVCInterimStatus = 0x0f
|
||||
} IOAVCCommandResponse;
|
||||
|
||||
// Opcodes
|
||||
typedef enum {
|
||||
|
||||
// Unit commands
|
||||
kAVCPlugInfoOpcode = 0x02,
|
||||
kAVCOutputPlugSignalFormatOpcode = 0x18,
|
||||
kAVCInputPlugSignalFormatOpcode = 0x19,
|
||||
kAVCUnitInfoOpcode = 0x30,
|
||||
kAVCSubunitInfoOpcode = 0x31,
|
||||
kAVCConnectionsOpcode = 0x22,
|
||||
kAVCConnectOpcode = 0x24,
|
||||
kAVCDisconnectOpcode = 0x25,
|
||||
kAVCPowerOpcode = 0xB2,
|
||||
kAVCSignalSourceOpcode = 0x1A,
|
||||
|
||||
// Vendor dependent commands
|
||||
kAVCVendorDependentOpcode = 0x00,
|
||||
|
||||
// Subunit commands
|
||||
kAVCOutputSignalModeOpcode = 0x78,
|
||||
kAVCInputSignalModeOpcode = 0x79,
|
||||
kAVCSignalModeSD525_60 = 0x00,
|
||||
kAVCSignalModeSDL525_60 = 0x04,
|
||||
kAVCSignalModeHD1125_60 = 0x08,
|
||||
kAVCSignalModeSD625_50 = 0x80,
|
||||
kAVCSignalModeSDL625_50 = 0x84,
|
||||
kAVCSignalModeHD1250_50 = 0x88,
|
||||
kAVCSignalModeDVCPro525_60 = 0x78,
|
||||
kAVCSignalModeDVCPro625_50 = 0xf8,
|
||||
|
||||
kAVCSignalModeDummyOperand = 0xff,
|
||||
kAVCSignalModeMask_50 = 0x80,
|
||||
kAVCSignalModeMask_STYPE = 0x7c,
|
||||
kAVCSignalModeMask_SDL = 0x04,
|
||||
kAVCSignalModeMask_DVCPro25 = 0x78
|
||||
|
||||
} IOAVCOpcodes;
|
||||
|
||||
// Unit/Subunit types
|
||||
typedef enum {
|
||||
kAVCVideoMonitor = 0x00,
|
||||
kAVCAudio = 0x01,
|
||||
kAVCPrinter = 0x02,
|
||||
kAVCDiskRecorder = 0x03,
|
||||
kAVCTapeRecorder = 0x04,
|
||||
kAVCTuner = 0x05,
|
||||
kAVCVideoCamera = 0x07,
|
||||
kAVCCameraStorage = 0x0b,
|
||||
kAVCVendorUnique = 0x1c,
|
||||
kAVCNumSubUnitTypes = 0x20
|
||||
} IOAVCUnitTypes;
|
||||
|
||||
#define kAVCAllOpcodes 0xFF
|
||||
#define kAVCAllSubunitsAndUnit 0xEE
|
||||
#define kAVCMaxNumPlugs 31
|
||||
#define kAVCAnyAvailableIsochPlug 0x7F
|
||||
#define kAVCAnyAvailableExternalPlug 0xFF
|
||||
#define kAVCAnyAvailableSubunitPlug 0xFF
|
||||
#define kAVCMultiplePlugs 0xFD
|
||||
#define kAVCInvalidPlug 0xFE
|
||||
|
||||
|
||||
#define IOAVCAddress(type, id) (((type) << 3) | (id))
|
||||
#define kAVCUnitAddress 0xff
|
||||
#define IOAVCType(address) ((address) >> 3)
|
||||
#define IOAVCId(address) ((address) & 0x7)
|
||||
|
||||
// Macros for Plug Control Register field manipulation
|
||||
|
||||
// Master control registers
|
||||
#define kIOFWPCRDataRate FWBitRange(0,1)
|
||||
#define kIOFWPCRDataRatePhase FWBitRangePhase(0,1)
|
||||
#define kIOFWPCRExtension FWBitRange(8,15)
|
||||
#define kIOFWPCRExtensionPhase FWBitRangePhase(8,15)
|
||||
#define kIOFWPCRNumPlugs FWBitRange(27,31)
|
||||
#define kIOFWPCRNumPlugsPhase FWBitRangePhase(27,31)
|
||||
|
||||
// master output register
|
||||
#define kIOFWPCRBroadcastBase FWBitRange(2,7)
|
||||
#define kIOFWPCRBroadcastBasePhase FWBitRangePhase(2,7)
|
||||
|
||||
// plug registers
|
||||
#define kIOFWPCROnline FWBitRange(0,0)
|
||||
#define kIOFWPCROnlinePhase FWBitRangePhase(0,0)
|
||||
#define kIOFWPCRBroadcast FWBitRange(1,1)
|
||||
#define kIOFWPCRBroadcastPhase FWBitRangePhase(1,1)
|
||||
#define kIOFWPCRP2PCount FWBitRange(2,7)
|
||||
#define kIOFWPCRP2PCountPhase FWBitRangePhase(2,7)
|
||||
#define kIOFWPCRChannel FWBitRange(10,15)
|
||||
#define kIOFWPCRChannelPhase FWBitRangePhase(10,15)
|
||||
|
||||
// Extra fields for output plug registers
|
||||
#define kIOFWPCROutputDataRate FWBitRange(16,17)
|
||||
#define kIOFWPCROutputDataRatePhase FWBitRangePhase(16,17)
|
||||
#define kIOFWPCROutputOverhead FWBitRange(18,21)
|
||||
#define kIOFWPCROutputOverheadPhase FWBitRangePhase(18,21)
|
||||
#define kIOFWPCROutputPayload FWBitRange(22,31)
|
||||
#define kIOFWPCROutputPayloadPhase FWBitRangePhase(22,31)
|
||||
|
||||
// async plug numbers
|
||||
|
||||
enum
|
||||
{
|
||||
kFWAVCAsyncPlug0 = 0xa0,
|
||||
kFWAVCAsyncPlug1 = 0xa1,
|
||||
kFWAVCAsyncPlug2 = 0xa2,
|
||||
kFWAVCAsyncPlug3 = 0xa3,
|
||||
kFWAVCAsyncPlug4 = 0xa4,
|
||||
kFWAVCAsyncPlug5 = 0xa5,
|
||||
kFWAVCAsyncPlug6 = 0xa6,
|
||||
kFWAVCAsyncPlug7 = 0xa7,
|
||||
kFWAVCAsyncPlug8 = 0xa8,
|
||||
kFWAVCAsyncPlug9 = 0xa9,
|
||||
kFWAVCAsyncPlug10 = 0xa1,
|
||||
kFWAVCAsyncPlug11 = 0xab,
|
||||
kFWAVCAsyncPlug12 = 0xac,
|
||||
kFWAVCAsyncPlug13 = 0xad,
|
||||
kFWAVCAsyncPlug14 = 0xae,
|
||||
kFWAVCAsyncPlug15 = 0xaf,
|
||||
kFWAVCAsyncPlug16 = 0xb0,
|
||||
kFWAVCAsyncPlug17 = 0xb1,
|
||||
kFWAVCAsyncPlug18 = 0xb2,
|
||||
kFWAVCAsyncPlug19 = 0xb3,
|
||||
kFWAVCAsyncPlug20 = 0xb4,
|
||||
kFWAVCAsyncPlug21 = 0xb5,
|
||||
kFWAVCAsyncPlug22 = 0xb6,
|
||||
kFWAVCAsyncPlug23 = 0xb7,
|
||||
kFWAVCAsyncPlug24 = 0xb8,
|
||||
kFWAVCAsyncPlug25 = 0xb9,
|
||||
kFWAVCAsyncPlug26 = 0xba,
|
||||
kFWAVCAsyncPlug27 = 0xbb,
|
||||
kFWAVCAsyncPlug28 = 0xbc,
|
||||
kFWAVCAsyncPlug29 = 0xbd,
|
||||
kFWAVCAsyncPlug30 = 0xbe,
|
||||
kFWAVCAsyncPlugAny = 0xbf
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kFWAVCStateBusSuspended = 0,
|
||||
kFWAVCStateBusResumed = 1,
|
||||
kFWAVCStatePlugReconnected = 2,
|
||||
kFWAVCStatePlugDisconnected = 3,
|
||||
kFWAVCStateDeviceRemoved = 4
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kFWAVCConsumerMode_MORE = 1,
|
||||
kFWAVCConsumerMode_LAST = 4,
|
||||
kFWAVCConsumerMode_LESS = 5,
|
||||
kFWAVCConsumerMode_JUNK = 6,
|
||||
kFWAVCConsumerMode_LOST = 7
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kFWAVCProducerMode_SEND = 5,
|
||||
kFWAVCProducerMode_TOSS = 7
|
||||
};
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
IOFWAVCPlugSubunitSourceType,
|
||||
IOFWAVCPlugSubunitDestType,
|
||||
IOFWAVCPlugIsochInputType,
|
||||
IOFWAVCPlugIsochOutputType,
|
||||
IOFWAVCPlugAsynchInputType,
|
||||
IOFWAVCPlugAsynchOutputType,
|
||||
IOFWAVCPlugExternalInputType,
|
||||
IOFWAVCPlugExternalOutputType
|
||||
} IOFWAVCPlugTypes;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kIOFWAVCSubunitPlugMsgConnected,
|
||||
kIOFWAVCSubunitPlugMsgDisconnected,
|
||||
kIOFWAVCSubunitPlugMsgConnectedPlugModified,
|
||||
kIOFWAVCSubunitPlugMsgSignalFormatModified
|
||||
} IOFWAVCSubunitPlugMessages;
|
||||
|
||||
// Some plug signal formats
|
||||
#define kAVCPlugSignalFormatNTSCDV 0x80000000
|
||||
#define kAVCPlugSignalFormatPalDV 0x80800000
|
||||
#define kAVCPlugSignalFormatMPEGTS 0xA0000000
|
||||
|
||||
// Possible states of an AVCAsynchronousCommand
|
||||
typedef enum
|
||||
{
|
||||
kAVCAsyncCommandStatePendingRequest,
|
||||
kAVCAsyncCommandStateRequestSent,
|
||||
kAVCAsyncCommandStateRequestFailed,
|
||||
kAVCAsyncCommandStateWaitingForResponse,
|
||||
kAVCAsyncCommandStateReceivedInterimResponse,
|
||||
kAVCAsyncCommandStateReceivedFinalResponse,
|
||||
kAVCAsyncCommandStateTimeOutBeforeResponse,
|
||||
kAVCAsyncCommandStateBusReset,
|
||||
kAVCAsyncCommandStateOutOfMemory,
|
||||
kAVCAsyncCommandStateCanceled
|
||||
} IOFWAVCAsyncCommandState;
|
||||
|
||||
#endif // _IOKIT_IOFIREWIREAVCCONSTS_H
|
||||
@@ -0,0 +1,734 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2001 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOFIREWIREAVCLIB_H_
|
||||
#define _IOKIT_IOFIREWIREAVCLIB_H_
|
||||
|
||||
#include <IOKit/IOCFPlugIn.h>
|
||||
#include <IOKit/firewire/IOFireWireFamilyCommon.h>
|
||||
#include <IOKit/avc/IOFireWireAVCConsts.h>
|
||||
|
||||
// Unit type UUID
|
||||
/* 6AAF2EF7-D476-11D5-B57C-0003934B81A0 */
|
||||
#define kIOFireWireAVCLibUnitTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x6A, 0xAF, 0x2E, 0xF7, 0xD4, 0x76, 0x11, 0xD5, 0xB5, 0x7C, 0x00, 0x03, 0x93, 0x4B, 0x81, 0xA0)
|
||||
|
||||
// Unit Factory UUID
|
||||
/* 3F4057BC-D479-11D5-9F05-0003934B81A0 */
|
||||
#define kIOFireWireAVCLibUnitFactoryID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x3F, 0x40, 0x57, 0xBC, 0xD4, 0x79, 0x11, 0xD5, 0x9F, 0x05, 0x00, 0x03, 0x93, 0x4B, 0x81, 0xA0)
|
||||
|
||||
// IOFireWireAVCUnitInterface UUID
|
||||
/* FC65C030-D498-11D5-878D-0003934B81A0 */
|
||||
#define kIOFireWireAVCLibUnitInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xFC, 0x65, 0xC0, 0x30, 0xD4, 0x98, 0x11, 0xD5, 0x87, 0x8D, 0x00, 0x03, 0x93, 0x4B, 0x81, 0xA0)
|
||||
|
||||
// kIOFireWireAVCLibUnitInterfaceID_v2 UUID - No Throttling of AVC Commands
|
||||
/* 85B5E954-0AEF-11D8-8D19-000393914ABA */
|
||||
#define kIOFireWireAVCLibUnitInterfaceID_v2 CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x85, 0xB5, 0xE9, 0x54, 0x0A, 0xEF, 0x11, 0xD8, 0x8D, 0x19, 0x00, 0x03, 0x93, 0x91, 0x4A, 0xBA)
|
||||
|
||||
// Protocol type UUID
|
||||
/* B54BC8F8-D53B-11D5-A1A1-0003934B81A0 */
|
||||
#define kIOFireWireAVCLibProtocolTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xB5, 0x4B, 0xC8, 0xF8, 0xD5, 0x3B, 0x11, 0xD5, 0xA1, 0xA1, 0x00, 0x03, 0x93, 0x4B, 0x81, 0xA0)
|
||||
|
||||
// Protocol Factory UUID
|
||||
/* 8E9AD5AC-D55E-11D5-B7D2-0003934B81A0 */
|
||||
#define kIOFireWireAVCLibProtocolFactoryID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x8E, 0x9A, 0xD5, 0xAC, 0xD5, 0x5E, 0x11, 0xD5, 0xB7, 0xD2, 0x00, 0x03, 0x93, 0x4B, 0x81, 0xA0)
|
||||
|
||||
// IOFireWireAVCProtocolInterface UUID
|
||||
/* CC85D421-D55E-11D5-8A10-0003934B81A0 */
|
||||
#define kIOFireWireAVCLibProtocolInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xCC, 0x85, 0xD4, 0x21, 0xD5, 0x5E, 0x11, 0xD5, 0x8A, 0x10, 0x00, 0x03, 0x93, 0x4B, 0x81, 0xA0)
|
||||
|
||||
// IOFireWireAVCLibConsumerInterfaceID
|
||||
/* 7FB7A454-226F-11D6-B889-000A277E7234 */
|
||||
#define kIOFireWireAVCLibConsumerInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x7F, 0xB7, 0xA4, 0x54, 0x22, 0x6F, 0x11, 0xD6, 0xB8, 0x89, 0x00, 0x0A, 0x27, 0x7E, 0x72, 0x34)
|
||||
|
||||
typedef void (*IOFWAVCMessageCallback)( void * refCon, UInt32 type, void * arg );
|
||||
|
||||
/*! @typedef IOFWAVCRequestCallback
|
||||
@abstract This Callback has been deprecated. Use installAVCCommandHandler instead.
|
||||
*/
|
||||
typedef IOReturn (*IOFWAVCRequestCallback)( void *refCon, UInt32 generation, UInt16 srcNodeID,
|
||||
const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen);
|
||||
|
||||
/*!
|
||||
@typedef IOFWAVCPCRCallback
|
||||
@abstract Callback called after a successful lock transaction to a CMP plug.
|
||||
@param refcon refcon supplied when a client is registered
|
||||
@param generation Bus generation command was received in
|
||||
@param nodeID is the node originating the request
|
||||
@param plug is the plug number
|
||||
@param oldVal is the value the plug used to contain
|
||||
@param newVal is the quad written into the plug
|
||||
*/
|
||||
typedef void (*IOFWAVCPCRCallback)(void *refcon, UInt32 generation, UInt16 nodeID, UInt32 plug,
|
||||
UInt32 oldVal, UInt32 newVal);
|
||||
|
||||
/*!
|
||||
@typedef IOFWAVCCommandHandlerCallback
|
||||
@abstract Callback called when a incoming AVC command matching a registered command handler is received.
|
||||
@param refCon The refcon supplied when a client is registered
|
||||
@param generation The FireWire bus generation value at the time the command was received
|
||||
@param srcNodeID The node ID of the device who sent us this command
|
||||
@param speed The speed the AVC command packet
|
||||
@param command A pointer to the command bytes
|
||||
@param cmdLen The length of the AVC command bytes buffer in bytes
|
||||
@result The callback handler should return success if it will send the AVC response, or an error if it doesn't want to handle the command
|
||||
*/
|
||||
typedef IOReturn (*IOFWAVCCommandHandlerCallback)( void *refCon, UInt32 generation, UInt16 srcNodeID, IOFWSpeed speed, const UInt8 * command, UInt32 cmdLen);
|
||||
|
||||
/*!
|
||||
@typedef IOFWAVCSubunitPlugHandlerCallback
|
||||
@abstract Callback called when a incoming AVC command matching a registered command handler is received.
|
||||
@param refCon The refcon supplied when a client is registered
|
||||
@param subunitTypeAndID The subunit type and id of this plug
|
||||
@param plugType The type of plug receiving the message
|
||||
@param plugNum The number of the plug receiving the message
|
||||
@param plugMessage The plug message
|
||||
@param messageParams The parameters associated with the plug message
|
||||
@result The return value is only pertinent for the kIOFWAVCSubunitPlugMsgSignalFormatModified message. Return an error if not accepting the sig format change.
|
||||
*/
|
||||
typedef IOReturn (*IOFWAVCSubunitPlugHandlerCallback)(void *refCon,
|
||||
UInt32 subunitTypeAndID,
|
||||
IOFWAVCPlugTypes plugType,
|
||||
UInt32 plugNum,
|
||||
IOFWAVCSubunitPlugMessages plugMessage,
|
||||
UInt32 messageParams);
|
||||
|
||||
typedef struct _IOFireWireAVCLibProtocolInterface IOFireWireAVCLibProtocolInterface;
|
||||
|
||||
typedef struct _IOFireWireAVCLibAsynchronousCommand
|
||||
{
|
||||
IOFWAVCAsyncCommandState cmdState;
|
||||
void *pRefCon;
|
||||
UInt8 *pCommandBuf;
|
||||
UInt32 cmdLen;
|
||||
UInt8 *pInterimResponseBuf;
|
||||
UInt32 interimResponseLen;
|
||||
UInt8 *pFinalResponseBuf;
|
||||
UInt32 finalResponseLen;
|
||||
}IOFireWireAVCLibAsynchronousCommand;
|
||||
|
||||
typedef void (*IOFireWireAVCLibAsynchronousCommandCallback)(void *pRefCon, IOFireWireAVCLibAsynchronousCommand *pCommandObject);
|
||||
|
||||
/*!
|
||||
@class IOFireWireAVCLibUnitInterface
|
||||
@abstract Initial interface discovered for all AVC Unit drivers.
|
||||
@discussion The IOFireWireAVCLibUnitInterface is the initial interface discovered by most drivers. It supplies the methods that control the operation of the AVC unit as a whole.
|
||||
Finally, the Unit can supply a reference to the IOFireWireUnit. This can be useful if a driver wishes to access the standard FireWire APIs.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
UInt16 version;
|
||||
UInt16 revision;
|
||||
|
||||
/*!
|
||||
@function open
|
||||
@abstract Exclusively opens a connection to the in-kernel device.
|
||||
@discussion Exclusively opens a connection to the in-kernel device. As long as the in-kernel
|
||||
device object is open, no other drivers will be able to open a connection to the device. When
|
||||
open, the device on the bus may disappear, but the in-kernel object representing it will stay
|
||||
instantiated and can begin communicating with the device again if it ever reappears.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@result Returns kIOReturnSuccess on success.
|
||||
*/
|
||||
|
||||
IOReturn (*open)( void * self );
|
||||
|
||||
/*!
|
||||
@function openWithSessionRef
|
||||
@abstract Opens a connection to a device that is not already open.
|
||||
@discussion Sometimes it is desirable to open multiple user clients on a device. In the case
|
||||
of FireWire sometimes we wish to have both the FireWire User Client and the AVC User Client
|
||||
open at the same time. The technique to arbitrate this is as follows:<br>First open normally
|
||||
the device furthest from the root in the I/O Registry.<br>Second, get its sessionRef with the
|
||||
getSessionRef call.<br>Third, open the device further up the chain by calling this method and
|
||||
passing the sessionRef returned from the call in step 2.
|
||||
@param sessionRef SessionRef returned from getSessionRef call.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@result Returns kIOReturnSuccess on success.
|
||||
*/
|
||||
|
||||
IOReturn (*openWithSessionRef)( void * self, IOFireWireSessionRef sessionRef );
|
||||
|
||||
/*!
|
||||
@function getSessionRef
|
||||
@abstract Get the session reference.
|
||||
@discussion Gets the sessionRef to be used with openWithSessionRef.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@result Returns a sessionRef on success.
|
||||
*/
|
||||
|
||||
IOFireWireSessionRef (*getSessionRef)(void * self);
|
||||
|
||||
/*!
|
||||
@function close
|
||||
@abstract Closes an exclusive access to the device.
|
||||
@discussion Closes an exclusive access to the device. When a device is closed it may be
|
||||
unloaded by the kernel. If it is unloaded and then later reappears it will be represented
|
||||
by a different object. You won't be able to use this user client on the new object. The
|
||||
new object will have to be looked up in the I/O Registry and a new user client will have to
|
||||
be opened on it.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
*/
|
||||
|
||||
void (*close)( void * self );
|
||||
|
||||
/*!
|
||||
@function addCallbackDispatcherToRunLoop
|
||||
@abstract Adds a dispatcher for kernel callbacks to the specified runloop.
|
||||
@discussion The user space portions of the AVC API communicate with the in-kernel services by
|
||||
messaging the kernel. Similarly, the kernel messages the user space services in response.
|
||||
These responses need to be picked up by a piece of code. This call adds that code to the specified
|
||||
run loop. Most drivers will call this method on the run loop that was created when your task was
|
||||
created. To avoid deadlock you must avoid sleeping (or spin waiting) the run loop to wait for
|
||||
AVC response. If you do this the dispatcher will never get to run and you will wait forever.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@param cfRunLoopRef Reference to a run loop.
|
||||
@result Returns kIOReturnSuccess on success.
|
||||
*/
|
||||
|
||||
IOReturn (*addCallbackDispatcherToRunLoop)( void *self, CFRunLoopRef cfRunLoopRef );
|
||||
|
||||
/*!
|
||||
@function removeCallbackDispatcherFromRunLoop
|
||||
@abstract Removes a dispatcher for kernel callbacks to the specified run loop.
|
||||
@discussion Undoes the work of addCallbackDispatcherToRunLoop.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
*/
|
||||
|
||||
void (*removeCallbackDispatcherFromRunLoop)( void * self );
|
||||
|
||||
/*!
|
||||
@function setMessageCallback
|
||||
@abstract Sets callback for user space message routine.
|
||||
@discussion In FireWire and AVC, bus status messages are delivered via IOKit's message routine.
|
||||
This routine is emulated in user space for AVC and FireWire messages via this callback. You should
|
||||
register here for bus reset and reconnect messages.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@param refCon RefCon to be returned as first argument of completion routine.
|
||||
@param callback Address of completion routine.
|
||||
*/
|
||||
|
||||
void (*setMessageCallback)( void *self, void * refCon, IOFWAVCMessageCallback callback);
|
||||
|
||||
/*!
|
||||
@function AVCCommand
|
||||
@abstract Sends an AVC command to the device and returns the response.
|
||||
@discussion This function will block until the device returns a response or the kernel driver times out.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@param command Pointer to command to send.
|
||||
@param cmdLen Length (in bytes) of command.
|
||||
@param response Pointer to place to store the response sent by the device.
|
||||
@param responseLen Pointer to place to store the length of the response.
|
||||
*/
|
||||
|
||||
IOReturn (*AVCCommand)( void * self,
|
||||
const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen);
|
||||
|
||||
/*!
|
||||
@function AVCCommandInGeneration
|
||||
@abstract Sends an AVC command to the device and returns the response.
|
||||
@discussion Sends an AVC command to the device and returns the response. The command must complete in the specified bus generation. This function is only available if the interface version is > 1 (MacOSX 10.2.0 or later?). This function will block until the device returns a response or the kernel driver times out.
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@param busGeneration FireWire bus generation that the command is valid in.
|
||||
@param command Pointer to command to send.
|
||||
@param cmdLen Length (in bytes) of command.
|
||||
@param response Pointer to place to store the response sent by the device.
|
||||
@param responseLen Pointer to place to store the length of the response.
|
||||
*/
|
||||
|
||||
IOReturn (*AVCCommandInGeneration)( void * self, UInt32 busGeneration,
|
||||
const UInt8 * command, UInt32 cmdLen, UInt8 * response, UInt32 *responseLen);
|
||||
|
||||
/*!
|
||||
@function getAncestorInterface
|
||||
@abstract Creates a plug-in object for an ancestor (in the I/O Registry) of the AVC unit and returns an interface to it.
|
||||
@discussion This function is only available if the interface version is > 1 (MacOSX 10.2.0 or later?).
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@param object_class Class name of ancestor of the device to get an interface for.
|
||||
@param pluginType An ID number, of type CFUUIDBytes (see CFUUID.h), identifying the type of plug-in service to be returned for the ancestor.
|
||||
@param iid An ID number, of type CFUUIDBytes (see CFUUID.h), identifying the type of interface to be returned for the created plug-in object.
|
||||
@result Returns a COM-style interface pointer. Returns 0 upon failure.
|
||||
*/
|
||||
void * (*getAncestorInterface)( void * self, char * object_class, REFIID pluginType, REFIID iid) ;
|
||||
|
||||
/*!
|
||||
@function getProtocolInterface
|
||||
@abstract Creates a plug-in object for a protocol driver for the FireWire bus the AVC unit
|
||||
is connected to and returns an interface to it.
|
||||
@discussion This function is only available if the interface version is > 1 (MacOSX 10.2.0 or later?).
|
||||
@param self Pointer to IOFireWireAVCLibUnitInterface.
|
||||
@param pluginType An ID number, of type CFUUIDBytes (see CFUUID.h), identifying the type of plug-in service to be returned for the created protocol object.
|
||||
@param iid An ID number, of type CFUUIDBytes (see CFUUID.h), identifying the type of interface to be returned for the created protocol device object.
|
||||
@result Returns a COM-style interface pointer. Returns 0 upon failure.
|
||||
*/
|
||||
void * (*getProtocolInterface)( void * self, REFIID pluginType, REFIID iid) ;
|
||||
|
||||
/*
|
||||
*/
|
||||
IOReturn (*getAsyncConnectionPlugCounts)
|
||||
( void *self, UInt8 * inputPlugCount, UInt8 * outputPlugCount );
|
||||
|
||||
/*
|
||||
*/
|
||||
IUnknownVTbl ** (*createConsumerPlug)( void *self, UInt8 plugNumber, REFIID iid );
|
||||
|
||||
/*!
|
||||
@function updateAVCCommandTimeout
|
||||
@abstract Updates an AVCCommand's timeout back to 10 seconds.
|
||||
@discussion AVCCommands will time out after 10 seconds unless this function is called (from another thread) to update the command's timeout back to 10 seconds.
|
||||
This function is only available if the interface version is > 2.
|
||||
*/
|
||||
IOReturn (*updateAVCCommandTimeout)(void * self);
|
||||
|
||||
/*!
|
||||
@function makeP2PInputConnection
|
||||
@abstract Increments the point-to-point connection count of a unit input plug.
|
||||
@discussion This function is only available if the interface version is > 3.
|
||||
*/
|
||||
IOReturn (*makeP2PInputConnection)(void * self, UInt32 inputPlug, UInt32 chan);
|
||||
|
||||
/*!
|
||||
@function breakP2PInputConnection
|
||||
@abstract Decrements the point-to-point connection count of a unit input plug.
|
||||
@discussion This function is only available if the interface version is > 3.
|
||||
*/
|
||||
IOReturn (*breakP2PInputConnection)(void * self, UInt32 inputPlug);
|
||||
|
||||
/*!
|
||||
@function makeP2POutputConnection
|
||||
@abstract Increments the point-to-point connection count of a unit output plug.
|
||||
@discussion This function is only available if the interface version is > 3.
|
||||
*/
|
||||
IOReturn (*makeP2POutputConnection)(void * self, UInt32 outputPlug, UInt32 chan, IOFWSpeed speed);
|
||||
|
||||
/*!
|
||||
@function breakP2POutputConnection
|
||||
@abstract Decrements the point-to-point connection count of a unit output plug.
|
||||
@discussion This function is only available if the interface version is > 3.
|
||||
*/
|
||||
IOReturn (*breakP2POutputConnection)(void * self, UInt32 outputPlug);
|
||||
|
||||
/*!
|
||||
@function createAVCAsynchronousCommand
|
||||
*/
|
||||
|
||||
IOReturn (*createAVCAsynchronousCommand)(void * self,
|
||||
const UInt8 * command,
|
||||
UInt32 cmdLen,
|
||||
IOFireWireAVCLibAsynchronousCommandCallback completionCallback,
|
||||
void *pRefCon,
|
||||
IOFireWireAVCLibAsynchronousCommand **ppCommandObject);
|
||||
|
||||
/*!
|
||||
@function AVCAsynchronousCommandSubmit
|
||||
*/
|
||||
|
||||
IOReturn (*AVCAsynchronousCommandSubmit)(void * self, IOFireWireAVCLibAsynchronousCommand *pCommandObject);
|
||||
|
||||
/*!
|
||||
@function AVCAsynchronousCommandReinit
|
||||
*/
|
||||
|
||||
IOReturn (*AVCAsynchronousCommandReinit)(void * self, IOFireWireAVCLibAsynchronousCommand *pCommandObject);
|
||||
|
||||
/*!
|
||||
@function AVCAsynchronousCommandCancel
|
||||
*/
|
||||
|
||||
IOReturn (*AVCAsynchronousCommandCancel)(void * self, IOFireWireAVCLibAsynchronousCommand *pCommandObject);
|
||||
|
||||
/*!
|
||||
@function AVCAsynchronousCommandRelease
|
||||
*/
|
||||
|
||||
IOReturn (*AVCAsynchronousCommandRelease)(void * self, IOFireWireAVCLibAsynchronousCommand *pCommandObject);
|
||||
|
||||
/*!
|
||||
@function AVCAsynchronousCommandReinitWithCommandBytes
|
||||
*/
|
||||
|
||||
IOReturn (*AVCAsynchronousCommandReinitWithCommandBytes)(void * self,
|
||||
IOFireWireAVCLibAsynchronousCommand *pCommandObject,
|
||||
const UInt8 * command,
|
||||
UInt32 cmdLen);
|
||||
} IOFireWireAVCLibUnitInterface;
|
||||
|
||||
/*!
|
||||
@class IOFireWireAVCLibProtocolInterface
|
||||
@abstract Initial interface discovered for all AVC protocol drivers.
|
||||
@discussion The IOFireWireAVCLibProtocolInterface is used to set up local plug control registers and to receive AVC requests.
|
||||
*/
|
||||
|
||||
typedef struct _IOFireWireAVCLibProtocolInterface
|
||||
{
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
UInt16 version;
|
||||
UInt16 revision;
|
||||
/*!
|
||||
@function addCallbackDispatcherToRunLoop
|
||||
@abstract Adds a dispatcher for kernel callbacks to the specified run loop.
|
||||
@discussion The user space portions of the AVC API communicate with the in-kernel services by
|
||||
messaging the kernel. Similarly, the kernel messages the user space services in response.
|
||||
These responses need to be picked up by a piece of code. This call adds that code to the specified
|
||||
run loop. Most drivers will call this method on the run loop that was created when your task was
|
||||
created. To avoid deadlock you must avoid sleeping (or spin waiting) the run loop to wait for
|
||||
AVC response. If you do this the dispatcher will never get to run and you will wait forever.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param cfRunLoopRef Reference to a run loop.
|
||||
@result Returns kIOReturnSuccess on success.
|
||||
*/
|
||||
|
||||
IOReturn (*addCallbackDispatcherToRunLoop)( void *self, CFRunLoopRef cfRunLoopRef );
|
||||
|
||||
/*!
|
||||
@function removeCallbackDispatcherFromRunLoop
|
||||
@abstract Removes a dispatcher for kernel callbacks to the specified run loop.
|
||||
@discussion Undoes the work of addCallbackDispatcherToRunLoop.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
*/
|
||||
|
||||
void (*removeCallbackDispatcherFromRunLoop)( void * self );
|
||||
|
||||
/*!
|
||||
@function setMessageCallback
|
||||
@abstract Sets callback for user space message routine.
|
||||
@discussion In FireWire and AVC, bus status messages are delivered via IOKit's message routine.
|
||||
This routine is emulated in user space for AVC and FireWire messages via this callback. You should
|
||||
register here for bus reset and reconnect messages.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param refCon RefCon to be returned as first argument of completion routine.
|
||||
@param callback Address of completion routine.
|
||||
*/
|
||||
|
||||
void (*setMessageCallback)( void *self, void * refCon, IOFWAVCMessageCallback callback);
|
||||
|
||||
/*!
|
||||
@function setAVCRequestCallback
|
||||
@abstract This function has been deprecated. Use installAVCCommandHandler instead.
|
||||
*/
|
||||
|
||||
IOReturn (*setAVCRequestCallback)( void *self, UInt32 subUnitType, UInt32 subUnitID,
|
||||
void *refCon, IOFWAVCRequestCallback callback);
|
||||
|
||||
/*!
|
||||
@function allocateInputPlug
|
||||
@abstract Allocates an input plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param refcon Arbitrary value passed back as first argument of callback.
|
||||
@param func Callback function when a successful lock transaction to the plug has been performed.
|
||||
@param plug Set to the plug number if a plug is successfully allocated.
|
||||
*/
|
||||
IOReturn (*allocateInputPlug)( void *self, void *refcon, IOFWAVCPCRCallback func, UInt32 *plug);
|
||||
/*!
|
||||
@function freeInputPlug
|
||||
@abstract Deallocates an input plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param plug Value returned by allocateInputPlug.
|
||||
*/
|
||||
void (*freeInputPlug)( void *self, UInt32 plug);
|
||||
/*!
|
||||
@function readInputPlug
|
||||
@abstract Returns the current value of an input plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param plug Value returned by allocateInputPlug.
|
||||
*/
|
||||
UInt32 (*readInputPlug)( void *self, UInt32 plug);
|
||||
/*!
|
||||
@function updateInputPlug
|
||||
@abstract Updates the value of an input plug (simulating a lock transaction).
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param plug Value returned by allocateInputPlug.
|
||||
@param oldVal Value returned by readInputPlug.
|
||||
@param newVal New value to store in plug if its current value is oldVal.
|
||||
*/
|
||||
IOReturn (*updateInputPlug)( void *self, UInt32 plug, UInt32 oldVal, UInt32 newVal);
|
||||
/*!
|
||||
@function allocateOutputPlug
|
||||
@abstract Allocates an output plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param refcon Arbitrary value passed back as first argument of callback.
|
||||
@param func Callback function when a successful lock transaction to the plug has been performed.
|
||||
@param plug Set to the plug number if a plug is successfully allocated.
|
||||
*/
|
||||
IOReturn (*allocateOutputPlug)( void *self, void *refcon, IOFWAVCPCRCallback func, UInt32 *plug);
|
||||
/*!
|
||||
@function freeOutputPlug
|
||||
@abstract Deallocates an output plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param plug Value returned by allocateOutputPlug.
|
||||
*/
|
||||
void (*freeOutputPlug)( void *self, UInt32 plug);
|
||||
/*!
|
||||
@function readOutputPlug
|
||||
@abstract Returns the current value of an output plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param plug Value returned by allocateOutputPlug.
|
||||
*/
|
||||
UInt32 (*readOutputPlug)( void *self, UInt32 plug);
|
||||
/*!
|
||||
@function updateOutputPlug
|
||||
@abstract Updates the value of an output plug (simulating a lock transaction).
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param plug Value returned by allocateOutputPlug.
|
||||
@param oldVal Value returned by readOutputPlug.
|
||||
@param newVal New value to store in plug if its current value is oldVal.
|
||||
*/
|
||||
IOReturn (*updateOutputPlug)( void *self, UInt32 plug, UInt32 oldVal, UInt32 newVal);
|
||||
/*!
|
||||
@function readOutputMasterPlug
|
||||
@abstract Returns the current value of the output master plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
*/
|
||||
UInt32 (*readOutputMasterPlug)( void *self);
|
||||
/*!
|
||||
@function updateOutputMasterPlug
|
||||
@abstract Updates the value of the master output plug (simulating a lock transaction).
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param oldVal Value returned by readOutputMasterPlug.
|
||||
@param newVal New value to store in plug if its current value is oldVal.
|
||||
*/
|
||||
IOReturn (*updateOutputMasterPlug)( void *self, UInt32 oldVal, UInt32 newVal);
|
||||
/*!
|
||||
@function readInputMasterPlug
|
||||
@abstract Returns the current value of the input master plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
|
||||
*/
|
||||
UInt32 (*readInputMasterPlug)( void *self);
|
||||
/*!
|
||||
@function updateInputMasterPlug
|
||||
@abstract Updates the value of the master input plug (simulating a lock transaction).
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param oldVal Value returned by readInputMasterPlug.
|
||||
@param newVal New value to store in plug if its current value is oldVal.
|
||||
*/
|
||||
IOReturn (*updateInputMasterPlug)( void *self, UInt32 oldVal, UInt32 newVal);
|
||||
|
||||
/*!
|
||||
@function publishAVCUnitDirectory
|
||||
@abstract Publishes an AVC unit directory in the config ROM.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
*/
|
||||
IOReturn (*publishAVCUnitDirectory)(void *self);
|
||||
|
||||
/*!
|
||||
@function installAVCCommandHandler
|
||||
@abstract Installs a command handler for handling specific incoming AVC commands.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param subUnitTypeAndID The subunit type and ID for this command handler.
|
||||
@param opCode The opcode for this command handler.
|
||||
@param refCon Arbitrary value passed back as first argument of callback.
|
||||
@param callback A pointer to the callback function
|
||||
*/
|
||||
IOReturn (*installAVCCommandHandler)(void *self,
|
||||
UInt32 subUnitTypeAndID,
|
||||
UInt32 opCode,
|
||||
void *refCon,
|
||||
IOFWAVCCommandHandlerCallback callback);
|
||||
|
||||
/*!
|
||||
@function sendAVCResponse
|
||||
@abstract Sends an AVC response packet.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param generation The Firewire bus generation that this response should be sent in.
|
||||
@param nodeID The node ID of the device we are sending this response to.
|
||||
@param response A pointer to the response bytes.
|
||||
@param responseLen The number of response bytes.
|
||||
*/
|
||||
IOReturn (*sendAVCResponse)(void *self,
|
||||
UInt32 generation,
|
||||
UInt16 nodeID,
|
||||
const char *response,
|
||||
UInt32 responseLen);
|
||||
|
||||
/*!
|
||||
@function addSubunit
|
||||
@abstract Installs a virtual AVC subunit.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param subunitType The type of subunit to create.
|
||||
@param numSourcePlugs The number of source plugs for this subunit.
|
||||
@param numDestPlugs The number of destination plugs for this subunit.
|
||||
@param refCon Arbitrary value passed back as first argument of callback.
|
||||
@param callback A pointer to the callback to receive plug management messages.
|
||||
@param pSubunitTypeAndID A pointer to a byte to hold the returned subunit address for the new subunit.
|
||||
*/
|
||||
IOReturn (*addSubunit)(void *self,
|
||||
UInt32 subunitType,
|
||||
UInt32 numSourcePlugs,
|
||||
UInt32 numDestPlugs,
|
||||
void *refCon,
|
||||
IOFWAVCSubunitPlugHandlerCallback callback,
|
||||
UInt32 *pSubunitTypeAndID);
|
||||
|
||||
/*!
|
||||
@function setSubunitPlugSignalFormat
|
||||
@abstract Sets the signal format of the specifed plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param subunitTypeAndID The subunit type and ID of the plug.
|
||||
@param plugType The plug type.
|
||||
@param plugNum The plug number.
|
||||
@param signalFormat The 32-bit signal format value.
|
||||
*/
|
||||
IOReturn (*setSubunitPlugSignalFormat)(void *self,
|
||||
UInt32 subunitTypeAndID,
|
||||
IOFWAVCPlugTypes plugType,
|
||||
UInt32 plugNum,
|
||||
UInt32 signalFormat);
|
||||
|
||||
/*!
|
||||
@function getSubunitPlugSignalFormat
|
||||
@abstract Gets the signal format of the specifed plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param subunitTypeAndID The subunit type and ID of the plug.
|
||||
@param plugType The plug type.
|
||||
@param plugNum The plug number.
|
||||
@param pSignalFormat A pointer to the location to return the signal format value.
|
||||
*/
|
||||
IOReturn (*getSubunitPlugSignalFormat)(void *self,
|
||||
UInt32 subunitTypeAndID,
|
||||
IOFWAVCPlugTypes plugType,
|
||||
UInt32 plugNum,
|
||||
UInt32 *pSignalFormat);
|
||||
|
||||
/*!
|
||||
@function connectTargetPlugs
|
||||
@abstract Establishes an internal AVC plug connection between subunit/unit plugs.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param sourceSubunitTypeAndID The subunit type and ID for the source plug
|
||||
@param sourcePlugType The source plug type.
|
||||
@param pSourcePlugNum A pointer to the source plug num. Will return the actual source plug num here.
|
||||
@param destSubunitTypeAndID The subunit type and ID for the destination plug.
|
||||
@param destPlugType The dest plug type.
|
||||
@param pDestPlugNum A pointer to the dest plug num. Will return the actual dest plug num here.
|
||||
@param lockConnection A flag to specify if this connection should be locked.
|
||||
@param permConnection A flag to specify if this connection is permanent.
|
||||
*/
|
||||
IOReturn (*connectTargetPlugs)(void *self,
|
||||
UInt32 sourceSubunitTypeAndID,
|
||||
IOFWAVCPlugTypes sourcePlugType,
|
||||
UInt32 *pSourcePlugNum,
|
||||
UInt32 destSubunitTypeAndID,
|
||||
IOFWAVCPlugTypes destPlugType,
|
||||
UInt32 *pDestPlugNum,
|
||||
bool lockConnection,
|
||||
bool permConnection);
|
||||
|
||||
/*!
|
||||
@function disconnectTargetPlugs
|
||||
@abstract Breaks an internal AVC plug connection between subunit/unit plugs.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param sourceSubunitTypeAndID The subunit type and ID for the source plug.
|
||||
@param sourcePlugType The source plug type.
|
||||
@param sourcePlugNum The source plug num.
|
||||
@param destSubunitTypeAndID The subunit type and ID for the destination plug.
|
||||
@param destPlugType The dest plug type.
|
||||
@param destPlugNum The dest plug num.
|
||||
*/
|
||||
IOReturn (*disconnectTargetPlugs)(void *self,
|
||||
UInt32 sourceSubunitTypeAndID,
|
||||
IOFWAVCPlugTypes sourcePlugType,
|
||||
UInt32 sourcePlugNum,
|
||||
UInt32 destSubunitTypeAndID,
|
||||
IOFWAVCPlugTypes destPlugType,
|
||||
UInt32 destPlugNum);
|
||||
|
||||
/*!
|
||||
@function getTargetPlugConnection
|
||||
@abstract Gets the connection details for a specific plug.
|
||||
@param self Pointer to IOFireWireAVCLibProtocolInterface.
|
||||
@param subunitTypeAndID The subunit type and ID of the plug.
|
||||
@param plugType The plug type.
|
||||
@param plugNum The plug number.
|
||||
@param pConnectedSubunitTypeAndID The subunit type and ID of the connected plug.
|
||||
@param pConnectedPlugType The type of the connected plug.
|
||||
@param pConnectedPlugNum The number of the connected plug.
|
||||
@param pLockConnection A pointer for returning the lock status of the connection.
|
||||
@param pPermConnection A pointer for returning the perm status of the connection.
|
||||
*/
|
||||
IOReturn (*getTargetPlugConnection)(void *self,
|
||||
UInt32 subunitTypeAndID,
|
||||
IOFWAVCPlugTypes plugType,
|
||||
UInt32 plugNum,
|
||||
UInt32 *pConnectedSubunitTypeAndID,
|
||||
IOFWAVCPlugTypes *pConnectedPlugType,
|
||||
UInt32 *pConnectedPlugNum,
|
||||
bool *pLockConnection,
|
||||
bool *pPermConnection);
|
||||
} IOFireWireAVCLibProtocolInterface;
|
||||
|
||||
|
||||
typedef void (*IOFireWireAVCPortStateHandler)( void * refcon, UInt32 state );
|
||||
typedef void (*IOFireWireAVCFrameStatusHandler)( void * refcon, UInt32 mode, UInt32 count );
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
@class IOFireWireAVCLibConsumerInterface
|
||||
@abstract Interface for an asynchronous connection consumer.
|
||||
@discussion Used to receive data from an asynchronous connection producer.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
UInt16 version;
|
||||
UInt16 revision;
|
||||
|
||||
void (*setSubunit)( void * self, UInt8 subunit );
|
||||
void (*setRemotePlug)( void * self, UInt8 plugNumber );
|
||||
|
||||
IOReturn (*connectToRemotePlug)( void * self );
|
||||
IOReturn (*disconnectFromRemotePlug)( void * self );
|
||||
|
||||
void (*setFrameStatusHandler)( void * self, void * refcon, IOFireWireAVCFrameStatusHandler handler );
|
||||
void (*frameProcessed)( void * self, UInt32 mode );
|
||||
|
||||
void (*setMaxPayloadSize)( void * self, UInt32 size );
|
||||
|
||||
IOReturn (*setSegmentSize)( void * self, UInt32 size );
|
||||
UInt32 (*getSegmentSize)( void * self );
|
||||
char * (*getSegmentBuffer)( void * self );
|
||||
|
||||
void (*setPortStateHandler)( void * self, void * refcon, IOFireWireAVCPortStateHandler handler );
|
||||
|
||||
|
||||
void (*setPortFlags)( void * self, UInt32 flags );
|
||||
void (*clearPortFlags)( void * self, UInt32 flags );
|
||||
UInt32 (*getPortFlags)( void * self );
|
||||
|
||||
} IOFireWireAVCLibConsumerInterface;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2002 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@
|
||||
*/
|
||||
/*
|
||||
File: IOFWIsoch.h
|
||||
|
||||
Contains: Definitions for FireWire isochronous transfers.
|
||||
|
||||
Copyright: <09> 1996-1999 by Apple Computer, Inc., all rights reserved.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __IOFWISOCH_H__
|
||||
#define __IOFWISOCH_H__
|
||||
|
||||
#warning This file is no longer needed. Please use <IOKit/firewire/IOFireWireFamilyCommon.h> instead.
|
||||
|
||||
#include <IOKit/firewire/IOFireWireFamilyCommon.h>
|
||||
|
||||
#endif /* __IOFWISOCH_H */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOACCEL_CLIENT_CONNECT_H
|
||||
#define _IOACCEL_CLIENT_CONNECT_H
|
||||
|
||||
|
||||
/*
|
||||
** The IOAccelerator service name
|
||||
*/
|
||||
#define kIOAcceleratorClassName "IOAccelerator"
|
||||
|
||||
|
||||
/*
|
||||
** IOAccelerator public client types. Private client types start with
|
||||
** kIOAccelNumClientTypes.
|
||||
*/
|
||||
enum eIOAcceleratorClientTypes {
|
||||
kIOAccelSurfaceClientType,
|
||||
kIOAccelNumClientTypes,
|
||||
#ifndef _OPEN_SOURCE_
|
||||
kIOAccelSurface2ClientType = 0x20
|
||||
#endif /* _OPEN_SOURCE_ */
|
||||
};
|
||||
|
||||
|
||||
#endif /* _IOACCEL_CLIENT_CONNECT_H */
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOACCEL_SURFACE_CONNECT_H
|
||||
#define _IOACCEL_SURFACE_CONNECT_H
|
||||
|
||||
#include <IOKit/graphics/IOAccelTypes.h>
|
||||
#include <IOKit/graphics/IOAccelClientConnect.h>
|
||||
|
||||
/*
|
||||
** Surface visible region in device coordinates.
|
||||
**
|
||||
** num_rects: The number of rectangles in the rect array. If num_rects
|
||||
** is zero the bounds rectangle is used for the visible rectangle.
|
||||
** If num_rects is zero the surface must be completely contained
|
||||
** by the device.
|
||||
**
|
||||
** bounds: The unclipped surface rectangle in device coords. Extends
|
||||
** beyond the device bounds if the surface is not totally on
|
||||
** the device.
|
||||
**
|
||||
** rect[]: An array of visible rectangles in device coords. If num_rects
|
||||
** is non-zero only the region described by these rectangles is
|
||||
** copied to the frame buffer during a flush operation.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UInt32 num_rects;
|
||||
IOAccelBounds bounds;
|
||||
IOAccelBounds rect[0];
|
||||
} IOAccelDeviceRegion;
|
||||
|
||||
|
||||
/*
|
||||
** Determine the size of a region.
|
||||
*/
|
||||
#define IOACCEL_SIZEOF_DEVICE_REGION(_rgn_) (sizeof(IOAccelDeviceRegion) + (_rgn_)->num_rects * sizeof(IOAccelBounds))
|
||||
|
||||
|
||||
/*
|
||||
** Surface client public memory types. Private memory types start with
|
||||
** kIOAccelNumSurfaceMemoryTypes.
|
||||
*/
|
||||
enum eIOAccelSurfaceMemoryTypes {
|
||||
kIOAccelNumSurfaceMemoryTypes
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
** Surface client public methods. Private methods start with
|
||||
** kIOAccelNumSurfaceMethods.
|
||||
*/
|
||||
enum eIOAccelSurfaceMethods {
|
||||
kIOAccelSurfaceReadLockOptions,
|
||||
kIOAccelSurfaceReadUnlockOptions,
|
||||
kIOAccelSurfaceGetState,
|
||||
kIOAccelSurfaceWriteLockOptions,
|
||||
kIOAccelSurfaceWriteUnlockOptions,
|
||||
kIOAccelSurfaceRead,
|
||||
kIOAccelSurfaceSetShapeBacking,
|
||||
|
||||
kIOAccelSurfaceSetIDMode,
|
||||
kIOAccelSurfaceSetScale,
|
||||
|
||||
kIOAccelSurfaceSetShape,
|
||||
kIOAccelSurfaceFlush,
|
||||
|
||||
kIOAccelSurfaceQueryLock,
|
||||
|
||||
kIOAccelSurfaceReadLock,
|
||||
kIOAccelSurfaceReadUnlock,
|
||||
kIOAccelSurfaceWriteLock,
|
||||
kIOAccelSurfaceWriteUnlock,
|
||||
|
||||
kIOAccelSurfaceControl,
|
||||
kIOAccelSurfaceSetShapeBackingAndLength,
|
||||
|
||||
kIOAccelNumSurfaceMethods
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
** Option bits for IOAccelCreateSurface and the kIOAccelSurfaceSetIDMode method.
|
||||
** The color depth field can take any value of the _CGSDepth enumeration.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOAccelSurfaceModeColorDepth1555 = 0x00000003,
|
||||
kIOAccelSurfaceModeColorDepth8888 = 0x00000004,
|
||||
// kIOAccelSurfaceModeColorDepthRGB565 = 0x00000005,
|
||||
kIOAccelSurfaceModeColorDepthYUV = 0x00000006,
|
||||
kIOAccelSurfaceModeColorDepthYUV9 = 0x00000007,
|
||||
kIOAccelSurfaceModeColorDepthYUV12 = 0x00000008,
|
||||
kIOAccelSurfaceModeColorDepthYUV2 = 0x00000009,
|
||||
kIOAccelSurfaceModeColorDepthBGRA32 = 0x0000000A,
|
||||
|
||||
// kIOAccelSurfaceModeColorDepthRGBA64 = 0x0000000B,
|
||||
// kIOAccelSurfaceModeColorDepthRGBAFloat64 = 0x0000000C,
|
||||
// kIOAccelSurfaceModeColorDepthRGBAFloat128 = 0x0000000D,
|
||||
|
||||
// kIOAccelSurfaceModeColorDepthYUV420 = 0x0000000E,
|
||||
kIOAccelSurfaceModeColorDepth2101010 = 0x0000000F,
|
||||
|
||||
kIOAccelSurfaceModeColorDepthBits = 0x0000000F,
|
||||
|
||||
kIOAccelSurfaceModeStereoBit = 0x00000010,
|
||||
kIOAccelSurfaceModeWindowedBit = 0x00000020,
|
||||
|
||||
#ifndef _OPEN_SOURCE_
|
||||
kIOAccelSurfaceModeSurface2 = 0x00004000,
|
||||
#endif /* _OPEN_SOURCE_ */
|
||||
kIOAccelSurfaceModeBeamSync = 0x00008000
|
||||
} eIOAccelSurfaceModeBits;
|
||||
|
||||
|
||||
/*
|
||||
** Options bits for IOAccelSetSurfaceShape and the kIOAccelSurfaceSetShape method.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOAccelSurfaceShapeNone = 0x00000000,
|
||||
kIOAccelSurfaceShapeNonBlockingBit = 0x00000001,
|
||||
kIOAccelSurfaceShapeNonSimpleBit = 0x00000002,
|
||||
kIOAccelSurfaceShapeIdentityScaleBit = 0x00000004,
|
||||
kIOAccelSurfaceShapeFrameSyncBit = 0x00000008,
|
||||
kIOAccelSurfaceShapeBeamSyncBit = 0x00000010,
|
||||
kIOAccelSurfaceShapeStaleBackingBit = 0x00000020,
|
||||
kIOAccelSurfaceShapeAssemblyBit = 0x00000040,
|
||||
kIOAccelSurfaceShapeWaitEnabledBit = 0x00000080,
|
||||
|
||||
/* wrong name, use kIOAccelSurfaceShapeNonBlockingBit */
|
||||
kIOAccelSurfaceShapeBlockingBit = kIOAccelSurfaceShapeNonBlockingBit
|
||||
} eIOAccelSurfaceShapeBits;
|
||||
|
||||
/*
|
||||
** Return bits for the kIOAccelSurfaceGetState method.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOAccelSurfaceStateNone = 0x00000000,
|
||||
kIOAccelSurfaceStateIdleBit = 0x00000001
|
||||
} eIOAccelSurfaceStateBits;
|
||||
|
||||
/*
|
||||
** Option bits for the kIOAccelSurfaceSetScale method.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOAccelSurfaceBeamSyncSwaps = 0x00000001,
|
||||
kIOAccelSurfaceFixedSource = 0x00000002,
|
||||
|
||||
kIOAccelSurfaceFiltering = 0x000000f0,
|
||||
kIOAccelSurfaceFilterDefault = 0x00000000,
|
||||
kIOAccelSurfaceFilterNone = 0x00000010,
|
||||
kIOAccelSurfaceFilterLinear = 0x00000020
|
||||
|
||||
} eIOAccelSurfaceScaleBits;
|
||||
|
||||
/*
|
||||
** Option bits for the kIOAccelSurfaceLock methods.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOAccelSurfaceLockInBacking = 0,
|
||||
kIOAccelSurfaceLockInAccel = 1,
|
||||
kIOAccelSurfaceLockInDontCare = 2,
|
||||
kIOAccelSurfaceLockInMask = 0x00000003
|
||||
} eIOAccelSurfaceLockBits;
|
||||
|
||||
#endif /* _IOACCEL_SURFACE_CONNECT_H */
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOACCEL_TYPES_H
|
||||
#define _IOACCEL_TYPES_H
|
||||
|
||||
#include <IOKit/IOTypes.h>
|
||||
#include <IOKit/IOKitKeys.h>
|
||||
|
||||
#define IOACCEL_TYPES_REV 12
|
||||
|
||||
#if !defined(OSTYPES_K64_REV) && !defined(MAC_OS_X_VERSION_10_6)
|
||||
#define IOACCELTYPES_10_5 1
|
||||
#endif
|
||||
|
||||
/* Integer rectangle in device coordinates */
|
||||
typedef struct
|
||||
{
|
||||
SInt16 x;
|
||||
SInt16 y;
|
||||
SInt16 w;
|
||||
SInt16 h;
|
||||
} IOAccelBounds;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SInt16 w;
|
||||
SInt16 h;
|
||||
} IOAccelSize;
|
||||
|
||||
/* Surface information */
|
||||
|
||||
enum {
|
||||
kIOAccelVolatileSurface = 0x00000001
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#if IOACCELTYPES_10_5
|
||||
vm_address_t address[4];
|
||||
#else
|
||||
mach_vm_address_t address[4];
|
||||
#endif /* IOACCELTYPES_10_5 */
|
||||
UInt32 rowBytes;
|
||||
UInt32 width;
|
||||
UInt32 height;
|
||||
UInt32 pixelFormat;
|
||||
IOOptionBits flags;
|
||||
IOFixed colorTemperature[4];
|
||||
UInt32 typeDependent[4];
|
||||
} IOAccelSurfaceInformation;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#if IOACCELTYPES_10_5
|
||||
long x, y, w, h;
|
||||
void *client_addr;
|
||||
unsigned long client_row_bytes;
|
||||
#else
|
||||
SInt32 x, y, w, h;
|
||||
mach_vm_address_t client_addr;
|
||||
UInt32 client_row_bytes;
|
||||
#endif /* IOACCELTYPES_10_5 */
|
||||
} IOAccelSurfaceReadData;
|
||||
|
||||
typedef struct {
|
||||
IOAccelBounds buffer;
|
||||
IOAccelSize source;
|
||||
UInt32 reserved[8];
|
||||
} IOAccelSurfaceScaling;
|
||||
|
||||
|
||||
typedef SInt32 IOAccelID;
|
||||
|
||||
enum {
|
||||
kIOAccelPrivateID = 0x00000001
|
||||
};
|
||||
|
||||
|
||||
#endif /* _IOACCEL_TYPES_H */
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOFRAMEBUFFERSHARED_H
|
||||
#define _IOKIT_IOFRAMEBUFFERSHARED_H
|
||||
|
||||
#include <IOKit/hidsystem/IOHIDTypes.h>
|
||||
#include <IOKit/graphics/IOGraphicsTypes.h>
|
||||
#include <libkern/OSAtomic.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*! @header IOFramebufferShared
|
||||
The IOFramebufferShared.h header contains definitions of objects and types shared between a kernel level IOFrameBuffer service and a non-kernel window server. In Mac OS X this structure is used by the CoreGraphics server and IOGraphics Family, and is not available to other clients. IOFramebuffer subclasses and IOFramebuffer clients within the kernel should also not rely on this structure definition and constants. It is public only for use on Darwin based window servers. Cursor and window server state data is exchanged by kernel and non-kernel tasks through a slice of shared memory containing a StdFBShmem_t structure.<br>
|
||||
For a non-kernel task to get access to this slice of shared memory, a connection to an IOFramebuffer service must be made. A connection is made with the IOServiceOpen() function described in IOKitLib.h. A connection type of kIOFBServerConnectType or kIOFBSharedConnectType (for read-only access) should be specified. An io_connect_t handle is returned by IOServiceOpen(). This handle must be passed to IOFBCreateSharedCursor() to create the slice of shared memory. Then IOConnectMapMemory() may be called with a memory type of kIOFBCursorMemory to map the shared memory into the non-kernel task.
|
||||
*/
|
||||
|
||||
#ifdef KERNEL
|
||||
// CGS use optional
|
||||
/*! @defined IOFB_ARBITRARY_SIZE_CURSOR
|
||||
@discussion When IOFB_ARBITRARY_SIZE_CURSOR is not defined, the maximum cursor size is assumed to be CURSORWIDTH x CURSORHEIGHT and this header file will define a number of structures for storing cursor images accordingly. A non-kernel task may define IOFB_ARBITRARY_SIZE_CURSOR and use cursors up to the size specified when IOFBCreateSharedCursor() was called. In this case appropriate structures for storing cursor images must be defined elsewhere. In the kernel, IOFB_ARBITRARY_SIZE_CURSOR is always defined.
|
||||
*/
|
||||
#define IOFB_ARBITRARY_SIZE_CURSOR
|
||||
#define IOFB_ARBITRARY_FRAMES_CURSOR 1
|
||||
#endif
|
||||
|
||||
#define IOFB_SUPPORTS_XOR_CURSOR
|
||||
#define IOFB_SUPPORTS_HW_SHIELD
|
||||
#define IOFB_SUPPORTS_ARBITRARY_FRAMES_CURSOR
|
||||
|
||||
//
|
||||
// Cursor and Window Server state data, occupying a slice of shared memory
|
||||
// between the kernel and WindowServer.
|
||||
//
|
||||
/*! @enum CursorParameters
|
||||
@constant kIOFBNumCursorFrames The number of cursor images stored in the StdFBShmem_t structure.
|
||||
@constant kIOFBNumCursorFramesShift Used with waiting cursors.
|
||||
@constant kIOFBMaxCursorDepth The maximum cursor pixel depth.
|
||||
*/
|
||||
enum {
|
||||
#if IOFB_ARBITRARY_FRAMES_CURSOR
|
||||
kIOFBMainCursorIndex = 0,
|
||||
kIOFBWaitCursorIndex = 1,
|
||||
kIOFBNumCursorIndex = 4,
|
||||
#else
|
||||
kIOFBNumCursorFrames = 4,
|
||||
kIOFBNumCursorFramesShift = 2,
|
||||
#endif
|
||||
kIOFBMaxCursorDepth = 32,
|
||||
kIOFBMaxCursorWidth = 256,
|
||||
kIOFBMaxCursorFrames = 32,
|
||||
};
|
||||
|
||||
#ifndef IOFB_ARBITRARY_SIZE_CURSOR
|
||||
|
||||
/*! @defined CURSORWIDTH
|
||||
@discussion The maximum width of the cursor image in pixels. This is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
|
||||
*/
|
||||
#define CURSORWIDTH 16 /* width in pixels */
|
||||
|
||||
/*! @defined CURSORHEIGHT
|
||||
@discussion The maximum height of the cursor image in pixels. This is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
|
||||
*/
|
||||
#define CURSORHEIGHT 16 /* height in pixels */
|
||||
|
||||
/*! @struct bm12Cursor
|
||||
@abstract Cursor image for 1-bit cursor.
|
||||
@discussion This structure stores 16 pixel x 16 pixel cursors to be used with 1-bit color depth. This structure is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
|
||||
@field image This array contains the cursor images.
|
||||
@field mask This array contains the cursor mask.
|
||||
@field save This array stores the pixel values of the region underneath the cursor in its last drawn position.
|
||||
*/
|
||||
struct bm12Cursor {
|
||||
unsigned int image[4][16];
|
||||
unsigned int mask[4][16];
|
||||
unsigned int save[16];
|
||||
};
|
||||
|
||||
/*! @struct bm18Cursor
|
||||
@abstract Cursor image for 8-bit cursor.
|
||||
@discussion This structure stores 16 pixel x 16 pixel cursors to be used with 8-bit color depth. This structure is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
|
||||
@field image This array contains cursor color values, which are converted to displayed colors through the color table. The array is two dimensional and its first index is the cursor frame and the second index is the cursor pixel.
|
||||
@field mask This array contains the cursor alpha mask. The array is two dimensional with the same indexing as the image. If an alpha mask pixel is 0 and the corresponding image pixel is set to white for the display, then this cursor pixel will invert pixels on the display.
|
||||
@field save This array stores the color values of the region underneath the cursor in its last drawn position.
|
||||
*/
|
||||
struct bm18Cursor {
|
||||
unsigned char image[4][256];
|
||||
unsigned char mask[4][256];
|
||||
unsigned char save[256];
|
||||
};
|
||||
|
||||
/*! @struct bm34Cursor
|
||||
@abstract Cursor image for 15-bit cursor.
|
||||
@discussion This structure stores 16 pixel x 16 pixel cursors to be used with 15-bit color depth. This structure is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
|
||||
@field image This array defines the cursor color values and transparency. The array is two dimensional and its first index is the cursor frame and the second index is the cursor pixel. A value of 0 means the pixel is transparent. Non-zero values are stored with the red, green, blue, and alpha values encoded with the following masks:<BR>
|
||||
red mask = 0xF000<br>
|
||||
blue mask 0x0F00<br>
|
||||
green mask 0x00F0<br>
|
||||
alpha mask = 0x000F<br>
|
||||
Note, only 4 bits are allocated for each color component.
|
||||
@field save This array stores the color values of the region underneath the cursor in its last drawn position.
|
||||
*/
|
||||
struct bm34Cursor {
|
||||
unsigned short image[4][256];
|
||||
unsigned short save[256];
|
||||
};
|
||||
|
||||
/*! @struct bm38Cursor
|
||||
@abstract Cursor image for 24-bit cursor.
|
||||
@discussion This structure stores 16 pixel x 16 pixel cursors to be used with 24-bit color depth. This structure is only defined if IOFB_ARBITRARY_SIZE_CURSOR is not defined.
|
||||
@field image This array defines the cursor color values and transparency. The array is two dimensional and its first index is the cursor frame and the second index is the cursor pixel. The lower 24 bits of a pixel's value contain the RGB color, while the upper 8 bits contain the alpha value.
|
||||
@field save This array stores the color values of the region underneath the cursor in its last drawn position.
|
||||
*/
|
||||
struct bm38Cursor {
|
||||
unsigned int image[4][256];
|
||||
unsigned int save[256];
|
||||
};
|
||||
|
||||
#endif /* IOFB_ARBITRARY_SIZE_CURSOR */
|
||||
|
||||
enum {
|
||||
kIOFBCursorImageNew = 0x01,
|
||||
kIOFBCursorHWCapable = 0x02
|
||||
};
|
||||
enum {
|
||||
kIOFBHardwareCursorActive = 0x01,
|
||||
kIOFBHardwareCursorInVRAM = 0x02
|
||||
};
|
||||
|
||||
/*! @struct StdFBShmem_t
|
||||
@discussion This structure contains cursor and window server state data and occupies a slice of shared memory between the kernel and window server. Several elements of this structure are only used in software cursor mode. Unless otherwise indicated, the coordinates in this structure are given in display space. Display space is the coordinate space that encompasses all the screens. The positions of the screens within display space indicate their location relative to each other as the cursor moves between them. If there is only one screen, the screen coordinates and display space coordinates will be the same.
|
||||
@field cursorSema Semaphore lock for write access to the shared data in this structure.
|
||||
@field frame The current cursor frame index.
|
||||
@field cursorShow The cursor is displayed when cursorShow is 0.
|
||||
@field cursorObscured If this is true, the cursor has been obscured and cursorShow should not be 0. The cursor will be shown again the next time it is moved.
|
||||
@field shieldFlag When this is set to true the cursor will not be displayed in the region specified by shieldRect.
|
||||
@field shielded True if the cursor has been hidden because it entered the shielded region.
|
||||
@field saveRect The region that is saved underneath the cursor in software cursor mode.
|
||||
@field shieldRect The region that the cursor will not be displayed in if shieldFlag is true.
|
||||
@field cursorLoc The location of the cursor hot spot.
|
||||
@field cursorRect The region that the cursor image currently occupies in software cursor mode.
|
||||
@field oldCursorRect The region that the cursor image occupied the last time the cursor was drawn in software cursor mode.
|
||||
@field screenBounds The region that the current screen occupies.
|
||||
@field version Contains kIOFBCurrentShmemVersion so that a user client can ensure it is using the same version of this structure as the kernel.
|
||||
@field structSize Contains the size of this structure.
|
||||
@field vblTime The time of the most recent vertical blanking.
|
||||
@field vblDelta The interval between the two most recent vertical blankings.
|
||||
@field vblCount A running count of vertical blank interrupts.
|
||||
@field reservedC Reserved for future use.
|
||||
@field hardwareCursorCapable True if the hardware is capable of using hardware cursor mode.
|
||||
@field hardwareCursorActive True if currently using the hardware cursor mode.
|
||||
@field reservedB Reserved for future use.
|
||||
@field cursorSize This array contains the cursor sizes indexed by frame.
|
||||
@field hotSpot This array contains the location of the cursor hot spots indexed by frame. The hot spots coordinates are given relative to the top left corner of the cursor image.
|
||||
@field cursor A union of structures that define the cursor images. The structure used depends on the framebuffer's bit depth. These structures are defined above.
|
||||
*/
|
||||
|
||||
struct StdFBShmem_t {
|
||||
OSSpinLock cursorSema;
|
||||
int frame;
|
||||
char cursorShow;
|
||||
char cursorObscured;
|
||||
char shieldFlag;
|
||||
char shielded;
|
||||
IOGBounds saveRect;
|
||||
IOGBounds shieldRect;
|
||||
IOGPoint cursorLoc;
|
||||
IOGBounds cursorRect;
|
||||
IOGBounds oldCursorRect;
|
||||
IOGBounds screenBounds;
|
||||
int version;
|
||||
int structSize;
|
||||
AbsoluteTime vblTime;
|
||||
AbsoluteTime vblDelta;
|
||||
unsigned long long int vblCount;
|
||||
#if IOFB_ARBITRARY_FRAMES_CURSOR
|
||||
unsigned long long int vblDrift;
|
||||
unsigned long long int vblDeltaMeasured;
|
||||
AbsoluteTime vblDeltaReal;
|
||||
unsigned int reservedC[22];
|
||||
#else
|
||||
unsigned int reservedC[27];
|
||||
unsigned char hardwareCursorFlags[kIOFBNumCursorFrames];
|
||||
#endif
|
||||
unsigned char hardwareCursorCapable;
|
||||
unsigned char hardwareCursorActive;
|
||||
unsigned char hardwareCursorShields;
|
||||
unsigned char reservedB[1];
|
||||
#if IOFB_ARBITRARY_FRAMES_CURSOR
|
||||
IOGSize cursorSize[kIOFBNumCursorIndex];
|
||||
IOGPoint hotSpot[kIOFBNumCursorIndex];
|
||||
#else
|
||||
IOGSize cursorSize[kIOFBNumCursorFrames];
|
||||
IOGPoint hotSpot[kIOFBNumCursorFrames];
|
||||
#endif
|
||||
#ifndef IOFB_ARBITRARY_SIZE_CURSOR
|
||||
union {
|
||||
struct bm12Cursor bw;
|
||||
struct bm18Cursor bw8;
|
||||
struct bm34Cursor rgb;
|
||||
struct bm38Cursor rgb24;
|
||||
} cursor;
|
||||
#else /* IOFB_ARBITRARY_SIZE_CURSOR */
|
||||
unsigned char cursor[0];
|
||||
#endif /* IOFB_ARBITRARY_SIZE_CURSOR */
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
typedef volatile struct StdFBShmem_t StdFBShmem_t;
|
||||
#endif
|
||||
|
||||
|
||||
/*! @enum FramebufferConstants
|
||||
@constant kIOFBCurrentShmemVersion The current version of the slice of shared memory that contains the cursor and window server state data in the StdFBShmem_t structure.
|
||||
@constant kIOFBCursorMemory The memory type for IOConnectMapMemory() to get a slice of shared memory that contains the StdFBShmem_t structure.
|
||||
*/
|
||||
enum {
|
||||
// version for IOFBCreateSharedCursor
|
||||
kIOFBShmemVersionMask = 0x000000ff,
|
||||
kIOFBTenPtOneShmemVersion = 2,
|
||||
kIOFBTenPtTwoShmemVersion = 3,
|
||||
kIOFBCurrentShmemVersion = 2,
|
||||
|
||||
// number of frames in animating cursor (if > kIOFBTenPtTwoShmemVersion)
|
||||
kIOFBShmemCursorNumFramesMask = 0x00ff0000,
|
||||
kIOFBShmemCursorNumFramesShift = 16,
|
||||
|
||||
// memory types for IOConnectMapMemory.
|
||||
kIOFBCursorMemory = 100
|
||||
};
|
||||
|
||||
/*! @defined IOFRAMEBUFFER_CONFORMSTO
|
||||
@discussion The class name of the framebuffer service.
|
||||
*/
|
||||
#define IOFRAMEBUFFER_CONFORMSTO "IOFramebuffer"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! _IOKIT_IOFRAMEBUFFERSHARED_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* 10 Mar 99 sdouglas created.
|
||||
*/
|
||||
|
||||
|
||||
struct IOGraphicsEngineContext {
|
||||
OSSpinLock contextLock;
|
||||
IOOptionBits state;
|
||||
void * owner;
|
||||
UInt32 version;
|
||||
IOByteCount structSize;
|
||||
UInt32 reserved[ 8 ];
|
||||
};
|
||||
#ifndef __cplusplus
|
||||
typedef volatile struct IOGraphicsEngineContext IOGraphicsEngineContext;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
// memory type for IOMapMemory
|
||||
kIOGraphicsEngineContext = 100
|
||||
};
|
||||
|
||||
enum {
|
||||
// version
|
||||
kIOGraphicsEngineContextVersion = 1
|
||||
};
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* Copyright (c) 1999-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@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOGRAPHICSINTERFACE_H
|
||||
#define _IOKIT_IOGRAPHICSINTERFACE_H
|
||||
|
||||
#ifdef KERNEL
|
||||
#define NO_CFPLUGIN 1
|
||||
#endif
|
||||
|
||||
#ifndef NO_CFPLUGIN
|
||||
#include <IOKit/IOCFPlugIn.h>
|
||||
#endif /* ! NO_CFPLUGIN */
|
||||
|
||||
#define IOGA_COMPAT 1
|
||||
|
||||
#include <IOKit/graphics/IOGraphicsInterfaceTypes.h>
|
||||
|
||||
// <rdar://problem/23764215> IOGraphics: IOGraphicsInterface.h: "C" linkage not enforced.
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define kIOGraphicsAcceleratorTypeID \
|
||||
(CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xAC, 0xCF, 0x00, 0x00, \
|
||||
0x00, 0x00, \
|
||||
0x00, 0x00, \
|
||||
0x00, 0x00, \
|
||||
0x00, 0x0a, 0x27, 0x89, 0x90, 0x4e))
|
||||
|
||||
// IOGraphicsAcceleratorType objects must implement the
|
||||
// IOGraphicsAcceleratorInterface
|
||||
|
||||
#define kIOGraphicsAcceleratorInterfaceID \
|
||||
(CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x67, 0x66, 0xE9, 0x4A, \
|
||||
0x00, 0x00, \
|
||||
0x00, 0x00, \
|
||||
0x00, 0x00, \
|
||||
0x00, 0x0a, 0x27, 0x89, 0x90, 0x4e))
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
typedef
|
||||
IOReturn (*IOBlitAccumulatePtr)(void *thisPointer,
|
||||
SInt32 a, SInt32 b, SInt32 c,
|
||||
SInt32 d, SInt32 e, SInt32 f );
|
||||
|
||||
#ifdef IOGA_COMPAT
|
||||
typedef
|
||||
IOReturn (*IOBlitProcPtr)(void *thisPointer,
|
||||
IOOptionBits options,
|
||||
IOBlitType type, IOBlitSourceDestType sourceDestType,
|
||||
IOBlitOperation * operation,
|
||||
void * source, void * destination,
|
||||
IOBlitCompletionToken * completionToken );
|
||||
#endif
|
||||
|
||||
typedef
|
||||
IOReturn (*IOBlitterPtr)(void *thisPointer,
|
||||
IOOptionBits options,
|
||||
IOBlitType type, IOBlitSourceType sourceType,
|
||||
IOBlitOperation * operation,
|
||||
void * source );
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef NO_CFPLUGIN
|
||||
|
||||
typedef struct IOGraphicsAcceleratorInterfaceStruct {
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOCFPLUGINBASE;
|
||||
|
||||
IOReturn (*Reset)
|
||||
(void *thisPointer, IOOptionBits options);
|
||||
IOReturn (*CopyCapabilities)
|
||||
(void *thisPointer, FourCharCode select, CFTypeRef * capabilities);
|
||||
#ifdef IOGA_COMPAT
|
||||
IOReturn (*GetBlitProc)
|
||||
(void *thisPointer, IOOptionBits options,
|
||||
IOBlitType type, IOBlitSourceDestType sourceDestType,
|
||||
IOBlitProcPtr * blitProc );
|
||||
#else
|
||||
void * __gaInterfaceReserved0;
|
||||
#endif
|
||||
|
||||
IOReturn (*Flush)
|
||||
(void *thisPointer, IOOptionBits options);
|
||||
#ifdef IOGA_COMPAT
|
||||
IOReturn (*WaitForCompletion)
|
||||
(void *thisPointer, IOOptionBits options,
|
||||
IOBlitCompletionToken completionToken);
|
||||
#else
|
||||
void * __gaInterfaceReserved1;
|
||||
#endif
|
||||
IOReturn (*Synchronize)
|
||||
(void *thisPointer, UInt32 options,
|
||||
UInt32 x, UInt32 y, UInt32 w, UInt32 h );
|
||||
IOReturn (*GetBeamPosition)
|
||||
(void *thisPointer, IOOptionBits options, SInt32 * position);
|
||||
IOReturn (*AllocateSurface)
|
||||
(void *thisPointer, IOOptionBits options,
|
||||
IOBlitSurface * surface, void * cgsSurfaceID );
|
||||
IOReturn (*FreeSurface)
|
||||
(void *thisPointer, IOOptionBits options, IOBlitSurface * surface);
|
||||
IOReturn (*LockSurface)
|
||||
(void *thisPointer, IOOptionBits options, IOBlitSurface * surface,
|
||||
vm_address_t * address );
|
||||
IOReturn (*UnlockSurface)
|
||||
(void *thisPointer, IOOptionBits options, IOBlitSurface * surface,
|
||||
IOOptionBits * swapFlags);
|
||||
IOReturn (*SwapSurface)
|
||||
(void *thisPointer, IOOptionBits options,
|
||||
IOBlitSurface * surface, IOOptionBits * swapFlags);
|
||||
|
||||
IOReturn (*SetDestination)
|
||||
(void *thisPointer, IOOptionBits options, IOBlitSurface * surface );
|
||||
|
||||
IOReturn (*GetBlitter)
|
||||
(void *thisPointer, IOOptionBits options,
|
||||
IOBlitType type, IOBlitSourceType sourceType,
|
||||
IOBlitterPtr * blitter );
|
||||
IOReturn (*WaitComplete)
|
||||
(void *thisPointer, IOOptionBits options);
|
||||
|
||||
void * __gaInterfaceReserved[ 24 ];
|
||||
|
||||
} IOGraphicsAcceleratorInterface;
|
||||
|
||||
#endif /* ! NO_CFPLUGIN */
|
||||
|
||||
/* Helper function for plugin use */
|
||||
IOReturn IOAccelFindAccelerator( io_service_t framebuffer,
|
||||
io_service_t * pAccelerator, UInt32 * pFramebufferIndex );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#endif /* !_IOKIT_IOGRAPHICSINTERFACE_H */
|
||||
@@ -0,0 +1,301 @@
|
||||
/*
|
||||
* Copyright (c) 1999-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@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOGRAPHICSINTERFACETYPES_H
|
||||
#define _IOKIT_IOGRAPHICSINTERFACETYPES_H
|
||||
|
||||
#include <IOKit/graphics/IOAccelSurfaceConnect.h>
|
||||
|
||||
#define IO_FOUR_CHAR_CODE(x) (x)
|
||||
|
||||
typedef UInt32 IOFourCharCode;
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#define kCurrentGraphicsInterfaceVersion 1
|
||||
#define kCurrentGraphicsInterfaceRevision 2
|
||||
|
||||
|
||||
#ifdef IOGA_COMPAT
|
||||
typedef SInt32 IOBlitCompletionToken;
|
||||
#endif
|
||||
|
||||
typedef UInt32 IOBlitType;
|
||||
enum {
|
||||
kIOBlitTypeVerbMask = 0x000000ff,
|
||||
kIOBlitTypeRects = 0,
|
||||
kIOBlitTypeCopyRects,
|
||||
kIOBlitTypeLines,
|
||||
kIOBlitTypeScanlines,
|
||||
kIOBlitTypeCopyRegion,
|
||||
|
||||
kIOBlitTypeMoveCursor,
|
||||
kIOBlitTypeShowCursor,
|
||||
kIOBlitTypeHideCursor,
|
||||
|
||||
kIOBlitTypeMonoExpand = 0x00000100,
|
||||
kIOBlitTypeColorSpaceConvert = 0x00000200,
|
||||
kIOBlitTypeScale = 0x00000400,
|
||||
|
||||
kIOBlitTypeSourceKeyColorModeMask = 0x00003000,
|
||||
kIOBlitTypeDestKeyColorModeMask = 0x0000c000,
|
||||
kIOBlitTypeSourceKeyColorEqual = 0x00001000,
|
||||
kIOBlitTypeSourceKeyColorNotEqual = 0x00002000,
|
||||
kIOBlitTypeDestKeyColorEqual = 0x00004000,
|
||||
kIOBlitTypeDestKeyColorNotEqual = 0x00008000,
|
||||
|
||||
kIOBlitTypeOperationMask = 0x0fff0000,
|
||||
kIOBlitTypeOperationShift = 16,
|
||||
kIOBlitTypeOperationTypeMask = 0x0f000000,
|
||||
|
||||
kIOBlitTypeOperationType0 = 0x00000000,
|
||||
kIOBlitCopyOperation = 0x00000000 | kIOBlitTypeOperationType0,
|
||||
kIOBlitOrOperation = 0x00010000 | kIOBlitTypeOperationType0,
|
||||
kIOBlitXorOperation = 0x00020000 | kIOBlitTypeOperationType0,
|
||||
kIOBlitBlendOperation = 0x00030000 | kIOBlitTypeOperationType0,
|
||||
kIOBlitHighlightOperation = 0x00040000 | kIOBlitTypeOperationType0
|
||||
};
|
||||
|
||||
typedef UInt32 IOBlitSourceType;
|
||||
enum {
|
||||
kIOBlitSourceDefault = 0x00000000,
|
||||
kIOBlitSourceFramebuffer = 0x00001000,
|
||||
kIOBlitSourceMemory = 0x00002000,
|
||||
kIOBlitSourceOOLMemory = 0x00003000,
|
||||
kIOBlitSourcePattern = 0x00004000,
|
||||
kIOBlitSourceOOLPattern = 0x00005000,
|
||||
kIOBlitSourceSolid = 0x00006000,
|
||||
kIOBlitSourceCGSSurface = 0x00007000,
|
||||
kIOBlitSourceIsSame = 0x80000000
|
||||
};
|
||||
|
||||
#ifdef IOGA_COMPAT
|
||||
typedef IOBlitSourceType IOBlitSourceDestType;
|
||||
enum {
|
||||
kIOBlitDestFramebuffer = 0x00000001
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef struct IOBlitOperationStruct {
|
||||
UInt32 color0;
|
||||
UInt32 color1;
|
||||
SInt32 offsetX;
|
||||
SInt32 offsetY;
|
||||
UInt32 sourceKeyColor;
|
||||
UInt32 destKeyColor;
|
||||
UInt32 specific[16];
|
||||
} IOBlitOperation;
|
||||
|
||||
typedef struct IOBlitRectangleStruct {
|
||||
SInt32 x;
|
||||
SInt32 y;
|
||||
SInt32 width;
|
||||
SInt32 height;
|
||||
} IOBlitRectangle;
|
||||
|
||||
typedef struct IOBlitRectanglesStruct {
|
||||
IOBlitOperation operation;
|
||||
IOItemCount count;
|
||||
IOBlitRectangle rects[1];
|
||||
} IOBlitRectangles;
|
||||
|
||||
typedef struct IOBlitCopyRectangleStruct {
|
||||
SInt32 sourceX;
|
||||
SInt32 sourceY;
|
||||
SInt32 x;
|
||||
SInt32 y;
|
||||
SInt32 width;
|
||||
SInt32 height;
|
||||
} IOBlitCopyRectangle;
|
||||
|
||||
typedef struct IOBlitCopyRectanglesStruct {
|
||||
IOBlitOperation operation;
|
||||
IOItemCount count;
|
||||
IOBlitCopyRectangle rects[1];
|
||||
} IOBlitCopyRectangles;
|
||||
|
||||
|
||||
typedef struct IOBlitCopyRegionStruct {
|
||||
IOBlitOperation operation;
|
||||
SInt32 deltaX;
|
||||
SInt32 deltaY;
|
||||
IOAccelDeviceRegion * region;
|
||||
} IOBlitCopyRegion;
|
||||
|
||||
|
||||
typedef struct IOBlitVertexStruct {
|
||||
SInt32 x;
|
||||
SInt32 y;
|
||||
} IOBlitVertex;
|
||||
|
||||
typedef struct IOBlitVerticesStruct {
|
||||
IOBlitOperation operation;
|
||||
IOItemCount count;
|
||||
IOBlitVertex vertices[2];
|
||||
} IOBlitVertices;
|
||||
|
||||
typedef struct IOBlitScanlinesStruct {
|
||||
IOBlitOperation operation;
|
||||
IOItemCount count;
|
||||
SInt32 y;
|
||||
SInt32 height;
|
||||
SInt32 x[2];
|
||||
} IOBlitScanlines;
|
||||
|
||||
|
||||
typedef struct IOBlitCursorStruct {
|
||||
IOBlitOperation operation;
|
||||
IOBlitRectangle rect;
|
||||
} IOBlitCursor;
|
||||
|
||||
typedef struct _IOBlitMemory * IOBlitMemoryRef;
|
||||
|
||||
|
||||
/* Quickdraw.h pixel formats*/
|
||||
|
||||
enum {
|
||||
kIO1MonochromePixelFormat = 0x00000001, /* 1 bit indexed*/
|
||||
kIO2IndexedPixelFormat = 0x00000002, /* 2 bit indexed*/
|
||||
kIO4IndexedPixelFormat = 0x00000004, /* 4 bit indexed*/
|
||||
kIO8IndexedPixelFormat = 0x00000008, /* 8 bit indexed*/
|
||||
kIO16BE555PixelFormat = 0x00000010, /* 16 bit BE rgb 555 (Mac)*/
|
||||
kIO24RGBPixelFormat = 0x00000018, /* 24 bit rgb */
|
||||
kIO32ARGBPixelFormat = 0x00000020, /* 32 bit argb (Mac)*/
|
||||
kIO1IndexedGrayPixelFormat = 0x00000021, /* 1 bit indexed gray*/
|
||||
kIO2IndexedGrayPixelFormat = 0x00000022, /* 2 bit indexed gray*/
|
||||
kIO4IndexedGrayPixelFormat = 0x00000024, /* 4 bit indexed gray*/
|
||||
kIO8IndexedGrayPixelFormat = 0x00000028 /* 8 bit indexed gray*/
|
||||
};
|
||||
|
||||
enum {
|
||||
kIO16LE555PixelFormat = IO_FOUR_CHAR_CODE('L555'), /* 16 bit LE rgb 555 (PC)*/
|
||||
kIO16LE5551PixelFormat = IO_FOUR_CHAR_CODE('5551'), /* 16 bit LE rgb 5551*/
|
||||
kIO16BE565PixelFormat = IO_FOUR_CHAR_CODE('B565'), /* 16 bit BE rgb 565*/
|
||||
kIO16LE565PixelFormat = IO_FOUR_CHAR_CODE('L565'), /* 16 bit LE rgb 565*/
|
||||
kIO24BGRPixelFormat = IO_FOUR_CHAR_CODE('24BG'), /* 24 bit bgr */
|
||||
kIO32BGRAPixelFormat = IO_FOUR_CHAR_CODE('BGRA'), /* 32 bit bgra (Matrox)*/
|
||||
kIO32ABGRPixelFormat = IO_FOUR_CHAR_CODE('ABGR'), /* 32 bit abgr */
|
||||
kIO32RGBAPixelFormat = IO_FOUR_CHAR_CODE('RGBA'), /* 32 bit rgba */
|
||||
kIOYUVSPixelFormat = IO_FOUR_CHAR_CODE('yuvs'), /* YUV 4:2:2 byte ordering 16-unsigned = 'YUY2'*/
|
||||
kIOYUVUPixelFormat = IO_FOUR_CHAR_CODE('yuvu'), /* YUV 4:2:2 byte ordering 16-signed*/
|
||||
kIOYVU9PixelFormat = IO_FOUR_CHAR_CODE('YVU9'), /* YVU9 Planar 9*/
|
||||
kIOYUV411PixelFormat = IO_FOUR_CHAR_CODE('Y411'), /* YUV 4:1:1 Interleaved 16*/
|
||||
kIOYVYU422PixelFormat = IO_FOUR_CHAR_CODE('YVYU'), /* YVYU 4:2:2 byte ordering 16*/
|
||||
kIOUYVY422PixelFormat = IO_FOUR_CHAR_CODE('UYVY'), /* UYVY 4:2:2 byte ordering 16*/
|
||||
kIOYUV211PixelFormat = IO_FOUR_CHAR_CODE('Y211'), /* YUV 2:1:1 Packed 8*/
|
||||
kIO2vuyPixelFormat = IO_FOUR_CHAR_CODE('2vuy') /* UYVY 4:2:2 byte ordering 16*/
|
||||
};
|
||||
|
||||
/* Non Quickdraw.h pixel formats*/
|
||||
enum {
|
||||
kIO16LE4444PixelFormat = IO_FOUR_CHAR_CODE('L444'), /* 16 bit LE argb 4444*/
|
||||
kIO16BE4444PixelFormat = IO_FOUR_CHAR_CODE('B444'), /* 16 bit BE argb 4444*/
|
||||
kIO64BGRAPixelFormat = IO_FOUR_CHAR_CODE('B16I'), /* 64 bit bgra */
|
||||
kIO64RGBAFloatPixelFormat = IO_FOUR_CHAR_CODE('B16F'), /* 64 bit rgba */
|
||||
kIO128RGBAFloatPixelFormat = IO_FOUR_CHAR_CODE('B32F') /* 128 bit rgba float */
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOBlitMemoryRequiresHostFlush = 0x00000001
|
||||
};
|
||||
|
||||
typedef struct IOBlitSurfaceStruct {
|
||||
union {
|
||||
UInt8 * bytes;
|
||||
IOBlitMemoryRef ref;
|
||||
} memory;
|
||||
IOFourCharCode pixelFormat;
|
||||
IOBlitRectangle size;
|
||||
UInt32 rowBytes;
|
||||
UInt32 byteOffset;
|
||||
UInt32 * palette;
|
||||
IOOptionBits accessFlags;
|
||||
IOBlitMemoryRef interfaceRef;
|
||||
UInt32 more[14];
|
||||
} IOBlitSurface;
|
||||
|
||||
typedef IOBlitSurface IOBlitMemory;
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
enum {
|
||||
// options for Synchronize
|
||||
kIOBlitSynchronizeWaitBeamExit = 0x00000001,
|
||||
kIOBlitSynchronizeFlushHostWrites = 0x00000002
|
||||
};
|
||||
|
||||
enum {
|
||||
// options for WaitComplete & Flush
|
||||
kIOBlitWaitContext = 0x00000000,
|
||||
kIOBlitWaitAll2D = 0x00000001,
|
||||
kIOBlitWaitGlobal = 0x00000001,
|
||||
kIOBlitWaitAll = 0x00000002,
|
||||
kIOBlitWaitCheck = 0x00000080,
|
||||
kIOBlitFlushWithSwap = 0x00010000
|
||||
};
|
||||
|
||||
enum {
|
||||
// options for AllocateSurface
|
||||
kIOBlitHasCGSSurface = 0x00000001,
|
||||
kIOBlitFixedSource = 0x00000002,
|
||||
kIOBlitBeamSyncSwaps = 0x00000004,
|
||||
kIOBlitReferenceSource = 0x00000008
|
||||
};
|
||||
|
||||
enum {
|
||||
// options for UnlockSurface
|
||||
kIOBlitUnlockWithSwap = 0x80000000
|
||||
};
|
||||
|
||||
enum {
|
||||
// options for SetDestination
|
||||
kIOBlitFramebufferDestination = 0x00000000,
|
||||
kIOBlitSurfaceDestination = 0x00000001
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
// options for blit procs
|
||||
kIOBlitBeamSync = 0x00000001,
|
||||
kIOBlitBeamSyncAlways = 0x00000002,
|
||||
kIOBlitBeamSyncSpin = 0x00000004,
|
||||
|
||||
kIOBlitAllOptions = 0xffffffff
|
||||
};
|
||||
|
||||
enum {
|
||||
// capabilities
|
||||
kIOBlitColorSpaceTypes = IO_FOUR_CHAR_CODE('cspc')
|
||||
};
|
||||
|
||||
|
||||
// keys for IOAccelFindAccelerator()
|
||||
#define kIOAccelTypesKey "IOAccelTypes"
|
||||
#define kIOAccelIndexKey "IOAccelIndex"
|
||||
|
||||
#define kIOAccelRevisionKey "IOAccelRevision"
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#endif /* !_IOKIT_IOGRAPHICSINTERFACETYPES_H */
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOGRAPHICSLIB_H
|
||||
#define _IOKIT_IOGRAPHICSLIB_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/graphics/IOFramebufferShared.h>
|
||||
#include <IOKit/graphics/IOGraphicsInterface.h>
|
||||
|
||||
/*! @header IOGraphicsLib
|
||||
IOGraphicsLib implements non-kernel task access to IOGraphics family object types - IOFramebuffer and IOAccelerator. These functions implement a graphics family specific API.<br>
|
||||
A connection to a graphics IOService must be made before these functions are called. A connection is made with the IOServiceOpen() function described in IOKitLib.h. An io_connect_t handle is returned by IOServiceOpen(), which must be passed to the IOGraphicsLib functions. The appropriate connection type from IOGraphicsTypes.h must be specified in the call to IOServiceOpen(). All of the IOFramebuffer functions can only be called from a kIOFBServerConnectType connection. Except as specified below, functions whose names begin with IOFB are IOFramebuffer functions. Functions whose names begin with IOPS are IOAccelerator functions and must be called from connections of type kIOFBEngineControllerConnectType or kIOFBEngineConnectType.<br>
|
||||
The functions in IOGraphicsLib use a number of special types. The display mode is the screen's resolution and refresh rate. The known display modes are referred to by an index of type IODisplayModeID. The display depth is the number of significant color bits used in representing each pixel. Depths are also referred to by an index value that is 0 for 8 bits, 1 for 15 bits, and 2 for 24 bits. A combination of display mode and depth may have a number of supported pixel formats. The pixel aperture is an index of supported pixel formats for a display mode and depth. This index is of type IOPixelAperture. All of these graphics specific types are defined in IOGraphicsTypes.h.
|
||||
*/
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
extern kern_return_t
|
||||
IOFramebufferOpen(
|
||||
io_service_t service,
|
||||
task_port_t owningTask,
|
||||
unsigned int type,
|
||||
io_connect_t * connect );
|
||||
|
||||
/*! @enum IODisplayDictionaryOptions
|
||||
@constant kIODisplayMatchingInfo Include only the keys necessary to match two displays with IODisplayMatchDictionaries().
|
||||
@constant kIODisplayOnlyPreferredName The kDisplayProductName property includes only the localized names returned by CFBundleCopyPreferredLocalizationsFromArray().
|
||||
@constant kIODisplayNoProductName The kDisplayProductName property is not included in the returned dictionary.
|
||||
*/
|
||||
enum {
|
||||
kIODisplayMatchingInfo = 0x00000100,
|
||||
kIODisplayOnlyPreferredName = 0x00000200,
|
||||
kIODisplayNoProductName = 0x00000400
|
||||
};
|
||||
|
||||
/*! @function IODisplayCreateInfoDictionary
|
||||
@abstract Create a CFDictionary with information about display hardware.
|
||||
@discussion The CFDictionary created by this function contains information about the display hardware associated with a framebuffer. The keys for the dictionary are listed in IOGraphicsTypes.h.
|
||||
@param framebuffer The IOService handle for an IOFramebuffer service.
|
||||
@param options Use IODisplayDictionaryOptions to specify which keys to include.
|
||||
@result The returned CFDictionary that should be released by the caller with CFRelease(). */
|
||||
|
||||
CFDictionaryRef
|
||||
IODisplayCreateInfoDictionary(
|
||||
io_service_t framebuffer,
|
||||
IOOptionBits options );
|
||||
|
||||
/*! @defined IOCreateDisplayInfoDictionary
|
||||
@discussion IOCreateDisplayInfoDictionary() was renamed IODisplayCreateInfoDictionary(). IOCreateDisplayInfoDictionary() is now a macro for IODisplayCreateInfoDictionary() for compatibility with older code. */
|
||||
|
||||
#define IOCreateDisplayInfoDictionary(f,o) \
|
||||
IODisplayCreateInfoDictionary(f,o)
|
||||
|
||||
/*! @function IODisplayMatchDictionaries
|
||||
@abstract Match two display information dictionaries to see if they are for the same display.
|
||||
@discussion By comparing two CFDictionaries returned from IODisplayCreateInfoDictionary(), this function determines if the displays are the same. The information compared is what is returned by calling IODisplayCreateInfoDictionary() with an option of kIODisplayMatchingInfo. This includes information such as the vendor, product, and serial number.
|
||||
@param matching1 A CFDictionary returned from IODisplayCreateInfoDictionary().
|
||||
@param matching2 Another CFDictionary returned from IODisplayCreateInfoDictionary().
|
||||
@param options No options are currently defined.
|
||||
@result Returns FALSE if the two displays are not equivalent or TRUE if they are. */
|
||||
|
||||
SInt32
|
||||
IODisplayMatchDictionaries(
|
||||
CFDictionaryRef matching1,
|
||||
CFDictionaryRef matching2,
|
||||
IOOptionBits options );
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
io_service_t
|
||||
IODisplayForFramebuffer(
|
||||
io_service_t framebuffer,
|
||||
IOOptionBits options );
|
||||
|
||||
IOReturn
|
||||
IODisplaySetParameters(
|
||||
io_service_t service,
|
||||
IOOptionBits options,
|
||||
CFDictionaryRef params );
|
||||
|
||||
IOReturn
|
||||
IODisplaySetFloatParameter(
|
||||
io_service_t service,
|
||||
IOOptionBits options,
|
||||
CFStringRef parameterName,
|
||||
float value );
|
||||
IOReturn
|
||||
IODisplaySetIntegerParameter(
|
||||
io_service_t service,
|
||||
IOOptionBits options,
|
||||
CFStringRef parameterName,
|
||||
SInt32 value );
|
||||
|
||||
IOReturn
|
||||
IODisplayCopyParameters(
|
||||
io_service_t service,
|
||||
IOOptionBits options,
|
||||
CFDictionaryRef * params );
|
||||
|
||||
IOReturn
|
||||
IODisplayCopyFloatParameters(
|
||||
io_service_t service,
|
||||
IOOptionBits options,
|
||||
CFDictionaryRef * params );
|
||||
|
||||
IOReturn
|
||||
IODisplayGetFloatParameter(
|
||||
io_service_t service,
|
||||
IOOptionBits options,
|
||||
CFStringRef parameterName,
|
||||
float * value );
|
||||
|
||||
IOReturn
|
||||
IODisplayGetIntegerRangeParameter(
|
||||
io_service_t service,
|
||||
IOOptionBits options,
|
||||
CFStringRef parameterName,
|
||||
SInt32 * value,
|
||||
SInt32 * min,
|
||||
SInt32 * max );
|
||||
|
||||
IOReturn
|
||||
IODisplayCommitParameters(
|
||||
io_service_t service,
|
||||
IOOptionBits options );
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ! _IOKIT_IOGRAPHICSLIB_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDBASE_H_
|
||||
#define _IOKIT_HID_IOHIDBASE_H_
|
||||
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
#include <IOKit/IOTypes.h> /* IOOptionBits */
|
||||
#include <stdint.h> /* uint32_t */
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
/*! @typedef IOHIDDeviceRef
|
||||
This is the type of a reference to the IOHIDDevice.
|
||||
*/
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDDevice * IOHIDDeviceRef;
|
||||
|
||||
/*! @typedef IOHIDElementRef
|
||||
This is the type of a reference to the IOHIDElement.
|
||||
*/
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDElement * IOHIDElementRef;
|
||||
|
||||
/*! @typedef IOHIDValueRef
|
||||
This is the type of a reference to the IOHIDValue.
|
||||
*/
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDValue * IOHIDValueRef;
|
||||
|
||||
/*!
|
||||
@typedef IOHIDTransactionDirectionType
|
||||
@abstract Direction for an IOHIDDeviceTransactionInterface.
|
||||
@constant kIOHIDTransactionDirectionTypeInput Transaction direction used for requesting element values from a device.
|
||||
@constant kIOHIDTransactionDirectionTypeOutput Transaction direction used for dispatching element values to a device.
|
||||
*/
|
||||
typedef CF_ENUM(uint32_t, IOHIDTransactionDirectionType) {
|
||||
kIOHIDTransactionDirectionTypeInput,
|
||||
kIOHIDTransactionDirectionTypeOutput
|
||||
};
|
||||
|
||||
/*!
|
||||
@enum IOHIDTransactionOption
|
||||
@abstract Options to be used in conjuntion with an IOHIDDeviceTransactionInterface.
|
||||
@constant kIOHIDTransactionOptionDefaultOutputValue Option to set the default element value to be used with an
|
||||
IOHIDDeviceTransactionInterface of direction kIOHIDTransactionDirectionTypeOutput.
|
||||
*/
|
||||
static const IOOptionBits kIOHIDTransactionOptionDefaultOutputValue = 0x0001;
|
||||
|
||||
|
||||
/*! @typedef IOHIDCallback
|
||||
@discussion Type and arguments of callout C function that is used when a completion routine is called.
|
||||
@param context void * pointer to your data, often a pointer to an object.
|
||||
@param result Completion result of desired operation.
|
||||
@param refcon void * pointer to more data.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
*/
|
||||
typedef void (*IOHIDCallback)(
|
||||
void * _Nullable context,
|
||||
IOReturn result,
|
||||
void * _Nullable sender);
|
||||
|
||||
/*! @typedef IOHIDReportCallback
|
||||
@discussion Type and arguments of callout C function that is used when a HID report completion routine is called.
|
||||
@param context void * pointer to your data, often a pointer to an object.
|
||||
@param result Completion result of desired operation.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
@param type The type of the report that was completed.
|
||||
@param reportID The ID of the report that was completed.
|
||||
@param report Pointer to the buffer containing the contents of the report.
|
||||
@param reportLength Size of the buffer received upon completion.
|
||||
*/
|
||||
typedef void (*IOHIDReportCallback) (
|
||||
void * _Nullable context,
|
||||
IOReturn result,
|
||||
void * _Nullable sender,
|
||||
IOHIDReportType type,
|
||||
uint32_t reportID,
|
||||
uint8_t * report,
|
||||
CFIndex reportLength);
|
||||
|
||||
/*! @typedef IOHIDReportCallback
|
||||
@discussion Type and arguments of callout C function that is used when a HID report completion routine is called.
|
||||
@param context void * pointer to your data, often a pointer to an object.
|
||||
@param result Completion result of desired operation.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
@param type The type of the report that was completed.
|
||||
@param reportID The ID of the report that was completed.
|
||||
@param report Pointer to the buffer containing the contents of the report.
|
||||
@param reportLength Size of the buffer received upon completion.
|
||||
@param timeStamp The time at which the report arrived.
|
||||
*/
|
||||
typedef void (*IOHIDReportWithTimeStampCallback) (
|
||||
void * _Nullable context,
|
||||
IOReturn result,
|
||||
void * _Nullable sender,
|
||||
IOHIDReportType type,
|
||||
uint32_t reportID,
|
||||
uint8_t * report,
|
||||
CFIndex reportLength,
|
||||
uint64_t timeStamp);
|
||||
|
||||
/*! @typedef IOHIDValueCallback
|
||||
@discussion Type and arguments of callout C function that is used when an element value completion routine is called.
|
||||
@param context void * pointer to more data.
|
||||
@param result Completion result of desired operation.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
@param value IOHIDValueRef containing the returned element value.
|
||||
*/
|
||||
typedef void (*IOHIDValueCallback) (
|
||||
void * _Nullable context,
|
||||
IOReturn result,
|
||||
void * _Nullable sender,
|
||||
IOHIDValueRef value);
|
||||
|
||||
/*! @typedef IOHIDValueMultipleCallback
|
||||
@discussion Type and arguments of callout C function that is used when an element value completion routine is called.
|
||||
@param context void * pointer to more data.
|
||||
@param result Completion result of desired operation.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
@param multiple CFDictionaryRef containing the returned element key value pairs.
|
||||
*/
|
||||
typedef void (*IOHIDValueMultipleCallback) (
|
||||
void * _Nullable context,
|
||||
IOReturn result,
|
||||
void * _Nullable sender,
|
||||
CFDictionaryRef multiple);
|
||||
|
||||
/*! @typedef IOHIDDeviceCallback
|
||||
@discussion Type and arguments of callout C function that is used when a device routine is called.
|
||||
@param context void * pointer to more data.
|
||||
@param result Completion result of desired operation.
|
||||
@param device IOHIDDeviceRef containing the sending device.
|
||||
*/
|
||||
typedef void (*IOHIDDeviceCallback) (
|
||||
void * _Nullable context,
|
||||
IOReturn result,
|
||||
void * _Nullable sender,
|
||||
IOHIDDeviceRef device);
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDBASE_H_ */
|
||||
@@ -0,0 +1,806 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDDEVICE_USER_H
|
||||
#define _IOKIT_HID_IOHIDDEVICE_USER_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/hid/IOHIDBase.h>
|
||||
|
||||
/*!
|
||||
@header IOHIDDevice
|
||||
IOHIDDevice defines a Human Interface Device (HID) object, which interacts
|
||||
with an IOHIDDevicePlugIn object that typically maps to an object in the
|
||||
kernel. IOHIDDevice is used to communicate with a single HID device in
|
||||
order to obtain or set device properties, element values, and reports.
|
||||
IOHIDDevice is also a CFType object and as such conforms to all the
|
||||
conventions expected such object.
|
||||
<p>
|
||||
All of the information described in this document is contained in the header
|
||||
file <font face="Courier New,Courier,Monaco">IOHIDDevice.h</font> found at
|
||||
<font face="Courier New,Courier,Monaco">/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDDevice.h</font>.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceGetTypeID
|
||||
@abstract Returns the type identifier of all IOHIDDevice instances.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeID IOHIDDeviceGetTypeID(void)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceCreate
|
||||
@abstract Creates an element from an io_service_t.
|
||||
@discussion The io_service_t passed in this method must reference an object
|
||||
in the kernel of type IOHIDDevice.
|
||||
@param allocator Allocator to be used during creation.
|
||||
@param service Reference to service object in the kernel.
|
||||
@result Returns a new IOHIDDeviceRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDDeviceRef _Nullable IOHIDDeviceCreate(
|
||||
CFAllocatorRef _Nullable allocator,
|
||||
io_service_t service)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceGetService
|
||||
@abstract Returns the io_service_t for an IOHIDDevice, if it has one.
|
||||
@discussion If the IOHIDDevice references an object in the kernel, this is
|
||||
used to get the io_service_t for that object.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@result Returns the io_service_t if the IOHIDDevice has one, or
|
||||
MACH_PORT_NULL if it does not.
|
||||
*/
|
||||
CF_EXPORT
|
||||
io_service_t IOHIDDeviceGetService(
|
||||
IOHIDDeviceRef device)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceOpen
|
||||
@abstract Opens a HID device for communication.
|
||||
@discussion Before the client can issue commands that change the state of
|
||||
the device, it must have succeeded in opening the device. This
|
||||
establishes a link between the client's task and the actual
|
||||
device. To establish an exclusive link use the
|
||||
kIOHIDOptionsTypeSeizeDevice option.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param options Option bits to be sent down to the device.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceOpen(
|
||||
IOHIDDeviceRef device,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceClose
|
||||
@abstract Closes communication with a HID device.
|
||||
@discussion This closes a link between the client's task and the actual
|
||||
device.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param options Option bits to be sent down to the device.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceClose(
|
||||
IOHIDDeviceRef device,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceConformsTo
|
||||
@abstract Convenience function that scans the Application Collection
|
||||
elements to see if it conforms to the provided usagePage
|
||||
and usage.
|
||||
@discussion Examples of Application Collection usages pairs are:
|
||||
<br>
|
||||
usagePage = kHIDPage_GenericDesktop <br>
|
||||
usage = kHIDUsage_GD_Mouse
|
||||
<br>
|
||||
<b>or</b>
|
||||
<br>
|
||||
usagePage = kHIDPage_GenericDesktop <br>
|
||||
usage = kHIDUsage_GD_Keyboard
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param usagePage Device usage page
|
||||
@param usage Device usage
|
||||
@result Returns TRUE if device conforms to provided usage.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDDeviceConformsTo(
|
||||
IOHIDDeviceRef device,
|
||||
uint32_t usagePage,
|
||||
uint32_t usage)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceGetProperty
|
||||
@abstract Obtains a property from an IOHIDDevice.
|
||||
@discussion Property keys are prefixed by kIOHIDDevice and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param key CFStringRef containing key to be used when querying the
|
||||
device.
|
||||
@result Returns CFTypeRef containing the property.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeRef _Nullable IOHIDDeviceGetProperty(
|
||||
IOHIDDeviceRef device,
|
||||
CFStringRef key)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceSetProperty
|
||||
@abstract Sets a property for an IOHIDDevice.
|
||||
@discussion Property keys are prefixed by kIOHIDDevice and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param key CFStringRef containing key to be used when modifiying the
|
||||
device property.
|
||||
@param property CFTypeRef containg the property to be set.
|
||||
@result Returns TRUE if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDDeviceSetProperty(
|
||||
IOHIDDeviceRef device,
|
||||
CFStringRef key,
|
||||
CFTypeRef property)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDDeviceCopyMatchingElements
|
||||
@abstract Obtains HID elements that match the criteria contained in the
|
||||
matching dictionary.
|
||||
@discussion Matching keys are prefixed by kIOHIDElement and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>. Passing a NULL dictionary will result
|
||||
in all device elements being returned.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param matching CFDictionaryRef containg element matching criteria.
|
||||
@param options Reserved for future use.
|
||||
@result Returns CFArrayRef containing multiple IOHIDElement object.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFArrayRef _Nullable IOHIDDeviceCopyMatchingElements(
|
||||
IOHIDDeviceRef device,
|
||||
CFDictionaryRef _Nullable matching,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceScheduleWithRunLoop
|
||||
@abstract Schedules HID device with run loop.
|
||||
@discussion Formally associates device with client's run loop. Scheduling
|
||||
this device with the run loop is necessary before making use of
|
||||
any asynchronous APIs.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param runLoop RunLoop to be used when scheduling any asynchronous
|
||||
activity.
|
||||
@param runLoopMode Run loop mode to be used when scheduling any
|
||||
asynchronous activity.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceScheduleWithRunLoop(
|
||||
IOHIDDeviceRef device,
|
||||
CFRunLoopRef runLoop,
|
||||
CFStringRef runLoopMode)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceUnscheduleFromRunLoop
|
||||
@abstract Unschedules HID device with run loop.
|
||||
@discussion Formally disassociates device with client's run loop.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param runLoop RunLoop to be used when unscheduling any asynchronous
|
||||
activity.
|
||||
@param runLoopMode Run loop mode to be used when unscheduling any
|
||||
asynchronous activity.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceUnscheduleFromRunLoop(
|
||||
IOHIDDeviceRef device,
|
||||
CFRunLoopRef runLoop,
|
||||
CFStringRef runLoopMode)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
* @function IOHIDDeviceSetDispatchQueue
|
||||
*
|
||||
* @abstract
|
||||
* Sets the dispatch queue to be associated with the IOHIDDevice.
|
||||
* This is necessary in order to receive asynchronous events from the kernel.
|
||||
*
|
||||
* @discussion
|
||||
* An IOHIDDevice should not be associated with both a runloop and
|
||||
* dispatch queue. A call to IOHIDDeviceSetDispatchQueue should only be made once.
|
||||
*
|
||||
* After a dispatch queue is set, the IOHIDDevice must make a call to activate
|
||||
* via IOHIDDeviceActivate and cancel via IOHIDDeviceCancel. All calls to "Register"
|
||||
* functions should be done before activation and not after cancellation.
|
||||
*
|
||||
* @param device
|
||||
* Reference to an IOHIDDevice
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the event handler block will be submitted.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceSetDispatchQueue(
|
||||
IOHIDDeviceRef device,
|
||||
dispatch_queue_t queue)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDDeviceSetCancelHandler
|
||||
*
|
||||
* @abstract
|
||||
* Sets a cancellation handler for the dispatch queue associated with
|
||||
* IOHIDDeviceSetDispatchQueue.
|
||||
*
|
||||
* @discussion
|
||||
* The cancellation handler (if specified) will be will be submitted to the
|
||||
* device's dispatch queue in response to a call to IOHIDDeviceCancel after
|
||||
* all the events have been handled.
|
||||
*
|
||||
* IOHIDDeviceSetCancelHandler should not be used when scheduling with
|
||||
* a run loop.
|
||||
*
|
||||
* The IOHIDDeviceRef should only be released after the device has been
|
||||
* cancelled, and the cancel handler has been called. This is to ensure all
|
||||
* asynchronous objects are released. For example:
|
||||
*
|
||||
* dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
|
||||
* CFRelease(device);
|
||||
* });
|
||||
* IOHIDDeviceSetCancelHandler(device, cancelHandler);
|
||||
* IOHIDDeviceActivate(device);
|
||||
* IOHIDDeviceCancel(device);
|
||||
*
|
||||
* @param device
|
||||
* Reference to an IOHIDDevice.
|
||||
*
|
||||
* @param handler
|
||||
* The cancellation handler block to be associated with the dispatch queue.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceSetCancelHandler(
|
||||
IOHIDDeviceRef device,
|
||||
dispatch_block_t handler)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDDeviceActivate
|
||||
*
|
||||
* @abstract
|
||||
* Activates the IOHIDDevice object.
|
||||
*
|
||||
* @discussion
|
||||
* An IOHIDDevice object associated with a dispatch queue is created
|
||||
* in an inactive state. The object must be activated in order to
|
||||
* receive asynchronous events from the kernel.
|
||||
*
|
||||
* A dispatch queue must be set via IOHIDDeviceSetDispatchQueue before
|
||||
* activation.
|
||||
*
|
||||
* An activated device must be cancelled via IOHIDDeviceCancel. All calls
|
||||
* to "Register" functions should be done before activation
|
||||
* and not after cancellation.
|
||||
*
|
||||
* Calling IOHIDDeviceActivate on an active IOHIDDevice has no effect.
|
||||
*
|
||||
* @param device
|
||||
* Reference to an IOHIDDevice
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceActivate(
|
||||
IOHIDDeviceRef device)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDDeviceCancel
|
||||
*
|
||||
* @abstract
|
||||
* Cancels the IOHIDDevice preventing any further invocation
|
||||
* of its event handler block.
|
||||
*
|
||||
* @discussion
|
||||
* Cancelling prevents any further invocation of the event handler block for
|
||||
* the specified dispatch queue, but does not interrupt an event handler
|
||||
* block that is already in progress.
|
||||
*
|
||||
* Explicit cancellation of the IOHIDDevice is required, no implicit
|
||||
* cancellation takes place.
|
||||
*
|
||||
* Calling IOHIDDeviceCancel on an already cancelled queue has no effect.
|
||||
*
|
||||
* The IOHIDDeviceRef should only be released after the device has been
|
||||
* cancelled, and the cancel handler has been called. This is to ensure all
|
||||
* asynchronous objects are released. For example:
|
||||
*
|
||||
* dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
|
||||
* CFRelease(device);
|
||||
* });
|
||||
* IOHIDDeviceSetCancelHandler(device, cancelHandler);
|
||||
* IOHIDDeviceActivate(device);
|
||||
* IOHIDDeviceCancel(device);
|
||||
*
|
||||
* @param device
|
||||
* Reference to an IOHIDDevice
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceCancel(
|
||||
IOHIDDeviceRef device)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*! @function IOHIDDeviceRegisterRemovalCallback
|
||||
@abstract Registers a callback to be used when a IOHIDDevice is removed.
|
||||
@discussion In most cases this occurs when a device is unplugged.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param callback Pointer to a callback method of type IOHIDCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceRegisterRemovalCallback(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceRegisterInputValueCallback
|
||||
@abstract Registers a callback to be used when an input value is issued by
|
||||
the device.
|
||||
@discussion An input element refers to any element of type
|
||||
kIOHIDElementTypeInput and is usually issued by interrupt driven
|
||||
reports. If more specific element values are desired, you can
|
||||
specify matching criteria via IOHIDDeviceSetInputValueMatching
|
||||
and IOHIDDeviceSetInputValueMatchingMultiple.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param callback Pointer to a callback method of type IOHIDValueCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceRegisterInputValueCallback(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDValueCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceRegisterInputReportCallback
|
||||
@abstract Registers a callback to be used when an input report is issued
|
||||
by the device.
|
||||
@discussion An input report is an interrupt driver report issued by the
|
||||
device.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param report Pointer to preallocated buffer in which to copy inbound
|
||||
report data.
|
||||
@param reportLength Length of preallocated buffer.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDReportCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceRegisterInputReportCallback(
|
||||
IOHIDDeviceRef device,
|
||||
uint8_t * report,
|
||||
CFIndex reportLength,
|
||||
IOHIDReportCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceRegisterInputReportWithTimeStampCallback
|
||||
@abstract Registers a timestamped callback to be used when an input report is issued
|
||||
by the device.
|
||||
@discussion An input report is an interrupt driver report issued by the
|
||||
device.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param report Pointer to preallocated buffer in which to copy inbound
|
||||
report data.
|
||||
@param reportLength Length of preallocated buffer.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDReportWithTimeStampCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceRegisterInputReportWithTimeStampCallback(
|
||||
IOHIDDeviceRef device,
|
||||
uint8_t * report,
|
||||
CFIndex reportLength,
|
||||
IOHIDReportWithTimeStampCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_10_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceSetInputValueMatching
|
||||
@abstract Sets matching criteria for input values received via
|
||||
IOHIDDeviceRegisterInputValueCallback.
|
||||
@discussion Matching keys are prefixed by kIOHIDElement and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>. Passing a NULL dictionary will result
|
||||
in all devices being enumerated. Any subsequent calls will cause
|
||||
the hid manager to release previously matched input elements and
|
||||
restart the matching process using the revised criteria. If
|
||||
interested in multiple, specific device elements, please defer to
|
||||
using IOHIDDeviceSetInputValueMatchingMultiple.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param matching CFDictionaryRef containg device matching criteria.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceSetInputValueMatching(
|
||||
IOHIDDeviceRef device,
|
||||
CFDictionaryRef _Nullable matching)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceSetInputValueMatchingMultiple
|
||||
@abstract Sets multiple matching criteria for input values received via
|
||||
IOHIDDeviceRegisterInputValueCallback.
|
||||
@discussion Matching keys are prefixed by kIOHIDElement and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>. This method is useful if interested
|
||||
in multiple, specific elements.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param multiple CFArrayRef containing multiple CFDictionaryRef objects
|
||||
containg input element matching criteria.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDDeviceSetInputValueMatchingMultiple(
|
||||
IOHIDDeviceRef device,
|
||||
CFArrayRef _Nullable multiple)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceSetValue
|
||||
@abstract Sets a value for an element.
|
||||
@discussion This method behaves synchronously and will block until the
|
||||
report has been issued to the device. It is only relevent for
|
||||
either output or feature type elements. If setting values for
|
||||
multiple elements you may want to consider using
|
||||
IOHIDDeviceSetValueMultiple or IOHIDTransaction.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param element IOHIDElementRef whose value is to be modified.
|
||||
@param value IOHIDValueRef containing value to be set.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceSetValue(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDElementRef element,
|
||||
IOHIDValueRef value)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceSetValueMultiple
|
||||
@abstract Sets multiple values for multiple elements.
|
||||
@discussion This method behaves synchronously and will block until the
|
||||
report has been issued to the device. It is only relevent for
|
||||
either output or feature type elements.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param multiple CFDictionaryRef where key is IOHIDElementRef and
|
||||
value is IOHIDValueRef.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceSetValueMultiple(
|
||||
IOHIDDeviceRef device,
|
||||
CFDictionaryRef multiple)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceSetValueWithCallback
|
||||
@abstract Sets a value for an element and returns status via a completion
|
||||
callback.
|
||||
@discussion This method behaves asynchronously and will invoke the callback
|
||||
once the report has been issued to the device. It is only
|
||||
relevent for either output or feature type elements.
|
||||
If setting values for multiple elements you may want to
|
||||
consider using IOHIDDeviceSetValueWithCallback or
|
||||
IOHIDTransaction.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param element IOHIDElementRef whose value is to be modified.
|
||||
@param value IOHIDValueRef containing value to be set.
|
||||
@param timeout CFTimeInterval containing the timeout.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDValueCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceSetValueWithCallback(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDElementRef element,
|
||||
IOHIDValueRef value,
|
||||
CFTimeInterval timeout,
|
||||
IOHIDValueCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceSetValueMultipleWithCallback
|
||||
@abstract Sets multiple values for multiple elements and returns status
|
||||
via a completion callback.
|
||||
@discussion This method behaves asynchronously and will invoke the callback
|
||||
once the report has been issued to the device. It is only
|
||||
relevent for either output or feature type elements.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param multiple CFDictionaryRef where key is IOHIDElementRef and
|
||||
value is IOHIDValueRef.
|
||||
@param timeout CFTimeInterval containing the timeout.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDValueMultipleCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceSetValueMultipleWithCallback(
|
||||
IOHIDDeviceRef device,
|
||||
CFDictionaryRef multiple,
|
||||
CFTimeInterval timeout,
|
||||
IOHIDValueMultipleCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceGetValue
|
||||
@abstract Gets a value for an element.
|
||||
@discussion This method behaves synchronously and return back immediately
|
||||
for input type element. If requesting a value for a feature
|
||||
element, this will block until the report has been issued to the
|
||||
device. If obtaining values for multiple elements you may want
|
||||
to consider using IOHIDDeviceCopyValueMultiple or IOHIDTransaction.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param element IOHIDElementRef whose value is to be obtained.
|
||||
@param pValue Pointer to IOHIDValueRef to be obtained.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceGetValue(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDElementRef element,
|
||||
IOHIDValueRef _Nonnull * _Nonnull pValue)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
|
||||
typedef CF_ENUM(uint32_t, IOHIDDeviceGetValueOptions) {
|
||||
kIOHIDDeviceGetValueWithUpdate = 0x00020000, // force value update (get report will be send to the device)
|
||||
kIOHIDDeviceGetValueWithoutUpdate = 0x00040000 // get last value
|
||||
};
|
||||
|
||||
|
||||
/*! @function IOHIDDeviceGetValueWithOptions
|
||||
@abstract Gets a value for an element.
|
||||
@discussion This method behaves synchronously and return back immediately
|
||||
for input type element. If requesting a value for a feature
|
||||
element, this will block until the report has been issued to the
|
||||
device. If obtaining values for multiple elements you may want
|
||||
to consider using IOHIDDeviceCopyValueMultiple or IOHIDTransaction.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param element IOHIDElementRef whose value is to be obtained.
|
||||
@param pValue Pointer to IOHIDValueRef to be obtained.
|
||||
@param options (see IOHIDDeviceGetValueOptions).
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
IOReturn IOHIDDeviceGetValueWithOptions (
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDElementRef element,
|
||||
IOHIDValueRef _Nonnull * _Nonnull pValue,
|
||||
uint32_t options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceCopyValueMultiple
|
||||
@abstract Copies a values for multiple elements.
|
||||
@discussion This method behaves synchronously and return back immediately
|
||||
for input type element. If requesting a value for a feature
|
||||
element, this will block until the report has been issued to the
|
||||
device.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param elements CFArrayRef containing multiple IOHIDElementRefs whose
|
||||
values are to be obtained.
|
||||
@param pMultiple Pointer to CFDictionaryRef where the keys are the
|
||||
provided elements and the values are the requested values.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceCopyValueMultiple(
|
||||
IOHIDDeviceRef device,
|
||||
CFArrayRef elements,
|
||||
CFDictionaryRef _Nullable * _Nullable pMultiple)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceGetValueWithCallback
|
||||
@abstract Gets a value for an element and returns status via a completion
|
||||
callback.
|
||||
@discussion This method behaves asynchronusly and is only relevent for
|
||||
either output or feature type elements. If obtaining values for
|
||||
multiple elements you may want to consider using
|
||||
IOHIDDeviceCopyValueMultipleWithCallback or IOHIDTransaction.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param element IOHIDElementRef whose value is to be obtained.
|
||||
@param pValue Pointer to IOHIDValueRef to be passedback.
|
||||
@param timeout CFTimeInterval containing the timeout.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDValueCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceGetValueWithCallback(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDElementRef element,
|
||||
IOHIDValueRef _Nonnull * _Nonnull pValue,
|
||||
CFTimeInterval timeout,
|
||||
IOHIDValueCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
|
||||
/*! @function IOHIDDeviceCopyValueMultipleWithCallback
|
||||
@abstract Copies a values for multiple elements and returns status via a
|
||||
completion callback.
|
||||
@discussion This method behaves asynchronusly and is only relevent for
|
||||
either output or feature type elements.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param elements CFArrayRef containing multiple IOHIDElementRefs whose
|
||||
values are to be obtained.
|
||||
@param pMultiple Pointer to CFDictionaryRef where the keys are the
|
||||
provided elements and the values are the requested values.
|
||||
@param timeout CFTimeInterval containing the timeout.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDValueMultipleCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
|
||||
IOReturn IOHIDDeviceCopyValueMultipleWithCallback(
|
||||
IOHIDDeviceRef device,
|
||||
CFArrayRef elements,
|
||||
CFDictionaryRef _Nullable * _Nullable pMultiple,
|
||||
CFTimeInterval timeout,
|
||||
IOHIDValueMultipleCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceSetReport
|
||||
@abstract Sends a report to the device.
|
||||
@discussion This method behaves synchronously and will block until the
|
||||
report has been issued to the device. It is only relevent for
|
||||
either output or feature type reports.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param reportType Type of report being sent.
|
||||
@param reportID ID of the report being sent. If the device supports
|
||||
multiple reports, this should also be set in the first byte of
|
||||
the report.
|
||||
@param report The report bytes to be sent to the device.
|
||||
@param reportLength The length of the report to be sent to the device.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceSetReport(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDReportType reportType,
|
||||
CFIndex reportID,
|
||||
const uint8_t * report,
|
||||
CFIndex reportLength)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceSetReportWithCallback
|
||||
@abstract Sends a report to the device.
|
||||
@discussion This method behaves asynchronously and will block until the
|
||||
report has been issued to the device. It is only relevent for
|
||||
either output or feature type reports.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param reportType Type of report being sent.
|
||||
@param reportID ID of the report being sent. If the device supports
|
||||
multiple reports, this should also be set in the first byte of
|
||||
the report.
|
||||
@param report The report bytes to be sent to the device.
|
||||
@param reportLength The length of the report to be sent to the device.
|
||||
@param timeout CFTimeInterval containing the timeout.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDReportCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceSetReportWithCallback(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDReportType reportType,
|
||||
CFIndex reportID,
|
||||
const uint8_t * report,
|
||||
CFIndex reportLength,
|
||||
CFTimeInterval timeout,
|
||||
IOHIDReportCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceGetReport
|
||||
@abstract Obtains a report from the device.
|
||||
@discussion This method behaves synchronously and will block until the
|
||||
report has been received from the device. This is only intended
|
||||
for feature reports because of sporadic devicesupport for
|
||||
polling input reports. Please defer to using
|
||||
IOHIDDeviceRegisterInputReportCallback for obtaining input
|
||||
reports.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param reportType Type of report being requested.
|
||||
@param reportID ID of the report being requested.
|
||||
@param report Pointer to preallocated buffer in which to copy inbound
|
||||
report data.
|
||||
@param pReportLength Pointer to length of preallocated buffer. This
|
||||
value will be modified to refect the length of the returned
|
||||
report.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceGetReport(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDReportType reportType,
|
||||
CFIndex reportID,
|
||||
uint8_t * report,
|
||||
CFIndex * pReportLength)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDDeviceGetReportWithCallback
|
||||
@abstract Obtains a report from the device.
|
||||
@discussion This method behaves asynchronously and will block until the
|
||||
report has been received from the device. This is only intended
|
||||
for feature reports because of sporadic devicesupport for
|
||||
polling input reports. Please defer to using
|
||||
IOHIDDeviceRegisterInputReportCallback for obtaining input
|
||||
reports.
|
||||
@param device Reference to an IOHIDDevice.
|
||||
@param reportType Type of report being requested.
|
||||
@param reportID ID of the report being requested.
|
||||
@param report Pointer to preallocated buffer in which to copy inbound
|
||||
report data.
|
||||
@param pReportLength Pointer to length of preallocated buffer.
|
||||
@param pReportLength Pointer to length of preallocated buffer. This
|
||||
value will be modified to refect the length of the returned
|
||||
report.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDReportCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDDeviceGetReportWithCallback(
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDReportType reportType,
|
||||
CFIndex reportID,
|
||||
uint8_t * report,
|
||||
CFIndex * pReportLength,
|
||||
CFTimeInterval timeout,
|
||||
IOHIDReportCallback callback,
|
||||
void * context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDDEVICE_USER_H */
|
||||
@@ -0,0 +1,228 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 2019 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef IOHIDDeviceKeys_h
|
||||
#define IOHIDDeviceKeys_h
|
||||
|
||||
/*!
|
||||
* @define kIOHIDTransportKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the transport of the device.
|
||||
*/
|
||||
#define kIOHIDTransportKey "Transport"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDVendorIDKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the vendor ID of the device.
|
||||
*/
|
||||
#define kIOHIDVendorIDKey "VendorID"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDProductIDKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the product ID of the device.
|
||||
*/
|
||||
#define kIOHIDProductIDKey "ProductID"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDVersionNumberKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the version number of the device.
|
||||
*/
|
||||
#define kIOHIDVersionNumberKey "VersionNumber"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDManufacturerKey
|
||||
*
|
||||
* @abstract
|
||||
* String property that describes the manufacturer of the device.
|
||||
*/
|
||||
#define kIOHIDManufacturerKey "Manufacturer"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDProductKey
|
||||
*
|
||||
* @abstract
|
||||
* String property that describes the product of the device.
|
||||
*/
|
||||
#define kIOHIDProductKey "Product"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDSerialNumberKey
|
||||
*
|
||||
* @abstract
|
||||
* String property that describes the serial number of the device.
|
||||
*/
|
||||
#define kIOHIDSerialNumberKey "SerialNumber"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDCountryCodeKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the country code of the device.
|
||||
*/
|
||||
#define kIOHIDCountryCodeKey "CountryCode"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDLocationIDKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the location ID of the device.
|
||||
*/
|
||||
#define kIOHIDLocationIDKey "LocationID"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDDeviceUsagePairsKey
|
||||
*
|
||||
* @abstract
|
||||
* Array property that describes the top level usages of the device. The array
|
||||
* will have dictionaries of usage pages/usages of each top level collection
|
||||
* that exists on the device.
|
||||
*/
|
||||
#define kIOHIDDeviceUsagePairsKey "DeviceUsagePairs"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDDeviceUsageKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property used in the device usage pairs array above. Describes a
|
||||
* usage of the device.
|
||||
*/
|
||||
#define kIOHIDDeviceUsageKey "DeviceUsage"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDDeviceUsagePageKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property used in the device usage pairs array above. Describes a
|
||||
* usage page of the device.
|
||||
*/
|
||||
#define kIOHIDDeviceUsagePageKey "DeviceUsagePage"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDPrimaryUsageKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the primary usage page of the device.
|
||||
*/
|
||||
#define kIOHIDPrimaryUsageKey "PrimaryUsage"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDPrimaryUsagePageKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the primary usage of the device.
|
||||
*/
|
||||
#define kIOHIDPrimaryUsagePageKey "PrimaryUsagePage"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDMaxInputReportSizeKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the max input report size of the device. This
|
||||
* is derived from the report descriptor data provided in the
|
||||
* kIOHIDReportDescriptorKey key.
|
||||
*/
|
||||
#define kIOHIDMaxInputReportSizeKey "MaxInputReportSize"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDMaxOutputReportSizeKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the max output report size of the device. This
|
||||
* is derived from the report descriptor data provided in the
|
||||
* kIOHIDReportDescriptorKey key.
|
||||
*/
|
||||
#define kIOHIDMaxOutputReportSizeKey "MaxOutputReportSize"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDMaxFeatureReportSizeKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the max feature report size of the device.
|
||||
* This is derived from the report descriptor data provided in the
|
||||
* kIOHIDReportDescriptorKey key.
|
||||
*/
|
||||
#define kIOHIDMaxFeatureReportSizeKey "MaxFeatureReportSize"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDReportIntervalKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property set on the device from a client that describes the interval in us
|
||||
* at which the client wishes to receive reports. It is up to the device to
|
||||
* determine how to handle this key, if it chooses to do so.
|
||||
*/
|
||||
#define kIOHIDReportIntervalKey "ReportInterval"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDBatchIntervalKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property set on the device from a client that describes the interval
|
||||
* at which the client wishes to receive batched reports. It is up to the device
|
||||
* to determine how to handle this key, if it chooses to do so.
|
||||
*/
|
||||
#define kIOHIDBatchIntervalKey "BatchInterval"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDRequestTimeoutKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the request timeout in us for get/setReport calls.
|
||||
* It is up to the device to determine how to handle this key, if it chooses to
|
||||
* do so.
|
||||
*/
|
||||
#define kIOHIDRequestTimeoutKey "RequestTimeout"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDReportDescriptorKey
|
||||
*
|
||||
* @abstract
|
||||
* Data property that describes the report descriptor of the device.
|
||||
*/
|
||||
#define kIOHIDReportDescriptorKey "ReportDescriptor"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDBuiltInKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes if the device is built in.
|
||||
*/
|
||||
#define kIOHIDBuiltInKey "Built-In"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDPhysicalDeviceUniqueIDKey
|
||||
*
|
||||
* @abstract
|
||||
* String property that describes a unique identifier of the device.
|
||||
*/
|
||||
#define kIOHIDPhysicalDeviceUniqueIDKey "PhysicalDeviceUniqueID"
|
||||
|
||||
#endif /* IOHIDDeviceKeys_h */
|
||||
@@ -0,0 +1,657 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDDEVICEPLUGIN_H
|
||||
#define _IOKIT_HID_IOHIDDEVICEPLUGIN_H
|
||||
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#if COREFOUNDATION_CFPLUGINCOM_SEPARATE
|
||||
#include <CoreFoundation/CFPlugInCOM.h>
|
||||
#endif
|
||||
|
||||
#include <IOKit/IOTypes.h>
|
||||
#include <IOKit/IOReturn.h>
|
||||
#include <IOKit/IOCFPlugIn.h>
|
||||
#include <IOKit/hid/IOHIDBase.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
#include <IOKit/hid/IOHIDLibObsolete.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
/*! @header IOHIDDevicePlugIn
|
||||
This documentation describes the details of the programming interface for accessing Human Interface Devices and
|
||||
interfaces from code running in user space. It is intended that user mode HID drivers properly inplement all
|
||||
interfaces described here in order to be visible via the HID Manager.
|
||||
<p>
|
||||
This documentation assumes that you have a basic understanding
|
||||
of the material contained in <a href="http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/index.html"><i>Accessing Hardware From Applications</i></a>
|
||||
For definitions of I/O Kit terms used in this documentation, such as matching dictionary, family, and driver, see the overview of I/O Kit terms and concepts
|
||||
in the "Device Access and the I/O Kit" chapter of <i>Accessing Hardware From Applications</i>.
|
||||
|
||||
This documentation also assumes you have read <a href="http://developer.apple.com/documentation/DeviceDrivers/HumanInterfaceDeviceForceFeedback-date.html"><i>Human Interface Device & Force Feedback</i></a>.
|
||||
Please review documentation before using this reference.
|
||||
<p>
|
||||
All of the information described in this document is contained in the header file <font face="Courier New,Courier,Monaco">IOHIDLib.h</font> found at
|
||||
<font face="Courier New,Courier,Monaco">/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDDevicePlugIn.h</font>.
|
||||
*/
|
||||
|
||||
|
||||
/* 13AA9C44-6F1B-11D4-907C-0005028F18D5 */
|
||||
/*! @defined kIOHIDDeviceFactoryID
|
||||
@discussion This UUID constant is used internally by the system, and
|
||||
should not have to be used by any driver code to access the device interfaces.
|
||||
*/
|
||||
#define kIOHIDDeviceFactoryID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x13, 0xAA, 0x9C, 0x44, 0x6F, 0x1B, 0x11, 0xD4, \
|
||||
0x90, 0x7C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
|
||||
|
||||
/* 7DDEECA8-A7B4-11DA-8A0E-0014519758EF */
|
||||
/*! @defined kIOHIDDeviceTypeID
|
||||
@discussion This UUID constant is used to obtain a device interface corresponding to
|
||||
an io_service_t corresponding to an IOHIDDevice in the kernel. Once you have
|
||||
obtained the IOCFPlugInInterface for the service, you must use the QueryInterface
|
||||
function to obtain the device interface for the user client itself.
|
||||
|
||||
Example:
|
||||
<pre>
|
||||
@textblock
|
||||
io_service_t hidDeviceRef; // obtained earlier
|
||||
|
||||
IOCFPlugInInterface **iodev; // fetching this now
|
||||
|
||||
SInt32 score; // not used
|
||||
IOReturn err;
|
||||
|
||||
err = IOCreatePlugInInterfaceForService(hidDeviceRef,
|
||||
kIOHIDDeviceTypeID,
|
||||
kIOCFPlugInInterfaceID,
|
||||
&iodev,
|
||||
&score);
|
||||
@/textblock
|
||||
</pre>
|
||||
*/
|
||||
#define kIOHIDDeviceTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x7d, 0xde, 0xec, 0xa8, 0xa7, 0xb4, 0x11, 0xda, \
|
||||
0x8a, 0x0e, 0x00, 0x14, 0x51, 0x97, 0x58, 0xef)
|
||||
|
||||
/* 474BDC8E-9F4A-11DA-B366-000D936D06D2 */
|
||||
/*! @defined kIOHIDDeviceDeviceInterfaceID
|
||||
@discussion This UUID constant is used to obtain a device interface corresponding
|
||||
to an IOHIDDevice service in the kernel. The type of this device interface is IOHIDDeviceDeviceInterface.
|
||||
This device interface is obtained after the IOCFPlugInInterface for the service itself has been obtained.
|
||||
|
||||
<b>Note:</b> Please note that subsequent calls to QueryInterface with the UUID
|
||||
kIOHIDDeviceDeviceInterfaceID, will return a retained instance of an existing IOHIDDeviceDeviceInterface.
|
||||
|
||||
Example:
|
||||
<pre>
|
||||
@textblock
|
||||
IOCFPluginInterface ** iodev; // obtained earlier
|
||||
|
||||
IOHIDDeviceDeviceInterface ** dev; // fetching this now
|
||||
IOReturn err;
|
||||
|
||||
err = (*iodev)->QueryInterface(iodev,
|
||||
CFUUIDGetUUIDBytes(kIOHIDDeviceDeviceInterfaceID),
|
||||
(LPVoid)&dev);
|
||||
@/textblock
|
||||
</pre>
|
||||
*/
|
||||
#define kIOHIDDeviceDeviceInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x47, 0x4b, 0xdc, 0x8e, 0x9f, 0x4a, 0x11, 0xda, \
|
||||
0xb3, 0x66, 0x00, 0x0d, 0x93, 0x6d, 0x06, 0xd2 )
|
||||
|
||||
/* B473256C-6A72-4E04-B694-C4001D202020 */
|
||||
/*! @defined kIOHIDDeviceDeviceInterfaceID2
|
||||
@discussion This UUID constant is used to obtain a device interface corresponding
|
||||
to an IOHIDDevice service in the kernel, but only for timestamped report callbacks.
|
||||
The type of this device interface is IOHIDDeviceTimeStampedDeviceInterface.
|
||||
This device interface is obtained after the IOCFPlugInInterface for the service itself has been obtained.
|
||||
|
||||
<b>Note:</b> Please note that subsequent calls to QueryInterface with the UUID
|
||||
kIOHIDDeviceDeviceInterfaceID2, will return a retained instance of an existing IOHIDDeviceTimeStampedDeviceInterface.
|
||||
|
||||
Example:
|
||||
<pre>
|
||||
@textblock
|
||||
IOCFPluginInterface **iodev; // obtained earlier
|
||||
|
||||
IOHIDDeviceTimeStampedDeviceInterface **devTime;// fetching this now
|
||||
IOReturn err;
|
||||
|
||||
err = (*iodev)->QueryInterface(iodev,
|
||||
CFUUIDGetUUIDBytes(kIOHIDDeviceDeviceInterfaceID2),
|
||||
(LPVoid)&devTime);
|
||||
@/textblock
|
||||
</pre>
|
||||
*/
|
||||
#define kIOHIDDeviceDeviceInterfaceID2 CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xB4, 0x73, 0x25, 0x6C, 0x6A, 0x72, 0x4E, 0x04, \
|
||||
0xB6, 0x94, 0xC4, 0x00, 0x1D, 0x20, 0x20, 0x20)
|
||||
|
||||
/* 2EC78BDB-9F4E-11DA-B65C-000D936D06D2 */
|
||||
/*! @defined kIOHIDDeviceQueueInterfaceID
|
||||
@discussion This UUID constant is used to obtain a queue interface corresponding
|
||||
to an IOHIDDevice service in the kernel. The type of this queue interface
|
||||
is IOHIDDeviceQueueInterface. This device interface is obtained after the device interface
|
||||
for the service itself has been obtained.
|
||||
|
||||
<b>Note:</b> Please note that subsequent calls to QueryInterface with the UUID
|
||||
kIOHIDDeviceQueueInterfaceID, will return a retained instance of a new IOHIDDeviceQueueInterface.
|
||||
|
||||
Example:
|
||||
<pre>
|
||||
@textblock
|
||||
IOCFPluginInterface ** iodev; // obtained earlier
|
||||
|
||||
IOHIDDeviceQueueInterface ** intf; // fetching this now
|
||||
IOReturn err;
|
||||
|
||||
err = (*iodev)->QueryInterface(iodev,
|
||||
CFUUIDGetUUIDBytes(kIOHIDDeviceQueueInterfaceID),
|
||||
(LPVoid)&intf);
|
||||
@/textblock
|
||||
</pre>
|
||||
*/
|
||||
#define kIOHIDDeviceQueueInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x2e, 0xc7, 0x8b, 0xdb, 0x9f, 0x4e, 0x11, 0xda, \
|
||||
0xb6, 0x5c, 0x00, 0x0d, 0x93, 0x6d, 0x06, 0xd2)
|
||||
|
||||
/* 1F2E78FA-9FFA-11DA-90B4-000D936D06D2 */
|
||||
/*! @defined kIOHIDDeviceTransactionInterfaceID
|
||||
@discussion This UUID constant is used to obtain a transaction interface corresponding
|
||||
to an IOHIDDevice service in the kernel. The type of this queue interface
|
||||
is IOHIDDeviceTransactionInterface. This device interface is obtained after the device interface
|
||||
for the service itself has been obtained.
|
||||
|
||||
<b>Note:</b> Please note that subsequent calls to QueryInterface with the UUID
|
||||
kIOHIDDeviceTransactionInterfaceID, will return a retained instance of a new IOHIDDeviceTransactionInterface.
|
||||
|
||||
Example:
|
||||
<pre>
|
||||
@textblock
|
||||
IOCFPluginInterface ** iodev; // obtained earlier
|
||||
|
||||
IOHIDDeviceTransactionInterface ** intf; // fetching this now
|
||||
IOReturn err;
|
||||
|
||||
err = (*iodev)->QueryInterface(iodev,
|
||||
CFUUIDGetUUIDBytes(kIOHIDDeviceTransactionInterfaceID),
|
||||
(LPVoid)&intf);
|
||||
@/textblock
|
||||
</pre>
|
||||
*/
|
||||
#define kIOHIDDeviceTransactionInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x1f, 0x2e, 0x78, 0xfa, 0x9f, 0xfa, 0x11, 0xda, \
|
||||
0x90, 0xb4, 0x00, 0x0d, 0x93, 0x6d, 0x06, 0xd2)
|
||||
|
||||
|
||||
#define IOHID_DEVICE_DEVICE_FUNCS_V1 \
|
||||
IOReturn (*open)(void * self, IOOptionBits options); \
|
||||
IOReturn (*close)(void * self, IOOptionBits options); \
|
||||
IOReturn (*getProperty)(void * self, CFStringRef key, CFTypeRef * pProperty); \
|
||||
IOReturn (*setProperty)(void * self, CFStringRef key, CFTypeRef property); \
|
||||
IOReturn (*getAsyncEventSource)(void * self, CFTypeRef * pSource); \
|
||||
IOReturn (*copyMatchingElements)(void * self, CFDictionaryRef matchingDict, CFArrayRef * pElements, IOOptionBits options); \
|
||||
IOReturn (*setValue)(void * self, IOHIDElementRef element, IOHIDValueRef value, uint32_t timeout, IOHIDValueCallback callback, void * context, IOOptionBits options); \
|
||||
IOReturn (*getValue)(void * self, IOHIDElementRef element, IOHIDValueRef * pValue, uint32_t timeout, IOHIDValueCallback callback, void * context, IOOptionBits options); \
|
||||
IOReturn (*setInputReportCallback)(void * self, uint8_t * report, CFIndex reportLength, IOHIDReportCallback callback, void * context, IOOptionBits options); \
|
||||
IOReturn (*setReport)(void * self, IOHIDReportType reportType, uint32_t reportID, const uint8_t * report, CFIndex reportLength, uint32_t timeout, IOHIDReportCallback callback, void * context, IOOptionBits options); \
|
||||
IOReturn (*getReport)(void * self, IOHIDReportType reportType, uint32_t reportID, uint8_t * report, CFIndex * pReportLength, uint32_t timeout, IOHIDReportCallback callback, void * context, IOOptionBits options)
|
||||
/*! @interface IOHIDDeviceDeviceInterface
|
||||
@abstract The object you use to access HID devices from user space, returned by version 1.5 of the IOHIDFamily.
|
||||
@discussion The functions listed here will work with any version of the IOHIDDeviceDeviceInterface.
|
||||
|
||||
<b>Note:</b> Please note that methods declared in this interface follow the copy/get/set conventions.
|
||||
*/
|
||||
typedef struct IOHIDDeviceDeviceInterface {
|
||||
IUNKNOWN_C_GUTS;
|
||||
#ifdef IOHID_DEVICE_DEVICE_FUNCS_V1 // {
|
||||
IOHID_DEVICE_DEVICE_FUNCS_V1;
|
||||
#else // } {
|
||||
/*! @function open
|
||||
@abstract Opens the IOHIDDevice.
|
||||
@discussion Before the client can issue commands that change the state of the device, it must have succeeded in
|
||||
opening the device. This establishes a link between the client's task and the actual device. To
|
||||
establish an exclusive link use the kIOHIDOptionsTypeSeizeDevice option.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param options Option bits to be passed down to the user client.
|
||||
@result Returns kIOReturnSuccess if successful, some other mach error if the connection is no longer valid.
|
||||
*/
|
||||
IOReturn (*open)(void * self, IOOptionBits options);
|
||||
|
||||
/*! @function close
|
||||
@abstract Closes the task's connection to the IOHIDDevice.
|
||||
@discussion Releases the client's access to the IOHIDDevice.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param options Option bits to be passed down to the user client.
|
||||
@result Returns kIOReturnSuccess if successful, kIOReturnNoDevice if there is no connection to an IOService.
|
||||
*/
|
||||
IOReturn (*close)(void * self, IOOptionBits options);
|
||||
|
||||
/*! @function getProperty
|
||||
@abstract Obtains a property related to the IOHIDDevice.
|
||||
@discussion Property keys are prefixed by kIOHIDDevice and declared in IOHIDKeys.h.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param key CFStringRef key
|
||||
@param pProperty Pointer to a CFTypeRef property.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
IOReturn (*getProperty)(void * self, CFStringRef key, CFTypeRef * pProperty);
|
||||
|
||||
/*! @function setProperty
|
||||
@abstract Sets a property related to the IOHIDDevice.
|
||||
@discussion Property keys are prefixed by kIOHIDDevice and declared in IOHIDKeys.h.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param key CFStringRef key
|
||||
@param property CFTypeRef property.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
IOReturn (*setProperty)(void * self, CFStringRef key, CFTypeRef property);
|
||||
|
||||
/*! @function getAsyncEventSource
|
||||
@abstract Obtains the event source for this IOHIDDeviceDeviceInterface instance.
|
||||
@discussion The returned event source can be of type CFRunLoopSourceRef or CFRunLoopTimerRef.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param pSource Pointer to a CFType to return the run loop event source.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*getAsyncEventSource)(void * self, CFTypeRef * pSource);
|
||||
|
||||
/*! @function copyMatchingElements
|
||||
@abstract Obtains a CFArrayRef containing the IOHIDDeviceDeviceInterface elements that match
|
||||
the passed matching dictionary.
|
||||
@discussion Objects contained in the returned array are of type IOHIDElementRef. Please see
|
||||
IOHIDElement.h for additional API information. Elemenet properties are prefixed by
|
||||
kIOHIDElement and declared in IOHIDKeys.h.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param matchingDict CFDictionaryRef containing the element properties to match on.
|
||||
@param pElements CFArrayRef containing matched elements.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*copyMatchingElements)(void * self, CFDictionaryRef matchingDict, CFArrayRef * pElements, IOOptionBits options);
|
||||
|
||||
/*! @function setValue
|
||||
@abstract Sets the value for an element.
|
||||
@discussion If setting multiple element values, please consider using an IOHIDDeviceTransactionInterface
|
||||
with the kIOHIDTransactionDirectionTypeOutput direction.
|
||||
<br>
|
||||
<b>Note:</b> In order to make use of asynchronous behavior, the event source obtained using getAsyncEventSource
|
||||
must be added to a run loop.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param element IOHIDElementRef referencing the element of interest.
|
||||
@param value IOHIDValueRef containing element value to be set.
|
||||
@param timeout Time in milliseconds to wait before aborting request.
|
||||
@param callback Callback of type IOHIDValueCallback to be used after report data has been sent to the device.
|
||||
If null, this method will behave synchronously.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*setValue)(void * self, IOHIDElementRef element, IOHIDValueRef value,
|
||||
uint32_t timeout, IOHIDValueCallback callback, void * context, IOOptionBits options);
|
||||
|
||||
/*! @function getValue
|
||||
@abstract Obtains the current value for an element.
|
||||
@discussion If an element of type kIOHIDElementTypeFeature is passed, this method will issue a request to the IOHIDDevice.
|
||||
Otherwise, this will return the last value reported by the IOHIDDevice. If requesting multiple feature element
|
||||
values, please consider using an IOHIDDeviceTransactionInterface with the kIOHIDTransactionDirectionTypeInput direction.
|
||||
<br>
|
||||
<b>Note:</b> In order to make use of asynchronous behavior, the event source obtained using getAsyncEventSource
|
||||
must be added to a run loop.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param element IOHIDElementRef referencing the element of interest.
|
||||
@param pValue Pointer to a IOHIDValueRef to return the element value.
|
||||
@param timeout Time in milliseconds to wait before aborting request.
|
||||
@param callback Callback of type IOHIDReportCallback to be used when element value has been received from the device.
|
||||
If null, this method will behave synchronously.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*getValue)(void * self, IOHIDElementRef element, IOHIDValueRef * pValue,
|
||||
uint32_t timeout, IOHIDValueCallback callback, void * context, IOOptionBits options);
|
||||
|
||||
/*!
|
||||
@function setInputReportCallback
|
||||
@abstract Sets the input report callback to be used when data is received from the Input pipe.
|
||||
@discussion In order to function properly, the event source obtained using getAsyncEventSource must be added to a run loop.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param report Pointer to a pre-allocated buffer to be filled and passed back via the callback.
|
||||
@param reportLength Length of the report buffer.
|
||||
@param callback Callback of type IOHIDReportCallback to be used when report data has been receieved by the IOHIDDevice.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*setInputReportCallback)(void * self, uint8_t * report, CFIndex reportLength,
|
||||
IOHIDReportCallback callback, void * context, IOOptionBits options);
|
||||
|
||||
/*! @function setReport
|
||||
@abstract Sends a report of type kIOHIDReportTypeOutput or kIOHIDReportTypeFeature to the IOHIDDevice.
|
||||
@discussion This method is useful if specific knowledge of the unparsed report is known to the caller. Otherwise, using
|
||||
an IOHIDDeviceTransactionInterface with the kIOHIDTransactionDirectionTypeOutput direction is recommended.
|
||||
<br>
|
||||
<b>Note:</b> In order to make use of asynchronous behavior, the event source obtained using getAsyncEventSource
|
||||
must be added to a run loop.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param reportType The report type.
|
||||
@param reportID The report id.
|
||||
@param report Pointer to a buffer containing the report data to be sent.
|
||||
@param reportLength Length of the report buffer.
|
||||
@param timeout Timeout in milliseconds for issuing the setReport.
|
||||
@param callback Callback of type IOHIDReportCallback to be used after report data has been sent to the device.
|
||||
If null, this method will behave synchronously.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*setReport)(void * self, IOHIDReportType reportType, uint32_t reportID, const uint8_t * report, CFIndex reportLength,
|
||||
uint32_t timeout, IOHIDReportCallback callback, void * context, IOOptionBits options);
|
||||
|
||||
/*! @function getReport
|
||||
@abstract Obtains a report of type kIOHIDReportTypeInput or kIOHIDReportTypeFeature from the IOHIDDevice.
|
||||
@discussion This method is useful if specific knowledge of the unparsed report is known to the caller. Otherwise, using
|
||||
an IOHIDDeviceTransactionInterface with the kIOHIDTransactionDirectionTypeInput direction is recommended.
|
||||
<br>
|
||||
<b>Note:</b> In order to make use of asynchronous behavior, the event source obtained using getAsyncEventSource
|
||||
must be added to a run loop.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param reportType The report type.
|
||||
@param reportID The report id.
|
||||
@param report Pointer to a pre-allocated buffer to be filled.
|
||||
@param pReportLength Length of the report buffer. When finished, this will contain the actual length of the report.
|
||||
@param timeout Timeout in milliseconds for issuing the getReport.
|
||||
@param callback Callback of type IOHIDReportCallback to be used when report data has been received from the device.
|
||||
If null, this method will behave synchronously.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*getReport)(void * self, IOHIDReportType reportType, uint32_t reportID, uint8_t * report, CFIndex * pReportLength,
|
||||
uint32_t timeout, IOHIDReportCallback callback, void * context, IOOptionBits options);
|
||||
#endif // }
|
||||
} IOHIDDeviceDeviceInterface;
|
||||
|
||||
#define IOHID_DEVICE_DEVICE_FUNCS_V2 \
|
||||
IOReturn (*setInputReportWithTimeStampCallback)(void * self, uint8_t * report, CFIndex reportLength, IOHIDReportWithTimeStampCallback callback, void * context, IOOptionBits options)
|
||||
/*! @interface IOHIDDeviceTimeStampedDeviceInterface
|
||||
@abstract The object you use to access HID devices from user space, returned by version 2.1 of the IOHIDFamily.
|
||||
@discussion The functions listed here include all of the functions from the IOHIDDeviceDeviceInterface.
|
||||
|
||||
<b>Note:</b> Please note that methods declared in this interface follow the copy/get/set conventions.
|
||||
*/
|
||||
typedef struct IOHIDDeviceTimeStampedDeviceInterface {
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOHID_DEVICE_DEVICE_FUNCS_V1;
|
||||
#ifdef IOHID_DEVICE_DEVICE_FUNCS_V2 // {
|
||||
IOHID_DEVICE_DEVICE_FUNCS_V2;
|
||||
#else // } {
|
||||
/*!
|
||||
@function setInputReportWithTimeStampCallback
|
||||
@abstract Sets the input report callback to be used when data is received from the Input pipe.
|
||||
@discussion In order to function properly, the event source obtained using getAsyncEventSource must be added to a run loop.
|
||||
@param self Pointer to the IOHIDDeviceDeviceInterface.
|
||||
@param report Pointer to a pre-allocated buffer to be filled and passed back via the callback.
|
||||
@param reportLength Length of the report buffer.
|
||||
@param callback Callback of type IOHIDReportWithTimeStampCallback to be used when report data has been receieved by the IOHIDDevice.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*setInputReportWithTimeStampCallback)(void * self, uint8_t * report, CFIndex reportLength,
|
||||
IOHIDReportWithTimeStampCallback callback, void * context, IOOptionBits options);
|
||||
|
||||
#endif // }
|
||||
} IOHIDDeviceTimeStampedDeviceInterface;
|
||||
|
||||
/*!
|
||||
@interface IOHIDDeviceQueueInterface
|
||||
@abstract The object you use to access a HID queue from user space, returned by version 1.5 of the IOHIDFamily.
|
||||
@discussion The functions listed here will work with any version of the IOHIDDeviceQueueInterface. This behavior is useful when you
|
||||
need to keep track of all values of an input element, rather than just the most recent one.
|
||||
<br>
|
||||
<b>Note:</b>Absolute element values (based on a fixed origin) will only be placed on a queue if there is a change in value.
|
||||
*/
|
||||
typedef struct IOHIDDeviceQueueInterface {
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
/*! @function getAsyncEventSource
|
||||
@abstract Obtains the event source for this IOHIDDeviceQueueInterface instance.
|
||||
@discussion The returned event source can be of type CFRunLoopSourceRef or CFRunLoopTimerRef.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param pSource Pointer to a CFType to return the run loop event source.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*getAsyncEventSource)(void * self, CFTypeRef * pSource);
|
||||
|
||||
/*! @function setDepth
|
||||
@abstract Sets the depth for this IOHIDDeviceQueueInterface instance.
|
||||
@discussion Regardless of element value size, queue will guarantee n=depth elements will be serviced.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param depth The maximum number of elements in the queue before the oldest elements in the queue begin to be lost.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*setDepth)(void *self, uint32_t depth, IOOptionBits options);
|
||||
|
||||
/*! @function getDepth
|
||||
@abstract Obtains the queue depth for this IOHIDDeviceQueueInterface instance.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param pDepth Pointer to a uint32_t to obtain the number of elements that can be serviced by the queue.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*getDepth)(void *self, uint32_t * pDepth);
|
||||
|
||||
/*! @function addElement
|
||||
@abstract Adds an element to this IOHIDDeviceQueueInterface instance.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param element IOHIDElementRef referencing the element to be added to the queue.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*addElement)(void * self, IOHIDElementRef element, IOOptionBits options);
|
||||
|
||||
/*! @function removeElement
|
||||
@abstract Removes an element from this IOHIDDeviceQueueInterface instance.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param element IOHIDElementRef referencing the element to be removed from the queue.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*removeElement)(void * self, IOHIDElementRef element, IOOptionBits options);
|
||||
|
||||
/*! @function containsElement
|
||||
@abstract Determines whether an element has been added to this IOHIDDeviceQueueInterface instance.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param element IOHIDElementRef referencing the element to be be found in the queue.
|
||||
@param pValue Pointer to a Boolean to return whether or not the element was found in the queue.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*containsElement)(void * self, IOHIDElementRef element, Boolean * pValue, IOOptionBits options);
|
||||
|
||||
/*! @function start
|
||||
@abstract Starts element value delivery to the queue.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*start)(void * self, IOOptionBits options);
|
||||
|
||||
/*! @function stop
|
||||
@abstract Stops element value delivery to the queue.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*stop)(void * self, IOOptionBits options);
|
||||
|
||||
/*! @function setValueAvailableCallback
|
||||
@abstract Sets callback to be used when the queue transitions to non-empty.
|
||||
@discussion In order to make use of asynchronous behavior, the event source obtained using getAsyncEventSource
|
||||
must be added to a run loop.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param callback Callback of type IOHIDCallback to be used when data is placed on the queue.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*setValueAvailableCallback)(void * self, IOHIDCallback callback, void * context);
|
||||
|
||||
/*! @function copyNextValue
|
||||
@abstract Dequeues a retained copy of an element value from the head of an IOHIDDeviceQueueInterface.
|
||||
@discussion Because the value is a retained copy, it is up to the caller to release the value using CFRelease.
|
||||
Use with setValueCallback to avoid polling the queue for data.
|
||||
@param self Pointer to the IOHIDDeviceQueueInterface.
|
||||
@param pValue Pointer to a IOHIDValueRef to return the value at the head of the queue.
|
||||
@param timeout Timeout in milliseconds before aborting an attempt to dequeue a value from the head of a queue.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful, kIOReturnUnderrun if data is unavailble, or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*copyNextValue)(void * self, IOHIDValueRef * pValue, uint32_t timeout, IOOptionBits options);
|
||||
} IOHIDDeviceQueueInterface;
|
||||
|
||||
|
||||
/*!
|
||||
@interface IOHIDDeviceTransactionInterface
|
||||
@abstract The object you use to access a HID transaction from user space, returned by version 1.5 of the IOHIDFamily.
|
||||
@discussion The functions listed here will work with any version of the IOHIDDeviceTransactionInterface. This functionality
|
||||
is useful when either setting or getting the values for multiple parsed elements.
|
||||
*/
|
||||
typedef struct IOHIDDeviceTransactionInterface {
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
/*! @function getAsyncEventSource
|
||||
@abstract Obtains the event source for this IOHIDDeviceTransactionInterface instance.
|
||||
@discussion The returned event source can be of type CFRunLoopSourceRef or CFRunLoopTimerRef.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param pSource Pointer to a CFType to return the run loop event source.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*getAsyncEventSource)(void * self, CFTypeRef * pSource);
|
||||
|
||||
/*! @function setDirection
|
||||
@abstract Sets the direction for this IOHIDDeviceTransactionInterface instance.
|
||||
@discussion Direction constants are declared in IOHIDTransactionDirectionType. Changing directions
|
||||
is useful when dealing with elements of type kIOHIDElementTypeFeature as you use the
|
||||
transaction to both set and get element values.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param direction Transaction direction of type IOHIDTransactionDirectionType.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*setDirection)(void * self, IOHIDTransactionDirectionType direction, IOOptionBits options);
|
||||
|
||||
/*! @function getDirection
|
||||
@abstract Obtains the direction for this IOHIDDeviceTransactionInterface instance.
|
||||
@discussion Direction constants are declared in IOHIDTransactionDirectionType.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param pDirection Pointer to a IOHIDTransactionDirectionType to obtain transaction direction.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*getDirection)(void * self, IOHIDTransactionDirectionType * pDirection);
|
||||
|
||||
/*! @function addElement
|
||||
@abstract Adds an element to this IOHIDDeviceTransactionInterface instance.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param element IOHIDElementRef referencing the element to be added to the transaction.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*addElement)(void * self, IOHIDElementRef element, IOOptionBits options);
|
||||
|
||||
/*! @function removeElement
|
||||
@abstract Removes an element from this IOHIDDeviceTransactionInterface instance.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param element IOHIDElementRef referencing the element to be removed from the transaction.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*removeElement)(void * self, IOHIDElementRef element, IOOptionBits options);
|
||||
|
||||
/*! @function containsElement
|
||||
@abstract Checks whether an element has been added to this IOHIDDeviceTransactionInterface instance.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param element IOHIDElementRef referencing the element to be be found in the transaction.
|
||||
@param pValue Pointer to a Boolean to return whether or not the element was found in the transaction.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*containsElement)(void * self, IOHIDElementRef element, Boolean * pValue, IOOptionBits options);
|
||||
|
||||
/*! @function setValue
|
||||
@abstract Sets the transaction value for an element in this IOHIDDeviceTransactionInterface instance.
|
||||
@discussion This method is intended for use with transaction of direction kIOHIDTransactionDirectionTypeOutput.
|
||||
Use the kIOHIDTransactionOptionDefaultOutputValue option to set the default element value.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param element IOHIDElementRef referencing the element of interest.
|
||||
@param value IOHIDValueRef referencing element value to be used in the transaction.
|
||||
@param options See IOHIDTransactionOption.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*setValue)(void * self, IOHIDElementRef element, IOHIDValueRef value, IOOptionBits options);
|
||||
|
||||
/*! @function getValue
|
||||
@abstract Obtains the transaction value for an element in this IOHIDDeviceTransactionInterface instance.
|
||||
@discussion Use the kIOHIDTransactionOptionDefaultOutputValue option to get the default element value.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param element IOHIDElementRef referencing the element of interest.
|
||||
@param pValue Pointer to an IOHIDValueRef to return the element value of the transaction.
|
||||
@param options See IOHIDTransactionOption.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*getValue)(void * self, IOHIDElementRef element, IOHIDValueRef *pValue, IOOptionBits options);
|
||||
|
||||
/*! @function commit
|
||||
@abstract Commits element transaction to an IOHIDDevice in this IOHIDDeviceTransactionInterface instance.
|
||||
@discussion In regards to kIOHIDTransactionDirectionTypeOutput direction, default element values will be used if
|
||||
element values are not set. If neither are set, that element will be omitted from the commit. After
|
||||
a transaction is committed, transaction element values will be cleared and default values preserved.
|
||||
<br>
|
||||
<b>Note:</b> It is possible for elements from different reports to be present in a given transaction
|
||||
causing a commit to transcend multiple reports. Keep this in mind when setting a timeout.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param timeout Timeout in milliseconds for issuing the transaction.
|
||||
@param callback Callback of type IOHIDCallback to be used when transaction has been completed. If null,
|
||||
this method will behave synchronously.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*commit)(void * self, uint32_t timeout, IOHIDCallback callback, void * context, IOOptionBits options);
|
||||
|
||||
/*! @function clear
|
||||
@abstract Clears element transaction values for an IOHIDDeviceTransactionInterface.
|
||||
@discussion In regards to kIOHIDTransactionDirectionTypeOutput direction, default element values will be preserved.
|
||||
@param self Pointer to the IOHIDDeviceTransactionInterface.
|
||||
@param options Reserved for future use. Ignored in current implementation. Set to zero.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if unsuccessful.
|
||||
*/
|
||||
IOReturn (*clear)(void * self, IOOptionBits options);
|
||||
} IOHIDDeviceTransactionInterface;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDDEVICEPLUGIN_H */
|
||||
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 2019 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef IOHIDDeviceTypes_h
|
||||
#define IOHIDDeviceTypes_h
|
||||
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_DRIVERKIT
|
||||
#include <DriverKit/IOTypes.h>
|
||||
#include <DriverKit/IOReturn.h>
|
||||
#else
|
||||
#include <IOKit/IOReturn.h>
|
||||
#include <IOKit/IOTypes.h>
|
||||
#endif // TARGET_OS_DRIVERKIT
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDReportType
|
||||
*
|
||||
* @abstract
|
||||
* Describes different type of HID reports.
|
||||
*/
|
||||
enum IOHIDReportType {
|
||||
kIOHIDReportTypeInput = 0,
|
||||
kIOHIDReportTypeOutput,
|
||||
kIOHIDReportTypeFeature,
|
||||
kIOHIDReportTypeCount
|
||||
};
|
||||
typedef enum IOHIDReportType IOHIDReportType;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDElementCommitDirection
|
||||
*
|
||||
* @abstract
|
||||
* Commit direction passed in to the commit() function of an IOHIDElement.
|
||||
*
|
||||
* @field kIOHIDElementCommitDirectionIn
|
||||
* Passing in kIOHIDElementCommitDirectionIn will issue a getReport call to the
|
||||
* device, and the element will be updated with the value retrieved by the
|
||||
* device. The value can be accessed via the getValue() or getDataValue()
|
||||
* functions.
|
||||
*
|
||||
* @field kIOHIDElementCommitDirectionOut
|
||||
* Passing in kIOHIDElementCommitDirectionOut will issue a setReport call to the
|
||||
* device. Before issuing this call, the desired value should be set on the
|
||||
* element with the setValue() or setDataValue() functions.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOHIDElementCommitDirectionIn,
|
||||
kIOHIDElementCommitDirectionOut
|
||||
} IOHIDElementCommitDirection;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDElementCookie
|
||||
*
|
||||
* @abstract
|
||||
* Abstract data type used as a unique identifier for an element.
|
||||
*/
|
||||
#if TARGET_OS_DRIVERKIT || defined(__LP64__)
|
||||
typedef uint32_t IOHIDElementCookie;
|
||||
#else
|
||||
typedef void * IOHIDElementCookie;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDElementType
|
||||
*
|
||||
* @abstract
|
||||
* Describes different types of HID elements.
|
||||
*
|
||||
* @discussion
|
||||
* Used by the IOHIDFamily to identify the type of element processed.
|
||||
* Represented by the key kIOHIDElementTypeKey in the dictionary describing the
|
||||
* element.
|
||||
*
|
||||
* @field kIOHIDElementTypeInput_Misc
|
||||
* Misc input data field or varying size.
|
||||
*
|
||||
* @field kIOHIDElementTypeInput_Button
|
||||
* One bit input data field.
|
||||
*
|
||||
* @field kIOHIDElementTypeInput_Axis
|
||||
* Input data field used to represent an axis.
|
||||
*
|
||||
* @field kIOHIDElementTypeInput_ScanCodes
|
||||
* Input data field used to represent a scan code or usage selector.
|
||||
*
|
||||
* @field kIOHIDElementTypeInput_NULL
|
||||
* Input data field used to represent the end of an input report when receiving
|
||||
* input elements.
|
||||
*
|
||||
* @field kIOHIDElementTypeOutput
|
||||
* Used to represent an output data field in a report.
|
||||
*
|
||||
* @field kIOHIDElementTypeFeature
|
||||
* Describes input and output elements not intended for consumption by the end
|
||||
* user.
|
||||
*
|
||||
* @field kIOHIDElementTypeCollection
|
||||
* Element used to identify a relationship between two or more elements.
|
||||
*/
|
||||
enum IOHIDElementType {
|
||||
kIOHIDElementTypeInput_Misc = 1,
|
||||
kIOHIDElementTypeInput_Button = 2,
|
||||
kIOHIDElementTypeInput_Axis = 3,
|
||||
kIOHIDElementTypeInput_ScanCodes = 4,
|
||||
kIOHIDElementTypeInput_NULL = 5,
|
||||
kIOHIDElementTypeOutput = 129,
|
||||
kIOHIDElementTypeFeature = 257,
|
||||
kIOHIDElementTypeCollection = 513
|
||||
};
|
||||
typedef enum IOHIDElementType IOHIDElementType;
|
||||
|
||||
enum {
|
||||
kIOHIDElementFlagsConstantMask = 0x0001,
|
||||
kIOHIDElementFlagsVariableMask = 0x0002,
|
||||
kIOHIDElementFlagsRelativeMask = 0x0004,
|
||||
kIOHIDElementFlagsWrapMask = 0x0008,
|
||||
kIOHIDElementFlagsNonLinearMask = 0x0010,
|
||||
kIOHIDElementFlagsNoPreferredMask = 0x0020,
|
||||
kIOHIDElementFlagsNullStateMask = 0x0040,
|
||||
kIOHIDElementFlagsVolativeMask = 0x0080,
|
||||
kIOHIDElementFlagsBufferedByteMask = 0x0100
|
||||
};
|
||||
typedef uint32_t IOHIDElementFlags;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDElementCollectionType
|
||||
*
|
||||
* @abstract
|
||||
* Describes different types of HID collections.
|
||||
*
|
||||
* @discussion
|
||||
* Collections identify a relationship between two or more elements.
|
||||
*
|
||||
* @field kIOHIDElementCollectionTypePhysical
|
||||
* Used for a set of data items that represent data points collected at one
|
||||
* geometric point.
|
||||
*
|
||||
* @field kIOHIDElementCollectionTypeApplication
|
||||
* Identifies item groups serving different purposes in a single device.
|
||||
*
|
||||
* @field kIOHIDElementCollectionTypeLogical
|
||||
* Used when a set of data items form a composite data structure.
|
||||
*
|
||||
* @field kIOHIDElementCollectionTypeReport
|
||||
* Wraps all the fields in a report.
|
||||
*
|
||||
* @field kIOHIDElementCollectionTypeNamedArray
|
||||
* Contains an array of selector usages.
|
||||
*
|
||||
* @field kIOHIDElementCollectionTypeUsageSwitch
|
||||
* Modifies the meaning of the usage it contains.
|
||||
*
|
||||
* @field kIOHIDElementCollectionTypeUsageModifier
|
||||
* Modifies the meaning of the usage attached to the encompassing collection.
|
||||
*/
|
||||
enum IOHIDElementCollectionType{
|
||||
kIOHIDElementCollectionTypePhysical = 0x00,
|
||||
kIOHIDElementCollectionTypeApplication,
|
||||
kIOHIDElementCollectionTypeLogical,
|
||||
kIOHIDElementCollectionTypeReport,
|
||||
kIOHIDElementCollectionTypeNamedArray,
|
||||
kIOHIDElementCollectionTypeUsageSwitch,
|
||||
kIOHIDElementCollectionTypeUsageModifier
|
||||
};
|
||||
typedef enum IOHIDElementCollectionType IOHIDElementCollectionType;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDValueScaleType
|
||||
*
|
||||
* @abstract
|
||||
* Describes different types of scaling that can be performed on element values.
|
||||
*
|
||||
* @field kIOHIDValueScaleTypeCalibrated
|
||||
* Type for value that is scaled with respect to the calibration properties.
|
||||
*
|
||||
* @field kIOHIDValueScaleTypePhysical
|
||||
* Type for value that is scaled with respect to the physical min and physical
|
||||
* max of the element.
|
||||
*
|
||||
* @field kIOHIDValueScaleTypeExponent
|
||||
* Type for value that is scaled with respect to the element's unit exponent.
|
||||
*/
|
||||
enum {
|
||||
kIOHIDValueScaleTypeCalibrated,
|
||||
kIOHIDValueScaleTypePhysical,
|
||||
kIOHIDValueScaleTypeExponent
|
||||
};
|
||||
typedef uint32_t IOHIDValueScaleType;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDValueOptions
|
||||
*
|
||||
* @abstract
|
||||
* Describes options for gathering element values.
|
||||
*
|
||||
* @field kIOHIDValueOptionsFlagRelativeSimple
|
||||
* Compares against previous value
|
||||
*
|
||||
* @field kIOHIDValueOptionsUpdateElementValues
|
||||
* Generates a get report before reading the element value when getting an element.
|
||||
* Generates a set report with the passed value, even if it did not change, to the device when setting a value.
|
||||
*/
|
||||
enum {
|
||||
kIOHIDValueOptionsFlagRelativeSimple = (1<<0),
|
||||
kIOHIDValueOptionsFlagPrevious = (1<<1),
|
||||
kIOHIDValueOptionsUpdateElementValues = (1<<2)
|
||||
};
|
||||
typedef uint32_t IOHIDValueOptions;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDCompletionAction
|
||||
*
|
||||
* @abstract Function called when set/get report completes
|
||||
*
|
||||
* @param target
|
||||
* The target specified in the IOHIDCompletion struct.
|
||||
*
|
||||
* @param parameter
|
||||
* The parameter specified in the IOHIDCompletion struct.
|
||||
*
|
||||
* @param status
|
||||
* Completion status
|
||||
*/
|
||||
typedef void (*IOHIDCompletionAction)(void *target,
|
||||
void *parameter,
|
||||
IOReturn status,
|
||||
uint32_t bufferSizeRemaining);
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDCompletion
|
||||
*
|
||||
* @abstract
|
||||
* Struct spefifying action to perform when set/get report completes.
|
||||
*
|
||||
* @var target
|
||||
* The target to pass to the action function.
|
||||
*
|
||||
* @var action
|
||||
* The function to call.
|
||||
*
|
||||
* @var parameter
|
||||
* The parameter to pass to the action function.
|
||||
*/
|
||||
typedef struct IOHIDCompletion {
|
||||
void *target;
|
||||
IOHIDCompletionAction action;
|
||||
void *parameter;
|
||||
} IOHIDCompletion;
|
||||
|
||||
/*!
|
||||
* @abstract
|
||||
* Option bits for IOHIDDevice::handleReport, IOHIDDevice::getReport, and
|
||||
* IOHIDDevice::setReport
|
||||
*
|
||||
* @field kIOHIDReportOptionNotInterrupt
|
||||
* Tells method that the report passed was not interrupt driven.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kIOHIDReportOptionNotInterrupt = 0x100,
|
||||
kIOHIDReportOptionVariableSize = 0x200
|
||||
};
|
||||
|
||||
/*!
|
||||
* @typedef HIDReportCommandType
|
||||
*
|
||||
* @abstract
|
||||
* Type of the report command for DriverKit driver
|
||||
*/
|
||||
typedef enum {
|
||||
kIOHIDReportCommandSetReport,
|
||||
kIOHIDReportCommandGetReport
|
||||
} HIDReportCommandType;
|
||||
|
||||
#endif /* IOHIDDeviceTypes_h */
|
||||
@@ -0,0 +1,423 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDELEMENT_USER_H
|
||||
#define _IOKIT_HID_IOHIDELEMENT_USER_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
#include <IOKit/hid/IOHIDBase.h>
|
||||
|
||||
/*!
|
||||
@header IOHIDElement
|
||||
IOHIDElement defines a parsed item contained within a Human Interface Device
|
||||
(HID) object. It is used to obtain properties of the parsed. It can also
|
||||
be used to set properties such as calibration settings. IOHIDElement is a
|
||||
CFType object and as such conforms to all the conventions expected such
|
||||
object.
|
||||
<p>
|
||||
This documentation assumes that you have a basic understanding of the material contained in <a href="http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/index.html"><i>Accessing Hardware From Applications</i></a>
|
||||
For definitions of I/O Kit terms used in this documentation, such as matching dictionary, family, and driver, see the overview of I/O Kit terms and concepts
|
||||
in the "Device Access and the I/O Kit" chapter of <i>Accessing Hardware From Applications</i>.
|
||||
This documentation also assumes you have read <a href="http://developer.apple.com/documentation/DeviceDrivers/HumanInterfaceDeviceForceFeedback-date.html"><i>Human Interface Device & Force Feedback</i></a>.
|
||||
Please review documentation before using this reference.
|
||||
<p>
|
||||
All of the information described in this document is contained in the header file <font face="Courier New,Courier,Monaco">IOHIDElement.h</font> found at
|
||||
<font face="Courier New,Courier,Monaco">/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDElement.h</font>.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetTypeID
|
||||
@abstract Returns the type identifier of all IOHIDElement instances.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeID IOHIDElementGetTypeID(void)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementCreateWithDictionary
|
||||
@abstract Creates an element from a dictionary.
|
||||
@discussion The dictionary should contain keys defined in IOHIDKeys.h and start with kIOHIDElement. This call is meant be used by a IOHIDDeviceDeviceInterface object.
|
||||
@param allocator Allocator to be used during creation.
|
||||
@param dictionary dictionary containing values in which to create element.
|
||||
@result Returns a new IOHIDElementRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDElementRef IOHIDElementCreateWithDictionary(CFAllocatorRef _Nullable allocator, CFDictionaryRef dictionary)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetDevice
|
||||
@abstract Obtain the device associated with the element.
|
||||
@param element IOHIDElement to be queried.
|
||||
@result Returns the a reference to the device.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDDeviceRef IOHIDElementGetDevice(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetParent
|
||||
@abstract Returns the parent for the element.
|
||||
@discussion The parent element can be an element of type kIOHIDElementTypeCollection.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns an IOHIDElementRef referencing the parent element.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDElementRef _Nullable IOHIDElementGetParent(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetChildren
|
||||
@abstract Returns the children for the element.
|
||||
@discussion An element of type kIOHIDElementTypeCollection usually contains children.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns an CFArrayRef containing element objects of type IOHIDElementRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFArrayRef _Nullable IOHIDElementGetChildren(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementAttach
|
||||
@abstract Establish a relationship between one or more elements.
|
||||
@discussion This is useful for grouping HID elements with related functionality.
|
||||
@param element The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@param toAttach The element to be attached. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDElementAttach(IOHIDElementRef element, IOHIDElementRef toAttach)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementDetach
|
||||
@abstract Remove a relationship between one or more elements.
|
||||
@discussion This is useful for grouping HID elements with related functionality.
|
||||
@param element The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@param toDetach The element to be detached. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDElementDetach(IOHIDElementRef element, IOHIDElementRef toDetach)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementCopyAttached
|
||||
@abstract Obtain attached elements.
|
||||
@discussion Attached elements are those that have been grouped via IOHIDElementAttach.
|
||||
@param element The element to be modified. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns a copy of the current attached elements.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFArrayRef _Nullable IOHIDElementCopyAttached(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetCookie
|
||||
@abstract Retrieves the cookie for the element.
|
||||
@discussion The IOHIDElementCookie represent a unique identifier for an element within a device.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the IOHIDElementCookie for the element.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDElementCookie IOHIDElementGetCookie(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetType
|
||||
@abstract Retrieves the type for the element.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the IOHIDElementType for the element.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDElementType IOHIDElementGetType(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetCollectionType
|
||||
@abstract Retrieves the collection type for the element.
|
||||
@discussion The value returned by this method only makes sense if the element type is kIOHIDElementTypeCollection.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the IOHIDElementCollectionType for the element.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDElementCollectionType IOHIDElementGetCollectionType(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetUsagePage
|
||||
@abstract Retrieves the usage page for an element.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the usage page for the element.
|
||||
*/
|
||||
CF_EXPORT
|
||||
uint32_t IOHIDElementGetUsagePage(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetUsage
|
||||
@abstract Retrieves the usage for an element.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the usage for the element.
|
||||
*/
|
||||
CF_EXPORT
|
||||
uint32_t IOHIDElementGetUsage(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementIsVirtual
|
||||
@abstract Returns the virtual property for the element.
|
||||
@discussion Indicates whether the element is a virtual element.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the TRUE if virtual or FALSE if not.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDElementIsVirtual(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementIsRelative
|
||||
@abstract Returns the relative property for the element.
|
||||
@discussion Indicates whether the data is relative (indicating the change in value from the last report) or absolute
|
||||
(based on a fixed origin).
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns TRUE if relative or FALSE if absolute.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDElementIsRelative(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementIsWrapping
|
||||
@abstract Returns the wrap property for the element.
|
||||
@discussion Wrap indicates whether the data "rolls over" when reaching either the extreme high or low value.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns TRUE if wrapping or FALSE if non-wrapping.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDElementIsWrapping(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementIsArray
|
||||
@abstract Returns the array property for the element.
|
||||
@discussion Indicates whether the element represents variable or array data values. Variable values represent data from a
|
||||
physical control. An array returns an index in each field that corresponds to the pressed button
|
||||
(like keyboard scan codes).
|
||||
<br>
|
||||
<b>Note:</b> The HID Manager will represent most elements as "variable" including the possible usages of an array.
|
||||
Array indices will remain as "array" elements with a usage of 0xffffffff.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns TRUE if array or FALSE if variable.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDElementIsArray(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementIsNonLinear
|
||||
@abstract Returns the linear property for the element.
|
||||
@discussion Indicates whether the value for the element has been processed in some way, and no longer represents a linear
|
||||
relationship between what is measured and the value that is reported.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns TRUE if non linear or FALSE if linear.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDElementIsNonLinear(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementHasPreferredState
|
||||
@abstract Returns the preferred state property for the element.
|
||||
@discussion Indicates whether the element has a preferred state to which it will return when the user is not physically
|
||||
interacting with the control.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns TRUE if preferred state or FALSE if no preferred state.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDElementHasPreferredState(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementHasNullState
|
||||
@abstract Returns the null state property for the element.
|
||||
@discussion Indicates whether the element has a state in which it is not sending meaningful data.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns TRUE if null state or FALSE if no null state.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDElementHasNullState(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetName
|
||||
@abstract Returns the name for the element.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns CFStringRef containing the element name.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFStringRef IOHIDElementGetName(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetReportID
|
||||
@abstract Returns the report ID for the element.
|
||||
@discussion The report ID represents what report this particular element belongs to.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the report ID.
|
||||
*/
|
||||
CF_EXPORT
|
||||
uint32_t IOHIDElementGetReportID(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetReportSize
|
||||
@abstract Returns the report size in bits for the element.
|
||||
@discussion If the element is an array type the total number of bit in the element is equal to
|
||||
IOHIDElementGetReportSize(element) * IOHIDElementGetReportCount(element). Otherwise this size is the
|
||||
total number of bits in the element.
|
||||
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the report size.
|
||||
*/
|
||||
CF_EXPORT
|
||||
uint32_t IOHIDElementGetReportSize(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetReportCount
|
||||
@abstract Returns the report count for the element.
|
||||
@discussion If the IOHIDElementGetReportCount(element) is greater than one and the element does not represent an
|
||||
array then the element represents a repeated set of usages, the size of each usage in the element is
|
||||
IOHIDElementGetReportSize(element) / IOHIDElementGetReportCount(element).
|
||||
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the report count.
|
||||
*/
|
||||
CF_EXPORT
|
||||
uint32_t IOHIDElementGetReportCount(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetUnit
|
||||
@abstract Returns the unit property for the element.
|
||||
@discussion The unit property is described in more detail in Section 6.2.2.7 of the
|
||||
"Device Class Definition for Human Interface Devices(HID)" Specification, Version 1.11.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the unit.
|
||||
*/
|
||||
CF_EXPORT
|
||||
uint32_t IOHIDElementGetUnit(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetUnitExponent
|
||||
@abstract Returns the unit exponenet in base 10 for the element.
|
||||
@discussion The unit exponent property is described in more detail in Section 6.2.2.7 of the
|
||||
"Device Class Definition for Human Interface Devices(HID)" Specification, Version 1.11.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the unit exponent.
|
||||
*/
|
||||
CF_EXPORT
|
||||
uint32_t IOHIDElementGetUnitExponent(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetLogicalMin
|
||||
@abstract Returns the minimum value possible for the element.
|
||||
@discussion This corresponds to the logical minimun, which indicates the lower bounds of a variable element.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the logical minimum.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFIndex IOHIDElementGetLogicalMin(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetLogicalMax
|
||||
@abstract Returns the maximum value possible for the element.
|
||||
@discussion This corresponds to the logical maximum, which indicates the upper bounds of a variable element.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the logical maximum.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFIndex IOHIDElementGetLogicalMax(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetPhysicalMin
|
||||
@abstract Returns the scaled minimum value possible for the element.
|
||||
@discussion Minimum value for the physical extent of a variable element. This represents the value for the logical minimum with units applied to it.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the physical minimum.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFIndex IOHIDElementGetPhysicalMin(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetPhysicalMax
|
||||
@abstract Returns the scaled maximum value possible for the element.
|
||||
@discussion Maximum value for the physical extent of a variable element. This represents the value for the logical maximum with units applied to it.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@result Returns the physical maximum.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFIndex IOHIDElementGetPhysicalMax(IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementGetProperty
|
||||
@abstract Returns the an element property.
|
||||
@discussion Property keys are prefixed by kIOHIDElement and declared in IOHIDKeys.h.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@param key The key to be used when querying the element.
|
||||
@result Returns the property.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeRef _Nullable IOHIDElementGetProperty(IOHIDElementRef element, CFStringRef key)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDElementSetProperty
|
||||
@abstract Sets an element property.
|
||||
@discussion This method can be used to set arbitrary element properties, such as application specific references.
|
||||
@param element The element to be queried. If this parameter is not a valid IOHIDElementRef, the behavior is undefined.
|
||||
@param key The key to be used when querying the element.
|
||||
@result Returns TRUE if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDElementSetProperty(IOHIDElementRef element, CFStringRef key, CFTypeRef property)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDELEMENT_USER_H */
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 2019 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef IOHIDEventServiceKeys_h
|
||||
#define IOHIDEventServiceKeys_h
|
||||
|
||||
/*!
|
||||
* @define kIOHIDPointerAccelerationKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that contains the pointer acceleration value.
|
||||
*/
|
||||
#define kIOHIDPointerAccelerationKey "HIDPointerAcceleration"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDPointerAccelerationTypeKey
|
||||
*
|
||||
* @abstract
|
||||
* String property containing the type of acceleration for pointer.
|
||||
* Supported types are:
|
||||
* <code>kIOHIDPointerAccelerationKey</code>
|
||||
* <code>kIOHIDMouseScrollAccelerationKey</code>
|
||||
* <code>kIOHIDTrackpadAccelerationType</code>
|
||||
*/
|
||||
#define kIOHIDPointerAccelerationTypeKey "HIDPointerAccelerationType"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDMouseScrollAccelerationKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that contains the mouse scroll acceleration value.
|
||||
*/
|
||||
#define kIOHIDMouseScrollAccelerationKey "HIDMouseScrollAcceleration"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDMouseAccelerationTypeKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that contains the mouse acceleration value.
|
||||
*/
|
||||
#define kIOHIDMouseAccelerationTypeKey "HIDMouseAcceleration"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDScrollAccelerationKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that contains the scroll acceleration value.
|
||||
*/
|
||||
#define kIOHIDScrollAccelerationKey "HIDScrollAcceleration"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDScrollAccelerationTypeKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property containing the type of acceleration for scroll.
|
||||
* Supported types are:
|
||||
* <code>kIOHIDMouseScrollAccelerationKey</code>
|
||||
* <code>kIOHIDTrackpadScrollAccelerationKey</code>
|
||||
*/
|
||||
#define kIOHIDScrollAccelerationTypeKey "HIDScrollAccelerationType"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDDigitizerTipThresholdKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property that describes the threshold percentage for when the tip
|
||||
* pressure of a digitizer stylus should change from hovering to dragging.
|
||||
*
|
||||
* @discussion
|
||||
* If a digitizer stylus supports the kHIDUsage_Dig_TipPressure (0x30) usage,
|
||||
* the service may optionally publish this key to describe the value at which
|
||||
* the pressure should change the pointer behavior from hovering to dragging.
|
||||
* The value is a percentage from 0 to 100, where 100 percent is equal to the
|
||||
* logical max that the stylus dispatches. If no value is provided, the default
|
||||
* value of 75 will be used.
|
||||
*/
|
||||
#define kIOHIDDigitizerTipThresholdKey "DigitizerTipThreshold"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDSurfaceDimensionsKey
|
||||
*
|
||||
* @abstract
|
||||
* Dictionary property published on a service that describes the surface
|
||||
* dimensions for services that publish absolute X/Y values, such as digitizer
|
||||
* and pointer devices. The dictionary will contain the kIOHIDWidthKey and
|
||||
* kIOHIDHeightKey keys described below. Value is in millimeter represented
|
||||
* as IOFixed.
|
||||
*/
|
||||
#define kIOHIDSurfaceDimensionsKey "SurfaceDimensions"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDWidthKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property used in the surface dimensions dictionary described above.
|
||||
* Default value represents the physical max - physical min of the absolute
|
||||
* X value.
|
||||
*/
|
||||
#define kIOHIDWidthKey "Width"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDHeightKey
|
||||
*
|
||||
* @abstract
|
||||
* Number property used in the surface dimensions dictionary described above.
|
||||
* Default value represents the physical max - physical min of the absolute
|
||||
* Y value.
|
||||
*/
|
||||
#define kIOHIDHeightKey "Height"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDEventDriverHandlesReport
|
||||
*
|
||||
* @abstract
|
||||
* Boolean property used to let handleReport in an IOUserHIDEventDriver get the
|
||||
* report before any other processing is done in IOUserHIDEventService.
|
||||
* If this property is enabled the IOUserHIDEventService subclass should update
|
||||
* the elements with IOHIDInterface::processReport to update the IOHIDElements as
|
||||
* IOUserHIDEventService will not do this like when this property is not set.
|
||||
*/
|
||||
#define kIOHIDEventDriverHandlesReport "IOHIDEventDriverHandlesReport"
|
||||
|
||||
#endif /* IOHIDDeviceTypes_h */
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 2019 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef IOHIDEventServiceTypes_h
|
||||
#define IOHIDEventServiceTypes_h
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDKeyboardEventOptions
|
||||
*
|
||||
* @abstract
|
||||
* Keyboard event options passed in to dispatchKeyboardEvent function in
|
||||
* IOHIDEventService.
|
||||
*
|
||||
* @field kIOHIDKeyboardEventOptionsNoKeyRepeat
|
||||
* Default behavior for keyboard events is to repeat keys if the key has been
|
||||
* held down for a certain amount of time defined in system preferences. Pass
|
||||
* in this option to not apply key repeat logic to this event.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOHIDKeyboardEventOptionsNoKeyRepeat = (1 << 8),
|
||||
} IOHIDKeyboardEventOptions;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDPointerEventOptions
|
||||
*
|
||||
* @abstract
|
||||
* Pointer event options passed in to dispatch(Relative/Absolute)PointerEvent
|
||||
* function in IOHIDEventService.
|
||||
*
|
||||
* @field kIOHIDPointerEventOptionsNoAcceleration
|
||||
* Pointer events are subject to an acceleration algorithm. Pass in this option
|
||||
* if you do not wish to have acceleration logic applied to the pointer event.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOHIDPointerEventOptionsNoAcceleration = (1 << 8),
|
||||
} IOHIDPointerEventOptions;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDScrollEventOptions
|
||||
*
|
||||
* @abstract
|
||||
* Scroll event options passed in to dispatchScrollEvent function in
|
||||
* IOHIDEventService.
|
||||
*
|
||||
* @field kIOHIDScrollEventOptionsNoAcceleration
|
||||
* Scroll events are subject to an acceleration algorithm. Pass in this option
|
||||
* if you do not wish to have acceleration logic applied to the scroll event.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOHIDScrollEventOptionsNoAcceleration = (1 << 8),
|
||||
} IOHIDScrollEventOptions;
|
||||
|
||||
#endif /* IOHIDEventServiceTypes_h */
|
||||
@@ -0,0 +1,426 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2020 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDKEYS_H_
|
||||
#define _IOKIT_HID_IOHIDKEYS_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <IOKit/hidsystem/IOHIDParameter.h>
|
||||
#include <IOKit/IOReturn.h>
|
||||
#include <IOKit/IOMessage.h>
|
||||
#include <IOKit/hid/IOHIDProperties.h>
|
||||
#include <IOKit/hid/IOHIDDeviceTypes.h>
|
||||
#include <IOKit/hid/IOHIDDeviceKeys.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* The following keys are used to search the IORegistry for HID related services
|
||||
*/
|
||||
|
||||
/* This is used to find HID Devices in the IORegistry */
|
||||
#define kIOHIDDeviceKey "IOHIDDevice"
|
||||
|
||||
/*!
|
||||
@defined HID Device Property Keys
|
||||
@abstract Keys that represent properties of a paticular device.
|
||||
@discussion Keys that represent properties of a paticular device. Can be added
|
||||
to your matching dictionary when refining searches for HID devices.
|
||||
<br><br>
|
||||
<b>Please note:</b><br>
|
||||
kIOHIDPrimaryUsageKey and kIOHIDPrimaryUsagePageKey are no longer
|
||||
rich enough to describe a device's capabilities. Take, for example, a
|
||||
device that describes both a keyboard and a mouse in the same descriptor.
|
||||
The previous behavior was to only describe the keyboard behavior with the
|
||||
primary usage and usage page. Needless to say, this would sometimes cause
|
||||
a program interested in mice to skip this device when matching.
|
||||
<br>
|
||||
Thus we have added 3
|
||||
additional keys:
|
||||
<ul>
|
||||
<li>kIOHIDDeviceUsageKey</li>
|
||||
<li>kIOHIDDeviceUsagePageKey</li>
|
||||
<li>kIOHIDDeviceUsagePairsKey</li>
|
||||
</ul>
|
||||
kIOHIDDeviceUsagePairsKey is used to represent an array of dictionaries containing
|
||||
key/value pairs referenced by kIOHIDDeviceUsageKey and kIOHIDDeviceUsagePageKey.
|
||||
These usage pairs describe all application type collections (behaviors) defined
|
||||
by the device.
|
||||
<br><br>
|
||||
An application intersted in only matching on one criteria would only add the
|
||||
kIOHIDDeviceUsageKey and kIOHIDDeviceUsagePageKey keys to the matching dictionary.
|
||||
If it is interested in a device that has multiple behaviors, the application would
|
||||
instead add an array or dictionaries referenced by kIOHIDDeviceUsagePairsKey to his
|
||||
matching dictionary.
|
||||
*/
|
||||
#define kIOHIDVendorIDSourceKey "VendorIDSource"
|
||||
#define kIOHIDStandardTypeKey "StandardType"
|
||||
#define kIOHIDSampleIntervalKey "SampleInterval"
|
||||
#define kIOHIDResetKey "Reset"
|
||||
#define kIOHIDKeyboardLanguageKey "KeyboardLanguage"
|
||||
#define kIOHIDAltHandlerIdKey "alt_handler_id"
|
||||
#define kIOHIDDisplayIntegratedKey "DisplayIntegrated"
|
||||
#define kIOHIDProductIDMaskKey "ProductIDMask"
|
||||
#define kIOHIDProductIDArrayKey "ProductIDArray"
|
||||
#define kIOHIDPowerOnDelayNSKey "HIDPowerOnDelayNS"
|
||||
#define kIOHIDCategoryKey "Category"
|
||||
#define kIOHIDMaxResponseLatencyKey "MaxResponseLatency"
|
||||
#define kIOHIDUniqueIDKey "UniqueID"
|
||||
#define kIOHIDModelNumberKey "ModelNumber"
|
||||
|
||||
|
||||
#define kIOHIDTransportUSBValue "USB"
|
||||
#define kIOHIDTransportBluetoothValue "Bluetooth"
|
||||
#define kIOHIDTransportBluetoothLowEnergyValue "BluetoothLowEnergy"
|
||||
#define kIOHIDTransportAIDBValue "AID"
|
||||
#define kIOHIDTransportI2CValue "I2C"
|
||||
#define kIOHIDTransportSPIValue "SPI"
|
||||
#define kIOHIDTransportSerialValue "Serial"
|
||||
#define kIOHIDTransportIAPValue "iAP"
|
||||
#define kIOHIDTransportAirPlayValue "AirPlay"
|
||||
#define kIOHIDTransportSPUValue "SPU"
|
||||
#define kIOHIDTransportBTAACPValue "BT-AACP"
|
||||
|
||||
|
||||
#define kIOHIDCategoryAutomotiveValue "Automotive"
|
||||
|
||||
/*!
|
||||
@define kIOHIDElementKey
|
||||
@abstract Keys that represents an element property.
|
||||
@discussion Property for a HID Device or element dictionary.
|
||||
Elements can be heirarchical, so they can contain other elements.
|
||||
*/
|
||||
#define kIOHIDElementKey "Elements"
|
||||
|
||||
/*!
|
||||
@defined HID Element Dictionary Keys
|
||||
@abstract Keys that represent properties of a particular elements.
|
||||
@discussion These keys can also be added to a matching dictionary
|
||||
when searching for elements via copyMatchingElements.
|
||||
*/
|
||||
#define kIOHIDElementCookieKey "ElementCookie"
|
||||
#define kIOHIDElementTypeKey "Type"
|
||||
#define kIOHIDElementCollectionTypeKey "CollectionType"
|
||||
#define kIOHIDElementUsageKey "Usage"
|
||||
#define kIOHIDElementUsagePageKey "UsagePage"
|
||||
#define kIOHIDElementMinKey "Min"
|
||||
#define kIOHIDElementMaxKey "Max"
|
||||
#define kIOHIDElementScaledMinKey "ScaledMin"
|
||||
#define kIOHIDElementScaledMaxKey "ScaledMax"
|
||||
#define kIOHIDElementSizeKey "Size"
|
||||
#define kIOHIDElementReportSizeKey "ReportSize"
|
||||
#define kIOHIDElementReportCountKey "ReportCount"
|
||||
#define kIOHIDElementReportIDKey "ReportID"
|
||||
#define kIOHIDElementIsArrayKey "IsArray"
|
||||
#define kIOHIDElementIsRelativeKey "IsRelative"
|
||||
#define kIOHIDElementIsWrappingKey "IsWrapping"
|
||||
#define kIOHIDElementIsNonLinearKey "IsNonLinear"
|
||||
#define kIOHIDElementHasPreferredStateKey "HasPreferredState"
|
||||
#define kIOHIDElementHasNullStateKey "HasNullState"
|
||||
#define kIOHIDElementFlagsKey "Flags"
|
||||
#define kIOHIDElementUnitKey "Unit"
|
||||
#define kIOHIDElementUnitExponentKey "UnitExponent"
|
||||
#define kIOHIDElementNameKey "Name"
|
||||
#define kIOHIDElementValueLocationKey "ValueLocation"
|
||||
#define kIOHIDElementDuplicateIndexKey "DuplicateIndex"
|
||||
#define kIOHIDElementParentCollectionKey "ParentCollection"
|
||||
#define kIOHIDElementVariableSizeKey "VariableSize"
|
||||
|
||||
#ifndef __ppc__
|
||||
#define kIOHIDElementVendorSpecificKey "VendorSpecific"
|
||||
#else
|
||||
#define kIOHIDElementVendorSpecificKey "VendorSpecifc"
|
||||
#endif
|
||||
|
||||
/*!
|
||||
@defined HID Element Match Keys
|
||||
@abstract Keys used for matching particular elements.
|
||||
@discussion These keys should only be used with a matching
|
||||
dictionary when searching for elements via copyMatchingElements.
|
||||
*/
|
||||
#define kIOHIDElementCookieMinKey "ElementCookieMin"
|
||||
#define kIOHIDElementCookieMaxKey "ElementCookieMax"
|
||||
#define kIOHIDElementUsageMinKey "UsageMin"
|
||||
#define kIOHIDElementUsageMaxKey "UsageMax"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDElementCalibrationMinKey
|
||||
@abstract The minimum bounds for a calibrated value.
|
||||
*/
|
||||
#define kIOHIDElementCalibrationMinKey "CalibrationMin"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDElementCalibrationMaxKey
|
||||
@abstract The maximum bounds for a calibrated value.
|
||||
*/
|
||||
#define kIOHIDElementCalibrationMaxKey "CalibrationMax"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDElementCalibrationSaturationMinKey
|
||||
@abstract The mininum tolerance to be used when calibrating a logical element value.
|
||||
@discussion The saturation property is used to allow for slight differences in the minimum and maximum value returned by an element.
|
||||
*/
|
||||
#define kIOHIDElementCalibrationSaturationMinKey "CalibrationSaturationMin"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDElementCalibrationSaturationMaxKey
|
||||
@abstract The maximum tolerance to be used when calibrating a logical element value.
|
||||
@discussion The saturation property is used to allow for slight differences in the minimum and maximum value returned by an element.
|
||||
*/
|
||||
#define kIOHIDElementCalibrationSaturationMaxKey "CalibrationSaturationMax"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDElementCalibrationDeadZoneMinKey
|
||||
@abstract The minimum bounds near the midpoint of a logical value in which the value is ignored.
|
||||
@discussion The dead zone property is used to allow for slight differences in the idle value returned by an element.
|
||||
*/
|
||||
#define kIOHIDElementCalibrationDeadZoneMinKey "CalibrationDeadZoneMin"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDElementCalibrationDeadZoneMinKey
|
||||
@abstract The maximum bounds near the midpoint of a logical value in which the value is ignored.
|
||||
@discussion The dead zone property is used to allow for slight differences in the idle value returned by an element.
|
||||
*/
|
||||
#define kIOHIDElementCalibrationDeadZoneMaxKey "CalibrationDeadZoneMax"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDElementCalibrationGranularityKey
|
||||
@abstract The scale or level of detail returned in a calibrated element value.
|
||||
@discussion Values are rounded off such that if granularity=0.1, values after calibration are 0, 0.1, 0.2, 0.3, etc.
|
||||
*/
|
||||
#define kIOHIDElementCalibrationGranularityKey "CalibrationGranularity"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDKeyboardSupportsEscKey
|
||||
@abstract Describe if keyboard device supports esc key.
|
||||
@discussion Keyboard devices having full HID keyboard descriptor can specify if esc key is actually supported or not. For new macs with TouchBar this is ideal scenario where keyboard descriptor by defaultspecifies presence of esc key but through given property client can check if key is present or not
|
||||
*/
|
||||
#define kIOHIDKeyboardSupportsEscKey "HIDKeyboardSupportsEscKey"
|
||||
|
||||
/*!
|
||||
@typedef IOHIDOptionsType
|
||||
@abstract Options for opening a device via IOHIDLib.
|
||||
@constant kIOHIDOptionsTypeNone Default option.
|
||||
@constant kIOHIDOptionsTypeSeizeDevice Used to open exclusive
|
||||
communication with the device. This will prevent the system
|
||||
and other clients from receiving events from the device.
|
||||
*/
|
||||
enum {
|
||||
kIOHIDOptionsTypeNone = 0x00,
|
||||
kIOHIDOptionsTypeSeizeDevice = 0x01
|
||||
};
|
||||
typedef uint32_t IOHIDOptionsType;
|
||||
|
||||
|
||||
/*!
|
||||
@typedef IOHIDQueueOptionsType
|
||||
@abstract Options for creating a queue via IOHIDLib.
|
||||
@constant kIOHIDQueueOptionsTypeNone Default option.
|
||||
@constant kIOHIDQueueOptionsTypeEnqueueAll Force the IOHIDQueue
|
||||
to enqueue all events, relative or absolute, regardless of change.
|
||||
*/
|
||||
enum {
|
||||
kIOHIDQueueOptionsTypeNone = 0x00,
|
||||
kIOHIDQueueOptionsTypeEnqueueAll = 0x01
|
||||
};
|
||||
typedef uint32_t IOHIDQueueOptionsType;
|
||||
|
||||
/*!
|
||||
@typedef IOHIDStandardType
|
||||
@abstract Type to define what industrial standard the device is referencing.
|
||||
@constant kIOHIDStandardTypeANSI ANSI.
|
||||
@constant kIOHIDStandardTypeISO ISO.
|
||||
@constant kIOHIDStandardTypeJIS JIS.
|
||||
@constant kIOHIDStandardTypeUnspecified.
|
||||
*/
|
||||
enum {
|
||||
kIOHIDStandardTypeANSI = 0x0,
|
||||
kIOHIDStandardTypeISO = 0x1,
|
||||
kIOHIDStandardTypeJIS = 0x2,
|
||||
kIOHIDStandardTypeUnspecified = 0xFFFFFFFF,
|
||||
};
|
||||
typedef uint32_t IOHIDStandardType;
|
||||
|
||||
#define kIOHIDDigitizerGestureCharacterStateKey "DigitizerCharacterGestureState"
|
||||
|
||||
/*
|
||||
* kIOHIDSystemButtonPressedDuringDarkBoot - Used to message that a wake button was pressed during dark boot
|
||||
*/
|
||||
#define kIOHIDSystemButtonPressedDuringDarkBoot iokit_family_msg(sub_iokit_hidsystem, 7)
|
||||
|
||||
/*!
|
||||
@defined IOHIDKeyboard Keys
|
||||
@abstract Keys that represent parameters of keyboards.
|
||||
@discussion Legacy IOHIDKeyboard keys, formerly in IOHIDPrivateKeys. See IOHIDServiceKeys.h for the new keys.
|
||||
*/
|
||||
#define kIOHIDKeyboardCapsLockDelay "CapsLockDelay"
|
||||
#define kIOHIDKeyboardEjectDelay "EjectDelay"
|
||||
|
||||
/*!
|
||||
@defined kFnFunctionUsageMapKey
|
||||
@abstract top row key remapping for consumer usages
|
||||
@discussion string of comma separated uint64_t value representing (usagePage<<32) | usage pairs
|
||||
|
||||
*/
|
||||
#define kFnFunctionUsageMapKey "FnFunctionUsageMap"
|
||||
|
||||
/*!
|
||||
@defined kFnKeyboardUsageMapKey
|
||||
@abstract top row key reampping for consumer usages
|
||||
@discussion string of comma separated uint64_t value representing (usagePage<<32) | usage pairs
|
||||
|
||||
*/
|
||||
#define kFnKeyboardUsageMapKey "FnKeyboardUsageMap"
|
||||
|
||||
#define kNumLockKeyboardUsageMapKey "NumLockKeyboardUsageMap"
|
||||
|
||||
#define kKeyboardUsageMapKey "KeyboardUsageMap"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDDeviceOpenedByEventSystemKey
|
||||
@abstract Property set when corresponding event service object opened by HID event system
|
||||
@discussion boolean value
|
||||
|
||||
*/
|
||||
#define kIOHIDDeviceOpenedByEventSystemKey "DeviceOpenedByEventSystem"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDDeviceSuspendKey
|
||||
*
|
||||
* @abstract
|
||||
* Boolean property set on a user space IOHIDDeviceRef to suspend report delivery
|
||||
* to registered callbacks.
|
||||
*
|
||||
* @discussion
|
||||
* When set to true, the callbacks registered via the following API will not be invoked:
|
||||
* IOHIDDeviceRegisterInputReportCallback
|
||||
* IOHIDDeviceRegisterInputReportWithTimeStampCallback
|
||||
* IOHIDDeviceRegisterInputValueCallback
|
||||
* To resume report delivery, this property should be set to false.
|
||||
*/
|
||||
#define kIOHIDDeviceSuspendKey "IOHIDDeviceSuspend"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDMaxReportBufferCountKey
|
||||
* @abstract Number property published for an IOHIDDevice that contains the
|
||||
* report buffer count.
|
||||
* @discussion IOHIDLibUserClient connections to an IOHIDDevice created
|
||||
* using IOKit/hid/IOHIDDevice.h/IOHIDDeviceCreate have a report
|
||||
* buffer, where reports can be enqueued and dispatched in quick succession.
|
||||
* A report buffer count can be published to help determine the
|
||||
* correct queue size that will be able to handle incoming report
|
||||
* rates. The queue size is determined by report buffer count
|
||||
* multiplied by the report buffer's entry size, this total size is
|
||||
* limited to 131072 bytes. This property can be set in the
|
||||
* IOHIDDevice's IOKit property table, or on the individual
|
||||
* IOHIDLibUserClient connection using IOHIDDeviceSetProperty.
|
||||
* (See kIOHIDReportBufferEntrySizeKey).
|
||||
*/
|
||||
#define kIOHIDMaxReportBufferCountKey "MaxReportBufferCount"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDReportBufferEntrySizeKey
|
||||
* @abstract Number property published on an IOHIDDevice that contains
|
||||
* the report buffer's entry size.
|
||||
* @discussion This key describes the entry size of the reports (in bytes)
|
||||
* in the report buffer between an IOHIDLibUserClient and its
|
||||
* associated IOHIDDevice. The queue size is determined by the
|
||||
* report buffer's report count multiplied by the entry size. The
|
||||
* buffer entry size is currently limited to 8167 bytes, exceeding
|
||||
* this value will result in a minimum queue size. This property
|
||||
* can be set in the IOHIDDevice's IOKit property table, or on the individual
|
||||
* IOHIDLibUserClient connection using IOHIDDeviceSetProperty.
|
||||
* (See kIOHIDMaxReportBufferCountKey).
|
||||
*/
|
||||
#define kIOHIDReportBufferEntrySizeKey "ReportBufferEntrySize"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDSensorPropertyReportIntervalKey
|
||||
@abstract Property to get or set the Report Interval in us of supported sensor devices
|
||||
@discussion Corresponds to kHIDUsage_Snsr_Property_ReportInterval in a sensor device's
|
||||
descriptor.
|
||||
*/
|
||||
#define kIOHIDSensorPropertyReportIntervalKey kIOHIDReportIntervalKey
|
||||
|
||||
/*!
|
||||
@defined kIOHIDSensorPropertySampleIntervalKey
|
||||
@abstract Property to get or set the Sample Interval in us of supported sensor devices
|
||||
@discussion Corresponds to kHIDUsage_Snsr_Property_SamplingRate in a sensor device's
|
||||
descriptor.
|
||||
*/
|
||||
#define kIOHIDSensorPropertySampleIntervalKey kIOHIDSampleIntervalKey
|
||||
|
||||
/*!
|
||||
@defined kIOHIDSensorPropertyBatchIntervalKey
|
||||
@abstract Property to get or set the Batch Interval / Report Latency in us of supported sensor devices
|
||||
@discussion Corresponds to kHIDUsage_Snsr_Property_ReportLatency in a sensor device's
|
||||
descriptor.
|
||||
*/
|
||||
#define kIOHIDSensorPropertyBatchIntervalKey kIOHIDBatchIntervalKey
|
||||
|
||||
/*!
|
||||
@defined kIOHIDSensorPropertyReportLatencyKey
|
||||
@abstract Alias of kIOHIDSensorPropertyBatchIntervalKey
|
||||
*/
|
||||
#define kIOHIDSensorPropertyReportLatencyKey kIOHIDSensorPropertyBatchIntervalKey
|
||||
|
||||
/*!
|
||||
@defined kIOHIDSensorPropertyMaxFIFOEventsKey
|
||||
@abstract Property to get or set the maximum FIFO event queue size of supported sensor devices
|
||||
@discussion Corresponds to kHIDUsage_Snsr_Property_MaxFIFOEvents in a sensor device's
|
||||
descriptor.
|
||||
*/
|
||||
#define kIOHIDSensorPropertyMaxFIFOEventsKey "MaxFIFOEvents"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDDigitizerSurfaceSwitchKey
|
||||
@abstract Property to turn on / of surface digitizer contact reporting
|
||||
@discussion To allow for better power management, a host may wish to indicate what it would like a touchpad digitizer to not report surface digitizer contacts by clearing this
|
||||
flag. By default, upon cold‐boot/power cycle, touchpads that support reporting surface
|
||||
contacts shall do so by default.
|
||||
*/
|
||||
|
||||
#define kIOHIDDigitizerSurfaceSwitchKey "DigitizerSurfaceSwitch"
|
||||
|
||||
|
||||
/*!
|
||||
@defined kIOHIDPointerAccelerationSupportKey
|
||||
@abstract Property to turn enable/disable acceleration of relative pointer events
|
||||
@discussion A boolean value to enable devices that report movement precisely but using relative positions,
|
||||
if false the events from the device will not have acceleration applied to the event value calculation.
|
||||
If the key is not set then the device will have acceleration applied to it's events by default.
|
||||
*/
|
||||
#define kIOHIDPointerAccelerationSupportKey "HIDSupportsPointerAcceleration"
|
||||
|
||||
/*!
|
||||
@defined kIOHIDScrollAccelerationSupportKey
|
||||
@abstract Property to turn enable/disable acceleration of scroll events
|
||||
@discussion A boolean value to enable devices that report scroll precisely but using relative positions,
|
||||
if false the events from the device will not have acceleration applied to the event value calculation.
|
||||
If the key is not set then the device will have acceleration applied to it's events by default.
|
||||
*/
|
||||
#define kIOHIDScrollAccelerationSupportKey "HIDSupportsScrollAcceleration"
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_IOKIT_HID_IOHIDKEYS_H_ */
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDLIB_H_
|
||||
#define _IOKIT_HID_IOHIDLIB_H_
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/IOTypes.h>
|
||||
#include <IOKit/IOReturn.h>
|
||||
#include <IOKit/hid/IOHIDBase.h>
|
||||
#include <IOKit/hid/IOHIDDevice.h>
|
||||
#include <IOKit/hid/IOHIDElement.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
#include <IOKit/hid/IOHIDLibObsolete.h>
|
||||
#include <IOKit/hid/IOHIDManager.h>
|
||||
#include <IOKit/hid/IOHIDQueue.h>
|
||||
#include <IOKit/hid/IOHIDUsageTables.h>
|
||||
#include <IOKit/hid/IOHIDValue.h>
|
||||
#include <IOKit/hid/IOHIDTransaction.h>
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDLIB_H_ */
|
||||
@@ -0,0 +1,858 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDLIBOBSOLETE_H_
|
||||
#define _IOKIT_HID_IOHIDLIBOBSOLETE_H_
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#if COREFOUNDATION_CFPLUGINCOM_SEPARATE
|
||||
#include <CoreFoundation/CFPlugInCOM.h>
|
||||
#endif
|
||||
|
||||
#include <IOKit/IOTypes.h>
|
||||
#include <IOKit/IOReturn.h>
|
||||
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
|
||||
struct IOHIDEventStruct
|
||||
{
|
||||
IOHIDElementType type;
|
||||
IOHIDElementCookie elementCookie;
|
||||
int32_t value;
|
||||
AbsoluteTime timestamp;
|
||||
uint32_t longValueSize;
|
||||
void * longValue;
|
||||
};
|
||||
typedef struct IOHIDEventStruct IOHIDEventStruct;
|
||||
|
||||
/* FA12FA38-6F1A-11D4-BA0C-0005028F18D5 */
|
||||
#define kIOHIDDeviceUserClientTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xFA, 0x12, 0xFA, 0x38, 0x6F, 0x1A, 0x11, 0xD4, \
|
||||
0xBA, 0x0C, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
|
||||
|
||||
/* 78BD420C-6F14-11D4-9474-0005028F18D5 */
|
||||
/*! @defined kIOHIDDeviceInterfaceID
|
||||
@discussion Interface ID for the IOHIDDeviceInterface. Corresponds to an
|
||||
available HID device. */
|
||||
#define kIOHIDDeviceInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x78, 0xBD, 0x42, 0x0C, 0x6F, 0x14, 0x11, 0xD4, \
|
||||
0x94, 0x74, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
|
||||
|
||||
/* 7D0B510E-16D5-11D7-9E9B-000393992E38 */
|
||||
/*! @defined kIOHIDDeviceInterfaceID121
|
||||
@discussion Interface ID for the IOHIDDeviceInterface121. Corresponds to
|
||||
an available HID device that includes methods from
|
||||
IOHIDDeviceInterface. This interface is available on
|
||||
IOHIDLib 1.2.1 and Mac OS X 10.2.3 or later.*/
|
||||
#define kIOHIDDeviceInterfaceID121 CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x7d, 0xb, 0x51, 0xe, 0x16, 0xd5, 0x11, 0xd7, \
|
||||
0x9e, 0x9b, 0x0, 0x3, 0x93, 0x99, 0x2e, 0x38)
|
||||
|
||||
/* B70ABF31-16D5-11D7-AB35-000393992E38 */
|
||||
/*! @defined kIOHIDDeviceInterfaceID122
|
||||
@discussion Interface ID for the IOHIDDeviceInterface122. Corresponds to
|
||||
an available HID device that includes methods from
|
||||
IOHIDDeviceInterface and IOHIDDeviceInterface121. This
|
||||
interface is available on IOHIDLib 1.2.2 and Mac OS X 10.3
|
||||
or later.*/
|
||||
#define kIOHIDDeviceInterfaceID122 CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xb7, 0xa, 0xbf, 0x31, 0x16, 0xd5, 0x11, 0xd7, \
|
||||
0xab, 0x35, 0x0, 0x3, 0x93, 0x99, 0x2e, 0x38)
|
||||
|
||||
/* 8138629E-6F14-11D4-970E-0005028F18D5 */
|
||||
/*! @defined kIOHIDQueueInterfaceID
|
||||
@discussion Interface ID for the kIOHIDQueueInterfaceID. Corresponds to a
|
||||
queue for a specific HID device. */
|
||||
#define kIOHIDQueueInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x81, 0x38, 0x62, 0x9E, 0x6F, 0x14, 0x11, 0xD4, \
|
||||
0x97, 0x0E, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
|
||||
|
||||
/* 80CDCC00-755D-11D4-8E0F-0005028F18D5 */
|
||||
/*! @defined kIOHIDOutputTransactionInterfaceID
|
||||
@discussion Interface ID for the kIOHIDOutputTransactionInterfaceID.
|
||||
Corresponds to an output transaction for one or more report IDs
|
||||
on a specific device. */
|
||||
#define kIOHIDOutputTransactionInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL,\
|
||||
0x80, 0xCD, 0xCC, 0x00, 0x75, 0x5D, 0x11, 0xD4, \
|
||||
0x80, 0xEF, 0x00, 0x05, 0x02, 0x8F, 0x18, 0xD5)
|
||||
|
||||
/*! @typedef IOHIDCallbackFunction
|
||||
@discussion Type and arguments of callout C function that is used when a
|
||||
completion routine is called, see
|
||||
IOHIDLib.h:setRemovalCallback().
|
||||
@param target void * pointer to your data, often a pointer to an object.
|
||||
@param result Completion result of desired operation.
|
||||
@param refcon void * pointer to more data.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
*/
|
||||
typedef void (*IOHIDCallbackFunction)(void * target, IOReturn result, void * refcon, void * sender);
|
||||
|
||||
/*! @typedef IOHIDElementCallbackFunction
|
||||
@discussion Type and arguments of callout C function that is used when a
|
||||
completion routine is called, see IOHIDLib.h:setElementValue().
|
||||
@param target void * pointer to your data, often a pointer to an object.
|
||||
@param result Completion result of desired operation.
|
||||
@param refcon void * pointer to more data.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
@param elementCookie Element within interface instance sending completion.
|
||||
*/
|
||||
typedef void (*IOHIDElementCallbackFunction) (void * target, IOReturn result, void * refcon, void * sender, IOHIDElementCookie elementCookie);
|
||||
|
||||
/*! @typedef IOHIDReportCallbackFunction
|
||||
@discussion Type and arguments of callout C function that is used when a
|
||||
completion routine is called, see IOHIDLib.h:setReport().
|
||||
@param target void * pointer to your data, often a pointer to an object.
|
||||
@param result Completion result of desired operation.
|
||||
@param refcon void * pointer to more data.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
@param bufferSize Size of the buffer received upon completion.
|
||||
*/
|
||||
typedef void (*IOHIDReportCallbackFunction) (void * target, IOReturn result, void * refcon, void * sender, uint32_t bufferSize);
|
||||
|
||||
|
||||
/* Forward declarations of the queue and output transaction interfaces */
|
||||
struct IOHIDQueueInterface;
|
||||
struct IOHIDOutputTransactionInterface;
|
||||
typedef struct IOHIDQueueInterface IOHIDQueueInterface;
|
||||
typedef struct IOHIDOutputTransactionInterface IOHIDOutputTransactionInterface;
|
||||
|
||||
//
|
||||
// IOHIDDeviceInterface Functions available in version 1.0 (10.0) and higher of Mac OS X
|
||||
//
|
||||
#define IOHIDDEVICEINTERFACE_FUNCS_100 \
|
||||
IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \
|
||||
CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \
|
||||
IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \
|
||||
mach_port_t (*getAsyncPort)(void * self); \
|
||||
IOReturn (*open)(void * self, IOOptionBits flags); \
|
||||
IOReturn (*close)(void * self); \
|
||||
IOReturn (*setRemovalCallback)(void * self, IOHIDCallbackFunction removalCallback, \
|
||||
void * removalTarget, void * removalRefcon); \
|
||||
IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, \
|
||||
IOHIDEventStruct * valueEvent); \
|
||||
IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, \
|
||||
IOHIDEventStruct * valueEvent, uint32_t timeoutMS, \
|
||||
IOHIDElementCallbackFunction callback, \
|
||||
void * callbackTarget, void * callbackRefcon); \
|
||||
IOReturn (*queryElementValue)(void * self, IOHIDElementCookie elementCookie, \
|
||||
IOHIDEventStruct * valueEvent, uint32_t timeoutMS, \
|
||||
IOHIDElementCallbackFunction callback, \
|
||||
void * callbackTarget, void * callbackRefcon); \
|
||||
IOReturn (*startAllQueues)(void * self); \
|
||||
IOReturn (*stopAllQueues)(void * self); \
|
||||
IOHIDQueueInterface ** (*allocQueue) (void *self); \
|
||||
IOHIDOutputTransactionInterface ** (*allocOutputTransaction) (void *self)
|
||||
|
||||
//
|
||||
// IOHIDDeviceInterface Functions available in version 1.2.1 (10.2.3) and higher of Mac OS X
|
||||
//
|
||||
#define IOHIDDEVICEINTERFACE_FUNCS_121 \
|
||||
IOReturn (*setReport)(void * self, IOHIDReportType reportType, uint32_t reportID, \
|
||||
void * reportBuffer, uint32_t reportBufferSize, \
|
||||
uint32_t timeoutMS, IOHIDReportCallbackFunction callback, \
|
||||
void * callbackTarget, void * callbackRefcon); \
|
||||
IOReturn (*getReport)(void * self, IOHIDReportType reportType, \
|
||||
uint32_t reportID, void * reportBuffer, \
|
||||
uint32_t * reportBufferSize, uint32_t timeoutMS, \
|
||||
IOHIDReportCallbackFunction callback, \
|
||||
void * callbackTarget, void * callbackRefcon)
|
||||
|
||||
//
|
||||
// IOHIDDeviceInterface Functions available in version 1.2.2 (10.3) and higher of Mac OS X
|
||||
//
|
||||
#define IOHIDDEVICEINTERFACE_FUNCS_122 \
|
||||
IOReturn (*copyMatchingElements)(void * self, CFDictionaryRef matchingDict, \
|
||||
CFArrayRef * elements); \
|
||||
IOReturn (*setInterruptReportHandlerCallback)(void * self, void * reportBuffer, \
|
||||
uint32_t reportBufferSize, \
|
||||
IOHIDReportCallbackFunction callback, \
|
||||
void * callbackTarget, void * callbackRefcon)
|
||||
|
||||
typedef struct IOHIDDeviceInterface
|
||||
{
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_100;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_121;
|
||||
} IOHIDDeviceInterface;
|
||||
|
||||
typedef struct IOHIDDeviceInterface121
|
||||
{
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_100;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_121;
|
||||
} IOHIDDeviceInterface121;
|
||||
|
||||
typedef struct IOHIDDeviceInterface122
|
||||
{
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_100;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_121;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_122;
|
||||
} IOHIDDeviceInterface122;
|
||||
|
||||
//
|
||||
// IOHIDQueueInterface Functions available in version 1.0 (10.0) and higher of Mac OS X
|
||||
//
|
||||
#define IOHIDQUEUEINTERFACE_FUNCS_100 \
|
||||
IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \
|
||||
CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \
|
||||
IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \
|
||||
mach_port_t (*getAsyncPort)(void * self); \
|
||||
IOReturn (*create)(void * self, uint32_t flags, uint32_t depth); \
|
||||
IOReturn (*dispose)(void * self); \
|
||||
IOReturn (*addElement)(void * self, IOHIDElementCookie elementCookie, uint32_t flags);\
|
||||
IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); \
|
||||
Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); \
|
||||
IOReturn (*start)(void * self); \
|
||||
IOReturn (*stop)(void * self); \
|
||||
IOReturn (*getNextEvent)(void * self, IOHIDEventStruct * event, \
|
||||
AbsoluteTime maxTime, uint32_t timeoutMS); \
|
||||
IOReturn (*setEventCallout)(void * self, IOHIDCallbackFunction callback, \
|
||||
void * callbackTarget, void * callbackRefcon); \
|
||||
IOReturn (*getEventCallout)(void * self, IOHIDCallbackFunction * outCallback, \
|
||||
void ** outCallbackTarget, void ** outCallbackRefcon)
|
||||
|
||||
struct IOHIDQueueInterface
|
||||
{
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOHIDQUEUEINTERFACE_FUNCS_100;
|
||||
};
|
||||
|
||||
//
|
||||
// IOHIDOutputTransactionInterface Functions available in version 1.2 (10.2) and higher of Mac OS X
|
||||
//
|
||||
#define IOHIDOUTPUTTRANSACTIONINTERFACE_FUNCS_120 \
|
||||
IOReturn (*createAsyncEventSource)(void * self, CFRunLoopSourceRef * source); \
|
||||
CFRunLoopSourceRef (*getAsyncEventSource)(void * self); \
|
||||
IOReturn (*createAsyncPort)(void * self, mach_port_t * port); \
|
||||
mach_port_t (*getAsyncPort)(void * self); \
|
||||
IOReturn (*create)(void * self); \
|
||||
IOReturn (*dispose)(void * self); \
|
||||
IOReturn (*addElement)(void * self, IOHIDElementCookie elementCookie); \
|
||||
IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie); \
|
||||
Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie); \
|
||||
IOReturn (*setElementDefault)(void *self, IOHIDElementCookie elementCookie, \
|
||||
IOHIDEventStruct * valueEvent); \
|
||||
IOReturn (*getElementDefault)(void * self, IOHIDElementCookie elementCookie, \
|
||||
IOHIDEventStruct * outValueEvent); \
|
||||
IOReturn (*setElementValue)(void * self, IOHIDElementCookie elementCookie, \
|
||||
IOHIDEventStruct * valueEvent); \
|
||||
IOReturn (*getElementValue)(void * self, IOHIDElementCookie elementCookie, \
|
||||
IOHIDEventStruct * outValueEvent); \
|
||||
IOReturn (*commit)(void * self, uint32_t timeoutMS, IOHIDCallbackFunction callback, \
|
||||
void * callbackTarget, void * callbackRefcon); \
|
||||
IOReturn (*clear)(void * self)
|
||||
|
||||
struct IOHIDOutputTransactionInterface
|
||||
{
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOHIDOUTPUTTRANSACTIONINTERFACE_FUNCS_120;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// BEGIN READABLE STRUCTURE DEFINITIONS
|
||||
//
|
||||
// This portion of uncompiled code provides a more reader friendly representation of
|
||||
// the CFPlugin methods defined above.
|
||||
|
||||
#if 0
|
||||
/*! @class IOHIDDeviceInterface
|
||||
@discussion CFPlugin object subclass which provides the primary interface to
|
||||
HID devices.
|
||||
*/
|
||||
typedef struct IOHIDDeviceInterface
|
||||
{
|
||||
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
/*! @function createAsyncEventSource
|
||||
@abstract Creates async eventsource.
|
||||
@discussion This method will create an async mach port, if one
|
||||
has not already been created.
|
||||
@param source Reference to CFRunLoopSourceRef that is created.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*createAsyncEventSource)(void * self,
|
||||
CFRunLoopSourceRef * source);
|
||||
|
||||
/*! @function getAsyncEventSource
|
||||
@abstract Gets the created async event source.
|
||||
@result Returns a CFRunLoopSourceRef.
|
||||
*/
|
||||
CFRunLoopSourceRef (*getAsyncEventSource)(void * self);
|
||||
|
||||
/*! @function createAsyncPort
|
||||
@abstract Creates an async port.
|
||||
@discussion The port must be created before any callbacks can be used.
|
||||
@param port Reference to mach port that is created.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*createAsyncPort)(void * self, mach_port_t * port);
|
||||
|
||||
/*! @function getAsyncPort
|
||||
@abstract Gets the current async port.
|
||||
@result Returns a mach_port_t.
|
||||
*/
|
||||
mach_port_t (*getAsyncPort)(void * self);
|
||||
|
||||
/*! @function open
|
||||
@abstract Opens the device.
|
||||
@param flags Flags to be passed down to the user client.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*open)(void * self, uint32_t flags);
|
||||
|
||||
/*! @function close
|
||||
@abstract Closes the device.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*close)(void * self);
|
||||
|
||||
/*! @function setRemovalCallback
|
||||
@abstract Sets callback to be used when device is removed.
|
||||
@param removalCallback Called when the device is removed.
|
||||
@param removalTarget Passed to the callback.
|
||||
@param removalRefcon Passed to the callback.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*setRemovalCallback)(void * self,
|
||||
IOHIDCallbackFunction removalCallback,
|
||||
void * removalTarget,
|
||||
void * removalRefcon);
|
||||
|
||||
/*! @function getElementValue
|
||||
@abstract Obtains the most recent value of an element.
|
||||
@discussion This call is most useful for interrupt driven elements,
|
||||
such as input type elements. Since feature type element values
|
||||
need to be polled from the device, it is recommended to use the
|
||||
queryElementValue method to obtain the current value. The
|
||||
timestamp field in the event details the last time the element
|
||||
value was altered.
|
||||
@param elementCookie The element of interest.
|
||||
@param valueEvent The event that will be filled. If a long value is
|
||||
present, it is up to the caller to deallocate it.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*getElementValue)(void * self,
|
||||
IOHIDElementCookie elementCookie,
|
||||
IOHIDEventStruct * valueEvent);
|
||||
|
||||
/*! @function setElementValue
|
||||
@abstract Sets an element value on the device.
|
||||
@discussion This call is most useful for feature type elements. It is
|
||||
recommended to use IOOutputTransaction for output type elements.
|
||||
@param elementCookie The element of interest.
|
||||
@param valueEvent The event that will be filled. If a long value is
|
||||
present, it will be copied.
|
||||
@param timeoutMS UNSUPPORTED.
|
||||
@param callback UNSUPPORTED.
|
||||
@param callbackTarget UNSUPPORTED.
|
||||
@param callbackRefcon UNSUPPORTED.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*setElementValue)(void * self,
|
||||
IOHIDElementCookie elementCookie,
|
||||
IOHIDEventStruct * valueEvent,
|
||||
uint32_t timeoutMS,
|
||||
IOHIDElementCallbackFunction callback,
|
||||
void * callbackTarget,
|
||||
void * callbackRefcon);
|
||||
|
||||
/*! @function queryElementValue
|
||||
@abstract Obtains the current value of an element.
|
||||
@discussion This call is most useful for feature type elements. This
|
||||
method will poll the device for the current element value.
|
||||
@param elementCookie The element of interest.
|
||||
@param valueEvent The event that will be filled. If a long value is
|
||||
present, it is up to the caller to deallocate it.
|
||||
@param timeoutMS UNSUPPORTED.
|
||||
@param callback UNSUPPORTED.
|
||||
@param callbackTarget UNSUPPORTED.
|
||||
@param callbackRefcon UNSUPPORTED.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*queryElementValue)(void * self,
|
||||
IOHIDElementCookie elementCookie,
|
||||
IOHIDEventStruct * valueEvent,
|
||||
uint32_t timeoutMS,
|
||||
IOHIDElementCallbackFunction callback,
|
||||
void * callbackTarget,
|
||||
void * callbackRefcon);
|
||||
|
||||
/*! @function startAllQueues
|
||||
@abstract Starts data delivery on all queues for this device.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*startAllQueues)(void * self);
|
||||
|
||||
/*! @function stopAllQueues
|
||||
@abstract Stops data delivery on all queues for this device.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*stopAllQueues)(void * self);
|
||||
|
||||
/*! @function allocQueue
|
||||
@abstract Wrapper to return instances of the IOHIDQueueInterface.
|
||||
@result Returns the created IOHIDQueueInterface.
|
||||
*/
|
||||
IOHIDQueueInterface ** (*allocQueue) (void *self);
|
||||
|
||||
/*! @function allocOutputTransaction
|
||||
@abstract Wrapper to return instances of the IOHIDOutputTransactionInterface.
|
||||
@result Returns the created IOHIDOutputTransactionInterface.
|
||||
*/
|
||||
IOHIDOutputTransactionInterface ** (*allocOutputTransaction) (void *self);
|
||||
|
||||
} IOHIDDeviceInterface;
|
||||
|
||||
/*! @class IOHIDDeviceInterface121
|
||||
@discussion CFPlugin object subclass which provides the primary interface to
|
||||
HID devices. This class is a subclass of IOHIDDeviceInterface.
|
||||
*/
|
||||
typedef struct IOHIDDeviceInterface121
|
||||
{
|
||||
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_100;
|
||||
|
||||
/*! @function setReport
|
||||
@abstract Sends a report to the device.
|
||||
@param reportType The report type.
|
||||
@param reportID The report id.
|
||||
@param reportBuffer Pointer to a preallocated buffer.
|
||||
@param reportBufferSize Size of the reportBuffer in bytes.
|
||||
@param timeoutMS
|
||||
@param callback If null, this method will behave synchronously.
|
||||
@param callbackTarget The callback target passed to the callback.
|
||||
@param callbackRefcon The callback refcon passed to the callback.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*setReport) (void * self,
|
||||
IOHIDReportType reportType,
|
||||
uint32_t reportID,
|
||||
void * reportBuffer,
|
||||
uint32_t reportBufferSize,
|
||||
uint32_t timeoutMS,
|
||||
IOHIDReportCallbackFunction callback,
|
||||
void * callbackTarget,
|
||||
void * callbackRefcon);
|
||||
|
||||
/*! @function getReport
|
||||
@abstract Obtains a report from the device.
|
||||
@param reportType The report type.
|
||||
@param reportID The report ID.
|
||||
@param reportBuffer Pointer to a preallocated buffer.
|
||||
@param reportBufferSize Size of the reportBuffer in bytes.
|
||||
When finished, will contain the actual size of the report.
|
||||
@param timeoutMS
|
||||
@param callback If null, this method will behave synchronously.
|
||||
@param callbackTarget The callback target passed to the callback.
|
||||
@param callbackRefcon The callback refcon passed to the callback.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*getReport) (void * self,
|
||||
IOHIDReportType reportType,
|
||||
uint32_t reportID,
|
||||
void * reportBuffer,
|
||||
uint32_t * reportBufferSize,
|
||||
uint32_t timeoutMS,
|
||||
IOHIDReportCallbackFunction callback,
|
||||
void * callbackTarget,
|
||||
void * callbackRefcon);
|
||||
|
||||
}IOHIDDeviceInterface121;
|
||||
|
||||
/*! @class IOHIDDeviceInterface122
|
||||
@discussion CFPlugin object subclass which provides the primary interface to
|
||||
HID devices. This class is a subclass of IOHIDDeviceInterface121.
|
||||
*/
|
||||
typedef struct IOHIDDeviceInterface122
|
||||
{
|
||||
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_100;
|
||||
IOHIDDEVICEINTERFACE_FUNCS_121;
|
||||
|
||||
/*! @function copyMatchingElements
|
||||
@abstract Obtains specific elements defined by the device.
|
||||
@discussion Using keys defined in IOHIDKeys.h for elements, create a
|
||||
matching dictonary containing items that you wish to search for.
|
||||
A null array indicates that no elements matching that criteria
|
||||
were found. Each item in the array is a reference to the same
|
||||
dictionary item that represents each element in the I/O Registry.
|
||||
It is up to the caller to release the returned array of elements.
|
||||
@param matchingDict Dictionary containg key/value pairs to match on. Pass
|
||||
a null value to match on all elements.
|
||||
@param elements Pointer to a CFArrayRef that will be returned by this
|
||||
method. It is up to the caller to release it when finished.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*copyMatchingElements)(void * self,
|
||||
CFDictionaryRef matchingDict,
|
||||
CFArrayRef * elements);
|
||||
|
||||
/*! @function setInterruptReportHandlerCallback
|
||||
@abstract Sets the report handler callout to be called when the data
|
||||
is received from the Interrupt-In pipe.
|
||||
@discussion In order for this to work correctly, you must call
|
||||
createAsyncPort and createAsyncEventSource.
|
||||
@param reportBuffer Pointer to a preallocated buffer.
|
||||
@param reportBufferSize Size of the reportBuffer in bytes.
|
||||
@param callback If non-NULL, is a callback to be called when data
|
||||
is received from the device.
|
||||
@param callbackTarget The callback target passed to the callback
|
||||
@param callbackRefcon The callback refcon passed to the callback.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*setInterruptReportHandlerCallback)(
|
||||
void * self,
|
||||
void * reportBuffer,
|
||||
uint32_t reportBufferSize,
|
||||
IOHIDReportCallbackFunction callback,
|
||||
void * callbackTarget,
|
||||
void * callbackRefcon);
|
||||
|
||||
}IOHIDDeviceInterface122;
|
||||
|
||||
/*! @class IOHIDQueueInterface
|
||||
@discussion CFPlugin object subclass which provides an interface for input
|
||||
queues from HID devices. Created by an IOHIDDeviceInterface
|
||||
object.
|
||||
*/
|
||||
typedef struct IOHIDQueueInterface
|
||||
{
|
||||
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
/*! @function createAsyncEventSource
|
||||
@abstract Creates an async event source.
|
||||
@discussion This will be used with setEventCallout.
|
||||
@param source The newly created event source.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*createAsyncEventSource)(void * self,
|
||||
CFRunLoopSourceRef * source);
|
||||
|
||||
/*! @function getAsyncEventSource
|
||||
@abstract Obtains the current event source.
|
||||
@result Returns a CFRunLoopSourceRef.
|
||||
*/
|
||||
CFRunLoopSourceRef (*getAsyncEventSource)(void * self);
|
||||
|
||||
/*! @function createAsyncPort
|
||||
@abstract Creates an async port.
|
||||
@discussion This will be used with createAsyncEventSource.
|
||||
@param port The newly created async port.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*createAsyncPort)(void * self, mach_port_t * port);
|
||||
|
||||
/*! @function getAsyncPort
|
||||
@abstract Obtains the current async port.
|
||||
@result Returns a mach_port_t.
|
||||
*/
|
||||
mach_port_t (*getAsyncPort)(void * self);
|
||||
|
||||
/*! @function create
|
||||
@abstract Creates the current queue.
|
||||
@param flags Pass kIOHIDQueueOptionsTypeEnqueueAll option to
|
||||
force the IOHIDQueue to enqueue all events, relative or absolute,
|
||||
regardless of change.
|
||||
@param depth The maximum number of elements in the queue
|
||||
before the oldest elements in the queue begin to be lost.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*create)(void * self,
|
||||
uint32_t flags,
|
||||
uint32_t depth);
|
||||
|
||||
/*! @function dispose
|
||||
@abstract Disposes of the current queue.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*dispose)(void * self);
|
||||
|
||||
/*! @function addElement
|
||||
@abstract Adds an element to the queue.
|
||||
@discussion If the element has already been added to queue,
|
||||
an error will be returned.
|
||||
@param elementCookie The element of interest.
|
||||
@param flags
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*addElement)(void * self,
|
||||
IOHIDElementCookie elementCookie,
|
||||
uint32_t flags);
|
||||
|
||||
/*! @function removeElement
|
||||
@abstract Removes an element from the queue.
|
||||
@discussion If the element has not been added to queue,
|
||||
an error will be returned.
|
||||
@param elementCookie The element of interest.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*removeElement)(void * self, IOHIDElementCookie elementCookie);
|
||||
|
||||
/*! @function hasElement
|
||||
@abstract Checks whether an element has been added to
|
||||
the queue.
|
||||
@discussion Will return true if present, otherwise will return false.
|
||||
@param elementCookie The element of interest.
|
||||
@result Returns a Boolean value.
|
||||
*/
|
||||
Boolean (*hasElement)(void * self, IOHIDElementCookie elementCookie);
|
||||
|
||||
/*! @function start
|
||||
@abstract Starts event delivery to the queue.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*start)(void * self);
|
||||
|
||||
/*! @function stop
|
||||
@abstract Stops event delivery to the queue.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*stop)(void * self);
|
||||
|
||||
/*! @function getNextEvent
|
||||
@abstract Reads next event from the queue.
|
||||
@param event The event that will be filled. If a long value is
|
||||
present, it is up to the caller to deallocate it.
|
||||
@param maxTime UNSUPPORTED. If non-zero, limits read events to
|
||||
those that occurred on or before maxTime.
|
||||
@param timeoutMS UNSUPPORTED. The timeout in milliseconds, a zero
|
||||
timeout will cause this call to be non-blocking (returning
|
||||
queue empty) if there is a NULL callback, and blocking forever
|
||||
until the queue is non-empty if there is a valid callback.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*getNextEvent)(void * self,
|
||||
IOHIDEventStruct * event,
|
||||
AbsoluteTime maxTime,
|
||||
uint32_t timeoutMS);
|
||||
|
||||
/*! @function setEventCallout
|
||||
@abstract Sets the event callout to be called when the queue
|
||||
transitions to non-empty.
|
||||
@discussion In order for this to work correctly, you must call
|
||||
createAsyncPort and createAsyncEventSource.
|
||||
@param callback if non-NULL is a callback to be called when data
|
||||
is inserted to the queue
|
||||
@param callbackTarget The callback target passed to the callback
|
||||
@param callbackRefcon The callback refcon passed to the callback.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*setEventCallout)(void * self,
|
||||
IOHIDCallbackFunction callback,
|
||||
void * callbackTarget,
|
||||
void * callbackRefcon);
|
||||
|
||||
/*! @function getEventCallout
|
||||
@abstract Gets the event callout.
|
||||
@discussion This callback will be called the queue transitions
|
||||
to non-empty.
|
||||
@param outCallback if non-NULL is a callback to be called when data
|
||||
is inserted to the queue
|
||||
@param outCallbackTarget The callback target passed to the callback
|
||||
@param outCallbackRefcon The callback refcon passed to the callback
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*getEventCallout)(void * self,
|
||||
IOHIDCallbackFunction * outCallback,
|
||||
void ** outCallbackTarget,
|
||||
void ** outCallbackRefcon);
|
||||
} IOHIDQueueInterface;
|
||||
|
||||
/*! @class IOHIDOutputTransactionInterface
|
||||
@discussion CFPlugin object subclass which privides interface for output
|
||||
transactions to HID devices. Created by a IOHIDDeviceInterface
|
||||
object. */
|
||||
|
||||
typedef struct IOHIDOutputTransactionInterface
|
||||
{
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
/*! @function createAsyncEventSource
|
||||
@abstract Creates an async event source.
|
||||
@discussion This will be used with setEventCallout.
|
||||
@param source The newly created event source
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*createAsyncEventSource)(void * self,
|
||||
CFRunLoopSourceRef * source);
|
||||
|
||||
/*! @function getAsyncEventSource
|
||||
@abstract Obtains the current event source.
|
||||
@result Returns a CFRunLoopSourceRef.
|
||||
*/
|
||||
CFRunLoopSourceRef (*getAsyncEventSource)(void * self);
|
||||
|
||||
/*! @function createAsyncPort
|
||||
@abstract Creates an async port.
|
||||
@discussion This will be used with createAsyncEventSource.
|
||||
@param port The newly created async port.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*createAsyncPort)(void * self, mach_port_t * port);
|
||||
|
||||
/*! @function getAsyncPort
|
||||
@abstract Obtains the current async port.
|
||||
@result Returns a mach_port_t.
|
||||
*/
|
||||
mach_port_t (*getAsyncPort)(void * self);
|
||||
|
||||
/*! @function create
|
||||
@abstract Creates the current transaction.
|
||||
@discussion This method will free any memory that has been
|
||||
allocated for this transaction.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*create)(void * self);
|
||||
|
||||
/*! @function dispose
|
||||
@abstract Disposes of the current transaction.
|
||||
@discussion The transaction will have to be recreated, in order
|
||||
to perform any operations on the transaction.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*dispose)(void * self);
|
||||
|
||||
/*! @function addElement
|
||||
@abstract Adds an element to the transaction.
|
||||
@discussion If the element has already been added to transaction,
|
||||
an error will be returned.
|
||||
@param elementCookie The element of interest.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*addElement) (void * self, IOHIDElementCookie elementCookie);
|
||||
|
||||
/*! @function removeElement
|
||||
@abstract Removes an element from the transaction.
|
||||
@discussion If the element has not been added to transaction,
|
||||
an error will be returned.
|
||||
@param elementCookie The element of interest.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*removeElement) (void * self, IOHIDElementCookie elementCookie);
|
||||
|
||||
/*! @function hasElement
|
||||
@abstract Checks whether an element has been added to
|
||||
the transaction.
|
||||
@discussion Will return true if present, otherwise will return false.
|
||||
@param elementCookie The element of interest.
|
||||
@result Returns a Boolean value.
|
||||
*/
|
||||
Boolean (*hasElement) (void * self, IOHIDElementCookie elementCookie);
|
||||
|
||||
/*! @function setElementDefault
|
||||
@abstract Sets the default value of an element in a
|
||||
transaction.
|
||||
@discussion An error will be returned if the element has not been
|
||||
added to the transaction.
|
||||
@param elementCookie The element of interest.
|
||||
@param valueEvent The event that will be filled. If a long value is
|
||||
present, it will be copied.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*setElementDefault)(void * self,
|
||||
IOHIDElementCookie elementCookie,
|
||||
IOHIDEventStruct * valueEvent);
|
||||
|
||||
/*! @function getElementDefault
|
||||
@abstract Obtains the default value of an element in a
|
||||
transaction.
|
||||
@discussion An error will be returned if the element has not been
|
||||
added to the transaction.
|
||||
@param elementCookie The element of interest.
|
||||
@param outValueEvent The event that will be filled. If a long value is
|
||||
present, it is up to the caller to deallocate it.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*getElementDefault)(void * self,
|
||||
IOHIDElementCookie elementCookie,
|
||||
IOHIDEventStruct * outValueEvent);
|
||||
|
||||
/*! @function setElementValue
|
||||
@abstract Sets the value of an element in a transaction.
|
||||
@discussion An error will be returned if the element has not been
|
||||
added to the transaction.
|
||||
@param elementCookie The element of interest.
|
||||
@param valueEvent The event that will be filled. If a long value is
|
||||
present, it will be copied.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*setElementValue)(void * self,
|
||||
IOHIDElementCookie elementCookie,
|
||||
IOHIDEventStruct * valueEvent);
|
||||
|
||||
/*! @function getElementValue
|
||||
@abstract Obtains the value of an element in a transaction.
|
||||
@discussion An error will be returned if the element has not been
|
||||
added to the transaction.
|
||||
@param elementCookie The element of interest.
|
||||
@param outValueEvent The event that will be filled. If a long value is
|
||||
present, it is up to the caller to deallocate it.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*getElementValue)(void * self,
|
||||
IOHIDElementCookie elementCookie,
|
||||
IOHIDEventStruct * outValueEvent);
|
||||
|
||||
/*! @function commit
|
||||
@abstract Commits the transaction.
|
||||
@discussion Transaction element values, if set, will be sent to the
|
||||
device. Otherwise, the default element value will be used. If
|
||||
neither are set, that element will be omitted from the commit.
|
||||
After a transaction is committed, transaction element values
|
||||
will be cleared. Default values will be preserved.
|
||||
@param timeoutMS UNSUPPORTED
|
||||
@param callback UNSUPPORTED
|
||||
@param callbackTarget UNSUPPORTED
|
||||
@param callbackRefcon UNSUPPORTED
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*commit)(void * self,
|
||||
uint32_t timeoutMS,
|
||||
IOHIDCallbackFunction callback,
|
||||
void * callbackTarget,
|
||||
void * callbackRefcon);
|
||||
|
||||
/*! @function clear
|
||||
@abstract Clears the transaction.
|
||||
@discussion Transaction element values will cleared. Default
|
||||
values will be preserved.
|
||||
@result Returns an IOReturn code.
|
||||
*/
|
||||
IOReturn (*clear)(void * self);
|
||||
} IOHIDOutputTransactionInterface;
|
||||
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* !_IOKIT_HID_IOHIDLIBOBSOLETE_H_ */
|
||||
@@ -0,0 +1,552 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDMANAGER_H_
|
||||
#define _IOKIT_HID_IOHIDMANAGER_H_
|
||||
|
||||
#include <IOKit/IOTypes.h>
|
||||
#include <IOKit/IOReturn.h>
|
||||
#include <IOKit/hid/IOHIDLib.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
/*!
|
||||
@header IOHIDManager
|
||||
IOHIDManager defines an Human Interface Device (HID) managment object.
|
||||
It provides global interaction with managed HID devices such as
|
||||
discovery/removal and receiving input events. IOHIDManager is also a CFType
|
||||
object and as such conforms to all the conventions expected such object.
|
||||
<p>
|
||||
This documentation assumes that you have a basic understanding of the
|
||||
material contained in <a href="http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/index.html"><i>Accessing Hardware From Applications</i></a>
|
||||
For definitions of I/O Kit terms used in this documentation, such as
|
||||
matching dictionary, family, and driver, see the overview of I/O Kit terms
|
||||
and concepts n the "Device Access and the I/O Kit" chapter of
|
||||
<i>Accessing Hardware From Applications</i>.
|
||||
|
||||
This documentation also assumes you have read <a href="http://developer.apple.com/documentation/DeviceDrivers/HumanInterfaceDeviceForceFeedback-date.html"><i>Human Interface Device & Force Feedback</i></a>.
|
||||
Please review documentation before using this reference.
|
||||
<p>
|
||||
All of the information described in this document is contained in the header
|
||||
file <font face="Courier New,Courier,Monaco">IOHIDManager.h</font> found at
|
||||
<font face="Courier New,Courier,Monaco">/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDManager.h</font>.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
/*!
|
||||
@enum IOHIDManagerOptions
|
||||
@abstract Various options that can be supplied to IOHIDManager functions.
|
||||
@const kIOHIDManagerOptionNone For those times when supplying 0 just isn't
|
||||
explicit enough.
|
||||
@const kIOHIDManagerOptionUsePersistentProperties This constant can be
|
||||
supplied to @link IOHIDManagerCreate @/link to create and/or use a
|
||||
persistent properties store.
|
||||
@const kIOHIDManagerOptionDoNotLoadProperties This constant can be supplied
|
||||
to @link IOHIDManagerCreate when you wish to overwrite the
|
||||
persistent properties store without loading it first.
|
||||
@const kIOHIDManagerOptionDoNotSaveProperties This constant can be supplied
|
||||
to @link IOHIDManagerCreate @/link when you want to use the
|
||||
persistent property store but do not want to add to it.
|
||||
@const kIOHIDManagerOptionIndependentDevices Devices maintained by the
|
||||
manager will act independently from calls to the manager.
|
||||
This allows for devices to be scheduled on separate queues, and
|
||||
their lifetime can persist after the manager is gone.
|
||||
|
||||
The following calls will not be propagated to the devices:
|
||||
IOHIDManagerOpen, IOHIDManagerClose, IOHIDManagerScheduleWithRunLoop,
|
||||
IOHIDManagerUnscheduleFromRunLoop, IOHIDManagerSetDispatchQueue,
|
||||
IOHIDManagerSetCancelHandler, IOHIDManagerActivate, IOHIDManagerCancel,
|
||||
IOHIDManagerRegisterInputReportCallback,
|
||||
IOHIDManagerRegisterInputReportWithTimeStampCallback,
|
||||
IOHIDManagerRegisterInputValueCallback, IOHIDManagerSetInputValueMatching,
|
||||
IOHIDManagerSetInputValueMatchingMultiple,
|
||||
|
||||
This also means that the manager will not be able to receive input
|
||||
reports or input values, since the devices may or may not be scheduled.
|
||||
*/
|
||||
typedef CF_OPTIONS(uint32_t, IOHIDManagerOptions) {
|
||||
kIOHIDManagerOptionNone = 0x0,
|
||||
kIOHIDManagerOptionUsePersistentProperties = 0x1,
|
||||
kIOHIDManagerOptionDoNotLoadProperties = 0x2,
|
||||
kIOHIDManagerOptionDoNotSaveProperties = 0x4,
|
||||
kIOHIDManagerOptionIndependentDevices = 0x8,
|
||||
};
|
||||
|
||||
/*! @typedef IOHIDManagerRef
|
||||
@abstract This is the type of a reference to the IOHIDManager.
|
||||
*/
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDManager * IOHIDManagerRef;
|
||||
|
||||
/*!
|
||||
@function IOHIDManagerGetTypeID
|
||||
@abstract Returns the type identifier of all IOHIDManager instances.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeID IOHIDManagerGetTypeID(void)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDManagerCreate
|
||||
@abstract Creates an IOHIDManager object.
|
||||
@discussion The IOHIDManager object is meant as a global management system
|
||||
for communicating with HID devices.
|
||||
@param allocator Allocator to be used during creation.
|
||||
@param options Supply @link kIOHIDManagerOptionUsePersistentProperties @/link to load
|
||||
properties from the default persistent property store. Otherwise supply
|
||||
@link kIOHIDManagerOptionNone @/link (or 0).
|
||||
@result Returns a new IOHIDManagerRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDManagerRef IOHIDManagerCreate(
|
||||
CFAllocatorRef _Nullable allocator,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDManagerOpen
|
||||
@abstract Opens the IOHIDManager.
|
||||
@discussion This will open both current and future devices that are
|
||||
enumerated. To establish an exclusive link use the
|
||||
kIOHIDOptionsTypeSeizeDevice option.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param options Option bits to be sent down to the manager and device.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDManagerOpen(
|
||||
IOHIDManagerRef manager,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDManagerClose
|
||||
@abstract Closes the IOHIDManager.
|
||||
@discussion This will also close all devices that are currently enumerated.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param options Option bits to be sent down to the manager and device.
|
||||
@result Returns kIOReturnSuccess if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDManagerClose(
|
||||
IOHIDManagerRef manager,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDManagerGetProperty
|
||||
@abstract Obtains a property of an IOHIDManager.
|
||||
@discussion Property keys are prefixed by kIOHIDDevice and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param key CFStringRef containing key to be used when querying the
|
||||
manager.
|
||||
@result Returns CFTypeRef containing the property.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeRef _Nullable IOHIDManagerGetProperty(
|
||||
IOHIDManagerRef manager,
|
||||
CFStringRef key)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDManagerSetProperty
|
||||
@abstract Sets a property for an IOHIDManager.
|
||||
@discussion Property keys are prefixed by kIOHIDDevice and kIOHIDManager and
|
||||
declared in <IOKit/hid/IOHIDKeys.h>. This method will propagate
|
||||
any relevent properties to current and future devices that are
|
||||
enumerated.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param key CFStringRef containing key to be used when modifiying the
|
||||
device property.
|
||||
@param value CFTypeRef containing the property value to be set.
|
||||
@result Returns TRUE if successful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDManagerSetProperty(
|
||||
IOHIDManagerRef manager,
|
||||
CFStringRef key,
|
||||
CFTypeRef value)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerScheduleWithRunLoop
|
||||
@abstract Schedules HID manager with run loop.
|
||||
@discussion Formally associates manager with client's run loop. Scheduling
|
||||
this device with the run loop is necessary before making use of
|
||||
any asynchronous APIs. This will propagate to current and
|
||||
future devices that are enumerated.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param runLoop RunLoop to be used when scheduling any asynchronous
|
||||
activity.
|
||||
@param runLoopMode Run loop mode to be used when scheduling any
|
||||
asynchronous activity.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerScheduleWithRunLoop(
|
||||
IOHIDManagerRef manager,
|
||||
CFRunLoopRef runLoop,
|
||||
CFStringRef runLoopMode)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerUnscheduleFromRunLoop
|
||||
@abstract Unschedules HID manager with run loop.
|
||||
@discussion Formally disassociates device with client's run loop. This will
|
||||
propagate to current devices that are enumerated.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param runLoop RunLoop to be used when unscheduling any asynchronous
|
||||
activity.
|
||||
@param runLoopMode Run loop mode to be used when unscheduling any
|
||||
asynchronous activity.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerUnscheduleFromRunLoop(
|
||||
IOHIDManagerRef manager,
|
||||
CFRunLoopRef runLoop,
|
||||
CFStringRef runLoopMode)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
* @function IOHIDManagerSetDispatchQueue
|
||||
*
|
||||
* @abstract
|
||||
* Sets the dispatch queue to be associated with the IOHIDManager.
|
||||
* This is necessary in order to receive asynchronous events from the kernel.
|
||||
*
|
||||
* @discussion
|
||||
* An IOHIDManager should not be associated with both a runloop and
|
||||
* dispatch queue. A call to IOHIDManagerSetDispatchQueue should only be made once.
|
||||
*
|
||||
* After a dispatch queue is set, the IOHIDManager must make a call to activate
|
||||
* via IOHIDManagerActivate and cancel via IOHIDManagerCancel. All calls to "Register"
|
||||
* functions should be done before activation and not after cancellation.
|
||||
*
|
||||
* @param manager
|
||||
* Reference to an IOHIDManager
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the event handler block will be submitted.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerSetDispatchQueue(
|
||||
IOHIDManagerRef manager,
|
||||
dispatch_queue_t queue)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDManagerSetCancelHandler
|
||||
*
|
||||
* @abstract
|
||||
* Sets a cancellation handler for the dispatch queue associated with
|
||||
* IOHIDManagerSetDispatchQueue.
|
||||
*
|
||||
* @discussion
|
||||
* The cancellation handler (if specified) will be will be submitted to the
|
||||
* manager's dispatch queue in response to a call to IOHIDManagerCancel after
|
||||
* all the events have been handled.
|
||||
*
|
||||
* IOHIDManagerSetCancelHandler should not be used when scheduling with
|
||||
* a run loop.
|
||||
*
|
||||
* The IOHIDManagerRef should only be released after the manager has been
|
||||
* cancelled, and the cancel handler has been called. This is to ensure all
|
||||
* asynchronous objects are released. For example:
|
||||
*
|
||||
* dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
|
||||
* CFRelease(manager);
|
||||
* });
|
||||
* IOHIDManagerSetCancelHandler(manager, cancelHandler);
|
||||
* IOHIDManagerActivate(manager);
|
||||
* IOHIDManageCancel(manager);
|
||||
*
|
||||
* @param manager
|
||||
* Reference to an IOHIDManager.
|
||||
*
|
||||
* @param handler
|
||||
* The cancellation handler block to be associated with the dispatch queue.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerSetCancelHandler(
|
||||
IOHIDManagerRef manager,
|
||||
dispatch_block_t handler)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDManagerActivate
|
||||
*
|
||||
* @abstract
|
||||
* Activates the IOHIDManager object.
|
||||
*
|
||||
* @discussion
|
||||
* An IOHIDManager object associated with a dispatch queue is created
|
||||
* in an inactive state. The object must be activated in order to
|
||||
* receive asynchronous events from the kernel.
|
||||
*
|
||||
* A dispatch queue must be set via IOHIDManagerSetDispatchQueue before
|
||||
* activation.
|
||||
*
|
||||
* An activated manager must be cancelled via IOHIDManagerCancel. All calls
|
||||
* to "Register" functions should be done before activation
|
||||
* and not after cancellation.
|
||||
*
|
||||
* Calling IOHIDManagerActivate on an active IOHIDManager has no effect.
|
||||
*
|
||||
* @param manager
|
||||
* Reference to an IOHIDManager
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerActivate( IOHIDManagerRef manager)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDManagerCancel
|
||||
*
|
||||
* @abstract
|
||||
* Cancels the IOHIDManager preventing any further invocation
|
||||
* of its event handler block.
|
||||
*
|
||||
* @discussion
|
||||
* Cancelling prevents any further invocation of the event handler block for
|
||||
* the specified dispatch queue, but does not interrupt an event handler
|
||||
* block that is already in progress.
|
||||
*
|
||||
* Explicit cancellation of the IOHIDManager is required, no implicit
|
||||
* cancellation takes place.
|
||||
*
|
||||
* Calling IOHIDManagerCancel on an already cancelled queue has no effect.
|
||||
*
|
||||
* The IOHIDManagerRef should only be released after the manager has been
|
||||
* cancelled, and the cancel handler has been called. This is to ensure all
|
||||
* asynchronous objects are released. For example:
|
||||
*
|
||||
* dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
|
||||
* CFRelease(manager);
|
||||
* });
|
||||
* IOHIDManagerSetCancelHandler(manager, cancelHandler);
|
||||
* IOHIDManagerActivate(manager);
|
||||
* IOHIDManageCancel(manager);
|
||||
*
|
||||
* @param manager
|
||||
* Reference to an IOHIDManager
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerCancel( IOHIDManagerRef manager)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*! @function IOHIDManagerSetDeviceMatching
|
||||
@abstract Sets matching criteria for device enumeration.
|
||||
@discussion Matching keys are prefixed by kIOHIDDevice and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>. Passing a NULL dictionary will result
|
||||
in all devices being enumerated. Any subsequent calls will cause
|
||||
the hid manager to release previously enumerated devices and
|
||||
restart the enuerate process using the revised criteria. If
|
||||
interested in multiple, specific device classes, please defer to
|
||||
using IOHIDManagerSetDeviceMatchingMultiple.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param matching CFDictionaryRef containg device matching criteria.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerSetDeviceMatching(
|
||||
IOHIDManagerRef manager,
|
||||
CFDictionaryRef _Nullable matching)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerSetDeviceMatchingMultiple
|
||||
@abstract Sets multiple matching criteria for device enumeration.
|
||||
@discussion Matching keys are prefixed by kIOHIDDevice and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>. This method is useful if interested
|
||||
in multiple, specific device classes.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param multiple CFArrayRef containing multiple CFDictionaryRef objects
|
||||
containg device matching criteria.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerSetDeviceMatchingMultiple(
|
||||
IOHIDManagerRef manager,
|
||||
CFArrayRef _Nullable multiple)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerCopyDevices
|
||||
@abstract Obtains currently enumerated devices.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@result CFSetRef containing IOHIDDeviceRefs.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFSetRef _Nullable IOHIDManagerCopyDevices(
|
||||
IOHIDManagerRef manager)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerRegisterDeviceMatchingCallback
|
||||
@abstract Registers a callback to be used a device is enumerated.
|
||||
@discussion Only device matching the set criteria will be enumerated.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
Devices provided in the callback will be scheduled with the same
|
||||
runloop/dispatch queue as the IOHIDManagerRef, and should not be
|
||||
rescheduled.
|
||||
@param manager Reference to an IOHIDManagerRef.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDDeviceCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerRegisterDeviceMatchingCallback(
|
||||
IOHIDManagerRef manager,
|
||||
IOHIDDeviceCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerRegisterDeviceRemovalCallback
|
||||
@abstract Registers a callback to be used when any enumerated device is
|
||||
removed.
|
||||
@discussion In most cases this occurs when a device is unplugged.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param manager Reference to an IOHIDManagerRef.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDDeviceCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerRegisterDeviceRemovalCallback(
|
||||
IOHIDManagerRef manager,
|
||||
IOHIDDeviceCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerRegisterInputReportCallback
|
||||
@abstract Registers a callback to be used when an input report is issued by
|
||||
any enumerated device.
|
||||
@discussion An input report is an interrupt driver report issued by a device.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param manager Reference to an IOHIDManagerRef.
|
||||
@param callback Pointer to a callback method of type IOHIDReportCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerRegisterInputReportCallback(
|
||||
IOHIDManagerRef manager,
|
||||
IOHIDReportCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerRegisterInputReportWithTimeStampCallback
|
||||
@abstract Registers a callback to be used when an input report is issued by
|
||||
any enumerated device.
|
||||
@discussion An input report is an interrupt driver report issued by a device.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param manager Reference to an IOHIDManagerRef.
|
||||
@param callback Pointer to a callback method of type
|
||||
IOHIDReportWithTimeStampCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
void IOHIDManagerRegisterInputReportWithTimeStampCallback(
|
||||
IOHIDManagerRef manager,
|
||||
IOHIDReportWithTimeStampCallback callback,
|
||||
void * _Nullable context)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*! @function IOHIDManagerRegisterInputValueCallback
|
||||
@abstract Registers a callback to be used when an input value is issued by
|
||||
any enumerated device.
|
||||
@discussion An input element refers to any element of type
|
||||
kIOHIDElementTypeInput and is usually issued by interrupt driven
|
||||
reports.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param manager Reference to an IOHIDManagerRef.
|
||||
@param callback Pointer to a callback method of type IOHIDValueCallback.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerRegisterInputValueCallback(
|
||||
IOHIDManagerRef manager,
|
||||
IOHIDValueCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerSetInputValueMatching
|
||||
@abstract Sets matching criteria for input values received via
|
||||
IOHIDManagerRegisterInputValueCallback.
|
||||
@discussion Matching keys are prefixed by kIOHIDElement and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>. Passing a NULL dictionary will result
|
||||
in all devices being enumerated. Any subsequent calls will cause
|
||||
the hid manager to release previously matched input elements and
|
||||
restart the matching process using the revised criteria. If
|
||||
interested in multiple, specific device elements, please defer to
|
||||
using IOHIDManagerSetInputValueMatchingMultiple.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param matching CFDictionaryRef containg device matching criteria.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerSetInputValueMatching(
|
||||
IOHIDManagerRef manager,
|
||||
CFDictionaryRef _Nullable matching)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*! @function IOHIDManagerSetInputValueMatchingMultiple
|
||||
@abstract Sets multiple matching criteria for input values received via
|
||||
IOHIDManagerRegisterInputValueCallback.
|
||||
@discussion Matching keys are prefixed by kIOHIDElement and declared in
|
||||
<IOKit/hid/IOHIDKeys.h>. This method is useful if interested
|
||||
in multiple, specific elements.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param multiple CFArrayRef containing multiple CFDictionaryRef objects
|
||||
containing input element matching criteria.
|
||||
*/
|
||||
|
||||
CF_EXPORT
|
||||
void IOHIDManagerSetInputValueMatchingMultiple(
|
||||
IOHIDManagerRef manager,
|
||||
CFArrayRef _Nullable multiple)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@abstract Used to write out the current properties to a specific domain.
|
||||
@discussion Using this function will cause the persistent properties to be saved out
|
||||
replacing any properties that already existed in the specified domain. All arguments
|
||||
must be non-NULL except options.
|
||||
@param manager Reference to an IOHIDManager.
|
||||
@param applicationID Reference to a CFPreferences applicationID.
|
||||
@param userName Reference to a CFPreferences userName.
|
||||
@param hostName Reference to a CFPreferences hostName.
|
||||
@param options Reserved for future use.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDManagerSaveToPropertyDomain(IOHIDManagerRef manager,
|
||||
CFStringRef applicationID,
|
||||
CFStringRef userName,
|
||||
CFStringRef hostName,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDMANAGER_H_ */
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef IOHIDProperties_h
|
||||
#define IOHIDProperties_h
|
||||
|
||||
#include <IOKit/hid/IOHIDEventServiceKeys.h>
|
||||
|
||||
/*!
|
||||
* @define kIOHIDMouseAccelerationType
|
||||
*
|
||||
* @abstract CFNumber that contains the mouse acceleration value.
|
||||
*/
|
||||
#define kIOHIDMouseAccelerationType "HIDMouseAcceleration"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDPointerButtonMode
|
||||
*
|
||||
* @abstract CFNumber containing the current pointer button mode.
|
||||
* See IOHIDButtonModes enumerator for possible modes.
|
||||
*/
|
||||
#define kIOHIDPointerButtonMode "HIDPointerButtonMode"
|
||||
#define kIOHIDPointerButtonModeKey kIOHIDPointerButtonMode
|
||||
|
||||
/*!
|
||||
* @define kIOHIDUserUsageMapKey
|
||||
*
|
||||
* @abstract CFArray of dictionaries that contain user defined key mappings.
|
||||
*/
|
||||
#define kIOHIDUserKeyUsageMapKey "UserKeyMapping"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDKeyboardCapsLockDelayOverride
|
||||
*
|
||||
* @abstract CFNumber containing the delay (in ms) before the caps lock key is activated.
|
||||
*/
|
||||
#define kIOHIDKeyboardCapsLockDelayOverride "CapsLockDelayOverride"
|
||||
#define kIOHIDKeyboardCapsLockDelayOverrideKey kIOHIDKeyboardCapsLockDelayOverride
|
||||
|
||||
/*!
|
||||
* @define kIOHIDServiceEjectDelayKey
|
||||
*
|
||||
* @abstract CFNumber containing the delay (in ms) before the eject key is activated.
|
||||
*/
|
||||
#define kIOHIDServiceEjectDelayKey "EjectDelay"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDServiceLockKeyDelayKey
|
||||
*
|
||||
* @abstract CFNumber containing the delay (in ms) before the lock key is activated.
|
||||
*/
|
||||
#define kIOHIDServiceLockKeyDelayKey "LockKeyDelay"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDServiceInitialKeyRepeatDelayKey
|
||||
*
|
||||
* @abstract CFNumber containing the delay (in ns) before the initial key repeat.
|
||||
* If value is 0, there are no repeats.
|
||||
*/
|
||||
#define kIOHIDServiceInitialKeyRepeatDelayKey "HIDInitialKeyRepeat"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDServiceKeyRepeatDelayKey
|
||||
*
|
||||
* @abstract CFNumber containing the delay (in ns) for subsequent key repeats.
|
||||
* If value is 0, there are no repeats (including initial).
|
||||
*/
|
||||
#define kIOHIDServiceKeyRepeatDelayKey "HIDKeyRepeat"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDIdleTimeMicrosecondsKey
|
||||
*
|
||||
* @abstract CFNumber containing the HID idle time in microseconds.
|
||||
*/
|
||||
#define kIOHIDIdleTimeMicrosecondsKey "HIDIdleTimeMicroseconds"
|
||||
|
||||
/*!
|
||||
* @define kIOHIDServiceCapsLockStateKey
|
||||
*
|
||||
* @abstract CFBoolean for setting/getting the caps lock state of the
|
||||
* service. The caps lock LED will be updated to reflect the state.
|
||||
*/
|
||||
#define kIOHIDServiceCapsLockStateKey "HIDCapsLockState"
|
||||
|
||||
#endif /* IOHIDProperties_h */
|
||||
@@ -0,0 +1,416 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDQUEUE_USER_H
|
||||
#define _IOKIT_HID_IOHIDQUEUE_USER_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/hid/IOHIDBase.h>
|
||||
|
||||
/*!
|
||||
@header IOHIDQueue
|
||||
IOHIDQueue defines an object used to queue values from input parsed items
|
||||
(IOHIDElement) contained within a Human Interface Device (HID) object. This
|
||||
object is useful when you need to keep track of all values of an input
|
||||
element, rather than just the most recent one. IOHIDQueue is a CFType
|
||||
object and as such conforms to all the conventions expected such object.
|
||||
<p>
|
||||
IOHIDQueue should be considered optional and is only useful for working with
|
||||
complex input elements. These elements include those whose length are
|
||||
greater than sizeof(CFIndex) or elements that are duplicate items.
|
||||
Whenever possible please defer to using
|
||||
IOHIDManagerRegisterInputValueCallback or
|
||||
IOHIDDeviceRegisterInputValueCallback.
|
||||
<p>
|
||||
<b>Note:</b>Absolute element values (based on a fixed origin) will only be
|
||||
placed on a queue if there is a change in value.
|
||||
<p>
|
||||
This documentation assumes that you have a basic understanding of the material contained in <a href="http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/index.html"><i>Accessing Hardware From Applications</i></a>
|
||||
For definitions of I/O Kit terms used in this documentation, such as matching dictionary, family, and driver, see the overview of I/O Kit terms and concepts
|
||||
in the "Device Access and the I/O Kit" chapter of <i>Accessing Hardware From Applications</i>.
|
||||
|
||||
This documentation also assumes you have read <a href="http://developer.apple.com/documentation/DeviceDrivers/HumanInterfaceDeviceForceFeedback-date.html"><i>Human Interface Device & Force Feedback</i></a>.
|
||||
Please review documentation before using this reference.
|
||||
<p>
|
||||
All of the information described in this document is contained in the header file <font face="Courier New,Courier,Monaco">IOHIDQueue.h</font> found at
|
||||
<font face="Courier New,Courier,Monaco">/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDQueue.h</font>.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
/*! @typedef IOHIDQueueRef
|
||||
This is the type of a reference to the IOHIDQueue.
|
||||
*/
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDQueue * IOHIDQueueRef;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueGetTypeID
|
||||
@abstract Returns the type identifier of all IOHIDQueue instances.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeID IOHIDQueueGetTypeID(void)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueCreate
|
||||
@abstract Creates an IOHIDQueue object for the specified device.
|
||||
@discussion Take care in specifying an appropriate depth to prevent dropping
|
||||
events.
|
||||
@param allocator Allocator to be used during creation.
|
||||
@param device IOHIDDevice object
|
||||
@param depth The number of values that can be handled by the queue.
|
||||
@param options Reserved for future use.
|
||||
@result Returns a new IOHIDQueueRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDQueueRef _Nullable IOHIDQueueCreate(
|
||||
CFAllocatorRef _Nullable allocator,
|
||||
IOHIDDeviceRef device,
|
||||
CFIndex depth,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueGetDevice
|
||||
@abstract Obtain the device associated with the queue.
|
||||
@param queue IOHIDQueue to be queried.
|
||||
@result Returns the a reference to the device.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDDeviceRef IOHIDQueueGetDevice(
|
||||
IOHIDQueueRef queue)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueGetDepth
|
||||
@abstract Obtain the depth of the queue.
|
||||
@param queue IOHIDQueue to be queried.
|
||||
@result Returns the queue depth.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFIndex IOHIDQueueGetDepth(
|
||||
IOHIDQueueRef queue)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueSetDepth
|
||||
@abstract Sets the depth of the queue.
|
||||
@discussion Set the appropriate depth value based on the number of elements
|
||||
contained in a queue.
|
||||
@param queue IOHIDQueue object to be modified.
|
||||
@param depth The new queue depth.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueSetDepth(
|
||||
IOHIDQueueRef queue,
|
||||
CFIndex depth)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueAddElement
|
||||
@abstract Adds an element to the queue
|
||||
@param queue IOHIDQueue object to be modified.
|
||||
@param element Element to be added to the queue.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueAddElement(
|
||||
IOHIDQueueRef queue,
|
||||
IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueRemoveElement
|
||||
@abstract Removes an element from the queue
|
||||
@param queue IOHIDQueue object to be modified.
|
||||
@param element Element to be removed from the queue.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueRemoveElement(
|
||||
IOHIDQueueRef queue,
|
||||
IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueContainsElement
|
||||
@abstract Queries the queue to determine if elemement has been added.
|
||||
@param queue IOHIDQueue object to be queried.
|
||||
@param element Element to be queried.
|
||||
@result Returns true or false depending if element is present.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDQueueContainsElement(
|
||||
IOHIDQueueRef queue,
|
||||
IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueStart
|
||||
@abstract Starts element value delivery to the queue.
|
||||
@discussion When a dispatch queue is assocaited with the IOHIDQueue
|
||||
via IOHIDQueueSetDispatchQueue, the queue does not need
|
||||
to be explicity started, this will be done during activation
|
||||
when IOHIDQueueActivate is called.
|
||||
@param queue IOHIDQueue object to be started.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueStart( IOHIDQueueRef queue)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueStop
|
||||
@abstract Stops element value delivery to the queue.
|
||||
@discussion When a dispatch queue is assocaited with the IOHIDQueue
|
||||
via IOHIDQueueSetDispatchQueue, the queue does not need
|
||||
to be explicity stopped, this will be done during cancellation
|
||||
when IOHIDQueueCancel is called.
|
||||
@param queue IOHIDQueue object to be stopped.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueStop( IOHIDQueueRef queue)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueScheduleWithRunLoop
|
||||
@abstract Schedules queue with run loop.
|
||||
@discussion Formally associates queue with client's run loop. Scheduling
|
||||
this queue with the run loop is necessary before making
|
||||
use of any asynchronous APIs.
|
||||
@param queue IOHIDQueue object to be modified.
|
||||
@param runLoop RunLoop to be used when scheduling any asynchronous
|
||||
activity.
|
||||
@param runLoopMode Run loop mode to be used when scheduling any
|
||||
asynchronous activity.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueScheduleWithRunLoop(
|
||||
IOHIDQueueRef queue,
|
||||
CFRunLoopRef runLoop,
|
||||
CFStringRef runLoopMode)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueUnscheduleFromRunLoop
|
||||
@abstract Unschedules queue with run loop.
|
||||
@discussion Formally disassociates queue with client's run loop.
|
||||
@param queue IOHIDQueue object to be modified.
|
||||
@param runLoop RunLoop to be used when scheduling any asynchronous
|
||||
activity.
|
||||
@param runLoopMode Run loop mode to be used when scheduling any
|
||||
asynchronous activity.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueUnscheduleFromRunLoop(
|
||||
IOHIDQueueRef queue,
|
||||
CFRunLoopRef runLoop,
|
||||
CFStringRef runLoopMode)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
* @function IOHIDQueueSetDispatchQueue
|
||||
*
|
||||
* @abstract
|
||||
* Sets the dispatch queue to be associated with the IOHIDQueue.
|
||||
* This is necessary in order to receive asynchronous events from the kernel.
|
||||
*
|
||||
* @discussion
|
||||
* An IOHIDQueue should not be associated with both a runloop and
|
||||
* dispatch queue. A call to IOHIDQueueSetDispatchQueue should only be made once.
|
||||
*
|
||||
* After a dispatch queue is set, the IOHIDQueue must make a call to activate
|
||||
* via IOHIDQueueActivate and cancel via IOHIDQueueCancel. All calls to "Register"
|
||||
* functions should be done before activation and not after cancellation.
|
||||
*
|
||||
* @param queue
|
||||
* Reference to an IOHIDQueue
|
||||
*
|
||||
* @param dispatchQueue
|
||||
* The dispatch queue to which the event handler block will be submitted.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueSetDispatchQueue(
|
||||
IOHIDQueueRef queue,
|
||||
dispatch_queue_t dispatchQueue)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDQueueSetCancelHandler
|
||||
*
|
||||
* @abstract
|
||||
* Sets a cancellation handler for the dispatch queue associated with
|
||||
* IOHIDQueueSetDispatchQueue.
|
||||
*
|
||||
* @discussion
|
||||
* The cancellation handler (if specified) will be will be submitted to the
|
||||
* queue's dispatch queue in response to a call to IOHIDQueueCancel after all
|
||||
* the events have been handled.
|
||||
*
|
||||
* IOHIDQueueSetCancelHandler should not be used when scheduling with
|
||||
* a run loop.
|
||||
*
|
||||
* The IOHIDQueueRef should only be released after the queue has been
|
||||
* cancelled, and the cancel handler has been called. This is to ensure all
|
||||
* asynchronous objects are released. For example:
|
||||
*
|
||||
* dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
|
||||
* CFRelease(queue);
|
||||
* });
|
||||
* IOHIDQueueSetCancelHandler(queue, cancelHandler);
|
||||
* IOHIDQueueActivate(queue);
|
||||
* IOHIDQueueCancel(queue);
|
||||
*
|
||||
* @param queue
|
||||
* Reference to an IOHIDQueue.
|
||||
*
|
||||
* @param handler
|
||||
* The cancellation handler block to be associated with the dispatch queue.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueSetCancelHandler(
|
||||
IOHIDQueueRef queue,
|
||||
dispatch_block_t handler)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDQueueActivate
|
||||
*
|
||||
* @abstract
|
||||
* Activates the IOHIDQueue object.
|
||||
*
|
||||
* @discussion
|
||||
* An IOHIDQueue object associated with a dispatch queue is created
|
||||
* in an inactive state. The object must be activated in order to
|
||||
* receive asynchronous events from the kernel.
|
||||
*
|
||||
* A dispatch queue must be set via IOHIDQueueSetDispatchQueue before
|
||||
* activation.
|
||||
*
|
||||
* An activated queue must be cancelled via IOHIDQueueCancel. All calls
|
||||
* to "Register" functions should be done before activation
|
||||
* and not after cancellation.
|
||||
*
|
||||
* Calling IOHIDQueueActivate on an active IOHIDQueue has no effect.
|
||||
*
|
||||
* @param queue
|
||||
* Reference to an IOHIDQueue
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueActivate( IOHIDQueueRef queue)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDQueueCancel
|
||||
*
|
||||
* @abstract
|
||||
* Cancels the IOHIDQueue preventing any further invocation
|
||||
* of its event handler block.
|
||||
*
|
||||
* @discussion
|
||||
* Cancelling prevents any further invocation of the event handler block for
|
||||
* the specified dispatch queue, but does not interrupt an event handler
|
||||
* block that is already in progress.
|
||||
*
|
||||
* Explicit cancellation of the IOHIDQueue is required, no implicit
|
||||
* cancellation takes place.
|
||||
*
|
||||
* Calling IOHIDQueueCancel on an already cancelled queue has no effect.
|
||||
*
|
||||
* The IOHIDQueueRef should only be released after the queue has been
|
||||
* cancelled, and the cancel handler has been called. This is to ensure all
|
||||
* asynchronous objects are released. For example:
|
||||
*
|
||||
* dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
|
||||
* CFRelease(queue);
|
||||
* });
|
||||
* IOHIDQueueSetCancelHandler(queue, cancelHandler);
|
||||
* IOHIDQueueActivate(queue);
|
||||
* IOHIDQueueCancel(queue);
|
||||
*
|
||||
* @param queue
|
||||
* Reference to an IOHIDQueue
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueCancel( IOHIDQueueRef queue)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueRegisterValueAvailableCallback
|
||||
@abstract Sets callback to be used when the queue transitions to non-empty.
|
||||
@discussion In order to make use of asynchronous behavior, the queue needs
|
||||
to be scheduled with the run loop or dispatch queue.
|
||||
If a dispatch queue is set, this call must occur before activation.
|
||||
@param queue IOHIDQueue object to be modified.
|
||||
@param callback Callback of type IOHIDCallback to be used when data is
|
||||
placed on the queue.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDQueueRegisterValueAvailableCallback(
|
||||
IOHIDQueueRef queue,
|
||||
IOHIDCallback callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueCopyNextValue
|
||||
@abstract Dequeues a retained copy of an element value from the head of an
|
||||
IOHIDQueue.
|
||||
@discussion Because the value is a retained copy, it is up to the caller to
|
||||
release the value using CFRelease. Use with setValueCallback to
|
||||
avoid polling the queue for data.
|
||||
@param queue IOHIDQueue object to be queried.
|
||||
@result Returns valid IOHIDValueRef if data is available.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDValueRef _Nullable IOHIDQueueCopyNextValue(
|
||||
IOHIDQueueRef queue)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDQueueCopyNextValueWithTimeout
|
||||
@abstract Dequeues a retained copy of an element value from the head of an
|
||||
IOHIDQueue. This method will block until either a value is
|
||||
available or it times out.
|
||||
@discussion Because the value is a retained copy, it is up to the caller to
|
||||
release the value using CFRelease. Use with setValueCallback to
|
||||
avoid polling the queue for data.
|
||||
@param queue IOHIDQueue object to be queried.
|
||||
@param timeout Timeout before aborting an attempt to dequeue a value
|
||||
from the head of a queue.
|
||||
@result Returns valid IOHIDValueRef if data is available.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDValueRef _Nullable IOHIDQueueCopyNextValueWithTimeout(
|
||||
IOHIDQueueRef queue,
|
||||
CFTimeInterval timeout)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDQUEUE_USER_H */
|
||||
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDTRANSACTION_USER_H
|
||||
#define _IOKIT_HID_IOHIDTRANSACTION_USER_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/hid/IOHIDBase.h>
|
||||
|
||||
/*!
|
||||
@header IOHIDTransaction
|
||||
IOHIDTransaction defines an object used to manipulate multiple parsed items
|
||||
(IOHIDElement) contained within a Human Interface Device (HID) object. It
|
||||
is used to minimize device communication when interacting with feature and
|
||||
output type elements that are grouped by their report IDs. IOHIDTransaction
|
||||
is a CFType object and as such conforms to all the conventions expected such
|
||||
object.
|
||||
<p>
|
||||
This documentation assumes that you have a basic understanding of the material contained in <a href="http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/index.html"><i>Accessing Hardware From Applications</i></a>
|
||||
For definitions of I/O Kit terms used in this documentation, such as matching dictionary, family, and driver, see the overview of I/O Kit terms and concepts
|
||||
in the "Device Access and the I/O Kit" chapter of <i>Accessing Hardware From Applications</i>.
|
||||
|
||||
This documentation also assumes you have read <a href="http://developer.apple.com/documentation/DeviceDrivers/HumanInterfaceDeviceForceFeedback-date.html"><i>Human Interface Device & Force Feedback</i></a>.
|
||||
Please review documentation before using this reference.
|
||||
<p>
|
||||
All of the information described in this document is contained in the header file <font face="Courier New,Courier,Monaco">IOHIDTransaction.h</font> found at
|
||||
<font face="Courier New,Courier,Monaco">/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDTransaction.h</font>.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
/*!
|
||||
@enum IOHIDTransactionOptions
|
||||
@abstract Various options that can be supplied to IOHIDTransaction functions.
|
||||
@const kIOHIDTransactionOptionsNone For those times when supplying 0 just isn't
|
||||
explicit enough.
|
||||
@const kIOHIDTransactionOptionsWeakDevice specifies the transaction to not retain the
|
||||
IOHIDDeviceRef being passed in. The expectation is that transaction will only exist during
|
||||
the lifetime of the IOHIDDeviceRef object.
|
||||
*/
|
||||
typedef CF_OPTIONS(uint32_t, IOHIDTransactionOptions) {
|
||||
kIOHIDTransactionOptionsNone = 0x0,
|
||||
kIOHIDTransactionOptionsWeakDevice = 0x1,
|
||||
};
|
||||
|
||||
/*! @typedef IOHIDTransactionRef
|
||||
This is the type of a reference to the IOHIDTransaction.
|
||||
*/
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDTransaction * IOHIDTransactionRef;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionGetTypeID
|
||||
@abstract Returns the type identifier of all IOHIDTransaction instances.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeID IOHIDTransactionGetTypeID(void)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionCreate
|
||||
@abstract Creates an IOHIDTransaction object for the specified device.
|
||||
@discussion IOHIDTransaction objects can be used to either send or receive
|
||||
multiple element values. As such the direction used should
|
||||
represent they type of objects added to the transaction.
|
||||
@param allocator Allocator to be used during creation.
|
||||
@param device IOHIDDevice object
|
||||
@param direction The direction, either in or out, for the transaction.
|
||||
@param options Reserved for future use.
|
||||
@result Returns a new IOHIDTransactionRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDTransactionRef _Nullable IOHIDTransactionCreate(
|
||||
CFAllocatorRef _Nullable allocator,
|
||||
IOHIDDeviceRef device,
|
||||
IOHIDTransactionDirectionType direction,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionGetDevice
|
||||
@abstract Obtain the device associated with the transaction.
|
||||
@param transaction IOHIDTransaction to be queried.
|
||||
@result Returns the a reference to the device.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDDeviceRef IOHIDTransactionGetDevice(
|
||||
IOHIDTransactionRef transaction)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionGetDirection
|
||||
@abstract Obtain the direction of the transaction.
|
||||
@param transaction IOHIDTransaction to be queried.
|
||||
@result Returns the transaction direction.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDTransactionDirectionType IOHIDTransactionGetDirection(
|
||||
IOHIDTransactionRef transaction)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionSetDirection
|
||||
@abstract Sets the direction of the transaction
|
||||
@disussion This method is useful for manipulating bi-direction (feature)
|
||||
elements such that you can set or get element values without
|
||||
creating an additional transaction object.
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
@param direction The new transaction direction.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDTransactionSetDirection(
|
||||
IOHIDTransactionRef transaction,
|
||||
IOHIDTransactionDirectionType direction)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionAddElement
|
||||
@abstract Adds an element to the transaction
|
||||
@disussion To minimize device traffic it is important to add elements that
|
||||
share a common report type and report id.
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
@param element Element to be added to the transaction.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDTransactionAddElement(
|
||||
IOHIDTransactionRef transaction,
|
||||
IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionRemoveElement
|
||||
@abstract Removes an element to the transaction
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
@param element Element to be removed to the transaction.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDTransactionRemoveElement(
|
||||
IOHIDTransactionRef transaction,
|
||||
IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionContainsElement
|
||||
@abstract Queries the transaction to determine if elemement has been added.
|
||||
@param transaction IOHIDTransaction object to be queried.
|
||||
@param element Element to be queried.
|
||||
@result Returns true or false depending if element is present.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDTransactionContainsElement(
|
||||
IOHIDTransactionRef transaction,
|
||||
IOHIDElementRef element)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionScheduleWithRunLoop
|
||||
@abstract Schedules transaction with run loop.
|
||||
@discussion Formally associates transaction with client's run loop.
|
||||
Scheduling this transaction with the run loop is necessary
|
||||
before making use of any asynchronous APIs.
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
@param runLoop RunLoop to be used when scheduling any asynchronous
|
||||
activity.
|
||||
@param runLoopMode Run loop mode to be used when scheduling any
|
||||
asynchronous activity.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDTransactionScheduleWithRunLoop(
|
||||
IOHIDTransactionRef transaction,
|
||||
CFRunLoopRef runLoop,
|
||||
CFStringRef runLoopMode)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionUnscheduleFromRunLoop
|
||||
@abstract Unschedules transaction with run loop.
|
||||
@discussion Formally disassociates transaction with client's run loop.
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
@param runLoop RunLoop to be used when scheduling any asynchronous
|
||||
activity.
|
||||
@param runLoopMode Run loop mode to be used when scheduling any
|
||||
asynchronous activity.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDTransactionUnscheduleFromRunLoop(
|
||||
IOHIDTransactionRef transaction,
|
||||
CFRunLoopRef runLoop,
|
||||
CFStringRef runLoopMode)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionSetValue
|
||||
@abstract Sets the value for a transaction element.
|
||||
@discussion The value set is pended until the transaction is committed and
|
||||
is only used if the transaction direction is
|
||||
kIOHIDTransactionDirectionTypeOutput. Use the
|
||||
kIOHIDTransactionOptionDefaultOutputValue option to set the
|
||||
default element value.
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
@param element Element to be modified after a commit.
|
||||
@param value Value to be set for the given element.
|
||||
@param options See IOHIDTransactionOption.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDTransactionSetValue(
|
||||
IOHIDTransactionRef transaction,
|
||||
IOHIDElementRef element,
|
||||
IOHIDValueRef value,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionGetValue
|
||||
@abstract Obtains the value for a transaction element.
|
||||
@discussion If the transaction direction is
|
||||
kIOHIDTransactionDirectionTypeInput the value represents what
|
||||
was obtained from the device from the transaction. Otherwise,
|
||||
if the transaction direction is
|
||||
kIOHIDTransactionDirectionTypeOutput the value represents the
|
||||
pending value to be sent to the device. Use the
|
||||
kIOHIDTransactionOptionDefaultOutputValue option to get the
|
||||
default element value.
|
||||
@param transaction IOHIDTransaction object to be queried.
|
||||
@param element Element to be queried.
|
||||
@param options See IOHIDTransactionOption.
|
||||
@result Returns IOHIDValueRef for the given element.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDValueRef _Nullable IOHIDTransactionGetValue(
|
||||
IOHIDTransactionRef transaction,
|
||||
IOHIDElementRef element,
|
||||
IOOptionBits options)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionCommit
|
||||
@abstract Synchronously commits element transaction to the device.
|
||||
@discussion In regards to kIOHIDTransactionDirectionTypeOutput direction,
|
||||
default element values will be used if element values are not
|
||||
set. If neither are set, that element will be omitted from the
|
||||
commit. After a transaction is committed, transaction element
|
||||
values will be cleared and default values preserved.
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if
|
||||
unsuccessful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDTransactionCommit(
|
||||
IOHIDTransactionRef transaction)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionCommitWithCallback
|
||||
@abstract Commits element transaction to the device.
|
||||
@discussion In regards to kIOHIDTransactionDirectionTypeOutput direction,
|
||||
default element values will be used if element values are not
|
||||
set. If neither are set, that element will be omitted from the
|
||||
commit. After a transaction is committed, transaction element
|
||||
values will be cleared and default values preserved.
|
||||
<br>
|
||||
<b>Note:</b> It is possible for elements from different reports
|
||||
to be present in a given transaction causing a commit to
|
||||
transcend multiple reports. Keep this in mind when setting a
|
||||
appropriate timeout.
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
@param timeout Timeout for issuing the transaction.
|
||||
@param callback Callback of type IOHIDCallback to be used when
|
||||
transaction has been completed. If null, this method will
|
||||
behave synchronously.
|
||||
@param context Pointer to data to be passed to the callback.
|
||||
@result Returns kIOReturnSuccess if successful or a kern_return_t if
|
||||
unsuccessful.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDTransactionCommitWithCallback(
|
||||
IOHIDTransactionRef transaction,
|
||||
CFTimeInterval timeout,
|
||||
IOHIDCallback _Nullable callback,
|
||||
void * _Nullable context)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDTransactionClear
|
||||
@abstract Clears element transaction values.
|
||||
@discussion In regards to kIOHIDTransactionDirectionTypeOutput direction,
|
||||
default element values will be preserved.
|
||||
@param transaction IOHIDTransaction object to be modified.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDTransactionClear(
|
||||
IOHIDTransactionRef transaction)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDTRANSACTION_USER_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2008 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDELEMENTEVENT_H
|
||||
#define _IOKIT_HID_IOHIDELEMENTEVENT_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/hid/IOHIDBase.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
|
||||
/*!
|
||||
@header IOHIDValue
|
||||
IOHIDValue defines a value at a given time from an parsed item
|
||||
(IOHIDElement) contained within a Human Interface Device (HID) object. It
|
||||
is used to obtain either integer or data element values along with scaled
|
||||
values based on physical or calibrated settings. IOHIDValue is a CFType
|
||||
object and as such conforms to all the conventions expected such object.
|
||||
<p>
|
||||
This documentation assumes that you have a basic understanding of the material contained in <a href="http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/index.html"><i>Accessing Hardware From Applications</i></a>
|
||||
For definitions of I/O Kit terms used in this documentation, such as matching dictionary, family, and driver, see the overview of I/O Kit terms and concepts
|
||||
in the "Device Access and the I/O Kit" chapter of <i>Accessing Hardware From Applications</i>.
|
||||
|
||||
This documentation also assumes you have read <a href="http://developer.apple.com/documentation/DeviceDrivers/HumanInterfaceDeviceForceFeedback-date.html"><i>Human Interface Device & Force Feedback</i></a>.
|
||||
Please review documentation before using this reference.
|
||||
<p>
|
||||
All of the information described in this document is contained in the header file <font face="Courier New,Courier,Monaco">IOHIDValue.h</font> found at
|
||||
<font face="Courier New,Courier,Monaco">/System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDValue.h</font>.
|
||||
*/
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
/*!
|
||||
@function IOHIDValueGetTypeID
|
||||
@abstract Returns the type identifier of all IOHIDValue instances.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeID IOHIDValueGetTypeID(void)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueCreateWithIntegerValue
|
||||
@abstract Creates a new element value using an integer value.
|
||||
@discussion IOHIDValueGetTimeStamp should represent OS AbsoluteTime, not CFAbsoluteTime.
|
||||
To obtain the OS AbsoluteTime, please reference the APIs declared in <mach/mach_time.h>
|
||||
@param allocator The CFAllocator which should be used to allocate memory for the value. This
|
||||
parameter may be NULL in which case the current default CFAllocator is used. If this
|
||||
reference is not a valid CFAllocator, the behavior is undefined.
|
||||
@param element IOHIDElementRef associated with this value.
|
||||
@param timeStamp OS absolute time timestamp for this value.
|
||||
@param value Integer value to be copied to this object.
|
||||
@result Returns a reference to a new IOHIDValueRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDValueRef IOHIDValueCreateWithIntegerValue(CFAllocatorRef _Nullable allocator, IOHIDElementRef element, uint64_t timeStamp, CFIndex value)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueCreateWithBytes
|
||||
@abstract Creates a new element value using byte data.
|
||||
@discussion IOHIDValueGetTimeStamp should represent OS AbsoluteTime, not CFAbsoluteTime.
|
||||
To obtain the OS AbsoluteTime, please reference the APIs declared in <mach/mach_time.h>
|
||||
@param allocator The CFAllocator which should be used to allocate memory for the value. This
|
||||
parameter may be NULL in which case the current default CFAllocator is used. If this
|
||||
reference is not a valid CFAllocator, the behavior is undefined.
|
||||
@param element IOHIDElementRef associated with this value.
|
||||
@param timeStamp OS absolute time timestamp for this value.
|
||||
@param bytes Pointer to a buffer of uint8_t to be copied to this object.
|
||||
@param length Number of bytes in the passed buffer.
|
||||
@result Returns a reference to a new IOHIDValueRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDValueRef _Nullable IOHIDValueCreateWithBytes(CFAllocatorRef _Nullable allocator, IOHIDElementRef element, uint64_t timeStamp, const uint8_t * bytes, CFIndex length)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueCreateWithBytesNoCopy
|
||||
@abstract Creates a new element value using byte data without performing a copy.
|
||||
@discussion The timestamp value passed should represent OS AbsoluteTime, not CFAbsoluteTime.
|
||||
To obtain the OS AbsoluteTime, please reference the APIs declared in <mach/mach_time.h>
|
||||
@param allocator The CFAllocator which should be used to allocate memory for the value. This
|
||||
parameter may be NULL in which case the current default CFAllocator is used. If this
|
||||
reference is not a valid CFAllocator, the behavior is undefined.
|
||||
@param element IOHIDElementRef associated with this value.
|
||||
@param timeStamp OS absolute time timestamp for this value.
|
||||
@param bytes Pointer to a buffer of uint8_t to be referenced by this object.
|
||||
@param length Number of bytes in the passed buffer.
|
||||
@result Returns a reference to a new IOHIDValueRef.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDValueRef _Nullable IOHIDValueCreateWithBytesNoCopy(CFAllocatorRef _Nullable allocator, IOHIDElementRef element, uint64_t timeStamp, const uint8_t * bytes, CFIndex length)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueGetElement
|
||||
@abstract Returns the element value associated with this IOHIDValueRef.
|
||||
@param value The value to be queried. If this parameter is not a valid IOHIDValueRef, the behavior is undefined.
|
||||
@result Returns a IOHIDElementRef referenced by this value.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDElementRef IOHIDValueGetElement(IOHIDValueRef value)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueGetTimeStamp
|
||||
@abstract Returns the timestamp value contained in this IOHIDValueRef.
|
||||
@discussion The timestamp value returned represents OS AbsoluteTime, not CFAbsoluteTime.
|
||||
@param value The value to be queried. If this parameter is not a valid IOHIDValueRef, the behavior is undefined.
|
||||
@result Returns a uint64_t representing the timestamp of this value.
|
||||
*/
|
||||
CF_EXPORT
|
||||
uint64_t IOHIDValueGetTimeStamp(IOHIDValueRef value)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueGetLength
|
||||
@abstract Returns the size, in bytes, of the value contained in this IOHIDValueRef.
|
||||
@param value The value to be queried. If this parameter is not a valid IOHIDValueRef, the behavior is undefined.
|
||||
@result Returns length of the value.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFIndex IOHIDValueGetLength(IOHIDValueRef value)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueGetBytePtr
|
||||
@abstract Returns a byte pointer to the value contained in this IOHIDValueRef.
|
||||
@param value The value to be queried. If this parameter is not a valid IOHIDValueRef, the behavior is undefined.
|
||||
@result Returns a pointer to the value.
|
||||
*/
|
||||
CF_EXPORT
|
||||
const uint8_t * IOHIDValueGetBytePtr(IOHIDValueRef value)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueGetIntegerValue
|
||||
@abstract Returns an integer representaion of the value contained in this IOHIDValueRef.
|
||||
@discussion The value is based on the logical element value contained in the report returned by the device.
|
||||
@param value The value to be queried. If this parameter is not a valid IOHIDValueRef, the behavior is undefined.
|
||||
@result Returns an integer representation of the value.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFIndex IOHIDValueGetIntegerValue(IOHIDValueRef value)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
/*!
|
||||
@function IOHIDValueGetScaledValue
|
||||
@abstract Returns an scaled representaion of the value contained in this IOHIDValueRef based on the scale type.
|
||||
@discussion The scaled value is based on the range described by the scale type's min and max, such that:
|
||||
<br>
|
||||
scaledValue = ((value - min) * (scaledMax - scaledMin) / (max - min)) + scaledMin
|
||||
<br>
|
||||
<b>Note:</b>
|
||||
<br>
|
||||
There are currently two types of scaling that can be applied:
|
||||
<ul>
|
||||
<li><b>kIOHIDValueScaleTypePhysical</b>: Scales element value using the physical bounds of the device such that <b>scaledMin = physicalMin</b> and <b>scaledMax = physicalMax</b>.
|
||||
<li><b>kIOHIDValueScaleTypeCalibrated</b>: Scales element value such that <b>scaledMin = -1</b> and <b>scaledMax = 1</b>. This value will also take into account the calibration properties associated with this element.
|
||||
</ul>
|
||||
@param value The value to be queried. If this parameter is not a valid IOHIDValueRef, the behavior is undefined.
|
||||
@param type The type of scaling to be performed.
|
||||
@result Returns an scaled floating point representation of the value.
|
||||
*/
|
||||
CF_EXPORT
|
||||
double_t IOHIDValueGetScaledValue(IOHIDValueRef value, IOHIDValueScaleType type)
|
||||
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDELEMENTEVENT_H */
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef IOHIDEventSystemClient_h
|
||||
#define IOHIDEventSystemClient_h
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
/*!
|
||||
@header IOHIDEventSystemClient
|
||||
|
||||
IOHIDEventSystemClient serves as a client that can be used
|
||||
for reading/writing specific properties of the HID event system, as
|
||||
well as getting services of the HID event system. A list of accessible
|
||||
properties can be found in <code>IOKit/hid/IOHIDProperties.h</code>.
|
||||
|
||||
@seealso IOKit/hidsystem/IOHIDServiceClient.h
|
||||
*/
|
||||
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDEventSystemClient * IOHIDEventSystemClientRef;
|
||||
|
||||
/*!
|
||||
* @function IOHIDEventSystemClientCreateSimpleClient
|
||||
*
|
||||
* @abstract Creates a client of the HID event system that has to ability to read/write certain
|
||||
* properties.
|
||||
*
|
||||
* @discussion Certain properties have the ability to be set/read by clients, see
|
||||
* <code>IOHIDProperties.h</code> for a list of these properties.
|
||||
*
|
||||
* @param allocator a custom allocator reference to be used for allocation of the result.
|
||||
*
|
||||
* @result Returns a <code>IOHIDEventSystemClientRef</code> on success.
|
||||
* Caller should CFRelease the client when they are finished with it, or keep a
|
||||
* reference to the client if multiple properties need to be set/read.
|
||||
*/
|
||||
IOHIDEventSystemClientRef IOHIDEventSystemClientCreateSimpleClient(CFAllocatorRef _Nullable allocator);
|
||||
|
||||
/*!
|
||||
* @function IOHIDEventSystemClientSetProperty
|
||||
*
|
||||
* @abstract Sets a property on the HID event system.
|
||||
*
|
||||
* @param client the HID client that created via <code>IOHIDEventSystemClientCreateSimpleClient()</code>.
|
||||
*
|
||||
* @param key the property key to set. A list of keys can be found in <code>HIDProperties.h</code>.
|
||||
*
|
||||
* @param property the value to set the property.
|
||||
*
|
||||
* @result Returns true on success.
|
||||
*/
|
||||
Boolean IOHIDEventSystemClientSetProperty(IOHIDEventSystemClientRef client, CFStringRef key, CFTypeRef property);
|
||||
|
||||
/*!
|
||||
* @function IOHIDEventSystemClientCopyProperty
|
||||
*
|
||||
* @abstract Copies a property from the HID event system.
|
||||
*
|
||||
* @param client the HID client created via <code>IOHIDEventSystemClientCreateSimpleClient()</code>.
|
||||
*
|
||||
* @param key the property key to copy. A list of keys can be found in <code>HIDProperties.h</code>.
|
||||
*
|
||||
* @result Returns a CFTypeRef of the property to be copied on success, otherwise NULL.
|
||||
* Caller is responsible for calling CFRelease on the property.
|
||||
*/
|
||||
CFTypeRef _Nullable IOHIDEventSystemClientCopyProperty(IOHIDEventSystemClientRef client, CFStringRef key);
|
||||
|
||||
/*!
|
||||
* @function IOHIDEventSystemClientGetTypeID
|
||||
*
|
||||
* @result Returns the CFTypeID of the <code>IOHIDEventSystemClient</code> class.
|
||||
*/
|
||||
CFTypeID IOHIDEventSystemClientGetTypeID(void);
|
||||
|
||||
/*!
|
||||
* @function IOHIDEventSystemClientCopyServices
|
||||
*
|
||||
* @abstract Copies all services available to the client.
|
||||
*
|
||||
* @discussion Useful for seeing services that are available. Clients can further probe
|
||||
* the services with the APIs available in <code>IOHIDServiceClient.h</code>.
|
||||
*
|
||||
* @param client the HID client that created via <code>IOHIDEventSystemClientCreateSimpleClient()</code>.
|
||||
*
|
||||
* @result On success, returns a CFArrayRef of <code>IOHIDServiceClientRefs</code> that are
|
||||
* available to the client. Caller is responsible for releasing the array.
|
||||
*/
|
||||
CFArrayRef _Nullable IOHIDEventSystemClientCopyServices(IOHIDEventSystemClientRef client);
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
__END_DECLS
|
||||
|
||||
#endif /* IOHIDEventSystemClient_h */
|
||||
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright (c) 1999-2009 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOHIDLIB_H
|
||||
#define _IOKIT_IOHIDLIB_H
|
||||
|
||||
#include <IOKit/hidsystem/IOHIDShared.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDCreateSharedMemory( io_connect_t connect,
|
||||
unsigned int version );
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetEventsEnable( io_connect_t connect,
|
||||
boolean_t enable );
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetCursorEnable( io_connect_t connect,
|
||||
boolean_t enable ) __attribute__((availability(macos,deprecated=11.0)));
|
||||
|
||||
enum {
|
||||
// Options for IOHIDPostEvent()
|
||||
kIOHIDSetGlobalEventFlags = 0x00000001,
|
||||
kIOHIDSetCursorPosition = 0x00000002,
|
||||
kIOHIDSetRelativeCursorPosition = 0x00000004,
|
||||
kIOHIDPostHIDManagerEvent = 0x00000008
|
||||
};
|
||||
|
||||
#define HIDPostEventDeprecatedMsg "Use CGSEventTap for posting HID events, IOHIDUserDevice for simulating HID device, IOPMAssertionDeclareUserActivity for reporting user activity"
|
||||
extern kern_return_t
|
||||
IOHIDPostEvent( io_connect_t connect,
|
||||
UInt32 eventType,
|
||||
IOGPoint location,
|
||||
const NXEventData * eventData,
|
||||
UInt32 eventDataVersion,
|
||||
IOOptionBits eventFlags,
|
||||
IOOptionBits options ) __attribute__((availability(macos,deprecated=11.0,message=HIDPostEventDeprecatedMsg)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetMouseLocation( io_connect_t connect, int x, int y) __attribute__((availability(macos,deprecated=11.0)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDGetButtonEventNum( io_connect_t connect,
|
||||
NXMouseButton button, int * eventNum ) __deprecated;
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDGetScrollAcceleration( io_connect_t handle, double * acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetScrollAcceleration( io_connect_t handle, double acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDGetMouseAcceleration( io_connect_t handle, double * acceleration) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetMouseAcceleration( io_connect_t handle, double acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDGetMouseButtonMode( io_connect_t handle, int * mode ) __attribute__((availability(macos,deprecated=11.0)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetMouseButtonMode( io_connect_t handle, int mode ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDGetAccelerationWithKey( io_connect_t handle, CFStringRef key, double * acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetAccelerationWithKey( io_connect_t handle, CFStringRef key, double acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
extern kern_return_t
|
||||
IOHIDGetParameter( io_connect_t handle, CFStringRef key, IOByteCount maxSize,
|
||||
void * bytes, IOByteCount * actualSize ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetParameter( io_connect_t handle, CFStringRef key,
|
||||
const void * bytes, IOByteCount size ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDCopyCFTypeParameter( io_connect_t handle, CFStringRef key,
|
||||
CFTypeRef * parameter );
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetCFTypeParameter( io_connect_t handle, CFStringRef key,
|
||||
CFTypeRef parameter );
|
||||
|
||||
// selectors are found in IOHIDParameter.h
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDGetStateForSelector( io_connect_t handle, int selector, UInt32 *state );
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetStateForSelector( io_connect_t handle, int selector, UInt32 state );
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDGetModifierLockState( io_connect_t handle, int selector, bool *state );
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetModifierLockState( io_connect_t handle, int selector, bool state );
|
||||
|
||||
// Used by Window Server only
|
||||
extern kern_return_t
|
||||
IOHIDRegisterVirtualDisplay( io_connect_t handle, UInt32 *display_token ) __attribute__((availability(macos,introduced=10.0,deprecated=11.0)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDUnregisterVirtualDisplay( io_connect_t handle, UInt32 display_token ) __attribute__((availability(macos,introduced=10.0,deprecated=11.0)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDSetVirtualDisplayBounds( io_connect_t handle, UInt32 display_token, const IOGBounds * bounds ) __attribute__((availability(macos,introduced=10.0,deprecated=11.0)));
|
||||
|
||||
extern kern_return_t
|
||||
IOHIDGetActivityState( io_connect_t handle, bool *hidActivityIdle ) __attribute__((availability(macos,deprecated=11.0)));
|
||||
|
||||
/*
|
||||
* @typedef IOHIDRequestType
|
||||
*
|
||||
* @abstract
|
||||
* Request type passed in to IOHIDCheckAccess/IOHIDRequestAccess.
|
||||
*
|
||||
* @field kIOHIDRequestTypePostEvent
|
||||
* Request to post event through IOHIDPostEvent API. Access must be granted
|
||||
* by the user to use this API. If you do not request access through the
|
||||
* IOHIDRequestAccess call, the request will be made on the process's behalf
|
||||
* in the IOHIDPostEvent call.
|
||||
*
|
||||
* @field kIOHIDRequestTypeListenEvent
|
||||
* Request to listen to event through IOHIDManager/IOHIDDevice API. Access must
|
||||
* be granted by the user to use this API. If you do not request access through
|
||||
* the IOHIDRequestAccess call, the request will be made on the process's behalf
|
||||
* in IOHIDManagerOpen/IOHIDDeviceOpen calls.
|
||||
*
|
||||
*/
|
||||
typedef enum {
|
||||
kIOHIDRequestTypePostEvent,
|
||||
kIOHIDRequestTypeListenEvent
|
||||
} IOHIDRequestType;
|
||||
|
||||
/*
|
||||
* @typedef IOHIDAccessType
|
||||
*
|
||||
* @abstract
|
||||
* Enumerator of access types returned from IOHIDCheckAccess.
|
||||
*/
|
||||
typedef enum {
|
||||
kIOHIDAccessTypeGranted,
|
||||
kIOHIDAccessTypeDenied,
|
||||
kIOHIDAccessTypeUnknown
|
||||
} IOHIDAccessType;
|
||||
|
||||
/*!
|
||||
* @function IOHIDCheckAccess
|
||||
*
|
||||
* @abstract
|
||||
* Checks if the process has access to a specific IOHIDRequestType. A process
|
||||
* may request access by calling the IOHIDRequestAccess function.
|
||||
*
|
||||
* @param requestType
|
||||
* The request type defined in the IOHIDRequestType enumerator.
|
||||
*
|
||||
* @result
|
||||
* Returns an access type defined in the IOHIDAccessType enumerator.
|
||||
*/
|
||||
IOHIDAccessType IOHIDCheckAccess(IOHIDRequestType requestType)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDRequestAccess
|
||||
*
|
||||
* @abstract
|
||||
* Requests access from the user for a specific IOHIDRequestType.
|
||||
*
|
||||
* @discussion
|
||||
* Processes that wish to post events through the IOHIDPostEvent API, or receive
|
||||
* reports through the IOHIDManager/IOHIDDevice API must be granted access first
|
||||
* by the user. If you do not call this API, it will be called on your behalf
|
||||
* when the API are used.
|
||||
*
|
||||
* @param requestType
|
||||
* The request type defined in the IOHIDRequestType enumerator.
|
||||
*
|
||||
* @result
|
||||
* Returns true if access was granted.
|
||||
*/
|
||||
bool IOHIDRequestAccess(IOHIDRequestType requestType)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* ! _IOKIT_IOHIDLIB_H */
|
||||
|
||||
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
|
||||
*
|
||||
* evsio.h - Get/Set parameter calls for Event Status Driver.
|
||||
*
|
||||
* CAUTION: Developers should stick to the API exported in
|
||||
* <drivers/event_status_driver.h> to guarantee
|
||||
* binary compatability of their applications in future
|
||||
* releases.
|
||||
*
|
||||
* HISTORY
|
||||
* 22 May 1992 Mike Paquette at NeXT
|
||||
* Created.
|
||||
*/
|
||||
#ifndef _DEV_EVSIO_H
|
||||
#define _DEV_EVSIO_H
|
||||
|
||||
/* Public type definitions. */
|
||||
#include <IOKit/hidsystem/IOHIDTypes.h>
|
||||
#include <IOKit/hidsystem/IOLLEvent.h>
|
||||
#include <IOKit/hid/IOHIDProperties.h>
|
||||
|
||||
/*
|
||||
* Identify this driver as one that uses the new driverkit and messaging API
|
||||
*/
|
||||
#ifndef _NeXT_MACH_EVENT_DRIVER_
|
||||
#define _NeXT_MACH_EVENT_DRIVER_ (1)
|
||||
#endif /* !_NeXT_MACH_EVENT_DRIVER_ */
|
||||
|
||||
/* * */
|
||||
|
||||
#define kIOHIDKindKey "HIDKind"
|
||||
#define kIOHIDInterfaceIDKey "HIDInterfaceID"
|
||||
#define kIOHIDSubinterfaceIDKey "HIDSubinterfaceID"
|
||||
#define kIOHIDOriginalSubinterfaceIDKey "HIDOriginalSubinterfaceID"
|
||||
|
||||
#define kIOHIDParametersKey "HIDParameters"
|
||||
|
||||
#define kIOHIDVirtualHIDevice "HIDVirtualDevice"
|
||||
|
||||
#define kIOHIDKeyRepeatKey "HIDKeyRepeat"
|
||||
#define kIOHIDInitialKeyRepeatKey "HIDInitialKeyRepeat"
|
||||
#define kIOHIDKeyMappingKey "HIDKeyMapping"
|
||||
#define kIOHIDResetKeyboardKey "HIDResetKeyboard"
|
||||
|
||||
#define kIOHIDKeyboardModifierMappingPairsKey "HIDKeyboardModifierMappingPairs"
|
||||
#define kIOHIDKeyboardModifierMappingSrcKey "HIDKeyboardModifierMappingSrc"
|
||||
#define kIOHIDKeyboardModifierMappingDstKey "HIDKeyboardModifierMappingDst"
|
||||
|
||||
#define kIOHIDKeyboardCapsLockDoesLockKey "HIDKeyboardCapsLockDoesLock"
|
||||
#define kIOHIDKeyboardSupportsF12EjectKey "HIDKeyboardSupportsF12Eject"
|
||||
#define kIOHIDKeyboardSupportedModifiersKey "HIDKeyboardSupportedModifiers"
|
||||
#define kIOHIDKeyboardGlobalModifiersKey "HIDKeyboardGlobalModifiers"
|
||||
|
||||
|
||||
//read only property that specify usage of clobal modifiers
|
||||
// Bit[0] - Report modifiers to the service by setting kIOHIDKeyboardGlobalModifiersKey with global modifiers
|
||||
// Bit[1] - Update/translate events from service taking global modifiers state in consideration
|
||||
#define kIOHIDServiceGlobalModifiersUsageKey "HIDServiceGlobalModifiersUsage"
|
||||
|
||||
|
||||
#define kIOHIDPointerResolutionKey "HIDPointerResolution"
|
||||
#define kIOHIDResetPointerKey "HIDResetPointer"
|
||||
#define kIOHIDPointerConvertAbsoluteKey "HIDPointerConvertAbsolute"
|
||||
#define kIOHIDPointerContactToMoveKey "HIDPointerContactToMove"
|
||||
#define kIOHIDPointerPressureToClickKey "HIDPointerPressureToClick"
|
||||
#define kIOHIDPointerButtonCountKey "HIDPointerButtonCount"
|
||||
|
||||
#define kIOHIDPointerAccelerationSettingsKey "HIDPointerAccelerationSettings"
|
||||
#define kIOHIDPointerAccelerationTableKey "HIDPointerAccelerationTable"
|
||||
|
||||
// velocity for pointer acceleration
|
||||
#define kIOHIDPointerAccelerationMultiplierKey "HIDPointerAccelerationMultiplier"
|
||||
|
||||
|
||||
#define kIOHIDScrollResetKey "HIDScrollReset"
|
||||
#define kIOHIDScrollResolutionKey "HIDScrollResolution"
|
||||
#define kIOHIDScrollReportRateKey "HIDScrollReportRate"
|
||||
#define kIOHIDScrollAccelerationTableKey "HIDScrollAccelerationTable"
|
||||
|
||||
#define kIOHIDScrollResolutionXKey "HIDScrollResolutionX"
|
||||
#define kIOHIDScrollResolutionYKey "HIDScrollResolutionY"
|
||||
#define kIOHIDScrollResolutionZKey "HIDScrollResolutionZ"
|
||||
|
||||
#define kIOHIDScrollAccelerationTableXKey "HIDScrollAccelerationTableX"
|
||||
#define kIOHIDScrollAccelerationTableYKey "HIDScrollAccelerationTableY"
|
||||
#define kIOHIDScrollAccelerationTableZKey "HIDScrollAccelerationTableZ"
|
||||
|
||||
#define kIOHIDScrollMouseButtonKey "HIDScrollMouseButton"
|
||||
|
||||
#define kIOHIDScrollZoomModifierMaskKey "HIDScrollZoomModifierMask"
|
||||
|
||||
#define kIOHIDTrackpadScrollAccelerationKey "HIDTrackpadScrollAcceleration"
|
||||
|
||||
#define kIOHIDTrackpadAccelerationType "HIDTrackpadAcceleration"
|
||||
|
||||
#define kIOHIDClickTimeKey "HIDClickTime"
|
||||
#define kIOHIDClickSpaceKey "HIDClickSpace"
|
||||
|
||||
#define kIOHIDWaitCursorFrameIntervalKey "HIDWaitCursorFrameInterval"
|
||||
|
||||
#define kIOHIDAutoDimThresholdKey "HIDAutoDimThreshold"
|
||||
#define kIOHIDAutoDimStateKey "HIDAutoDimState"
|
||||
#define kIOHIDAutoDimTimeKey "HIDAutoDimTime"
|
||||
#define kIOHIDIdleTimeKey "HIDIdleTime"
|
||||
|
||||
#define kIOHIDBrightnessKey "HIDBrightness"
|
||||
#define kIOHIDAutoDimBrightnessKey "HIDAutoDimBrightness"
|
||||
|
||||
#define kIOHIDFKeyModeKey "HIDFKeyMode"
|
||||
|
||||
// if kIOHIDStickyKeysDisabledKey is 1, then all sticky keys functionality
|
||||
// is completely turned off. Multiple shifts will have no effect.
|
||||
#define kIOHIDStickyKeysDisabledKey "HIDStickyKeysDisabled"
|
||||
|
||||
// if kIOHIDStickyKeysOnKey is 1 then a depressed modifier will stay down
|
||||
// until a non-modifer key is pressed (or sticky keys is turned off)
|
||||
#define kIOHIDStickyKeysOnKey "HIDStickyKeysOn"
|
||||
|
||||
// if kIOHIDStickyKeysShiftTogglesKey is 1, then a sequence of five
|
||||
// shift keys in sequence will toggle sticky keys on or off
|
||||
#define kIOHIDStickyKeysShiftTogglesKey "HIDStickyKeysShiftToggles"
|
||||
|
||||
//
|
||||
//
|
||||
#define kIOHIDResetStickyKeyNotification "HIDResetStickyKeyNotification"
|
||||
|
||||
// if kIOHIDMouseKeysOptionTogglesKey is 1, then a sequence of five
|
||||
// option keys in sequence will toggle mouse keys on or off
|
||||
#define kIOHIDMouseKeysOptionTogglesKey "HIDMouseKeysOptionToggles"
|
||||
|
||||
// kIOHIDSlowKeysDelayKey represents the delay used for slow keys.
|
||||
// if kIOHIDSlowKeysDelayKey is 0, then slow keys off
|
||||
#define kIOHIDSlowKeysDelayKey "HIDSlowKeysDelay"
|
||||
|
||||
#define kIOHIDF12EjectDelayKey "HIDF12EjectDelay"
|
||||
|
||||
#define kIOHIDMouseKeysOnKey "HIDMouseKeysOn"
|
||||
|
||||
#define kIOHIDUseKeyswitchKey "HIDUseKeyswitch"
|
||||
|
||||
#define kIOHIDDisallowRemappingOfPrimaryClickKey "HIDDisallowRemappingOfPrimaryClick"
|
||||
#define kIOHIDMouseKeysEnablesVirtualNumPadKey "HIDMouseKeysEnablesVirtualNumPad"
|
||||
|
||||
#define kIOHIDResetLEDsKey "HIDResetLEDs"
|
||||
|
||||
// Parametric Acceleration Keys
|
||||
#define kHIDAccelParametricCurvesKey "HIDAccelCurves"
|
||||
#define kHIDPointerReportRateKey "HIDPointerReportRate"
|
||||
#define kHIDTrackingAccelParametricCurvesKey "HIDTrackingAccelCurves"
|
||||
#define kHIDScrollAccelParametricCurvesKey "HIDScrollAccelCurves"
|
||||
#define kHIDAccelParametricCurvesDebugKey "HIDAccelCurvesDebug"
|
||||
#define kHIDScrollAccelParametricCurvesDebugKey "HIDScrollAccelCurvesDebug"
|
||||
#define kHIDAccelGainLinearKey "HIDAccelGainLinear"
|
||||
#define kHIDAccelGainParabolicKey "HIDAccelGainParabolic"
|
||||
#define kHIDAccelGainCubicKey "HIDAccelGainCubic"
|
||||
#define kHIDAccelGainQuarticKey "HIDAccelGainQuartic"
|
||||
#define kHIDAccelTangentSpeedLinearKey "HIDAccelTangentSpeedLinear"
|
||||
#define kHIDAccelTangentSpeedParabolicRootKey "HIDAccelTangentSpeedParabolicRoot"
|
||||
#define kHIDAccelTangentSpeedCubicRootKey "HIDAccelTangentSpeedCubicRoot"
|
||||
#define kHIDAccelTangentSpeedQuarticRootKey "HIDAccelTangentSpeedQuarticRoot"
|
||||
#define kHIDAccelIndexKey "HIDAccelIndex"
|
||||
|
||||
// Scroll Count Keys
|
||||
#define kIOHIDScrollCountMaxTimeDeltaBetweenKey "HIDScrollCountMaxTimeDeltaBetween"
|
||||
#define kIOHIDScrollCountMaxTimeDeltaToSustainKey "HIDScrollCountMaxTimeDeltaToSustain"
|
||||
#define kIOHIDScrollCountMinDeltaToStartKey "HIDScrollCountMinDeltaToStart"
|
||||
#define kIOHIDScrollCountMinDeltaToSustainKey "HIDScrollCountMinDeltaToSustain"
|
||||
#define kIOHIDScrollCountIgnoreMomentumScrollsKey "HIDScrollCountIgnoreMomentumScrolls"
|
||||
#define kIOHIDScrollCountMouseCanResetKey "HIDScrollCountMouseCanReset"
|
||||
#define kIOHIDScrollCountMaxKey "HIDScrollCountMax"
|
||||
#define kIOHIDScrollCountAccelerationFactorKey "HIDScrollCountAccelerationFactor"
|
||||
#define kIOHIDScrollCountZeroKey "HIDScrollCountZero"
|
||||
#define kIOHIDScrollCountBootDefaultKey "HIDScrollCountBootDefault"
|
||||
#define kIOHIDScrollCountResetKey "HIDScrollCountReset"
|
||||
|
||||
// HIDSystem Property Key
|
||||
|
||||
// Mark user activity state on HID System
|
||||
#define kIOHIDActivityUserIdleKey "IOHIDActivityUserIdle"
|
||||
|
||||
// the following values are used in kIOHIDPointerButtonMode
|
||||
typedef enum {
|
||||
kIOHIDButtonMode_BothLeftClicks = 0,
|
||||
kIOHIDButtonMode_ReverseLeftRightClicks = 1,
|
||||
kIOHIDButtonMode_EnableRightClick = 2
|
||||
} IOHIDButtonModes;
|
||||
|
||||
#ifdef _undef
|
||||
#define EVS_PREFIX "Evs_" /* All EVS calls start with this string */
|
||||
|
||||
/* WaitCursor-related ioctls */
|
||||
|
||||
#define EVSIOSWT "Evs_SetWaitThreshold"
|
||||
#define EVSIOSWT_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOSWS "Evs_SetWaitSustain"
|
||||
#define EVSIOSWS_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOSWFI "Evs_SetWaitFrameInterval"
|
||||
#define EVSIOSWFI_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOCWINFO "Evs_CurrentWaitCursorInfo"
|
||||
#define EVSIOCWINFO_THRESH 0
|
||||
#define EVSIOCWINFO_SUSTAIN (EVSIOCWINFO_THRESH + EVS_PACKED_TIME_SIZE)
|
||||
#define EVSIOCWINFO_FINTERVAL (EVSIOCWINFO_SUSTAIN + EVS_PACKED_TIME_SIZE)
|
||||
#define EVSIOCWINFO_SIZE (EVSIOCWINFO_FINTERVAL + EVS_PACKED_TIME_SIZE)
|
||||
#endif
|
||||
|
||||
#define EVS_PACKED_TIME_SIZE (sizeof(UInt64) / sizeof( unsigned int))
|
||||
|
||||
/* Device control ioctls. Levels specified may be in the range 0 - 64. */
|
||||
|
||||
#define EVSIOSB kIOHIDBrightnessKey
|
||||
#define EVSIOSB_SIZE 1
|
||||
|
||||
#define EVSIOSADB kIOHIDAutoDimBrightnessKey
|
||||
#define EVSIOSADB_SIZE 1
|
||||
|
||||
#ifdef _undef
|
||||
#define EVSIOSA "Evs_SetAttenuation"
|
||||
#define EVIOSA_SIZE 1
|
||||
|
||||
#define EVSIO_DCTLINFO "Evs_DeviceControlInfo"
|
||||
typedef enum {
|
||||
EVSIO_DCTLINFO_BRIGHT,
|
||||
EVSIO_DCTLINFO_ATTEN,
|
||||
EVSIO_DCTLINFO_AUTODIMBRIGHT
|
||||
} evsio_DCTLINFOIndices;
|
||||
#define EVSIO_DCTLINFO_SIZE (EVSIO_DCTLINFO_AUTODIMBRIGHT + 1)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Device status request
|
||||
*/
|
||||
#define EVSIOINFO NX_EVS_DEVICE_INFO
|
||||
|
||||
|
||||
/* Keyboard-related ioctls - implemented within Event Sources */
|
||||
|
||||
#define EVSIOSKR kIOHIDKeyRepeatKey
|
||||
#define EVSIOSKR_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOSIKR kIOHIDInitialKeyRepeatKey
|
||||
#define EVSIOSIKR_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIORKBD kIOHIDResetKeyboardKey
|
||||
#define EVSIORKBD_SIZE 1
|
||||
|
||||
#define EVSIOCKR_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOCKML kIOHIDKeyMappingKey
|
||||
#define EVSIOCKML_SIZE 1
|
||||
|
||||
/* The following two tokens are for use with the get/set character routines. */
|
||||
#define EVSIOSKM kIOHIDKeyMappingKey
|
||||
#define EVSIOSKM_SIZE 4096
|
||||
|
||||
#define EVSIOCKM kIOHIDKeyMappingKey
|
||||
#define EVSIOCKM_SIZE 4096
|
||||
|
||||
/* Mouse-related ioctls - implemented within Event Sources */
|
||||
|
||||
#define EVSIOSMS kIOHIDPointerAccelerationKey
|
||||
#define EVSIOSMS_SIZE (1)
|
||||
|
||||
#define EVSIOCMS kIOHIDPointerAccelerationKey
|
||||
#define EVSIOCMS_SIZE (1)
|
||||
|
||||
#ifdef _undef
|
||||
#define EVSIOSMH "Evs_SetMouseHandedness"
|
||||
#define EVSIOSMH_SIZE 1 // value from NXMouseButton enum
|
||||
|
||||
#define EVSIOCMH "Evs_CurrentMouseHandedness"
|
||||
#define EVSIOCMH_SIZE 1
|
||||
#endif
|
||||
|
||||
/* Generic pointer device controls, implemented by the Event Driver. */
|
||||
#define EVSIOSCT kIOHIDClickTimeKey
|
||||
#define EVSIOSCT_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOSCS kIOHIDClickSpaceKey
|
||||
typedef enum {
|
||||
EVSIOSCS_X,
|
||||
EVSIOSCS_Y
|
||||
} evsioEVSIOSCSIndices;
|
||||
#define EVSIOSCS_SIZE (EVSIOSCS_Y + 1)
|
||||
|
||||
#define EVSIOSADT kIOHIDAutoDimThresholdKey
|
||||
#define EVSIOSADT_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOSADS kIOHIDAutoDimStateKey
|
||||
#define EVSIOSADS_SIZE 1
|
||||
|
||||
#define EVSIORMS kIOHIDResetPointerKey
|
||||
#define EVSIORMS_SIZE 1
|
||||
|
||||
#define EVSIOCCT kIOHIDClickTimeKey
|
||||
#define EVSIOCCT_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOCADT kIOHIDAutoDimThresholdKey
|
||||
#define EVSIOCADT_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOGDADT kIOHIDAutoDimTimeKey
|
||||
#define EVSIOGDADT_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOIDLE kIOHIDIdleTimeKey
|
||||
#define EVSIOIDLE_SIZE EVS_PACKED_TIME_SIZE
|
||||
|
||||
#define EVSIOCCS kIOHIDClickSpaceKey
|
||||
typedef enum {
|
||||
EVSIOCCS_X,
|
||||
EVSIOCCS_Y
|
||||
} evsioEVSIOCCSIndices;
|
||||
#define EVSIOCCS_SIZE (EVSIOCCS_Y + 1)
|
||||
|
||||
#define EVSIOCADS kIOHIDAutoDimStateKey
|
||||
#define EVSIOCADS_SIZE 1
|
||||
|
||||
enum {
|
||||
// Selectors for IOHIDGetModifierLockState and IOHIDSetModifierLockState
|
||||
kIOHIDCapsLockState = 0x00000001,
|
||||
kIOHIDNumLockState = 0x00000002,
|
||||
kIOHIDActivityUserIdle = 0x00000003,
|
||||
// We no longer report display state through HIDSystem. This will not return the current state.
|
||||
kIOHIDActivityDisplayOn = 0x00000004,
|
||||
};
|
||||
|
||||
#endif /* !_DEV_EVSIO_H */
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2016 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef IOHIDServiceClient_h
|
||||
#define IOHIDServiceClient_h
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
/*!
|
||||
@header IOHIDServiceClient
|
||||
|
||||
IOHIDServiceClient serves as a client to the HID event system
|
||||
services. Users are able to copy/set specific properties (defined in
|
||||
<code>IOKit/hid/IOHIDProperties.h</code>), and gather more information
|
||||
about the services available in the HID event system.
|
||||
*/
|
||||
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDServiceClient * IOHIDServiceClientRef;
|
||||
|
||||
/*!
|
||||
* @function IOHIDServiceClientSetProperty
|
||||
*
|
||||
* @abstract Sets a property on the HID service.
|
||||
*
|
||||
* @param service the HID service to set the property on.
|
||||
*
|
||||
* @param key the property key to set. A list of keys can be found in <code>HIDProperties.h</code>.
|
||||
*
|
||||
* @param property the value to set the property.
|
||||
*
|
||||
* @result Returns true on success.
|
||||
*/
|
||||
Boolean IOHIDServiceClientSetProperty(IOHIDServiceClientRef service, CFStringRef key, CFTypeRef property);
|
||||
|
||||
/*!
|
||||
* @function IOHIDServiceClientCopyProperty
|
||||
*
|
||||
* @abstract Copies a property from the HID service.
|
||||
*
|
||||
* @param service the HID service to copy the property from.
|
||||
*
|
||||
* @param key the property key to copy. A list of keys can be found in <code>HIDProperties.h</code>.
|
||||
*
|
||||
* @result Returns a CFTypeRef of the property to be copied on success, otherwise NULL.
|
||||
* Caller is responsible for calling CFRelease on the property.
|
||||
*/
|
||||
CFTypeRef _Nullable IOHIDServiceClientCopyProperty(IOHIDServiceClientRef service, CFStringRef key);
|
||||
|
||||
/*!
|
||||
* @function IOHIDServiceClientGetTypeID
|
||||
*
|
||||
* @result Returns the CFTypeID of the <code>IOHIDServiceClient</code> class.
|
||||
*/
|
||||
CFTypeID IOHIDServiceClientGetTypeID(void);
|
||||
|
||||
/*!
|
||||
* @function IOHIDServiceClientGetRegistryID
|
||||
*
|
||||
* @param service the HID service to get the registry ID for.
|
||||
*
|
||||
* @result Returns a CFTypeRef containing the registry ID for the service.
|
||||
*/
|
||||
CFTypeRef IOHIDServiceClientGetRegistryID(IOHIDServiceClientRef service);
|
||||
|
||||
/*!
|
||||
* @function IOHIDServiceClientConformsTo
|
||||
*
|
||||
* @abstract Determines if a HID service conforms to a specific usage page and usage.
|
||||
*
|
||||
* @param usagePage A usage page defined in <code>IOHIDUsageTables.h</code>.
|
||||
*
|
||||
* @param usage A usage defined in <code>IOHIDUsageTables.h</code>.
|
||||
*
|
||||
* @result Returns true if the service conforms to the provided usage page and usage.
|
||||
*/
|
||||
boolean_t IOHIDServiceClientConformsTo(IOHIDServiceClientRef service, uint32_t usagePage, uint32_t usage);
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
__END_DECLS
|
||||
|
||||
#endif /* IOHIDServiceClient_h */
|
||||
@@ -0,0 +1,291 @@
|
||||
/*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2011 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _DEV_EVIO_H
|
||||
#define _DEV_EVIO_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#if KERNEL
|
||||
#include <IOKit/system.h>
|
||||
#else /* !KERNEL */
|
||||
#include <mach/message.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#endif /* KERNEL */
|
||||
|
||||
#include <IOKit/IOReturn.h>
|
||||
#include <IOKit/graphics/IOGraphicsTypes.h>
|
||||
#include <IOKit/hidsystem/IOHIDTypes.h>
|
||||
#include <IOKit/hidsystem/IOLLEvent.h>
|
||||
|
||||
/*
|
||||
* Identify this driver as one that uses the new driverkit and messaging API
|
||||
*/
|
||||
#ifndef _NeXT_MACH_EVENT_DRIVER_
|
||||
#define _NeXT_MACH_EVENT_DRIVER_ (1)
|
||||
#endif /* _NeXT_MACH_EVENT_DRIVER_ */
|
||||
|
||||
|
||||
/* Pressure Constants */
|
||||
#define MINPRESSURE EV_MINPRESSURE
|
||||
#define MAXPRESSURE EV_MAXPRESSURE
|
||||
|
||||
#define LLEQSIZE 240 /* Entries in low-level event queue */
|
||||
|
||||
typedef struct _NXEQElStruct {
|
||||
int next; /* Slot of lleq for next event */
|
||||
OSSpinLock sema; /* Is high-level code reading this event now? */
|
||||
NXEvent event; /* The event itself */
|
||||
} NXEQElement;
|
||||
|
||||
/******************************************************************************
|
||||
SHARED MEMORY OVERVIEW
|
||||
|
||||
PERSPECTIVE
|
||||
The ev driver and PostScript share at least one page of wired memory.
|
||||
This memory contains the low-level event queue which ev deposits events
|
||||
into and PostScript reads events from. Also, this memory contains other
|
||||
important data such as wait cursor state and some general cursor state.
|
||||
This memory is critical for speed. That is, we avoid having to make
|
||||
system calls for common operations.
|
||||
|
||||
SHARED MEMORY REGIONS
|
||||
There are currently three "regions" or "zones" delineated within this
|
||||
shared memory. The first zone is the EvOffsets structure. This structure
|
||||
contains two offsets from the beginning of shared memory. The first offset
|
||||
is to the second zone, EvGlobals. The second offset is to the third
|
||||
zone, private shmem for drivers.
|
||||
|
||||
INITIALIZATION OF SHARED MEMORY
|
||||
When the WindowServer starts up, it finds all screens that will be active.
|
||||
It then opens the ev driver and calls the EVIOSSCR ioctl repeatedly for
|
||||
each screen in use. This lets the ev driver set up the evScreen array
|
||||
and fill in each element. This ioctl also returns to PostScript a running
|
||||
total shared memory size with which to allocate. PostScript then allocates
|
||||
a region of memory this size and calls evmmap to "map in" this shared
|
||||
region. Evmmap initializes and fills in the EvOffsets and EvGlobals.
|
||||
Next the WindowServer calls each screen in turn to register itself with
|
||||
the ev driver in the same sequence as presented to EVIOSSCR. Each screen
|
||||
driver calls ev_register_screen() which among other things allocates a
|
||||
part of the private shmem (of the third shared memory zone) for the driver.
|
||||
|
||||
DEBUGGING NOTES
|
||||
You can easily display and set this shared memory from kgdb, but usually
|
||||
cannot do so from within PostScript. Gdb (or some weird interaction
|
||||
between gdb and the os) chokes on this shmem. So if you read or write
|
||||
this area of memory, copy-on-write will occur and you'll get a completely
|
||||
new page for PostScript. This will render the shared memory scheme
|
||||
useless and you will have to restart PostScript. It was my understanding
|
||||
that before, we were able to "read" this area from PS, but not write to
|
||||
it (the idea behind copy-on-WRITE). However, this seems to be broken
|
||||
in 2.0. We think this is a kernel bug.
|
||||
******************************************************************************/
|
||||
|
||||
typedef volatile struct _evOffsets {
|
||||
int evGlobalsOffset; /* Offset to EvGlobals structure */
|
||||
int evShmemOffset; /* Offset to private shmem regions */
|
||||
} EvOffsets;
|
||||
|
||||
/******************************************************************************
|
||||
EvGlobals
|
||||
This structures defines the portion of the events driver data structure
|
||||
that is exported to the PostScript server. It contains the event queue
|
||||
which is in memory shared between the driver and the PostScript server.
|
||||
All the variables necessary to read and process events from the queue are
|
||||
contained here.
|
||||
******************************************************************************/
|
||||
|
||||
typedef volatile struct _evGlobals {
|
||||
OSSpinLock cursorSema; /* set to disable periodic code */
|
||||
int eNum; /* Unique id for mouse events */
|
||||
int buttons; /* State of the mouse buttons 1==down, 0==up */
|
||||
int eventFlags; /* The current value of event.flags */
|
||||
int VertRetraceClock; /* The current value of event.time */
|
||||
IOGPoint cursorLoc; /* The current location of the cursor, in desktop coordinates */
|
||||
int frame; /* current cursor frame */
|
||||
IOGBounds workBounds; /* bounding box of all screens */
|
||||
IOGBounds mouseRect; /* Rect for mouse-exited events */
|
||||
int version; /* for run time checks */
|
||||
int structSize; /* for run time checks */
|
||||
int lastFrame;
|
||||
/* The current location of the cursor, 24.8 bit fixed point format */
|
||||
IOFixedPoint32 screenCursorFixed; /* in Screen coordinates */
|
||||
IOFixedPoint32 desktopCursorFixed;/* in Desktop coordinates */
|
||||
unsigned int reservedA[27];
|
||||
|
||||
unsigned reserved:25;
|
||||
unsigned updateCursorPositionFromFixed:1; /* if this is set, IOHIDSystem will take any cursor position updates from desktopCursorFixed instead of cursorLoc */
|
||||
unsigned logCursorUpdates:1; /* log cursor updates */
|
||||
unsigned wantPressure:1; /* pressure in current mouseRect? */
|
||||
unsigned wantPrecision:1; /* precise coordinates in current mouseRect? */
|
||||
unsigned dontWantCoalesce:1; /* coalesce within the current mouseRect? */
|
||||
unsigned dontCoalesce:1; /* actual flag which determines coalescing */
|
||||
unsigned mouseRectValid:1; /* If nonzero, post a mouse-exited whenever mouse outside mouseRect. */
|
||||
int movedMask; /* This contains an event mask for the three events MOUSEMOVED,
|
||||
LMOUSEDRAGGED, and RMOUSEDRAGGED. It says whether driver should
|
||||
generate those events. */
|
||||
OSSpinLock waitCursorSema; /* protects wait cursor fields */
|
||||
int AALastEventSent; /* timestamp for wait cursor */
|
||||
int AALastEventConsumed; /* timestamp for wait cursor */
|
||||
int waitCursorUp; /* Is wait cursor up? */
|
||||
char ctxtTimedOut; /* Has wait cursor timer expired? */
|
||||
char waitCursorEnabled; /* Play wait cursor game (per ctxt)? */
|
||||
char globalWaitCursorEnabled; /* Play wait cursor game (global)? */
|
||||
int waitThreshold; /* time before wait cursor appears */
|
||||
|
||||
int LLEHead; /* The next event to be read */
|
||||
int LLETail; /* Where the next event will go */
|
||||
int LLELast; /* The last event entered */
|
||||
NXEQElement lleq[LLEQSIZE]; /* The event queue itself */
|
||||
} EvGlobals;
|
||||
|
||||
/* These evio structs are used in various calls supported by the ev driver. */
|
||||
|
||||
struct evioLLEvent {
|
||||
int setCursor;
|
||||
int type;
|
||||
IOGPoint location;
|
||||
NXEventData data;
|
||||
int setFlags;
|
||||
int flags;
|
||||
};
|
||||
|
||||
typedef struct evioLLEvent _NXLLEvent;
|
||||
|
||||
#ifdef mach3xxx
|
||||
|
||||
/*
|
||||
* On a keypress of a VOL UP or VOL DOWN key, we send a message to the
|
||||
* sound server to notify it of the volume change. The message includes
|
||||
* a flag to indicate which key was pressed, and the machine independant
|
||||
* flag bits to indicate which modifier keys were pressed.
|
||||
*/
|
||||
|
||||
struct evioSpecialKeyMsg
|
||||
{
|
||||
msg_header_t Head;
|
||||
msg_type_t keyType;
|
||||
int key; // special key number, from bsd/dev/ev_keymap.h
|
||||
msg_type_t directionType;
|
||||
int direction; // NX_KEYDOWN, NX_KEYUP from event.h
|
||||
msg_type_t flagsType;
|
||||
int flags; // device independant flags from event.h
|
||||
msg_type_t levelType;
|
||||
int level; // EV_AUDIO_MIN_VOLUME to EV_AUDIO_MAX_VOLUME
|
||||
};
|
||||
#else
|
||||
struct evioSpecialKeyMsg
|
||||
{
|
||||
mach_msg_header_t Head;
|
||||
int key; // special key number, from bsd/dev/ev_keymap.h
|
||||
int direction; // NX_KEYDOWN, NX_KEYUP from event.h
|
||||
int flags; // device independant flags from event.h
|
||||
int level; // EV_AUDIO_MIN_VOLUME to EV_AUDIO_MAX_VOLUME
|
||||
};
|
||||
#endif
|
||||
|
||||
#define EV_SPECIAL_KEY_MSG_ID (('S'<<24) | ('k'<<16) | ('e'<<8) | ('y'))
|
||||
typedef struct evioSpecialKeyMsg *evioSpecialKeyMsg_t;
|
||||
|
||||
/*
|
||||
* Volume ranges
|
||||
*/
|
||||
#define EV_AUDIO_MIN_VOLUME 0
|
||||
#define EV_AUDIO_MAX_VOLUME 64
|
||||
|
||||
#define kIOHIDSystemClass "IOHIDSystem"
|
||||
#define kIOHIKeyboardClass "IOHIKeyboard"
|
||||
#define kIOHIPointingClass "IOHIPointing"
|
||||
|
||||
#define IOHIDSYSTEM_CONFORMSTO kIOHIDSystemClass
|
||||
|
||||
enum {
|
||||
kIOHIDEventNotification = 0,
|
||||
};
|
||||
#define kIOHIDCurrentShmemVersion 4
|
||||
#define kIOHIDLastCompatibleShmemVersion 3
|
||||
|
||||
enum {
|
||||
kIOHIDServerConnectType = 0,
|
||||
kIOHIDParamConnectType = 1,
|
||||
kIOHIDEventSystemConnectType = 3,
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOHIDGlobalMemory = 0
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOHIDEventQueueTypeKernel = 0,
|
||||
kIOHIDEventQueueTypeUser = 1
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
typedef UInt16 (*MasterVolumeUpdate)(void);
|
||||
typedef bool (*MasterMuteUpdate)(void);
|
||||
|
||||
typedef struct {
|
||||
MasterVolumeUpdate incrementMasterVolume;
|
||||
MasterVolumeUpdate decrementMasterVolume;
|
||||
MasterMuteUpdate toggleMasterMute;
|
||||
} MasterAudioFunctions;
|
||||
|
||||
extern MasterAudioFunctions *masterAudioFunctions;
|
||||
#endif
|
||||
|
||||
#ifndef KERNEL
|
||||
#ifndef _IOKIT_IOHIDLIB_H
|
||||
#include <IOKit/hidsystem/IOHIDLib.h>
|
||||
#endif
|
||||
#endif /* !KERNEL */
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
/*!
|
||||
@defined kIOHIDOpenedByEventSystem
|
||||
@abstract option passed to open for IOHIDInterface if opened by IOHIDEventDriver
|
||||
*/
|
||||
kIOHIDOpenedByEventSystem = 0x10000,
|
||||
/*!
|
||||
@defined kIOHIDOpenedByFastPathClient
|
||||
@abstract option passed to open for IOHIDEventService if opened by fast path client
|
||||
*/
|
||||
kIOHIDOpenedByFastPathClient = 0x20000
|
||||
};
|
||||
|
||||
// iokit_vendor_specific_msg(1) unused
|
||||
|
||||
/*!
|
||||
@defined kIOHIDMessageRelayServiceInterfaceActive
|
||||
@abstract message from IOHIDDevice to indicate that the IOHIDRelayService's USB interface is active.
|
||||
*/
|
||||
|
||||
#define kIOHIDMessageRelayServiceInterfaceActive iokit_vendor_specific_msg(2)
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#endif /* !_DEV_EVIO_H */
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/******************************************************************************
|
||||
ev_types.h
|
||||
Data types for the events status driver.
|
||||
This file contains public API.
|
||||
mpaque 11Oct91
|
||||
|
||||
Copyright 1991 NeXT Computer, Inc.
|
||||
Copyright 1997-2011 Apple, Inc.
|
||||
|
||||
Modified:
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _DEV_EV_TYPES_H
|
||||
#define _DEV_EV_TYPES_H
|
||||
|
||||
#include <mach/boolean.h>
|
||||
#include <libkern/OSAtomic.h>
|
||||
#include <IOKit/graphics/IOGraphicsTypes.h>
|
||||
|
||||
// This should be removed, but is being used by others
|
||||
// <rdar://problem/8917741> IOHIDFamily-355 causes projects to fail to build with 'ev_lock_data_t' does not name a type
|
||||
#include <IOKit/IOSharedLock.h>
|
||||
|
||||
/* Shared memory versions */
|
||||
#define EVENT_SYSTEM_VERSION 2
|
||||
|
||||
/* Maximum length of SetMouseScaling arrays */
|
||||
#define NX_MAXMOUSESCALINGS 20
|
||||
|
||||
typedef struct evsioKeymapping /* Match old struct names in kernel */
|
||||
{
|
||||
int size;
|
||||
char *mapping;
|
||||
} NXKeyMapping;
|
||||
|
||||
typedef struct evsioMouseScaling /* Match old struct names in kernel */
|
||||
{
|
||||
int numScaleLevels;
|
||||
short scaleThresholds[NX_MAXMOUSESCALINGS];
|
||||
short scaleFactors[NX_MAXMOUSESCALINGS];
|
||||
} NXMouseScaling;
|
||||
|
||||
typedef enum {
|
||||
NX_OneButton,
|
||||
NX_LeftButton,
|
||||
NX_RightButton
|
||||
} NXMouseButton;
|
||||
|
||||
// IOFixedPoint32 is a 24.8 format
|
||||
typedef struct __IOFixedPoint32 {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
} IOFixedPoint32;
|
||||
|
||||
/*
|
||||
* NXEventSystemInfo() information structures. These are designed to
|
||||
* allow for expansion.
|
||||
*
|
||||
* The current implementation of NXEventSystemInfo() uses an ioctl call.
|
||||
* THIS WILL CHANGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Generic query max size and typedefs.
|
||||
*
|
||||
* The maximum size is selected to support anticipated future extensions
|
||||
* of request flavors. Certain flavors planned for future releases may
|
||||
* require roughtly 800 ints to represent. We allow a little extra, in
|
||||
* case further growth is needed.
|
||||
*/
|
||||
typedef int *NXEventSystemInfoType;
|
||||
#define NX_EVS_INFO_MAX (1024) /* Max array size */
|
||||
typedef int NXEventSystemInfoData[NX_EVS_INFO_MAX];
|
||||
|
||||
/* Event System Devices query */
|
||||
#define NX_EVS_DEVICE_MAX 16
|
||||
|
||||
/* Interface types */
|
||||
#define NX_EVS_DEVICE_INTERFACE_OTHER 0
|
||||
#define NX_EVS_DEVICE_INTERFACE_NeXT 1 // NeXT custom, in older sys
|
||||
#define NX_EVS_DEVICE_INTERFACE_ADB 2 // NeXT/fruit keybds/mice
|
||||
#define NX_EVS_DEVICE_INTERFACE_ACE 3 // For x86 PC keyboards
|
||||
#define NX_EVS_DEVICE_INTERFACE_SERIAL_ACE 4 // For PC serial mice
|
||||
#define NX_EVS_DEVICE_INTERFACE_BUS_ACE 5 // For PC bus mice
|
||||
#define NX_EVS_DEVICE_INTERFACE_HIL 6 // For HIL hp keyboard
|
||||
#define NX_EVS_DEVICE_INTERFACE_TYPE5 7 // For Sun Type5 keyboard
|
||||
|
||||
/*
|
||||
* Note! if any new interface types are added above, the following
|
||||
* definition of the number of interfaces supported must reflect this.
|
||||
* This is used in the libkeymap project (storemap.c module) which needs
|
||||
* to be cognizant of the number of new devices coming online
|
||||
* via support for heterogeneous architecture platforms.
|
||||
* e.g., PCs, HP's HIL, Sun's Type5 keyboard,...
|
||||
*/
|
||||
#define NUM_SUPPORTED_INTERFACES (NX_EVS_DEVICE_INTERFACE_TYPE5 + 1)
|
||||
// Other, NeXT, ADB, ACE,...
|
||||
|
||||
/* Device types */
|
||||
#define NX_EVS_DEVICE_TYPE_OTHER 0
|
||||
#define NX_EVS_DEVICE_TYPE_KEYBOARD 1
|
||||
#define NX_EVS_DEVICE_TYPE_MOUSE 2 // Relative position devices
|
||||
#define NX_EVS_DEVICE_TYPE_TABLET 3 // Absolute position devices
|
||||
|
||||
typedef struct {
|
||||
int interface; /* NeXT, ADB, other */
|
||||
int interface_addr; /* Device address on the interface */
|
||||
int dev_type; /* Keyboard, mouse, tablet, other */
|
||||
int id; /* manufacturer's device handler ID */
|
||||
} NXEventSystemDevice;
|
||||
|
||||
typedef struct {
|
||||
NXEventSystemDevice dev[NX_EVS_DEVICE_MAX];
|
||||
} NXEventSystemDeviceList;
|
||||
|
||||
#define __OLD_NX_EVS_DEVICE_INFO 1
|
||||
#define NX_EVS_DEVICE_INFO "Evs_EventDeviceInfo"
|
||||
#define NX_EVS_DEVICE_INFO_COUNT \
|
||||
(sizeof (NXEventSystemDeviceList) / sizeof (int))
|
||||
|
||||
/*
|
||||
* Types used in evScreen protocol compliant operations.
|
||||
*/
|
||||
|
||||
typedef enum {EVNOP, EVHIDE, EVSHOW, EVMOVE, EVLEVEL} EvCmd; /* Cursor state */
|
||||
|
||||
#define EV_SCREEN_MIN_BRIGHTNESS 0
|
||||
#define EV_SCREEN_MAX_BRIGHTNESS 64
|
||||
/* Scale should lie between MIN_BRIGHTNESS and MAX_BRIGHTNESS */
|
||||
#define EV_SCALE_BRIGHTNESS( scale, datum ) \
|
||||
((((UInt32)(datum))*((UInt32)scale)) >> 6)
|
||||
|
||||
/*
|
||||
* Definition of a tick, as a time in milliseconds. This controls how
|
||||
* often the event system periodic jobs are run. All actual tick times
|
||||
* are derived from the nanosecond timer. These values are typically used
|
||||
* as part of computing mouse velocity for acceleration purposes.
|
||||
*/
|
||||
#define EV_TICK_TIME 16 /* 16 milliseconds */
|
||||
#define EV_TICKS_PER_SEC (1000/EV_TICK_TIME) /* ~ 62 Hz */
|
||||
|
||||
/* Mouse Button bits, as passed from an EventSrc to the Event Driver */
|
||||
#define EV_RB (0x01)
|
||||
#define EV_LB (0x04)
|
||||
#define EV_MOUSEBUTTONMASK (EV_LB | EV_RB)
|
||||
|
||||
/* Tablet Pressure Constants, as passed from an EventSrc to the Event Driver */
|
||||
#define EV_MINPRESSURE 0
|
||||
#define EV_MAXPRESSURE 255
|
||||
|
||||
/* Cursor size in pixels */
|
||||
#define EV_CURSOR_WIDTH 16
|
||||
#define EV_CURSOR_HEIGHT 16
|
||||
|
||||
|
||||
#define kAppleOnboardGUID 0x0610000000000000ULL
|
||||
|
||||
#endif /* !_DEV_EV_TYPES_H */
|
||||
|
||||
@@ -0,0 +1,382 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 2019 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_HID_IOHIDUSERDEVICE_H
|
||||
#define _IOKIT_HID_IOHIDUSERDEVICE_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/hid/IOHIDKeys.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
CF_ASSUME_NONNULL_BEGIN
|
||||
CF_IMPLICIT_BRIDGING_ENABLED
|
||||
|
||||
typedef struct CF_BRIDGED_TYPE(id) __IOHIDUserDevice * IOHIDUserDeviceRef;
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDUserDeviceSetReportBlock
|
||||
*
|
||||
* @abstract
|
||||
* The type block used for IOHIDUserDevice set report calls.
|
||||
*
|
||||
* @param type
|
||||
* The report type.
|
||||
*
|
||||
* @param reportID
|
||||
* The report ID.
|
||||
*
|
||||
* @param report
|
||||
* The report bytes.
|
||||
*
|
||||
* @param reportLength
|
||||
* The length of the report being passed in.
|
||||
*/
|
||||
typedef IOReturn (^IOHIDUserDeviceSetReportBlock)(IOHIDReportType type,
|
||||
uint32_t reportID,
|
||||
const uint8_t *report,
|
||||
CFIndex reportLength);
|
||||
|
||||
/*!
|
||||
* @typedef IOHIDUserDeviceGetReportBlock
|
||||
*
|
||||
* @abstract
|
||||
* The type block used for IOHIDUserDevice get report calls.
|
||||
*
|
||||
* @param type
|
||||
* The report type.
|
||||
*
|
||||
* @param reportID
|
||||
* The report ID.
|
||||
*
|
||||
* @param report
|
||||
* A buffer to be filled in by the implementor with the report.
|
||||
*
|
||||
* @param reportLength
|
||||
* The length of the report buffer being passed in. The implementor of this
|
||||
* block may update the reportLength variable to reflect the actual length of
|
||||
* the returned report.
|
||||
*/
|
||||
typedef IOReturn (^IOHIDUserDeviceGetReportBlock)(IOHIDReportType type,
|
||||
uint32_t reportID,
|
||||
uint8_t *report,
|
||||
CFIndex *reportLength);
|
||||
|
||||
/*!
|
||||
* @enum IOHIDUserDeviceOptions
|
||||
*
|
||||
* @abstract
|
||||
* Enumerator of IOHIDUserDeviceOptions to be passed in to
|
||||
* IOHIDUserDeviceCreateWithOptions.
|
||||
*
|
||||
* @field IOHIDUserDeviceOptionsCreateOnActivate
|
||||
* Specifies that the kernel HID device should not be created until the call
|
||||
* to IOHIDUserDeviceActivate. This may be useful for preventing dropped get/set
|
||||
* report calls to the user device.
|
||||
*/
|
||||
typedef CF_ENUM(IOOptionBits, IOHIDUserDeviceOptions) {
|
||||
IOHIDUserDeviceOptionsCreateOnActivate = 1 << 0,
|
||||
};
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceGetTypeID
|
||||
*
|
||||
* @abstract
|
||||
* Returns the type identifier of all IOHIDUserDevice instances.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeID IOHIDUserDeviceGetTypeID(void);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceCreateWithProperties
|
||||
*
|
||||
* @abstract
|
||||
* Creates a virtual IOHIDDevice in the kernel.
|
||||
*
|
||||
* @discussion
|
||||
* The IOHIDUserDeviceRef represents a virtual IOHIDDevice. In order to create
|
||||
* the device, the entitlement "com.apple.developer.hid.virtual.device" is
|
||||
* required to validate the source of the device.
|
||||
*
|
||||
* @param allocator
|
||||
* Allocator to be used during creation.
|
||||
*
|
||||
* @param properties
|
||||
* Dictionary containing device properties indexed by keys defined in
|
||||
* IOHIDKeys.h. At the bare minimum, the kIOHIDReportDescriptorKey key must be
|
||||
* provided, where the value represents a CFData representation of the device's
|
||||
* report descriptor.
|
||||
*
|
||||
* @param options
|
||||
* Options to be used when creating the device.
|
||||
*
|
||||
* @result
|
||||
* Returns a IOHIDUserDeviceRef on success.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOHIDUserDeviceRef _Nullable IOHIDUserDeviceCreateWithProperties(
|
||||
CFAllocatorRef _Nullable allocator,
|
||||
CFDictionaryRef properties,
|
||||
IOOptionBits options)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceRegisterGetReportBlock
|
||||
*
|
||||
* @abstract
|
||||
* Registers a block to receive get report requests.
|
||||
*
|
||||
* @discussion
|
||||
* The call to IOHIDUserDeviceRegisterGetReportBlock should be made before the
|
||||
* device is activated. The device must be activated in order to receive
|
||||
* get report requests.
|
||||
*
|
||||
* @param device
|
||||
* Reference to a IOHIDUserDeviceRef
|
||||
*
|
||||
* @param block
|
||||
* The block to be invoked for get report calls.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDUserDeviceRegisterGetReportBlock(IOHIDUserDeviceRef device,
|
||||
IOHIDUserDeviceGetReportBlock block)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceRegisterSetReportBlock
|
||||
*
|
||||
* @abstract
|
||||
* Registers a block to receive set report requests.
|
||||
*
|
||||
* @discussion
|
||||
* The call to IOHIDUserDeviceRegisterSetReportBlock should be made before the
|
||||
* device is activated. The device must be activated in order to receive set
|
||||
* report requests.
|
||||
*
|
||||
* @param device
|
||||
* Reference to a IOHIDUserDeviceRef
|
||||
*
|
||||
* @param block
|
||||
* The block to be invoked for set report calls.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDUserDeviceRegisterSetReportBlock(IOHIDUserDeviceRef device,
|
||||
IOHIDUserDeviceSetReportBlock block)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceSetDispatchQueue
|
||||
*
|
||||
* @abstract
|
||||
* Sets the dispatch queue to be associated with the IOHIDUserDevice.
|
||||
* This is necessary in order to receive asynchronous events from the kernel.
|
||||
*
|
||||
* @discussion
|
||||
* A call to IOHIDUserDeviceSetDispatchQueue should only be made once.
|
||||
*
|
||||
* After a dispatch queue is set, the IOHIDUserDevice must make a call to
|
||||
* activate via IOHIDUserDeviceActivate and cancel via IOHIDUserDeviceCancel.
|
||||
* All calls to "Register" functions should be done before activation and not
|
||||
* after cancellation.
|
||||
*
|
||||
* @param device
|
||||
* Reference to an IOHIDUserDevice
|
||||
*
|
||||
* @param queue
|
||||
* The dispatch queue to which the event handler block will be submitted.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDUserDeviceSetDispatchQueue(IOHIDUserDeviceRef device,
|
||||
dispatch_queue_t queue)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceSetCancelHandler
|
||||
*
|
||||
* @abstract
|
||||
* Sets a cancellation handler for the dispatch queue associated with
|
||||
* IOHIDUserDeviceScheduleWithDispatchQueue.
|
||||
*
|
||||
* @discussion
|
||||
* The cancellation handler (if specified) will be submitted to the device's
|
||||
* dispatch queue in response to a call to to IOHIDUserDeviceCancel
|
||||
* after all the events have been handled.
|
||||
*
|
||||
* The IOHIDUserDeviceRef should only be released after the device has been
|
||||
* cancelled, and the cancel handler has been called. This is to ensure all
|
||||
* asynchronous objects are released. For example:
|
||||
*
|
||||
* dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
|
||||
* CFRelease(device);
|
||||
* });
|
||||
* IOHIDUserDeviceSetCancelHandler(device, cancelHandler);
|
||||
* IOHIDUserDeviceActivate(device);
|
||||
* IOHIDUserDeviceCancel(device);
|
||||
*
|
||||
* @param device
|
||||
* Reference to an IOHIDUserDevice.
|
||||
*
|
||||
* @param handler
|
||||
* The cancellation handler block to be associated with the dispatch queue.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDUserDeviceSetCancelHandler(IOHIDUserDeviceRef device,
|
||||
dispatch_block_t handler)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceActivate
|
||||
*
|
||||
* @abstract
|
||||
* Activates the IOHIDUserDevice object.
|
||||
*
|
||||
* @discussion
|
||||
* An IOHIDUserDevice object associated with a dispatch queue is created
|
||||
* in an inactive state. The object must be activated in order to
|
||||
* receive asynchronous events from the kernel.
|
||||
*
|
||||
* A dispatch queue must be set via IOHIDUserDeviceSetDispatchQueue before
|
||||
* activation.
|
||||
*
|
||||
* An activated device must be cancelled via IOHIDUserDeviceCancel. All calls
|
||||
* to "Register" functions should be done before activation and not after
|
||||
* cancellation.
|
||||
*
|
||||
* Calling IOHIDUserDeviceActivate on an active IOHIDUserDevice has no effect.
|
||||
*
|
||||
* @param device
|
||||
* Reference to an IOHIDUserDevice.
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDUserDeviceActivate(IOHIDUserDeviceRef device)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceCancel
|
||||
*
|
||||
* @abstract
|
||||
* Cancels the IOHIDUserDevice preventing any further invocation of its event
|
||||
* handler block.
|
||||
*
|
||||
* @discussion
|
||||
* Cancelling prevents any further invocation of the event handler block for
|
||||
* the specified dispatch queue, but does not interrupt an event handler block
|
||||
* that is already in progress.
|
||||
*
|
||||
* Explicit cancellation of the IOHIDUserDevice is required, no implicit
|
||||
* cancellation takes place.
|
||||
*
|
||||
* Calling IOHIDUserDeviceCancel on an already cancelled queue has no effect.
|
||||
*
|
||||
* The IOHIDUserDeviceRef should only be released after the device has been
|
||||
* cancelled, and the cancel handler has been called. This is to ensure all
|
||||
* asynchronous objects are released. For example:
|
||||
*
|
||||
* dispatch_block_t cancelHandler = dispatch_block_create(0, ^{
|
||||
* CFRelease(device);
|
||||
* });
|
||||
* IOHIDUserDeviceSetCancelHandler(device, cancelHandler);
|
||||
* IOHIDUserDeviceActivate(device);
|
||||
* IOHIDUserDeviceCancel(device);
|
||||
*
|
||||
* @param device
|
||||
* Reference to an IOHIDUserDevice
|
||||
*/
|
||||
CF_EXPORT
|
||||
void IOHIDUserDeviceCancel(IOHIDUserDeviceRef device)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceCopyProperty
|
||||
*
|
||||
* @abstract
|
||||
* Obtains a property from the device.
|
||||
*
|
||||
* @param key
|
||||
* The property key.
|
||||
*
|
||||
* @result
|
||||
* Returns the property on success.
|
||||
*/
|
||||
CF_EXPORT
|
||||
CFTypeRef _Nullable IOHIDUserDeviceCopyProperty(IOHIDUserDeviceRef device,
|
||||
CFStringRef key)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceSetProperty
|
||||
*
|
||||
* @abstract
|
||||
* Sets a property on the device.
|
||||
*
|
||||
* @param key
|
||||
* The property key.
|
||||
*
|
||||
* @param value
|
||||
* The value of the property.
|
||||
*
|
||||
* @result
|
||||
* Returns true on success.
|
||||
*/
|
||||
CF_EXPORT
|
||||
Boolean IOHIDUserDeviceSetProperty(IOHIDUserDeviceRef device,
|
||||
CFStringRef key,
|
||||
CFTypeRef property)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
/*!
|
||||
* @function IOHIDUserDeviceHandleReportWithTimeStamp
|
||||
*
|
||||
* @abstract
|
||||
* Dispatches a report on behalf of the device.
|
||||
*
|
||||
* @param device
|
||||
* Reference to a IOHIDUserDeviceRef.
|
||||
*
|
||||
* @param timestamp
|
||||
* mach_absolute_time() based timestamp.
|
||||
*
|
||||
* @param report
|
||||
* Buffer containing a HID report.
|
||||
*
|
||||
* @param reportLength
|
||||
* The report buffer length.
|
||||
*
|
||||
* @result
|
||||
* Returns kIOReturnSuccess on success.
|
||||
*/
|
||||
CF_EXPORT
|
||||
IOReturn IOHIDUserDeviceHandleReportWithTimeStamp(IOHIDUserDeviceRef device,
|
||||
uint64_t timestamp,
|
||||
const uint8_t *report,
|
||||
CFIndex reportLength)
|
||||
__OSX_AVAILABLE(10.15) __IOS_AVAILABLE(13.0) __TVOS_AVAILABLE(13.0) __WATCHOS_AVAILABLE(6.0);
|
||||
|
||||
CF_IMPLICIT_BRIDGING_DISABLED
|
||||
CF_ASSUME_NONNULL_END
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_HID_IOHIDUSERDEVICE_H */
|
||||
@@ -0,0 +1,586 @@
|
||||
/*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2009 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/******************************************************************************
|
||||
event.h (PostScript side version)
|
||||
|
||||
CONFIDENTIAL
|
||||
Copyright (c) 1988 NeXT, Inc. as an unpublished work.
|
||||
All Rights Reserved.
|
||||
|
||||
Created Leo 01Mar88
|
||||
|
||||
Modified:
|
||||
04May88 Leo Final event types and record
|
||||
22Aug88 Leo Change short -> int for window, add reserved
|
||||
26May90 Ted Added NX_UNDIMMASK to correct triggering of UndoAutoDim
|
||||
12Dec91 Mike Brought into sync with dpsclient/event.h, and fixed
|
||||
the #ifndef interlock with dpsclient/event.h that was
|
||||
broken during the Great Header Revision.
|
||||
|
||||
The PostScript version of this file differs from the
|
||||
Window Kit version in that the coordinates here are
|
||||
ints instead of floats.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _DEV_EVENT_H
|
||||
#define _DEV_EVENT_H
|
||||
|
||||
#include <libkern/OSTypes.h>
|
||||
#include <IOKit/hidsystem/IOHIDTypes.h>
|
||||
#include <mach/mach_types.h>
|
||||
|
||||
#ifdef EVENT_H /* Interlock with dpsclient/event.h */
|
||||
#if !defined(_NXSIZE_) /* Work around patch for old event.h in Phase 3 projs*/
|
||||
#define _NXSIZE_ 1 /* NXCoord, NXPoint, NXSize decl seen */
|
||||
#define _NXSize_ NXSize
|
||||
#endif /* _NXSIZE_ */
|
||||
#else /* EVENT_H */ /* Haven't seen dpsclient/event.h, so define away */
|
||||
#define EVENT_H
|
||||
|
||||
#ifdef KERNEL
|
||||
#else /* KERNEL */
|
||||
|
||||
#if !defined(_NXSIZE_) /* Work around patch for old event.h in Phase 3 projs*/
|
||||
#define _NXSIZE_ 1 /* NXCoord, NXPoint, NXSize decl seen */
|
||||
typedef float NXCoord;
|
||||
|
||||
typedef struct _NXPoint { /* point */
|
||||
NXCoord x, y;
|
||||
} NXPoint;
|
||||
|
||||
typedef struct _NXSize { /* size */
|
||||
NXCoord width, height;
|
||||
} NXSize;
|
||||
#define _NXSize_ NXSize /* Correct usage in event_status_driver.h */
|
||||
#endif /* _NXSIZE_ */
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
/* Event types */
|
||||
|
||||
#define NX_NULLEVENT 0 /* internal use */
|
||||
|
||||
/* mouse events */
|
||||
|
||||
#define NX_LMOUSEDOWN 1 /* left mouse-down event */
|
||||
#define NX_LMOUSEUP 2 /* left mouse-up event */
|
||||
#define NX_RMOUSEDOWN 3 /* right mouse-down event */
|
||||
#define NX_RMOUSEUP 4 /* right mouse-up event */
|
||||
#define NX_MOUSEMOVED 5 /* mouse-moved event */
|
||||
#define NX_LMOUSEDRAGGED 6 /* left mouse-dragged event */
|
||||
#define NX_RMOUSEDRAGGED 7 /* right mouse-dragged event */
|
||||
#define NX_MOUSEENTERED 8 /* mouse-entered event */
|
||||
#define NX_MOUSEEXITED 9 /* mouse-exited event */
|
||||
|
||||
/* other mouse events
|
||||
*
|
||||
* event.data.mouse.buttonNumber should contain the
|
||||
* button number (2-31) changing state.
|
||||
*/
|
||||
#define NX_OMOUSEDOWN 25 /* other mouse-down event */
|
||||
#define NX_OMOUSEUP 26 /* other mouse-up event */
|
||||
#define NX_OMOUSEDRAGGED 27 /* other mouse-dragged event */
|
||||
|
||||
/* keyboard events */
|
||||
|
||||
#define NX_KEYDOWN 10 /* key-down event */
|
||||
#define NX_KEYUP 11 /* key-up event */
|
||||
#define NX_FLAGSCHANGED 12 /* flags-changed event */
|
||||
|
||||
/* composite events */
|
||||
|
||||
#define NX_KITDEFINED 13 /* application-kit-defined event */
|
||||
#define NX_SYSDEFINED 14 /* system-defined event */
|
||||
#define NX_APPDEFINED 15 /* application-defined event */
|
||||
/* There are additional DPS client defined events past this point. */
|
||||
|
||||
/* Scroll wheel events */
|
||||
|
||||
#define NX_SCROLLWHEELMOVED 22
|
||||
|
||||
/* Zoom events */
|
||||
#define NX_ZOOM 28
|
||||
|
||||
/* tablet events */
|
||||
|
||||
#define NX_TABLETPOINTER 23 /* for non-mousing transducers */
|
||||
#define NX_TABLETPROXIMITY 24 /* for non-mousing transducers */
|
||||
|
||||
/* event range */
|
||||
|
||||
#define NX_FIRSTEVENT 0
|
||||
#define NX_LASTEVENT 28
|
||||
#define NX_NUMPROCS (NX_LASTEVENT-NX_FIRSTEVENT+1)
|
||||
|
||||
/* Event masks */
|
||||
#define NX_NULLEVENTMASK (1 << NX_NULLEVENT) /* NULL event */
|
||||
#define NX_LMOUSEDOWNMASK (1 << NX_LMOUSEDOWN) /* left mouse-down */
|
||||
#define NX_LMOUSEUPMASK (1 << NX_LMOUSEUP) /* left mouse-up */
|
||||
#define NX_RMOUSEDOWNMASK (1 << NX_RMOUSEDOWN) /* right mouse-down */
|
||||
#define NX_RMOUSEUPMASK (1 << NX_RMOUSEUP) /* right mouse-up */
|
||||
#define NX_OMOUSEDOWNMASK (1 << NX_OMOUSEDOWN) /* other mouse-down */
|
||||
#define NX_OMOUSEUPMASK (1 << NX_OMOUSEUP) /* other mouse-up */
|
||||
#define NX_MOUSEMOVEDMASK (1 << NX_MOUSEMOVED) /* mouse-moved */
|
||||
#define NX_LMOUSEDRAGGEDMASK (1 << NX_LMOUSEDRAGGED) /* left-dragged */
|
||||
#define NX_RMOUSEDRAGGEDMASK (1 << NX_RMOUSEDRAGGED) /* right-dragged */
|
||||
#define NX_OMOUSEDRAGGEDMASK (1 << NX_OMOUSEDRAGGED) /* other-dragged */
|
||||
#define NX_MOUSEENTEREDMASK (1 << NX_MOUSEENTERED) /* mouse-entered */
|
||||
#define NX_MOUSEEXITEDMASK (1 << NX_MOUSEEXITED) /* mouse-exited */
|
||||
#define NX_KEYDOWNMASK (1 << NX_KEYDOWN) /* key-down */
|
||||
#define NX_KEYUPMASK (1 << NX_KEYUP) /* key-up */
|
||||
#define NX_FLAGSCHANGEDMASK (1 << NX_FLAGSCHANGED) /* flags-changed */
|
||||
#define NX_KITDEFINEDMASK (1 << NX_KITDEFINED) /* kit-defined */
|
||||
#define NX_SYSDEFINEDMASK (1 << NX_SYSDEFINED) /* system-defined */
|
||||
#define NX_APPDEFINEDMASK (1 << NX_APPDEFINED) /* app-defined */
|
||||
#define NX_SCROLLWHEELMOVEDMASK (1 << NX_SCROLLWHEELMOVED) /* scroll wheel moved */
|
||||
#define NX_ZOOMMASK (1 << NX_ZOOM) /* Zoom */
|
||||
#define NX_TABLETPOINTERMASK (1 << NX_TABLETPOINTER) /* tablet pointer moved */
|
||||
#define NX_TABLETPROXIMITYMASK (1 << NX_TABLETPROXIMITY) /* tablet pointer proximity */
|
||||
|
||||
#define EventCodeMask(type) (1 << (type))
|
||||
#define NX_ALLEVENTS -1 /* Check for all events */
|
||||
|
||||
/* sub types for mouse and move events */
|
||||
|
||||
#define NX_SUBTYPE_DEFAULT 0
|
||||
#define NX_SUBTYPE_TABLET_POINT 1
|
||||
#define NX_SUBTYPE_TABLET_PROXIMITY 2
|
||||
#define NX_SUBTYPE_MOUSE_TOUCH 3
|
||||
|
||||
/* sub types for system defined events */
|
||||
|
||||
#define NX_SUBTYPE_POWER_KEY 1
|
||||
#define NX_SUBTYPE_AUX_MOUSE_BUTTONS 7
|
||||
|
||||
/*
|
||||
* NX_SUBTYPE_AUX_CONTROL_BUTTONS usage
|
||||
*
|
||||
* The incoming NXEvent for other mouse button down/up has event.type
|
||||
* NX_SYSDEFINED and event.data.compound.subtype NX_SUBTYPE_AUX_MOUSE_BUTTONS.
|
||||
* Within the event.data.compound.misc.L[0] contains bits for all the buttons
|
||||
* that have changed state, and event.data.compound.misc.L[1] contains the
|
||||
* current button state as a bitmask, with 1 representing down, and 0
|
||||
* representing up. Bit 0 is the left button, bit one is the right button,
|
||||
* bit 2 is the center button and so forth.
|
||||
*/
|
||||
#define NX_SUBTYPE_AUX_CONTROL_BUTTONS 8
|
||||
|
||||
#define NX_SUBTYPE_EJECT_KEY 10
|
||||
#define NX_SUBTYPE_SLEEP_EVENT 11
|
||||
#define NX_SUBTYPE_RESTART_EVENT 12
|
||||
#define NX_SUBTYPE_SHUTDOWN_EVENT 13
|
||||
#define NX_SUBTYPE_MENU 16
|
||||
#define NX_SUBTYPE_ACCESSIBILITY 17
|
||||
|
||||
|
||||
|
||||
#define NX_SUBTYPE_STICKYKEYS_ON 100
|
||||
#define NX_SUBTYPE_STICKYKEYS_OFF 101
|
||||
#define NX_SUBTYPE_STICKYKEYS_SHIFT 102
|
||||
#define NX_SUBTYPE_STICKYKEYS_CONTROL 103
|
||||
#define NX_SUBTYPE_STICKYKEYS_ALTERNATE 104
|
||||
#define NX_SUBTYPE_STICKYKEYS_COMMAND 105
|
||||
#define NX_SUBTYPE_STICKYKEYS_RELEASE 106
|
||||
#define NX_SUBTYPE_STICKYKEYS_TOGGLEMOUSEDRIVING 107
|
||||
|
||||
// New stickykeys key events
|
||||
// These were created to send an event describing the
|
||||
// different state of the modifiers
|
||||
#define NX_SUBTYPE_STICKYKEYS_SHIFT_DOWN 110
|
||||
#define NX_SUBTYPE_STICKYKEYS_CONTROL_DOWN 111
|
||||
#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_DOWN 112
|
||||
#define NX_SUBTYPE_STICKYKEYS_COMMAND_DOWN 113
|
||||
#define NX_SUBTYPE_STICKYKEYS_FN_DOWN 114
|
||||
|
||||
#define NX_SUBTYPE_STICKYKEYS_SHIFT_LOCK 120
|
||||
#define NX_SUBTYPE_STICKYKEYS_CONTROL_LOCK 121
|
||||
#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_LOCK 122
|
||||
#define NX_SUBTYPE_STICKYKEYS_COMMAND_LOCK 123
|
||||
#define NX_SUBTYPE_STICKYKEYS_FN_LOCK 124
|
||||
|
||||
#define NX_SUBTYPE_STICKYKEYS_SHIFT_UP 130
|
||||
#define NX_SUBTYPE_STICKYKEYS_CONTROL_UP 131
|
||||
#define NX_SUBTYPE_STICKYKEYS_ALTERNATE_UP 132
|
||||
#define NX_SUBTYPE_STICKYKEYS_COMMAND_UP 133
|
||||
#define NX_SUBTYPE_STICKYKEYS_FN_UP 134
|
||||
|
||||
|
||||
|
||||
// SlowKeys
|
||||
#define NX_SUBTYPE_SLOWKEYS_START 200
|
||||
#define NX_SUBTYPE_SLOWKEYS_ABORT 201
|
||||
#define NX_SUBTYPE_SLOWKEYS_END 202
|
||||
|
||||
// HID Parameter Property Modified
|
||||
#define NX_SUBTYPE_HIDPARAMETER_MODIFIED 210
|
||||
|
||||
/* Masks for the bits in event.flags */
|
||||
|
||||
/* device-independent */
|
||||
|
||||
#define NX_ALPHASHIFTMASK 0x00010000
|
||||
#define NX_SHIFTMASK 0x00020000
|
||||
#define NX_CONTROLMASK 0x00040000
|
||||
#define NX_ALTERNATEMASK 0x00080000
|
||||
#define NX_COMMANDMASK 0x00100000
|
||||
#define NX_NUMERICPADMASK 0x00200000
|
||||
#define NX_HELPMASK 0x00400000
|
||||
#define NX_SECONDARYFNMASK 0x00800000
|
||||
#define NX_ALPHASHIFT_STATELESS_MASK 0x01000000
|
||||
|
||||
/* device-dependent (really?) */
|
||||
|
||||
#define NX_DEVICELCTLKEYMASK 0x00000001
|
||||
#define NX_DEVICELSHIFTKEYMASK 0x00000002
|
||||
#define NX_DEVICERSHIFTKEYMASK 0x00000004
|
||||
#define NX_DEVICELCMDKEYMASK 0x00000008
|
||||
#define NX_DEVICERCMDKEYMASK 0x00000010
|
||||
#define NX_DEVICELALTKEYMASK 0x00000020
|
||||
#define NX_DEVICERALTKEYMASK 0x00000040
|
||||
#define NX_DEVICE_ALPHASHIFT_STATELESS_MASK 0x00000080
|
||||
#define NX_DEVICERCTLKEYMASK 0x00002000
|
||||
|
||||
/*
|
||||
* Additional reserved bits in event.flags
|
||||
*/
|
||||
|
||||
#define NX_STYLUSPROXIMITYMASK 0x00000080 /* deprecated */
|
||||
#define NX_NONCOALSESCEDMASK 0x00000100
|
||||
|
||||
/* click state values
|
||||
* If you have the following events in close succession, the click
|
||||
* field has the indicated value:
|
||||
*
|
||||
* Event Click Value Comments
|
||||
* mouse-down 1 Not part of any click yet
|
||||
* mouse-up 1 Aha! A click!
|
||||
* mouse-down 2 Doing a double-click
|
||||
* mouse-up 2 It's finished
|
||||
* mouse-down 3 A triple
|
||||
* mouse-up 3
|
||||
*/
|
||||
|
||||
/* Values for the character set in event.data.key.charSet */
|
||||
|
||||
#define NX_ASCIISET 0
|
||||
#define NX_SYMBOLSET 1
|
||||
#define NX_DINGBATSSET 2
|
||||
|
||||
/* tablet button masks
|
||||
* Mask bits for the tablet barrel buttons placed in tablet.buttons.
|
||||
* The buttons field uses adopts the following convention:
|
||||
*
|
||||
* Bit Comments
|
||||
* 0 Left Mouse Button ( kHIDUsage_Button_1 )
|
||||
* 1 Right Mouse Button ( kHIDUsage_Button_2 )
|
||||
* 2 Middle Mouse Button ( kHIDUsage_Button_3 )
|
||||
* 3 4th Mouse Button ( kHIDUsage_Button_4 )
|
||||
* ...
|
||||
* 15 15th Mouse Button
|
||||
*
|
||||
* For your convenience, the following mask bits have been defined
|
||||
* for tablet specific application:
|
||||
*/
|
||||
|
||||
#define NX_TABLET_BUTTON_PENTIPMASK 0x0001
|
||||
#define NX_TABLET_BUTTON_PENLOWERSIDEMASK 0x0002
|
||||
#define NX_TABLET_BUTTON_PENUPPERSIDEMASK 0x0004
|
||||
|
||||
|
||||
/* tablet capability masks
|
||||
* Mask bits for the tablet capabilities field. Use these
|
||||
* masks with the capabilities field of a proximity event to
|
||||
* determine what fields in a Tablet Event are valid for this
|
||||
* device.
|
||||
*/
|
||||
#define NX_TABLET_CAPABILITY_DEVICEIDMASK 0x0001
|
||||
#define NX_TABLET_CAPABILITY_ABSXMASK 0x0002
|
||||
#define NX_TABLET_CAPABILITY_ABSYMASK 0x0004
|
||||
#define NX_TABLET_CAPABILITY_VENDOR1MASK 0x0008
|
||||
#define NX_TABLET_CAPABILITY_VENDOR2MASK 0x0010
|
||||
#define NX_TABLET_CAPABILITY_VENDOR3MASK 0x0020
|
||||
#define NX_TABLET_CAPABILITY_BUTTONSMASK 0x0040
|
||||
#define NX_TABLET_CAPABILITY_TILTXMASK 0x0080
|
||||
#define NX_TABLET_CAPABILITY_TILTYMASK 0x0100
|
||||
#define NX_TABLET_CAPABILITY_ABSZMASK 0x0200
|
||||
#define NX_TABLET_CAPABILITY_PRESSUREMASK 0x0400
|
||||
#define NX_TABLET_CAPABILITY_TANGENTIALPRESSUREMASK 0x0800
|
||||
#define NX_TABLET_CAPABILITY_ORIENTINFOMASK 0x1000
|
||||
#define NX_TABLET_CAPABILITY_ROTATIONMASK 0x2000
|
||||
|
||||
/* proximity pointer types
|
||||
* Value that describes the type of pointing device placed in
|
||||
* proximity.pointerType.
|
||||
*/
|
||||
|
||||
#define NX_TABLET_POINTER_UNKNOWN 0
|
||||
#define NX_TABLET_POINTER_PEN 1
|
||||
#define NX_TABLET_POINTER_CURSOR 2
|
||||
#define NX_TABLET_POINTER_ERASER 3
|
||||
|
||||
/* TabletPointData type: defines the tablet data for points included
|
||||
* in mouse events created by a tablet driver.
|
||||
*/
|
||||
|
||||
typedef struct _NXTabletPointData {
|
||||
SInt32 x; /* absolute x coordinate in tablet space at full tablet resolution */
|
||||
SInt32 y; /* absolute y coordinate in tablet space at full tablet resolution */
|
||||
SInt32 z; /* absolute z coordinate in tablet space at full tablet resolution */
|
||||
UInt16 buttons; /* one bit per button - bit 0 is first button - 1 = closed */
|
||||
UInt16 pressure; /* scaled pressure value; MAX=(2^16)-1, MIN=0 */
|
||||
struct { /* tilt range is -((2^15)-1) to (2^15)-1 (-32767 to 32767) */
|
||||
SInt16 x; /* scaled tilt x value */
|
||||
SInt16 y; /* scaled tilt y value */
|
||||
} tilt;
|
||||
UInt16 rotation; /* Fixed-point representation of device rotation in a 10.6 format */
|
||||
SInt16 tangentialPressure; /* tangential pressure on the device; same range as tilt */
|
||||
UInt16 deviceID; /* system-assigned unique device ID */
|
||||
SInt16 vendor1; /* vendor-defined signed 16-bit integer */
|
||||
SInt16 vendor2; /* vendor-defined signed 16-bit integer */
|
||||
SInt16 vendor3; /* vendor-defined signed 16-bit integer */
|
||||
} NXTabletPointData, *NXTabletPointDataPtr;
|
||||
|
||||
/* TabletProximityData type: defines the tablet data for proximity
|
||||
* events included in mouse events created by a tablet driver.
|
||||
*/
|
||||
|
||||
typedef struct _NXTabletProximityData {
|
||||
UInt16 vendorID; /* vendor-defined ID - typically the USB vendor ID */
|
||||
UInt16 tabletID; /* vendor-defined tablet ID - typically the USB product ID */
|
||||
UInt16 pointerID; /* vendor-defined ID of the specific pointing device */
|
||||
UInt16 deviceID; /* system-assigned unique device ID */
|
||||
UInt16 systemTabletID; /* system-assigned unique tablet ID */
|
||||
UInt16 vendorPointerType; /* vendor-defined pointer type */
|
||||
UInt32 pointerSerialNumber; /* vendor-defined serial number */
|
||||
UInt64 uniqueID __attribute__ ((packed)); /* vendor-defined unique ID */
|
||||
UInt32 capabilityMask; /* capabilities mask of the device */
|
||||
UInt8 pointerType; /* type of pointing device */
|
||||
UInt8 enterProximity; /* non-zero = entering; zero = leaving */
|
||||
SInt16 reserved1;
|
||||
} NXTabletProximityData, *NXTabletProximityDataPtr;
|
||||
|
||||
/* EventData type: defines the data field of an event */
|
||||
|
||||
typedef union {
|
||||
struct { /* For mouse-down and mouse-up events */
|
||||
UInt8 subx; /* sub-pixel position for x */
|
||||
UInt8 suby; /* sub-pixel position for y */
|
||||
SInt16 eventNum; /* unique identifier for this button */
|
||||
SInt32 click; /* click state of this event */
|
||||
UInt8 pressure; /* pressure value: 0=none, 255=full */
|
||||
UInt8 buttonNumber;/* button generating other button event (0-31) */
|
||||
UInt8 subType;
|
||||
UInt8 reserved2;
|
||||
SInt32 reserved3;
|
||||
union {
|
||||
NXTabletPointData point; /* tablet point data */
|
||||
NXTabletProximityData proximity; /* tablet proximity data */
|
||||
} tablet;
|
||||
} mouse;
|
||||
struct {
|
||||
SInt32 dx;
|
||||
SInt32 dy;
|
||||
UInt8 subx;
|
||||
UInt8 suby;
|
||||
UInt8 subType;
|
||||
UInt8 reserved1;
|
||||
SInt32 reserved2;
|
||||
union {
|
||||
NXTabletPointData point; /* tablet point data */
|
||||
NXTabletProximityData proximity; /* tablet proximity data */
|
||||
} tablet;
|
||||
} mouseMove;
|
||||
struct { /* For key-down and key-up events */
|
||||
UInt16 origCharSet; /* unmodified character set code */
|
||||
SInt16 repeat; /* for key-down: nonzero if really a repeat */
|
||||
UInt16 charSet; /* character set code */
|
||||
UInt16 charCode; /* character code in that set */
|
||||
UInt16 keyCode; /* device-dependent key number */
|
||||
UInt16 origCharCode; /* unmodified character code */
|
||||
SInt32 reserved1;
|
||||
UInt32 keyboardType;
|
||||
SInt32 reserved2;
|
||||
SInt32 reserved3;
|
||||
SInt32 reserved4;
|
||||
SInt32 reserved5[4];
|
||||
} key;
|
||||
struct { /* For mouse-entered and mouse-exited events */
|
||||
SInt16 reserved;
|
||||
SInt16 eventNum; /* unique identifier from mouse down event */
|
||||
SInt32 trackingNum; /* unique identifier from settrackingrect */
|
||||
SInt32 userData; /* uninterpreted integer from settrackingrect */
|
||||
SInt32 reserved1;
|
||||
SInt32 reserved2;
|
||||
SInt32 reserved3;
|
||||
SInt32 reserved4;
|
||||
SInt32 reserved5;
|
||||
SInt32 reserved6[4];
|
||||
} tracking;
|
||||
struct {
|
||||
SInt16 deltaAxis1;
|
||||
SInt16 deltaAxis2;
|
||||
SInt16 deltaAxis3;
|
||||
SInt16 reserved1;
|
||||
SInt32 fixedDeltaAxis1;
|
||||
SInt32 fixedDeltaAxis2;
|
||||
SInt32 fixedDeltaAxis3;
|
||||
SInt32 pointDeltaAxis1;
|
||||
SInt32 pointDeltaAxis2;
|
||||
SInt32 pointDeltaAxis3;
|
||||
SInt32 reserved8[4];
|
||||
} scrollWheel, zoom;
|
||||
struct { /* For window-changed, sys-defined, and app-defined events */
|
||||
SInt16 reserved;
|
||||
SInt16 subType; /* event subtype for compound events */
|
||||
union {
|
||||
float F[11]; /* for use in compound events */
|
||||
SInt32 L[11]; /* for use in compound events */
|
||||
SInt16 S[22]; /* for use in compound events */
|
||||
char C[44]; /* for use in compound events */
|
||||
} misc;
|
||||
} compound;
|
||||
struct {
|
||||
SInt32 x; /* absolute x coordinate in tablet space at full tablet resolution */
|
||||
SInt32 y; /* absolute y coordinate in tablet space at full tablet resolution */
|
||||
SInt32 z; /* absolute z coordinate in tablet space at full tablet resolution */
|
||||
UInt16 buttons; /* one bit per button - bit 0 is first button - 1 = closed */
|
||||
UInt16 pressure; /* scaled pressure value; MAX=(2^16)-1, MIN=0 */
|
||||
struct { /* tilt range is -((2^15)-1) to (2^15)-1 (-32767 to 32767) */
|
||||
SInt16 x; /* scaled tilt x value */
|
||||
SInt16 y; /* scaled tilt y value */
|
||||
} tilt;
|
||||
UInt16 rotation; /* Fixed-point representation of device rotation in a 10.6 format */
|
||||
SInt16 tangentialPressure; /* tangential pressure on the device; same range as tilt */
|
||||
UInt16 deviceID; /* system-assigned unique device ID */
|
||||
SInt16 vendor1; /* vendor-defined signed 16-bit integer */
|
||||
SInt16 vendor2; /* vendor-defined signed 16-bit integer */
|
||||
SInt16 vendor3; /* vendor-defined signed 16-bit integer */
|
||||
SInt32 reserved[4];
|
||||
} tablet;
|
||||
struct {
|
||||
UInt16 vendorID; /* vendor-defined ID - typically the USB vendor ID */
|
||||
UInt16 tabletID; /* vendor-defined tablet ID - typically the USB product ID */
|
||||
UInt16 pointerID; /* vendor-defined ID of the specific pointing device */
|
||||
UInt16 deviceID; /* system-assigned unique device ID */
|
||||
UInt16 systemTabletID; /* system-assigned unique tablet ID */
|
||||
UInt16 vendorPointerType; /* vendor-defined pointer type */
|
||||
UInt32 pointerSerialNumber; /* vendor-defined serial number */
|
||||
UInt64 uniqueID __attribute__ ((packed)); /* vendor-defined unique ID */
|
||||
UInt32 capabilityMask; /* capabilities mask of the device */
|
||||
UInt8 pointerType; /* type of pointing device */
|
||||
UInt8 enterProximity; /* non-zero = entering; zero = leaving */
|
||||
SInt16 reserved1;
|
||||
SInt32 reserved2[4];
|
||||
} proximity;
|
||||
} NXEventData;
|
||||
|
||||
/* The current version number of the NXEventData structure. */
|
||||
|
||||
#define kNXEventDataVersion 2
|
||||
|
||||
/* Finally! The event record! */
|
||||
#ifndef __ppc__
|
||||
typedef struct _NXEvent {
|
||||
SInt32 type; /* An event type from above */
|
||||
struct {
|
||||
SInt32 x, y; /* Base coordinates in window, */
|
||||
} location; /* from bottom left */
|
||||
UInt64 time __attribute__ ((packed)); /* time since launch */
|
||||
SInt32 flags; /* key state flags */
|
||||
UInt32 window; /* window number of assigned window */
|
||||
UInt64 service_id __attribute__ ((packed)); /* service id */
|
||||
SInt32 ext_pid; /* external pid */
|
||||
NXEventData data; /* type-dependent data */
|
||||
} NXEvent, *NXEventPtr;
|
||||
|
||||
#else
|
||||
|
||||
typedef struct _NXEvent {
|
||||
SInt32 type; /* An event type from above */
|
||||
struct {
|
||||
SInt32 x, y; /* Base coordinates in window, */
|
||||
} location; /* from bottom left */
|
||||
UInt64 time __attribute__ ((packed)); /* time since launch */
|
||||
SInt32 flags; /* key state flags */
|
||||
UInt32 window; /* window number of assigned window */
|
||||
NXEventData data; /* type-dependent data */
|
||||
UInt64 service_id __attribute__ ((packed)); /* service id */
|
||||
SInt32 ext_pid; /* external pid */
|
||||
} NXEvent, *NXEventPtr;
|
||||
|
||||
#endif
|
||||
|
||||
/* The current version number of the NXEvent structure. */
|
||||
|
||||
#define kNXEventVersion 2
|
||||
|
||||
/* How to pick window(s) for event (for PostEvent) */
|
||||
#define NX_NOWINDOW -1
|
||||
#define NX_BYTYPE 0
|
||||
#define NX_BROADCAST 1
|
||||
#define NX_TOPWINDOW 2
|
||||
#define NX_FIRSTWINDOW 3
|
||||
#define NX_MOUSEWINDOW 4
|
||||
#define NX_NEXTWINDOW 5
|
||||
#define NX_LASTLEFT 6
|
||||
#define NX_LASTRIGHT 7
|
||||
#define NX_LASTKEY 8
|
||||
#define NX_EXPLICIT 9
|
||||
#define NX_TRANSMIT 10
|
||||
#define NX_BYPSCONTEXT 11
|
||||
|
||||
#endif /* EVENT_H */ /* End of defs common with dpsclient/event.h */
|
||||
|
||||
/* Mask of events that cause the screen to wake up */
|
||||
#define NX_WAKEMASK ( NX_KEYDOWNMASK | NX_FLAGSCHANGEDMASK | \
|
||||
NX_LMOUSEDOWNMASK | NX_LMOUSEUPMASK | \
|
||||
NX_RMOUSEDOWNMASK | NX_RMOUSEUPMASK | \
|
||||
NX_OMOUSEDOWNMASK | NX_OMOUSEUPMASK \
|
||||
)
|
||||
|
||||
/* Mask of events that cause screen to undim */
|
||||
#define NX_UNDIMMASK ( NX_WAKEMASK | NX_KEYUPMASK | NX_SCROLLWHEELMOVEDMASK | \
|
||||
NX_LMOUSEDRAGGEDMASK | NX_RMOUSEDRAGGEDMASK | NX_OMOUSEDRAGGEDMASK | \
|
||||
NX_MOUSEMOVEDMASK | NX_MOUSEENTEREDMASK | NX_MOUSEEXITEDMASK | \
|
||||
NX_TABLETPOINTERMASK | NX_TABLETPROXIMITYMASK \
|
||||
)
|
||||
|
||||
|
||||
#define NX_EVENT_EXTENSION_LOCATION_INVALID 0x1
|
||||
#define NX_EVENT_EXTENSION_LOCATION_TYPE_FLOAT 0x2
|
||||
#define NX_EVENT_EXTENSION_LOCATION_DEVICE_SCALED 0x4
|
||||
#define NX_EVENT_EXTENSION_MOUSE_DELTA_TYPE_FLOAT 0x8
|
||||
#define NX_EVENT_EXTENSION_AUDIT_TOKEN 0x10
|
||||
|
||||
typedef struct _NXEventExtension {
|
||||
UInt32 flags;
|
||||
audit_token_t audit;
|
||||
} NXEventExtension;
|
||||
|
||||
typedef struct _NXEventExt {
|
||||
NXEvent payload;
|
||||
NXEventExtension extension;
|
||||
} NXEventExt;
|
||||
|
||||
#endif /* !_DEV_EVENT_H */
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
|
||||
*
|
||||
* ev_keymap.h
|
||||
* Defines the structure used for parsing keymappings. These structures
|
||||
* and definitions are used by event sources in the kernel and by
|
||||
* applications and utilities which manipulate keymaps.
|
||||
*
|
||||
* HISTORY
|
||||
* 02-Jun-1992 Mike Paquette at NeXT
|
||||
* Created.
|
||||
*/
|
||||
|
||||
#ifndef _DEV_EV_KEYMAP_H
|
||||
#define _DEV_EV_KEYMAP_H
|
||||
|
||||
#define NX_NUMKEYCODES 256 /* Highest key code is 0xff. ADB used to use 0x80 for keydown state, but who the heck uses adb anymore. */
|
||||
#define NX_NUMSEQUENCES 128 /* Maximum possible number of sequences */
|
||||
#define NX_NUMMODIFIERS 16 /* Maximum number of modifier bits */
|
||||
#define NX_BYTE_CODES 0 /* If first short 0, all are bytes (else shorts) */
|
||||
|
||||
#define NX_WHICHMODMASK 0x0f /* bits out of keyBits for bucky bits */
|
||||
#define NX_MODMASK 0x10 /* Bit out of keyBits indicates modifier bit */
|
||||
#define NX_CHARGENMASK 0x20 /* bit out of keyBits for char gen */
|
||||
#define NX_SPECIALKEYMASK 0x40 /* bit out of keyBits for specialty key */
|
||||
#define NX_KEYSTATEMASK 0x80 /* OBSOLETE - DO NOT USE IN NEW DESIGNS */
|
||||
|
||||
/*
|
||||
* Special keys currently known to and understood by the system.
|
||||
* If new specialty keys are invented, extend this list as appropriate.
|
||||
* The presence of these keys in a particular implementation is not
|
||||
* guaranteed.
|
||||
*/
|
||||
#define NX_NOSPECIALKEY 0xFFFF
|
||||
#define NX_KEYTYPE_SOUND_UP 0
|
||||
#define NX_KEYTYPE_SOUND_DOWN 1
|
||||
#define NX_KEYTYPE_BRIGHTNESS_UP 2
|
||||
#define NX_KEYTYPE_BRIGHTNESS_DOWN 3
|
||||
#define NX_KEYTYPE_CAPS_LOCK 4
|
||||
#define NX_KEYTYPE_HELP 5
|
||||
#define NX_POWER_KEY 6
|
||||
#define NX_KEYTYPE_MUTE 7
|
||||
#define NX_UP_ARROW_KEY 8
|
||||
#define NX_DOWN_ARROW_KEY 9
|
||||
#define NX_KEYTYPE_NUM_LOCK 10
|
||||
|
||||
#define NX_KEYTYPE_CONTRAST_UP 11
|
||||
#define NX_KEYTYPE_CONTRAST_DOWN 12
|
||||
#define NX_KEYTYPE_LAUNCH_PANEL 13
|
||||
#define NX_KEYTYPE_EJECT 14
|
||||
#define NX_KEYTYPE_VIDMIRROR 15
|
||||
|
||||
#define NX_KEYTYPE_PLAY 16
|
||||
#define NX_KEYTYPE_NEXT 17
|
||||
#define NX_KEYTYPE_PREVIOUS 18
|
||||
#define NX_KEYTYPE_FAST 19
|
||||
#define NX_KEYTYPE_REWIND 20
|
||||
|
||||
#define NX_KEYTYPE_ILLUMINATION_UP 21
|
||||
#define NX_KEYTYPE_ILLUMINATION_DOWN 22
|
||||
#define NX_KEYTYPE_ILLUMINATION_TOGGLE 23
|
||||
|
||||
#define NX_NUMSPECIALKEYS 24 /* Maximum number of special keys */
|
||||
#define NX_NUM_SCANNED_SPECIALKEYS 24 /* First 24 special keys are */
|
||||
/* actively scanned in kernel */
|
||||
|
||||
#define NX_KEYTYPE_MENU 25
|
||||
|
||||
/* Mask of special keys that are posted as events */
|
||||
|
||||
#define NX_SPECIALKEY_POST_MASK \
|
||||
((1 << NX_KEYTYPE_SOUND_UP) | (1 << NX_KEYTYPE_SOUND_DOWN) | \
|
||||
(1 << NX_POWER_KEY) | (1 << NX_KEYTYPE_MUTE) | \
|
||||
(1 << NX_KEYTYPE_BRIGHTNESS_UP) | (1 << NX_KEYTYPE_BRIGHTNESS_DOWN) | \
|
||||
(1 << NX_KEYTYPE_CONTRAST_UP) | (1 << NX_KEYTYPE_CONTRAST_UP) | \
|
||||
(1 << NX_KEYTYPE_LAUNCH_PANEL) | (1 << NX_KEYTYPE_EJECT) | \
|
||||
(1 << NX_KEYTYPE_VIDMIRROR) | (1 << NX_KEYTYPE_PLAY) | \
|
||||
(1 << NX_KEYTYPE_NEXT) | (1 << NX_KEYTYPE_PREVIOUS) | \
|
||||
(1 << NX_KEYTYPE_FAST) | (1 << NX_KEYTYPE_REWIND) | \
|
||||
(1 << NX_KEYTYPE_ILLUMINATION_UP) | \
|
||||
(1 << NX_KEYTYPE_ILLUMINATION_DOWN) | \
|
||||
(1 << NX_KEYTYPE_ILLUMINATION_TOGGLE) | 0)
|
||||
|
||||
/* Modifier key indices into modDefs[] */
|
||||
#define NX_MODIFIERKEY_ALPHALOCK 0
|
||||
#define NX_MODIFIERKEY_SHIFT 1
|
||||
#define NX_MODIFIERKEY_CONTROL 2
|
||||
#define NX_MODIFIERKEY_ALTERNATE 3
|
||||
#define NX_MODIFIERKEY_COMMAND 4
|
||||
#define NX_MODIFIERKEY_NUMERICPAD 5
|
||||
#define NX_MODIFIERKEY_HELP 6
|
||||
#define NX_MODIFIERKEY_SECONDARYFN 7
|
||||
#define NX_MODIFIERKEY_NUMLOCK 8
|
||||
|
||||
/* support for right hand modifier */
|
||||
#define NX_MODIFIERKEY_RSHIFT 9
|
||||
#define NX_MODIFIERKEY_RCONTROL 10
|
||||
#define NX_MODIFIERKEY_RALTERNATE 11
|
||||
#define NX_MODIFIERKEY_RCOMMAND 12
|
||||
|
||||
#define NX_MODIFIERKEY_ALPHALOCK_STATELESS 13
|
||||
#define NX_MODIFIERKEY_LAST_KEY 13
|
||||
|
||||
|
||||
typedef struct _NXParsedKeyMapping_ {
|
||||
/* If nonzero, all numbers are shorts; if zero, all numbers are bytes*/
|
||||
short shorts;
|
||||
|
||||
/*
|
||||
* For each keycode, low order bit says if the key
|
||||
* generates characters.
|
||||
* High order bit says if the key is assigned to a modifier bit.
|
||||
* The second to low order bit gives the current state of the key.
|
||||
*/
|
||||
char keyBits[NX_NUMKEYCODES];
|
||||
|
||||
/* Bit number of highest numbered modifier bit */
|
||||
int maxMod;
|
||||
|
||||
/* Pointers to where the list of keys for each modifiers bit begins,
|
||||
* or NULL.
|
||||
*/
|
||||
unsigned char *modDefs[NX_NUMMODIFIERS];
|
||||
|
||||
/* Key code of highest key deinfed to generate characters */
|
||||
int numDefs;
|
||||
|
||||
/* Pointer into the keyMapping where this key's definitions begin */
|
||||
unsigned char *keyDefs[NX_NUMKEYCODES];
|
||||
|
||||
/* number of sequence definitions */
|
||||
int numSeqs;
|
||||
|
||||
/* pointers to sequences */
|
||||
unsigned char *seqDefs[NX_NUMSEQUENCES];
|
||||
|
||||
/* Special key definitions */
|
||||
int numSpecialKeys;
|
||||
|
||||
/* Special key values, or 0xFFFF if none */
|
||||
unsigned short specialKeys[NX_NUMSPECIALKEYS];
|
||||
|
||||
/* Pointer to the original keymapping string */
|
||||
const unsigned char *mapping;
|
||||
|
||||
/* Length of the original string */
|
||||
int mappingLen;
|
||||
} NXParsedKeyMapping;
|
||||
|
||||
#endif /* !_DEV_EV_KEYMAP_H */
|
||||
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/******************************************************************************
|
||||
event_status_driver.h
|
||||
API for the events status driver.
|
||||
This file contains public API.
|
||||
mpaque 11Oct91
|
||||
|
||||
Copyright 1991 NeXT Computer, Inc.
|
||||
|
||||
Modified:
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _DRIVERS_EVENT_STATUS_DRIVER_
|
||||
#define _DRIVERS_EVENT_STATUS_DRIVER_
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <mach/port.h>
|
||||
#include <IOKit/hidsystem/IOLLEvent.h>
|
||||
#include <IOKit/hidsystem/IOHIDTypes.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
|
||||
/*
|
||||
* Event System Handle:
|
||||
*
|
||||
* Information used by the system between calls to NXOpenEventSystem and
|
||||
* NXCloseEventSystem. The application should not
|
||||
* access any of the elements of this structure.
|
||||
*/
|
||||
typedef mach_port_t NXEventHandle;
|
||||
|
||||
/* Open and Close */
|
||||
NXEventHandle NXOpenEventStatus(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
void NXCloseEventStatus(NXEventHandle handle) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
|
||||
/* Status */
|
||||
extern NXEventSystemInfoType NXEventSystemInfo(NXEventHandle handle,
|
||||
char *flavor,
|
||||
int *evs_info,
|
||||
unsigned int *evs_info_cnt) __deprecated;
|
||||
/* Keyboard */
|
||||
extern void NXSetKeyRepeatInterval(NXEventHandle handle, double seconds) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
extern double NXKeyRepeatInterval(NXEventHandle handle) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
extern void NXSetKeyRepeatThreshold(NXEventHandle handle, double threshold) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
extern double NXKeyRepeatThreshold(NXEventHandle handle) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
extern void NXResetKeyboard(NXEventHandle handle) __deprecated;
|
||||
|
||||
/* Mouse */
|
||||
extern void NXSetClickTime(NXEventHandle handle, double seconds)__OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
extern double NXClickTime(NXEventHandle handle) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
extern void NXSetClickSpace(NXEventHandle handle, _NXSize_ *area) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
extern void NXGetClickSpace(NXEventHandle handle, _NXSize_ *area) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_12, __IPHONE_NA, __IPHONE_NA);
|
||||
extern void NXResetMouse(NXEventHandle handle) __deprecated;
|
||||
|
||||
/*
|
||||
* The following functions have been removed.
|
||||
*
|
||||
* NXIdleTime
|
||||
* <20><><EFBFBD><EFBFBD>See CGEventSourceSecondsSinceLastEventType.
|
||||
*
|
||||
* NXSetKeyMapping
|
||||
* NXKeyMappingLength
|
||||
* NXGetKeyMapping
|
||||
* <20><><EFBFBD><EFBFBD>These do not have a drop in replacement. <20>See UCKeyTranslate.
|
||||
*
|
||||
* NXSetMouseScaling
|
||||
* <20><><EFBFBD><EFBFBD>See IOHIDSetAccelerationWithKey and IOHIDSetMouseAcceleration.
|
||||
*
|
||||
* NXGetMouseScaling
|
||||
* <20><><EFBFBD><EFBFBD>See IOHIDGetAccelerationWithKey and IOHIDGetMouseAcceleration.
|
||||
*
|
||||
* NXSetAutoDimThreshold
|
||||
* NXSetAutoDimState
|
||||
* <20><><EFBFBD><EFBFBD>See IOPMSetAggressiveness and kPMMinutesToDim.
|
||||
*
|
||||
* NXAutoDimThreshold
|
||||
* NXAutoDimTime
|
||||
* NXAutoDimState
|
||||
* <20><><EFBFBD><EFBFBD>See IOPMGetAggressiveness and kPMMinutesToDim.
|
||||
*
|
||||
* NXSetAutoDimBrightness
|
||||
* NXAutoDimBrightness
|
||||
* NXSetScreenBrightness
|
||||
* NXScreenBrightness
|
||||
* <20><><EFBFBD><EFBFBD>This functionality is unsupported.
|
||||
*/
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /*_DRIVERS_EVENT_STATUS_DRIVER_ */
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOI2CINTERFACE_H
|
||||
#define _IOKIT_IOI2CINTERFACE_H
|
||||
|
||||
#include <IOKit/IOTypes.h> /* IOOptionBits */
|
||||
#include <stdint.h> /* uint32_t */
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
typedef struct IOI2CRequest IOI2CRequest;
|
||||
typedef struct IOI2CBuffer IOI2CBuffer;
|
||||
|
||||
typedef void (*IOI2CRequestCompletion) (IOI2CRequest * request);
|
||||
|
||||
// IOI2CRequest.sendTransactionType, IOI2CRequest.replyTransactionType
|
||||
enum {
|
||||
kIOI2CNoTransactionType = 0,
|
||||
kIOI2CSimpleTransactionType = 1,
|
||||
kIOI2CDDCciReplyTransactionType = 2,
|
||||
kIOI2CCombinedTransactionType = 3,
|
||||
kIOI2CDisplayPortNativeTransactionType = 4
|
||||
};
|
||||
|
||||
// IOI2CRequest.commFlags
|
||||
enum {
|
||||
kIOI2CUseSubAddressCommFlag = 0x00000002
|
||||
};
|
||||
|
||||
/*!
|
||||
* @struct IOI2CRequest
|
||||
* @abstract A structure defining an I2C bus transaction.
|
||||
* @discussion This structure is used to request an I2C transaction consisting of a send (write) to and reply (read) from a device, either of which is optional, to be carried out atomically on an I2C bus.
|
||||
* @field __reservedA Set to zero.
|
||||
* @field result The result of the transaction. Common errors are kIOReturnNoDevice if there is no device responding at the given address, kIOReturnUnsupportedMode if the type of transaction is unsupported on the requested bus.
|
||||
* @field completion A completion routine to be executed when the request completes. If NULL is passed, the request is synchronous, otherwise it may execute asynchronously.
|
||||
* @field commFlags Flags that modify the I2C transaction type. The following flags are defined:<br>
|
||||
* kIOI2CUseSubAddressCommFlag Transaction includes a subaddress.<br>
|
||||
* @field minReplyDelay Minimum delay as absolute time between send and reply transactions.
|
||||
* @field sendAddress I2C address to write.
|
||||
* @field sendSubAddress I2C subaddress to write.
|
||||
* @field __reservedB Set to zero.
|
||||
* @field sendTransactionType The following types of transaction are defined for the send part of the request:<br>
|
||||
* kIOI2CNoTransactionType No send transaction to perform. <br>
|
||||
* kIOI2CSimpleTransactionType Simple I2C message. <br>
|
||||
* kIOI2CCombinedTransactionType Combined format I2C R/~W transaction. <br>
|
||||
* @field sendBuffer Pointer to the send buffer.
|
||||
* @field sendBytes Number of bytes to send. Set to actual bytes sent on completion of the request.
|
||||
* @field replyAddress I2C Address from which to read.
|
||||
* @field replySubAddress I2C Address from which to read.
|
||||
* @field __reservedC Set to zero.
|
||||
* @field replyTransactionType The following types of transaction are defined for the reply part of the request:<br>
|
||||
* kIOI2CNoTransactionType No reply transaction to perform. <br>
|
||||
* kIOI2CSimpleTransactionType Simple I2C message. <br>
|
||||
* kIOI2CDDCciReplyTransactionType DDC/ci message (with embedded length). See VESA DDC/ci specification. <br>
|
||||
* kIOI2CCombinedTransactionType Combined format I2C R/~W transaction. <br>
|
||||
* @field replyBuffer Pointer to the reply buffer.
|
||||
* @field replyBytes Max bytes to reply (size of replyBuffer). Set to actual bytes received on completion of the request.
|
||||
* @field __reservedD Set to zero.
|
||||
*/
|
||||
|
||||
#pragma pack(push, 4)
|
||||
struct IOI2CRequest
|
||||
{
|
||||
IOOptionBits sendTransactionType;
|
||||
IOOptionBits replyTransactionType;
|
||||
uint32_t sendAddress;
|
||||
uint32_t replyAddress;
|
||||
uint8_t sendSubAddress;
|
||||
uint8_t replySubAddress;
|
||||
uint8_t __reservedA[2];
|
||||
|
||||
uint64_t minReplyDelay;
|
||||
|
||||
IOReturn result;
|
||||
IOOptionBits commFlags;
|
||||
|
||||
#if defined(__LP64__)
|
||||
uint32_t __padA;
|
||||
#else
|
||||
vm_address_t sendBuffer;
|
||||
#endif
|
||||
uint32_t sendBytes;
|
||||
|
||||
uint32_t __reservedB[2];
|
||||
|
||||
#if defined(__LP64__)
|
||||
uint32_t __padB;
|
||||
#else
|
||||
vm_address_t replyBuffer;
|
||||
#endif
|
||||
uint32_t replyBytes;
|
||||
|
||||
IOI2CRequestCompletion completion;
|
||||
#if !defined(__LP64__)
|
||||
uint32_t __padC[5];
|
||||
#else
|
||||
vm_address_t sendBuffer;
|
||||
vm_address_t replyBuffer;
|
||||
#endif
|
||||
|
||||
uint32_t __reservedC[10];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#define kIOI2CInterfaceClassName "IOI2CInterface"
|
||||
|
||||
#define kIOI2CInterfaceIDKey "IOI2CInterfaceID"
|
||||
#define kIOI2CBusTypeKey "IOI2CBusType"
|
||||
#define kIOI2CTransactionTypesKey "IOI2CTransactionTypes"
|
||||
#define kIOI2CSupportedCommFlagsKey "IOI2CSupportedCommFlags"
|
||||
|
||||
#define kIOFBI2CInterfaceInfoKey "IOFBI2CInterfaceInfo"
|
||||
#define kIOFBI2CInterfaceIDsKey "IOFBI2CInterfaceIDs"
|
||||
|
||||
// kIOI2CBusTypeKey values
|
||||
enum {
|
||||
kIOI2CBusTypeI2C = 1,
|
||||
kIOI2CBusTypeDisplayPort = 2
|
||||
};
|
||||
|
||||
/*!
|
||||
* @struct IOI2CBusTiming
|
||||
* @abstract A structure defining low level timing for an I2C bus.
|
||||
* @discussion This structure is used to specify timeouts and pulse widths for an I2C bus implementation.
|
||||
* @field bitTimeout Maximum time a slave can delay (by pulling the clock line low) a single bit response.
|
||||
* @field byteTimeout Maximum time a slave can delay (by pulling the clock line low) the first bit of a byte response.
|
||||
* @field acknowledgeTimeout Maximum time to wait for a slave to respond with an ACK after writing a byte.
|
||||
* @field startTimeout Maximum time to wait for a slave to respond after a start signal.
|
||||
* @field riseFallTime Time to wait after any change in output signal.
|
||||
* @field __reservedA Set to zero.
|
||||
*/
|
||||
|
||||
struct IOI2CBusTiming
|
||||
{
|
||||
AbsoluteTime bitTimeout;
|
||||
AbsoluteTime byteTimeout;
|
||||
AbsoluteTime acknowledgeTimeout;
|
||||
AbsoluteTime startTimeout;
|
||||
AbsoluteTime holdTime;
|
||||
AbsoluteTime riseFallTime;
|
||||
UInt32 __reservedA[8];
|
||||
};
|
||||
typedef struct IOI2CBusTiming IOI2CBusTiming;
|
||||
|
||||
#ifndef KERNEL
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// options for IOFBCopyI2CInterfaceForBus()
|
||||
enum {
|
||||
kIOI2CBusNumberMask = 0x000000ff
|
||||
};
|
||||
|
||||
|
||||
/*! @function IOFBGetI2CInterfaceCount
|
||||
@abstract Returns a count of I2C interfaces available associated with an IOFramebuffer instance.
|
||||
@discussion Returns a count of I2C interfaces available associated with an IOFramebuffer instance.
|
||||
@param framebuffer The io_service_t of an IOFramebuffer instance. CoreGraphics will provide this for a CGDisplay with the CGDisplayIOServicePort() call.
|
||||
@param count Interface count is returned.
|
||||
@result An IOReturn code. */
|
||||
|
||||
IOReturn IOFBGetI2CInterfaceCount( io_service_t framebuffer, IOItemCount * count );
|
||||
|
||||
/*! @function IOFBCopyI2CInterfaceForBus
|
||||
@abstract Returns an instance of an I2C bus interface, associated with an IOFramebuffer instance / bus index pair.
|
||||
@discussion Some graphics devices will allow access to an I2C bus routed through a display connector in order to control external devices on that bus. This function returns an instance of an I2C bus interface, associated with an IOFramebuffer instance / bus index pair. The number of I2C buses is available from the IOFBGetI2CInterfaceCount() call. The interface may be used with the IOI2CInterfaceOpen/Close/SendRequest() calls to carry out I2C transactions on that bus. Not all graphics devices support this functionality.
|
||||
@param bus The zero based index of the bus on the requested framebuffer.
|
||||
@param interface The interface instance is returned. The caller should release this instance with IOObjectRelease().
|
||||
@result An IOReturn code. */
|
||||
|
||||
IOReturn IOFBCopyI2CInterfaceForBus( io_service_t framebuffer, IOOptionBits bus, io_service_t * interface );
|
||||
|
||||
typedef struct IOI2CConnect * IOI2CConnectRef; /* struct IOI2CConnect is opaque */
|
||||
|
||||
IOReturn IOI2CCopyInterfaceForID( CFTypeRef identifier, io_service_t * interface );
|
||||
|
||||
/*! @function IOI2CInterfaceOpen
|
||||
@abstract Opens an instance of an I2C bus interface, allowing I2C requests to be made.
|
||||
@discussion An instance of an I2C bus interface, obtained by IOFBCopyI2CInterfaceForBus, is opened with this function allowing I2C requests to be made.
|
||||
@param interface An I2C bus interface (see IOFBCopyI2CInterfaceForBus). The interface may be released after this call is made.
|
||||
@param options Pass kNilOptions.
|
||||
@param connect The opaque IOI2CConnectRef is returned, for use with IOI2CSendRequest() and IOI2CInterfaceClose().
|
||||
@result An IOReturn code. */
|
||||
|
||||
IOReturn IOI2CInterfaceOpen( io_service_t interface, IOOptionBits options,
|
||||
IOI2CConnectRef * connect );
|
||||
|
||||
/*! @function IOI2CInterfaceClose
|
||||
@abstract Closes an IOI2CConnectRef.
|
||||
@discussion Frees the resources associated with an IOI2CConnectRef.
|
||||
@param connect The opaque IOI2CConnectRef returned by IOI2CInterfaceOpen().
|
||||
@param options Pass kNilOptions.
|
||||
@result An IOReturn code. */
|
||||
|
||||
IOReturn IOI2CInterfaceClose( IOI2CConnectRef connect, IOOptionBits options );
|
||||
|
||||
/*! @function IOI2CSendRequest
|
||||
@abstract Carries out the I2C transaction specified by an IOI2CRequest structure.
|
||||
@discussion Frees the resources associated with an IOI2CConnectRef.
|
||||
@param connect The opaque IOI2CConnectRef returned by IOI2CInterfaceOpen().
|
||||
@param options Pass kNilOptions.
|
||||
@param request Pass a pointer to a IOI2CRequest structure describing the request. If an asynchronous request (with a non-NULL completion routine) the request structure must be valid for the life of the request.
|
||||
@result An IOReturn code reflecting only the result of starting the transaction. If the result of IOI2CSendRequest() is kIOReturnSuccess, the I2C transaction result is returned in the result field of the request structure. */
|
||||
|
||||
IOReturn IOI2CSendRequest( IOI2CConnectRef connect, IOOptionBits options,
|
||||
IOI2CRequest * request );
|
||||
|
||||
#else
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*! @class IOI2CInterface
|
||||
@abstract The base class for an I2C bus interface.
|
||||
@discussion The IOI2CInterface base class defines an I2C bus interface. Not useful for developers. */
|
||||
|
||||
class IOI2CInterface : public IOService
|
||||
{
|
||||
OSDeclareDefaultStructors(IOI2CInterface)
|
||||
|
||||
protected:
|
||||
UInt64 fID;
|
||||
|
||||
public:
|
||||
IOReturn newUserClient( task_t owningTask,
|
||||
void * security_id,
|
||||
UInt32 type,
|
||||
IOUserClient ** handler ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
bool registerI2C( UInt64 id );
|
||||
|
||||
virtual IOReturn startIO( IOI2CRequest * request ) = 0;
|
||||
};
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* ! _IOKIT_IOI2CINTERFACE_H */
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/* Deprecated, kept (for now) for compatibility */
|
||||
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2008, 2012 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef __KEXTMANAGER_H__
|
||||
#define __KEXTMANAGER_H__
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <libkern/OSReturn.h>
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/*!
|
||||
* @header KextManager.h
|
||||
*
|
||||
* @abstract
|
||||
* The KextManager API provides a simple interface for applications
|
||||
* to load kernel extensions (kexts) via RPC to kextd, and to look up the
|
||||
* URLs for kexts by bundle identifier.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @function KextManagerCreateURLForBundleIdentifier
|
||||
* @abstract Create a URL locating a kext with a given bundle identifier.
|
||||
*
|
||||
* @param allocator
|
||||
* The allocator to use to allocate memory for the new object.
|
||||
* Pass <code>NULL</code> or <code>kCFAllocatorDefault</code>
|
||||
* to use the current default allocator.
|
||||
* @param kextIdentifier
|
||||
* The bundle identifier to look up.
|
||||
*
|
||||
* @result
|
||||
* A CFURLRef locating a kext with the requested bundle identifier.
|
||||
* Returns <code>NULL</code> if the kext cannot be found, or on error.
|
||||
*
|
||||
* @discussion
|
||||
* Kexts are looked up first by whether they are loaded, second by version.
|
||||
* Specifically, if <code>kextIdentifier</code> identifies a kext
|
||||
* that is currently loaded,
|
||||
* the returned URL will locate that kext if it's still present on disk.
|
||||
* If the requested kext is not loaded,
|
||||
* or if its bundle is not at the location it was originally loaded from,
|
||||
* the returned URL will locate the latest version of the desired kext,
|
||||
* if one can be found within the system extensions folder.
|
||||
* If no version of the kext can be found, <code>NULL</code> is returned.
|
||||
*/
|
||||
CFURLRef KextManagerCreateURLForBundleIdentifier(
|
||||
CFAllocatorRef allocator,
|
||||
CFStringRef kextIdentifier) AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER;
|
||||
|
||||
/*!
|
||||
* @function KextManagerLoadKextWithIdentifier
|
||||
* @abstract
|
||||
* Request the kext loading system to load a kext with a given bundle identifier.
|
||||
*
|
||||
* @param kextIdentifier
|
||||
* The bundle identifier of the kext to look up and load.
|
||||
* @param dependencyKextAndFolderURLs
|
||||
* An array of additional URLs, of individual kexts and
|
||||
* of folders that may contain kexts.
|
||||
*
|
||||
* @result
|
||||
* <code>kOSReturnSuccess</code> if the kext is successfully loaded
|
||||
* (or is already loaded), otherwise returns on error.
|
||||
*
|
||||
* @discussion
|
||||
* <code>kextIdentifier</code> is looked up in the system extensions
|
||||
* folder and among any kexts from <code>dependencyKextAndFolderURLs</code>.
|
||||
* Any non-kext URLs in <code>dependencyKextAndFolderURLs</code>
|
||||
* are scanned at the top level for kexts and plugins of kexts.
|
||||
*
|
||||
* Either the calling process must have an effective user id of 0 (superuser),
|
||||
* or the kext being loaded and all its dependencies must reside in
|
||||
* /System and have an OSBundleAllowUserLoad property of <code>true</code>.
|
||||
*/
|
||||
OSReturn KextManagerLoadKextWithIdentifier(
|
||||
CFStringRef kextIdentifier,
|
||||
CFArrayRef dependencyKextAndFolderURLs) AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
/*!
|
||||
* @function KextManagerLoadKextWithURL
|
||||
* @abstract
|
||||
* Request the kext loading system to load a kext with a given URL.
|
||||
*
|
||||
* @param kextURL
|
||||
* The URL of the kext to load.
|
||||
* @param dependencyKextAndFolderURLs
|
||||
* An array of additional URLs, of individual kexts and
|
||||
* of folders that may contain kexts.
|
||||
*
|
||||
* @result
|
||||
* <code>kOSReturnSuccess</code> if the kext is successfully loaded
|
||||
* (or is already loaded), otherwise returns on error.
|
||||
*
|
||||
* @discussion
|
||||
* Any non-kext URLs in <code>dependencyKextAndFolderURLs</code>
|
||||
* are scanned at the top level for kexts and plugins of kexts.
|
||||
*
|
||||
* Either the calling process must have an effective user id of 0 (superuser),
|
||||
* or the kext being loaded and all its dependencies must reside in
|
||||
* /System and have an OSBundleAllowUserLoad property of <code>true</code>.
|
||||
*/
|
||||
OSReturn KextManagerLoadKextWithURL(
|
||||
CFURLRef kextURL,
|
||||
CFArrayRef dependencyKextAndFolderURLs) AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER;
|
||||
|
||||
/*!
|
||||
* @function KextManagerUnloadKextWithIdentifier
|
||||
* @abstract
|
||||
* Request the kernel to unload a kext with a given bundle identifier.
|
||||
*
|
||||
* @param kextIdentifier
|
||||
* The bundle identifier of the kext to unload.
|
||||
*
|
||||
* @result
|
||||
* <code>kOSReturnSuccess</code> if the kext is
|
||||
* found and successfully unloaded,
|
||||
* otherwise returns on error.
|
||||
* See <code>/usr/include/libkern/OSKextLib.h</code>
|
||||
* for error codes.
|
||||
*
|
||||
* @discussion
|
||||
* The calling process must have an effective user id of 0 (superuser).
|
||||
*/
|
||||
OSReturn KextManagerUnloadKextWithIdentifier(
|
||||
CFStringRef kextIdentifier) AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER;
|
||||
|
||||
/*!
|
||||
* @function KextManagerCopyLoadedKextInfo
|
||||
* @abstract Returns information about loaded kexts in a dictionary.
|
||||
*
|
||||
* @param kextIdentifiers An array of kext identifiers to read from the kernel.
|
||||
* Pass <code>NULL</code> to read info for all loaded kexts.
|
||||
* @param infoKeys An array of info keys to read from the kernel.
|
||||
* Pass <code>NULL</code> to read all information.
|
||||
* @result
|
||||
* A dictionary, keyed by bundle identifier,
|
||||
* of dictionaries containing information about loaded kexts.
|
||||
*
|
||||
* @discussion
|
||||
* The information keys returned by this function are listed below.
|
||||
* Some are taken directly from the kext's information property list,
|
||||
* and some are generated at run time.
|
||||
* Never assume a given key will be present for a kext.
|
||||
*
|
||||
* <ul>
|
||||
* <li><code>CFBundleIdentifier</code> - CFString</li>
|
||||
* <li><code>CFBundleVersion</code> - CFString (note: version strings may be canonicalized
|
||||
* but their numeric values will be the same; "1.2.0" may become "1.2", for example)</li>
|
||||
* <li><code>OSBundleCompatibleVersion</code> - CFString</li>
|
||||
* <li><code>OSBundleIsInterface</code> - CFBoolean</li>
|
||||
* <li><code>OSKernelResource</code> - CFBoolean</li>
|
||||
* <li><code>OSBundleCPUType</code> - CFNumber</li>
|
||||
* <li><code>OSBundleCPUSubtype</code> - CFNumber</li>
|
||||
* <li><code>OSBundlePath</code> - CFString (this is merely a hint stored in the kernel;
|
||||
* the kext is not guaranteed to be at this path)</li>
|
||||
* <li><code>OSBundleExecutablePath</code> - CFString
|
||||
* (the absolute path to the executable within the kext bundle; a hint as above)</li>
|
||||
* <li><code>OSBundleUUID</code> - CFData (the UUID of the kext executable, if it has one)</li>
|
||||
* <li><code>OSBundleStarted</code> - CFBoolean (true if the kext is running)</li>
|
||||
* <li><code>OSBundlePrelinked</code> - CFBoolean (true if the kext is loaded from a prelinked kernel)</li>
|
||||
* <li><code>OSBundleLoadTag</code> - CFNumber (the "Index" given by kextstat)</li>
|
||||
* <li><code>OSBundleLoadAddress</code> - CFNumber</li>
|
||||
* <li><code>OSBundleLoadSize</code> - CFNumber</li>
|
||||
* <li><code>OSBundleWiredSize</code> - CFNumber</li>
|
||||
* <li><code>OSBundleDependencies</code> - CFArray of load tags identifying immediate link dependencies</li>
|
||||
* <li><code>OSBundleRetainCount</code> - CFNumber (the OSObject retain count of the kext itself)</li>
|
||||
* <li><code>OSBundleClasses</code> - CFArray of CFDictionary containing info on C++ classes
|
||||
* defined by the kext:</li>
|
||||
* <ul>
|
||||
* <li><code>OSMetaClassName</code> - CFString</li>
|
||||
* <li><code>OSMetaClassSuperclassName</code> - CFString, absent for root classes</li>
|
||||
* <li><code>OSMetaClassTrackingCount</code> - CFNumber giving the instance count
|
||||
* of the class itself, <i>plus</i> 1 for each direct subclass with any instances</li>
|
||||
* </ul>
|
||||
* </ul>
|
||||
*/
|
||||
CFDictionaryRef KextManagerCopyLoadedKextInfo(
|
||||
CFArrayRef kextIdentifiers,
|
||||
CFArrayRef infoKeys) AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER;
|
||||
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* __KEXTMANAGER_H__ */
|
||||
@@ -0,0 +1,419 @@
|
||||
/*
|
||||
* 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@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1997 Apple Computer, Inc.
|
||||
*
|
||||
*
|
||||
* HISTORY
|
||||
*
|
||||
* sdouglas 22 Oct 97 - first checked in.
|
||||
* sdouglas 21 July 98 - start IOKit
|
||||
*/
|
||||
|
||||
/*
|
||||
File: Types.h
|
||||
|
||||
Contains: Basic Macintosh data types.
|
||||
|
||||
Version: Technology: PowerSurge 1.0.2.
|
||||
Package: Universal Interfaces 2.1.2 on ETO #20
|
||||
|
||||
Copyright: <20> 1984-1995 by Apple Computer, Inc.
|
||||
All rights reserved.
|
||||
|
||||
Bugs?: If you find a problem with this file, use the Apple Bug Reporter
|
||||
stack. Include the file and version information (from above)
|
||||
in the problem description and send to:
|
||||
Internet: apple.bugs@applelink.apple.com
|
||||
AppleLink: APPLE.BUGS
|
||||
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOMACOSTYPES_H
|
||||
#define _IOKIT_IOMACOSTYPES_H
|
||||
#ifndef __MACTYPES__
|
||||
|
||||
#include <IOKit/IOTypes.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __LP64__
|
||||
#pragma options align=mac68k
|
||||
#endif
|
||||
|
||||
#ifndef NULL
|
||||
#if !defined(__cplusplus) && (defined(__SC__) || defined(THINK_C))
|
||||
#define NULL ((void *) 0)
|
||||
#else
|
||||
#define NULL 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
enum {
|
||||
noErr = 0
|
||||
};
|
||||
|
||||
typedef unsigned char Byte;
|
||||
|
||||
typedef signed char SignedByte;
|
||||
|
||||
typedef UInt16 UniChar;
|
||||
|
||||
typedef char *Ptr;
|
||||
|
||||
typedef Ptr *Handle;
|
||||
|
||||
typedef UInt32 Fixed;
|
||||
|
||||
typedef Fixed *FixedPtr;
|
||||
|
||||
typedef UInt32 Fract;
|
||||
|
||||
typedef Fract *FractPtr;
|
||||
|
||||
/*
|
||||
enum {
|
||||
false,
|
||||
true
|
||||
};
|
||||
#if !__option(bool)
|
||||
#ifndef true
|
||||
#define true 1
|
||||
#endif
|
||||
#ifndef false
|
||||
#define false 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef unsigned char Boolean;
|
||||
*/
|
||||
|
||||
|
||||
typedef short OSErr;
|
||||
|
||||
typedef unsigned int FourCharCode;
|
||||
|
||||
typedef FourCharCode OSType;
|
||||
|
||||
typedef FourCharCode ResType;
|
||||
|
||||
typedef OSType *OSTypePtr;
|
||||
|
||||
typedef ResType *ResTypePtr;
|
||||
|
||||
struct Rect {
|
||||
short top;
|
||||
short left;
|
||||
short bottom;
|
||||
short right;
|
||||
};
|
||||
typedef struct Rect Rect;
|
||||
|
||||
typedef Rect *RectPtr;
|
||||
|
||||
// Quickdraw.i
|
||||
|
||||
/*
|
||||
kVariableLengthArray is used in array bounds to specify a variable length array.
|
||||
It is ususally used in variable length structs when the last field is an array
|
||||
of any size. Before ANSI C, we used zero as the bounds of variable length
|
||||
array, but that is illegal in ANSI C. Example:
|
||||
|
||||
struct FooList
|
||||
{
|
||||
short listLength;
|
||||
Foo elements[kVariableLengthArray];
|
||||
};
|
||||
*/
|
||||
|
||||
enum {
|
||||
kVariableLengthArray = 1
|
||||
};
|
||||
|
||||
/* Numeric version part of 'vers' resource */
|
||||
struct NumVersion {
|
||||
UInt8 majorRev; /*1st part of version number in BCD*/
|
||||
UInt8 minorAndBugRev; /*2nd & 3rd part of version number share a byte*/
|
||||
UInt8 stage; /*stage code: dev, alpha, beta, final*/
|
||||
UInt8 nonRelRev; /*revision level of non-released version*/
|
||||
};
|
||||
typedef struct NumVersion NumVersion;
|
||||
|
||||
typedef struct OpaqueRef *KernelID;
|
||||
|
||||
typedef UInt8 *BytePtr;
|
||||
|
||||
typedef IOByteCount ByteCount;
|
||||
|
||||
typedef IOItemCount ItemCount;
|
||||
|
||||
typedef void *LogicalAddress;
|
||||
|
||||
#if !defined(__LP64__)
|
||||
typedef void *PhysicalAddress;
|
||||
#endif
|
||||
|
||||
typedef UInt32 PBVersion;
|
||||
|
||||
typedef SInt32 Duration;
|
||||
|
||||
#define kInvalidID 0
|
||||
|
||||
enum {
|
||||
kNilOptions = 0
|
||||
};
|
||||
|
||||
|
||||
typedef unsigned char Str31[32];
|
||||
|
||||
|
||||
/*
|
||||
From:
|
||||
File: DriverFamilyMatching.i <18>
|
||||
Copyright: <20> 1995-1996 by Apple Computer, Inc., all rights reserved.
|
||||
*/
|
||||
|
||||
//##############################################
|
||||
// Well known properties in the Name Registry
|
||||
//##############################################
|
||||
|
||||
#define kPropertyName "name"
|
||||
#define kPropertyCompatible "compatible"
|
||||
#define kPropertyDriverPtr "driver-ptr"
|
||||
#define kPropertyDriverDesc "driver-description"
|
||||
#define kPropertyReg "reg"
|
||||
#define kPropertyAAPLAddress "AAPL,address"
|
||||
#define kPropertyMatching "matching"
|
||||
|
||||
|
||||
//#########################################################
|
||||
// Descriptor for Drivers and NDRVs
|
||||
//#########################################################
|
||||
/* Driver Typing Information Used to Match Drivers With Devices */
|
||||
struct DriverType {
|
||||
Str31 nameInfoStr; /* Driver Name/Info String*/
|
||||
NumVersion version; /* Driver Version Number*/
|
||||
};
|
||||
typedef struct DriverType DriverType;
|
||||
typedef DriverType * DriverTypePtr;
|
||||
|
||||
/* OS Runtime Information Used to Setup and Maintain a Driver's Runtime Environment */
|
||||
typedef IOOptionBits RuntimeOptions;
|
||||
|
||||
|
||||
enum {
|
||||
kDriverIsLoadedUponDiscovery = 0x00000001, /* auto-load driver when discovered*/
|
||||
kDriverIsOpenedUponLoad = 0x00000002, /* auto-open driver when loaded*/
|
||||
kDriverIsUnderExpertControl = 0x00000004, /* I/O expert handles loads/opens*/
|
||||
kDriverIsConcurrent = 0x00000008, /* supports concurrent requests*/
|
||||
kDriverQueuesIOPB = 0x00000010, /* device manager doesn't queue IOPB*/
|
||||
kDriverIsLoadedAtBoot = 0x00000020, /* Driver is loaded at the boot time */
|
||||
kDriverIsForVirtualDevice = 0x00000040, /* Driver is for a virtual Device */
|
||||
kDriverSupportDMSuspendAndResume = 0x00000080 /* Driver supports Device Manager Suspend and Resume command */
|
||||
};
|
||||
|
||||
struct DriverOSRuntime {
|
||||
RuntimeOptions driverRuntime; /* Options for OS Runtime*/
|
||||
Str31 driverName; /* Driver's name to the OS*/
|
||||
UInt32 driverDescReserved[8]; /* Reserved area*/
|
||||
};
|
||||
typedef struct DriverOSRuntime DriverOSRuntime;
|
||||
typedef DriverOSRuntime * DriverOSRuntimePtr;
|
||||
|
||||
/* OS Service Information Used To Declare What APIs a Driver Supports */
|
||||
typedef UInt32 ServiceCount;
|
||||
|
||||
struct DriverServiceInfo {
|
||||
OSType serviceCategory; /* Service Category Name*/
|
||||
OSType serviceType; /* Type within Category*/
|
||||
NumVersion serviceVersion; /* Version of service*/
|
||||
};
|
||||
typedef struct DriverServiceInfo DriverServiceInfo;
|
||||
typedef DriverServiceInfo * DriverServiceInfoPtr;
|
||||
|
||||
struct DriverOSService {
|
||||
ServiceCount nServices; /* Number of Services Supported*/
|
||||
DriverServiceInfo service[1]; /* The List of Services (at least one)*/
|
||||
};
|
||||
typedef struct DriverOSService DriverOSService;
|
||||
typedef DriverOSService * DriverOSServicePtr;
|
||||
|
||||
/* Categories */
|
||||
|
||||
enum {
|
||||
kServiceCategoryDisplay = 'disp', /* Display Manager*/
|
||||
kServiceCategoryOpenTransport = 'otan', /* Open Transport*/
|
||||
kServiceCategoryBlockStorage = 'blok', /* Block Storage*/
|
||||
kServiceCategoryNdrvDriver = 'ndrv', /* Generic Native Driver*/
|
||||
kServiceCategoryScsiSIM = 'scsi', /* SCSI */
|
||||
kServiceCategoryFileManager = 'file', /* File Manager */
|
||||
kServiceCategoryIDE = 'ide-', /* ide */
|
||||
kServiceCategoryADB = 'adb-', /* adb */
|
||||
kServiceCategoryPCI = 'pci-', /* pci bus */
|
||||
/* Nu Bus */
|
||||
kServiceCategoryDFM = 'dfm-', /* DFM */
|
||||
kServiceCategoryMotherBoard = 'mrbd', /* mother Board */
|
||||
kServiceCategoryKeyboard = 'kybd', /* Keyboard */
|
||||
kServiceCategoryPointing = 'poit', /* Pointing */
|
||||
kServiceCategoryRTC = 'rtc-', /* RTC */
|
||||
kServiceCategoryNVRAM = 'nram', /* NVRAM */
|
||||
kServiceCategorySound = 'sond', /* Sound (1/3/96 MCS) */
|
||||
kServiceCategoryPowerMgt = 'pgmt', /* Power Management */
|
||||
kServiceCategoryGeneric = 'genr' /* Generic Service Category to receive general Events */
|
||||
};
|
||||
|
||||
/* Ndrv ServiceCategory Types */
|
||||
enum {
|
||||
kNdrvTypeIsGeneric = 'genr', /* generic*/
|
||||
kNdrvTypeIsVideo = 'vido', /* video*/
|
||||
kNdrvTypeIsBlockStorage = 'blok', /* block storage*/
|
||||
kNdrvTypeIsNetworking = 'netw', /* networking*/
|
||||
kNdrvTypeIsSerial = 'serl', /* serial*/
|
||||
kNdrvTypeIsParallel = 'parl', /* parallel */
|
||||
kNdrvTypeIsSound = 'sond', /* sound*/
|
||||
kNdrvTypeIsBusBridge = 'brdg'
|
||||
};
|
||||
|
||||
typedef UInt32 DriverDescVersion;
|
||||
|
||||
/* The Driver Description */
|
||||
enum {
|
||||
kInitialDriverDescriptor = 0,
|
||||
kVersionOneDriverDescriptor = 1
|
||||
};
|
||||
|
||||
enum {
|
||||
kTheDescriptionSignature = 'mtej',
|
||||
kDriverDescriptionSignature = 'pdes'
|
||||
};
|
||||
|
||||
|
||||
struct DriverDescription {
|
||||
OSType driverDescSignature; /* Signature field of this structure*/
|
||||
DriverDescVersion driverDescVersion; /* Version of this data structure*/
|
||||
DriverType driverType; /* Type of Driver*/
|
||||
DriverOSRuntime driverOSRuntimeInfo; /* OS Runtime Requirements of Driver*/
|
||||
DriverOSService driverServices; /* Apple Service API Membership*/
|
||||
};
|
||||
typedef struct DriverDescription DriverDescription;
|
||||
typedef DriverDescription * DriverDescriptionPtr;
|
||||
|
||||
|
||||
#ifndef __LP64__
|
||||
#pragma options align=reset
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MACTYPES__ */
|
||||
|
||||
#ifndef __QUICKDRAW__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef __LP64__
|
||||
#pragma options align=mac68k
|
||||
#endif
|
||||
|
||||
struct RGBColor {
|
||||
unsigned short red; /*magnitude of red component*/
|
||||
unsigned short green; /*magnitude of green component*/
|
||||
unsigned short blue; /*magnitude of blue component*/
|
||||
};
|
||||
typedef struct RGBColor RGBColor;
|
||||
typedef RGBColor *RGBColorPtr;
|
||||
typedef RGBColorPtr *RGBColorHdl;
|
||||
|
||||
struct ColorSpec {
|
||||
short value; /*index or other value*/
|
||||
RGBColor rgb; /*true color*/
|
||||
};
|
||||
|
||||
typedef struct ColorSpec ColorSpec;
|
||||
typedef ColorSpec *ColorSpecPtr;
|
||||
|
||||
struct GammaTbl {
|
||||
short gVersion; /*gamma version number*/
|
||||
short gType; /*gamma data type*/
|
||||
short gFormulaSize; /*Formula data size*/
|
||||
short gChanCnt; /*number of channels of data*/
|
||||
short gDataCnt; /*number of values/channel*/
|
||||
short gDataWidth; /*bits/corrected value (data packed to next larger byte size)*/
|
||||
short gFormulaData[1]; /*data for formulas followed by gamma values*/
|
||||
};
|
||||
typedef struct GammaTbl GammaTbl;
|
||||
typedef GammaTbl *GammaTblPtr;
|
||||
|
||||
struct RegEntryID
|
||||
{
|
||||
void * opaque[4];
|
||||
};
|
||||
typedef struct RegEntryID RegEntryID;
|
||||
typedef RegEntryID * RegEntryIDPtr;
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
struct IONDRVControlParameters {
|
||||
UInt8 __reservedA[0x1a];
|
||||
UInt16 code;
|
||||
void * params;
|
||||
UInt8 __reservedB[0x12];
|
||||
};
|
||||
|
||||
enum {
|
||||
kIONDRVOpenCommand = 128 + 0,
|
||||
kIONDRVCloseCommand = 128 + 1,
|
||||
kIONDRVReadCommand = 128 + 2,
|
||||
kIONDRVWriteCommand = 128 + 3,
|
||||
kIONDRVControlCommand = 128 + 4,
|
||||
kIONDRVStatusCommand = 128 + 5,
|
||||
kIONDRVKillIOCommand = 128 + 6,
|
||||
kIONDRVInitializeCommand = 128 + 7, /* init driver and device*/
|
||||
kIONDRVFinalizeCommand = 128 + 8, /* shutdown driver and device*/
|
||||
kIONDRVReplaceCommand = 128 + 9, /* replace an old driver*/
|
||||
kIONDRVSupersededCommand = 128 + 10 /* prepare to be replaced by a new driver*/
|
||||
};
|
||||
enum {
|
||||
kIONDRVSynchronousIOCommandKind = 0x00000001,
|
||||
kIONDRVAsynchronousIOCommandKind = 0x00000002,
|
||||
kIONDRVImmediateIOCommandKind = 0x00000004
|
||||
};
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#ifndef __LP64__
|
||||
#pragma options align=reset
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __QUICKDRAW__ */
|
||||
|
||||
#endif /* _IOKIT_IOMACOSTYPES_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOETHERNETCONTROLLER_H
|
||||
#define _IOETHERNETCONTROLLER_H
|
||||
|
||||
#include <IOKit/network/IONetworkController.h>
|
||||
|
||||
#define APPLE_KEXT_DEPRECATE __kpi_deprecated("DriverKit/NetworkingDriverKit is the new Networking Driver Development framework, please transition your Networking Driver to that Framework")
|
||||
|
||||
/*! @defined kIOEthernetControllerClass
|
||||
@abstract kIOEthernetControllerClass is the name of the
|
||||
IOEthernetController class. */
|
||||
|
||||
#define kIOEthernetControllerClass "IOEthernetController"
|
||||
|
||||
/*! @defined kIOEthernetAddressSize
|
||||
@abstract The number of bytes in an Ethernet hardware address. */
|
||||
|
||||
#define kIOEthernetAddressSize 6
|
||||
|
||||
/*! @defined kIOEthernetMaxPacketSize
|
||||
@abstract The maximum size of an Ethernet packet, including
|
||||
the FCS bytes. */
|
||||
|
||||
#define kIOEthernetMaxPacketSize 1518
|
||||
|
||||
/*! @defined kIOEthernetMinPacketSize
|
||||
@abstract The minimum size of an Ethernet packet, including
|
||||
the FCS bytes. */
|
||||
|
||||
#define kIOEthernetMinPacketSize 64
|
||||
|
||||
/*! @defined kIOEthernetCRCSize
|
||||
@abstract The size in bytes of the 32-bit CRC value appended
|
||||
to the end of each Ethernet frame. */
|
||||
|
||||
#define kIOEthernetCRCSize 4
|
||||
|
||||
/*! @defined kIOEthernetWakeOnLANFilterGroup
|
||||
@abstract kIOEthernetWakeOnLANFilterGroup describes the name assigned
|
||||
to the Ethernet Wake-On-LAN filter group. This group represents
|
||||
wake filters that are supported by the controller. */
|
||||
|
||||
#define kIOEthernetWakeOnLANFilterGroup "IOEthernetWakeOnLANFilterGroup"
|
||||
|
||||
/*! @defined kIOEthernetDisabledWakeOnLANFilterGroup
|
||||
@abstract kIOEthernetDisabledWakeOnLANFilterGroup describes the name
|
||||
assigned to the disabled Ethernet Wake-On-LAN filter group. This
|
||||
group represents wake filters that are currently disabled.
|
||||
Membership in this group is dynamic. */
|
||||
|
||||
#define kIOEthernetDisabledWakeOnLANFilterGroup \
|
||||
"IOEthernetDisabledWakeOnLANFilterGroup"
|
||||
|
||||
/*! @enum Wake On LAN Filters
|
||||
@abstract All filters in the Wake-on-LAN filter group.
|
||||
@discussion Each filter listed will respond to a network event that
|
||||
will trigger a system wake-up.
|
||||
@constant kIOEthernetWakeOnMagicPacket Reception of a Magic Packet.
|
||||
@constant kIOEthernetWakeOnPacketAddressMatch Reception of a packet
|
||||
which passes through any of the address filtering mechanisms based
|
||||
on its destination Ethernet address. This may include unicast,
|
||||
broadcast, or multicast addresses depending on the current state
|
||||
and setting of the corresponding packet filters. */
|
||||
|
||||
enum {
|
||||
kIOEthernetWakeOnMagicPacket = 0x00000001,
|
||||
kIOEthernetWakeOnPacketAddressMatch = 0x00000002
|
||||
};
|
||||
|
||||
#endif /* !_IOETHERNETCONTROLLER_H */
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IOETHERNETINTERFACE_H
|
||||
#define _IOETHERNETINTERFACE_H
|
||||
|
||||
/*! @defined kIOEthernetInterfaceClass
|
||||
@abstract The name of the
|
||||
IOEthernetInterface class.
|
||||
*/
|
||||
|
||||
#define kIOEthernetInterfaceClass "IOEthernetInterface"
|
||||
|
||||
/*! @defined kIOActivePacketFilters
|
||||
@abstract A property of IOEthernetInterface objects.
|
||||
@discussion The kIOActivePacketFilters property has an OSDictionary value that describes the current
|
||||
set of packet filters that have been successfully activated. Each
|
||||
entry in the dictionary is a key/value pair consisting of the filter
|
||||
group name, and an OSNumber describing the set of active filters for
|
||||
that group. Entries in this dictionary will mirror those in
|
||||
kIORequiredPacketFilters if the controller has reported success for
|
||||
all filter change requests from the IOEthernetInterface object.
|
||||
*/
|
||||
|
||||
#define kIOActivePacketFilters "IOActivePacketFilters"
|
||||
|
||||
/*! @defined kIORequiredPacketFilters
|
||||
@abstract A property of IOEthernetInterface objects.
|
||||
@discussion The kIORequiredPacketFilters property has an OSDictionary value that describes the current
|
||||
set of required packet filters. Each entry in the dictionary is a
|
||||
key/value pair consisting of the filter group name, and an OSNumber
|
||||
describing the set of required filters for that group.
|
||||
*/
|
||||
|
||||
#define kIORequiredPacketFilters "IORequiredPacketFilters"
|
||||
|
||||
/*! @defined kIOMulticastAddressList
|
||||
@abstract A property of IOEthernetInterface objects.
|
||||
@discussion The kIOMulticastAddressList property is an OSData object that describes the
|
||||
list of multicast addresses that are being used by the
|
||||
controller to match against the destination address of an
|
||||
incoming frame.
|
||||
*/
|
||||
|
||||
#define kIOMulticastAddressList "IOMulticastAddressList"
|
||||
#define kIOMulticastFilterData kIOMulticastAddressList
|
||||
|
||||
#endif /* !_IOETHERNETINTERFACE_H */
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008 Apple 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@
|
||||
*/
|
||||
/*
|
||||
* IOEthernetStats.h - Ethernet MIB statistics definitions.
|
||||
*
|
||||
* HISTORY
|
||||
*/
|
||||
|
||||
#ifndef _IOETHERNETSTATS_H
|
||||
#define _IOETHERNETSTATS_H
|
||||
|
||||
/*! @header IOEthernetStats.h
|
||||
@discussion Ethernet statistics. */
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Ethernet-like statistics group.
|
||||
|
||||
/*! @typedef IODot3StatsEntry
|
||||
@discussion Ethernet MIB statistics structure.
|
||||
@field alignmentErrors dot3StatsAlignmentErrors.
|
||||
@field fcsErrors dot3StatsFCSErrors.
|
||||
@field singleCollisionFrames dot3StatsSingleCollisionFrames.
|
||||
@field multipleCollisionFrames dot3StatsMultipleCollisionFrames.
|
||||
@field sqeTestErrors dot3StatsSQETestErrors.
|
||||
@field deferredTransmissions dot3StatsDeferredTransmissions.
|
||||
@field lateCollisions dot3StatsLateCollisions.
|
||||
@field excessiveCollisions dot3StatsExcessiveCollisions.
|
||||
@field internalMacTransmitErrors dot3StatsInternalMacTransmitErrors.
|
||||
@field carrierSenseErrors dot3StatsCarrierSenseErrors.
|
||||
@field frameTooLongs dot3StatsFrameTooLongs.
|
||||
@field internalMacReceiveErrors dot3StatsInternalMacReceiveErrors.
|
||||
@field etherChipSet dot3StatsEtherChipSet.
|
||||
@field missedFrames dot3StatsMissedFrames (not in RFC1650).
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
UInt32 alignmentErrors;
|
||||
UInt32 fcsErrors;
|
||||
UInt32 singleCollisionFrames;
|
||||
UInt32 multipleCollisionFrames;
|
||||
UInt32 sqeTestErrors;
|
||||
UInt32 deferredTransmissions;
|
||||
UInt32 lateCollisions;
|
||||
UInt32 excessiveCollisions;
|
||||
UInt32 internalMacTransmitErrors;
|
||||
UInt32 carrierSenseErrors;
|
||||
UInt32 frameTooLongs;
|
||||
UInt32 internalMacReceiveErrors;
|
||||
UInt32 etherChipSet;
|
||||
UInt32 missedFrames;
|
||||
} IODot3StatsEntry;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Ethernet-like collision statistics group (optional).
|
||||
|
||||
/*! @typedef IODot3CollEntry
|
||||
@discussion Collision statistics structure.
|
||||
@field collFrequencies dot3StatsCollFrequencies. */
|
||||
|
||||
typedef struct {
|
||||
UInt32 collFrequencies[16];
|
||||
} IODot3CollEntry;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Receiver extra statistics group (not defined by RFC 1650).
|
||||
|
||||
/*! @typedef IODot3RxExtraEntry
|
||||
@discussion Extra receiver statistics not defined by RFC1650.
|
||||
@field overruns receiver overruns.
|
||||
@field watchdogTimeouts watchdog timer expirations.
|
||||
@field frameTooShorts runt frames.
|
||||
@field collisionErrors frames damages by late collision.
|
||||
@field phyErrors PHY receive errors.
|
||||
@field timeouts receiver timeouts.
|
||||
@field interrupts receiver interrupts.
|
||||
@field resets receiver resets.
|
||||
@field resourceErrors receiver resource shortages.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
UInt32 overruns;
|
||||
UInt32 watchdogTimeouts;
|
||||
UInt32 frameTooShorts;
|
||||
UInt32 collisionErrors;
|
||||
UInt32 phyErrors;
|
||||
UInt32 timeouts;
|
||||
UInt32 interrupts;
|
||||
UInt32 resets;
|
||||
UInt32 resourceErrors;
|
||||
UInt32 reserved[4];
|
||||
} IODot3RxExtraEntry;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Transmitter extra statistics group (not defined by RFC 1650).
|
||||
|
||||
/*! @typedef IODot3TxExtraEntry
|
||||
@discussion Extra transmitter statistics not defined by RFC1650.
|
||||
@field underruns transmit underruns.
|
||||
@field jabbers jabber events.
|
||||
@field phyErrors PHY transmit errors.
|
||||
@field timeouts transmitter timeouts.
|
||||
@field interrupts transmitter interrupts.
|
||||
@field resets transmitter resets.
|
||||
@field resourceErrors transmitter resource shortages.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
UInt32 underruns;
|
||||
UInt32 jabbers;
|
||||
UInt32 phyErrors;
|
||||
UInt32 timeouts;
|
||||
UInt32 interrupts;
|
||||
UInt32 resets;
|
||||
UInt32 resourceErrors;
|
||||
UInt32 reserved[4];
|
||||
} IODot3TxExtraEntry;
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Aggregate Ethernet statistics.
|
||||
|
||||
/*! @typedef IOEthernetStats
|
||||
@discussion Aggregate Ethernet statistics structure.
|
||||
@field dot3StatsEntry IODot3StatsEntry statistics group.
|
||||
@field dot3CollEntry IODot3CollEntry statistics group.
|
||||
@field dot3RxExtraEntry IODot3RxExtraEntry statistics group.
|
||||
@field dot3TxExtraEntry IODot3TxExtraEntry statistics group.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
IODot3StatsEntry dot3StatsEntry;
|
||||
IODot3CollEntry dot3CollEntry;
|
||||
IODot3RxExtraEntry dot3RxExtraEntry;
|
||||
IODot3TxExtraEntry dot3TxExtraEntry;
|
||||
} IOEthernetStats;
|
||||
|
||||
/*! @defined kIOEthernetStatsKey
|
||||
@discussion Defines the name of an IONetworkData that contains
|
||||
an IOEthernetStats. */
|
||||
|
||||
#define kIOEthernetStatsKey "IOEthernetStatsKey"
|
||||
|
||||
#endif /* !_IOETHERNETSTATS_H */
|
||||
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IONETWORKCONTROLLER_H
|
||||
#define _IONETWORKCONTROLLER_H
|
||||
|
||||
/*! @defined kIONetworkControllerClass
|
||||
@abstract The name of the IONetworkController class. */
|
||||
|
||||
#define kIONetworkControllerClass "IONetworkController"
|
||||
|
||||
/*! @defined kIOVendor
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOVendor property is a property of IONetworkController objects. It has an OSString value that describes the vendor of the network controller. */
|
||||
|
||||
#define kIOVendor "IOVendor"
|
||||
|
||||
/*! @defined kIOModel
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOModel property is a property of IONetworkController objects. It has an OSString value that describes the model of the network controller. */
|
||||
|
||||
#define kIOModel "IOModel"
|
||||
|
||||
/*! @defined kIORevision
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIORevision property is a property of IONetworkController objects. It has an OSString value that describes the revision level of the network controller. */
|
||||
|
||||
#define kIORevision "IORevision"
|
||||
|
||||
/*! @defined kIOFeatures
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOFeatures property is a property of IONetworkController objects. It has an OSNumber value that describes generic features defined by IONetworkController that are supported by the
|
||||
network controller. */
|
||||
|
||||
#define kIOFeatures "IOFeatures"
|
||||
|
||||
/*! @defined kIOMediumDictionary
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOMediumDictionary property is a property of IONetworkController
|
||||
objects. It has an OSDictionary value that is a container for the
|
||||
collection of IONetworkMedium objects that represent the media
|
||||
types supported by the network controller.
|
||||
Each entry in the dictionary is a key/value pair consisting of
|
||||
the medium name, and a dictionary value that contains the
|
||||
properties for that medium entry. */
|
||||
|
||||
#define kIOMediumDictionary "IOMediumDictionary"
|
||||
|
||||
/*! @defined kIODefaultMedium
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIODefaultMedium property is a property of IONetworkController
|
||||
objects. It has an OSString value that describes the name of the
|
||||
default medium. This definition may change or disappear in the
|
||||
future. */
|
||||
|
||||
#define kIODefaultMedium "IODefaultMedium"
|
||||
|
||||
/*! @defined kIOSelectedMedium
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOSelectedMedium property is a property of IONetworkController
|
||||
objects. It has an OSSymbol value that describes the name of the
|
||||
current selected medium. This name can be used as a key into the
|
||||
medium dictionary to gather additional information about the
|
||||
selected medium. */
|
||||
|
||||
#define kIOSelectedMedium "IOSelectedMedium"
|
||||
|
||||
/*! @defined kIOActiveMedium
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOActiveMedium property is a property of IONetworkController
|
||||
objects. It has an OSSymbol value that describes the name of the
|
||||
active medium. This is the name of the medium where an active
|
||||
link has been established. This name can be used as a key into
|
||||
the medium dictionary to gather additional information about the
|
||||
active medium. */
|
||||
|
||||
#define kIOActiveMedium "IOActiveMedium"
|
||||
|
||||
/*! @defined kIOLinkSpeed
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOLinkSpeed property is a property of IONetworkController
|
||||
objects. It has an OSNumber value that describes the speed of the
|
||||
link established over the active medium in bits per second. */
|
||||
|
||||
#define kIOLinkSpeed "IOLinkSpeed"
|
||||
|
||||
/*! @defined kIOLinkStatus
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOLinkStatus property is a property of IONetworkController
|
||||
objects. It has an OSNumber value that describes the current network
|
||||
link status. See IONetworkMedium for the definition of the link
|
||||
status bits. */
|
||||
|
||||
#define kIOLinkStatus "IOLinkStatus"
|
||||
|
||||
/*! @defined kIOLinkData
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOLinkData property is a property of IONetworkController
|
||||
objects. It has an OSData value that contains additional information
|
||||
describing the active link that was established.
|
||||
Its interpretation is not defined. */
|
||||
|
||||
#define kIOLinkData "IOLinkData"
|
||||
|
||||
/*! @defined kIOPacketFilters
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOPacketFilters property is a property of IONetworkController
|
||||
objects. It has an OSDictionary value that describes the entire
|
||||
set of packet filters supported by the controller. Each entry
|
||||
in the dictionary is a key/value pair consisting of the filter
|
||||
group name, and an OSNumber describing the set of supported
|
||||
filters for that group. */
|
||||
|
||||
#define kIOPacketFilters "IOPacketFilters"
|
||||
|
||||
/*! @defined kIOMACAddress
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOMACAddress property is a property of IONetworkController
|
||||
objects. It has an OSData value that describes the hardware
|
||||
MAC (media access controller) address, or station address,
|
||||
of the network controller. */
|
||||
|
||||
#define kIOMACAddress "IOMACAddress"
|
||||
|
||||
/*! @defined kIOMaxPacketSize
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOMaxPacketSize property is a property of IONetworkController
|
||||
objects. It has an OSNumber value that describes the maximum
|
||||
packet size supported by the controller. */
|
||||
|
||||
#define kIOMaxPacketSize "IOMaxPacketSize"
|
||||
|
||||
/*! @defined kIOMinPacketSize
|
||||
@abstract A property of IONetworkController objects.
|
||||
@discussion The kIOMinPacketSize property is a property of IONetworkController
|
||||
objects. It has an OSNumber value that describes the minimum
|
||||
packet size supported by the controller. */
|
||||
|
||||
#define kIOMinPacketSize "IOMinPacketSize"
|
||||
|
||||
/*! @defined kIONetworkFilterGroup
|
||||
@abstract The name assigned to the standard network filter group. */
|
||||
|
||||
#define kIONetworkFilterGroup "IONetworkFilterGroup"
|
||||
|
||||
/*! @enum StandardPacketFilters
|
||||
@abstract All standard packet filters.
|
||||
@discussion Each filter will allow the reception of certain class of packets
|
||||
depending on its destination MAC address.
|
||||
@constant kIOPacketFilterUnicast Reception of unicast packets.
|
||||
@constant kIOPacketFilterBroadcast Reception of broadcast packets.
|
||||
@constant kIOPacketFilterMulticast Reception of multicast packets
|
||||
addressed to a set of multicast addresses.
|
||||
@constant kIOPacketFilterMulticastAll Reception of all multicast
|
||||
packets.
|
||||
@constant kIOPacketFilterPromiscuous Reception of all packets.
|
||||
@constant kIOPacketFilterPromiscuousAll Reception of all packets,
|
||||
including bad packets. */
|
||||
|
||||
enum {
|
||||
kIOPacketFilterUnicast = 0x1,
|
||||
kIOPacketFilterBroadcast = 0x2,
|
||||
kIOPacketFilterMulticast = 0x10,
|
||||
kIOPacketFilterMulticastAll = 0x20,
|
||||
kIOPacketFilterPromiscuous = 0x100,
|
||||
kIOPacketFilterPromiscuousAll = 0x200
|
||||
};
|
||||
|
||||
/*! @enum Network Feature Flags
|
||||
@abstract Feature flags returned by the getFeatures() method.
|
||||
@constant kIONetworkFeatureNoBSDWait Set this bit in the value
|
||||
returned by getFeatures() to disable the automatic wait for
|
||||
"IOBSD" resource by the IONetworkController::start() method.
|
||||
@constant kIONetworkFeatureHardwareVlan Set this bit in the value
|
||||
returned by getFeatures() to indicate the controller supports hardware
|
||||
stripping and stuffing of 802.1q vlan tags. If the controller supports
|
||||
this feature it must enable it when initializing so that all received
|
||||
packets delivered to higher layers have the tag stripped. The controller
|
||||
should use setVlanTag() to provide the tag information out of band.
|
||||
@constant kIONetworkFeatureSoftwareVlan Set this bit in the value
|
||||
returned by getFeatures() to indicate that the controller can support software
|
||||
based vlan by transmitting and receiving packets 4 bytes longer that normal.
|
||||
@constant kIONetworkFeatureMultiPages Set this bit if the driver is
|
||||
capable of handling packets coming down from the network stack that
|
||||
reside in virtually, but not in physically contiguous span of the
|
||||
external mbuf clusters. In this case, the data area of a packet in
|
||||
the external mbuf cluster might cross one or more physical pages that
|
||||
are disjoint, depending on the interface MTU and the packet size.
|
||||
Such a use of larger than system page size clusters by the network
|
||||
stack is done for better system efficiency. Drivers that utilize the
|
||||
IOMbufNaturalMemoryCursor with the getPhysicalSegmentsWithCoalesce
|
||||
interfaces and enumerate the list of vectors should set this flag
|
||||
for possible gain in performance during bulk data transfer.
|
||||
@constant kIONetworkFeatureTSOIPv4 Set this bit to advertise support
|
||||
for TCP/IPv4 segmentation offload.
|
||||
@constant kIONetworkFeatureTSOIPv6 Set this bit to advertise support
|
||||
for TCP/IPv6 segmentation offload.
|
||||
@constant kIONetworkFeatureTransmitCompletionStatus Set this bit to
|
||||
advertise the capability to report per-packet transmit completion status.
|
||||
See <code>IONetworkInterface::reportTransmitCompletionStatus</code>.
|
||||
@constant kIONetworkFeatureHWTimeStamp Set this bit to advertise
|
||||
the capability to compute per-packet timestamp in hardware.
|
||||
@constant kIONetworkFeatureHWTimeStamp Set this bit to advertise
|
||||
the capability to compute per-packet timestamp in software.
|
||||
*/
|
||||
|
||||
enum {
|
||||
kIONetworkFeatureNoBSDWait = 0x001,
|
||||
kIONetworkFeatureHardwareVlan = 0x002,
|
||||
kIONetworkFeatureSoftwareVlan = 0x004,
|
||||
kIONetworkFeatureMultiPages = 0x008,
|
||||
kIONetworkFeatureTSOIPv4 = 0x010,
|
||||
kIONetworkFeatureTSOIPv6 = 0x020,
|
||||
kIONetworkFeatureTransmitCompletionStatus = 0x040,
|
||||
kIONetworkFeatureHWTimeStamp = 0x080,
|
||||
kIONetworkFeatureSWTimeStamp = 0x100
|
||||
};
|
||||
|
||||
#endif /* !_IONETWORKCONTROLLER_H */
|
||||
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IONETWORKDATA_H
|
||||
#define _IONETWORKDATA_H
|
||||
|
||||
#define IONetworkParameter IONetworkData // FIXME
|
||||
|
||||
/*! @enum NetworkDataAccessTypes
|
||||
@abstract Constants that describe access types.
|
||||
@constant kIONetworkDataAccessTypeRead Read access.
|
||||
@constant kIONetworkDataAccessTypeWrite Write access (deprecated).
|
||||
@constant kIONetworkDataAccessTypeReset Reset access (deprecated).
|
||||
@constant kIONetworkDataAccessTypeSerialize Serialization access.
|
||||
*/
|
||||
|
||||
enum {
|
||||
kIONetworkDataAccessTypeRead = 0x01,
|
||||
kIONetworkDataAccessTypeWrite = 0x02,
|
||||
kIONetworkDataAccessTypeReset = 0x04,
|
||||
kIONetworkDataAccessTypeSerialize = 0x08,
|
||||
kIONetworkDataAccessTypeMask = 0xff
|
||||
};
|
||||
|
||||
/*! @define kIONetworkDataBasicAccessTypes
|
||||
@discussion The default access types supported by an IONetworkData
|
||||
object. Allow read() and serialize(). */
|
||||
|
||||
#define kIONetworkDataBasicAccessTypes \
|
||||
(kIONetworkDataAccessTypeRead | kIONetworkDataAccessTypeSerialize)
|
||||
|
||||
/*! @enum NetworkDataBufferTypes
|
||||
@abstract The types of data buffers that can be managed by an IONetworkData object.
|
||||
@constant kIONetworkDataBufferTypeInternal An internal data buffer
|
||||
allocated by the init() method.
|
||||
@constant kIONetworkDataBufferTypeExternal An external (persistent) data
|
||||
buffer.
|
||||
@constant kIONetworkDataBufferTypeNone No data buffer. The only useful
|
||||
action perfomed by an IONetworkData object with this buffer type
|
||||
is to call the access notification handler.
|
||||
*/
|
||||
|
||||
enum {
|
||||
kIONetworkDataBufferTypeInternal = 0,
|
||||
kIONetworkDataBufferTypeExternal,
|
||||
kIONetworkDataBufferTypeNone
|
||||
};
|
||||
|
||||
/*! @defined kIONetworkDataBytes
|
||||
@abstract A property of IONetworkData objects.
|
||||
@discussion The kIONetworkDataBytes property is an OSData that describes
|
||||
the data buffer of an IONetworkData object. This property is present
|
||||
only if kIONetworkDataAccessTypeSerialize access is supported.
|
||||
*/
|
||||
|
||||
#define kIONetworkDataBytes "Data"
|
||||
|
||||
/*! @defined kIONetworkDataAccessTypes
|
||||
@abstract A property of IONetworkData objects.
|
||||
@discussion The kIONetworkDataAccessTypes property is an OSNumber that
|
||||
describes the supported access types of an IONetworkData object.
|
||||
*/
|
||||
|
||||
#define kIONetworkDataAccessTypes "Access Types"
|
||||
|
||||
/*! @defined kIONetworkDataSize
|
||||
@abstract A property of IONetworkData objects.
|
||||
@discussion The kIONetworkDataSize property is an OSNumber that
|
||||
describes the size of the data buffer of an IONetworkData object.
|
||||
*/
|
||||
|
||||
#define kIONetworkDataSize "Size"
|
||||
|
||||
|
||||
#endif /* !_IONETWORKDATA_H */
|
||||
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IONETWORKINTERFACE_H
|
||||
#define _IONETWORKINTERFACE_H
|
||||
|
||||
/*! @defined kIONetworkInterfaceClass
|
||||
@abstract The name of the IONetworkInterface class.
|
||||
*/
|
||||
|
||||
#define kIONetworkInterfaceClass "IONetworkInterface"
|
||||
|
||||
/*! @defined kIONetworkData
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIONetworkData property has an OSDictionary value and is a
|
||||
container for the set of IONetworkData objects managed by the interface.
|
||||
Each entry in the dictionary is a key/value pair consisting of
|
||||
the network data name, and an OSDictionary describing the
|
||||
contents of the network data.
|
||||
*/
|
||||
|
||||
#define kIONetworkData "IONetworkData"
|
||||
|
||||
/*! @defined kIOInterfaceType
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOInterfaceType property has an OSNumber value that
|
||||
specifies the type of network interface that this interface represents.
|
||||
The type constants are defined in bsd/net/if_types.h.
|
||||
*/
|
||||
|
||||
#define kIOInterfaceType "IOInterfaceType"
|
||||
|
||||
/*! @defined kIOMaxTransferUnit
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOMaxTransferUnit property has an OSNumber value that
|
||||
specifies the maximum transfer unit for the interface in bytes.
|
||||
*/
|
||||
|
||||
#define kIOMaxTransferUnit "IOMaxTransferUnit"
|
||||
|
||||
/*! @defined kIOMediaAddressLength
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOMediaAddressLength property has an OSNumber value that
|
||||
specifies the size of the media address in bytes.
|
||||
*/
|
||||
|
||||
#define kIOMediaAddressLength "IOMediaAddressLength"
|
||||
|
||||
/*! @defined kIOMediaHeaderLength
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOMediaHeaderLength property has an OSNumber value that
|
||||
specifies the size of the media header in bytes.
|
||||
*/
|
||||
|
||||
#define kIOMediaHeaderLength "IOMediaHeaderLength"
|
||||
|
||||
/*! @defined kIOInterfaceFlags
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOInterfaceFlags property has an OSNumber value that
|
||||
specifies the current value of the interface flags. The flag constants
|
||||
are defined in bsd/net/if.h.
|
||||
*/
|
||||
|
||||
#define kIOInterfaceFlags "IOInterfaceFlags"
|
||||
|
||||
/*! @defined kIOInterfaceExtraFlags
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOInterfaceExtraFlags property has an OSNumber value that
|
||||
specifies the current value of the interface eflags. The eflag constants
|
||||
are defined in bsd/net/if.h.
|
||||
*/
|
||||
|
||||
#define kIOInterfaceExtraFlags "IOInterfaceExtraFlags"
|
||||
|
||||
/*! @defined kIOInterfaceUnit
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOInterfaceUnit property has an OSNumber value that
|
||||
describes the unit number assigned to the interface object.
|
||||
*/
|
||||
|
||||
#define kIOInterfaceUnit "IOInterfaceUnit"
|
||||
|
||||
/*! @defined kIOInterfaceState
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOInterfaceState property has an OSNumber value that
|
||||
describes the current state of the interface object. This property is
|
||||
not exported to BSD via the ifnet structure.
|
||||
*/
|
||||
|
||||
#define kIOInterfaceState "IOInterfaceState"
|
||||
|
||||
/*! @defined kIOInterfaceNamePrefix
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOInterfaceNamePrefix property has an OSString value that
|
||||
describes the string prefix for the BSD name assigned to the interface.
|
||||
*/
|
||||
|
||||
#define kIOInterfaceNamePrefix "IOInterfaceNamePrefix"
|
||||
|
||||
/*! @defined kIOPrimaryInterface
|
||||
@abstract A property of IONetworkInterface objects.
|
||||
@discussion The kIOInterfaceNamePrefix property has an OSBoolean value that
|
||||
describes whether the interface is the primary or the built-in network
|
||||
interface.
|
||||
*/
|
||||
|
||||
#define kIOPrimaryInterface "IOPrimaryInterface"
|
||||
|
||||
/*! @defined kIOBuiltin
|
||||
@abstract kIOBuiltin is a property of IONetworkInterface
|
||||
objects. It has an OSBoolean value.
|
||||
@discussion The kIOBuiltin property describes whether the
|
||||
interface is built-in.
|
||||
*/
|
||||
|
||||
#define kIOBuiltin "IOBuiltin"
|
||||
|
||||
/*! @defined kIOLocation
|
||||
@abstract kIOLocation is a property of IONetworkInterface
|
||||
objects. It has an OSString value.
|
||||
@discussion The kIOLocation property describes the physical
|
||||
location of built-in interfaces.
|
||||
*/
|
||||
|
||||
#define kIOLocation "IOLocation"
|
||||
|
||||
/*! @defined kIONetworkNoBSDAttachKey
|
||||
@abstract kIONetworkNoBSDAttachKey is a property of IONetworkInterface
|
||||
objects. It has an OSBoolean value.
|
||||
@discussion Adding a property with this key and the value kOSBooleanTrue
|
||||
before the interface is published will hold off the BSD attach.
|
||||
When the interface is ready to attach to BSD, remove the property
|
||||
and then re-publish the interface by calling registerService().
|
||||
*/
|
||||
|
||||
#define kIONetworkNoBSDAttachKey "IONetworkNoBSDAttach"
|
||||
|
||||
/*! @enum InterfaceObjectStates
|
||||
@discussion Constants used to encode the state of the interface object.
|
||||
@constant kIONetworkInterfaceRegisteredState The interface object has
|
||||
registered with the data link layer.
|
||||
@constant kIONetworkInterfaceOpenedState One or more clients have an
|
||||
open on the interface object.
|
||||
@constant kIONetworkInterfaceDisabledState The interface is temporarily
|
||||
unable to service its clients. This will occur when the network
|
||||
controller that is servicing the interface has entered a low power
|
||||
state that renders it unusable.
|
||||
*/
|
||||
|
||||
enum {
|
||||
kIONetworkInterfaceRegisteredState = 0x1,
|
||||
kIONetworkInterfaceOpenedState = 0x2,
|
||||
kIONetworkInterfaceDisabledState = 0x4
|
||||
};
|
||||
|
||||
#endif /* !_IONETWORKINTERFACE_H */
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* HISTORY
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IONETWORKLIB_H
|
||||
#define _IONETWORKLIB_H
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
#include <IOKit/network/IONetworkData.h>
|
||||
#include <IOKit/network/IONetworkMedium.h>
|
||||
#include <IOKit/network/IONetworkStats.h>
|
||||
#include <IOKit/network/IOEthernetStats.h>
|
||||
#include <IOKit/network/IONetworkUserClient.h>
|
||||
|
||||
typedef UInt32 IONDHandle;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*! @function IONetworkOpen
|
||||
@abstract Open a connection to an IONetworkInterface object.
|
||||
An IONetworkUserClient object is created to manage the connection. */
|
||||
|
||||
IOReturn IONetworkOpen(io_object_t obj, io_connect_t * con);
|
||||
|
||||
/*! @function IONetworkClose
|
||||
@abstract Close the connection to an IONetworkInterface object. */
|
||||
|
||||
IOReturn IONetworkClose(io_connect_t con);
|
||||
|
||||
/*! @function IONetworkWriteData
|
||||
@abstract Write to the buffer of a network data object.
|
||||
@param conObj The connection object.
|
||||
@param dataHandle The handle of a network data object.
|
||||
@param srcBuf The data to write is taken from this buffer.
|
||||
@param inSize The size of the source buffer.
|
||||
@result kIOReturnSuccess on success, or an error code otherwise. */
|
||||
|
||||
IOReturn IONetworkWriteData(io_connect_t conObj,
|
||||
IONDHandle dataHandle,
|
||||
UInt8 * srcBuf,
|
||||
UInt32 inSize);
|
||||
|
||||
/*! @function IONetworkReadData
|
||||
@abstract Read the buffer of a network data object.
|
||||
@param conObj The connection object.
|
||||
@param dataHandle The handle of a network data object.
|
||||
@param destBuf The buffer where the data read shall be written to.
|
||||
@param inOutSizeP Pointer to an integer that the caller must initialize
|
||||
to contain the size of the buffer. This function will overwrite
|
||||
it with the actual number of bytes written to the buffer.
|
||||
@result kIOReturnSuccess on success, or an error code otherwise. */
|
||||
|
||||
IOReturn IONetworkReadData(io_connect_t conObj,
|
||||
IONDHandle dataHandle,
|
||||
UInt8 * destBuf,
|
||||
UInt32 * inOutSizeP);
|
||||
|
||||
/*! @function IONetworkResetData
|
||||
@abstract Fill the buffer of a network data object with zeroes.
|
||||
@param conObject The connection object.
|
||||
@param dataHandle The handle of a network data object.
|
||||
@result kIOReturnSuccess on success, or an error code otherwise. */
|
||||
|
||||
IOReturn IONetworkResetData(io_connect_t conObject, IONDHandle dataHandle);
|
||||
|
||||
/*! @function IONetworkGetDataCapacity
|
||||
@abstract Get the capacity (in bytes) of a network data object.
|
||||
@param conObject The connection object.
|
||||
@param dataHandle The handle of a network data object.
|
||||
@param capacityP Upon success, the capacity is written to this address.
|
||||
@result kIOReturnSuccess on success, or an error code otherwise. */
|
||||
|
||||
IOReturn IONetworkGetDataCapacity(io_connect_t conObject,
|
||||
IONDHandle dataHandle,
|
||||
UInt32 * capacityP);
|
||||
|
||||
/*! @function IONetworkGetDataHandle
|
||||
@abstract Get the handle of a network data object with the given name.
|
||||
@param conObject The connection object.
|
||||
@param dataName The name of the network data object.
|
||||
@param dataHandleP Upon success, the handle is written to this address.
|
||||
@result kIOReturnSuccess on success, or an error code otherwise. */
|
||||
|
||||
IOReturn IONetworkGetDataHandle(io_connect_t conObject,
|
||||
const char * dataName,
|
||||
IONDHandle * dataHandleP);
|
||||
|
||||
/*! @function IONetworkSetPacketFiltersMask
|
||||
@abstract Set the packet filters for a given filter group.
|
||||
@discussion A network controller may support a number of packets filters
|
||||
that can accept or reject a type of packet seen on the network. A filter
|
||||
group identifies a set of related filters, such as all filters that will
|
||||
allow a packet to pass upstream based on the destination address encoded
|
||||
within the packet. This function allows an user-space program to set the
|
||||
filtering performed by a given filter group.
|
||||
@param connect The connection object returned from IONetworkOpen().
|
||||
@param filterGroup The name of the packet filter group.
|
||||
@param filtersMask A mask of filters to set.
|
||||
@param options No options are currently defined.
|
||||
@result An IOReturn error code. */
|
||||
|
||||
IOReturn IONetworkSetPacketFiltersMask( io_connect_t connect,
|
||||
const io_name_t filterGroup,
|
||||
UInt32 filtersMask,
|
||||
IOOptionBits options );
|
||||
|
||||
/*! @enum IONetworkPacketFilterOptions
|
||||
@constant kIONetworkSupportedPacketFilters Indicate the filters that are
|
||||
supported by the hardware. */
|
||||
|
||||
enum {
|
||||
kIONetworkSupportedPacketFilters = 0x0001
|
||||
};
|
||||
|
||||
/*! @function IONetworkGetPacketFiltersMask
|
||||
@abstract Get the packet filters for a given filter group.
|
||||
@discussion A network controller may support a number of packets filters
|
||||
that can accept or reject a type of packet seen on the network. A filter
|
||||
group identifies a set of related filters, such as all filters that will
|
||||
allow a packet to pass upstream based on the destination address encoded
|
||||
within the packet. This function allows an user-space program to get the
|
||||
filtering performed by a given filter group.
|
||||
@param connect The connection object returned from IONetworkOpen().
|
||||
@param filterGroup The name of the packet filter group.
|
||||
@param filtersMask Pointer to the return value containing a mask of
|
||||
packet filters.
|
||||
@param options kIONetworkSupportedPacketFilters may be set to fetch the
|
||||
filters that are supported by the hardware.
|
||||
@result An IOReturn error code. */
|
||||
|
||||
IOReturn IONetworkGetPacketFiltersMask( io_connect_t connect,
|
||||
const io_name_t filterGroup,
|
||||
UInt32 * filtersMask,
|
||||
IOOptionBits options );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_IONETWORKLIB_H */
|
||||
@@ -0,0 +1,185 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008, 2021 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IONETWORKMEDIUM_H
|
||||
#define _IONETWORKMEDIUM_H
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#include <net/if_media.h>
|
||||
|
||||
/*! @typedef IOMediumType
|
||||
@discussion A 32-bit value divided into fields which describes
|
||||
a single medium type. */
|
||||
|
||||
typedef UInt32 IOMediumType;
|
||||
|
||||
/*! @defined kIOMediumType
|
||||
@abstract A property of IONetworkMedium objects.
|
||||
@discussion The kIOMediumType property is an OSNumber object that describes the type of
|
||||
medium that this object represents.
|
||||
*/
|
||||
|
||||
#define kIOMediumType "Type"
|
||||
|
||||
/*! @defined kIOMediumFlags
|
||||
@abstract A property of IONetworkMedium objects.
|
||||
@discussion The kIOMediumFlags property is an OSNumber object that describes a set of
|
||||
attributes assigned to the medium.
|
||||
*/
|
||||
|
||||
#define kIOMediumFlags "Flags"
|
||||
|
||||
/*! @defined kIOMediumSpeed
|
||||
@abstract A property of IONetworkMedium objects.
|
||||
@discussion The kIOMediumSpeed property is an OSNumber object that describes the maximum link
|
||||
speed supported by the medium in bits per second.
|
||||
*/
|
||||
|
||||
#define kIOMediumSpeed "Speed"
|
||||
|
||||
/*! @defined kIOMediumIndex
|
||||
@abstract A property of IONetworkMedium objects.
|
||||
@discussion The kIOMediumIndex property is an OSNumber object that describes an index assigned
|
||||
by the owner of the medium object. Its interpretation is driver
|
||||
specific.
|
||||
*/
|
||||
|
||||
#define kIOMediumIndex "Index"
|
||||
|
||||
//===========================================================================
|
||||
// Medium Type (IOMediumType).
|
||||
//
|
||||
// The medium type is encoded by a 32-bit value. The definitions of
|
||||
// the fields and the encoding for each field is adapted from FreeBSD.
|
||||
//
|
||||
// Bits Definition
|
||||
// -------------------
|
||||
// 4-0 medium subtype
|
||||
// 7-5 network type
|
||||
// 15-8 network specific options
|
||||
// 19-16 reserved
|
||||
// 27-20 common options
|
||||
// 31-28 instance number
|
||||
|
||||
// Ethernet.
|
||||
//
|
||||
// Important Note:
|
||||
//
|
||||
// The kIOMediumEthernet* definitions are aliases for the IFM_* definitions
|
||||
// in <net/if_media.h>. The kIOMediumEthernet* list defined here is no longer
|
||||
// complete and will not be extended beyond its current set of definitions.
|
||||
// Use the IFM_* definitions from <net/if_media.h> directly to make use
|
||||
// of media types not defined here. For example to specify an IOMediumType
|
||||
// corresponding to 25G_T, use (IFM_25G_T | IFM_ETHER).
|
||||
//
|
||||
enum {
|
||||
kIOMediumEthernet = IFM_ETHER,
|
||||
kIOMediumEthernetAuto = ( IFM_AUTO | IFM_ETHER ),
|
||||
kIOMediumEthernetManual = ( IFM_MANUAL | IFM_ETHER ),
|
||||
kIOMediumEthernetNone = ( IFM_NONE | IFM_ETHER ),
|
||||
kIOMediumEthernet10BaseT = ( IFM_10_T | IFM_ETHER ),
|
||||
kIOMediumEthernet10Base2 = ( IFM_10_2 | IFM_ETHER ),
|
||||
kIOMediumEthernet10Base5 = ( IFM_10_5 | IFM_ETHER ),
|
||||
kIOMediumEthernet100BaseTX = ( IFM_100_TX | IFM_ETHER ),
|
||||
kIOMediumEthernet100BaseFX = ( IFM_100_FX | IFM_ETHER ),
|
||||
kIOMediumEthernet100BaseT4 = ( IFM_100_T4 | IFM_ETHER ),
|
||||
kIOMediumEthernet100BaseVG = ( IFM_100_VG | IFM_ETHER ),
|
||||
kIOMediumEthernet100BaseT2 = ( IFM_100_T2 | IFM_ETHER ),
|
||||
kIOMediumEthernet1000BaseSX = ( IFM_1000_SX | IFM_ETHER ),
|
||||
kIOMediumEthernet10BaseSTP = ( IFM_10_STP | IFM_ETHER ),
|
||||
kIOMediumEthernet10BaseFL = ( IFM_10_FL | IFM_ETHER ),
|
||||
kIOMediumEthernet1000BaseLX = ( IFM_1000_LX | IFM_ETHER ),
|
||||
kIOMediumEthernet1000BaseCX = ( IFM_1000_CX | IFM_ETHER ),
|
||||
kIOMediumEthernet1000BaseTX = ( IFM_1000_T | IFM_ETHER ), //deprecated- use kIOMediumEthernet1000BaseT instead
|
||||
kIOMediumEthernet1000BaseT = ( IFM_1000_T | IFM_ETHER ),
|
||||
kIOMediumEthernetHomePNA1 = ( IFM_HPNA_1 | IFM_ETHER ),
|
||||
kIOMediumEthernet10GBaseSR = ( IFM_10G_SR | IFM_ETHER ),
|
||||
kIOMediumEthernet10GBaseLR = ( IFM_10G_LR | IFM_ETHER ),
|
||||
kIOMediumEthernet10GBaseCX4 = ( IFM_10G_CX4 | IFM_ETHER ),
|
||||
kIOMediumEthernet10GBaseT = ( IFM_10G_T | IFM_ETHER ),
|
||||
kIOMediumEthernet2500BaseT = ( IFM_2500_T | IFM_ETHER ),
|
||||
kIOMediumEthernet5000BaseT = ( IFM_5000_T | IFM_ETHER )
|
||||
};
|
||||
|
||||
// IEEE 802.11 Wireless.
|
||||
//
|
||||
enum {
|
||||
kIOMediumIEEE80211 = IFM_IEEE80211,
|
||||
kIOMediumIEEE80211Auto = ( IFM_AUTO | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211Manual = ( IFM_MANUAL | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211None = ( IFM_NONE | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211FH1 = ( IFM_IEEE80211_FH1 | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211FH2 = ( IFM_IEEE80211_FH2 | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211DS2 = ( IFM_IEEE80211_DS2 | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211DS5 = ( IFM_IEEE80211_DS5 | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211DS11 = ( IFM_IEEE80211_DS11 | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211DS1 = ( IFM_IEEE80211_DS1 | IFM_IEEE80211 ),
|
||||
kIOMediumIEEE80211OptionAdhoc = IFM_IEEE80211_ADHOC
|
||||
};
|
||||
|
||||
// Common options.
|
||||
//
|
||||
enum {
|
||||
kIOMediumOptionFullDuplex = IFM_FDX,
|
||||
kIOMediumOptionHalfDuplex = IFM_HDX,
|
||||
kIOMediumOptionFlowControl = IFM_FLOW,
|
||||
kIOMediumOptionEEE = IFM_EEE,
|
||||
kIOMediumOptionFlag0 = IFM_FLAG0,
|
||||
kIOMediumOptionFlag1 = IFM_FLAG1,
|
||||
kIOMediumOptionFlag2 = IFM_FLAG2,
|
||||
kIOMediumOptionLoopback = IFM_LOOP
|
||||
};
|
||||
|
||||
// Medium type masks.
|
||||
//
|
||||
#define kIOMediumSubTypeMask IFM_TMASK
|
||||
#define kIOMediumNetworkTypeMask IFM_NMASK
|
||||
#define kIOMediumOptionsMask IFM_OMASK
|
||||
#define kIOMediumCommonOptionsMask IFM_GMASK
|
||||
#define kIOMediumInstanceShift IFM_ISHIFT
|
||||
#define kIOMediumInstanceMask IFM_IMASK
|
||||
|
||||
// Medium type field accessors.
|
||||
//
|
||||
#define IOMediumGetSubType(x) ((x) & kIOMediumSubTypeMask)
|
||||
#define IOMediumGetNetworkType(x) ((x) & kIOMediumNetworkTypeMask)
|
||||
#define IOMediumGetInstance(x) (((x) & kIOMediumInstanceMask) >> \
|
||||
kIOMediumInstanceShift)
|
||||
|
||||
//===========================================================================
|
||||
// Medium flags.
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// Link status bits.
|
||||
//
|
||||
enum {
|
||||
kIONetworkLinkValid = IFM_AVALID, // link status is valid
|
||||
kIONetworkLinkActive = IFM_ACTIVE, // link is up/active.
|
||||
kIONetworkLinkNoNetworkChange = IFM_WAKESAMENET
|
||||
};
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
#endif /* !_IONETWORKMEDIUM_H */
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2011 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IONETWORKSTACK_H
|
||||
#define _IONETWORKSTACK_H
|
||||
|
||||
// User-client keys
|
||||
//
|
||||
#define kIONetworkStackUserCommandKey "IONetworkStackUserCommand"
|
||||
#define kIONetworkStackUserCommand "IONetworkStackUserCommand"
|
||||
|
||||
enum {
|
||||
kIONetworkStackRegisterInterfaceWithUnit = 0,
|
||||
kIONetworkStackRegisterInterfaceWithLowestUnit = 1,
|
||||
kIONetworkStackRegisterInterfaceAll = 2
|
||||
};
|
||||
|
||||
#endif /* !_IONETWORKSTACK_H */
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IONETWORKSTATS_H
|
||||
#define _IONETWORKSTATS_H
|
||||
|
||||
#include <libkern/OSTypes.h>
|
||||
|
||||
/*! @header IONetworkStats.h
|
||||
@discussion Generic network statistics. */
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Generic network statistics. Common to all network interfaces.
|
||||
//
|
||||
// WARNING: This structure must match the statistics field in
|
||||
// ifnet->if_data. This structure will overlay a portion of ifnet.
|
||||
|
||||
/*! @typedef IONetworkStats
|
||||
@discussion Generic network statistics structure.
|
||||
@field inputPackets count input packets.
|
||||
@field inputErrors count input errors.
|
||||
@field outputPackets count output packets.
|
||||
@field outputErrors count output errors.
|
||||
@field collisions count collisions on CDMA networks. */
|
||||
|
||||
typedef struct {
|
||||
UInt32 inputPackets;
|
||||
UInt32 inputErrors;
|
||||
UInt32 outputPackets;
|
||||
UInt32 outputErrors;
|
||||
UInt32 collisions;
|
||||
} IONetworkStats;
|
||||
|
||||
/*! @defined kIONetworkStatsKey
|
||||
@discussion Defines the name of an IONetworkData that contains
|
||||
an IONetworkStats. */
|
||||
|
||||
#define kIONetworkStatsKey "IONetworkStatsKey"
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// Output queue statistics.
|
||||
|
||||
/*! @typedef IOOutputQueueStats
|
||||
@discussion Statistics recorded by IOOutputQueue objects.
|
||||
@field capacity queue capacity.
|
||||
@field size current size of the queue.
|
||||
@field peakSize peak size of the queue.
|
||||
@field dropCount number of packets dropped.
|
||||
@field outputCount number of output packets.
|
||||
@field retryCount number of retries.
|
||||
@field stallCount number of queue stalls. */
|
||||
|
||||
typedef struct {
|
||||
UInt32 capacity;
|
||||
UInt32 size;
|
||||
UInt32 peakSize;
|
||||
UInt32 dropCount;
|
||||
UInt32 outputCount;
|
||||
UInt32 retryCount;
|
||||
UInt32 stallCount;
|
||||
UInt32 reserved[4];
|
||||
} IOOutputQueueStats;
|
||||
|
||||
/*! @defined kIOOutputQueueStatsKey
|
||||
@discussion Defines the name of an IONetworkData that contains
|
||||
an IOOutputQueueStats. */
|
||||
|
||||
#define kIOOutputQueueStatsKey "IOOutputQueueStatsKey"
|
||||
|
||||
#endif /* !_IONETWORKSTATS_H */
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2008 Apple 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@
|
||||
*/
|
||||
|
||||
#ifndef _IONETWORKUSERCLIENT_H
|
||||
#define _IONETWORKUSERCLIENT_H
|
||||
|
||||
// IONetworkUserClient type ID.
|
||||
//
|
||||
#define kIONetworkUserClientTypeID 0xff000001
|
||||
#define kIONUCType 0xff000001 // FIXME
|
||||
|
||||
// IONetworkUserClient call structure definitions.
|
||||
//
|
||||
enum {
|
||||
kIONUCResetNetworkDataIndex = 0,
|
||||
kIONUCWriteNetworkDataIndex = 1,
|
||||
kIONUCReadNetworkDataIndex = 2,
|
||||
kIONUCGetNetworkDataCapacityIndex = 3,
|
||||
kIONUCGetNetworkDataHandleIndex = 4,
|
||||
kIONUCLastIndex
|
||||
};
|
||||
|
||||
|
||||
#endif /* !_IONETWORKUSERCLIENT_H */
|
||||
@@ -0,0 +1,906 @@
|
||||
/*
|
||||
* Copyright (c) 2002-2010 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @header IOPSKeys.h
|
||||
*
|
||||
* @discussion
|
||||
* IOPSKeys.h defines C strings for use accessing power source data in IOPowerSource
|
||||
* CFDictionaries, as returned by <code>@link //apple_ref/c/func/IOPSGetPowerSourceDescription IOPSGetPowerSourceDescription @/link</code>
|
||||
* Note that all of these C strings must be converted to CFStrings before use. You can wrap
|
||||
* them with the CFSTR() macro, or create a CFStringRef (that you must later CFRelease()) using CFStringCreateWithCString().
|
||||
*/
|
||||
|
||||
#ifndef _IOPSKEYS_H_
|
||||
#define _IOPSKEYS_H_
|
||||
|
||||
/*!
|
||||
* @group IOPSPowerAdapter Keys
|
||||
*
|
||||
* @discussion
|
||||
* Use these kIOPSPowerAdapter keys to decipher the dictionary returned
|
||||
* by @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerAdapterIDKey
|
||||
*
|
||||
* @abstract This key refers to the attached external AC power adapter's ID.
|
||||
* The value associated with this key is a CFNumberRef kCFNumberIntType integer.
|
||||
*
|
||||
* @discussion This key may be present in the dictionary returned from
|
||||
* @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
|
||||
* This key might not be defined in the adapter details dictionary.
|
||||
*/
|
||||
#define kIOPSPowerAdapterIDKey "AdapterID"
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerAdapterWattsKey
|
||||
*
|
||||
* @abstract This key refers to the wattage of the external AC power adapter attached to a portable.
|
||||
* The value associated with this key is a CFNumberRef kCFNumberIntType integer value, in units of watts.
|
||||
*
|
||||
* @discussion This key may be present in the dictionary returned from
|
||||
* @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
|
||||
* This key might not be defined in the adapter details dictionary.
|
||||
*/
|
||||
#define kIOPSPowerAdapterWattsKey "Watts"
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerAdapterRevisionKey
|
||||
*
|
||||
* @abstract The power adapter's revision.
|
||||
* The value associated with this key is a CFNumberRef kCFNumberIntType integer value
|
||||
*
|
||||
* @discussion This key may be present in the dictionary returned from
|
||||
* @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
|
||||
* This key might not be defined in the adapter details dictionary.
|
||||
*/
|
||||
#define kIOPSPowerAdapterRevisionKey "AdapterRevision"
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerAdapterSerialNumberKey
|
||||
*
|
||||
* @abstract The power adapter's serial number.
|
||||
* The value associated with this key is a CFNumberRef kCFNumberIntType integer value
|
||||
*
|
||||
* @discussion This key may be present in the dictionary returned from
|
||||
* @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
|
||||
* This key might not be defined in the adapter details dictionary.
|
||||
*/
|
||||
#define kIOPSPowerAdapterSerialNumberKey "SerialNumber"
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerAdapterFamilyKey
|
||||
*
|
||||
* @abstract The power adapter's family code.
|
||||
* The value associated with this key is a CFNumberRef kCFNumberIntType integer value
|
||||
*
|
||||
* @discussion This key may be present in the dictionary returned from
|
||||
* @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
|
||||
* This key might not be defined in the adapter details dictionary.
|
||||
*/
|
||||
#define kIOPSPowerAdapterFamilyKey "FamilyCode"
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerAdapterCurrentKey
|
||||
*
|
||||
* @abstract This key refers to the current of the external AC power adapter attached to a portable.
|
||||
* The value associated with this key is a CFNumberRef kCFNumberIntType integer value, in units of mAmps.
|
||||
*
|
||||
* @discussion This key may be present in the dictionary returned from
|
||||
* @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
|
||||
* This key might not be defined in the adapter details dictionary.
|
||||
*/
|
||||
#define kIOPSPowerAdapterCurrentKey "Current"
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerAdapterSourceKey
|
||||
*
|
||||
* @abstract This key refers to the source of the power.
|
||||
* The value associated with this key is a CFNumberRef kCFNumberIntType integer value.
|
||||
*
|
||||
* @discussion This key may be present in the dictionary returned from
|
||||
* @link //apple_ref/c/func/IOPSCopyExternalPowerAdapterDetails IOPSCopyExternalPowerAdapterDetails @/link
|
||||
* This key might not be defined in the adapter details dictionary.
|
||||
*/
|
||||
#define kIOPSPowerAdapterSourceKey "Source"
|
||||
|
||||
|
||||
/*!
|
||||
* @group Internal Keys
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @define kIOPSUPSManagementClaimed
|
||||
*
|
||||
* @abstract Claims UPS management for a third-party driver.
|
||||
* @discussion kIOPSUPSManagementClaimed is obsolete. Do not use.
|
||||
* @deprecated Unsupported in OS X 10.5 and later.
|
||||
*/
|
||||
#define kIOPSUPSManagementClaimed "/IOKit/UPSPowerManagementClaimed"
|
||||
|
||||
/*!
|
||||
* @define kIOPSLowWarnLevelKey
|
||||
* @abstract Specifies the battery capacity percentage at which device is considered to be low on power.
|
||||
* Typically used to show initial warning to the user.
|
||||
*
|
||||
* Holds a CFNumber, with possible values between 0-100.
|
||||
*/
|
||||
#define kIOPSLowWarnLevelKey "Low Warn Level"
|
||||
|
||||
/*!
|
||||
* @define kIOPSDeadWarnLevelKey
|
||||
* @abstract Specifies the battery capacity percentage at which device is considered to be very low on power and
|
||||
* soon will not be functional. Typically used to show final warning to the user.
|
||||
*
|
||||
* Holds a CFNumber, with possible values between 0-100.
|
||||
*
|
||||
*/
|
||||
#define kIOPSDeadWarnLevelKey "Shutdown Level"
|
||||
|
||||
|
||||
/*!
|
||||
* @define kIOPSDynamicStorePath
|
||||
*
|
||||
* @abstract This is only used for internal bookkeeping, and should be ignored.
|
||||
*/
|
||||
#define kIOPSDynamicStorePath "/IOKit/PowerSources"
|
||||
|
||||
|
||||
/*!
|
||||
* @group Power Source Commands (UPS)
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @define kIOPSCommandDelayedRemovePowerKey
|
||||
*
|
||||
* @abstract Command to give a UPS when it should remove power from its AC plugs in a specified amount of time
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li>The matching argument should be a CFNumber of kCFNumberIntType specifying when the UPS should
|
||||
* <li>remove power from its AC power ports.
|
||||
* </ul>
|
||||
*/
|
||||
#define kIOPSCommandDelayedRemovePowerKey "Delayed Remove Power"
|
||||
|
||||
/*!
|
||||
* @define kIOPSCommandEnableAudibleAlarmKey
|
||||
*
|
||||
* @abstract Command to give a UPS when it should either enable or disable the audible alarm.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li>The matching argument should be a CFBooleanRef where kCFBooleanTrue enables the alarm and
|
||||
* <li>kCFBooleanFalse diables the alarm
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSCommandEnableAudibleAlarmKey "Enable Audible Alarm"
|
||||
|
||||
/*!
|
||||
* @define kIOPSCommandStartupDelayKey
|
||||
*
|
||||
* @abstract Tell UPS how long it should wait for
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li>The matching argument should be a CFNumber of kCFNumberIntType specifying when the UPS should
|
||||
* <li>remove power from its AC power ports.
|
||||
* </ul>
|
||||
*/
|
||||
#define kIOPSCommandStartupDelayKey "Startup Delay"
|
||||
|
||||
/*!
|
||||
* @define kIOPSCommandSetCurrentLimitKey
|
||||
*
|
||||
* @abstract Tell the UPS the max current it can draw from an attached power source
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li>The matching argument should be a CFNumber of kCFNumberIntType specifying the UPS' new current
|
||||
* <li>limit in mA.
|
||||
*/
|
||||
#define kIOPSCommandSetCurrentLimitKey "Set Current Limit"
|
||||
|
||||
/*!
|
||||
* @define kIOPSCommandSetRequiredVoltageKey
|
||||
*
|
||||
* @abstract Tell the UPS the minimum voltage it needs to provide.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li>The matching argument should be a CFNumber of kCFNumberIntType specifying the required voltage
|
||||
* <li>from a UPS in mV.
|
||||
*/
|
||||
#define kIOPSCommandSetRequiredVoltageKey "Set Required Voltage"
|
||||
|
||||
/*!
|
||||
* @define kIOPSCommandSendCurrentStateOfCharge
|
||||
*
|
||||
* @abstract Tell the UPS the device's current state of charge
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li>The matching argument should be a CFNumber of kCFNumberIntType specifying the device's
|
||||
* <li>state of charge as a percentage.
|
||||
*/
|
||||
#define kIOPSCommandSendCurrentStateOfCharge "Send Current State of Charge"
|
||||
|
||||
/*!
|
||||
* @define kIOPSCommandSendCurrentTemperature
|
||||
*
|
||||
* @abstract Tell the UPS the device's current temperature
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li>The matching argument should be a CFNumber of kCFNumberIntType specifying the device's
|
||||
* <li>temperature in degrees deciKelvin.
|
||||
*/
|
||||
#define kIOPSCommandSendCurrentTemperature "Send Current Temperature"
|
||||
|
||||
/*!
|
||||
* @group Power Source data keys
|
||||
*
|
||||
*/
|
||||
|
||||
/* These keys specify the values in a dictionary of PowerSource details.
|
||||
* Use these keys in conjunction with the dictionary returned by
|
||||
* <code>@link //apple_ref/c/func/IOPSGetPowerSourceDescription IOPSGetPowerSourceDescription @/link</code>
|
||||
*
|
||||
* Clients of <code>@link //apple_ref/c/func/IOPSCreatePowerSource IOPSCreatePowerSource @/link</code>
|
||||
* must specify these keys in their power source dictionaries.
|
||||
* Each key is labelled with one of these labels that indicate what information is REQUIRED. to
|
||||
* represent a power source in OS X.
|
||||
*
|
||||
* <ul>
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> For power source creators: Providing this key is OPTIONAL.
|
||||
* <li> This key is DEPRECATED, do not provide it.
|
||||
* </ul>
|
||||
*
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerSourceIDKey
|
||||
*
|
||||
* @abstract CFNumber key uniquely identifying the power source.
|
||||
*
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Callers should not set this key; OS X power management will publish this key for all power sources
|
||||
* <li> Type CFNumber, kCFNumberIntType, uniquely identifying the power source
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSPowerSourceIDKey "Power Source ID"
|
||||
|
||||
|
||||
/*!
|
||||
* @define kIOPSPowerSourceStateKey
|
||||
*
|
||||
* @abstract CFDictionary key for the current source of power.
|
||||
*
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> <code>@link kIOPSBatteryPowerValue @/link</code> indicates power source is drawing internal power;
|
||||
* <code>@link kIOPSACPowerValue@/link</code> indicates power source is connected to an external power source.
|
||||
* <li> Type CFString, value is <code>@link kIOPSACPowerValue@/link</code>, <code>@link kIOPSBatteryPowerValue@/link</code>, or <code>@link kIOPSOffLineValue@/link</code>.
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSPowerSourceStateKey "Power Source State"
|
||||
|
||||
/*!
|
||||
* @define kIOPSCurrentCapacityKey
|
||||
* @abstract CFDictionary key for the current power source's capacity.
|
||||
*
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key in units of percent.
|
||||
* <li> The power source's software may specify the units for this key.
|
||||
* The units must be consistent for all capacities reported by this power source.
|
||||
* The power source will usually define this number in units of percent, or mAh.
|
||||
* <li> Clients may derive a percentage of power source battery remaining by dividing "Current Capacity" by "Max Capacity"
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer)
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSCurrentCapacityKey "Current Capacity"
|
||||
|
||||
/*!
|
||||
* @define kIOPSMaxCapacityKey
|
||||
* @abstract CFDictionary key for the current power source's maximum or "Full Charge Capacity"
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key in units of percent. The value is usually 100%.
|
||||
* <li> The power source's software may specify the units for this key. The units must be consistent for all capacities reported by this power source.
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer)
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSMaxCapacityKey "Max Capacity"
|
||||
|
||||
/*!
|
||||
* @define kIOPSDesignCapacityKey
|
||||
* @abstract CFDictionary key for the current power source's design capacity
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources might not publish this key.
|
||||
* <li> The power source's software may specify the units for this key. The units must be consistent for all capacities reported by this power source.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer)
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSDesignCapacityKey "DesignCapacity"
|
||||
|
||||
/*!
|
||||
* @define kIOPSNominalCapacityKey
|
||||
* @abstract CFDictionary key for the current power source's normalized full, or "nominal", charge capacity
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources might not publish this key.
|
||||
* <li> The power source's software may specify the units for this key. The units must be consistent for all capacities reported by this power source.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer)
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSNominalCapacityKey "Nominal Capacity"
|
||||
|
||||
/*!
|
||||
* @define kIOPSTimeToEmptyKey
|
||||
* @abstract CFDictionary key for the current power source's time remaining until empty.
|
||||
* @discussion
|
||||
* Only valid if the power source is running off its own power. That's when the
|
||||
* <code>@link kIOPSPowerSourceStateKey @/link</code> has value <code>@link kIOPSBatteryPowerValue @/link</code>
|
||||
* and the value of <code>@link kIOPSIsChargingKey @/link</code> is kCFBooleanFalse.
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer), units are minutes
|
||||
* <li> A value of -1 indicates "Still Calculating the Time", otherwise estimated minutes left on the battery.
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
|
||||
#define kIOPSTimeToEmptyKey "Time to Empty"
|
||||
|
||||
/*!
|
||||
* @define kIOPSTimeToFullChargeKey
|
||||
* @abstract CFDictionary key for the current power source's time remaining until empty.
|
||||
* @discussion
|
||||
* Only valid if the value of <code>@link kIOPSIsChargingKey @/link</code> is kCFBooleanTrue.
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer), units are minutes
|
||||
* <li>A value of -1 indicates "Still Calculating the Time", otherwise estimated minutes until fully charged.
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSTimeToFullChargeKey "Time to Full Charge"
|
||||
|
||||
/*!
|
||||
* @define kIOPSIsChargingKey
|
||||
* @abstract CFDictionary key for the current power source's charging state
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSIsChargingKey "Is Charging"
|
||||
|
||||
/*!
|
||||
* @define kIOPSInternalFailureKey
|
||||
* @abstract CFDictionary key for whether the current power source has experienced a failure
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources might not publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSInternalFailureKey "Internal Failure"
|
||||
|
||||
/*!
|
||||
* @define kIOPSIsPresentKey
|
||||
* @abstract CFDictionary key for the current power source's presence.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For instance, a portable with the capacity for two batteries but
|
||||
* with only one present would show two power source dictionaries,
|
||||
* but kIOPSIsPresentKey would have the value kCFBooleanFalse in one of them.
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSIsPresentKey "Is Present"
|
||||
|
||||
/*!
|
||||
* @define kIOPSVoltageKey
|
||||
* @abstract CFDictionary key for the current power source's electrical voltage.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer) - units are mV
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSVoltageKey "Voltage"
|
||||
|
||||
/*!
|
||||
* @define kIOPSCurrentKey
|
||||
* @abstract CFDictionary key for the current power source's electrical current.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer) - units are mA
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSCurrentKey "Current"
|
||||
|
||||
/*!
|
||||
* @define kIOPSTemperatureKey
|
||||
* @abstract CFDictionary key for the current power source's temperature.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumber kCFNumberIntType (signed integer) - units are C
|
||||
* </ul>
|
||||
*/
|
||||
#define kIOPSTemperatureKey "Temperature"
|
||||
|
||||
/*!
|
||||
* @define kIOPSNameKey
|
||||
* @abstract CFDictionary key for the current power source's name.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> Type CFStringRef
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSNameKey "Name"
|
||||
|
||||
|
||||
/*!
|
||||
* @define kIOPSTypeKey
|
||||
* @abstract CFDictionary key for the type of the power source
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> Type CFStringRef. Valid transport types are kIOPSUPSType or kIOPSInternalBatteryType.
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSTypeKey "Type"
|
||||
|
||||
|
||||
/*!
|
||||
* @define kIOPSTransportTypeKey
|
||||
* @abstract CFDictionary key for the current power source's data transport type (e.g. the means that the power source conveys power source data to the OS X machine).
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> A value of <code>@link kIOPSInternalType @/link</code> describes an internal power source.
|
||||
* <li> <code>@link kIOPSUSBTransportType @/link</code>, <code>@link kIOPSNetworkTransportType @/link</code>, and <code>@link kIOPSSerialTransportType @/link</code> usually describe UPS's.
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> Type CFStringRef. Valid transport types are kIOPSSerialTransportType,
|
||||
* kIOPSUSBTransportType, kIOPSNetworkTransportType, kIOPSInternalType
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSTransportTypeKey "Transport Type"
|
||||
|
||||
/*!
|
||||
* @define kIOPSVendorIDKey
|
||||
* @abstract CFDictionary key for the current power source's vendor ID.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumberRef
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSVendorIDKey "Vendor ID"
|
||||
|
||||
/*!
|
||||
* @define kIOPSProductIDKey
|
||||
* @abstract CFDictionary key for the current power source's product ID.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFNumberRef
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSProductIDKey "Product ID"
|
||||
|
||||
/*!
|
||||
* @define kIOPSVendorDataKey
|
||||
* @abstract CFDictionary key for arbitrary vendor data.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources are not required to publish this key.
|
||||
* <li> For power source creators: Providing this key is OPTIONAL.
|
||||
* <li>CFDictionary; contents determined by the power source software. OS X will not look at this data.
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSVendorDataKey "Vendor Specific Data"
|
||||
|
||||
/*!
|
||||
* @define kIOPSBatteryHealthKey
|
||||
* @abstract CFDictionary key for the current power source's "health" estimate.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined battery power sources will publish this key.
|
||||
* <li> Use value <code>@link kIOPSGoodValue @/link</code> to describe a well-performing power source,
|
||||
* <li> Use <code>@link kIOPSFairValue @/link</code> to describe a functional power source with limited capacity
|
||||
* <li> And use <code>@link kIOPSPoorValue @/link</code> to describe a power source that's not capable of Providing power.
|
||||
* <li> For power source creators: Providing this key is OPTIONAL.
|
||||
* <li> Type CFStringRef
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSBatteryHealthKey "BatteryHealth"
|
||||
|
||||
/*!
|
||||
* @define kIOPSBatteryHealthConditionKey
|
||||
* @abstract kIOPSBatteryHealthConditionKey broadly describes the battery's health.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> Value is one of the "Battery Health Condition Values" strings described in this file.
|
||||
* <li> For power source creators: Providing this key is OPTIONAL - these keys have values only used by Apple power sources.
|
||||
* <li> Type CFStringRef
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSBatteryHealthConditionKey "BatteryHealthCondition"
|
||||
|
||||
/*!
|
||||
* @define kIOPSBatteryFailureModesKey
|
||||
* @abstract Enumerates a battery's failures and error conditions.
|
||||
* @discussion
|
||||
* Various battery failures will be listed here. A battery may suffer from more than one
|
||||
* type of failure simultaneously, so this key has a CFArray value.
|
||||
*
|
||||
* If BatteryFailureModesKey is not defined (or is set to an empty dictionary),
|
||||
* then the battery has no detectable failures.
|
||||
*
|
||||
* Each entry in the array should be a short descriptive string describing the error.
|
||||
* <li> Apple-defined power sources will publish this key if any battery errors exist.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFArrayRef
|
||||
* </ul>
|
||||
*/
|
||||
#define kIOPSBatteryFailureModesKey "BatteryFailureModes"
|
||||
|
||||
/*!
|
||||
* @define kIOPSHealthConfidenceKey
|
||||
* @abstract CFDictionary key for our confidence in the accuracy of our
|
||||
* power source's "health" estimate.
|
||||
* @deprecated In OS X 10.6 and later.
|
||||
* @discussion
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will no longer publish this key.
|
||||
* <li> Power source creators should not publish this key.
|
||||
* <li> For power source creators: This key is DEPRECATED, do not implement it.
|
||||
* <li> Type CFStringRef
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSHealthConfidenceKey "HealthConfidence"
|
||||
|
||||
|
||||
/*!
|
||||
* @define kIOPSMaxErrKey
|
||||
* @abstract CFDictionary key for the current power source's percentage error in capacity reporting.
|
||||
* @discussion
|
||||
* In internal batteries, this refers to the battery pack's estimated percentage error.
|
||||
* <ul>
|
||||
* <li> Apple-defined battery power sources will publish this key, but only if it's defined for the battery.
|
||||
* <li> For power source creators: Providing this key is OPTIONAL.
|
||||
* <li> Type CFNumberRef kCFNumberIntType, non-negative integer
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSMaxErrKey "MaxErr"
|
||||
|
||||
/*!
|
||||
* @define kIOPSIsChargedKey
|
||||
* @abstract CFDictionary key indicates whether the battery is charged.
|
||||
* @discussion
|
||||
* A battery must be plugged in to an external power source in order to be fully charged.
|
||||
* Note that a battery may validly be plugged in, not charging, and <100% charge.
|
||||
* e.g. A battery with capacity >= 95% and not charging, is defined as charged.
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is REQUIRED.
|
||||
* <li> Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSIsChargedKey "Is Charged"
|
||||
|
||||
/*!
|
||||
* @define kIOPSIsFinishingChargeKey
|
||||
* @abstract CFDictionary key indicates whether the battery is finishing off its charge.
|
||||
* @discussion
|
||||
* When this is true, the system UI should indicate that the battery is "Finishing Charge."
|
||||
* Some batteries may continue charging after they report 100% capacity.
|
||||
* <ul>
|
||||
* <li> Apple-defined battery power sources will publish this key.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFBoolean - kCFBooleanTrue or kCFBooleanFalse
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
#define kIOPSIsFinishingChargeKey "Is Finishing Charge"
|
||||
|
||||
/*!
|
||||
* @define kIOPSHardwareSerialNumberKey
|
||||
* @abstract A unique serial number that identifies the power source.
|
||||
* @discussion For Apple-manufactured batteries, this is an alphanumeric string generated
|
||||
* during the battery manufacturing process.
|
||||
* <ul>
|
||||
* <li> Apple-defined power sources will publish this key if the hardware provides the serial number.
|
||||
* <li> For power source creators: Providing this key is RECOMMENDED.
|
||||
* <li> Type CFStringRef
|
||||
* </ul>
|
||||
*/
|
||||
|
||||
|
||||
#define kIOPSHardwareSerialNumberKey "Hardware Serial Number"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @group Transport types
|
||||
* @abstract Possible values for <code>@link kIOPSTransportTypeKey @/link</code>
|
||||
*/
|
||||
/*!
|
||||
* @define kIOPSSerialTransportType
|
||||
* @abstract Value for key <code>@link kIOPSTransportTypeKey @/link</code>.
|
||||
* @discussion Indicates the power source is a UPS attached over a serial connection.
|
||||
*/
|
||||
#define kIOPSSerialTransportType "Serial"
|
||||
|
||||
/*!
|
||||
* @define kIOPSUSBTransportType
|
||||
* @abstract Value for key <code>@link kIOPSTransportTypeKey @/link</code>.
|
||||
* @discussion Indicates the power source is a UPS attached over a USB connection.
|
||||
*/
|
||||
#define kIOPSUSBTransportType "USB"
|
||||
|
||||
/*!
|
||||
* @define kIOPSNetworkTransportType
|
||||
* @abstract Value for key <code>@link kIOPSTransportTypeKey @/link</code>.
|
||||
* @discussion Indicates the power source is a UPS attached over a network connection (and it may be managing several computers).
|
||||
*/
|
||||
#define kIOPSNetworkTransportType "Ethernet"
|
||||
|
||||
/*!
|
||||
* @define kIOPSInternalType
|
||||
* @abstract Value for key <code>@link kIOPSTransportTypeKey @/link</code>. Indicates the power source is an internal battery.
|
||||
*/
|
||||
#define kIOPSInternalType "Internal"
|
||||
|
||||
|
||||
/*
|
||||
* @group PowerSource Types
|
||||
* @discussion
|
||||
* A string that broadly describes the type of power source. One of these strings must be passed
|
||||
* as an argument to IOPSCreatePowerSource() when defining a new system power source.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @define kIOPSInternalBatteryType
|
||||
*
|
||||
* @abstract Represents a battery residing inside a Mac.
|
||||
*/
|
||||
#define kIOPSInternalBatteryType "InternalBattery"
|
||||
|
||||
/*!
|
||||
* @define kIOPSUPSType
|
||||
*
|
||||
* @abstract Represents an external attached UPS.
|
||||
*/
|
||||
#define kIOPSUPSType "UPS"
|
||||
|
||||
/*
|
||||
* PS state
|
||||
*/
|
||||
/*!
|
||||
* @define kIOPSOffLineValue
|
||||
* @abstract Value for key kIOPSPowerSourceStateKey. Power source is off-line or no longer connected.
|
||||
*/
|
||||
#define kIOPSOffLineValue "Off Line"
|
||||
|
||||
/*!
|
||||
* @define kIOPSACPowerValue
|
||||
* @abstract Value for key kIOPSPowerSourceStateKey. Power source is connected to external or AC power, and is not draining the internal battery.
|
||||
*/
|
||||
#define kIOPSACPowerValue "AC Power"
|
||||
|
||||
/*!
|
||||
* @define kIOPSBatteryPowerValue
|
||||
* @abstract Value for key kIOPSPowerSourceStateKey. Power source is currently using the internal battery.
|
||||
*/
|
||||
#define kIOPSBatteryPowerValue "Battery Power"
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* @group Battery Health values
|
||||
*/
|
||||
/*!
|
||||
* @define kIOPSPoorValue
|
||||
* @abstract Value for key <code>@link kIOPSBatteryHealthKey @/link</code>.
|
||||
*/
|
||||
#define kIOPSPoorValue "Poor"
|
||||
|
||||
/*!
|
||||
* @define kIOPSFairValue
|
||||
* @abstract Value for key <code>@link kIOPSBatteryHealthKey @/link</code>.
|
||||
*/
|
||||
#define kIOPSFairValue "Fair"
|
||||
|
||||
/*!
|
||||
* @define kIOPSGoodValue
|
||||
* @abstract Value for key <code>@link kIOPSBatteryHealthKey @/link</code>.
|
||||
*/
|
||||
#define kIOPSGoodValue "Good"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @group Battery Health Condition values
|
||||
*/
|
||||
/*!
|
||||
* @define kIOPSCheckBatteryValue
|
||||
*
|
||||
* @abstract Value for key <code>@link kIOPSBatteryHealthConditionKey @/link</code>
|
||||
*
|
||||
* @discussion This value indicates that the battery should be checked out by a licensed Mac repair service.
|
||||
*/
|
||||
#define kIOPSCheckBatteryValue "Check Battery"
|
||||
|
||||
/*!
|
||||
* @define kIOPSPermanentFailureValue
|
||||
*
|
||||
* @abstract Value for key <code>@link kIOPSBatteryHealthConditionKey @/link</code>
|
||||
*
|
||||
* @discussion Indicates the battery needs replacement.
|
||||
*/
|
||||
#define kIOPSPermanentFailureValue "Permanent Battery Failure"
|
||||
|
||||
|
||||
/*!
|
||||
* @group Battery Failure Mode values
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @define kIOPSFailureExternalInput
|
||||
*
|
||||
* @abstract Value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureExternalInput "Externally Indicated Failure"
|
||||
/*!
|
||||
* @define kIOPSFailureSafetyOverVoltage
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureSafetyOverVoltage "Safety Over-Voltage"
|
||||
/*!
|
||||
* @define kIOPSFailureChargeOverTemp
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureChargeOverTemp "Charge Over-Temperature"
|
||||
/*!
|
||||
* @define kIOPSFailureDischargeOverTemp
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureDischargeOverTemp "Discharge Over-Temperature"
|
||||
/*!
|
||||
* @define kIOPSFailureCellImbalance
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureCellImbalance "Cell Imbalance"
|
||||
/*!
|
||||
* @define kIOPSFailureChargeFET
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureChargeFET "Charge FET"
|
||||
/*!
|
||||
* @define kIOPSFailureDischargeFET
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureDischargeFET "Discharge FET"
|
||||
/*!
|
||||
* @define kIOPSFailureDataFlushFault
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureDataFlushFault "Data Flush Fault"
|
||||
/*!
|
||||
* @define kIOPSFailurePermanentAFEComms
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailurePermanentAFEComms "Permanent AFE Comms"
|
||||
/*!
|
||||
* @define kIOPSFailurePeriodicAFEComms
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailurePeriodicAFEComms "Periodic AFE Comms"
|
||||
/*!
|
||||
* @define kIOPSFailureChargeOverCurrent
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureChargeOverCurrent "Charge Over-Current"
|
||||
/*!
|
||||
* @define kIOPSFailureDischargeOverCurrent
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureDischargeOverCurrent "Discharge Over-Current"
|
||||
/*!
|
||||
* @define kIOPSFailureOpenThermistor
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureOpenThermistor "Open Thermistor"
|
||||
/*!
|
||||
* @define kIOPSFailureFuseBlown
|
||||
*
|
||||
* @abstract Potential value for key <code>@link kIOPSBatteryFailureModesKey@/link</code>
|
||||
*/
|
||||
#define kIOPSFailureFuseBlown "Fuse Blown"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,379 @@
|
||||
/*
|
||||
* Copyright (c) 2002 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* HISTORY
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_IOPOWERSOURCES_H
|
||||
#define _IOKIT_IOPOWERSOURCES_H
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <CoreFoundation/CoreFoundation.h> /* CFTimeInterval, CFArrayRef, CFDictionaryRef, CFRunLoopSourceRef */
|
||||
__BEGIN_DECLS
|
||||
|
||||
|
||||
/*!
|
||||
* @header IOPowerSources.h
|
||||
*
|
||||
* @discussion IOPowerSources provides uniform access to the state of power sources attached to the system.
|
||||
* You can receive a change notification when any power source data changes.
|
||||
* "Power sources" currently include batteries and UPS devices.
|
||||
*
|
||||
* The header follows CF semantics in that it is the caller's responsibility to
|
||||
* CFRelease() anything returned by a "Copy" function, and the caller should not
|
||||
* CFRelease() anything returned by a "Get" function.
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @functiongroup Low Power Warnings
|
||||
*/
|
||||
|
||||
/*! @constant kIOPSNotifyLowBattery
|
||||
*
|
||||
* @abstract Notify(3) key. IOKit posts kIOPSNotifyLowBattery notifications when the
|
||||
* system is drawing from limited battery power, and the battery time
|
||||
* remaining drops into a warnable level.
|
||||
*
|
||||
* See also kIOPSNotifyPowerSource, and kIOPSNotifyTimeRemaining
|
||||
*/
|
||||
#define kIOPSNotifyLowBattery "com.apple.system.powersources.lowbattery"
|
||||
|
||||
/*!
|
||||
* @enum IOPSLowBatteryWarningLevel
|
||||
*
|
||||
* @discussion Possible return values from <code>@link IOPSGetBatteryWarningLevel@/link</code>
|
||||
*/
|
||||
typedef enum {
|
||||
/*! @constant kIOPSLowBatteryWarningNone
|
||||
*
|
||||
* @abstract The system is not in a low battery situation, or is on drawing from an external power source.
|
||||
*
|
||||
* @discussion The system displays no low power warnings; neither should application clients of this
|
||||
* API.
|
||||
*/
|
||||
kIOPSLowBatteryWarningNone = 1,
|
||||
|
||||
/*! @constant kIOPSLowBatteryWarningEarly
|
||||
*
|
||||
* @abstract The battery can provide no more than 20 minutes of runtime.
|
||||
*
|
||||
* @discussion OS X makes no guarantees that the system shall remain in Early Warning for 20 minutes.
|
||||
* Batteries are frequently calibrated differently and may provide runtime
|
||||
* for more, or less, than the estimated 20 minutes.
|
||||
* OS X alerts the user by changing the color of BatteryMonitor to red.
|
||||
* Warning the user is optional for full screen apps.
|
||||
*/
|
||||
kIOPSLowBatteryWarningEarly = 2,
|
||||
|
||||
/*! @constant kIOPSLowBatteryWarningFinal
|
||||
*
|
||||
* @abstract The battery can provide no more than 10 minutes of runtime.
|
||||
*
|
||||
* @discussion OS X makes no guarantees that the system shall remain in Final Warning for 10 minutes.
|
||||
* Batteries are frequently calibrated differently and may provide runtime
|
||||
* for more, or less, than the estimated 10 minutes.
|
||||
*/
|
||||
kIOPSLowBatteryWarningFinal = 3
|
||||
} IOPSLowBatteryWarningLevel;
|
||||
|
||||
/*! @function IOPSGetBatteryWarningLevel
|
||||
*
|
||||
* @abstract Indicates whether the system is at a low battery warning level.
|
||||
*
|
||||
* @discussion If your app runs in full screen mode and occludes OS X's battery monitor's low
|
||||
* battery warnings, you should alert the user at least when the system
|
||||
* is in kIOPSLowBatteryWarnFinal.
|
||||
*/
|
||||
IOPSLowBatteryWarningLevel IOPSGetBatteryWarningLevel(void);
|
||||
|
||||
/*!
|
||||
* @functiongroup Quick Power Source Info
|
||||
*/
|
||||
|
||||
/*!
|
||||
* @define kIOPSNotifyTimeRemaining
|
||||
* C-string key for a notification of changes to any power source's time remaining estimate.
|
||||
* IOKit also posts this notification when the active power source changes between AC, Battery, and UPS.
|
||||
*
|
||||
* If you only need to detect when the power source changes between AC, Battery, or UPS, please use
|
||||
* <code>@link kIOPSNotifyPowerSource @/link</code>; your code will run less often and conserve battery life.
|
||||
*
|
||||
* See API <code>@link IOPSGetTimeRemainingEstimate @/link</code> to determine whether the active power source is
|
||||
* limited or unlimited; and to determine the estimated time remaining until empty.
|
||||
*
|
||||
* Use notify(3) API to register for notifications.
|
||||
*/
|
||||
#define kIOPSNotifyTimeRemaining "com.apple.system.powersources.timeremaining"
|
||||
#define kIOPSTimeRemainingNotificationKey kIOPSNotifyTimeRemaining
|
||||
|
||||
/*!
|
||||
* @define kIOPSNotifyPowerSource
|
||||
* @abstract C-string key for a notification of changes to the active power source.
|
||||
* @discussion Use this notification to discover when the active power source changes from AC power (unlimited/wall power),
|
||||
* to Battery Power or UPS Power (limited power). IOKit will not deliver this notification when a battery's
|
||||
* time remaining changes, only when the active power source changes. This makes it a more efficient
|
||||
* choice for clients only interested in differentiating AC vs Battery.
|
||||
*
|
||||
* See API <code>@link IOPSGetTimeRemainingEstimate @/link</code> to determine whether the active power source is
|
||||
* limited or unlimited.
|
||||
*
|
||||
* Example: IOKit posts kIOPSNotifyPowerSource upon connecting or disconnecting AC power to a laptop.
|
||||
* IOKit posts kIOPSNotifyPowerSource upon a UPS losing AC Power; as the system switches to a limited
|
||||
* UPS battery power source.
|
||||
*
|
||||
* Use notify(3) API to register for notifications.
|
||||
* */
|
||||
#define kIOPSNotifyPowerSource "com.apple.system.powersources.source"
|
||||
|
||||
/*!
|
||||
* @define kIOPSNotifyAttach
|
||||
* @abstract C-string key for a notification when a power source is attached or detached.
|
||||
* @discussion Example: IOKit posts kIOPSNotifyAttach upon detection of internal battery.
|
||||
* IOKit posts kIOPSNotifyAttach when a user attaches or detaches an external UPS.
|
||||
*
|
||||
* Note that IOKit doesn't deliver kIOPSNotifyAttach upon plugging or unplugging AC Power to a laptop; see
|
||||
* <code>@link kIOPSNotifyPowerSource@/link</code> for changes to the active power source.
|
||||
*
|
||||
* IOKit may take many seconds to discover a built-in battery at boot time. If your user process runs
|
||||
* at early boot, use kIOPSNotifyAttach to detect an IOPowerSource's appearance.
|
||||
* Use notify(3) API to register for notifications.
|
||||
*/
|
||||
#define kIOPSNotifyAttach "com.apple.system.powersources.attach"
|
||||
|
||||
/*!
|
||||
* @define kIOPSNotifyAnyPowerSource
|
||||
* @abstract C-string key for a notification that of changes to any attribute of any IOPowerSource.
|
||||
* @discussion Use notify(3) API to register for notifications.
|
||||
* IOKit posts this notification more frequently than the other notifications, and thus uses more
|
||||
* energy to run your code. To conserve CPU cycles and battery life, please consider another notification
|
||||
* that also fits your needs. Please consider these instead:
|
||||
* <code>@link kIOPSNotifyPowerSource @/link</code>,
|
||||
* <code>@link kIOPSNotifyTimeRemaining @/link</code>
|
||||
*
|
||||
*/
|
||||
#define kIOPSNotifyAnyPowerSource "com.apple.system.powersources"
|
||||
|
||||
/*!
|
||||
* @constant kIOPSTimeRemainingUnknown
|
||||
* Possible return value from <code>@link IOPSGetTimeRemainingEstimate@/link</code>
|
||||
* Indicates the system is connected to a limited power source, but the system is still
|
||||
* calculating a time remaining estimate. Check for a valid estimate again when IOKit posts the
|
||||
* notification <code>@link kIOPSPowerSourcesNotificationKey@/link</code>.
|
||||
*/
|
||||
#define kIOPSTimeRemainingUnknown ((CFTimeInterval)-1.0)
|
||||
|
||||
/*!
|
||||
* @constant kIOPSTimeRemainingUnlimited
|
||||
* Possible return value from <code>@link IOPSGetTimeRemainingEstimate@/link</code>
|
||||
* Indicates the system is connected to an external power source, without a time limit.
|
||||
*/
|
||||
#define kIOPSTimeRemainingUnlimited ((CFTimeInterval)-2.0)
|
||||
|
||||
|
||||
/*!
|
||||
* @constant kIOPMUPSPowerKey
|
||||
* Possible return value from <code>@link IOPSGetProvidingPowerSourceType@/link</code>
|
||||
* Indicates that the system is connected to an external power source, that identifies itself as
|
||||
* as an UPS.
|
||||
*/
|
||||
|
||||
#define kIOPMUPSPowerKey "UPS Power"
|
||||
|
||||
/*!
|
||||
* @constant kIOPMBatteryPowerKey
|
||||
* Possible return value from <code>@link IOPSGetProvidingPowerSourceType@/link</code>
|
||||
* Indicates that the system is connected to internal battery power source.
|
||||
*/
|
||||
#define kIOPMBatteryPowerKey "Battery Power"
|
||||
|
||||
/*!
|
||||
* @constant kIOPMACPowerKey
|
||||
* Possible return value from <code>@link IOPSGetProvidingPowerSourceType@/link</code>
|
||||
* Indicates that the system is connected to an external unlimited power source.
|
||||
*/
|
||||
#define kIOPMACPowerKey "AC Power"
|
||||
|
||||
|
||||
/*!
|
||||
* @function IOPSGetTimeRemainingEstimate
|
||||
*
|
||||
* @abstract Returns the estimated minutes remaining until all power sources
|
||||
* (battery and/or UPS's) are empty, or returns <code>@link kIOPSTimeRemainingUnlimited@/link </code>
|
||||
* if attached to an unlimited power source.
|
||||
*
|
||||
* @discussion
|
||||
* If attached to an "Unlimited" power source, like AC power or any external source, the
|
||||
* return value is <code>@link kIOPSTimeRemainingUnlimited@/link </code>
|
||||
*
|
||||
* If the system is on "Limited" power, like a battery or UPS,
|
||||
* but is still calculating the time remaining, which may
|
||||
* take several seconds after each system power event
|
||||
* (e.g. waking from sleep, or unplugging AC Power), the return value is
|
||||
* <code>@link kIOPSTimeRemainingUnknown@/link </code>
|
||||
*
|
||||
* Otherwise, if the system is on "Limited" power and the system has an accurate time
|
||||
* remaining estimate, the system returns a CFTimeInterval estimate of the time
|
||||
* remaining until the system is out of battery power.
|
||||
*
|
||||
* If you require more detailed battery information, use
|
||||
* <code>@link IOPSCopyPowerSourcesInfo @/link></code>
|
||||
* and <code>@link IOPSGetPowerSourceDescription @/link></code>.
|
||||
*
|
||||
* @result
|
||||
* Returns <code>@link kIOPSTimeRemainingUnknown@/link</code> if the
|
||||
* OS cannot determine the time remaining.
|
||||
*
|
||||
* Returns <code>@link kIOPSTimeRemainingUnlimited@/link</code> if the
|
||||
* system has an unlimited power source.
|
||||
*
|
||||
* Otherwise returns a positive number of type CFTimeInterval, indicating the time
|
||||
* remaining in seconds until all power sources are depleted.
|
||||
*/
|
||||
CFTimeInterval IOPSGetTimeRemainingEstimate(void);
|
||||
|
||||
|
||||
/*!
|
||||
* @functiongroup Power Source Descriptions
|
||||
*/
|
||||
|
||||
typedef void (*IOPowerSourceCallbackType)(void *context);
|
||||
|
||||
/*! @function IOPSCopyPowerSourcesInfo
|
||||
*
|
||||
* @abstract Returns a blob of Power Source information in an opaque CFTypeRef.
|
||||
*
|
||||
* @discussion Clients should not directly access data in the returned CFTypeRef -
|
||||
* they should use the accessor functions IOPSCopyPowerSourcesList and
|
||||
* IOPSGetPowerSourceDescription, instead.
|
||||
*
|
||||
* @result NULL if errors were encountered, a CFTypeRef otherwise.
|
||||
* Caller must CFRelease() the return value when done accessing it.
|
||||
*/
|
||||
CFTypeRef IOPSCopyPowerSourcesInfo(void);
|
||||
|
||||
/*! @function IOPSCopyPowerSourcesList
|
||||
*
|
||||
* @abstract Returns a CFArray of Power Source handles, each of type CFTypeRef.
|
||||
*
|
||||
* @discussion The caller shouldn't directly access the CFTypeRefs, but should use
|
||||
* IOPSGetPowerSourceDescription on each member of the CFArrayRef.
|
||||
*
|
||||
* @param blob Takes the CFTypeRef returned by IOPSCopyPowerSourcesInfo()
|
||||
*
|
||||
* @result Returns NULL if errors were encountered, otherwise a CFArray of CFTypeRefs.
|
||||
* Caller must CFRelease() the returned CFArrayRef.
|
||||
*/
|
||||
CFArrayRef IOPSCopyPowerSourcesList(CFTypeRef blob);
|
||||
|
||||
/*! @function IOPSGetPowerSourceDescription
|
||||
*
|
||||
* @abstract Returns a CFDictionary with readable information about the specific power source.
|
||||
*
|
||||
* @discussion See the C-strings defined in IOPSKeys.h for specific keys into the dictionary.
|
||||
* Don't expect all keys to be present in any dictionary. Some power sources, for example,
|
||||
* may not support the "Time Remaining To Empty" key and it will not be present in their dictionaries.
|
||||
*
|
||||
* @param blob The CFTypeRef returned by IOPSCopyPowerSourcesInfo()
|
||||
*
|
||||
* @param ps One of the CFTypeRefs in the CFArray returned by IOPSCopyPowerSourcesList()
|
||||
*
|
||||
* @result Returns NULL if an error was encountered, otherwise a CFDictionary. Caller should
|
||||
* NOT release the returned CFDictionary - it will be released as part of the CFTypeRef returned by
|
||||
* IOPSCopyPowerSourcesInfo().
|
||||
*/
|
||||
CFDictionaryRef IOPSGetPowerSourceDescription(CFTypeRef blob, CFTypeRef ps);
|
||||
|
||||
/*! @function IOPSGetProvidingPowerSourceType
|
||||
*
|
||||
* @abstract Indicates the power source the computer is currently drawing from.
|
||||
*
|
||||
* @discussion Determines which power source is providing power.
|
||||
*
|
||||
* @param snapshot The CFTypeRef returned by IOPSCopyPowerSourcesInfo()
|
||||
*
|
||||
* @result One of: CFSTR(kIOPMACPowerKey), CFSTR(kIOPMBatteryPowerKey), CFSTR(kIOPMUPSPowerKey)
|
||||
*/
|
||||
CFStringRef IOPSGetProvidingPowerSourceType(CFTypeRef snapshot);
|
||||
|
||||
/*! @function IOPSNotificationCreateRunLoopSource
|
||||
*
|
||||
* @abstract Returns a CFRunLoopSourceRef that notifies the caller when power source
|
||||
* information changes.
|
||||
*
|
||||
* @discussion Returns a CFRunLoopSourceRef for scheduling with your CFRunLoop.
|
||||
* If your project does not use a CFRunLoop, you can alternatively
|
||||
* receive notifications via mach port, dispatch, or signal, via <code>notify.h</code>
|
||||
* using the name <code>@link kIOPSTimeRemainingNotificationKey @/link</code>.
|
||||
*
|
||||
* IOKit delivers this notification when percent remaining or time remaining changes.
|
||||
* Thus it fires fairly frequently while discharging or charging the battery;
|
||||
* please consider using:
|
||||
* <code>@link IOPSCreateLimitedPowerNotification @/link</code> if you only require
|
||||
* notifications when the power source type changes from limited to unlimited.
|
||||
*
|
||||
* @param callback A function to be called whenever any power source is added, removed, or changes.
|
||||
*
|
||||
* @param context Any user-defined pointer, passed to the IOPowerSource callback.
|
||||
*
|
||||
* @result Returns NULL if an error was encountered, otherwise a CFRunLoopSource. Caller must
|
||||
* release the CFRunLoopSource.
|
||||
*/
|
||||
CFRunLoopSourceRef IOPSNotificationCreateRunLoopSource(IOPowerSourceCallbackType callback, void *context);
|
||||
|
||||
/*! @function IOPSCreateLimitedPowerNotification
|
||||
*
|
||||
* @abstract Returns a CFRunLoopSourceRef that notifies the caller when power source
|
||||
* changes from an unlimited power source (like attached to wall, car, or airplane power), to a limited
|
||||
* power source (like a battery or UPS).
|
||||
*
|
||||
* @discussion Returns a CFRunLoopSourceRef for scheduling with your CFRunLoop.
|
||||
* If your project does not use a CFRunLoop, you can alternatively
|
||||
* receive this notification via <code>notify.h</code>
|
||||
* using the name <code>@link kIOPSNotifyPowerSource @/link</code>
|
||||
*
|
||||
* @param callback A function to be called whenever the power source changes from AC to DC..
|
||||
*
|
||||
* @param context Any user-defined pointer, passed to the IOPowerSource callback.
|
||||
*
|
||||
* @result Returns NULL if an error was encountered, otherwise a CFRunLoopSource. Caller must
|
||||
* release the CFRunLoopSource.
|
||||
*/
|
||||
CFRunLoopSourceRef IOPSCreateLimitedPowerNotification(IOPowerSourceCallbackType callback, void *context) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
|
||||
|
||||
/*! @function IOPSCopyExternalPowerAdapterDetails
|
||||
*
|
||||
* @abstract Returns a CFDictionary that describes the attached (AC) external
|
||||
* power adapter (if any external power adapter is attached.
|
||||
*
|
||||
* @discussion Use the kIOPSPowerAdapter... keys described in IOPSKeys.h
|
||||
* to interpret the returned CFDictionary.
|
||||
*
|
||||
* @result Returns a CFDictionary on success. Caller must release the returned
|
||||
* dictionary. If no adapter is attached, or if there's an error, returns NULL.
|
||||
*/
|
||||
CFDictionaryRef IOPSCopyExternalPowerAdapterDetails(void);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _IOKIT_IOPOWERSOURCES_H */
|
||||
@@ -0,0 +1,257 @@
|
||||
/*
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
/*!
|
||||
@header IOUPSPlugIn.h
|
||||
|
||||
IOUPSPlugIn.h is the header that defines the software used by ioupsd in user-space to communicate with
|
||||
UPS devices.
|
||||
<p>
|
||||
<b>NOTE:</b>
|
||||
Kernel extensions should have the following key/value pair in their personality in order to be
|
||||
recognized by ioupsd:
|
||||
<pre>
|
||||
<key>UPSDevice</key>
|
||||
<true/>
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
To communicate with a UPS device, an instance of IOUPSPlugInInterface (a struct which is defined below)
|
||||
is created. The methods of IOUPSPlugInInterface allow ioupsd to communicate with the device.
|
||||
</p>
|
||||
<p>
|
||||
To obtain an IOUPSPlugInInterface for a UPS device, use the function IOCreatePlugInInterfaceForService()
|
||||
defined in IOKit/IOCFPlugIn.h. (Note the "i" in "PlugIn" is
|
||||
always upper-case.) Quick usage reference:<br>
|
||||
<ul>
|
||||
<li>'service' is a reference to the IOKit registry entry of the kernel object
|
||||
(usually of type IOHIDDevice) representing the device
|
||||
of interest. This reference can be obtained using the functions defined in
|
||||
IOKit/IOKitLib.h.</li>
|
||||
<li>'plugInType' should be CFUUIDGetUUIDBytes(kIOCFPlugInInterfaceID)</li>
|
||||
<li>'interfaceType' should be CFUUIDGetUUIDBytes(kIOUPSPlugInTypeID) when using IOUPSPlugIn</li>
|
||||
</ul>
|
||||
The interface returned by IOCreatePlugInInterfaceForService() should be deallocated using
|
||||
IODestroyPlugInInterface(). Do not call Release() on it.
|
||||
</p>
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_PM_IOUPSPLUGIN_H
|
||||
#define _IOKIT_PM_IOUPSPLUGIN_H
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/IOCFPlugIn.h>
|
||||
|
||||
|
||||
/* 40A57A4E-26A0-11D8-9295-000A958A2C78 */
|
||||
/*!
|
||||
@define kIOUPSPlugInTypeID
|
||||
@discussion Type ID for the IOUPSPlugInInterface. Corresponds to an
|
||||
available UPS device.
|
||||
*/
|
||||
#define kIOUPSPlugInTypeID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x40, 0xa5, 0x7a, 0x4e, 0x26, 0xa0, 0x11, 0xd8, \
|
||||
0x92, 0x95, 0x00, 0x0a, 0x95, 0x8a, 0x2c, 0x78)
|
||||
|
||||
/* 63F8BFC4-26A0-11D8-88B4-000A958A2C78 */
|
||||
/*!
|
||||
@define kIOUPSPlugInInterfaceID
|
||||
@discussion Interface ID for the IOUPSPlugInInterface. Corresponds to an
|
||||
available UPS device.
|
||||
*/
|
||||
#define kIOUPSPlugInInterfaceID CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0x63, 0xf8, 0xbf, 0xc4, 0x26, 0xa0, 0x11, 0xd8, \
|
||||
0x88, 0xb4, 0x0, 0xa, 0x95, 0x8a, 0x2c, 0x78)
|
||||
|
||||
/* E60E0799-9AA6-49DF-B55B-A5C94BA07A4A */
|
||||
/*!
|
||||
@define kIOUPSPlugInInterfaceID_v140
|
||||
@discussion Interface ID for the IOUPSPlugInInterface. Corresponds to an
|
||||
available UPS device.
|
||||
*/
|
||||
#define kIOUPSPlugInInterfaceID_v140 CFUUIDGetConstantUUIDWithBytes(NULL, \
|
||||
0xe6, 0xe, 0x7, 0x99, 0x9a, 0xa6, 0x49, 0xdf, \
|
||||
0xb5, 0x5b, 0xa5, 0xc9, 0x4b, 0xa0, 0x7a, 0x4a)
|
||||
|
||||
|
||||
/*!
|
||||
@typedef IOUPSEventCallbackFunction
|
||||
@discussion Type and arguments of callout C function that is used when a
|
||||
completion routine is called. This function pointer is set
|
||||
via setEventCallback and is called when an event is available
|
||||
from the UPS.
|
||||
@param target void * pointer to your data, often a pointer to an object.
|
||||
@param result Completion result of desired operation.
|
||||
@param refcon void * pointer to more data.
|
||||
@param sender Interface instance sending the completion routine.
|
||||
@param event CFDictionaryRef containing event data.
|
||||
*/
|
||||
typedef void (*IOUPSEventCallbackFunction)
|
||||
(void * target,
|
||||
IOReturn result,
|
||||
void * refcon,
|
||||
void * sender,
|
||||
CFDictionaryRef event);
|
||||
|
||||
#define IOUPSPLUGINBASE \
|
||||
IOReturn (*getProperties)( void * thisPointer, \
|
||||
CFDictionaryRef * properties); \
|
||||
IOReturn (*getCapabilities)(void * thisPointer, \
|
||||
CFSetRef * capabilities); \
|
||||
IOReturn (*getEvent)( void * thisPointer, \
|
||||
CFDictionaryRef * event); \
|
||||
IOReturn (*setEventCallback)(void * thisPointer, \
|
||||
IOUPSEventCallbackFunction callback, \
|
||||
void * callbackTarget, \
|
||||
void * callbackRefcon); \
|
||||
IOReturn (*sendCommand)( void * thisPointer, \
|
||||
CFDictionaryRef command)
|
||||
|
||||
#define IOUPSPLUGIN_V140 \
|
||||
IOReturn (*createAsyncEventSource)(void * thisPointer, \
|
||||
CFTypeRef * source)
|
||||
|
||||
|
||||
typedef struct IOUPSPlugInInterface {
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOUPSPLUGINBASE;
|
||||
} IOUPSPlugInInterface;
|
||||
|
||||
typedef struct IOUPSPlugInInterface_v140 {
|
||||
IUNKNOWN_C_GUTS;
|
||||
IOUPSPLUGINBASE;
|
||||
IOUPSPLUGIN_V140;
|
||||
} IOUPSPlugInInterface_v140;
|
||||
|
||||
//
|
||||
// BEGIN READABLE STRUCTURE DEFINITIONS
|
||||
//
|
||||
// This portion of uncompiled code provides a more reader friendly representation of
|
||||
// the CFPlugin methods defined above.
|
||||
|
||||
#if 0
|
||||
/*!
|
||||
@interface IOUPSPlugInInterface
|
||||
@discussion Represents and provides management functions for a UPS device.
|
||||
*/
|
||||
|
||||
typedef struct IOUPSPlugInInterface {
|
||||
IUNKNOWN_C_GUTS;
|
||||
|
||||
/*!
|
||||
@function getProperties
|
||||
@abstract Used to obtain the properties of the UPS device such as the
|
||||
name and transport.
|
||||
@discussion Property keys are defined in IOPSKeys.h. This is not an
|
||||
allocation method. Thus the caller does not release the
|
||||
CFDictionary that is returned.
|
||||
@param thisPointer The UPS Interface to use.
|
||||
@param properties Pointer to a CFDictionaryRef that contains
|
||||
the properties.
|
||||
@result An IOReturn error code.
|
||||
*/
|
||||
IOReturn (*getProperties)( void * thisPointer,
|
||||
CFDictionaryRef * properties);
|
||||
|
||||
/*!
|
||||
@function getCapabilities
|
||||
@abstract Used to obtain the capabilities of the UPS device.
|
||||
@discussion Keys are defined in IOPSKeys.h and begin with kIOPS. This
|
||||
is not an allocation method. Thus the caller does not
|
||||
release the CFSet that is returned.
|
||||
@param thisPointer The UPS Interface to use.
|
||||
@param capabilities Pointer to a CFSetRef that contains the
|
||||
capabilities.
|
||||
@result An IOReturn error code.
|
||||
*/
|
||||
IOReturn (*getCapabilities)(void * thisPointer,
|
||||
CFSetRef * capabilities);
|
||||
|
||||
/*!
|
||||
@function getEvent
|
||||
@abstract Used to poll the current state of the UPS.
|
||||
@discussion Keys are defined in IOPSKeys.h and begin with kIOPS. This
|
||||
is not an allocation method. Thus the caller does not
|
||||
release the CFDictionary that is returned.
|
||||
@param thisPointer The UPS Interface to use.
|
||||
@param event Pointer to a CFDictionaryRef that contains
|
||||
the current event state.
|
||||
@result An IOReturn error code.
|
||||
*/
|
||||
IOReturn (*getEvent)( void * thisPointer,
|
||||
CFDictionaryRef * event);
|
||||
|
||||
/*!
|
||||
@function setEventCallback
|
||||
@abstract Set the callback that should be called to handle an event
|
||||
from the UPS.
|
||||
@discussion The proivided callback method should be called whenever there
|
||||
is a change of state in the UPS. This should be used in
|
||||
conjunction with createAsyncEventSource.
|
||||
@param thisPointer The UPS Interface to use.
|
||||
@param callback A callback handler of type
|
||||
IOUPSEventCallbackFunction.
|
||||
@param callbackTarget The address to be targeted by this callback.
|
||||
@param callbackRefcon A user specified reference value. This will
|
||||
be passed to all callback functions.
|
||||
@result An IOReturn error code.
|
||||
*/
|
||||
IOReturn (*setEventCallback)(void * thisPointer,
|
||||
IOUPSEventCallbackFunction callback,
|
||||
void * callbackTarget,
|
||||
void * callbackRefcon);
|
||||
|
||||
/*!
|
||||
@function sendCommand
|
||||
@abstract Send a command to the UPS.
|
||||
@discussion Command keys are defined in IOPSKeys.h and begin with
|
||||
kIOPSCommand. An error should be returned if your device does
|
||||
not know how to respond to a command.
|
||||
@param thisPointer The UPS Interface to use.
|
||||
@param command CFDictionaryRef that contains the command.
|
||||
@result An IOReturn error code.
|
||||
*/
|
||||
IOReturn (*sendCommand)( void * thisPointer,
|
||||
CFDictionaryRef command);
|
||||
|
||||
/*!
|
||||
@function createAsyncEventSource
|
||||
@abstract Used to create an async run loop event source of the plugin.
|
||||
@discussion This is an allocation method. Thus the caller must
|
||||
release the object that is returned.
|
||||
@param thisPointer The UPS Interface to use.
|
||||
@param source Pointer to a CFTypeRef. It is expected that this
|
||||
point to either a CFRunLoopSourceRef, a
|
||||
CFRunLoopTimerRef or a CFArray containing the
|
||||
aforementioned types.
|
||||
@result An IOReturn error code.
|
||||
*/
|
||||
IOReturn (*createAsyncEventSource)( void * thisPointer,
|
||||
CFTypeRef * source);
|
||||
|
||||
|
||||
} IOUPSPlugInInterface;
|
||||
#endif
|
||||
|
||||
// END READABLE STRUCTURE DEFINITIONS
|
||||
|
||||
#endif /* !_IOKIT_PM_IOUPSPLUGIN_H */
|
||||
@@ -0,0 +1,945 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2005 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
#ifndef _IOKIT_IOPM_H
|
||||
#define _IOKIT_IOPM_H
|
||||
|
||||
#include <IOKit/IOTypes.h>
|
||||
#include <IOKit/IOMessage.h>
|
||||
#include <IOKit/IOReturn.h>
|
||||
|
||||
/*! @header IOPM.h
|
||||
* @abstract Defines power management constants and keys used by both in-kernel and user space power management.
|
||||
* @discussion IOPM.h defines a range of power management constants used in several in-kernel and user space APIs. Most significantly, the IOPMPowerFlags used to specify the fields of an IOPMPowerState struct are defined here.
|
||||
*
|
||||
* Most of the constants defined in IOPM.h are deprecated or for Apple internal use only, and are not elaborated on in headerdoc.
|
||||
*/
|
||||
|
||||
enum {
|
||||
kIOPMMaxPowerStates = 10,
|
||||
IOPMMaxPowerStates = kIOPMMaxPowerStates
|
||||
};
|
||||
|
||||
/*! @enum IOPMPowerFlags
|
||||
* @abstract Bits are used in defining capabilityFlags, inputPowerRequirements, and outputPowerCharacter in the IOPMPowerState structure.
|
||||
* @discussion These bits may be bitwise-OR'd together in the IOPMPowerState capabilityFlags field, the outputPowerCharacter field, and/or the inputPowerRequirement field.
|
||||
*
|
||||
* The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three.
|
||||
*
|
||||
* The value of capabilityFlags, inputPowerRequirement or outputPowerCharacter may be 0. Most drivers implement their 'OFF' state, used when asleep, by defininf each of the 3 fields as 0.
|
||||
*
|
||||
* The bits listed below are only the most common bits used to define a device's power states. Your device's IO family may require that your device specify other input or output power flags to interact properly. Consult family-specific documentation to determine if your IOPower plane parents or children require other power flags; they probably don't.
|
||||
*
|
||||
* @constant kIOPMPowerOn Indicates the device is on, requires power, and provides power. Useful as a: Capability, InputPowerRequirement, OutputPowerCharacter
|
||||
*
|
||||
* @constant kIOPMDeviceUsable Indicates the device is usable in this state. Useful only as a Capability
|
||||
*
|
||||
* @constant kIOPMLowPower
|
||||
* Indicates device is in a low power state. May be bitwis-OR'd together
|
||||
* with kIOPMDeviceUsable flag, to indicate the device is still usable.
|
||||
*
|
||||
* A device with a capability of kIOPMLowPower may:
|
||||
* Require either 0 or kIOPMPowerOn from its power parent
|
||||
* Offer either kIOPMLowPower, kIOPMPowerOn, or 0 (no power at all)
|
||||
* to its power plane children.
|
||||
*
|
||||
* Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit.
|
||||
*
|
||||
* @constant kIOPMPreventIdleSleep
|
||||
* In the capability field of a power state, disallows idle system sleep while the device is in that state.
|
||||
*
|
||||
* For example, displays and disks set this capability for their ON power state; since the system may not idle sleep while the display (and thus keyboard or mouse) or the disk is active.
|
||||
*
|
||||
* Useful only as a Capability.
|
||||
*
|
||||
* @constant kIOPMSleepCapability
|
||||
* Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
|
||||
*
|
||||
* @constant kIOPMRestartCapability
|
||||
* Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
|
||||
*
|
||||
* @constant kIOPMSleep
|
||||
* Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
|
||||
*
|
||||
* @constant kIOPMRestart
|
||||
* Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
|
||||
*
|
||||
* @constant kIOPMInitialDeviceState
|
||||
* Indicates the initial power state for the device. If <code>initialPowerStateForDomainState()</code> returns a power state with this flag set in the capability field, then the initial power change is performed without calling the driver's <code>setPowerState()</code>.
|
||||
*
|
||||
* @constant kIOPMRootDomainState
|
||||
* An indication that the power flags represent the state of the root power
|
||||
* domain. This bit must not be set in the IOPMPowerState structure.
|
||||
* Power Management may pass this bit to initialPowerStateForDomainState()
|
||||
* to map from a global system state to the desired device state.
|
||||
*/
|
||||
typedef unsigned long IOPMPowerFlags;
|
||||
enum {
|
||||
kIOPMPowerOn = 0x00000002,
|
||||
kIOPMDeviceUsable = 0x00008000,
|
||||
kIOPMLowPower = 0x00010000,
|
||||
kIOPMPreventIdleSleep = 0x00000040,
|
||||
kIOPMSleepCapability = 0x00000004,
|
||||
kIOPMRestartCapability = 0x00000080,
|
||||
kIOPMSleep = 0x00000001,
|
||||
kIOPMRestart = 0x00000080,
|
||||
kIOPMInitialDeviceState = 0x00000100,
|
||||
kIOPMRootDomainState = 0x00000200
|
||||
};
|
||||
|
||||
/*
|
||||
* Private IOPMPowerFlags
|
||||
*
|
||||
* For Apple use only
|
||||
* Not for use with non-Apple drivers
|
||||
* Their behavior is undefined
|
||||
*/
|
||||
enum {
|
||||
kIOPMClockNormal = 0x0004,
|
||||
kIOPMClockRunning = 0x0008,
|
||||
kIOPMPreventSystemSleep = 0x0010,
|
||||
kIOPMDoze = 0x0400,
|
||||
kIOPMChildClamp = 0x0080,
|
||||
kIOPMChildClamp2 = 0x0200,
|
||||
kIOPMNotPowerManaged = 0x0800
|
||||
};
|
||||
|
||||
/*
|
||||
* Deprecated IOPMPowerFlags
|
||||
* Their behavior is undefined when used in IOPMPowerState
|
||||
* Capability, InputPowerRequirement, or OutputPowerCharacter fields.
|
||||
*/
|
||||
enum {
|
||||
kIOPMMaxPerformance = 0x4000,
|
||||
kIOPMPassThrough = 0x0100,
|
||||
kIOPMAuxPowerOn = 0x0020,
|
||||
kIOPMNotAttainable = 0x0001,
|
||||
kIOPMContextRetained = 0x2000,
|
||||
kIOPMConfigRetained = 0x1000,
|
||||
kIOPMStaticPowerValid = 0x0800,
|
||||
kIOPMSoftSleep = 0x0400,
|
||||
kIOPMCapabilitiesMask = kIOPMPowerOn | kIOPMDeviceUsable |
|
||||
kIOPMMaxPerformance | kIOPMContextRetained |
|
||||
kIOPMConfigRetained | kIOPMSleepCapability |
|
||||
kIOPMRestartCapability
|
||||
};
|
||||
|
||||
/*
|
||||
* Support for old names of IOPMPowerFlag constants
|
||||
*/
|
||||
enum {
|
||||
IOPMNotAttainable = kIOPMNotAttainable,
|
||||
IOPMPowerOn = kIOPMPowerOn,
|
||||
IOPMClockNormal = kIOPMClockNormal,
|
||||
IOPMClockRunning = kIOPMClockRunning,
|
||||
IOPMAuxPowerOn = kIOPMAuxPowerOn,
|
||||
IOPMDeviceUsable = kIOPMDeviceUsable,
|
||||
IOPMMaxPerformance = kIOPMMaxPerformance,
|
||||
IOPMContextRetained = kIOPMContextRetained,
|
||||
IOPMConfigRetained = kIOPMConfigRetained,
|
||||
IOPMNotPowerManaged = kIOPMNotPowerManaged,
|
||||
IOPMSoftSleep = kIOPMSoftSleep
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
kIOPMNextHigherState = 1,
|
||||
kIOPMHighestState = 2,
|
||||
kIOPMNextLowerState = 3,
|
||||
kIOPMLowestState = 4
|
||||
};
|
||||
|
||||
enum {
|
||||
IOPMNextHigherState = kIOPMNextHigherState,
|
||||
IOPMHighestState = kIOPMHighestState,
|
||||
IOPMNextLowerState = kIOPMNextLowerState,
|
||||
IOPMLowestState = kIOPMLowestState
|
||||
};
|
||||
|
||||
// Internal commands used by power managment command queue
|
||||
enum {
|
||||
kIOPMBroadcastAggressiveness = 1,
|
||||
kIOPMUnidleDevice
|
||||
};
|
||||
|
||||
// Power consumption unknown value
|
||||
enum {
|
||||
kIOPMUnknown = 0xFFFF
|
||||
};
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Root Domain property keys of interest
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* AppleClamshellState
|
||||
* reflects the state of the clamshell (lid) on a portable.
|
||||
* It has a boolean value.
|
||||
* true == clamshell is closed
|
||||
* false == clamshell is open
|
||||
* not present == no clamshell on this hardware
|
||||
*/
|
||||
#define kAppleClamshellStateKey "AppleClamshellState"
|
||||
|
||||
/* AppleClamshellCausesSleep
|
||||
* reflects the clamshell close behavior on a portable.
|
||||
* It has a boolean value.
|
||||
* true == system will sleep when clamshell is closed
|
||||
* false == system will not sleep on clamshell close
|
||||
* (typically external display mode)
|
||||
* not present == no clamshell on this hardware
|
||||
*/
|
||||
#define kAppleClamshellCausesSleepKey "AppleClamshellCausesSleep"
|
||||
|
||||
/* kIOPMSleepWakeUUIDKey
|
||||
* Key refers to a CFStringRef that will uniquely identify
|
||||
* a sleep/wake cycle for logging & tracking.
|
||||
* The key becomes valid at the beginning of a sleep cycle - before we
|
||||
* initiate any sleep/wake notifications.
|
||||
* The key becomes invalid at the completion of a system wakeup. The
|
||||
* property will not be present in the IOPMrootDomain's registry entry
|
||||
* when it is invalid.
|
||||
*
|
||||
* See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange
|
||||
*/
|
||||
#define kIOPMSleepWakeUUIDKey "SleepWakeUUID"
|
||||
|
||||
/* kIOPMBootSessionUUIDKey
|
||||
* Key refers to a CFStringRef that will uniquely identify
|
||||
* a boot cycle.
|
||||
* The key becomes valid at boot time and remains valid
|
||||
* till shutdown. The property value will remain same across
|
||||
* sleep/wake/hibernate cycle.
|
||||
*/
|
||||
#define kIOPMBootSessionUUIDKey "BootSessionUUID"
|
||||
|
||||
/* kIOPMDeepSleepEnabledKey
|
||||
* Indicates the Deep Sleep enable state.
|
||||
* It has a boolean value.
|
||||
* true == Deep Sleep is enabled
|
||||
* false == Deep Sleep is disabled
|
||||
* not present == Deep Sleep is not supported on this hardware
|
||||
*/
|
||||
#define kIOPMDeepSleepEnabledKey "Standby Enabled"
|
||||
|
||||
/* kIOPMDeepSleepDelayKey
|
||||
* Key refers to a CFNumberRef that represents the delay in seconds before
|
||||
* entering Deep Sleep state when on battery power and when remaining
|
||||
* battery capacity is below a particular threshold (e.g., 50%.) The
|
||||
* property is not present if Deep Sleep is unsupported.
|
||||
*/
|
||||
#define kIOPMDeepSleepDelayKey "Standby Delay"
|
||||
|
||||
/* kIOPMDeepSleepDelayHighKey
|
||||
* Key refers to a CFNumberRef that represents the delay in seconds before
|
||||
* entering Deep Sleep state. This is used instead of the value specified by
|
||||
* kIOPMDeepSleepDelayKey if the remaining battery capacity is above a
|
||||
* particular threshold (e.g. 50%) or on AC power. The property is not
|
||||
* present if Deep Sleep is unsupported.
|
||||
*/
|
||||
#define kIOPMDeepSleepDelayHighKey "High Standby Delay"
|
||||
|
||||
/* kIOPMLowBatteryThresholdKey
|
||||
* Key refers to a CFNumberRef that represents the threshold used to choose
|
||||
* between the normal deep sleep delay and the high deep sleep delay (as a
|
||||
* percentage of total battery capacity remaining.) The property is not
|
||||
* present if Deep Sleep is unsupported.
|
||||
*/
|
||||
#define kIOPMStandbyBatteryThresholdKey "Standby Battery Threshold"
|
||||
|
||||
/* kIOPMDestroyFVKeyOnStandbyKey
|
||||
* Specifies if FileVault key can be stored when going to standby mode
|
||||
* It has a boolean value,
|
||||
* true == Destroy FV key when going to standby mode
|
||||
* false == Retain FV key when going to standby mode
|
||||
* not present == Retain FV key when going to standby mode
|
||||
*/
|
||||
#define kIOPMDestroyFVKeyOnStandbyKey "DestroyFVKeyOnStandby"
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Properties that can control power management behavior
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* kIOPMResetPowerStateOnWakeKey
|
||||
* If an IOService publishes this key with the value of kOSBooleanTrue,
|
||||
* then PM will disregard the influence from changePowerStateToPriv() or
|
||||
* any activity tickles that occurred before system sleep when resolving
|
||||
* the initial device power state on wake. Influences from power children
|
||||
* and changePowerStateTo() are not eliminated. At the earliest opportunity
|
||||
* upon system wake, PM will query the driver for a new power state to be
|
||||
* installed as the initial changePowerStateToPriv() influence, by calling
|
||||
* initialPowerStateForDomainState() with both kIOPMRootDomainState and
|
||||
* kIOPMPowerOn flags set. The default implementation will always return
|
||||
* the lowest power state. Drivers can override this default behavior to
|
||||
* immediately raise the power state when there are work blocked on the
|
||||
* power change, and cannot afford to wait until the next activity tickle.
|
||||
* This property should be statically added to a driver's plist or set at
|
||||
* runtime before calling PMinit().
|
||||
*/
|
||||
#define kIOPMResetPowerStateOnWakeKey "IOPMResetPowerStateOnWake"
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Driver PM Assertions
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* Driver Assertion bitfield description
|
||||
* Driver PM assertions are defined by these bits.
|
||||
*/
|
||||
enum {
|
||||
/*! kIOPMDriverAssertionCPUBit
|
||||
* When set, PM kernel will prefer to leave the CPU and core hardware
|
||||
* running in "Dark Wake" state, instead of sleeping.
|
||||
*/
|
||||
kIOPMDriverAssertionCPUBit = 0x01,
|
||||
|
||||
/*! kIOPMDriverAssertionPreventSystemIdleSleepBit
|
||||
* When set, the system should not idle sleep. This does not prevent
|
||||
* demand sleep.
|
||||
*/
|
||||
kIOPMDriverAssertionPreventSystemIdleSleepBit = 0x02,
|
||||
|
||||
/*! kIOPMDriverAssertionUSBExternalDeviceBit
|
||||
* When set, driver is informing PM that an external USB device is attached.
|
||||
*/
|
||||
kIOPMDriverAssertionUSBExternalDeviceBit = 0x04,
|
||||
|
||||
/*! kIOPMDriverAssertionBluetoothHIDDevicePairedBit
|
||||
* When set, driver is informing PM that a Bluetooth HID device is paired.
|
||||
*/
|
||||
kIOPMDriverAssertionBluetoothHIDDevicePairedBit = 0x08,
|
||||
|
||||
/*! kIOPMDriverAssertionExternalMediaMountedBit
|
||||
* When set, driver is informing PM that an external media is mounted.
|
||||
*/
|
||||
kIOPMDriverAssertionExternalMediaMountedBit = 0x10,
|
||||
|
||||
/*! kIOPMDriverAssertionReservedBit5
|
||||
* Reserved for Thunderbolt.
|
||||
*/
|
||||
kIOPMDriverAssertionReservedBit5 = 0x20,
|
||||
|
||||
/*! kIOPMDriverAssertionPreventDisplaySleepBit
|
||||
* When set, the display should remain powered on while the system's awake.
|
||||
*/
|
||||
kIOPMDriverAssertionPreventDisplaySleepBit = 0x40,
|
||||
|
||||
/*! kIOPMDriverAssertionReservedBit7
|
||||
* Reserved for storage family.
|
||||
*/
|
||||
kIOPMDriverAssertionReservedBit7 = 0x80,
|
||||
|
||||
/*! kIOPMDriverAssertionMagicPacketWakeEnabledBit
|
||||
* When set, driver is informing PM that magic packet wake is enabled.
|
||||
*/
|
||||
kIOPMDriverAssertionMagicPacketWakeEnabledBit = 0x100,
|
||||
|
||||
/*! kIOPMDriverAssertionNetworkKeepAliveActiveBit
|
||||
* When set, driver is informing PM that it is holding the network
|
||||
* interface up to do TCPKeepAlive
|
||||
*/
|
||||
kIOPMDriverAssertionNetworkKeepAliveActiveBit = 0x200
|
||||
};
|
||||
|
||||
/* kIOPMAssertionsDriverKey
|
||||
* This kIOPMrootDomain key refers to a CFNumberRef property, containing
|
||||
* a bitfield describing the aggregate PM assertion levels.
|
||||
* Example: A value of 0 indicates that no driver has asserted anything.
|
||||
* Or, a value of <link>kIOPMDriverAssertionCPUBit</link>
|
||||
* indicates that a driver (or drivers) have asserted a need for CPU and video.
|
||||
*/
|
||||
#define kIOPMAssertionsDriverKey "DriverPMAssertions"
|
||||
|
||||
/* kIOPMAssertionsDriverKey
|
||||
* This kIOPMrootDomain key refers to a CFNumberRef property, containing
|
||||
* a bitfield describing the aggregate PM assertion levels.
|
||||
* Example: A value of 0 indicates that no driver has asserted anything.
|
||||
* Or, a value of <link>kIOPMDriverAssertionCPUBit</link>
|
||||
* indicates that a driver (or drivers) have asserted a need for CPU and video.
|
||||
*/
|
||||
#define kIOPMAssertionsDriverDetailedKey "DriverPMAssertionsDetailed"
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Kernel Driver assertion detailed dictionary keys
|
||||
*
|
||||
* Keys decode the Array & dictionary data structure under IOPMrootDomain property
|
||||
* kIOPMAssertionsDriverKey.
|
||||
*
|
||||
*/
|
||||
#define kIOPMDriverAssertionIDKey "ID"
|
||||
#define kIOPMDriverAssertionCreatedTimeKey "CreatedTime"
|
||||
#define kIOPMDriverAssertionModifiedTimeKey "ModifiedTime"
|
||||
#define kIOPMDriverAssertionOwnerStringKey "Owner"
|
||||
#define kIOPMDriverAssertionOwnerServiceKey "ServicePtr"
|
||||
#define kIOPMDriverAssertionRegistryEntryIDKey "RegistryEntryID"
|
||||
#define kIOPMDriverAssertionLevelKey "Level"
|
||||
#define kIOPMDriverAssertionAssertedKey "Assertions"
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Root Domain general interest messages
|
||||
*
|
||||
* Available by registering for interest type 'gIOGeneralInterest'
|
||||
* on IOPMrootDomain.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
/* kIOPMMessageClamshellStateChange
|
||||
* Delivered as a general interest notification on the IOPMrootDomain
|
||||
* IOPMrootDomain sends this message when state of either AppleClamshellState
|
||||
* or AppleClamshellCausesSleep changes. If this clamshell change results in
|
||||
* a sleep, the sleep will initiate soon AFTER delivery of this message.
|
||||
* The state of both variables is encoded in a bitfield argument sent with
|
||||
* the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit
|
||||
*/
|
||||
enum {
|
||||
kClamshellStateBit = (1 << 0),
|
||||
kClamshellSleepBit = (1 << 1)
|
||||
};
|
||||
|
||||
#define kIOPMMessageClamshellStateChange \
|
||||
iokit_family_msg(sub_iokit_powermanagement, 0x100)
|
||||
|
||||
/* kIOPMMessageFeatureChange
|
||||
* Delivered when the set of supported features ("Supported Features" dictionary
|
||||
* under IOPMrootDomain registry) changes in some way. Typically addition or
|
||||
* removal of a supported feature.
|
||||
* RootDomain passes no argument with this message.
|
||||
*/
|
||||
#define kIOPMMessageFeatureChange \
|
||||
iokit_family_msg(sub_iokit_powermanagement, 0x110)
|
||||
|
||||
/* kIOPMMessageInflowDisableCancelled
|
||||
* The battery has drained completely to its "Fully Discharged" state.
|
||||
* If a user process has disabled battery inflow for battery
|
||||
* calibration, we forcibly re-enable Inflow at this point.
|
||||
* If inflow HAS been forcibly re-enabled, bit 0
|
||||
* (kInflowForciblyEnabledBit) will be set.
|
||||
*/
|
||||
enum {
|
||||
kInflowForciblyEnabledBit = (1 << 0)
|
||||
};
|
||||
|
||||
/* kIOPMMessageInternalBatteryFullyDischarged
|
||||
* The battery has drained completely to its "Fully Discharged" state.
|
||||
*/
|
||||
#define kIOPMMessageInternalBatteryFullyDischarged \
|
||||
iokit_family_msg(sub_iokit_powermanagement, 0x120)
|
||||
|
||||
/* kIOPMMessageSystemPowerEventOccurred
|
||||
* Some major system thermal property has changed, and interested clients may
|
||||
* modify their behavior.
|
||||
*/
|
||||
#define kIOPMMessageSystemPowerEventOccurred \
|
||||
iokit_family_msg(sub_iokit_powermanagement, 0x130)
|
||||
|
||||
/* kIOPMMessageSleepWakeUUIDChange
|
||||
* Either a new SleepWakeUUID has been specified at the beginning of a sleep,
|
||||
* or we're removing the existing property upon completion of a wakeup.
|
||||
*/
|
||||
#define kIOPMMessageSleepWakeUUIDChange \
|
||||
iokit_family_msg(sub_iokit_powermanagement, 0x140)
|
||||
|
||||
/* kIOPMMessageSleepWakeUUIDSet
|
||||
* Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
|
||||
* a new UUID has been specified.
|
||||
*/
|
||||
#define kIOPMMessageSleepWakeUUIDSet ((void *)1)
|
||||
|
||||
/* kIOPMMessageSleepWakeUUIDCleared
|
||||
* Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
|
||||
* the current UUID has been removed.
|
||||
*/
|
||||
#define kIOPMMessageSleepWakeUUIDCleared ((void *)NULL)
|
||||
|
||||
/*! kIOPMMessageDriverAssertionsChanged
|
||||
* Sent when kernel PM driver assertions have changed.
|
||||
*/
|
||||
#define kIOPMMessageDriverAssertionsChanged \
|
||||
iokit_family_msg(sub_iokit_powermanagement, 0x150)
|
||||
|
||||
/*! kIOPMMessageDarkWakeThermalEmergency
|
||||
* Sent when machine becomes unsustainably warm in DarkWake.
|
||||
* Kernel PM might choose to put the machine back to sleep right after.
|
||||
*/
|
||||
#define kIOPMMessageDarkWakeThermalEmergency \
|
||||
iokit_family_msg(sub_iokit_powermanagement, 0x160)
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Power commands issued to root domain
|
||||
* Use with IOPMrootDomain::receivePowerNotification()
|
||||
*
|
||||
* These commands are issued from system drivers only:
|
||||
* ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily
|
||||
*
|
||||
* TODO: deprecate kIOPMAllowSleep and kIOPMPreventSleep
|
||||
******************************************************************************/
|
||||
enum {
|
||||
kIOPMSleepNow = (1 << 0),// put machine to sleep now
|
||||
kIOPMAllowSleep = (1 << 1),// allow idle sleep
|
||||
kIOPMPreventSleep = (1 << 2),// do not allow idle sleep
|
||||
kIOPMPowerButton = (1 << 3),// power button was pressed
|
||||
kIOPMClamshellClosed = (1 << 4),// clamshell was closed
|
||||
kIOPMPowerEmergency = (1 << 5),// battery dangerously low
|
||||
kIOPMDisableClamshell = (1 << 6),// do not sleep on clamshell closure
|
||||
kIOPMEnableClamshell = (1 << 7),// sleep on clamshell closure
|
||||
kIOPMProcessorSpeedChange = (1 << 8),// change the processor speed
|
||||
kIOPMOverTemp = (1 << 9),// system dangerously hot
|
||||
kIOPMClamshellOpened = (1 << 10),// clamshell was opened
|
||||
kIOPMDWOverTemp = (1 << 11),// DarkWake thermal limits exceeded.
|
||||
kIOPMPowerButtonUp = (1 << 12),// Power button up
|
||||
kIOPMProModeEngaged = (1 << 13),// Fans entered 'ProMode'
|
||||
kIOPMProModeDisengaged = (1 << 14) // Fans exited 'ProMode'
|
||||
};
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Power Management Return Codes
|
||||
*
|
||||
******************************************************************************/
|
||||
enum {
|
||||
kIOPMNoErr = 0,
|
||||
|
||||
// Returned by driver's setPowerState(), powerStateWillChangeTo(),
|
||||
// powerStateDidChangeTo(), or acknowledgeSetPowerState() to
|
||||
// implicitly acknowledge power change upon function return.
|
||||
kIOPMAckImplied = 0,
|
||||
|
||||
// Deprecated
|
||||
kIOPMWillAckLater = 1,
|
||||
|
||||
// Returned by requestPowerDomainState() to indicate
|
||||
// unrecognized specification parameter.
|
||||
kIOPMBadSpecification = 4,
|
||||
|
||||
// Returned by requestPowerDomainState() to indicate
|
||||
// no power state matches search specification.
|
||||
kIOPMNoSuchState = 5,
|
||||
|
||||
// Deprecated
|
||||
kIOPMCannotRaisePower = 6,
|
||||
|
||||
// Deprecated
|
||||
kIOPMParameterError = 7,
|
||||
|
||||
// Returned when power management state is accessed
|
||||
// before driver has called PMinit().
|
||||
kIOPMNotYetInitialized = 8,
|
||||
|
||||
// And the old constants; deprecated
|
||||
IOPMNoErr = kIOPMNoErr,
|
||||
IOPMAckImplied = kIOPMAckImplied,
|
||||
IOPMWillAckLater = kIOPMWillAckLater,
|
||||
IOPMBadSpecification = kIOPMBadSpecification,
|
||||
IOPMNoSuchState = kIOPMNoSuchState,
|
||||
IOPMCannotRaisePower = kIOPMCannotRaisePower,
|
||||
IOPMParameterError = kIOPMParameterError,
|
||||
IOPMNotYetInitialized = kIOPMNotYetInitialized
|
||||
};
|
||||
|
||||
|
||||
// IOPMPowerSource class descriptive strings
|
||||
// Power Source state is published as properties to the IORegistry under these
|
||||
// keys.
|
||||
#define kIOPMPSExternalConnectedKey "ExternalConnected"
|
||||
#define kIOPMPSExternalChargeCapableKey "ExternalChargeCapable"
|
||||
#define kIOPMPSBatteryInstalledKey "BatteryInstalled"
|
||||
#define kIOPMPSIsChargingKey "IsCharging"
|
||||
#define kIOPMFullyChargedKey "FullyCharged"
|
||||
#define kIOPMPSAtWarnLevelKey "AtWarnLevel"
|
||||
#define kIOPMPSAtCriticalLevelKey "AtCriticalLevel"
|
||||
#define kIOPMPSCurrentCapacityKey "CurrentCapacity"
|
||||
#define kIOPMPSMaxCapacityKey "MaxCapacity"
|
||||
#define kIOPMPSDesignCapacityKey "DesignCapacity"
|
||||
#define kIOPMPSTimeRemainingKey "TimeRemaining"
|
||||
#define kIOPMPSAmperageKey "Amperage"
|
||||
#define kIOPMPSVoltageKey "Voltage"
|
||||
#define kIOPMPSCycleCountKey "CycleCount"
|
||||
#define kIOPMPSMaxErrKey "MaxErr"
|
||||
#define kIOPMPSAdapterInfoKey "AdapterInfo"
|
||||
#define kIOPMPSLocationKey "Location"
|
||||
#define kIOPMPSErrorConditionKey "ErrorCondition"
|
||||
#define kIOPMPSManufacturerKey "Manufacturer"
|
||||
#define kIOPMPSManufactureDateKey "ManufactureDate"
|
||||
#define kIOPMPSModelKey "Model"
|
||||
#define kIOPMPSSerialKey "Serial"
|
||||
#define kIOPMDeviceNameKey "DeviceName"
|
||||
#define kIOPMPSLegacyBatteryInfoKey "LegacyBatteryInfo"
|
||||
#define kIOPMPSBatteryHealthKey "BatteryHealth"
|
||||
#define kIOPMPSHealthConfidenceKey "HealthConfidence"
|
||||
#define kIOPMPSCapacityEstimatedKey "CapacityEstimated"
|
||||
#define kIOPMPSBatteryChargeStatusKey "ChargeStatus"
|
||||
#define kIOPMPSBatteryTemperatureKey "Temperature"
|
||||
#define kIOPMPSAdapterDetailsKey "AdapterDetails"
|
||||
#define kIOPMPSChargerConfigurationKey "ChargerConfiguration"
|
||||
|
||||
// kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have
|
||||
// no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it
|
||||
// then charge is proceeding normally. If one of these battery charge status reasons is listed,
|
||||
// then the charge may have been interrupted.
|
||||
#define kIOPMBatteryChargeStatusTooHot "HighTemperature"
|
||||
#define kIOPMBatteryChargeStatusTooCold "LowTemperature"
|
||||
#define kIOPMBatteryChargeStatusTooHotOrCold "HighOrLowTemperature"
|
||||
#define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient"
|
||||
|
||||
// Definitions for battery location, in case of multiple batteries.
|
||||
// A location of 0 is unspecified
|
||||
// Location is undefined for single battery systems
|
||||
enum {
|
||||
kIOPMPSLocationLeft = 1001,
|
||||
kIOPMPSLocationRight = 1002
|
||||
};
|
||||
|
||||
// Battery quality health types, specified by BatteryHealth and HealthConfidence
|
||||
// properties in an IOPMPowerSource battery kext.
|
||||
enum {
|
||||
kIOPMUndefinedValue = 0,
|
||||
kIOPMPoorValue = 1,
|
||||
kIOPMFairValue = 2,
|
||||
kIOPMGoodValue = 3
|
||||
};
|
||||
|
||||
// Keys for kIOPMPSAdapterDetailsKey dictionary
|
||||
#define kIOPMPSAdapterDetailsIDKey "AdapterID"
|
||||
#define kIOPMPSAdapterDetailsWattsKey "Watts"
|
||||
#define kIOPMPSAdapterDetailsRevisionKey "AdapterRevision"
|
||||
#define kIOPMPSAdapterDetailsSerialNumberKey "SerialNumber"
|
||||
#define kIOPMPSAdapterDetailsFamilyKey "FamilyCode"
|
||||
#define kIOPMPSAdapterDetailsAmperageKey "Current"
|
||||
#define kIOPMPSAdapterDetailsDescriptionKey "Description"
|
||||
#define kIOPMPSAdapterDetailsPMUConfigurationKey "PMUConfiguration"
|
||||
#define kIOPMPSAdapterDetailsVoltage "Voltage"
|
||||
#define kIOPMPSAdapterDetailsSourceIDKey "Source"
|
||||
#define kIOPMPSAdapterDetailsErrorFlagsKey "ErrorFlags"
|
||||
#define kIOPMPSAdapterDetailsSharedSourceKey "SharedSource"
|
||||
#define kIOPMPSAdapterDetailsCloakedKey "CloakedSource"
|
||||
|
||||
// values for kIOPSPowerAdapterFamilyKey
|
||||
enum {
|
||||
kIOPSFamilyCodeDisconnected = 0,
|
||||
kIOPSFamilyCodeUnsupported = kIOReturnUnsupported,
|
||||
kIOPSFamilyCodeFirewire = iokit_family_err(sub_iokit_firewire, 0),
|
||||
kIOPSFamilyCodeUSBHost = iokit_family_err(sub_iokit_usb, 0),
|
||||
kIOPSFamilyCodeUSBHostSuspended = iokit_family_err(sub_iokit_usb, 1),
|
||||
kIOPSFamilyCodeUSBDevice = iokit_family_err(sub_iokit_usb, 2),
|
||||
kIOPSFamilyCodeUSBAdapter = iokit_family_err(sub_iokit_usb, 3),
|
||||
kIOPSFamilyCodeUSBChargingPortDedicated = iokit_family_err(sub_iokit_usb, 4),
|
||||
kIOPSFamilyCodeUSBChargingPortDownstream = iokit_family_err(sub_iokit_usb, 5),
|
||||
kIOPSFamilyCodeUSBChargingPort = iokit_family_err(sub_iokit_usb, 6),
|
||||
kIOPSFamilyCodeUSBUnknown = iokit_family_err(sub_iokit_usb, 7),
|
||||
kIOPSFamilyCodeUSBCBrick = iokit_family_err(sub_iokit_usb, 8),
|
||||
kIOPSFamilyCodeUSBCTypeC = iokit_family_err(sub_iokit_usb, 9),
|
||||
kIOPSFamilyCodeUSBCPD = iokit_family_err(sub_iokit_usb, 10),
|
||||
kIOPSFamilyCodeAC = iokit_family_err(sub_iokit_pmu, 0),
|
||||
kIOPSFamilyCodeExternal = iokit_family_err(sub_iokit_pmu, 1),
|
||||
kIOPSFamilyCodeExternal2 = iokit_family_err(sub_iokit_pmu, 2),
|
||||
kIOPSFamilyCodeExternal3 = iokit_family_err(sub_iokit_pmu, 3),
|
||||
kIOPSFamilyCodeExternal4 = iokit_family_err(sub_iokit_pmu, 4),
|
||||
kIOPSFamilyCodeExternal5 = iokit_family_err(sub_iokit_pmu, 5),
|
||||
kIOPSFamilyCodeExternal6 = iokit_family_err(sub_iokit_pmu, 6),
|
||||
kIOPSFamilyCodeExternal7 = iokit_family_err(sub_iokit_pmu, 7),
|
||||
};
|
||||
|
||||
// values for kIOPMPSAdapterDetailsErrorFlagsKey
|
||||
enum {
|
||||
kIOPSAdapterErrorFlagNoErrors = 0,
|
||||
kIOPSAdapterErrorFlagInsufficientAvailablePower = (1 << 1),
|
||||
kIOPSAdapterErrorFlagForeignObjectDetected = (1 << 2),
|
||||
kIOPSAdapterErrorFlagDeviceNeedsToBeRepositioned = (1 << 3),
|
||||
};
|
||||
|
||||
// Battery's time remaining estimate is invalid this long (seconds) after a wake
|
||||
#define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds"
|
||||
|
||||
// Battery must wait this long (seconds) after being completely charged before
|
||||
// the battery is settled.
|
||||
#define kIOPMPSPostChargeWaitSecondsKey "PostChargeWaitSeconds"
|
||||
|
||||
// Battery must wait this long (seconds) after being completely discharged
|
||||
// before the battery is settled.
|
||||
#define kIOPMPSPostDishargeWaitSecondsKey "PostDischargeWaitSeconds"
|
||||
|
||||
|
||||
/* CPU Power Management status keys
|
||||
* Pass as arguments to IOPMrootDomain::systemPowerEventOccurred
|
||||
* Or as arguments to IOPMSystemPowerEventOccurred()
|
||||
* Or to decode the dictionary obtained from IOPMCopyCPUPowerStatus()
|
||||
* These keys reflect restrictions placed on the CPU by the system
|
||||
* to bring the CPU's power consumption within allowable thermal and
|
||||
* power constraints.
|
||||
*/
|
||||
|
||||
|
||||
/* kIOPMGraphicsPowerLimitsKey
|
||||
* The key representing the dictionary of graphics power limits.
|
||||
* The dictionary contains the other kIOPMCPUPower keys & their associated
|
||||
* values (e.g. Speed limit, Processor Count, and Schedule limits).
|
||||
*/
|
||||
#define kIOPMGraphicsPowerLimitsKey "Graphics_Power_Limits"
|
||||
|
||||
/* kIOPMGraphicsPowerLimitPerformanceKey
|
||||
* The key representing the percent of overall performance made available
|
||||
* by the graphics chip as a percentage (integer 0 - 100).
|
||||
*/
|
||||
#define kIOPMGraphicsPowerLimitPerformanceKey "Graphics_Power_Performance"
|
||||
|
||||
|
||||
|
||||
/* kIOPMCPUPowerLimitsKey
|
||||
* The key representing the dictionary of CPU Power Limits.
|
||||
* The dictionary contains the other kIOPMCPUPower keys & their associated
|
||||
* values (e.g. Speed limit, Processor Count, and Schedule limits).
|
||||
*/
|
||||
#define kIOPMCPUPowerLimitsKey "CPU_Power_Limits"
|
||||
|
||||
/* kIOPMCPUPowerLimitProcessorSpeedKey defines the speed & voltage limits placed
|
||||
* on the CPU.
|
||||
* Represented as a percentage (0-100) of maximum CPU speed.
|
||||
*/
|
||||
#define kIOPMCPUPowerLimitProcessorSpeedKey "CPU_Speed_Limit"
|
||||
|
||||
/* kIOPMCPUPowerLimitProcessorCountKey reflects how many, if any, CPUs have been
|
||||
* taken offline. Represented as an integer number of CPUs (0 - Max CPUs).
|
||||
*/
|
||||
#define kIOPMCPUPowerLimitProcessorCountKey "CPU_Available_CPUs"
|
||||
|
||||
/* kIOPMCPUPowerLimitSchedulerTimeKey represents the percentage (0-100) of CPU time
|
||||
* available. 100% at normal operation. The OS may limit this time for a percentage
|
||||
* less than 100%.
|
||||
*/
|
||||
#define kIOPMCPUPowerLimitSchedulerTimeKey "CPU_Scheduler_Limit"
|
||||
|
||||
|
||||
/* Thermal Level Warning Key
|
||||
* Indicates the thermal constraints placed on the system. This value may
|
||||
* cause clients to action to consume fewer system resources.
|
||||
* The value associated with this warning is defined by the platform.
|
||||
*/
|
||||
#define kIOPMThermalLevelWarningKey "Thermal_Level_Warning"
|
||||
|
||||
/* Thermal Warning Level values
|
||||
* kIOPMThermalLevelNormal - under normal operating conditions
|
||||
* kIOPMThermalLevelDanger - thermal pressure may cause system slowdown
|
||||
* kIOPMThermalLevelCritical - thermal conditions may cause imminent shutdown
|
||||
*
|
||||
* The platform may define additional thermal levels if necessary.
|
||||
* Platform specific values are defined from 100 and above
|
||||
*/
|
||||
enum {
|
||||
kIOPMThermalLevelNormal = 0,
|
||||
kIOPMThermalLevelDanger = 5,
|
||||
kIOPMThermalLevelCritical = 10,
|
||||
|
||||
kIOPMThermalLevelWarning = 100,
|
||||
kIOPMThermalLevelTrap = 110,
|
||||
|
||||
kIOPMThermalLevelUnknown = 255,
|
||||
};
|
||||
|
||||
#define kIOPMThermalWarningLevelNormal kIOPMThermalLevelNormal
|
||||
#define kIOPMThermalWarningLevelDanger kIOPMThermalLevelWarning
|
||||
#define kIOPMThermalWarningLevelCrisis kIOPMThermalLevelCritical
|
||||
|
||||
// PM Settings Controller setting types
|
||||
// Settings types used primarily with:
|
||||
// IOPMrootDomain::registerPMSettingController
|
||||
// The values are identical to the similarly named keys for use in user space
|
||||
// PM settings work. Those keys are defined in IOPMLibPrivate.h.
|
||||
#define kIOPMSettingWakeOnRingKey "Wake On Modem Ring"
|
||||
#define kIOPMSettingRestartOnPowerLossKey "Automatic Restart On Power Loss"
|
||||
#define kIOPMSettingWakeOnACChangeKey "Wake On AC Change"
|
||||
#define kIOPMSettingSleepOnPowerButtonKey "Sleep On Power Button"
|
||||
#define kIOPMSettingWakeOnClamshellKey "Wake On Clamshell Open"
|
||||
#define kIOPMSettingReduceBrightnessKey "ReduceBrightness"
|
||||
#define kIOPMSettingDisplaySleepUsesDimKey "Display Sleep Uses Dim"
|
||||
#define kIOPMSettingTimeZoneOffsetKey "TimeZoneOffsetSeconds"
|
||||
#define kIOPMSettingMobileMotionModuleKey "MobileMotionModule"
|
||||
#define kIOPMSettingGraphicsSwitchKey "GPUSwitch"
|
||||
#define kIOPMSettingProModeControl "ProModeControl"
|
||||
#define kIOPMSettingProModeDefer "ProModeDefer"
|
||||
|
||||
// Setting controlling drivers can register to receive scheduled wake data
|
||||
// Either in "CF seconds" type, or structured calendar data in a formatted
|
||||
// IOPMCalendarStruct defined below.
|
||||
#define kIOPMSettingAutoWakeSecondsKey "wake"
|
||||
#define kIOPMSettingAutoWakeCalendarKey "WakeByCalendarDate"
|
||||
#define kIOPMSettingAutoPowerSecondsKey "poweron"
|
||||
#define kIOPMSettingAutoPowerCalendarKey "PowerByCalendarDate"
|
||||
|
||||
// Debug seconds auto wake
|
||||
// Used by sleep cycling debug tools
|
||||
#define kIOPMSettingDebugWakeRelativeKey "WakeRelativeToSleep"
|
||||
#define kIOPMSettingDebugPowerRelativeKey "PowerRelativeToShutdown"
|
||||
|
||||
// Maintenance wake calendar.
|
||||
#define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate"
|
||||
|
||||
|
||||
struct IOPMCalendarStruct {
|
||||
UInt32 year;
|
||||
UInt8 month;
|
||||
UInt8 day;
|
||||
UInt8 hour;
|
||||
UInt8 minute;
|
||||
UInt8 second;
|
||||
UInt8 selector;
|
||||
};
|
||||
typedef struct IOPMCalendarStruct IOPMCalendarStruct;
|
||||
|
||||
// SetAggressiveness types
|
||||
enum {
|
||||
kPMGeneralAggressiveness = 0,
|
||||
kPMMinutesToDim,
|
||||
kPMMinutesToSpinDown,
|
||||
kPMMinutesToSleep,
|
||||
kPMEthernetWakeOnLANSettings,
|
||||
kPMSetProcessorSpeed,
|
||||
kPMPowerSource,
|
||||
kPMMotionSensor,
|
||||
kPMLastAggressivenessType
|
||||
};
|
||||
#define kMaxType (kPMLastAggressivenessType-1)
|
||||
|
||||
// SetAggressiveness values for the kPMPowerSource aggressiveness type
|
||||
enum {
|
||||
kIOPMInternalPower = 1,
|
||||
kIOPMExternalPower
|
||||
};
|
||||
|
||||
#define kIOREMSleepEnabledKey "REMSleepEnabled"
|
||||
|
||||
// Strings for deciphering the dictionary returned from IOPMCopyBatteryInfo
|
||||
#define kIOBatteryInfoKey "IOBatteryInfo"
|
||||
#define kIOBatteryCurrentChargeKey "Current"
|
||||
#define kIOBatteryCapacityKey "Capacity"
|
||||
#define kIOBatteryFlagsKey "Flags"
|
||||
#define kIOBatteryVoltageKey "Voltage"
|
||||
#define kIOBatteryAmperageKey "Amperage"
|
||||
#define kIOBatteryCycleCountKey "Cycle Count"
|
||||
|
||||
enum {
|
||||
kIOBatteryInstalled = (1 << 2),
|
||||
kIOBatteryCharge = (1 << 1),
|
||||
kIOBatteryChargerConnect = (1 << 0)
|
||||
};
|
||||
|
||||
// Private power management message indicating battery data has changed
|
||||
// Indicates new data resides in the IORegistry
|
||||
#define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100)
|
||||
|
||||
// Apple private Legacy messages for re-routing AutoWake and AutoPower messages to the PMU
|
||||
// through newer user space IOPMSchedulePowerEvent API
|
||||
#define kIOPMUMessageLegacyAutoWake iokit_family_msg(sub_iokit_pmu, 0x200)
|
||||
#define kIOPMUMessageLegacyAutoPower iokit_family_msg(sub_iokit_pmu, 0x210)
|
||||
|
||||
// For use with IOPMPowerSource bFlags
|
||||
#define IOPM_POWER_SOURCE_REV 2
|
||||
enum {
|
||||
kIOPMACInstalled = kIOBatteryChargerConnect,
|
||||
kIOPMBatteryCharging = kIOBatteryCharge,
|
||||
kIOPMBatteryInstalled = kIOBatteryInstalled,
|
||||
kIOPMUPSInstalled = (1 << 3),
|
||||
kIOPMBatteryAtWarn = (1 << 4),
|
||||
kIOPMBatteryDepleted = (1 << 5),
|
||||
kIOPMACnoChargeCapability = (1 << 6), // AC adapter cannot charge battery
|
||||
kIOPMRawLowBattery = (1 << 7), // used only by Platform Expert
|
||||
kIOPMForceLowSpeed = (1 << 8), // set by Platfm Expert, chk'd by Pwr Plugin
|
||||
kIOPMClosedClamshell = (1 << 9), // set by PMU - reflects state of the clamshell
|
||||
kIOPMClamshellStateOnWake = (1 << 10) // used only by Platform Expert
|
||||
};
|
||||
|
||||
// **********************************************
|
||||
// Internal power management data structures
|
||||
// **********************************************
|
||||
|
||||
struct IOPowerStateChangeNotification {
|
||||
void * powerRef;
|
||||
unsigned long returnValue;
|
||||
unsigned long stateNumber;
|
||||
IOPMPowerFlags stateFlags;
|
||||
};
|
||||
typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification;
|
||||
typedef IOPowerStateChangeNotification sleepWakeNote;
|
||||
|
||||
/*! @struct IOPMSystemCapabilityChangeParameters
|
||||
* @abstract A structure describing a system capability change.
|
||||
* @discussion A system capability change is a system level transition from a set
|
||||
* of system capabilities to a new set of system capabilities. Power management
|
||||
* sends a <code>kIOMessageSystemCapabilityChange</code> message and provides
|
||||
* this structure as the message data (by reference) to
|
||||
* <code>gIOPriorityPowerStateInterest</code> clients when system capability
|
||||
* changes.
|
||||
* @field notifyRef An identifier for this message notification. Clients with pending
|
||||
* I/O can signal completion by calling <code>allowPowerChange()</code> with this
|
||||
* value as the argument. Clients that are able to process the notification
|
||||
* synchronously should ignore this field.
|
||||
* @field maxWaitForReply A return value to the caller indicating the maximum time in
|
||||
* microseconds to wait for the <code>allowPowerChange()</code> call. The default
|
||||
* value is zero, which indicates the client processing has finished, and power
|
||||
* management should not wait for an <code>allowPowerChange()</code> call.
|
||||
* @field changeFlags Flags will be set to indicate whether the notification precedes
|
||||
* the capability change (<code>kIOPMSystemCapabilityWillChange</code>), or after
|
||||
* the capability change has occurred (<code>kIOPMSystemCapabilityDidChange</code>).
|
||||
* @field __reserved1 Set to zero.
|
||||
* @field fromCapabilities The system capabilities at the start of the transition.
|
||||
* @field toCapabilities The system capabilities at the end of the transition.
|
||||
* @field __reserved2 Set to zero.
|
||||
*/
|
||||
struct IOPMSystemCapabilityChangeParameters {
|
||||
uint32_t notifyRef;
|
||||
uint32_t maxWaitForReply;
|
||||
uint32_t changeFlags;
|
||||
uint32_t __reserved1;
|
||||
uint32_t fromCapabilities;
|
||||
uint32_t toCapabilities;
|
||||
uint32_t __reserved2[4];
|
||||
};
|
||||
|
||||
/*! @enum IOPMSystemCapabilityChangeFlags
|
||||
* @constant kIOPMSystemCapabilityWillChange Indicates the system capability will change.
|
||||
* @constant kIOPMSystemCapabilityDidChange Indicates the system capability has changed.
|
||||
*/
|
||||
enum {
|
||||
kIOPMSystemCapabilityWillChange = 0x01,
|
||||
kIOPMSystemCapabilityDidChange = 0x02
|
||||
};
|
||||
|
||||
enum {
|
||||
kIOPMSystemCapabilityCPU = 0x01,
|
||||
kIOPMSystemCapabilityGraphics = 0x02,
|
||||
kIOPMSystemCapabilityAudio = 0x04,
|
||||
kIOPMSystemCapabilityNetwork = 0x08
|
||||
};
|
||||
|
||||
#endif /* ! _IOKIT_IOPM_H */
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
/*!
|
||||
@header IOPMKeys.h
|
||||
|
||||
IOPMKeys.h defines C strings for use accessing power management data.
|
||||
Note that all of these C strings must be converted to CFStrings before use. You can wrap
|
||||
them with the CFSTR() macro, or create a CFStringRef (that you must later CFRelease()) using CFStringCreateWithCString()
|
||||
*/
|
||||
|
||||
#ifndef _IOPMKEYS_H_
|
||||
#define _IOPMKEYS_H_
|
||||
|
||||
/*
|
||||
* Types of power event
|
||||
* These are potential arguments to IOPMSchedulePowerEvent().
|
||||
* These are all potential values of the kIOPMPowerEventTypeKey in the CFDictionaries
|
||||
* returned by IOPMCopyScheduledPowerEvents().
|
||||
*/
|
||||
/*!
|
||||
@define kIOPMAutoWake
|
||||
@abstract Value for scheduled wake from sleep.
|
||||
*/
|
||||
#define kIOPMAutoWake "wake"
|
||||
|
||||
/*!
|
||||
@define kIOPMAutoPowerOn
|
||||
@abstract Value for scheduled power on from off state.
|
||||
*/
|
||||
#define kIOPMAutoPowerOn "poweron"
|
||||
|
||||
/*!
|
||||
@define kIOPMAutoWakeOrPowerOn
|
||||
@abstract Value for scheduled wake from sleep, or power on. The system will either wake OR
|
||||
power on, whichever is necessary.
|
||||
*/
|
||||
|
||||
#define kIOPMAutoWakeOrPowerOn "wakepoweron"
|
||||
/*!
|
||||
@define kIOPMAutoSleep
|
||||
@abstract Value for scheduled sleep.
|
||||
*/
|
||||
|
||||
#define kIOPMAutoSleep "sleep"
|
||||
/*!
|
||||
@define kIOPMAutoShutdown
|
||||
@abstract Value for scheduled shutdown.
|
||||
*/
|
||||
|
||||
#define kIOPMAutoShutdown "shutdown"
|
||||
/*!
|
||||
@define kIOPMAutoRestart
|
||||
@abstract Value for scheduled restart.
|
||||
*/
|
||||
|
||||
#define kIOPMAutoRestart "restart"
|
||||
|
||||
/*
|
||||
* Keys for evaluating the CFDictionaries returned by IOPMCopyScheduledPowerEvents()
|
||||
*/
|
||||
/*!
|
||||
@define kIOPMPowerEventTimeKey
|
||||
@abstract Key for the time of the scheduled power event. Value is a CFDateRef.
|
||||
*/
|
||||
#define kIOPMPowerEventTimeKey "time"
|
||||
|
||||
/*!
|
||||
@define kIOPMPowerEventAppNameKey
|
||||
@abstract Key for the CFBundleIdentifier of the app that scheduled the power event. Value is a CFStringRef.
|
||||
*/
|
||||
#define kIOPMPowerEventAppNameKey "scheduledby"
|
||||
|
||||
/*!
|
||||
@define kIOPMPowerEventAppPIDKey
|
||||
@abstract Key for the PID the App that scheduled the power event. Value is a CFNumber integer.
|
||||
*/
|
||||
#define kIOPMPowerEventAppPIDKey "appPID"
|
||||
|
||||
/*!
|
||||
@define kIOPMPowerEventTypeKey
|
||||
@abstract Key for the type of power event. Value is a CFStringRef, with the c-string value of one of the "kIOPMAuto" strings.
|
||||
*/
|
||||
#define kIOPMPowerEventTypeKey "eventtype"
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
|
||||
#define kPMSetAggressiveness 0
|
||||
#define kPMGetAggressiveness 1
|
||||
#define kPMSleepSystem 2
|
||||
#define kPMAllowPowerChange 3
|
||||
#define kPMCancelPowerChange 4
|
||||
#define kPMShutdownSystem 5
|
||||
#define kPMRestartSystem 6
|
||||
#define kPMSleepSystemOptions 7
|
||||
#define kPMSetMaintenanceWakeCalendar 8
|
||||
#define kPMSetUserAssertionLevels 9
|
||||
#define kPMActivityTickle 10
|
||||
#define kPMGetSystemSleepType 11
|
||||
#define kPMSetClamshellSleepState 12
|
||||
#define kPMSleepWakeWatchdogEnable 13
|
||||
#define kPMSleepWakeDebugTrig 14
|
||||
#define kPMSetDisplayPowerOn 15
|
||||
#define kPMSetDisplayState 16
|
||||
|
||||
#define kNumPMMethods 17
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,830 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_
|
||||
#define _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_
|
||||
|
||||
#if KERNEL
|
||||
#include <IOKit/IOTypes.h>
|
||||
#else
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#include <IOKit/storage/IOStorageDeviceCharacteristics.h>
|
||||
|
||||
// Build includes
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Constants
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
// Message constants
|
||||
#define kIOMessageTrayStateChange 0x69000035
|
||||
#define kIOMessageTrayStateHasChanged kIOMessageTrayStateChange // DEPRECATED, use kIOMessageTrayStateChange instead
|
||||
|
||||
// Message values for kIOMessageTrayStateChange
|
||||
enum
|
||||
{
|
||||
kMessageTrayStateChangeRequestAccepted = 0,
|
||||
kMessageTrayStateChangeRequestRejected = 1
|
||||
};
|
||||
|
||||
#define kIOMessageMediaAccessChange 0x69000036
|
||||
|
||||
// Message values for kIOMessageMediaAccessChange
|
||||
enum
|
||||
{
|
||||
kMessageDeterminingMediaPresence = 0,
|
||||
kMessageFoundMedia = 1,
|
||||
kMessageMediaTypeDetermined = 2
|
||||
};
|
||||
|
||||
// IOKit property keys and constants
|
||||
#define kIOPropertySupportedCDFeatures kIOPropertySupportedCDFeaturesKey
|
||||
#define kIOPropertySupportedDVDFeatures kIOPropertySupportedDVDFeaturesKey
|
||||
#define kIOPropertySupportedBDFeatures kIOPropertySupportedBDFeaturesKey
|
||||
#define kIOPropertyLowPowerPolling "Low Power Polling"
|
||||
|
||||
typedef UInt32 CDFeatures;
|
||||
enum
|
||||
{
|
||||
kCDFeaturesAnalogAudioBit = 0, // Analog Audio playback
|
||||
kCDFeaturesReadStructuresBit = 1, // CD-ROM
|
||||
kCDFeaturesWriteOnceBit = 2, // CD-R
|
||||
kCDFeaturesReWriteableBit = 3, // CD-R/W
|
||||
kCDFeaturesCDDAStreamAccurateBit = 4, // CD-DA stream accurate
|
||||
kCDFeaturesPacketWriteBit = 5, // Packet Writing
|
||||
kCDFeaturesTAOWriteBit = 6, // CD Track At Once
|
||||
kCDFeaturesSAOWriteBit = 7, // CD Mastering - Session At Once
|
||||
kCDFeaturesRawWriteBit = 8, // CD Mastering - Raw
|
||||
kCDFeaturesTestWriteBit = 9, // CD Mastering/TAO - Test Write
|
||||
kCDFeaturesBUFWriteBit = 10 // CD Mastering/TAO - Buffer Underrun Free
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kCDFeaturesAnalogAudioMask = (1 << kCDFeaturesAnalogAudioBit),
|
||||
kCDFeaturesReadStructuresMask = (1 << kCDFeaturesReadStructuresBit),
|
||||
kCDFeaturesWriteOnceMask = (1 << kCDFeaturesWriteOnceBit),
|
||||
kCDFeaturesReWriteableMask = (1 << kCDFeaturesReWriteableBit),
|
||||
kCDFeaturesCDDAStreamAccurateMask = (1 << kCDFeaturesCDDAStreamAccurateBit),
|
||||
kCDFeaturesPacketWriteMask = (1 << kCDFeaturesPacketWriteBit),
|
||||
kCDFeaturesTAOWriteMask = (1 << kCDFeaturesTAOWriteBit),
|
||||
kCDFeaturesSAOWriteMask = (1 << kCDFeaturesSAOWriteBit),
|
||||
kCDFeaturesRawWriteMask = (1 << kCDFeaturesRawWriteBit),
|
||||
kCDFeaturesTestWriteMask = (1 << kCDFeaturesTestWriteBit),
|
||||
kCDFeaturesBUFWriteMask = (1 << kCDFeaturesBUFWriteBit)
|
||||
};
|
||||
|
||||
typedef UInt32 DVDFeatures;
|
||||
enum
|
||||
{
|
||||
kDVDFeaturesCSSBit = 0, // DVD-CSS
|
||||
kDVDFeaturesReadStructuresBit = 1, // DVD-ROM
|
||||
kDVDFeaturesWriteOnceBit = 2, // DVD-R
|
||||
kDVDFeaturesRandomWriteableBit = 3, // DVD-RAM
|
||||
kDVDFeaturesReWriteableBit = 4, // DVD-RW
|
||||
kDVDFeaturesTestWriteBit = 5, // DVD-R Write - Test Write
|
||||
kDVDFeaturesBUFWriteBit = 6, // DVD-R Write - Buffer Underrun Free
|
||||
kDVDFeaturesPlusRBit = 7, // DVD+R
|
||||
kDVDFeaturesPlusRWBit = 8, // DVD+RW (implies backgound format support)
|
||||
kDVDFeaturesHDReadBit = 9, // HD DVD-ROM
|
||||
kDVDFeaturesHDRBit = 10, // HD DVD-R
|
||||
kDVDFeaturesHDRAMBit = 11, // HD DVD-RAM
|
||||
kDVDFeaturesHDRWBit = 12 // HD DVD-RW
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kDVDFeaturesCSSMask = (1 << kDVDFeaturesCSSBit),
|
||||
kDVDFeaturesReadStructuresMask = (1 << kDVDFeaturesReadStructuresBit),
|
||||
kDVDFeaturesWriteOnceMask = (1 << kDVDFeaturesWriteOnceBit),
|
||||
kDVDFeaturesRandomWriteableMask = (1 << kDVDFeaturesRandomWriteableBit),
|
||||
kDVDFeaturesReWriteableMask = (1 << kDVDFeaturesReWriteableBit),
|
||||
kDVDFeaturesTestWriteMask = (1 << kDVDFeaturesTestWriteBit),
|
||||
kDVDFeaturesBUFWriteMask = (1 << kDVDFeaturesBUFWriteBit),
|
||||
kDVDFeaturesPlusRMask = (1 << kDVDFeaturesPlusRBit),
|
||||
kDVDFeaturesPlusRWMask = (1 << kDVDFeaturesPlusRWBit),
|
||||
kDVDFeaturesHDReadMask = (1 << kDVDFeaturesHDReadBit),
|
||||
kDVDFeaturesHDRMask = (1 << kDVDFeaturesHDRBit),
|
||||
kDVDFeaturesHDRAMMask = (1 << kDVDFeaturesHDRAMBit),
|
||||
kDVDFeaturesHDRWMask = (1 << kDVDFeaturesHDRWBit)
|
||||
};
|
||||
|
||||
typedef UInt32 BDFeatures;
|
||||
enum
|
||||
{
|
||||
kBDFeaturesReadBit = 0, // BD-ROM
|
||||
kBDFeaturesWriteBit = 1 // BD-R / BD-RE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kBDFeaturesReadMask = (1 << kBDFeaturesReadBit),
|
||||
kBDFeaturesWriteMask = (1 << kBDFeaturesWriteBit)
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kDiscStatusEmpty = 0,
|
||||
kDiscStatusIncomplete = 1,
|
||||
kDiscStatusComplete = 2,
|
||||
kDiscStatusOther = 3,
|
||||
kDiscStatusMask = 0x03,
|
||||
kDiscStatusErasableMask = 0x10
|
||||
};
|
||||
|
||||
|
||||
#if defined(KERNEL) && defined(__cplusplus)
|
||||
|
||||
// MMC power states as defined in T10:1228D SCSI Multimedia Commands - 2 (MMC-2)
|
||||
// Revision 11a, August 30, 1999, page 312 (Annex F).
|
||||
enum
|
||||
{
|
||||
kMMCPowerStateSystemSleep = 0,
|
||||
kMMCPowerStateSleep = 1,
|
||||
kMMCPowerStateStandby = 2,
|
||||
kMMCPowerStateIdle = 3,
|
||||
kMMCPowerStateActive = 4,
|
||||
kMMCNumPowerStates = 5
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
kMediaStateUnlocked = 0,
|
||||
kMediaStateLocked = 1
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Includes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// General IOKit headers
|
||||
#include <IOKit/IOLib.h>
|
||||
#include <IOKit/IOMemoryDescriptor.h>
|
||||
|
||||
// Generic IOKit storage related headers
|
||||
#include <IOKit/storage/IOStorage.h>
|
||||
#include <IOKit/storage/IOCDTypes.h>
|
||||
#include <IOKit/storage/IODVDTypes.h>
|
||||
|
||||
// SCSI Architecture Model Family includes
|
||||
#include <IOKit/scsi/IOSCSIPrimaryCommandsDevice.h>
|
||||
|
||||
// Forward definitions for internal use only classes
|
||||
class SCSIMultimediaCommands;
|
||||
class SCSIBlockCommands;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
//-----------------------------------------------------------------------------
|
||||
class __exported IOSCSIMultimediaCommandsDevice : public IOSCSIPrimaryCommandsDevice
|
||||
{
|
||||
|
||||
OSDeclareAbstractStructors ( IOSCSIMultimediaCommandsDevice )
|
||||
|
||||
private:
|
||||
|
||||
static void AsyncReadWriteComplete ( SCSITaskIdentifier completedTask );
|
||||
|
||||
protected:
|
||||
|
||||
// Reserve space for future expansion.
|
||||
struct IOSCSIMultimediaCommandsDeviceExpansionData
|
||||
{
|
||||
IONotifier * fPowerDownNotifier;
|
||||
bool fDeviceSupportsPowerOff;
|
||||
BDFeatures fSupportedBDFeatures;
|
||||
bool fDeviceSupportsAsyncNotification;
|
||||
bool fDeviceSupportsFastSpindown;
|
||||
UInt8 fCDLoadingMechanism;
|
||||
bool fDoNotLockMedia;
|
||||
};
|
||||
IOSCSIMultimediaCommandsDeviceExpansionData * fIOSCSIMultimediaCommandsDeviceReserved;
|
||||
|
||||
#define fPowerDownNotifier fIOSCSIMultimediaCommandsDeviceReserved->fPowerDownNotifier
|
||||
#define fDeviceSupportsPowerOff fIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsPowerOff
|
||||
#define fSupportedBDFeatures fIOSCSIMultimediaCommandsDeviceReserved->fSupportedBDFeatures
|
||||
#define fDeviceSupportsAsyncNotification fIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsAsyncNotification
|
||||
#define fDeviceSupportsFastSpindown fIOSCSIMultimediaCommandsDeviceReserved->fDeviceSupportsFastSpindown
|
||||
#define fCDLoadingMechanism fIOSCSIMultimediaCommandsDeviceReserved->fCDLoadingMechanism
|
||||
#define fDoNotLockMedia fIOSCSIMultimediaCommandsDeviceReserved->fDoNotLockMedia
|
||||
|
||||
CDFeatures fSupportedCDFeatures;
|
||||
DVDFeatures fSupportedDVDFeatures;
|
||||
|
||||
UInt16 fCurrentDiscSpeed;
|
||||
bool fMediaChanged;
|
||||
bool fMediaPresent;
|
||||
|
||||
// The byte count of each physical block on the media.
|
||||
UInt32 fMediaBlockSize;
|
||||
|
||||
// The total number of blocks of fMediaBlockSize on the media.
|
||||
UInt32 fMediaBlockCount;
|
||||
|
||||
// Flags used to indicate device feature
|
||||
bool fMediaIsRemovable;
|
||||
bool fMediaIsWriteProtected;
|
||||
UInt32 fMediaType;
|
||||
|
||||
thread_call_t fPollingThread;
|
||||
bool fDeviceSupportsLowPowerPolling;
|
||||
bool fLowPowerPollingEnabled;
|
||||
UInt32 fPollingMode;
|
||||
|
||||
enum
|
||||
{
|
||||
kPollingMode_Suspended = 0,
|
||||
kPollingMode_NewMedia = 1,
|
||||
kPollingMode_MediaRemoval = 2
|
||||
};
|
||||
|
||||
virtual IOReturn setProperties ( OSObject * properties ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
virtual void CreateStorageServiceNub ( void );
|
||||
virtual bool DetermineDeviceCharacteristics ( void );
|
||||
virtual IOReturn DetermineIfMediaIsRemovable ( void );
|
||||
virtual IOReturn DetermineDeviceFeatures ( void );
|
||||
virtual void DetermineMediaType ( void );
|
||||
virtual bool CheckForDVDMediaType ( void );
|
||||
virtual bool CheckForCDMediaType ( void );
|
||||
virtual void PollForMedia ( void );
|
||||
virtual void EnablePolling ( void );
|
||||
virtual void DisablePolling ( void );
|
||||
virtual void CheckWriteProtection ( void );
|
||||
virtual bool ClearNotReadyStatus ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
virtual IOReturn GetDeviceConfiguration ( void );
|
||||
virtual IOReturn GetDeviceConfigurationSize ( UInt32 * size );
|
||||
virtual IOReturn ParseFeatureList ( UInt32 numProfiles, UInt8 * firstFeaturePtr );
|
||||
|
||||
virtual IOReturn GetMechanicalCapabilities ( void );
|
||||
virtual IOReturn GetMechanicalCapabilitiesSize ( UInt32 * size );
|
||||
virtual IOReturn ParseMechanicalCapabilities ( UInt8 * mechanicalCapabilitiesPtr );
|
||||
|
||||
virtual IOReturn CheckForLowPowerPollingSupport ( void );
|
||||
virtual IOReturn GetCurrentPowerStateOfDrive ( UInt32 * powerState );
|
||||
|
||||
virtual IOReturn IssueRead ( IOMemoryDescriptor * buffer,
|
||||
UInt64 startBlock,
|
||||
UInt64 blockCount );
|
||||
|
||||
virtual IOReturn IssueRead ( IOMemoryDescriptor * buffer,
|
||||
void * clientData,
|
||||
UInt64 startBlock,
|
||||
UInt64 blockCount );
|
||||
|
||||
virtual IOReturn IssueWrite ( IOMemoryDescriptor * buffer,
|
||||
UInt64 startBlock,
|
||||
UInt64 blockCount );
|
||||
|
||||
virtual IOReturn IssueWrite ( IOMemoryDescriptor * buffer,
|
||||
void * clientData,
|
||||
UInt64 startBlock,
|
||||
UInt64 blockCount );
|
||||
|
||||
virtual void SetMediaCharacteristics ( UInt32 blockSize, UInt32 blockCount );
|
||||
virtual void ResetMediaCharacteristics ( void );
|
||||
|
||||
UInt8 ConvertBCDToHex ( UInt8 binaryCodedDigit );
|
||||
|
||||
// ------ User Client Support ------
|
||||
|
||||
virtual IOReturn HandleSetUserClientExclusivityState ( IOService * userClient, bool state ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
// ----- Power Management Support ------
|
||||
|
||||
// We override this method to set our power states and register ourselves
|
||||
// as a power policy maker.
|
||||
virtual void InitializePowerManagement ( IOService * provider ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
// We override this method so that when we register for power management,
|
||||
// we go to our active power state (which the drive is definitely in
|
||||
// at startup time).
|
||||
virtual UInt32 GetInitialPowerState ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
// We override this method in order to provide the number of transitions
|
||||
// from Fully active to Sleep state so that the idle timer can be adjusted
|
||||
// to the appropriate time period based on the disk spindown time set in
|
||||
// the Energy Saver prefs panel.
|
||||
virtual UInt32 GetNumberOfPowerStateTransitions ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
// The TicklePowerManager method is called to tell the power manager that the
|
||||
// device needs to be in a certain power state to handle requests.
|
||||
virtual void TicklePowerManager ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
// The HandlePowerChange method is the state machine for power management.
|
||||
// It is guaranteed to be on its own thread of execution (different from
|
||||
// the power manager thread AND the workloop thread. This routine can
|
||||
// send sync or async calls to the drive without worrying about threading
|
||||
// issues.
|
||||
virtual void HandlePowerChange ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
// The HandleCheckPowerState (void) method is on the serialized side of the command
|
||||
// gate and can change member variables safely without multi-threading issues.
|
||||
// It's main purpose is to call the superclass' HandleCheckPowerState ( UInt32 maxPowerState )
|
||||
// with the max power state the class registered with.
|
||||
virtual void HandleCheckPowerState ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
// The CheckMediaPresence method is called to see if the media which we
|
||||
// anticipated being there is still there.
|
||||
virtual bool CheckMediaPresence ( void );
|
||||
|
||||
virtual bool InitializeDeviceSupport ( void ) APPLE_KEXT_OVERRIDE;
|
||||
virtual void StartDeviceSupport ( void ) APPLE_KEXT_OVERRIDE;
|
||||
virtual void SuspendDeviceSupport ( void ) APPLE_KEXT_OVERRIDE;
|
||||
virtual void ResumeDeviceSupport ( void ) APPLE_KEXT_OVERRIDE;
|
||||
virtual void StopDeviceSupport ( void ) APPLE_KEXT_OVERRIDE;
|
||||
virtual void TerminateDeviceSupport ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
virtual void free ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
virtual IOReturn VerifyDeviceState ( void ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
virtual IOReturn setAggressiveness ( unsigned long type, unsigned long minutes ) APPLE_KEXT_OVERRIDE;
|
||||
|
||||
virtual IOReturn SyncReadWrite ( IOMemoryDescriptor * buffer,
|
||||
UInt64 startBlock,
|
||||
UInt64 blockCount );
|
||||
|
||||
virtual IOReturn AsyncReadWrite ( IOMemoryDescriptor * buffer,
|
||||
UInt64 block,
|
||||
UInt64 nblks,
|
||||
void * clientData );
|
||||
|
||||
virtual IOReturn EjectTheMedia ( void );
|
||||
virtual IOReturn GetTrayState ( UInt8 * trayState );
|
||||
virtual IOReturn SetTrayState ( UInt8 trayState );
|
||||
virtual IOReturn FormatMedia ( UInt64 byteCapacity );
|
||||
virtual UInt32 GetFormatCapacities ( UInt64 * capacities,
|
||||
UInt32 capacitiesMaxCount ) const;
|
||||
virtual IOReturn LockUnlockMedia ( bool doLock );
|
||||
virtual IOReturn SynchronizeCache ( void );
|
||||
virtual IOReturn ReportBlockSize ( UInt64 * blockSize );
|
||||
virtual IOReturn ReportEjectability ( bool * isEjectable );
|
||||
virtual IOReturn ReportLockability ( bool * isLockable );
|
||||
virtual IOReturn ReportPollRequirements ( bool * pollIsRequired,
|
||||
bool * pollIsExpensive );
|
||||
virtual IOReturn ReportMaxReadTransfer ( UInt64 blockSize,
|
||||
UInt64 * max );
|
||||
virtual IOReturn ReportMaxValidBlock ( UInt64 * maxBlock );
|
||||
virtual IOReturn ReportMaxWriteTransfer ( UInt64 blockSize,
|
||||
UInt64 * max );
|
||||
virtual IOReturn ReportMediaState ( bool * mediaPresent,
|
||||
bool * changed );
|
||||
virtual IOReturn ReportRemovability ( bool * isRemovable );
|
||||
virtual IOReturn ReportWriteProtection ( bool * isWriteProtected );
|
||||
|
||||
static void sPollForMedia ( void * pdtDriver, void * refCon );
|
||||
|
||||
/* CD Specific */
|
||||
virtual IOReturn SetMediaAccessSpeed ( UInt16 kilobytesPerSecond );
|
||||
|
||||
virtual IOReturn GetMediaAccessSpeed ( UInt16 * kilobytesPerSecond );
|
||||
|
||||
virtual IOReturn AsyncReadCD ( IOMemoryDescriptor * buffer,
|
||||
UInt32 block,
|
||||
UInt32 nblks,
|
||||
CDSectorArea sectorArea,
|
||||
CDSectorType sectorType,
|
||||
void * clientData );
|
||||
|
||||
virtual IOReturn ReadISRC ( UInt8 track, CDISRC isrc );
|
||||
|
||||
virtual IOReturn ReadMCN ( CDMCN mcn);
|
||||
|
||||
virtual IOReturn ReadTOC ( IOMemoryDescriptor * buffer );
|
||||
|
||||
/* DVD Specific */
|
||||
virtual UInt32 GetMediaType ( void );
|
||||
|
||||
virtual IOReturn ReportKey ( IOMemoryDescriptor * buffer,
|
||||
const DVDKeyClass keyClass,
|
||||
const UInt32 lba,
|
||||
const UInt8 agid,
|
||||
const DVDKeyFormat keyFormat ) __attribute__ ((deprecated));
|
||||
|
||||
virtual IOReturn SendKey ( IOMemoryDescriptor * buffer,
|
||||
const DVDKeyClass keyClass,
|
||||
const UInt8 agid,
|
||||
const DVDKeyFormat keyFormat );
|
||||
|
||||
virtual IOReturn ReadDVDStructure ( IOMemoryDescriptor * buffer,
|
||||
const UInt32 length,
|
||||
const UInt8 structureFormat,
|
||||
const UInt32 logicalBlockAddress,
|
||||
const UInt8 layer,
|
||||
const UInt8 agid );
|
||||
|
||||
// The block size decoding for Read CD and Read CD MSF as defined in table 255
|
||||
bool GetBlockSize (
|
||||
UInt32 * requestedByteCount,
|
||||
SCSICmdField3Bit EXPECTED_SECTOR_TYPE,
|
||||
SCSICmdField1Bit SYNC,
|
||||
SCSICmdField2Bit HEADER_CODES,
|
||||
SCSICmdField1Bit USER_DATA,
|
||||
SCSICmdField1Bit EDC_ECC,
|
||||
SCSICmdField2Bit ERROR_FIELD,
|
||||
SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS );
|
||||
|
||||
SCSICmdField4Byte ConvertMSFToLBA ( SCSICmdField3Byte MSF );
|
||||
|
||||
// The GET CONFIGURATION command as defined in section 6.1.4
|
||||
virtual bool GET_CONFIGURATION (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField2Bit RT,
|
||||
SCSICmdField2Byte STARTING_FEATURE_NUMBER,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The GET EVENT/STATUS NOTIFICATION command as defined in section 6.1.5
|
||||
virtual bool GET_EVENT_STATUS_NOTIFICATION (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField1Bit IMMED,
|
||||
SCSICmdField1Byte NOTIFICATION_CLASS_REQUEST,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The GET PERFORMANCE command as defined in section 6.1.6
|
||||
virtual bool GET_PERFORMANCE (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField2Bit TOLERANCE,
|
||||
SCSICmdField1Bit WRITE,
|
||||
SCSICmdField2Bit EXCEPT,
|
||||
SCSICmdField4Byte STARTING_LBA,
|
||||
SCSICmdField2Byte MAXIMUM_NUMBER_OF_DESCRIPTORS,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The LOAD/UNLOAD MEDIUM command as defined in section 6.1.7
|
||||
virtual bool LOAD_UNLOAD_MEDIUM (
|
||||
SCSITaskIdentifier request,
|
||||
SCSICmdField1Bit IMMED,
|
||||
SCSICmdField1Bit LO_UNLO,
|
||||
SCSICmdField1Bit START,
|
||||
SCSICmdField1Byte SLOT,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The MECHANISM STATUS command as defined in section 6.1.8
|
||||
virtual bool MECHANISM_STATUS (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
virtual bool READ_10 (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor *dataBuffer,
|
||||
UInt32 blockSize,
|
||||
SCSICmdField1Bit DPO,
|
||||
SCSICmdField1Bit FUA,
|
||||
SCSICmdField1Bit RELADR,
|
||||
SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField2Byte TRANSFER_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ CD command as defined in section 6.1.15
|
||||
virtual bool READ_CD (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField3Bit EXPECTED_SECTOR_TYPE,
|
||||
SCSICmdField1Bit RELADR,
|
||||
SCSICmdField4Byte STARTING_LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField3Byte TRANSFER_LENGTH,
|
||||
SCSICmdField1Bit SYNC,
|
||||
SCSICmdField2Bit HEADER_CODES,
|
||||
SCSICmdField1Bit USER_DATA,
|
||||
SCSICmdField1Bit EDC_ECC,
|
||||
SCSICmdField2Bit ERROR_FIELD,
|
||||
SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ CD MSF command as defined in section 6.1.16
|
||||
virtual bool READ_CD_MSF (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField3Bit EXPECTED_SECTOR_TYPE,
|
||||
SCSICmdField3Byte STARTING_MSF,
|
||||
SCSICmdField3Byte ENDING_MSF,
|
||||
SCSICmdField1Bit SYNC,
|
||||
SCSICmdField2Bit HEADER_CODES,
|
||||
SCSICmdField1Bit USER_DATA,
|
||||
SCSICmdField1Bit EDC_ECC,
|
||||
SCSICmdField2Bit ERROR_FIELD,
|
||||
SCSICmdField3Bit SUBCHANNEL_SELECTION_BITS,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ CAPACITY command as defined in section 6.1.17
|
||||
virtual bool READ_CAPACITY (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField1Bit RELADR,
|
||||
SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField1Bit PMI,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ DISC INFORMATION command as defined in section 6.1.18
|
||||
virtual bool READ_DISC_INFORMATION (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ DVD STRUCTURE command as defined in section 6.1.19
|
||||
virtual bool READ_DVD_STRUCTURE (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField4Byte ADDRESS,
|
||||
SCSICmdField1Byte LAYER_NUMBER,
|
||||
SCSICmdField1Byte FORMAT,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField2Bit AGID,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ FORMAT CAPACITIES command as defined in section 6.1.20
|
||||
virtual bool READ_FORMAT_CAPACITIES (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ SUB-CHANNEL command as defined in section 6.1.23
|
||||
virtual bool READ_SUB_CHANNEL (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField1Bit MSF,
|
||||
SCSICmdField1Bit SUBQ,
|
||||
SCSICmdField1Byte SUB_CHANNEL_PARAMETER_LIST,
|
||||
SCSICmdField1Byte TRACK_NUMBER,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ TOC/PMA/ATIP command as defined in section 6.1.24/25
|
||||
virtual bool READ_TOC_PMA_ATIP (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField1Bit MSF,
|
||||
SCSICmdField4Bit FORMAT,
|
||||
SCSICmdField1Byte TRACK_SESSION_NUMBER,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The READ TRACK INFORMATION command as defined in section 6.1.26
|
||||
virtual bool READ_TRACK_INFORMATION (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField2Bit ADDRESS_NUMBER_TYPE,
|
||||
SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS_TRACK_SESSION_NUMBER,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
/*********************** LEGACY COMMAND SUPPORT ***********************/
|
||||
// The SET CD SPEED command as defined in section 6.1.36
|
||||
virtual bool SET_CD_SPEED (
|
||||
SCSITaskIdentifier request,
|
||||
SCSICmdField2Byte LOGICAL_UNIT_READ_SPEED,
|
||||
SCSICmdField2Byte LOGICAL_UNIT_WRITE_SPEED,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
/*********************** END LEGACY COMMAND SUPPORT ***********************/
|
||||
|
||||
// The SET READ AHEAD command as defined in section 6.1.37
|
||||
virtual bool SET_READ_AHEAD (
|
||||
SCSITaskIdentifier request,
|
||||
SCSICmdField4Byte TRIGGER_LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField4Byte READ_AHEAD_LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The SET STREAMING command as defined in section 6.1.38
|
||||
virtual bool SET_STREAMING (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField2Byte PARAMETER_LIST_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
virtual bool START_STOP_UNIT (
|
||||
SCSITaskIdentifier request,
|
||||
SCSICmdField1Bit IMMED,
|
||||
SCSICmdField4Bit POWER_CONDITIONS,
|
||||
SCSICmdField1Bit LOEJ,
|
||||
SCSICmdField1Bit START,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The SYNCHRONIZE CACHE command as defined in section 6.1.40
|
||||
virtual bool SYNCHRONIZE_CACHE (
|
||||
SCSITaskIdentifier request,
|
||||
SCSICmdField1Bit IMMED,
|
||||
SCSICmdField1Bit RELADR,
|
||||
SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField2Byte NUMBER_OF_BLOCKS,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The WRITE (10) command as defined in section 6.1.41
|
||||
virtual bool WRITE_10 (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
UInt32 blockSize,
|
||||
SCSICmdField1Bit DPO,
|
||||
SCSICmdField1Bit FUA,
|
||||
SCSICmdField1Bit RELADR,
|
||||
SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField2Byte TRANSFER_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
// The WRITE AND VERIFY (10) command as defined in section 6.1.42
|
||||
virtual bool WRITE_AND_VERIFY_10 (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
UInt32 blockSize,
|
||||
SCSICmdField1Bit DPO,
|
||||
SCSICmdField1Bit BYT_CHK,
|
||||
SCSICmdField1Bit RELADR,
|
||||
SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField4Byte TRANSFER_LENGTH,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
/* Added with 10.1.3 */
|
||||
OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 1 );
|
||||
|
||||
virtual IOReturn ReadTOC ( IOMemoryDescriptor * buffer,
|
||||
CDTOCFormat format,
|
||||
UInt8 msf,
|
||||
UInt32 trackSessionNumber,
|
||||
UInt16 * actualByteCount );
|
||||
|
||||
/* Added with 10.1.3 */
|
||||
OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 2 );
|
||||
|
||||
virtual IOReturn ReadDiscInfo ( IOMemoryDescriptor * buffer,
|
||||
UInt16 * actualByteCount );
|
||||
|
||||
/* Added with 10.1.3 */
|
||||
OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 3 );
|
||||
|
||||
virtual IOReturn ReadTrackInfo ( IOMemoryDescriptor * buffer,
|
||||
UInt32 address,
|
||||
CDTrackInfoAddressType addressType,
|
||||
UInt16 * actualByteCount );
|
||||
|
||||
/* Added with 10.2 */
|
||||
OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 4 );
|
||||
|
||||
virtual IOReturn PowerDownHandler ( void * refCon,
|
||||
UInt32 messageType,
|
||||
IOService * provider,
|
||||
void * messageArgument,
|
||||
vm_size_t argSize );
|
||||
|
||||
/* Added with 10.3.3 */
|
||||
OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 5 );
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
virtual void AsyncReadWriteCompletion ( SCSITaskIdentifier completedTask );
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/* Added with 10.5 */
|
||||
OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 6 );
|
||||
|
||||
virtual IOReturn ReadDiscStructure ( IOMemoryDescriptor * buffer,
|
||||
const UInt32 length,
|
||||
const UInt8 structureFormat,
|
||||
const UInt32 logicalBlockAddress,
|
||||
const UInt8 layer,
|
||||
const UInt8 agid,
|
||||
const UInt8 mediaType );
|
||||
|
||||
|
||||
bool CheckForBDMediaType ( void );
|
||||
|
||||
|
||||
bool READ_DISC_STRUCTURE (
|
||||
SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField4Bit MEDIA_TYPE,
|
||||
SCSICmdField4Byte ADDRESS,
|
||||
SCSICmdField1Byte LAYER_NUMBER,
|
||||
SCSICmdField1Byte FORMAT,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField2Bit AGID,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
|
||||
OSMetaClassDeclareReservedUsed ( IOSCSIMultimediaCommandsDevice, 7 );
|
||||
|
||||
virtual IOReturn ReserveTrack ( UInt8 reservationType,
|
||||
UInt8 reservationFormat,
|
||||
UInt64 ReservationParameter );
|
||||
|
||||
|
||||
bool RESERVE_TRACK_V2 ( SCSITaskIdentifier request,
|
||||
SCSICmdField1Bit RMZ,
|
||||
SCSICmdField1Bit ARSV,
|
||||
SCSICmdField7Byte RESERVATION_PARAMETER,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
|
||||
bool REPORT_KEY_V2 ( SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField1Byte KEY_CLASS,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField2Bit AGID,
|
||||
SCSICmdField6Bit KEY_FORMAT,
|
||||
SCSICmdField1Byte CONTROL ) __attribute__ ((deprecated));
|
||||
|
||||
|
||||
bool REPORT_KEY_V3 ( SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField4Byte LOGICAL_BLOCK_ADDRESS,
|
||||
SCSICmdField1Byte KEY_CLASS,
|
||||
SCSICmdField2Byte ALLOCATION_LENGTH,
|
||||
SCSICmdField1Byte BLOCK_COUNT,
|
||||
SCSICmdField2Bit AGID,
|
||||
SCSICmdField6Bit KEY_FORMAT,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
|
||||
bool SEND_KEY_V2 ( SCSITaskIdentifier request,
|
||||
IOMemoryDescriptor * dataBuffer,
|
||||
SCSICmdField1Byte KEY_CLASS,
|
||||
SCSICmdField2Byte PARAMETER_LIST_LENGTH,
|
||||
SCSICmdField2Bit AGID,
|
||||
SCSICmdField6Bit KEY_FORMAT,
|
||||
SCSICmdField1Byte CONTROL );
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
void SetPollingMode ( UInt32 newPollingMode );
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
/* 10.6.0 */
|
||||
|
||||
IOReturn RequestIdle ( void );
|
||||
|
||||
/* 10.12.0 */
|
||||
virtual IOReturn ReportKey ( IOMemoryDescriptor * buffer,
|
||||
const DVDKeyClass keyClass,
|
||||
const UInt32 lba,
|
||||
const UInt8 blockCount,
|
||||
const UInt8 agid,
|
||||
const DVDKeyFormat keyFormat );
|
||||
|
||||
private:
|
||||
|
||||
// Space reserved for future expansion.
|
||||
OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 9 );
|
||||
OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 10 );
|
||||
OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 11 );
|
||||
OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 12 );
|
||||
OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 13 );
|
||||
OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 14 );
|
||||
OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 15 );
|
||||
OSMetaClassDeclareReservedUnused ( IOSCSIMultimediaCommandsDevice, 16 );
|
||||
|
||||
};
|
||||
|
||||
#endif /* defined(KERNEL) && defined(__cplusplus) */
|
||||
|
||||
#endif /* _IOKIT_IO_SCSI_MULTIMEDIA_COMMANDS_DEVICE_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,559 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_
|
||||
#define _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Includes
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if KERNEL
|
||||
#include <IOKit/IOTypes.h>
|
||||
#else
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*! @header SCSI Request Sense Definitions
|
||||
@discussion
|
||||
This file contains all definitions for the data returned from
|
||||
the MODE_SENSE_6 and MODE_SENSE_10 commands.
|
||||
*/
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/*!
|
||||
@struct SPCModeParameterHeader6
|
||||
@discussion
|
||||
Mode Parameter Header for the MODE_SENSE_6 command.
|
||||
*/
|
||||
typedef struct SPCModeParameterHeader6
|
||||
{
|
||||
UInt8 MODE_DATA_LENGTH;
|
||||
UInt8 MEDIUM_TYPE;
|
||||
UInt8 DEVICE_SPECIFIC_PARAMETER;
|
||||
UInt8 BLOCK_DESCRIPTOR_LENGTH;
|
||||
} SPCModeParameterHeader6;
|
||||
|
||||
|
||||
/*!
|
||||
@struct SPCModeParameterHeader10
|
||||
@discussion
|
||||
Mode Parameter Header for the MODE_SENSE_10 command.
|
||||
*/
|
||||
typedef struct SPCModeParameterHeader10
|
||||
{
|
||||
UInt16 MODE_DATA_LENGTH;
|
||||
UInt8 MEDIUM_TYPE;
|
||||
UInt8 DEVICE_SPECIFIC_PARAMETER;
|
||||
UInt8 LONGLBA;
|
||||
UInt8 RESERVED;
|
||||
UInt16 BLOCK_DESCRIPTOR_LENGTH;
|
||||
} SPCModeParameterHeader10;
|
||||
|
||||
|
||||
/*!
|
||||
@enum Long LBA Bitfield definitions
|
||||
@discussion
|
||||
Long LBA Bitfield definitions for Mode Parameter Header
|
||||
for MODE_SENSE_10 command.
|
||||
@constant kModeSenseParameterHeader10_LongLBABit
|
||||
Bit to indicate Long LBA block descriptors follow.
|
||||
@constant kModeSenseParameterHeader10_LongLBAMask
|
||||
Mask to test for kModeSenseParameterHeader10_LongLBABit.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kModeSenseParameterHeader10_LongLBABit = 0,
|
||||
kModeSenseParameterHeader10_LongLBAMask = (1 << kModeSenseParameterHeader10_LongLBABit),
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum Device Specific Parameter Bitfield definitions
|
||||
@discussion
|
||||
SBC definitions for Device Specific Parameter in the
|
||||
Mode Sense Header Block.
|
||||
@constant kModeSenseSBCDeviceSpecific_DPOFUABit
|
||||
Bit to indicate DPO and FUA bits are accepted by the device server.
|
||||
@constant kModeSenseSBCDeviceSpecific_WriteProtectBit
|
||||
Bit to indicate medium is write protected.
|
||||
@constant kModeSenseSBCDeviceSpecific_DPOFUAMask
|
||||
Mask to test for kModeSenseSBCDeviceSpecific_DPOFUABit.
|
||||
@constant kModeSenseSBCDeviceSpecific_WriteProtectMask
|
||||
Mask to test for kModeSenseSBCDeviceSpecific_WriteProtectBit.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kModeSenseSBCDeviceSpecific_DPOFUABit = 4,
|
||||
kModeSenseSBCDeviceSpecific_WriteProtectBit = 7,
|
||||
kModeSenseSBCDeviceSpecific_DPOFUAMask = (1 << kModeSenseSBCDeviceSpecific_DPOFUABit),
|
||||
kModeSenseSBCDeviceSpecific_WriteProtectMask = (1 << kModeSenseSBCDeviceSpecific_WriteProtectBit)
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@struct ModeParameterBlockDescriptor
|
||||
@discussion
|
||||
General mode parameter block descriptor.
|
||||
*/
|
||||
typedef struct ModeParameterBlockDescriptor
|
||||
{
|
||||
UInt8 DENSITY_CODE;
|
||||
UInt8 NUMBER_OF_BLOCKS[3];
|
||||
UInt8 RESERVED;
|
||||
UInt8 BLOCK_LENGTH[3];
|
||||
} ModeParameterBlockDescriptor;
|
||||
|
||||
|
||||
/*!
|
||||
@struct DASDModeParameterBlockDescriptor
|
||||
@discussion
|
||||
Direct Access Storage Device mode parameter block descriptor.
|
||||
*/
|
||||
typedef struct DASDModeParameterBlockDescriptor
|
||||
{
|
||||
UInt32 NUMBER_OF_BLOCKS;
|
||||
UInt8 DENSITY_CODE;
|
||||
UInt8 BLOCK_LENGTH[3];
|
||||
} DASDModeParameterBlockDescriptor;
|
||||
|
||||
|
||||
/*!
|
||||
@struct LongLBAModeParameterBlockDescriptor
|
||||
@discussion
|
||||
Long LBA mode parameter block descriptor.
|
||||
*/
|
||||
typedef struct LongLBAModeParameterBlockDescriptor
|
||||
{
|
||||
UInt64 NUMBER_OF_BLOCKS;
|
||||
UInt8 DENSITY_CODE;
|
||||
UInt8 RESERVED[3];
|
||||
UInt32 BLOCK_LENGTH;
|
||||
} LongLBAModeParameterBlockDescriptor;
|
||||
|
||||
|
||||
/*!
|
||||
@struct ModePageFormatHeader
|
||||
@discussion
|
||||
Mode Page format header.
|
||||
*/
|
||||
typedef struct ModePageFormatHeader
|
||||
{
|
||||
UInt8 PS_PAGE_CODE;
|
||||
UInt8 PAGE_LENGTH;
|
||||
} ModePageFormatHeader;
|
||||
|
||||
|
||||
/*!
|
||||
@enum Mode Page Format bit definitions
|
||||
@discussion
|
||||
Mode Page Format bit definitions.
|
||||
@constant kModePageFormat_PS_Bit
|
||||
Bit to indicate Parameters Saveable.
|
||||
@constant kModePageFormat_PAGE_CODE_Mask
|
||||
Mask to obtain the PAGE_CODE from the PS_PAGE_CODE field.
|
||||
@constant kModePageFormat_PS_Mask
|
||||
Mask to test for kModePageFormat_PS_Bit.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kModePageFormat_PS_Bit = 7,
|
||||
|
||||
kModePageFormat_PAGE_CODE_Mask = 0x3F,
|
||||
kModePageFormat_PS_Mask = (1 << kModePageFormat_PS_Bit)
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark SPC Mode Pages
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
@enum SPC Mode Pages
|
||||
@discussion
|
||||
SPC Mode Page definitions.
|
||||
@constant kSPCModePagePowerConditionCode
|
||||
Power Conditions Mode Page value.
|
||||
@constant kSPCModePageAllPagesCode
|
||||
All Mode Pages value.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSPCModePagePowerConditionCode = 0x1A,
|
||||
kSPCModePageAllPagesCode = 0x3F
|
||||
};
|
||||
|
||||
/*!
|
||||
@struct SPCModePagePowerCondition
|
||||
@discussion
|
||||
Power Conditions Mode Page (PAGE CODE 0x1A) format.
|
||||
*/
|
||||
typedef struct SPCModePagePowerCondition
|
||||
{
|
||||
ModePageFormatHeader header;
|
||||
UInt8 RESERVED;
|
||||
UInt8 IDLE_STANDBY;
|
||||
UInt32 IDLE_CONDITION_TIMER;
|
||||
UInt32 STANDBY_CONDITION_TIMER;
|
||||
} SPCModePagePowerCondition;
|
||||
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark 0x00 SBC Direct Access Mode Pages
|
||||
#pragma mark -
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
@enum SBC Mode Pages
|
||||
@discussion
|
||||
SBC Mode Page definitions.
|
||||
@constant kSBCModePageFormatDeviceCode
|
||||
Format Device Mode Page value.
|
||||
@constant kSBCModePageRigidDiskGeometryCode
|
||||
Rigid Disk Geometry Page value.
|
||||
@constant kSBCModePageFlexibleDiskCode
|
||||
Flexible Disk Page value.
|
||||
@constant kSBCModePageCachingCode
|
||||
Caching Page value.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCModePageFormatDeviceCode = 0x03,
|
||||
kSBCModePageRigidDiskGeometryCode = 0x04,
|
||||
kSBCModePageFlexibleDiskCode = 0x05,
|
||||
kSBCModePageCachingCode = 0x08
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@struct SBCModePageFormatDevice
|
||||
@discussion
|
||||
Format Device Mode Page (PAGE CODE 0x03) format.
|
||||
*/
|
||||
typedef struct SBCModePageFormatDevice
|
||||
{
|
||||
ModePageFormatHeader header;
|
||||
UInt16 TRACKS_PER_ZONE;
|
||||
UInt16 ALTERNATE_SECTORS_PER_ZONE;
|
||||
UInt16 ALTERNATE_TRACKS_PER_ZONE;
|
||||
UInt16 ALTERNATE_TRACKS_PER_LOGICAL_UNIT;
|
||||
UInt16 SECTORS_PER_TRACK;
|
||||
UInt16 DATA_BYTES_PER_PHYSICAL_SECTOR;
|
||||
UInt16 INTERLEAVE;
|
||||
UInt16 TRACK_SKEW_FACTOR;
|
||||
UInt16 CYLINDER_SKEW_FACTOR;
|
||||
UInt8 SSEC_HSEC_RMB_SURF;
|
||||
UInt8 RESERVED[3];
|
||||
} SBCModePageFormatDevice;
|
||||
|
||||
|
||||
/*!
|
||||
@struct SBCModePageRigidDiskGeometry
|
||||
@discussion
|
||||
Rigid Disk Geometry Mode Page (PAGE CODE 0x04) format.
|
||||
*/
|
||||
typedef struct SBCModePageRigidDiskGeometry
|
||||
{
|
||||
ModePageFormatHeader header;
|
||||
UInt8 NUMBER_OF_CYLINDERS[3];
|
||||
UInt8 NUMBER_OF_HEADS;
|
||||
UInt8 STARTING_CYLINDER_WRITE_PRECOMPENSATION[3];
|
||||
UInt8 STARTING_CYLINDER_REDUCED_WRITE_CURRENT[3];
|
||||
UInt16 DEVICE_STEP_RATE;
|
||||
UInt8 LANDING_ZONE_CYLINDER[3];
|
||||
UInt8 RPL;
|
||||
UInt8 ROTATIONAL_OFFSET;
|
||||
UInt8 RESERVED;
|
||||
UInt16 MEDIUM_ROTATION_RATE;
|
||||
UInt8 RESERVED1[2];
|
||||
} SBCModePageRigidDiskGeometry;
|
||||
|
||||
|
||||
/*!
|
||||
@enum Rigid Disk Geometry bitfields
|
||||
@discussion
|
||||
Bit field masks for Rigid Disk Geometry structure fields.
|
||||
@constant kSBCModePageRigidDiskGeometry_RPL_Mask
|
||||
Mask for use with the RPL field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCModePageRigidDiskGeometry_RPL_Mask = 0x03
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@struct SBCModePageFlexibleDisk
|
||||
@discussion
|
||||
Flexible Disk Mode Page (PAGE CODE 0x05) format.
|
||||
*/
|
||||
typedef struct SBCModePageFlexibleDisk
|
||||
{
|
||||
ModePageFormatHeader header;
|
||||
UInt16 TRANSFER_RATE;
|
||||
UInt8 NUMBER_OF_HEADS;
|
||||
UInt8 SECTORS_PER_TRACK;
|
||||
UInt16 DATA_BYTES_PER_SECTOR;
|
||||
UInt16 NUMBER_OF_CYLINDERS;
|
||||
UInt16 STARTING_CYLINDER_WRITE_PRECOMPENSATION;
|
||||
UInt16 STARTING_CYLINDER_REDUCED_WRITE_CURRENT;
|
||||
UInt16 DEVICE_STEP_RATE;
|
||||
UInt8 DEVICE_STEP_PULSE_WIDTH;
|
||||
UInt16 HEAD_SETTLE_DELAY;
|
||||
UInt8 MOTOR_ON_DELAY;
|
||||
UInt8 MOTOR_OFF_DELAY;
|
||||
UInt8 TRDY_SSN_MO;
|
||||
UInt8 SPC;
|
||||
UInt8 WRITE_COMPENSATION;
|
||||
UInt8 HEAD_LOAD_DELAY;
|
||||
UInt8 HEAD_UNLOAD_DELAY;
|
||||
UInt8 PIN_34_PIN_2;
|
||||
UInt8 PIN_4_PIN_1;
|
||||
UInt16 MEDIUM_ROTATION_RATE;
|
||||
UInt8 RESERVED[2];
|
||||
} SBCModePageFlexibleDisk;
|
||||
|
||||
|
||||
/*!
|
||||
@enum TRDY_SSN_MO bitfields
|
||||
@discussion
|
||||
Bit field definitions and masks for Flexible Disk TRDY_SSN_MO field.
|
||||
@constant kSBCModePageFlexibleDisk_MO_Bit
|
||||
MO Bit definition.
|
||||
@constant kSBCModePageFlexibleDisk_SSN_Bit
|
||||
SSN Bit definition.
|
||||
@constant kSBCModePageFlexibleDisk_TRDY_Bit
|
||||
TRDY Bit definition.
|
||||
@constant kSBCModePageFlexibleDisk_MO_Mask
|
||||
Mask for use with TRDY_SSN_MO field.
|
||||
@constant kSBCModePageFlexibleDisk_SSN_Mask
|
||||
Mask for use with TRDY_SSN_MO field.
|
||||
@constant kSBCModePageFlexibleDisk_TRDY_Mask
|
||||
Mask for use with TRDY_SSN_MO field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
// Bits 0:4 Reserved
|
||||
kSBCModePageFlexibleDisk_MO_Bit = 5,
|
||||
kSBCModePageFlexibleDisk_SSN_Bit = 6,
|
||||
kSBCModePageFlexibleDisk_TRDY_Bit = 7,
|
||||
|
||||
kSBCModePageFlexibleDisk_MO_Mask = (1 << kSBCModePageFlexibleDisk_MO_Bit),
|
||||
kSBCModePageFlexibleDisk_SSN_Mask = (1 << kSBCModePageFlexibleDisk_SSN_Bit),
|
||||
kSBCModePageFlexibleDisk_TRDY_Mask = (1 << kSBCModePageFlexibleDisk_TRDY_Bit)
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum SPC bitfields
|
||||
@discussion
|
||||
Bit field definitions and masks for Flexible Disk SPC field.
|
||||
@constant kSBCModePageFlexibleDisk_SPC_Mask
|
||||
Mask for use with SPC field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCModePageFlexibleDisk_SPC_Mask = 0x0F
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum PIN_34_PIN_2 bitfields
|
||||
@discussion
|
||||
Bit field definitions and masks for Flexible Disk PIN_34_PIN_2 field.
|
||||
@constant kSBCModePageFlexibleDisk_PIN_2_Mask
|
||||
Mask for use with PIN_34_PIN_2 field.
|
||||
@constant kSBCModePageFlexibleDisk_PIN_34_Mask
|
||||
Mask for use with PIN_34_PIN_2 field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCModePageFlexibleDisk_PIN_2_Mask = 0x0F,
|
||||
kSBCModePageFlexibleDisk_PIN_34_Mask = 0xF0
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum PIN_4_PIN_1 bitfields
|
||||
@discussion
|
||||
Bit field definitions and masks for Flexible Disk PIN_4_PIN_1 field.
|
||||
@constant kSBCModePageFlexibleDisk_PIN_1_Mask
|
||||
Mask for use with PIN_4_PIN_1 field.
|
||||
@constant kSBCModePageFlexibleDisk_PIN_4_Mask
|
||||
Mask for use with PIN_4_PIN_1 field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCModePageFlexibleDisk_PIN_1_Mask = 0x0F,
|
||||
kSBCModePageFlexibleDisk_PIN_4_Mask = 0xF0
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@struct SBCModePageCaching
|
||||
@discussion
|
||||
Caching Mode Page (PAGE CODE 0x08) format.
|
||||
*/
|
||||
typedef struct SBCModePageCaching
|
||||
{
|
||||
ModePageFormatHeader header;
|
||||
UInt8 flags;
|
||||
UInt8 DEMAND_READ_WRITE_RETENTION_PRIORITY;
|
||||
UInt16 DISABLE_PREFETCH_TRANSFER_LENGTH;
|
||||
UInt16 MINIMUM_PREFETCH;
|
||||
UInt16 MAXIMUM_PREFETCH;
|
||||
UInt16 MAXIMUM_PREFETCH_CEILING;
|
||||
UInt8 flags2;
|
||||
UInt8 NUMBER_OF_CACHE_SEGMENTS;
|
||||
UInt16 CACHE_SEGMENT_SIZE;
|
||||
UInt8 RESERVED;
|
||||
UInt8 NON_CACHE_SEGMENT_SIZE[3];
|
||||
} SBCModePageCaching;
|
||||
|
||||
|
||||
/*!
|
||||
@enum Caching flags bitfields
|
||||
@discussion
|
||||
Bit field definitions and masks for Caching flags field.
|
||||
@constant kSBCModePageCaching_RCD_Bit
|
||||
RCD Bit definition.
|
||||
@constant kSBCModePageCaching_MF_Bit
|
||||
MF Bit definition.
|
||||
@constant kSBCModePageCaching_WCE_Bit
|
||||
WCE Bit definition.
|
||||
@constant kSBCModePageCaching_SIZE_Bit
|
||||
SIZE Bit definition.
|
||||
@constant kSBCModePageCaching_DISC_Bit
|
||||
DISC Bit definition.
|
||||
@constant kSBCModePageCaching_CAP_Bit
|
||||
CAP Bit definition.
|
||||
@constant kSBCModePageCaching_ABPF_Bit
|
||||
ABPF Bit definition.
|
||||
@constant kSBCModePageCaching_IC_Bit
|
||||
IC Bit definition.
|
||||
@constant kSBCModePageCaching_RCD_Mask
|
||||
Mask for use with flags field.
|
||||
@constant kSBCModePageCaching_MF_Mask
|
||||
Mask for use with flags field.
|
||||
@constant kSBCModePageCaching_WCE_Mask
|
||||
Mask for use with flags field.
|
||||
@constant kSBCModePageCaching_SIZE_Mask
|
||||
Mask for use with flags field.
|
||||
@constant kSBCModePageCaching_DISC_Mask
|
||||
Mask for use with flags field.
|
||||
@constant kSBCModePageCaching_CAP_Mask
|
||||
Mask for use with flags field.
|
||||
@constant kSBCModePageCaching_ABPF_Mask
|
||||
Mask for use with flags field.
|
||||
@constant kSBCModePageCaching_IC_Mask
|
||||
Mask for use with flags field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCModePageCaching_RCD_Bit = 0,
|
||||
kSBCModePageCaching_MF_Bit = 1,
|
||||
kSBCModePageCaching_WCE_Bit = 2,
|
||||
kSBCModePageCaching_SIZE_Bit = 3,
|
||||
kSBCModePageCaching_DISC_Bit = 4,
|
||||
kSBCModePageCaching_CAP_Bit = 5,
|
||||
kSBCModePageCaching_ABPF_Bit = 6,
|
||||
kSBCModePageCaching_IC_Bit = 7,
|
||||
|
||||
kSBCModePageCaching_RCD_Mask = (1 << kSBCModePageCaching_RCD_Bit),
|
||||
kSBCModePageCaching_MF_Mask = (1 << kSBCModePageCaching_MF_Bit),
|
||||
kSBCModePageCaching_WCE_Mask = (1 << kSBCModePageCaching_WCE_Bit),
|
||||
kSBCModePageCaching_SIZE_Mask = (1 << kSBCModePageCaching_SIZE_Bit),
|
||||
kSBCModePageCaching_DISC_Mask = (1 << kSBCModePageCaching_DISC_Bit),
|
||||
kSBCModePageCaching_CAP_Mask = (1 << kSBCModePageCaching_CAP_Bit),
|
||||
kSBCModePageCaching_ABPF_Mask = (1 << kSBCModePageCaching_ABPF_Bit),
|
||||
kSBCModePageCaching_IC_Mask = (1 << kSBCModePageCaching_IC_Bit)
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum Demand Read/Write Retention masks
|
||||
@discussion
|
||||
Demand Read/Write Retention masks.
|
||||
@constant kSBCModePageCaching_DEMAND_WRITE_Mask
|
||||
Mask for the DEMAND_READ_WRITE_RETENTION_PRIORITY field.
|
||||
@constant kSBCModePageCaching_DEMAND_READ_Mask
|
||||
Mask for the DEMAND_READ_WRITE_RETENTION_PRIORITY field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCModePageCaching_DEMAND_WRITE_Mask = 0x00FF,
|
||||
kSBCModePageCaching_DEMAND_READ_Mask = 0xFF00
|
||||
};
|
||||
|
||||
/*!
|
||||
@enum Caching flags2 bitfields
|
||||
@discussion
|
||||
Bit field definitions and masks for Caching flags2 field.
|
||||
@constant kSBCModePageCaching_VS1_Bit
|
||||
VS1 Bit definition.
|
||||
@constant kSBCModePageCaching_VS2_Bit
|
||||
VS2 Bit definition.
|
||||
@constant kSBCModePageCaching_DRA_Bit
|
||||
DRA Bit definition.
|
||||
@constant kSBCModePageCaching_LBCSS_Bit
|
||||
LBCSS Bit definition.
|
||||
@constant kSBCModePageCaching_FSW_Bit
|
||||
FSW Bit definition.
|
||||
@constant kSBCModePageCaching_VS1_Mask
|
||||
Mask for use with flags2 field.
|
||||
@constant kSBCModePageCaching_VS2_Mask
|
||||
Mask for use with flags2 field.
|
||||
@constant kSBCModePageCaching_DRA_Mask
|
||||
Mask for use with flags2 field.
|
||||
@constant kSBCModePageCaching_LBCSS_Mask
|
||||
Mask for use with flags2 field.
|
||||
@constant kSBCModePageCaching_FSW_Mask
|
||||
Mask for use with flags2 field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
// Bits 0:2 Reserved
|
||||
kSBCModePageCaching_VS1_Bit = 3,
|
||||
kSBCModePageCaching_VS2_Bit = 4,
|
||||
kSBCModePageCaching_DRA_Bit = 5,
|
||||
kSBCModePageCaching_LBCSS_Bit = 6,
|
||||
kSBCModePageCaching_FSW_Bit = 7,
|
||||
|
||||
kSBCModePageCaching_VS1_Mask = (1 << kSBCModePageCaching_VS1_Bit),
|
||||
kSBCModePageCaching_VS2_Mask = (1 << kSBCModePageCaching_VS2_Bit),
|
||||
kSBCModePageCaching_DRA_Mask = (1 << kSBCModePageCaching_DRA_Bit),
|
||||
kSBCModePageCaching_LBCSS_Mask = (1 << kSBCModePageCaching_LBCSS_Bit),
|
||||
kSBCModePageCaching_FSW_Mask = (1 << kSBCModePageCaching_FSW_Bit)
|
||||
};
|
||||
|
||||
#pragma options align=reset
|
||||
|
||||
#endif /* _IOKIT_SCSI_CMDS_MODE_DEFINITIONS_H_ */
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_SCSI_CMDS_READ_CAPACITY_H_
|
||||
#define _IOKIT_SCSI_CMDS_READ_CAPACITY_H_
|
||||
|
||||
|
||||
#if KERNEL
|
||||
#include <IOKit/IOTypes.h>
|
||||
#else
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*! @header SCSI Request Sense Definitions
|
||||
@discussion
|
||||
This file contains all definitions for the data returned from
|
||||
the READ CAPACITY 10 (0x25) and READ CAPACITY 16 (0x9E) commands.
|
||||
*/
|
||||
|
||||
/*!
|
||||
@enum READ CAPACITY Payload Sizes
|
||||
@discussion
|
||||
Sizes of the payload for the READ CAPACITY 10 and
|
||||
READ CAPACITY 16 commands.
|
||||
@constant kREPORT_CAPACITY_DataSize
|
||||
Data size for a READ_CAPACITY command.
|
||||
@constant kREPORT_CAPACITY_16_DataSize
|
||||
Data size for a READ_CAPACITY_16 command.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kREPORT_CAPACITY_DataSize = 8,
|
||||
kREPORT_CAPACITY_16_DataSize = 32
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@constant kREPORT_CAPACITY_MaximumLBA
|
||||
@discussion
|
||||
Maximum LBA supported via READ CAPACITY 10 command.
|
||||
*/
|
||||
#define kREPORT_CAPACITY_MaximumLBA 0xFFFFFFFFUL
|
||||
|
||||
|
||||
/*!
|
||||
@constant kREPORT_CAPACITY_16_MaximumLBA
|
||||
@discussion
|
||||
Maximum LBA supported via READ CAPACITY 16 command.
|
||||
*/
|
||||
#define kREPORT_CAPACITY_16_MaximumLBA 0xFFFFFFFFFFFFFFFFULL
|
||||
|
||||
|
||||
/*!
|
||||
@struct SCSI_Capacity_Data
|
||||
@discussion
|
||||
Capacity return structure for READ CAPACITY 10 command.
|
||||
*/
|
||||
typedef struct SCSI_Capacity_Data
|
||||
{
|
||||
UInt32 RETURNED_LOGICAL_BLOCK_ADDRESS;
|
||||
UInt32 BLOCK_LENGTH_IN_BYTES;
|
||||
} SCSI_Capacity_Data;
|
||||
|
||||
|
||||
/*!
|
||||
@struct SCSI_Capacity_Data_Long
|
||||
@discussion
|
||||
Capacity return structure for READ CAPACITY 16 command.
|
||||
*/
|
||||
typedef struct SCSI_Capacity_Data_Long
|
||||
{
|
||||
UInt64 RETURNED_LOGICAL_BLOCK_ADDRESS;
|
||||
UInt32 BLOCK_LENGTH_IN_BYTES;
|
||||
UInt8 RTO_EN_PROT_EN;
|
||||
UInt8 Reserved[19];
|
||||
} SCSI_Capacity_Data_Long;
|
||||
|
||||
|
||||
/*!
|
||||
@enum RTO_EN definitions
|
||||
@discussion
|
||||
Values for the REFERENCE TAG OWN (RTO_EN) bit in the
|
||||
READ CAPACITY Long Data structure.
|
||||
@constant kREAD_CAPACITY_RTO_Enabled
|
||||
Reference Tag Own enabled.
|
||||
@constant kREAD_CAPACITY_RTO_Disabled
|
||||
Reference Tag Own disabled.
|
||||
@constant kREAD_CAPACITY_RTO_Mask
|
||||
Mask to use when checking the RTO_EN_PROT_EN field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kREAD_CAPACITY_RTO_Enabled = 0x02,
|
||||
kREAD_CAPACITY_RTO_Disabled = 0x00,
|
||||
kREAD_CAPACITY_RTO_Mask = 0x02
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum PROTECTION INFORMATION definitions
|
||||
@discussion
|
||||
Values for the PROTECTION INFORMATION (PROT_EN) bit in the
|
||||
READ CAPACITY Long Data structure.
|
||||
@constant kREAD_CAPACITY_PROT_Enabled
|
||||
Protection Information enabled.
|
||||
@constant kREAD_CAPACITY_PROT_Disabled
|
||||
Protection Information disabled.
|
||||
@constant kREAD_CAPACITY_PROT_Mask
|
||||
Mask to use when checking the RTO_EN_PROT_EN field.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
kREAD_CAPACITY_PROT_Enabled = 0x01,
|
||||
kREAD_CAPACITY_PROT_Disabled = 0x00,
|
||||
kREAD_CAPACITY_PROT_Mask = 0x01
|
||||
};
|
||||
|
||||
|
||||
#endif /* _IOKIT_SCSI_CMDS_READ_CAPACITY_H_ */
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (c) 2004-2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_SCSI_CMDS_REPORT_LUNS_DEFINITIONS_H_
|
||||
#define _IOKIT_SCSI_CMDS_REPORT_LUNS_DEFINITIONS_H_
|
||||
|
||||
|
||||
#if KERNEL
|
||||
#include <IOKit/IOTypes.h>
|
||||
#else
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*! @header SCSI Request Sense Definitions
|
||||
@discussion
|
||||
This file contains all definitions for the data returned from
|
||||
the REPORT_LUNS (0xA0) command.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
@struct SCSICmd_REPORT_LUNS_LUN_ENTRY
|
||||
@discussion
|
||||
This structure represents a single LUN entry in a LUN list
|
||||
returned via the REPORT_LUNS command.
|
||||
*/
|
||||
typedef struct SCSICmd_REPORT_LUNS_LUN_ENTRY
|
||||
{
|
||||
UInt16 FIRST_LEVEL_ADDRESSING;
|
||||
UInt16 SECOND_LEVEL_ADDRESSING;
|
||||
UInt16 THIRD_LEVEL_ADDRESSING;
|
||||
UInt16 FOURTH_LEVEL_ADDRESSING;
|
||||
} SCSICmd_REPORT_LUNS_LUN_ENTRY;
|
||||
|
||||
|
||||
/*!
|
||||
@constant kREPORT_LUNS_HeaderSize
|
||||
@discussion
|
||||
Size of the REPORT_LUNS header as defined in the SPC-3 specification.
|
||||
*/
|
||||
#define kREPORT_LUNS_HeaderSize 8
|
||||
|
||||
/*!
|
||||
@enum REPORT_LUNS addressing methods.
|
||||
@discussion
|
||||
REPORT_LUNS addressing methods described in
|
||||
SAM-2 documents.
|
||||
@constant kREPORT_LUNS_ADDRESS_METHOD_PERIPHERAL_DEVICE
|
||||
Peripheral Device Addressing Method.
|
||||
@constant kREPORT_LUNS_ADDRESS_DEVICE_TYPE_SPECIFIC
|
||||
Device Type Specific Addressing Method.
|
||||
@constant kREPORT_LUNS_ADDRESS_METHOD_LOGICAL_UNIT
|
||||
Logical Unit Specific Addressing Method.
|
||||
@constant kREPORT_LUNS_ADDRESS_METHOD_OFFSET
|
||||
Offset to the address method data.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kREPORT_LUNS_ADDRESS_METHOD_PERIPHERAL_DEVICE = 0,
|
||||
kREPORT_LUNS_ADDRESS_METHOD_FLAT_SPACE = 1,
|
||||
kREPORT_LUNS_ADDRESS_DEVICE_TYPE_SPECIFIC = kREPORT_LUNS_ADDRESS_METHOD_FLAT_SPACE,
|
||||
kREPORT_LUNS_ADDRESS_METHOD_LOGICAL_UNIT = 2,
|
||||
// Reserved [3]
|
||||
kREPORT_LUNS_ADDRESS_METHOD_OFFSET = 14
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@struct REPORT_LUNS_LOGICAL_UNIT_ADDRESSING
|
||||
@discussion
|
||||
This structure represents a LUN Addressing scheme.
|
||||
*/
|
||||
typedef struct REPORT_LUNS_LOGICAL_UNIT_ADDRESSING
|
||||
{
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
UInt16 LUN : 5;
|
||||
UInt16 BUS_NUMBER : 3;
|
||||
UInt16 TARGET : 6;
|
||||
UInt16 reserved2 : 1;
|
||||
UInt16 reserved : 1;
|
||||
#else /* !__LITTLE_ENDIAN__ */
|
||||
UInt16 reserved : 1;
|
||||
UInt16 reserved2 : 1;
|
||||
UInt16 TARGET : 6;
|
||||
UInt16 BUS_NUMBER : 3;
|
||||
UInt16 LUN : 5;
|
||||
#endif /* !__LITTLE_ENDIAN__ */
|
||||
} REPORT_LUNS_LOGICAL_UNIT_ADDRESSING;
|
||||
|
||||
|
||||
/*!
|
||||
@struct REPORT_LUNS_PERIPHERAL_DEVICE_ADDRESSING
|
||||
@discussion
|
||||
This structure represents a Peripheral Device Addressing scheme.
|
||||
*/
|
||||
typedef struct REPORT_LUNS_PERIPHERAL_DEVICE_ADDRESSING
|
||||
{
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
UInt16 TARGET_LUN : 8;
|
||||
UInt16 BUS_IDENTIFIER : 6;
|
||||
UInt16 reserved2 : 1;
|
||||
UInt16 reserved : 1;
|
||||
#else /* !__LITTLE_ENDIAN__ */
|
||||
UInt16 reserved : 1;
|
||||
UInt16 reserved2 : 1;
|
||||
UInt16 BUS_IDENTIFIER : 6;
|
||||
UInt16 TARGET_LUN : 8;
|
||||
#endif /* !__LITTLE_ENDIAN__ */
|
||||
} REPORT_LUNS_PERIPHERAL_DEVICE_ADDRESSING;
|
||||
|
||||
|
||||
/*!
|
||||
@struct SCSICmd_REPORT_LUNS_Header
|
||||
@discussion
|
||||
This structure defines the format of the data that is returned for
|
||||
the REPORT_LUNS command.
|
||||
*/
|
||||
typedef struct SCSICmd_REPORT_LUNS_Header
|
||||
{
|
||||
UInt32 LUN_LIST_LENGTH; // LUN list length in bytes.
|
||||
UInt32 RESERVED;
|
||||
SCSICmd_REPORT_LUNS_LUN_ENTRY LUN[1]; // Variable length list. Must have at least LUN 0 if
|
||||
} SCSICmd_REPORT_LUNS_Header; // Target supports REPORT_LUNS command.
|
||||
|
||||
|
||||
#endif /* _IOKIT_SCSI_CMDS_REPORT_LUNS_DEFINITIONS_H_ */
|
||||
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_
|
||||
#define _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_
|
||||
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_DRIVERKIT
|
||||
typedef uint8_t UInt8;
|
||||
#else
|
||||
#if KERNEL
|
||||
#include <IOKit/IOTypes.h>
|
||||
#else
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*! @header SCSI Request Sense Definitions
|
||||
@discussion
|
||||
This file contains all definitions for the data returned from
|
||||
the REQUEST SENSE (0x03) command and from auto sense on protocols
|
||||
that support it.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
@enum kSenseDefaultSize
|
||||
@discussion
|
||||
The default size for SCSI Request Sense data.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSenseDefaultSize = 18
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@struct SCSI_Sense_Data
|
||||
@discussion
|
||||
The basic SCSI Request Sense data structure.
|
||||
*/
|
||||
typedef struct SCSI_Sense_Data
|
||||
{
|
||||
UInt8 VALID_RESPONSE_CODE; // 7 = Valid. 6-0 = Response Code.
|
||||
UInt8 SEGMENT_NUMBER; // Segment number
|
||||
UInt8 SENSE_KEY; // 7 = FILEMARK, 6 = EOM, 5 = ILI, 3-0 = SENSE KEY.
|
||||
UInt8 INFORMATION_1; // INFORMATION.
|
||||
UInt8 INFORMATION_2; // INFORMATION.
|
||||
UInt8 INFORMATION_3; // INFORMATION.
|
||||
UInt8 INFORMATION_4; // INFORMATION.
|
||||
UInt8 ADDITIONAL_SENSE_LENGTH; // Number of additional bytes available in sense data
|
||||
UInt8 COMMAND_SPECIFIC_INFORMATION_1; // Command Specific Information
|
||||
UInt8 COMMAND_SPECIFIC_INFORMATION_2; // Command Specific Information
|
||||
UInt8 COMMAND_SPECIFIC_INFORMATION_3; // Command Specific Information
|
||||
UInt8 COMMAND_SPECIFIC_INFORMATION_4; // Command Specific Information
|
||||
UInt8 ADDITIONAL_SENSE_CODE; // Additional Sense Code
|
||||
UInt8 ADDITIONAL_SENSE_CODE_QUALIFIER; // Additional Sense Code Qualifier
|
||||
UInt8 FIELD_REPLACEABLE_UNIT_CODE; // Field Replaceable Unit Code
|
||||
UInt8 SKSV_SENSE_KEY_SPECIFIC_MSB; // 7 = Sense Key Specific Valid bit, 6-0 Sense Key Specific MSB
|
||||
UInt8 SENSE_KEY_SPECIFIC_MID; // Sense Key Specific Middle
|
||||
UInt8 SENSE_KEY_SPECIFIC_LSB; // Sense Key Specific LSB
|
||||
} SCSI_Sense_Data;
|
||||
|
||||
|
||||
/*!
|
||||
@enum Sense Valid
|
||||
@discussion
|
||||
Masks to use to determine if sense data is valid or not.
|
||||
@constant kSENSE_DATA_VALID
|
||||
Sense data is valid.
|
||||
@constant kSENSE_NOT_DATA_VALID
|
||||
Sense data is not valid.
|
||||
@constant kSENSE_DATA_VALID_Mask
|
||||
Validity mask to use when checking the VALID_RESPONSE_CODE field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSENSE_DATA_VALID = 0x80,
|
||||
kSENSE_NOT_DATA_VALID = 0x00,
|
||||
kSENSE_DATA_VALID_Mask = 0x80
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum Sense Response Codes
|
||||
@discussion
|
||||
Masks and values to determine the Response Code.
|
||||
@constant kSENSE_RESPONSE_CODE_Current_Errors
|
||||
Response code indicating current errors are reported.
|
||||
@constant kSENSE_RESPONSE_CODE_Deferred_Errors
|
||||
Response code indicating deferred errors are reported.
|
||||
@constant kSENSE_RESPONSE_CODE_Mask
|
||||
Mask to use when checking the VALID_RESPONSE_CODE field.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSENSE_RESPONSE_CODE_Current_Errors = 0x70,
|
||||
kSENSE_RESPONSE_CODE_Deferred_Errors = 0x71,
|
||||
kSENSE_RESPONSE_CODE_Mask = 0x7F
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum FILEMARK bit field definitions
|
||||
@discussion
|
||||
Masks and values to determine the FileMark bit field.
|
||||
@constant kSENSE_FILEMARK_Set
|
||||
Filemark bit is set.
|
||||
@constant kSENSE_FILEMARK_Not_Set
|
||||
Filemark bit is not set.
|
||||
@constant kSENSE_FILEMARK_Mask
|
||||
Mask to use when checking the SENSE_KEY field for the FILEMARK bit.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSENSE_FILEMARK_Set = 0x80,
|
||||
kSENSE_FILEMARK_Not_Set = 0x00,
|
||||
kSENSE_FILEMARK_Mask = 0x80
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum EOM bit field definitions
|
||||
@discussion
|
||||
Masks and values to determine the End Of Medium bit field.
|
||||
@constant kSENSE_EOM_Set
|
||||
End Of Medium bit is set.
|
||||
@constant kSENSE_EOM_Not_Set
|
||||
End Of Medium bit is not set.
|
||||
@constant kSENSE_EOM_Mask
|
||||
Mask to use when checking the SENSE_KEY field for the EOM bit.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSENSE_EOM_Set = 0x40,
|
||||
kSENSE_EOM_Not_Set = 0x00,
|
||||
kSENSE_EOM_Mask = 0x40
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum ILI bit field definitions
|
||||
@discussion
|
||||
Masks and values to determine the Incorrect Length Indicator bit field.
|
||||
@constant kSENSE_ILI_Set
|
||||
Incorrect Length Indicator bit is set.
|
||||
@constant kSENSE_ILI_Not_Set
|
||||
Incorrect Length Indicator bit is not set.
|
||||
@constant kSENSE_ILI_Mask
|
||||
Mask to use when checking the SENSE_KEY field for the ILI bit.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSENSE_ILI_Set = 0x20,
|
||||
kSENSE_ILI_Not_Set = 0x00,
|
||||
kSENSE_ILI_Mask = 0x20
|
||||
};
|
||||
|
||||
|
||||
/*!
|
||||
@enum Sense Key definitions
|
||||
@discussion
|
||||
Masks and values to determine the SENSE_KEY.
|
||||
@constant kSENSE_KEY_NO_SENSE
|
||||
No sense data is present.
|
||||
@constant kSENSE_KEY_RECOVERED_ERROR
|
||||
A recovered error has occurred.
|
||||
@constant kSENSE_KEY_NOT_READY
|
||||
Device server is not ready.
|
||||
@constant kSENSE_KEY_MEDIUM_ERROR
|
||||
Device server detected a medium error.
|
||||
@constant kSENSE_KEY_HARDWARE_ERROR
|
||||
Device server detected a hardware error.
|
||||
@constant kSENSE_KEY_ILLEGAL_REQUEST
|
||||
Device server detected an illegal request.
|
||||
@constant kSENSE_KEY_UNIT_ATTENTION
|
||||
Device server indicates a unit attention condition.
|
||||
@constant kSENSE_KEY_DATA_PROTECT
|
||||
Device server indicates a data protect condition.
|
||||
@constant kSENSE_KEY_BLANK_CHECK
|
||||
Device server indicates a blank check condition.
|
||||
@constant kSENSE_KEY_VENDOR_SPECIFIC
|
||||
Device server indicates a vendor specific condition.
|
||||
@constant kSENSE_KEY_COPY_ABORTED
|
||||
Device server indicates a copy aborted condition.
|
||||
@constant kSENSE_KEY_ABORTED_COMMAND
|
||||
Device server indicates an aborted command condition.
|
||||
@constant kSENSE_KEY_VOLUME_OVERFLOW
|
||||
Device server indicates a volume overflow condition.
|
||||
@constant kSENSE_KEY_MISCOMPARE
|
||||
Device server indicates a miscompare condition.
|
||||
@constant kSENSE_KEY_Mask
|
||||
Mask to use when checking the SENSE_KEY field for the SENSE_KEY value.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSENSE_KEY_NO_SENSE = 0x00,
|
||||
kSENSE_KEY_RECOVERED_ERROR = 0x01,
|
||||
kSENSE_KEY_NOT_READY = 0x02,
|
||||
kSENSE_KEY_MEDIUM_ERROR = 0x03,
|
||||
kSENSE_KEY_HARDWARE_ERROR = 0x04,
|
||||
kSENSE_KEY_ILLEGAL_REQUEST = 0x05,
|
||||
kSENSE_KEY_UNIT_ATTENTION = 0x06,
|
||||
kSENSE_KEY_DATA_PROTECT = 0x07,
|
||||
kSENSE_KEY_BLANK_CHECK = 0x08,
|
||||
kSENSE_KEY_VENDOR_SPECIFIC = 0x09,
|
||||
kSENSE_KEY_COPY_ABORTED = 0x0A,
|
||||
kSENSE_KEY_ABORTED_COMMAND = 0x0B,
|
||||
/* SENSE KEY 0x0C is obsoleted */
|
||||
kSENSE_KEY_VOLUME_OVERFLOW = 0x0D,
|
||||
kSENSE_KEY_MISCOMPARE = 0x0E,
|
||||
/* SENSE KEY 0x0F is reserved */
|
||||
kSENSE_KEY_Mask = 0x0F
|
||||
};
|
||||
|
||||
|
||||
#endif /* _IOKIT_SCSI_CMDS_REQUEST_SENSE_H_ */
|
||||
@@ -0,0 +1,479 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _IOKIT_SCSI_COMMAND_DEFINITIONS_H_
|
||||
#define _IOKIT_SCSI_COMMAND_DEFINITIONS_H_
|
||||
|
||||
|
||||
#if KERNEL
|
||||
#include <IOKit/IOTypes.h>
|
||||
#else
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*! @header SCSICommandDefinitions
|
||||
@discussion
|
||||
This file contains all the definitions for types and constants that are
|
||||
used by the command set classes for building CDBs. The field type
|
||||
definitions are used for the parameters passed to a method that builds and
|
||||
sends any SCSI defined command to clearly identify the type of value
|
||||
expected for a parameter.
|
||||
|
||||
The command methods will then use the appropriate mask to verify that the
|
||||
value passed into a parameter is of the specified type.
|
||||
|
||||
Currently only types and masks are defined for 8 bytes and smaller fields.
|
||||
If a command is defined that uses a larger field, these should be expanded
|
||||
to include those sizes.
|
||||
*/
|
||||
|
||||
#pragma mark Field Type Definitions
|
||||
/* These are the type definitions used for the parameters of methods that
|
||||
* build and send Command Descriptor Blocks.
|
||||
*/
|
||||
|
||||
/* 1 Byte or smaller fields. */
|
||||
|
||||
/*! @typedef SCSICmdField1Bit */
|
||||
typedef UInt8 SCSICmdField1Bit;
|
||||
|
||||
/*! @typedef SCSICmdField2Bit */
|
||||
typedef UInt8 SCSICmdField2Bit;
|
||||
|
||||
/*! @typedef SCSICmdField3Bit */
|
||||
typedef UInt8 SCSICmdField3Bit;
|
||||
|
||||
/*! @typedef SCSICmdField4Bit */
|
||||
typedef UInt8 SCSICmdField4Bit;
|
||||
|
||||
/*! @typedef SCSICmdField5Bit */
|
||||
typedef UInt8 SCSICmdField5Bit;
|
||||
|
||||
/*! @typedef SCSICmdField6Bit */
|
||||
typedef UInt8 SCSICmdField6Bit;
|
||||
|
||||
/*! @typedef SCSICmdField7Bit */
|
||||
typedef UInt8 SCSICmdField7Bit;
|
||||
|
||||
/*! @typedef SCSICmdField1Byte */
|
||||
typedef UInt8 SCSICmdField1Byte;
|
||||
|
||||
/* 2 Bytes or smaller fields. */
|
||||
|
||||
/*! @typedef SCSICmdField9Bit */
|
||||
typedef UInt16 SCSICmdField9Bit;
|
||||
|
||||
/*! @typedef SCSICmdField10Bit */
|
||||
typedef UInt16 SCSICmdField10Bit;
|
||||
|
||||
/*! @typedef SCSICmdField11Bit */
|
||||
typedef UInt16 SCSICmdField11Bit;
|
||||
|
||||
/*! @typedef SCSICmdField12Bit */
|
||||
typedef UInt16 SCSICmdField12Bit;
|
||||
|
||||
/*! @typedef SCSICmdField13Bit */
|
||||
typedef UInt16 SCSICmdField13Bit;
|
||||
|
||||
/*! @typedef SCSICmdField14Bit */
|
||||
typedef UInt16 SCSICmdField14Bit;
|
||||
|
||||
/*! @typedef SCSICmdField15Bit */
|
||||
typedef UInt16 SCSICmdField15Bit;
|
||||
|
||||
/*! @typedef SCSICmdField2Byte */
|
||||
typedef UInt16 SCSICmdField2Byte;
|
||||
|
||||
/* 3 Bytes or smaller fields. */
|
||||
|
||||
/*! @typedef SCSICmdField17Bit */
|
||||
typedef UInt32 SCSICmdField17Bit;
|
||||
|
||||
/*! @typedef SCSICmdField18Bit */
|
||||
typedef UInt32 SCSICmdField18Bit;
|
||||
|
||||
/*! @typedef SCSICmdField19Bit */
|
||||
typedef UInt32 SCSICmdField19Bit;
|
||||
|
||||
/*! @typedef SCSICmdField20Bit */
|
||||
typedef UInt32 SCSICmdField20Bit;
|
||||
|
||||
/*! @typedef SCSICmdField21Bit */
|
||||
typedef UInt32 SCSICmdField21Bit;
|
||||
|
||||
/*! @typedef SCSICmdField22Bit */
|
||||
typedef UInt32 SCSICmdField22Bit;
|
||||
|
||||
/*! @typedef SCSICmdField23Bit */
|
||||
typedef UInt32 SCSICmdField23Bit;
|
||||
|
||||
/*! @typedef SCSICmdField3Byte */
|
||||
typedef UInt32 SCSICmdField3Byte;
|
||||
|
||||
/* 4 Bytes or smaller fields. */
|
||||
|
||||
/*! @typedef SCSICmdField25Bit */
|
||||
typedef UInt32 SCSICmdField25Bit;
|
||||
|
||||
/*! @typedef SCSICmdField26Bit */
|
||||
typedef UInt32 SCSICmdField26Bit;
|
||||
|
||||
/*! @typedef SCSICmdField27Bit */
|
||||
typedef UInt32 SCSICmdField27Bit;
|
||||
|
||||
/*! @typedef SCSICmdField28Bit */
|
||||
typedef UInt32 SCSICmdField28Bit;
|
||||
|
||||
/*! @typedef SCSICmdField29Bit */
|
||||
typedef UInt32 SCSICmdField29Bit;
|
||||
|
||||
/*! @typedef SCSICmdField30Bit */
|
||||
typedef UInt32 SCSICmdField30Bit;
|
||||
|
||||
/*! @typedef SCSICmdField31Bit */
|
||||
typedef UInt32 SCSICmdField31Bit;
|
||||
|
||||
/*! @typedef SCSICmdField4Byte */
|
||||
typedef UInt32 SCSICmdField4Byte;
|
||||
|
||||
/* 5 Bytes or smaller fields. */
|
||||
|
||||
/*! @typedef SCSICmdField33Bit */
|
||||
typedef UInt64 SCSICmdField33Bit;
|
||||
|
||||
/*! @typedef SCSICmdField34Bit */
|
||||
typedef UInt64 SCSICmdField34Bit;
|
||||
|
||||
/*! @typedef SCSICmdField35Bit */
|
||||
typedef UInt64 SCSICmdField35Bit;
|
||||
|
||||
/*! @typedef SCSICmdField36Bit */
|
||||
typedef UInt64 SCSICmdField36Bit;
|
||||
|
||||
/*! @typedef SCSICmdField37Bit */
|
||||
typedef UInt64 SCSICmdField37Bit;
|
||||
|
||||
/*! @typedef SCSICmdField38Bit */
|
||||
typedef UInt64 SCSICmdField38Bit;
|
||||
|
||||
/*! @typedef SCSICmdField39Bit */
|
||||
typedef UInt64 SCSICmdField39Bit;
|
||||
|
||||
/*! @typedef SCSICmdField5Byte */
|
||||
typedef UInt64 SCSICmdField5Byte;
|
||||
|
||||
/* 6 Bytes or smaller fields. */
|
||||
|
||||
/*! @typedef SCSICmdField41Bit */
|
||||
typedef UInt64 SCSICmdField41Bit;
|
||||
|
||||
/*! @typedef SCSICmdField42Bit */
|
||||
typedef UInt64 SCSICmdField42Bit;
|
||||
|
||||
/*! @typedef SCSICmdField43Bit */
|
||||
typedef UInt64 SCSICmdField43Bit;
|
||||
|
||||
/*! @typedef SCSICmdField44Bit */
|
||||
typedef UInt64 SCSICmdField44Bit;
|
||||
|
||||
/*! @typedef SCSICmdField45Bit */
|
||||
typedef UInt64 SCSICmdField45Bit;
|
||||
|
||||
/*! @typedef SCSICmdField46Bit */
|
||||
typedef UInt64 SCSICmdField46Bit;
|
||||
|
||||
/*! @typedef SCSICmdField47Bit */
|
||||
typedef UInt64 SCSICmdField47Bit;
|
||||
|
||||
/*! @typedef SCSICmdField6Byte */
|
||||
typedef UInt64 SCSICmdField6Byte;
|
||||
|
||||
/* 7 Bytes or smaller fields. */
|
||||
|
||||
/*! @typedef SCSICmdField49Bit */
|
||||
typedef UInt64 SCSICmdField49Bit;
|
||||
|
||||
/*! @typedef SCSICmdField50Bit */
|
||||
typedef UInt64 SCSICmdField50Bit;
|
||||
|
||||
/*! @typedef SCSICmdField51Bit */
|
||||
typedef UInt64 SCSICmdField51Bit;
|
||||
|
||||
/*! @typedef SCSICmdField52Bit */
|
||||
typedef UInt64 SCSICmdField52Bit;
|
||||
|
||||
/*! @typedef SCSICmdField53Bit */
|
||||
typedef UInt64 SCSICmdField53Bit;
|
||||
|
||||
/*! @typedef SCSICmdField54Bit */
|
||||
typedef UInt64 SCSICmdField54Bit;
|
||||
|
||||
/*! @typedef SCSICmdField55Bit */
|
||||
typedef UInt64 SCSICmdField55Bit;
|
||||
|
||||
/*! @typedef SCSICmdField7Byte */
|
||||
typedef UInt64 SCSICmdField7Byte;
|
||||
|
||||
/* 8 Bytes or smaller fields. */
|
||||
|
||||
/*! @typedef SCSICmdField57Bit */
|
||||
typedef UInt64 SCSICmdField57Bit;
|
||||
|
||||
/*! @typedef SCSICmdField58Bit */
|
||||
typedef UInt64 SCSICmdField58Bit;
|
||||
|
||||
/*! @typedef SCSICmdField59Bit */
|
||||
typedef UInt64 SCSICmdField59Bit;
|
||||
|
||||
/*! @typedef SCSICmdField60Bit */
|
||||
typedef UInt64 SCSICmdField60Bit;
|
||||
|
||||
/*! @typedef SCSICmdField61Bit */
|
||||
typedef UInt64 SCSICmdField61Bit;
|
||||
|
||||
/*! @typedef SCSICmdField62Bit */
|
||||
typedef UInt64 SCSICmdField62Bit;
|
||||
|
||||
/*! @typedef SCSICmdField63Bit */
|
||||
typedef UInt64 SCSICmdField63Bit;
|
||||
|
||||
/*! @typedef SCSICmdField8Byte */
|
||||
typedef UInt64 SCSICmdField8Byte;
|
||||
|
||||
|
||||
#pragma mark Field Mask Definitions
|
||||
/* These are masks that are used to verify that the values passed into the
|
||||
* parameters for the fields are not larger than the field size.
|
||||
*
|
||||
* NB: These have changed from enums to #define since enums greater than
|
||||
* 32 bits in size are not well-defined in C99.
|
||||
*/
|
||||
|
||||
/* 1 Byte or smaller fields. */
|
||||
|
||||
/*! @constant kSCSICmdFieldMask1Bit */
|
||||
#define kSCSICmdFieldMask1Bit 0x01
|
||||
|
||||
/*! @constant kSCSICmdFieldMask2Bit */
|
||||
#define kSCSICmdFieldMask2Bit 0x03
|
||||
|
||||
/*! @constant kSCSICmdFieldMask3Bit */
|
||||
#define kSCSICmdFieldMask3Bit 0x07
|
||||
|
||||
/*! @constant kSCSICmdFieldMask4Bit */
|
||||
#define kSCSICmdFieldMask4Bit 0x0F
|
||||
|
||||
/*! @constant kSCSICmdFieldMask5Bit */
|
||||
#define kSCSICmdFieldMask5Bit 0x1F
|
||||
|
||||
/*! @constant kSCSICmdFieldMask6Bit */
|
||||
#define kSCSICmdFieldMask6Bit 0x3F
|
||||
|
||||
/*! @constant kSCSICmdFieldMask7Bit */
|
||||
#define kSCSICmdFieldMask7Bit 0x7F
|
||||
|
||||
#define kSCSICmdFieldMask1Byte 0xFF
|
||||
|
||||
/* 2 Bytes or smaller fields. */
|
||||
|
||||
/*! @constant kSCSICmdFieldMask9Bit */
|
||||
#define kSCSICmdFieldMask9Bit 0x01FF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask10Bit */
|
||||
#define kSCSICmdFieldMask10Bit 0x03FF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask11Bit */
|
||||
#define kSCSICmdFieldMask11Bit 0x07FF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask12Bit */
|
||||
#define kSCSICmdFieldMask12Bit 0x0FFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask13Bit */
|
||||
#define kSCSICmdFieldMask13Bit 0x1FFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask14Bit */
|
||||
#define kSCSICmdFieldMask14Bit 0x3FFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask15Bit */
|
||||
#define kSCSICmdFieldMask15Bit 0x7FFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask2Byte */
|
||||
#define kSCSICmdFieldMask2Byte 0xFFFF
|
||||
|
||||
/* 3 Bytes or smaller fields. */
|
||||
|
||||
/*! @constant kSCSICmdFieldMask17Bit */
|
||||
#define kSCSICmdFieldMask17Bit 0x01FFFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask18Bit */
|
||||
#define kSCSICmdFieldMask18Bit 0x03FFFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask19Bit */
|
||||
#define kSCSICmdFieldMask19Bit 0x07FFFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask20Bit */
|
||||
#define kSCSICmdFieldMask20Bit 0x0FFFFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask21Bit */
|
||||
#define kSCSICmdFieldMask21Bit 0x1FFFFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask22Bit */
|
||||
#define kSCSICmdFieldMask22Bit 0x3FFFFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask23Bit */
|
||||
#define kSCSICmdFieldMask23Bit 0x7FFFFF
|
||||
|
||||
/*! @constant kSCSICmdFieldMask3Byte */
|
||||
#define kSCSICmdFieldMask3Byte 0xFFFFFF
|
||||
|
||||
/* 4 Bytes or smaller fields. */
|
||||
/*! @constant kSCSICmdFieldMask25Bit */
|
||||
#define kSCSICmdFieldMask25Bit 0x01FFFFFFUL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask26Bit */
|
||||
#define kSCSICmdFieldMask26Bit 0x03FFFFFFUL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask27Bit */
|
||||
#define kSCSICmdFieldMask27Bit 0x07FFFFFFUL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask28Bit */
|
||||
#define kSCSICmdFieldMask28Bit 0x0FFFFFFFUL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask29Bit */
|
||||
#define kSCSICmdFieldMask29Bit 0x1FFFFFFFUL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask30Bit */
|
||||
#define kSCSICmdFieldMask30Bit 0x3FFFFFFFUL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask31Bit */
|
||||
#define kSCSICmdFieldMask31Bit 0x7FFFFFFFUL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask4Byte */
|
||||
#define kSCSICmdFieldMask4Byte 0xFFFFFFFFUL
|
||||
|
||||
/* 5 Bytes or smaller fields. */
|
||||
|
||||
/*! @constant kSCSICmdFieldMask33Bit */
|
||||
#define kSCSICmdFieldMask33Bit 0x01FFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask34Bit */
|
||||
#define kSCSICmdFieldMask34Bit 0x03FFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask35Bit */
|
||||
#define kSCSICmdFieldMask35Bit 0x07FFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask36Bit */
|
||||
#define kSCSICmdFieldMask36Bit 0x0FFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask37Bit */
|
||||
#define kSCSICmdFieldMask37Bit 0x1FFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask38Bit */
|
||||
#define kSCSICmdFieldMask38Bit 0x3FFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask39Bit */
|
||||
#define kSCSICmdFieldMask39Bit 0x7FFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask5Byte */
|
||||
#define kSCSICmdFieldMask5Byte 0xFFFFFFFFFFULL
|
||||
|
||||
/* 6 Bytes or smaller fields. */
|
||||
|
||||
/*! @constant kSCSICmdFieldMask41Bit */
|
||||
#define kSCSICmdFieldMask41Bit 0x01FFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask42Bit */
|
||||
#define kSCSICmdFieldMask42Bit 0x03FFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask43Bit */
|
||||
#define kSCSICmdFieldMask43Bit 0x07FFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask44Bit */
|
||||
#define kSCSICmdFieldMask44Bit 0x0FFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask45Bit */
|
||||
#define kSCSICmdFieldMask45Bit 0x1FFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask46Bit */
|
||||
#define kSCSICmdFieldMask46Bit 0x3FFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask47Bit */
|
||||
#define kSCSICmdFieldMask47Bit 0x7FFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask6Byte */
|
||||
#define kSCSICmdFieldMask6Byte 0xFFFFFFFFFFFFULL
|
||||
|
||||
/* 7 Bytes or smaller fields. */
|
||||
|
||||
/*! @constant kSCSICmdFieldMask49Bit */
|
||||
#define kSCSICmdFieldMask49Bit 0x01FFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask50Bit */
|
||||
#define kSCSICmdFieldMask50Bit 0x03FFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask51Bit */
|
||||
#define kSCSICmdFieldMask51Bit 0x07FFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask52Bit */
|
||||
#define kSCSICmdFieldMask52Bit 0x0FFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask53Bit */
|
||||
#define kSCSICmdFieldMask53Bit 0x1FFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask54Bit */
|
||||
#define kSCSICmdFieldMask54Bit 0x3FFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask55Bit */
|
||||
#define kSCSICmdFieldMask55Bit 0x7FFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask7Byte */
|
||||
#define kSCSICmdFieldMask7Byte 0xFFFFFFFFFFFFFFULL
|
||||
|
||||
/* 8 Bytes or smaller fields. */
|
||||
|
||||
/*! @constant kSCSICmdFieldMask57Bit */
|
||||
#define kSCSICmdFieldMask57Bit 0x01FFFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask58Bit */
|
||||
#define kSCSICmdFieldMask58Bit 0x03FFFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask59Bit */
|
||||
#define kSCSICmdFieldMask59Bit 0x07FFFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask60Bit */
|
||||
#define kSCSICmdFieldMask60Bit 0x0FFFFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask61Bit */
|
||||
#define kSCSICmdFieldMask61Bit 0x1FFFFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask62Bit */
|
||||
#define kSCSICmdFieldMask62Bit 0x3FFFFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask63Bit */
|
||||
#define kSCSICmdFieldMask63Bit 0x7FFFFFFFFFFFFFFFULL
|
||||
|
||||
/*! @constant kSCSICmdFieldMask8Byte */
|
||||
#define kSCSICmdFieldMask8Byte 0xFFFFFFFFFFFFFFFFULL
|
||||
|
||||
#endif /* _IOKIT_SCSI_COMMAND_DEFINITIONS_H_ */
|
||||
@@ -0,0 +1,920 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
#ifndef _SCSI_COMMAND_OPERATION_CODES_H_
|
||||
#define _SCSI_COMMAND_OPERATION_CODES_H_
|
||||
|
||||
#pragma mark About this file
|
||||
/* This file contains the operation code definitions for all commands defined
|
||||
* by the SCSI specifications. The commands are listed in three formats:
|
||||
* 1) All commands are listed in alphabetical order. This list is the live
|
||||
* enumeration for all of the command constants.
|
||||
* 2) The commands are listed in ascending numerical order.
|
||||
* 3) The commands are grouped by Peripheral Device Type.
|
||||
*
|
||||
* In the command listings by Peripheral Device Type, there will be a comment
|
||||
* following each command. This comment indentifies the section of the related
|
||||
* specification where the commands is defined and the requirement type of the
|
||||
* command, Mandatory or Optional.
|
||||
* If a specification redefines an optional command from SPC as mandatory,
|
||||
* the command will be relisted in the Peripheral Device Type command list with
|
||||
* the mandatory tag next to it.
|
||||
* All commands that are listed in SPC as Device Type Specifc will be relisted
|
||||
* as a comment in all specifications lists that support that command with the
|
||||
* appropriate Mandatory or Optional tag for that specification.
|
||||
*
|
||||
* The section number and the requirement type of the command are based on the
|
||||
* version of the specification listed in the header comment for the Peripheral
|
||||
* Device Type. This data is provided for informational purposes only. The
|
||||
* specification document and version that the device adheres to as indicated
|
||||
* by the data returned in response to the INQUIRY command should be used as
|
||||
* the authorative source for supported and required behavior of the device.
|
||||
*
|
||||
* The SPC set is listed before all other Peripheral Device Type commands as
|
||||
* this is the base document from which all of the other documents are derived.
|
||||
*
|
||||
* The Peripheral Device Types and associated command sets as defined by SPC-2,
|
||||
* section 7.4.1 are as follows:
|
||||
* Peripheral Device Type Associated Command Specification
|
||||
* ------------------------------------ -----------------------------------
|
||||
* 0x00 Direct Access Device SBC - SCSI-3 Block Commands
|
||||
* 0x01 Sequential Access Device SSC - SCSI-3 Stream Commands
|
||||
* 0x02 Printer Device SSC - SCSI-3 Stream Commands
|
||||
* 0x03 Processor Device SPC - SCSI Primary Commands-2
|
||||
* 0x04 Write Once Device SBC - SCSI-3 Block Commands
|
||||
* 0x05 CD-ROM Device MMC - SCSI Multimedia Commands-2
|
||||
* 0x06 Scanner Device SGC - SCSI-3 Graphics Commands
|
||||
* 0x07 Optical Memory Device SBC - SCSI-3 Block Commands
|
||||
* 0x08 Medium Changer Device SMC - SCSI-3 Medium Changer Cmds
|
||||
* 0x09 Communications Device SSC - SCSI-3 Stream Commands
|
||||
* 0x0A - 0x0B Graphic Arts Prepress Dev ASC IT8
|
||||
* 0x0C Storage Array Controller Device SCC-2 - SCSI Controller Commands-2
|
||||
* 0x0D Enclosure Services SES - SCSI-3 Enclosure Services
|
||||
* 0x0E Simplified Direct Access Device RBC - SCSI Reduced Block Commands
|
||||
* 0x0F Optical Card Reader/Writer Device OCRW - SCSI Specification for
|
||||
* Optical Card Reader/Writer
|
||||
* 0x10 Reserved No command specification
|
||||
* 0x11 Object-Based Storage Device OSD - SCSI Object Based Storage
|
||||
* Device Commands
|
||||
* 0x12 - 0x14 Reserved No command specification
|
||||
* 0x15 Multimedia Media Access Engine RMC - Reduced Multimedia Commands
|
||||
* 0x16 - 0x1E Reserved No command specification
|
||||
* 0x1F Unknown or No Device No command specification
|
||||
*/
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Command Definitions by Name
|
||||
/* All SCSI Commands listed in alphabetical order. These are the live
|
||||
* definitions of the commands. All other command lists are informative.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSCSICmd_ACCESS_CONTROL_IN = 0x86,
|
||||
kSCSICmd_ACCESS_CONTROL_OUT = 0x87,
|
||||
kSCSICmd_BLANK = 0xA1,
|
||||
kSCSICmd_CHANGE_DEFINITION = 0x40,
|
||||
kSCSICmd_CLOSE_TRACK_SESSION = 0x5B,
|
||||
kSCSICmd_COMPARE = 0x39,
|
||||
kSCSICmd_COPY = 0x18,
|
||||
kSCSICmd_COPY_AND_VERIFY = 0x3A,
|
||||
kSCSICmd_ERASE_10 = 0x2C,
|
||||
kSCSICmd_ERASE_12 = 0xAC,
|
||||
kSCSICmd_EXTENDED_COPY = 0x83,
|
||||
kSCSICmd_FORMAT_UNIT = 0x04,
|
||||
kSCSICmd_GET_CONFIGURATION = 0x46,
|
||||
kSCSICmd_GET_EVENT_STATUS_NOTIFICATION = 0x4A,
|
||||
kSCSICmd_GET_PERFORMANCE = 0xAC,
|
||||
kSCSICmd_INQUIRY = 0x12,
|
||||
kSCSICmd_LOAD_UNLOAD_MEDIUM = 0xA6,
|
||||
kSCSICmd_LOCK_UNLOCK_CACHE = 0x36,
|
||||
kSCSICmd_LOCK_UNLOCK_CACHE_16 = 0x92,
|
||||
kSCSICmd_LOG_SELECT = 0x4C,
|
||||
kSCSICmd_LOG_SENSE = 0x4D,
|
||||
kSCSICmd_MAINTENANCE_IN = 0xA3,
|
||||
kSCSICmd_MAINTENANCE_OUT = 0xA4,
|
||||
kSCSICmd_MECHANISM_STATUS = 0xBD,
|
||||
kSCSICmd_MEDIUM_SCAN = 0x38,
|
||||
kSCSICmd_MODE_SELECT_6 = 0x15,
|
||||
kSCSICmd_MODE_SELECT_10 = 0x55,
|
||||
kSCSICmd_MODE_SENSE_6 = 0x1A,
|
||||
kSCSICmd_MODE_SENSE_10 = 0x5A,
|
||||
kSCSICmd_MOVE_MEDIUM_ATTACHED = 0xA7,
|
||||
kSCSICmd_PAUSE_RESUME = 0x4B,
|
||||
kSCSICmd_PERSISTENT_RESERVE_IN = 0x5E,
|
||||
kSCSICmd_PERSISTENT_RESERVE_OUT = 0x5F,
|
||||
kSCSICmd_PLAY_AUDIO_10 = 0x45,
|
||||
kSCSICmd_PLAY_AUDIO_12 = 0xA5,
|
||||
kSCSICmd_PLAY_AUDIO_MSF = 0x47,
|
||||
kSCSICmd_PLAY_AUDIO_TRACK_INDEX = 0x48,
|
||||
kSCSICmd_PLAY_CD = 0xBC,
|
||||
kSCSICmd_PLAY_RELATIVE_10 = 0x49,
|
||||
kSCSICmd_PLAY_RELATIVE_12 = 0xA9,
|
||||
kSCSICmd_PREFETCH = 0x34,
|
||||
kSCSICmd_PREFETCH_16 = 0x90,
|
||||
kSCSICmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E,
|
||||
kSCSICmd_READ_6 = 0x08,
|
||||
kSCSICmd_READ_10 = 0x28,
|
||||
kSCSICmd_READ_12 = 0xA8,
|
||||
kSCSICmd_READ_16 = 0x88,
|
||||
kSCSICmd_READ_ATTRIBUTE = 0x8C,
|
||||
kSCSICmd_READ_BUFFER = 0x3C,
|
||||
kSCSICmd_READ_BUFFER_CAPACITY = 0x5C,
|
||||
kSCSICmd_READ_CAPACITY = 0x25,
|
||||
kSCSICmd_READ_CD = 0xBE,
|
||||
kSCSICmd_READ_CD_MSF = 0xB9,
|
||||
kSCSICmd_READ_DEFECT_DATA_10 = 0x37,
|
||||
kSCSICmd_READ_DEFECT_DATA_12 = 0xB7,
|
||||
kSCSICmd_READ_DISC_INFORMATION = 0x51,
|
||||
kSCSICmd_READ_DVD_STRUCTURE = 0xAD,
|
||||
kSCSICmd_READ_DISC_STRUCTURE = 0xAD,
|
||||
kSCSICmd_READ_ELEMENT_STATUS_ATTACHED = 0xB4,
|
||||
kSCSICmd_READ_FORMAT_CAPACITIES = 0x23,
|
||||
kSCSICmd_READ_GENERATION = 0x29,
|
||||
kSCSICmd_READ_HEADER = 0x44,
|
||||
kSCSICmd_READ_LONG = 0x3E,
|
||||
kSCSICmd_READ_MASTER_CUE = 0x59,
|
||||
kSCSICmd_READ_SUB_CHANNEL = 0x42,
|
||||
kSCSICmd_READ_TOC_PMA_ATIP = 0x43,
|
||||
kSCSICmd_READ_TRACK_INFORMATION = 0x52,
|
||||
kSCSICmd_READ_UPDATED_BLOCK_10 = 0x2D,
|
||||
kSCSICmd_REASSIGN_BLOCKS = 0x07,
|
||||
kSCSICmd_REBUILD = 0x81,
|
||||
kSCSICmd_RECEIVE = 0x08,
|
||||
kSCSICmd_RECEIVE_COPY_RESULTS = 0x84,
|
||||
kSCSICmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C,
|
||||
kSCSICmd_REDUNDANCY_GROUP_IN = 0xBA,
|
||||
kSCSICmd_REDUNDANCY_GROUP_OUT = 0xBB,
|
||||
kSCSICmd_REGENERATE = 0x82,
|
||||
kSCSICmd_RELEASE_6 = 0x17,
|
||||
kSCSICmd_RELEASE_10 = 0x57,
|
||||
kSCSICmd_REPAIR_TRACK = 0x58,
|
||||
kSCSICmd_REPORT_DEVICE_IDENTIFIER = 0xA3,
|
||||
kSCSICmd_REPORT_KEY = 0xA4,
|
||||
kSCSICmd_REPORT_LUNS = 0xA0,
|
||||
kSCSICmd_REQUEST_SENSE = 0x03,
|
||||
kSCSICmd_RESERVE_6 = 0x16,
|
||||
kSCSICmd_RESERVE_10 = 0x56,
|
||||
kSCSICmd_RESERVE_TRACK = 0x53,
|
||||
kSCSICmd_REZERO_UNIT = 0x01,
|
||||
kSCSICmd_SCAN_MMC = 0xBA,
|
||||
kSCSICmd_SEARCH_DATA_EQUAL_10 = 0x31,
|
||||
kSCSICmd_SEARCH_DATA_EQUAL_12 = 0xB1,
|
||||
kSCSICmd_SEARCH_DATA_HIGH_10 = 0x30,
|
||||
kSCSICmd_SEARCH_DATA_HIGH_12 = 0xB0,
|
||||
kSCSICmd_SEARCH_DATA_LOW_10 = 0x32,
|
||||
kSCSICmd_SEARCH_DATA_LOW_12 = 0xB2,
|
||||
kSCSICmd_SEEK_6 = 0x0B,
|
||||
kSCSICmd_SEEK_10 = 0x2B,
|
||||
kSCSICmd_SEND = 0x0A,
|
||||
kSCSICmd_SEND_CUE_SHEET = 0x5D,
|
||||
kSCSICmd_SEND_DIAGNOSTICS = 0x1D,
|
||||
kSCSICmd_SEND_DVD_STRUCTURE = 0xBF,
|
||||
kSCSICmd_SEND_EVENT = 0xA2,
|
||||
kSCSICmd_SEND_KEY = 0xA3,
|
||||
kSCSICmd_SEND_OPC_INFORMATION = 0x54,
|
||||
kSCSICmd_SERVICE_ACTION_IN = 0x9E,
|
||||
kSCSICmd_SERVICE_ACTION_OUT = 0x9F,
|
||||
kSCSICmd_SET_CD_SPEED = 0xBB,
|
||||
kSCSICmd_SET_DEVICE_IDENTIFIER = 0xA4,
|
||||
kSCSICmd_SET_LIMITS_10 = 0x33,
|
||||
kSCSICmd_SET_LIMITS_12 = 0xB3,
|
||||
kSCSICmd_SET_READ_AHEAD = 0xA7,
|
||||
kSCSICmd_SET_STREAMING = 0xB6,
|
||||
kSCSICmd_SPARE_IN = 0xBC,
|
||||
kSCSICmd_SPARE_OUT = 0xBD,
|
||||
kSCSICmd_START_STOP_UNIT = 0x1B,
|
||||
kSCSICmd_STOP_PLAY_SCAN = 0x4E,
|
||||
kSCSICmd_SYNCHRONIZE_CACHE = 0x35,
|
||||
kSCSICmd_SYNCHRONIZE_CACHE_16 = 0x91,
|
||||
kSCSICmd_TEST_UNIT_READY = 0x00,
|
||||
kSCSICmd_UPDATE_BLOCK = 0x3D,
|
||||
kSCSICmd_UNMAP = 0x42,
|
||||
kSCSICmd_VERIFY_10 = 0x2F,
|
||||
kSCSICmd_VERIFY_12 = 0xAF,
|
||||
kSCSICmd_VERIFY_16 = 0x8F,
|
||||
kSCSICmd_VOLUME_SET_IN = 0xBE,
|
||||
kSCSICmd_VOLUME_SET_OUT = 0xBF,
|
||||
kSCSICmd_WRITE_6 = 0x0A,
|
||||
kSCSICmd_WRITE_10 = 0x2A,
|
||||
kSCSICmd_WRITE_12 = 0xAA,
|
||||
kSCSICmd_WRITE_16 = 0x8A,
|
||||
kSCSICmd_WRITE_AND_VERIFY_10 = 0x2E,
|
||||
kSCSICmd_WRITE_AND_VERIFY_12 = 0xAE,
|
||||
kSCSICmd_WRITE_AND_VERIFY_16 = 0x8E,
|
||||
kSCSICmd_WRITE_ATTRIBUTE = 0x8D,
|
||||
kSCSICmd_WRITE_BUFFER = 0x3B,
|
||||
kSCSICmd_WRITE_LONG = 0x3F,
|
||||
kSCSICmd_WRITE_SAME = 0x41,
|
||||
kSCSICmd_WRITE_SAME_16 = 0x93,
|
||||
kSCSICmd_XDREAD = 0x52,
|
||||
kSCSICmd_XDWRITE = 0x50,
|
||||
kSCSICmd_XDWRITE_EXTENDED = 0x80,
|
||||
kSCSICmd_XDWRITEREAD_10 = 0x53,
|
||||
kSCSICmd_XPWRITE = 0x51,
|
||||
|
||||
kSCSICmdVariableLengthCDB = 0x7F
|
||||
};
|
||||
|
||||
/* Service Action Definitions for the Variable Length CDB (7Fh) command */
|
||||
enum
|
||||
{
|
||||
kSCSIServiceAction_READ_32 = 0x0009,
|
||||
kSCSIServiceAction_VERIFY_32 = 0x000A,
|
||||
kSCSIServiceAction_WRITE_32 = 0x000B,
|
||||
kSCSIServiceAction_WRITE_AND_VERIFY_32 = 0x000C,
|
||||
kSCSIServiceAction_WRITE_SAME_32 = 0x000D,
|
||||
kSCSIServiceAction_XDREAD_32 = 0x0003,
|
||||
kSCSIServiceAction_XDWRITE_32 = 0x0004,
|
||||
kSCSIServiceAction_XDWRITEREAD_32 = 0x0007,
|
||||
kSCSIServiceAction_XPWRITE_32 = 0x0006
|
||||
};
|
||||
|
||||
/* Service Action Definitions for the MAINTENANCE IN (A3h) command */
|
||||
enum
|
||||
{
|
||||
kSCSIServiceAction_REPORT_ALIASES = 0x0B,
|
||||
kSCSIServiceAction_REPORT_DEVICE_IDENTIFIER = 0x05,
|
||||
kSCSIServiceAction_REPORT_PRIORITY = 0x0E,
|
||||
kSCSIServiceAction_REPORT_PROVISIONING_INITIALIZATION_PATTERN = 0x1D,
|
||||
kSCSIServiceAction_REPORT_SUPPORTED_OPERATION_CODES = 0x0C,
|
||||
kSCSIServiceAction_REPORT_SUPPORTED_TASK_MANAGEMENT_FUNCTIONS = 0x0D,
|
||||
kSCSIServiceAction_REPORT_TARGET_PORT_GROUPS = 0x0A
|
||||
};
|
||||
|
||||
/* Service Action Definitions for the MAINTENANCE OUT (A4h) command */
|
||||
enum
|
||||
{
|
||||
kSCSIServiceAction_CHANGE_ALIASES = 0x0B,
|
||||
kSCSIServiceAction_SET_DEVICE_IDENTIFIER = 0x06,
|
||||
kSCSIServiceAction_SET_PRIORITY = 0x0E,
|
||||
kSCSIServiceAction_SET_TARGET_PORT_GROUPS = 0x0A
|
||||
};
|
||||
|
||||
/* Service Action Definitions for the SERVICE ACTION IN (9Eh) command */
|
||||
enum
|
||||
{
|
||||
kSCSIServiceAction_GET_LBA_STATUS = 0x12,
|
||||
kSCSIServiceAction_READ_CAPACITY_16 = 0x10,
|
||||
kSCSIServiceAction_READ_LONG_16 = 0x11,
|
||||
};
|
||||
|
||||
/* Service Action Definitions for the SERVICE ACTION OUT (9Fh) command */
|
||||
enum
|
||||
{
|
||||
kSCSIServiceAction_WRITE_LONG_16 = 0x11
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Command Definitions by Number
|
||||
#if 0
|
||||
enum
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark All Types SPC Commands
|
||||
/* Commands defined by the T10:1236-D SCSI Primary Commands-2 (SPC-2)
|
||||
* command specification. The definitions and section numbers are based on
|
||||
* section 7 of the revision 18, 21 May 2000 version of the specification.
|
||||
*
|
||||
* These commands are defined for all devices.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSPCCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */
|
||||
kSPCCmd_COMPARE = 0x39, /* Sec. 7.2: Optional */
|
||||
kSPCCmd_COPY = 0x18, /* Sec. 7.3: Optional */
|
||||
kSPCCmd_COPY_AND_VERIFY = 0x3A, /* Sec. 7.4: Optional */
|
||||
kSPCCmd_EXTENDED_COPY = 0x83, /* Sec. 7.5: Optional */
|
||||
kSPCCmd_INQUIRY = 0x12, /* Sec. 7.6: Mandatory */
|
||||
kSPCCmd_LOG_SELECT = 0x4C, /* Sec. 7.7: Optional */
|
||||
kSPCCmd_LOG_SENSE = 0x4D, /* Sec. 7.8: Optional */
|
||||
kSPCCmd_MODE_SELECT_6 = 0x15, /* Sec. 7.9: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_MODE_SELECT_10 = 0x55, /* Sec. 7.10: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_MODE_SENSE_6 = 0x1A, /* Sec. 7.11: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_MODE_SENSE_10 = 0x5A, /* Sec. 7.12: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_MOVE_MEDIUM_ATTACHED = 0xA7, /* Defined in SMC */
|
||||
kSPCCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Sec. 7.13: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Sec. 7.14: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* Sec. 7.15: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_READ_BUFFER = 0x3C, /* Sec. 7.16: Optional */
|
||||
kSPCCmd_READ_ELEMENT_STATUS_ATTACHED = 0xB4, /* Defined in SMC */
|
||||
kSPCCmd_RECEIVE_COPY_RESULTS = 0x84, /* Sec. 7.17: Optional */
|
||||
kSPCCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* Sec. 7.18: Optional */
|
||||
kSPCCmd_RELEASE_10 = 0x57, /* Sec. 7.19: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_RELEASE_6 = 0x17, /* Sec. 7.20: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_REPORT_DEVICE_IDENTIFIER = 0xA3, /* Sec. 7.21: Optional */
|
||||
kSPCCmd_REPORT_LUNS = 0xA0, /* Sec. 7.22: Mandatory for
|
||||
* LUN Supporting devices*/
|
||||
kSPCCmd_REQUEST_SENSE = 0x03, /* Sec. 7.23: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_RESERVE_10 = 0x56, /* Sec. 7.24: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_RESERVE_6 = 0x16, /* Sec. 7.25: Device Type
|
||||
* Specific */
|
||||
kSPCCmd_SEND_DIAGNOSTICS = 0x1D, /* Sec. 7.26: Optional */
|
||||
kSPCCmd_SET_DEVICE_IDENTIFIER = 0xA4, /* Sec. 7.27: Optional */
|
||||
kSPCCmd_TEST_UNIT_READY = 0x00, /* Sec. 7.28: Mandatory */
|
||||
kSPCCmd_WRITE_BUFFER = 0x3B /* Sec. 7.29: Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x00 SBC Direct Access Commands
|
||||
/* Commands defined by the T10:990-D SCSI-3 Block Commands (SBC) command
|
||||
* specification. The definitions and section numbers are based on section 6.1
|
||||
* of the revision 8c, 13 November 1997 version of the specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */
|
||||
kSBCCmd_COMPARE = 0x39, /* SPC: Optional */
|
||||
kSBCCmd_COPY = 0x18, /* SPC: Optional */
|
||||
kSBCCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional*/
|
||||
kSBCCmd_FORMAT_UNIT = 0x04, /* Sec. 6.1.1: Mandatory */
|
||||
kSBCCmd_INQUIRY = 0x12, /* SPC: Mandatory */
|
||||
kSBCCmd_LOCK_UNLOCK_CACHE = 0x36, /* Sec. 6.1.2: Optional */
|
||||
kSBCCmd_LOG_SELECT = 0x4C, /* SPC: Optional */
|
||||
kSBCCmd_LOG_SENSE = 0x4D, /* SPC: Optional */
|
||||
kSBCCmd_MODE_SELECT_6 = 0x15, /* SPC: Optional */
|
||||
kSBCCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */
|
||||
kSBCCmd_MODE_SENSE_6 = 0x1A, /* SPC: Optional */
|
||||
kSBCCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */
|
||||
kSBCCmd_MOVE_MEDIUM_ATTACHED = 0xA7, /* SMC: Optional */
|
||||
kSBCCmd_PERSISTENT_RESERVE_IN = 0x5E, /* SPC: Optional */
|
||||
kSBCCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* SPC: Optional */
|
||||
kSBCCmd_PREFETCH = 0x34, /* Sec. 6.1.3: Optional */
|
||||
kSBCCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* SPC: Optional */
|
||||
kSBCCmd_READ_6 = 0x08, /* Sec. 6.1.4: Mandatory */
|
||||
kSBCCmd_READ_10 = 0x28, /* Sec. 6.1.5: Mandatory */
|
||||
kSBCCmd_READ_12 = 0xA8, /* Sec. 6.2.4: Optional */
|
||||
kSBCCmd_READ_BUFFER = 0x3C, /* SPC: Optional */
|
||||
kSBCCmd_READ_CAPACITY = 0x25, /* Sec. 6.1.6: Mandatory */
|
||||
kSBCCmd_READ_DEFECT_DATA_10 = 0x37, /* Sec. 6.1.7: Optional */
|
||||
kSBCCmd_READ_DEFECT_DATA_12 = 0xB7, /* Sec. 6.2.5: Optional */
|
||||
kSBCCmd_READ_ELEMENT_STATUS_ATTACHED = 0xB4, /* SMC: Optional */
|
||||
kSBCCmd_READ_GENERATION = 0x29, /* Sec. 6.2.6: Optional */
|
||||
kSBCCmd_READ_LONG = 0x3E, /* Sec. 6.1.8: Optional */
|
||||
kSBCCmd_READ_UPDATED_BLOCK_10 = 0x2D, /* Sec. 6.2.7: Optional */
|
||||
kSBCCmd_REASSIGN_BLOCKS = 0x07, /* Sec. 6.1.9: Optional */
|
||||
kSBCCmd_REBUILD = 0x81, /* Sec. 6.1.10: Optional */
|
||||
kSBCCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */
|
||||
kSBCCmd_REGENERATE = 0x82, /* Sec. 6.1.11: Optional */
|
||||
kSBCCmd_RELEASE_6 = 0x17, /* SPC: Optional */
|
||||
kSBCCmd_RELEASE_10 = 0x57, /* SPC: Mandatory */
|
||||
kSBCCmd_REPORT_LUNS = 0xA0, /* SPC: Optional */
|
||||
kSBCCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */
|
||||
kSBCCmd_RESERVE_6 = 0x16, /* SPC: Optional */
|
||||
kSBCCmd_RESERVE_10 = 0x56, /* SPC: Mandatory */
|
||||
kSBCCmd_REZERO_UNIT = 0x01, /* Obsolete */
|
||||
kSBCCmd_SEARCH_DATA_EQUAL_10 = 0x31, /* Obsolete */
|
||||
kSBCCmd_SEARCH_DATA_HIGH_10 = 0x30, /* Obsolete */
|
||||
kSBCCmd_SEARCH_DATA_LOW_10 = 0x32, /* Obsolete */
|
||||
kSBCCmd_SEEK_6 = 0x0B, /* Obsolete */
|
||||
kSBCCmd_SEEK_10 = 0x2B, /* Sec. 6.1.12: Optional */
|
||||
kSBCCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */
|
||||
kSBCCmd_SET_LIMITS_10 = 0x33, /* Sec. 6.1.13: Optional */
|
||||
kSBCCmd_SET_LIMITS_12 = 0xB3, /* Sec. 6.2.8: Optional */
|
||||
kSBCCmd_START_STOP_UNIT = 0x1B, /* Sec. 6.1.14: Optional */
|
||||
kSBCCmd_SYNCHRONIZE_CACHE = 0x35, /* Sec. 6.1.15: Optional */
|
||||
kSBCCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */
|
||||
kSBCCmd_UPDATE_BLOCK = 0x3D, /* Sec. 6.2.9: Optional */
|
||||
kSBCCmd_VERIFY_10 = 0x2F, /* Sec. 6.1.16: Optional */
|
||||
kSBCCmd_WRITE_6 = 0x0A, /* Sec. 6.1.17: Optional */
|
||||
kSBCCmd_WRITE_10 = 0x2A, /* Sec. 6.1.18: Optional */
|
||||
kSBCCmd_WRITE_12 = 0xAA, /* Sec. 6.2.13: Optional */
|
||||
kSBCCmd_WRITE_AND_VERIFY_10 = 0x2E, /* Sec. 6.1.19: Optional */
|
||||
kSBCCmd_WRITE_AND_VERIFY_12 = 0xAE, /* Sec. 6.2.15: Optional */
|
||||
kSBCCmd_WRITE_BUFFER = 0x3B, /* SPC: Optional */
|
||||
kSBCCmd_WRITE_LONG = 0x3F, /* Sec. 6.1.20: Optional */
|
||||
kSBCCmd_WRITE_SAME = 0x41, /* Sec. 6.1.21: Optional */
|
||||
kSBCCmd_XDREAD = 0x52, /* Sec. 6.1.22: Optional */
|
||||
kSBCCmd_XDWRITE = 0x50, /* Sec. 6.1.23: Optional */
|
||||
kSBCCmd_XDWRITE_EXTENDED = 0x80, /* Sec. 6.1.24: Optional */
|
||||
kSBCCmd_XPWRITE = 0x51 /* Sec. 6.1.25: Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x01 SSC Sequential Access Commands
|
||||
/* Commands defined by the T10:997-D SCSI-3 Stream Commands (SSC) command
|
||||
* specification. The definitions and section numbers are based on section 5
|
||||
* of the revision 22, January 1, 2000 version of the specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSSCSeqCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */
|
||||
kSSCSeqCmd_COMPARE = 0x39, /* SPC: Optional */
|
||||
kSSCSeqCmd_COPY = 0x18, /* SPC: Optional */
|
||||
kSSCSeqCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional */
|
||||
kSSCSeqCmd_ERASE = 0x19, /* Sec. 5.3.1: Mandatory */
|
||||
kSSCSeqCmd_FORMAT_MEDIUM = 0x04, /* Sec. 5.3.2: Optional */
|
||||
kSSCSeqCmd_INQUIRY = 0x12, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_LOAD_UNLOAD = 0x1B, /* Sec. 5.3.3: Optional */
|
||||
kSSCSeqCmd_LOCATE = 0x2B, /* Sec. 5.3.4: Optional */
|
||||
kSSCSeqCmd_LOG_SELECT = 0x4C, /* SPC: Optional */
|
||||
kSSCSeqCmd_LOG_SENSE = 0x4D, /* SPC: Optional */
|
||||
kSSCSeqCmd_MODE_SELECT_6 = 0x15, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */
|
||||
kSSCSeqCmd_MODE_SENSE_6 = 0x1A, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */
|
||||
kSSCSeqCmd_MOVE_MEDIUM = 0xA5, /* SMC: Optional */
|
||||
kSSCSeqCmd_MOVE_MEDIUM_ATTACHED = 0xA7, /* SMC: Optional */
|
||||
kSSCSeqCmd_PERSISTENT_RESERVE_IN = 0x5E, /* SPC: Optional */
|
||||
kSSCSeqCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* SPC: Optional */
|
||||
kSSCSeqCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* SPC: Optional */
|
||||
kSSCSeqCmd_READ_6 = 0x08, /* Sec. 5.3.5: Mandatory */
|
||||
kSSCSeqCmd_READ_BLOCK_LIMITS = 0x05, /* Sec. 5.3.6: Mandatory */
|
||||
kSSCSeqCmd_READ_BUFFER = 0x3C, /* SPC: Optional */
|
||||
kSSCSeqCmd_READ_ELEMENT_STATUS = 0xB8, /* SMC: Optional */
|
||||
kSSCSeqCmd_READ_ELEMENT_STATUS_ATTACHED = 0xB4, /* SMC: Optional */
|
||||
kSSCSeqCmd_READ_POSITION = 0x34, /* Sec. 5.3.7: Mandatory */
|
||||
kSSCSeqCmd_READ_REVERSE = 0x0F, /* Sec. 5.3.8: Optional */
|
||||
kSSCSeqCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */
|
||||
kSSCSeqCmd_RECOVER_BUFFERED_DATA = 0x14, /* Sec. 5.3.9: Optional */
|
||||
kSSCSeqCmd_RELEASE_6 = 0x17, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_RELEASE_10 = 0x57, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_REPORT_DENSITY_SUPPORT = 0x44, /* Sec. 5.3.10: Mandatory*/
|
||||
kSSCSeqCmd_REPORT_LUNS = 0xA0, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_RESERVE_6 = 0x16, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_RESERVE_10 = 0x56, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_REWIND = 0x01, /* Sec. 5.3.11: Mandatory*/
|
||||
kSSCSeqCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_SPACE = 0x11, /* Sec. 5.3.12: Mandatory*/
|
||||
kSSCSeqCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */
|
||||
kSSCSeqCmd_VERIFY_6 = 0x13, /* Sec. 5.3.13: Optional */
|
||||
kSSCSeqCmd_WRITE_6 = 0x0A, /* Sec. 5.3.14: Mandatory*/
|
||||
kSSCSeqCmd_WRITE_BUFFER = 0x3B, /* SPC: Optional */
|
||||
kSSCSeqCmd_WRITE_FILEMARKS = 0x10 /* Sec. 5.3.15: Mandatory*/
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x02 SSC Printer Commands
|
||||
/* Commands defined by the T10:997-D SCSI-3 Stream Commands (SSC) command
|
||||
* specification. The definitions and section numbers are based on section 6
|
||||
* of the revision 22, January 1, 2000 version of the specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSSCPrinterCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */
|
||||
kSSCPrinterCmd_COMPARE = 0x39, /* SPC: Optional */
|
||||
kSSCPrinterCmd_COPY = 0x18, /* SPC: Optional */
|
||||
kSSCPrinterCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional */
|
||||
kSSCPrinterCmd_FORMAT = 0x04, /* Sec. 6.2.1: Optional */
|
||||
kSSCPrinterCmd_INQUIRY = 0x12, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_LOG_SELECT = 0x4C, /* SPC: Optional */
|
||||
kSSCPrinterCmd_LOG_SENSE = 0x4D, /* SPC: Optional */
|
||||
kSSCPrinterCmd_MODE_SELECT_6 = 0x15, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */
|
||||
kSSCPrinterCmd_MODE_SENSE_6 = 0x1A, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */
|
||||
kSSCPrinterCmd_PERSISTENT_RESERVE_IN = 0x5E, /* SPC: Optional */
|
||||
kSSCPrinterCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* SPC: Optional */
|
||||
kSSCPrinterCmd_PRINT = 0x0A, /* Sec. 6.2.2: Mandatory */
|
||||
kSSCPrinterCmd_READ_BUFFER = 0x3C, /* SPC: Optional */
|
||||
kSSCPrinterCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */
|
||||
kSSCPrinterCmd_RECOVER_BUFFERED_DATA = 0x14, /* Sec. 6.2.3: Optional */
|
||||
kSSCPrinterCmd_RELEASE_6 = 0x17, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_RELEASE_10 = 0x57, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_REPORT_LUNS = 0xA0, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_RESERVE_6 = 0x16, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_RESERVE_10 = 0x56, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_SLEW_AND_PRINT = 0x0B, /* Sec. 6.2.4: Optional */
|
||||
kSSCPrinterCmd_STOP_PRINT = 0x1B, /* Sec. 6.2.5: Optional */
|
||||
kSSCPrinterCmd_SYNCHRONIZE_BUFFER = 0x10, /* Sec. 6.2.6: Optional */
|
||||
kSSCPrinterCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */
|
||||
kSSCPrinterCmd_WRITE_BUFFER = 0x3B /* SPC: Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x03 SPC Processor Commands
|
||||
/* Commands defined by the T10:1236-D SCSI Primary Commands-2 (SPC-2)
|
||||
* command specification. The definitions and section numbers are based on
|
||||
* section 9 of the revision 18, 21 May 2000 version of the specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSPCProcCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */
|
||||
kSPCProcCmd_COMPARE = 0x39, /* Sec. 7.2: Optional */
|
||||
kSPCProcCmd_COPY = 0x18, /* Sec. 7.3: Optional */
|
||||
kSPCProcCmd_COPY_AND_VERIFY = 0x3A, /* Sec. 7.4: Optional */
|
||||
kSPCProcCmd_EXTENDED_COPY = 0x83, /* Sec. 7.5: Optional */
|
||||
kSPCProcCmd_INQUIRY = 0x12, /* Sec. 7.6: Mandatory */
|
||||
kSPCProcCmd_LOG_SELECT = 0x4C, /* Sec. 7.7: Optional */
|
||||
kSPCProcCmd_LOG_SENSE = 0x4D, /* Sec. 7.8: Optional */
|
||||
kSPCProcCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Sec. 7.13: Optional */
|
||||
kSPCProcCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Sec. 7.14: Optional */
|
||||
kSPCProcCmd_READ_BUFFER = 0x3C, /* Sec. 7.16: Optional */
|
||||
kSPCProcCmd_RECEIVE = 0x08, /* Sec. 9.2: Optional */
|
||||
kSPCProcCmd_RECEIVE_COPY_RESULTS = 0x84, /* Sec. 7.17: Optional */
|
||||
kSPCProcCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* Sec. 7.18: Optional */
|
||||
kSPCProcCmd_RELEASE_10 = 0x57, /* Sec. 7.19: Optional */
|
||||
kSPCProcCmd_RELEASE_6 = 0x17, /* Sec. 7.20: Optional */
|
||||
kSPCProcCmd_REPORT_LUNS = 0xA0, /* Sec. 7.22: Optional */
|
||||
kSPCProcCmd_REQUEST_SENSE = 0x03, /* Sec. 7.23: Mandatory */
|
||||
kSPCProcCmd_RESERVE_10 = 0x56, /* Sec. 7.24: Optional */
|
||||
kSPCProcCmd_RESERVE_6 = 0x16, /* Sec. 7.25: Optional */
|
||||
kSPCProcCmd_SEND = 0x0A, /* Sec. 9.3: Optional */
|
||||
kSPCProcCmd_SEND_DIAGNOSTICS = 0x1D, /* Sec. 7.26: Mandatory */
|
||||
kSPCProcCmd_TEST_UNIT_READY = 0x00, /* Sec. 7.27: Mandatory */
|
||||
kSPCProcCmd_WRITE_BUFFER = 0x3B /* Sec. 7.29: Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x04 SBC Write Once Commands
|
||||
/* Commands defined by the T10:990-D SCSI-3 Block Commands (SBC) command
|
||||
* specification. The definitions and section numbers are based on section 6.3
|
||||
* of the revision 8c, 13 November 1997 version of the specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSBCWOCmd_CHANGE_DEFINITION = 0x40, /* SPC: Optional */
|
||||
kSBCWOCmd_COMPARE = 0x39, /* SPC: Optional */
|
||||
kSBCWOCmd_COPY = 0x18, /* SPC: Optional */
|
||||
kSBCWOCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional*/
|
||||
kSBCWOCmd_INQUIRY = 0x12, /* SPC: Mandatory */
|
||||
kSBCWOCmd_LOCK_UNLOCK_CACHE = 0x36, /* Sec. 6.1.2: Optional */
|
||||
kSBCWOCmd_LOG_SELECT = 0x4C, /* SPC: Optional */
|
||||
kSBCWOCmd_LOG_SENSE = 0x4D, /* SPC: Optional */
|
||||
kSBCWOCmd_MEDIUM_SCAN = 0x38, /* Sec. 6.2.3: Optional */
|
||||
kSBCWOCmd_MODE_SELECT_6 = 0x15, /* SPC: Optional */
|
||||
kSBCWOCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */
|
||||
kSBCWOCmd_MODE_SENSE_6 = 0x1A, /* SPC: Optional */
|
||||
kSBCWOCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */
|
||||
kSBCWOCmd_MOVE_MEDIUM = 0xA5, /* SMC: Optional */
|
||||
kSBCWOCmd_PERSISTENT_RESERVE_IN = 0x5E, /* SPC: Optional */
|
||||
kSBCWOCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* SPC: Optional */
|
||||
kSBCWOCmd_PREFETCH = 0x34, /* Sec. 6.1.3: Optional */
|
||||
kSBCWOCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* SPC: Optional */
|
||||
kSBCWOCmd_READ_6 = 0x08, /* Sec. 6.1.4: Optional */
|
||||
kSBCWOCmd_READ_10 = 0x28, /* Sec. 6.1.5: Mandatory */
|
||||
kSBCWOCmd_READ_12 = 0xA8, /* Sec. 6.2.4: Optional */
|
||||
kSBCWOCmd_READ_BUFFER = 0x3C, /* SPC: Optional */
|
||||
kSBCWOCmd_READ_CAPACITY = 0x25, /* Sec. 6.1.6: Mandatory */
|
||||
kSBCWOCmd_READ_ELEMENT_STATUS = 0xB8, /* SMC: Optional */
|
||||
kSBCWOCmd_READ_LONG = 0x3E, /* Sec. 6.1.8: Optional */
|
||||
kSBCWOCmd_REASSIGN_BLOCKS = 0x07, /* Sec. 6.1.9: Optional */
|
||||
kSBCWOCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */
|
||||
kSBCWOCmd_RELEASE_6 = 0x17, /* SPC: Optional */
|
||||
kSBCWOCmd_RELEASE_10 = 0x57, /* SPC: Mandatory */
|
||||
kSBCWOCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */
|
||||
kSBCWOCmd_RESERVE_6 = 0x16, /* SPC: Optional */
|
||||
kSBCWOCmd_RESERVE_10 = 0x56, /* SPC: Mandatory */
|
||||
kSBCWOCmd_REZERO_UNIT = 0x01, /* Obsolete */
|
||||
kSBCWOCmd_SEARCH_DATA_EQUAL_10 = 0x31, /* Obsolete */
|
||||
kSBCWOCmd_SEARCH_DATA_EQUAL_12 = 0xB1, /* Obsolete */
|
||||
kSBCWOCmd_SEARCH_DATA_HIGH_10 = 0x30, /* Obsolete */
|
||||
kSBCWOCmd_SEARCH_DATA_HIGH_12 = 0xB0, /* Obsolete */
|
||||
kSBCWOCmd_SEARCH_DATA_LOW_10 = 0x32, /* Obsolete */
|
||||
kSBCWOCmd_SEARCH_DATA_LOW_12 = 0xB2, /* Obsolete */
|
||||
kSBCWOCmd_SEEK_6 = 0x0B, /* Obsolete */
|
||||
kSBCWOCmd_SEEK_10 = 0x2B, /* Sec. 6.1.12: Optional */
|
||||
kSBCWOCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */
|
||||
kSBCWOCmd_SET_LIMITS_10 = 0x33, /* Sec. 6.1.13: Optional */
|
||||
kSBCWOCmd_SET_LIMITS_12 = 0xB3, /* Sec. 6.2.8: Optional */
|
||||
kSBCWOCmd_START_STOP_UNIT = 0x1B, /* Sec. 6.1.14: Optional */
|
||||
kSBCWOCmd_SYNCHRONIZE_CACHE = 0x35, /* Sec. 6.1.15: Optional */
|
||||
kSBCWOCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */
|
||||
kSBCWOCmd_VERIFY_10 = 0x2F, /* Sec. 6.2.10: Optional */
|
||||
kSBCWOCmd_VERIFY_12 = 0xAF, /* Sec. 6.2.11: Optional */
|
||||
kSBCWOCmd_WRITE_6 = 0x0A, /* Sec. 6.1.17: Optional */
|
||||
kSBCWOCmd_WRITE_10 = 0x2A, /* Sec. 6.2.10: Mandatory*/
|
||||
kSBCWOCmd_WRITE_12 = 0xAA, /* Sec. 6.2.13: Optional */
|
||||
kSBCWOCmd_WRITE_AND_VERIFY_10 = 0x2E, /* Sec. 6.2.14: Optional */
|
||||
kSBCWOCmd_WRITE_AND_VERIFY_12 = 0xAE, /* Sec. 6.2.15: Optional */
|
||||
kSBCWOCmd_WRITE_BUFFER = 0x3B, /* SPC: Optional */
|
||||
kSBCWOCmd_WRITE_LONG = 0x3F /* Sec. 6.1.20: Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x05 MMC CD-ROM Commands
|
||||
/* Commands defined by the T10:1363-D SCSI Multimedia Commands-3 (MMC-3)
|
||||
* specification. The definitions and section numbers are based on section 6.1
|
||||
* of the revision 01, March 03, 2000 version of the specification.
|
||||
*
|
||||
* NOTE: The comments following each command may not be accurate. These are
|
||||
* not from the MMC-3 specification, but have been derived from the SCSI-2 and
|
||||
* original MMC specifications. Unlike the other SCSI command specifications,
|
||||
* MMC-2 and MMC-3 do not provide a command requirement type and therefore does
|
||||
* not relist the SPC commands with these requirements as they apply to MMC
|
||||
* devices. The MMC-2 and MMC-3 specifications also refer back to the SBC
|
||||
* specification which seems invalid since MMC devices do not represent a
|
||||
* Peripheral Device Type defined by SBC. It is assumed that the SBC
|
||||
* references refer to the Peripheral Device Type 0x00 - Direct Access Commands
|
||||
* definitions from that specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kMMCCmd_BLANK = 0xA1, /* Sec. 6.1.1: */
|
||||
kMMCCmd_CHANGE_DEFINITION = 0x40, /* Obsolete */
|
||||
kMMCCmd_CLOSE_TRACK_SESSION = 0x5B, /* Sec. 6.1.2: */
|
||||
kMMCCmd_COMPARE = 0x39, /* SPC: Optional */
|
||||
kMMCCmd_COPY = 0x18, /* SPC: Optional */
|
||||
kMMCCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional */
|
||||
kMMCCmd_ERASE = 0x2C, /* SBC: */
|
||||
kMMCCmd_FORMAT_UNIT = 0x04, /* Sec. 6.1.3: */
|
||||
kMMCCmd_GET_CONFIGURATION = 0x46, /* Sec. 6.1.4: */
|
||||
kMMCCmd_GET_EVENT_STATUS_NOTIFICATION = 0x4A, /* Sec. 6.1.5: */
|
||||
kMMCCmd_GET_PERFORMANCE = 0xAC, /* Sec. 6.1.6: */
|
||||
kMMCCmd_INQUIRY = 0x12, /* SPC: Mandatory */
|
||||
kMMCCmd_LOAD_UNLOAD_MEDIUM = 0xA6, /* Sec. 6.1.7: */
|
||||
kMMCCmd_LOG_SELECT = 0x4C, /* SPC: Optional */
|
||||
kMMCCmd_LOG_SENSE = 0x4D, /* SPC: Optional */
|
||||
kMMCCmd_MECHANISM_STATUS = 0xBD, /* Sec. 6.1.8: */
|
||||
kMMCCmd_MODE_SELECT_6 = 0x15, /* SPC: Mandatory */
|
||||
kMMCCmd_MODE_SELECT_10 = 0x55, /* SPC: Mandatory */
|
||||
kMMCCmd_MODE_SENSE_6 = 0x1A, /* SPC: Mandatory */
|
||||
kMMCCmd_MODE_SENSE_10 = 0x5A, /* SPC: Mandatory */
|
||||
kMMCCmd_PAUSE_RESUME = 0x4B, /* Sec. 6.1.9: */
|
||||
kMMCCmd_PLAY_AUDIO_10 = 0x45, /* Sec. 6.1.10: */
|
||||
kMMCCmd_PLAY_AUDIO_12 = 0xA5, /* Sec. 6.1.11: */
|
||||
kMMCCmd_PLAY_AUDIO_MSF = 0x47, /* Sec. 6.1.12: */
|
||||
kMMCCmd_PLAY_AUDIO_TRACK_INDEX = 0x48, /* Obsolete */
|
||||
kMMCCmd_PLAY_CD = 0xBC, /* Sec. 6.1.13: */
|
||||
kMMCCmd_PLAY_RELATIVE_10 = 0x49, /* Obsolete */
|
||||
kMMCCmd_PLAY_RELATIVE_12 = 0xA9, /* Obsolete */
|
||||
kMMCCmd_PREFETCH = 0x34, /* Optional */
|
||||
kMMCCmd_PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E, /* Optional */
|
||||
kMMCCmd_READ_6 = 0x08, /* Optional */
|
||||
kMMCCmd_READ_10 = 0x28, /* Mandatory */
|
||||
kMMCCmd_READ_12 = 0xA8, /* Optional */
|
||||
kMMCCmd_READ_BUFFER = 0x3C, /* Optional */
|
||||
kMMCCmd_READ_BUFFER_CAPACITY = 0x5C, /* Sec. 6.1.15: */
|
||||
kMMCCmd_READ_CD = 0xBE, /* Sec. 6.1.16: */
|
||||
kMMCCmd_READ_CD_MSF = 0xB9, /* Sec. 6.1.17: */
|
||||
kMMCCmd_READ_CAPACITY = 0x25, /* Sec. 6.1.18: */
|
||||
kMMCCmd_READ_DISC_INFORMATION = 0x51, /* Sec. 6.1.19: */
|
||||
kMMCCmd_READ_DVD_STRUCTURE = 0xAD, /* Sec. 6.1.20: */
|
||||
kMMCCmd_READ_DISC_STRUCTURE = 0xAD, /* Sec. 6.1.20: */
|
||||
kMMCCmd_READ_FORMAT_CAPACITIES = 0x23, /* Sec. 6.1.21: */
|
||||
kMMCCmd_READ_HEADER = 0x44, /* Sec. 6.1.22: */
|
||||
kMMCCmd_READ_LONG = 0x3E, /* Optional */
|
||||
kMMCCmd_READ_MASTER_CUE = 0x59, /* Sec. 6.1.23: */
|
||||
kMMCCmd_READ_SUB_CHANNEL = 0x42, /* Sec. 6.1.24: */
|
||||
kMMCCmd_READ_TOC_PMA_ATIP = 0x43, /* Sec. 6.1.25: */
|
||||
kMMCCmd_READ_TRACK_INFORMATION = 0x52, /* Sec. 6.1.27: */
|
||||
kMMCCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* Optional */
|
||||
kMMCCmd_RELEASE_6 = 0x17, /* Mandatory */
|
||||
kMMCCmd_RELEASE_10 = 0x57, /* Optional */
|
||||
kMMCCmd_REPAIR_TRACK = 0x58, /* Sec. 6.1.28: */
|
||||
kMMCCmd_REPORT_KEY = 0xA4, /* Sec. 6.1.29: */
|
||||
kMMCCmd_REQUEST_SENSE = 0x03, /* Mandatory */
|
||||
kMMCCmd_RESERVE_6 = 0x16, /* Mandatory */
|
||||
kMMCCmd_RESERVE_10 = 0x56, /* Optional */
|
||||
kMMCCmd_RESERVE_TRACK = 0x53, /* Sec. 6.1.30: */
|
||||
kMMCCmd_SCAN_MMC = 0xBA, /* Sec. 6.1.31: */
|
||||
kMMCCmd_SEARCH_DATA_EQUAL_10 = 0x31, /* Obsolete */
|
||||
kMMCCmd_SEARCH_DATA_EQUAL_12 = 0xB1, /* Obsolete */
|
||||
kMMCCmd_SEARCH_DATA_HIGH_10 = 0x30, /* Obsolete */
|
||||
kMMCCmd_SEARCH_DATA_HIGH_12 = 0xB0, /* Obsolete */
|
||||
kMMCCmd_SEARCH_DATA_LOW_10 = 0x32, /* Obsolete */
|
||||
kMMCCmd_SEARCH_DATA_LOW_12 = 0xB2, /* Obsolete */
|
||||
kMMCCmd_SEEK_6 = 0x0B, /* Obsolete */
|
||||
kMMCCmd_SEEK_10 = 0x2B, /* SBC: */
|
||||
kMMCCmd_SEND_CUE_SHEET = 0x5D, /* Sec. 6.1.32: */
|
||||
kMMCCmd_SEND_DIAGNOSTICS = 0x1D, /* Mandatory */
|
||||
kMMCCmd_SEND_DVD_STRUCTURE = 0xBF, /* Sec. 6.1.33: */
|
||||
kMMCCmd_SEND_EVENT = 0xA2, /* Sec. 6.1.34: */
|
||||
kMMCCmd_SEND_KEY = 0xA3, /* Sec. 6.1.35: */
|
||||
kMMCCmd_SEND_OPC_INFORMATION = 0x54, /* Sec. 6.1.36: */
|
||||
kMMCCmd_SET_CD_SPEED = 0xBB, /* Sec. 6.1.37: */
|
||||
kMMCCmd_SET_LIMITS_10 = 0x33, /* Optional */
|
||||
kMMCCmd_SET_LIMITS_12 = 0xB3, /* Optional */
|
||||
kMMCCmd_SET_READ_AHEAD = 0xA7, /* Sec. 6.1.38: */
|
||||
kMMCCmd_SET_STREAMING = 0xB6, /* Sec. 6.1.39: */
|
||||
kMMCCmd_START_STOP_UNIT = 0x1B, /* Optional */
|
||||
kMMCCmd_STOP_PLAY_SCAN = 0x4E, /* Sec. 6.1.40: */
|
||||
kMMCCmd_SYNCHRONIZE_CACHE = 0x35, /* Sec. 6.1.41: */
|
||||
kMMCCmd_TEST_UNIT_READY = 0x00, /* Mandatory */
|
||||
kMMCCmd_VERIFY_10 = 0x2F, /* Optional */
|
||||
kMMCCmd_VERIFY_12 = 0xAF, /* Optional */
|
||||
kMMCCmd_WRITE_10 = 0x2A, /* Sec. 6.1.42: */
|
||||
kMMCCmd_WRITE_12 = 0xAA, /* Sec. 6.1.43: */
|
||||
kMMCCmd_WRITE_AND_VERIFY_10 = 0x2E, /* Sec. 6.1.44: */
|
||||
kMMCCmd_WRITE_BUFFER = 0x3B /* Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x06 SGC Scanner Commands
|
||||
/* Commands defined by the T10:998-D SCSI-3 Graphics Commands (SGC)
|
||||
* specification. The definitions and section numbers are based on section 6
|
||||
* of the revision 0, April 1995 version of the specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSGCCmd_CHANGE_DEFINITION = 0x40, /* SPC: Optional */
|
||||
kSGCCmd_COMPARE = 0x39, /* SPC: Optional */
|
||||
kSGCCmd_COPY = 0x18, /* SPC: Optional */
|
||||
kSGCCmd_COPY_AND_VERIFY = 0x3A, /* SPC: Optional */
|
||||
kSGCCmd_GET_DATA_BUFFER_STATUS = 0x34, /* Sec. 6.1.1: Optional */
|
||||
kSGCCmd_GET_WINDOW = 0x25, /* Sec. 6.1.2: Optional */
|
||||
kSGCCmd_INQUIRY = 0x12, /* SPC: Mandatory */
|
||||
kSGCCmd_LOG_SELECT = 0x4C, /* SPC: Optional */
|
||||
kSGCCmd_LOG_SENSE = 0x4D, /* SPC: Optional */
|
||||
kSGCCmd_MODE_SELECT_6 = 0x15, /* SPC: Optional */
|
||||
kSGCCmd_MODE_SELECT_10 = 0x55, /* SPC: Optional */
|
||||
kSGCCmd_MODE_SENSE_6 = 0x1A, /* SPC: Optional */
|
||||
kSGCCmd_MODE_SENSE_10 = 0x5A, /* SPC: Optional */
|
||||
kSGCCmd_OBJECT_POSITION = 0x31, /* Sec. 6.1.3: Optional */
|
||||
kSGCCmd_PORT_STATUS = 0x11, /* SPC (??): Mandatory
|
||||
* for dual port devices */
|
||||
kSGCCmd_READ = 0x28, /* Sec. 6.1.4: Mandatory */
|
||||
kSGCCmd_READ_BUFFER = 0x3C, /* SPC: Optional */
|
||||
kSGCCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x1C, /* SPC: Optional */
|
||||
kSGCCmd_RELEASE_6 = 0x17, /* SPC: Mandatory */
|
||||
kSGCCmd_REQUEST_SENSE = 0x03, /* SPC: Mandatory */
|
||||
kSGCCmd_RESERVE_6 = 0x16, /* SPC: Mandatory */
|
||||
kSGCCmd_SCAN = 0x1B, /* Sec. 6.1.5: Optional */
|
||||
kSGCCmd_SEND = 0x1B, /* Sec. 6.1.6: Optional */
|
||||
kSGCCmd_SEND_DIAGNOSTICS = 0x1D, /* SPC: Mandatory */
|
||||
kSGCCmd_SET_WINDOW = 0x24, /* Sec. 6.1.7: Mandatory */
|
||||
kSGCCmd_TEST_UNIT_READY = 0x00, /* SPC: Mandatory */
|
||||
kSGCCmd_WRITE_BUFFER = 0x3B /* SPC: Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x07 SBC Optical Media Commands
|
||||
/* Commands defined by the T10:990-D SCSI-3 Block Commands (SBC)
|
||||
* (revision 8c, 13 November 1998) command specification.
|
||||
*/
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x08 SMC Medium Changer Commands
|
||||
/* Commands defined by the T10:1228-D SCSI-3 Medium Changer Commands-2 (SMC-2)
|
||||
* (revision 0, March 16, 2000) command specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/* Commands For Independent Medium Changers */
|
||||
kSMCCmd_EXCHANGE_MEDIUM = 0xA6, /* Optional */
|
||||
kSMCCmd_INITIALIZE_ELEMENT_STATUS = 0x07, /* Optional */
|
||||
kSMCCmd_MODE_SELECT_6 = 0x15, /* Optional */
|
||||
kSMCCmd_MODE_SELECT_10 = 0x55, /* Optional */
|
||||
kSMCCmd_MODE_SENSE_6 = 0x1A, /* Optional */
|
||||
kSMCCmd_MODE_SENSE_10 = 0x5A, /* Optional */
|
||||
kSMCCmd_MOVE_MEDIUM = 0xA5, /* Mandatory */
|
||||
kSMCCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Optional */
|
||||
kSMCCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Optional */
|
||||
kSMCCmd_POSITION_TO_ELEMENT = 0x2B, /* Optional */
|
||||
kSMCCmd_READ_ELEMENT_STATUS = 0xB8, /* Mandatory */
|
||||
kSMCCmd_RELEASE_ELEMENT_6 = 0x16, /* Optional */
|
||||
kSMCCmd_RELEASE_ELEMENT_10 = 0x56, /* Optional */
|
||||
kSMCCmd_REQUEST_VOLUME_ELEMENT_ADDRESS = 0xB5, /* Optional */
|
||||
kSMCCmd_REQUEST_SENSE = 0x03, /* Mandatory */
|
||||
kSMCCmd_RESERVE_ELEMENT_6 = 0x16, /* Optional */
|
||||
kSMCCmd_RESERVE_ELEMENT_10 = 0x56 /* Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x09 SSC Communications Commands
|
||||
/* Commands defined by the T10:997-D SCSI-3 Stream Commands (SSC)
|
||||
* (revision 22, January 1, 2000) command specification.
|
||||
*/
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x0A ASC IT8 Prepress Commands
|
||||
#pragma mark 0x0B ASC IT8 Prepress Commands
|
||||
/* Commands defined by the ASC IT8 <title goes here> specification
|
||||
* (revision xx, month day, year) command specification.
|
||||
*/
|
||||
#if 0
|
||||
enum
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x0C SCC Array Controller Commands
|
||||
/* Commands defined by the ANSI NCITS.318-199x SCSI Controller
|
||||
* Commands (SCC-2) ratified command specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSCCCmd_MAINTENANCE_IN = 0xA3, /* Mandatory */
|
||||
kSCCCmd_MAINTENANCE_OUT = 0xA4, /* Optional */
|
||||
kSCCCmd_MODE_SELECT_6 = 0x15, /* Optional */
|
||||
kSCCCmd_MODE_SELECT_10 = 0x55, /* Optional */
|
||||
kSCCCmd_MODE_SENSE_6 = 0x1A, /* Optional */
|
||||
kSCCCmd_MODE_SENSE_10 = 0x5A, /* Optional */
|
||||
kSCCCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Optional */
|
||||
kSCCCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Optional */
|
||||
kSCCCmd_PORT_STATUS = 0x1F, /* Optional */
|
||||
kSCCCmd_REDUNDANCY_GROUP_IN = 0xBA, /* Mandatory */
|
||||
kSCCCmd_REDUNDANCY_GROUP_OUT = 0xBB, /* Optional */
|
||||
kSCCCmd_RELEASE_6 = 0x17, /* Optional */
|
||||
kSCCCmd_RELEASE_10 = 0x57, /* Optional */
|
||||
kSCCCmd_REPORT_LUNS = 0xA0, /* Mandatory */
|
||||
kSCCCmd_REQUEST_SENSE = 0x03, /* Mandatory */
|
||||
kSCCCmd_RESERVE_6 = 0x16, /* Optional */
|
||||
kSCCCmd_RESERVE_10 = 0x56, /* Optional*/
|
||||
kSCCCmd_SEND_DIAGNOSTICS = 0x1D, /* Optional */
|
||||
kSCCCmd_SPARE_IN = 0xBC, /* Mandatory */
|
||||
kSCCCmd_SPARE_OUT = 0xBD /* Optional */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x0D SES Enclosure Services Commands
|
||||
/* Commands defined by the T10:1212-D SCSI-3 Enclosure Services (SES)
|
||||
* (revision 8b, February 11, 1998) command specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kSESCmd_MODE_SELECT_6 = 0x15, /* Optional */
|
||||
kSESCmd_MODE_SELECT_10 = 0x55, /* Optional */
|
||||
kSESCmd_MODE_SENSE_6 = 0x1A, /* Optional */
|
||||
kSESCmd_MODE_SENSE_10 = 0x5A, /* Optional */
|
||||
kSESCmd_PERSISTENT_RESERVE_IN = 0x5E, /* Optional */
|
||||
kSESCmd_PERSISTENT_RESERVE_OUT = 0x5F, /* Optional */
|
||||
kSESCmd_RECEIVE_DIAGNOSTICS_RESULTS = 0x17, /* Mandatory */
|
||||
kSESCmd_RELEASE_6 = 0x17, /* Optional */
|
||||
kSESCmd_RELEASE_10 = 0x57, /* Optional */
|
||||
kSESCmd_REQUEST_SENSE = 0x03, /* Mandatory */
|
||||
kSESCmd_RESERVE_6 = 0x16, /* Optional */
|
||||
kSESCmd_RESERVE_10 = 0x56, /* Optional */
|
||||
kSESCmd_SEND_DIAGNOSTICS = 0x1D /* Mandatory */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x0E RBC Reduced Block Commands
|
||||
/* Commands defined by the T10:1240-D Reduced Block Commands (RBC)
|
||||
* (revision 10a, August 18, 1999) command specification.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
kRBCCmd_FORMAT_UNIT = 0x04, /* Optional */
|
||||
kRBCCmd_READ_10 = 0x28, /* Mandatory */
|
||||
kRBCCmd_READ_CAPACITY = 0x25, /* Mandatory */
|
||||
kRBCCmd_START_STOP_UNIT = 0x1B, /* Mandatory */
|
||||
kRBCCmd_SYNCHRONIZE_CACHE = 0x35, /* Optional */
|
||||
kRBCCmd_VERIFY_10 = 0x2F, /* Mandatory */
|
||||
kRBCCmd_WRITE_10 = 0x2A, /* Mandatory */
|
||||
kRBCCmd_WRITE_BUFFER = 0x3B /* Mandatory for fixed media
|
||||
* Optional for removable */
|
||||
};
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x0F OCRW Optical Card Commands
|
||||
/* Commands defined by the ISO/IEC 14776-381 SCSI Specification for
|
||||
* Optical Card Reader/Writer (OCRW) ratified command specification.
|
||||
*/
|
||||
#if 0
|
||||
enum
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x11 OSD Object-based Storage Commands
|
||||
/* Commands defined by the T10:1355-D Object-based Storage Commands (OSD)
|
||||
* (revision 1, 18 May 2000) command specification.
|
||||
*/
|
||||
#if 0
|
||||
enum
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark 0x15 RMC Simplified Multimedia Commands
|
||||
/* Commands defined by the T10:1364-D Reduced Multimedia Commands (RMC)
|
||||
* (revision 1, November 11, 1999) command specification.
|
||||
*/
|
||||
#if 0
|
||||
enum
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif /* _SCSI_COMMAND_OPERATION_CODES_H_ */
|
||||
@@ -0,0 +1,474 @@
|
||||
/*
|
||||
* Copyright (c) 1998-2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this
|
||||
* file.
|
||||
*
|
||||
* The 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, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_LICENSE_HEADER_END@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _IOKIT_SCSI_TASK_H_
|
||||
#define _IOKIT_SCSI_TASK_H_
|
||||
|
||||
#include <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_DRIVERKIT
|
||||
typedef uint8_t UInt8;
|
||||
typedef uint64_t UInt64;
|
||||
#else
|
||||
#if KERNEL
|
||||
#include <IOKit/IOTypes.h>
|
||||
#else
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*! @header SCSITask
|
||||
SCSITask typedefs and constants used inside the kernel and user space.
|
||||
|
||||
Note that the SCSITaskIdentifier is an opaque object and that directly
|
||||
casting the SCSITaskIdentifier to any other type is discouraged. The SCSITask
|
||||
implementation changes when necessary to accomodate architectural changes,
|
||||
performance improvements, and bug fixes.
|
||||
|
||||
Device and protocol layer drivers that need to access information
|
||||
contained in a SCSITask should use the appropriate accessor methods in
|
||||
IOSCSIPrimaryCommandsDevice.h or IOSCSIProtocolServices.h
|
||||
*/
|
||||
|
||||
|
||||
/*! @typedef SCSIDeviceIdentifier
|
||||
@abstract 64-bit number to represent a SCSI Device.
|
||||
@discussion If the identifier can either be that of an initiator or a target,
|
||||
SCSIDeviceIdentifier should be used.
|
||||
*/
|
||||
|
||||
typedef UInt64 SCSIDeviceIdentifier;
|
||||
|
||||
/*! @typedef SCSITargetIdentifier
|
||||
@abstract 64-bit number to represent a SCSI Target Device.
|
||||
@discussion If the identifier is for a target only and not an initiator, then
|
||||
SCSITargetIdentifier should be used.
|
||||
*/
|
||||
|
||||
typedef SCSIDeviceIdentifier SCSITargetIdentifier;
|
||||
|
||||
/*! @typedef SCSIInitiatorIdentifier
|
||||
@abstract 64-bit number to represent a SCSI Initiator Device.
|
||||
@discussion If the identifier is for an initiator only and not a target, then
|
||||
SCSIInitiatorIdentifier should be used.
|
||||
*/
|
||||
|
||||
typedef SCSIDeviceIdentifier SCSIInitiatorIdentifier;
|
||||
|
||||
/*! @typedef SCSILogicalUnitBytes[8]
|
||||
@abstract 8-Byte array to represent LUN information
|
||||
@discussion The SCSI Primary Commands specification treats the 64-bits
|
||||
of LUN information as 4 2-byte structures.
|
||||
|
||||
Use of the 64-bit SCSILogicalUnitNumber is now deprecated. Since it
|
||||
was not defined on Mac OS X how the 64-bits were encoded for hierarchical
|
||||
units and all usage was simply as a 64-bit number, changing the encoding
|
||||
scheme now would result in non-binary compatible code. New APIs have been
|
||||
added to retrieve the LUN bytes from the SCSITask and set them in the SCSITask.
|
||||
*/
|
||||
typedef UInt8 SCSILogicalUnitBytes[8];
|
||||
typedef UInt64 SCSILogicalUnitNumber; // DEPRECATED
|
||||
|
||||
|
||||
/*! @typedef SCSITaggedTaskIdentifier
|
||||
@abstract 64-bit number to represent a unique task identifier.
|
||||
@discussion The Tagged Task Identifier is used when a Task has a Task Attribute other
|
||||
than SIMPLE. The SCSI Application Layer client that controls the Logical
|
||||
Unit for which a Task is intended is required to guarantee that the Task
|
||||
Tag Identifier is unique. Zero cannot be used a a Tag value as this is used
|
||||
to when a Tagged Task Identifier value is needed for a Task with a SIMPLE
|
||||
attribute.
|
||||
*/
|
||||
|
||||
typedef UInt64 SCSITaggedTaskIdentifier;
|
||||
|
||||
/*!
|
||||
@enum Untagged Task Identifier
|
||||
@discussion The Untagged Task Identifier is used to indicate no unique tag
|
||||
is associated with the Task.
|
||||
@constant kSCSIUntaggedTaskIdentifier This value means the task is untagged.
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
kSCSIUntaggedTaskIdentifier = 0
|
||||
};
|
||||
|
||||
/*!
|
||||
@typedef SCSITaskAttribute
|
||||
@abstract Attributes for task delivery.
|
||||
@discussion The Task Attribute defines how this task should be managed
|
||||
when determing order for queueing and submission to the
|
||||
appropriate device server. The Task Attribute is set by the SCSI
|
||||
Application Layer and cannot be modified by the SCSI Protocol Layer.
|
||||
@constant kSCSITask_SIMPLE The task has a simple attribute.
|
||||
@constant kSCSITask_ORDERED The task has an ordered attribute.
|
||||
@constant kSCSITask_HEAD_OF_QUEUE The task has a head-of-queue attribute.
|
||||
@constant kSCSITask_ACA The task has an auto-contingent-allegiance attribute.
|
||||
*/
|
||||
|
||||
typedef enum SCSITaskAttribute
|
||||
{
|
||||
kSCSITask_SIMPLE = 0,
|
||||
kSCSITask_ORDERED = 1,
|
||||
kSCSITask_HEAD_OF_QUEUE = 2,
|
||||
kSCSITask_ACA = 3
|
||||
} SCSITaskAttribute;
|
||||
|
||||
/*!
|
||||
@typedef SCSITaskState
|
||||
@abstract Attributes for task state.
|
||||
@discussion The Task State represents the current state of the task.
|
||||
The state is set to NEW_TASK when the task is created. The SCSI Protocol
|
||||
Layer will then adjust the state as the task is queued and during
|
||||
execution. The SCSI Application Layer can examine the state to monitor
|
||||
the progress of a task. The Task State can only be modified by the SCSI
|
||||
Protocol Layer. The SCSI Application Layer can only read the state.
|
||||
@constant kSCSITaskState_NEW_TASK The task state is new task.
|
||||
@constant kSCSITaskState_ENABLED The task is enabled and queued.
|
||||
@constant kSCSITaskState_BLOCKED The task is blocked.
|
||||
@constant kSCSITaskState_DORMANT The task is dormant.
|
||||
@constant kSCSITaskState_ENDED The task is complete.
|
||||
*/
|
||||
|
||||
typedef enum SCSITaskState
|
||||
{
|
||||
kSCSITaskState_NEW_TASK = 0,
|
||||
kSCSITaskState_ENABLED = 1,
|
||||
kSCSITaskState_BLOCKED = 2,
|
||||
kSCSITaskState_DORMANT = 3,
|
||||
kSCSITaskState_ENDED = 4
|
||||
} SCSITaskState;
|
||||
|
||||
|
||||
/*!
|
||||
@typedef SCSIServiceResponse
|
||||
@abstract Attributes for task service response.
|
||||
@discussion The Service Response represents the execution status of
|
||||
a service request made to a Protocol Services Driver. The Service
|
||||
Response can only be modified by the SCSI Protocol Layer. The SCSI
|
||||
Application Layer can only read the state.
|
||||
*/
|
||||
|
||||
typedef enum SCSIServiceResponse
|
||||
{
|
||||
/*!
|
||||
@constant kSCSIServiceResponse_Request_In_Process
|
||||
Not defined in SAM specification, but is a service response used
|
||||
for asynchronous commands that are not yet completed.
|
||||
*/
|
||||
kSCSIServiceResponse_Request_In_Process = 0,
|
||||
|
||||
/*!
|
||||
@constant kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE
|
||||
The service request failed because of a delivery or target failure.
|
||||
*/
|
||||
kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE = 1,
|
||||
|
||||
/*!
|
||||
@constant kSCSIServiceResponse_TASK_COMPLETE
|
||||
The task completed.
|
||||
*/
|
||||
kSCSIServiceResponse_TASK_COMPLETE = 2,
|
||||
|
||||
/*!
|
||||
@constant kSCSIServiceResponse_LINK_COMMAND_COMPLETE
|
||||
The linked command completed.
|
||||
*/
|
||||
kSCSIServiceResponse_LINK_COMMAND_COMPLETE = 3,
|
||||
|
||||
/*!
|
||||
@constant kSCSIServiceResponse_FUNCTION_COMPLETE
|
||||
The task management function completed.
|
||||
*/
|
||||
kSCSIServiceResponse_FUNCTION_COMPLETE = 4,
|
||||
|
||||
/*!
|
||||
@constant kSCSIServiceResponse_FUNCTION_REJECTED
|
||||
The task management function was rejected.
|
||||
*/
|
||||
kSCSIServiceResponse_FUNCTION_REJECTED = 5
|
||||
} SCSIServiceResponse;
|
||||
|
||||
/*!
|
||||
@typedef SCSITaskStatus
|
||||
@abstract Attributes for task status.
|
||||
@discussion The Task Status represents the completion status
|
||||
of the task which provides the SCSI Application Layer with
|
||||
additional information about how to procede in handling a
|
||||
completed task.
|
||||
|
||||
The SCSI Architecture Model specification only defines task
|
||||
status values for when a task completes with a service response
|
||||
of either TASK_COMPLETED or LINK_COMMAND_COMPLETE.
|
||||
|
||||
Since additional information will aid in error recovery when
|
||||
a task fails to be completed by a device due to a service
|
||||
response of kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE,
|
||||
additional values have been defined that can be returned by the
|
||||
SCSI Protocol Layer to inform the SCSI Application Layer of the
|
||||
cause of the delivery failure.
|
||||
|
||||
The Task Status can only be modified by the SCSI Protocol Layer.
|
||||
The SCSI Application Layer can only read the status
|
||||
*/
|
||||
typedef enum SCSITaskStatus
|
||||
{
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_GOOD
|
||||
The task completed with a status of GOOD.
|
||||
*/
|
||||
|
||||
kSCSITaskStatus_GOOD = 0x00,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_CHECK_CONDITION
|
||||
The task completed with a status of CHECK_CONDITION. Additional
|
||||
information about the condition should be available in the sense data.
|
||||
*/
|
||||
|
||||
kSCSITaskStatus_CHECK_CONDITION = 0x02,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_CONDITION_MET
|
||||
The task completed with a status of CONDITION_MET.
|
||||
*/
|
||||
|
||||
kSCSITaskStatus_CONDITION_MET = 0x04,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_BUSY
|
||||
The task completed with a status of BUSY. The device server might need
|
||||
time to process a request and a delay may be required.
|
||||
*/
|
||||
kSCSITaskStatus_BUSY = 0x08,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_INTERMEDIATE
|
||||
The task completed with a status of INTERMEDIATE.
|
||||
*/
|
||||
kSCSITaskStatus_INTERMEDIATE = 0x10,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_INTERMEDIATE_CONDITION_MET
|
||||
The task completed with a status of INTERMEDIATE_CONDITION_MET.
|
||||
*/
|
||||
kSCSITaskStatus_INTERMEDIATE_CONDITION_MET = 0x14,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_RESERVATION_CONFLICT
|
||||
The task completed with a status of RESERVATION_CONFLICT.
|
||||
*/
|
||||
kSCSITaskStatus_RESERVATION_CONFLICT = 0x18,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_TASK_SET_FULL
|
||||
The task completed with a status of TASK_SET_FULL. The device server
|
||||
may need to complete a task before the initiator sends another.
|
||||
*/
|
||||
kSCSITaskStatus_TASK_SET_FULL = 0x28,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_ACA_ACTIVE
|
||||
The task completed with a status of ACA_ACTIVE. The device server may
|
||||
need the initiator to clear the Auto-Contingent Allegiance condition
|
||||
before it will respond to new commands.
|
||||
*/
|
||||
kSCSITaskStatus_ACA_ACTIVE = 0x30,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_TaskTimeoutOccurred
|
||||
If a task is aborted by the SCSI Protocol Layer due to it exceeding
|
||||
the timeout value specified by the task, the task status shall be
|
||||
set to kSCSITaskStatus_TaskTimeoutOccurred.
|
||||
*/
|
||||
|
||||
kSCSITaskStatus_TaskTimeoutOccurred = 0x01,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_ProtocolTimeoutOccurred
|
||||
If a task is aborted by the SCSI Protocol Layer due to it exceeding a
|
||||
timeout value specified by the support for the protocol or a related
|
||||
specification, the task status shall be set to
|
||||
kSCSITaskStatus_ProtocolTimeoutOccurred.
|
||||
*/
|
||||
|
||||
kSCSITaskStatus_ProtocolTimeoutOccurred = 0x02,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_DeviceNotResponding
|
||||
If a task is unable to be delivered due to a failure of the device not
|
||||
accepting the task or the device acknowledging the attempt to send it the
|
||||
device the task status shall be set to kSCSITaskStatus_DeviceNotResponding.
|
||||
This will allow the SCSI Application driver to perform the necessary steps
|
||||
to try to recover the device. This shall only be reported after the SCSI
|
||||
Protocol Layer driver has attempted all protocol specific attempts to recover
|
||||
the device.
|
||||
*/
|
||||
|
||||
kSCSITaskStatus_DeviceNotResponding = 0x03,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_DeviceNotPresent
|
||||
If the task is unable to be delivered because the device has been
|
||||
detached, the task status shall be set to kSCSITaskStatus_DeviceNotPresent.
|
||||
This will allow the SCSI Application Layer to halt the sending of tasks
|
||||
to the device and, if supported, perform any device failover or system
|
||||
cleanup.
|
||||
*/
|
||||
kSCSITaskStatus_DeviceNotPresent = 0x04,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_DeliveryFailure
|
||||
If the task is unable to be
|
||||
delivered to the device due to a failure in the SCSI Protocol Layer,
|
||||
such as a bus reset or communications error, but the device is is
|
||||
known to be functioning properly, the task status shall be set to
|
||||
kSCSITaskStatus_DeliveryFailure. This can also be reported if the
|
||||
task could not be delivered due to a protocol error that has since
|
||||
been corrected.
|
||||
*/
|
||||
kSCSITaskStatus_DeliveryFailure = 0x05,
|
||||
|
||||
/*!
|
||||
@constant kSCSITaskStatus_No_Status
|
||||
This status is not defined by
|
||||
the SCSI specifications, but is here to provide a status that can
|
||||
be returned in cases where there is not status available from the
|
||||
device or protocol, for example, when the service response is
|
||||
neither TASK_COMPLETED nor LINK_COMMAND_COMPLETE or when the
|
||||
service response is SERVICE_DELIVERY_OR_TARGET_FAILURE and the
|
||||
reason for failure could not be determined.
|
||||
*/
|
||||
kSCSITaskStatus_No_Status = 0xFF
|
||||
} SCSITaskStatus;
|
||||
|
||||
/*!
|
||||
@enum Command Descriptor Block Size
|
||||
@discussion Command Descriptor Block Size constants.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!
|
||||
@constant kSCSICDBSize_Maximum This is the largest size a Command Descriptor
|
||||
Block can be as specified in SPC-2.
|
||||
*/
|
||||
kSCSICDBSize_Maximum = 16,
|
||||
|
||||
/*!
|
||||
@constant kSCSICDBSize_6Byte Use this for a 6-byte CDB.
|
||||
*/
|
||||
kSCSICDBSize_6Byte = 6,
|
||||
|
||||
/*!
|
||||
@constant kSCSICDBSize_10Byte Use this for a 10-byte CDB.
|
||||
*/
|
||||
kSCSICDBSize_10Byte = 10,
|
||||
|
||||
/*!
|
||||
@constant kSCSICDBSize_12Byte Use this for a 12-byte CDB.
|
||||
*/
|
||||
kSCSICDBSize_12Byte = 12,
|
||||
|
||||
/*!
|
||||
@constant kSCSICDBSize_16Byte Use this for a 16-byte CDB.
|
||||
*/
|
||||
kSCSICDBSize_16Byte = 16
|
||||
};
|
||||
|
||||
typedef UInt8 SCSICommandDescriptorBlock[kSCSICDBSize_Maximum];
|
||||
|
||||
/*!
|
||||
@enum Data Transfer Direction
|
||||
@discussion DataTransferDirection constants.
|
||||
*/
|
||||
enum
|
||||
{
|
||||
/*!
|
||||
@constant kSCSIDataTransfer_NoDataTransfer Use this for tasks
|
||||
that transfer no data.
|
||||
*/
|
||||
kSCSIDataTransfer_NoDataTransfer = 0x00,
|
||||
|
||||
/*!
|
||||
@constant kSCSIDataTransfer_FromInitiatorToTarget Use this for tasks that transfer
|
||||
data from the initiator to the target.
|
||||
*/
|
||||
kSCSIDataTransfer_FromInitiatorToTarget = 0x01,
|
||||
|
||||
/*!
|
||||
@constant kSCSIDataTransfer_FromTargetToInitiator Use this for tasks that transfer
|
||||
data from the target to the initiator.
|
||||
*/
|
||||
kSCSIDataTransfer_FromTargetToInitiator = 0x02
|
||||
};
|
||||
|
||||
|
||||
/* Libkern includes */
|
||||
#if defined(KERNEL) && defined(__cplusplus)
|
||||
#if TARGET_OS_DRIVERKIT
|
||||
#include <DriverKit/OSObject.h>
|
||||
#else
|
||||
#include <libkern/c++/OSObject.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
@enum SCSITaskMode
|
||||
@discussion The SCSI Task mode is used by the SCSI
|
||||
Protocol Layer to indicate what mode the task is executing.
|
||||
*/
|
||||
typedef enum SCSITaskMode
|
||||
{
|
||||
kSCSITaskMode_CommandExecution = 1,
|
||||
kSCSITaskMode_Autosense = 2
|
||||
} SCSITaskMode;
|
||||
|
||||
/*!
|
||||
@typedef SCSITaskIdentifier
|
||||
@discussion This is an opaque object that represents a task.
|
||||
This is used so that drivers for both the SCSI Protocol Layer
|
||||
and the SCSI Application Layer cannot modify the SCSITask object
|
||||
directly but must instead use the inherited methods to do so. This
|
||||
allows the implementation of SCSITask to change without directly
|
||||
impacting device and protocol layer drivers. In addition, it
|
||||
prevents changing of properties that are not allowed to be
|
||||
changed by a given layer.
|
||||
*/
|
||||
typedef OSObject * SCSITaskIdentifier;
|
||||
|
||||
|
||||
/*!
|
||||
@typedef SCSITaskCompletion
|
||||
@discussion This is the typedef for completion routines that
|
||||
work with SCSITaskIdentifiers.
|
||||
*/
|
||||
typedef void ( *SCSITaskCompletion )( SCSITaskIdentifier completedTask );
|
||||
|
||||
|
||||
#endif /* defined(KERNEL) && defined(__cplusplus) */
|
||||
|
||||
#endif /* _IOKIT_SCSI_TASK_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (c) 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@
|
||||
*/
|
||||
/*
|
||||
* IOSerialKeys.h
|
||||
*
|
||||
* 2000-10-21 gvdl Initial real change to IOKit serial family.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
Sample Matching dictionary
|
||||
{
|
||||
IOProviderClass = kIOSerialBSDServiceValue;
|
||||
kIOSerialBSDTypeKey = kIOSerialBSDAllTypes
|
||||
| kIOSerialBSDModemType
|
||||
| kIOSerialBSDRS232Type;
|
||||
kIOTTYDeviceKey = <Raw Unique Device Name>;
|
||||
kIOTTYBaseNameKey = <Raw Unique Device Name>;
|
||||
kIOTTYSuffixKey = <Raw Unique Device Name>;
|
||||
kIOCalloutDeviceKey = <Callout Device Name>;
|
||||
kIODialinDeviceKey = <Dialin Device Name>;
|
||||
}
|
||||
|
||||
Note only the IOProviderClass is mandatory. The other keys allow the searcher to reduce the size of the set of matching devices.
|
||||
*/
|
||||
|
||||
/* Service Matching That is the 'IOProviderClass' */
|
||||
#define kIOSerialBSDServiceValue "IOSerialBSDClient"
|
||||
|
||||
/* Matching keys */
|
||||
#define kIOSerialBSDTypeKey "IOSerialBSDClientType"
|
||||
|
||||
/* Currently possible kIOSerialBSDTypeKey values. */
|
||||
#define kIOSerialBSDAllTypes "IOSerialStream"
|
||||
#define kIOSerialBSDModemType "IOSerialStream"
|
||||
#define kIOSerialBSDRS232Type "IOSerialStream"
|
||||
|
||||
// Properties that resolve to a /dev device node to open for
|
||||
// a particular service
|
||||
#define kIOTTYDeviceKey "IOTTYDevice"
|
||||
#define kIOTTYBaseNameKey "IOTTYBaseName"
|
||||
#define kIOTTYSuffixKey "IOTTYSuffix"
|
||||
|
||||
#define kIOCalloutDeviceKey "IOCalloutDevice"
|
||||
#define kIODialinDeviceKey "IODialinDevice"
|
||||
|
||||
// Property 'ioctl' wait for the tty device to go idle.
|
||||
#define kIOTTYWaitForIdleKey "IOTTYWaitForIdle"
|
||||
|
||||
#if KERNEL
|
||||
#if !defined(KERNEL_PRIVATE)
|
||||
extern const OSSymbol *gIOSerialBSDServiceValue __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIOSerialBSDTypeKey __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIOSerialBSDAllTypes __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIOSerialBSDModemType __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIOSerialBSDRS232Type __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIOTTYDeviceKey __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIOTTYBaseNameKey __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIOTTYSuffixKey __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIOCalloutDeviceKey __deprecated_msg("Use DriverKit");
|
||||
extern const OSSymbol *gIODialinDeviceKey __deprecated_msg("Use DriverKit");
|
||||
#else
|
||||
extern const OSSymbol *gIOSerialBSDServiceValue;
|
||||
extern const OSSymbol *gIOSerialBSDTypeKey;
|
||||
extern const OSSymbol *gIOSerialBSDAllTypes;
|
||||
extern const OSSymbol *gIOSerialBSDModemType;
|
||||
extern const OSSymbol *gIOSerialBSDRS232Type;
|
||||
extern const OSSymbol *gIOTTYDeviceKey;
|
||||
extern const OSSymbol *gIOTTYBaseNameKey;
|
||||
extern const OSSymbol *gIOTTYSuffixKey;
|
||||
extern const OSSymbol *gIOCalloutDeviceKey;
|
||||
extern const OSSymbol *gIODialinDeviceKey;
|
||||
#endif
|
||||
#endif /* KERNEL */
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (c) 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@
|
||||
*/
|
||||
/* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
|
||||
|
||||
/* ioctl's for all Apple IOSerialStream based streaming serial ports */
|
||||
|
||||
#ifndef _SYS_IOSS_H
|
||||
#define _SYS_IOSS_H
|
||||
|
||||
#ifndef _POSIX_SOURCE
|
||||
|
||||
#include <sys/termios.h>
|
||||
#include <sys/ttycom.h>
|
||||
|
||||
/*
|
||||
* External clock baud rates, for use with cfsetospeed
|
||||
*/
|
||||
#define _MAKE_EXT(x) (((x) << 1) | 1)
|
||||
#define BEXT1 _MAKE_EXT(1)
|
||||
#define BEXT2 _MAKE_EXT(2)
|
||||
#define BEXT4 _MAKE_EXT(4)
|
||||
#define BEXT8 _MAKE_EXT(8)
|
||||
#define BEXT16 _MAKE_EXT(16)
|
||||
#define BEXT32 _MAKE_EXT(32)
|
||||
#define BEXT64 _MAKE_EXT(64)
|
||||
#define BEXT128 _MAKE_EXT(128)
|
||||
#define BEXT256 _MAKE_EXT(256)
|
||||
|
||||
// ul - unsigned long for x86_64
|
||||
// us - unsigned long for i386
|
||||
// speed and shspeed correspondingly
|
||||
typedef __uint64_t user_ul_t;
|
||||
typedef __uint64_t user_speed_t;
|
||||
typedef __uint32_t user_us_t;
|
||||
typedef __uint32_t user_shspeed_t;
|
||||
|
||||
/*
|
||||
* Sets the receive latency (in microseconds) with the default
|
||||
* value of 0 meaning a 256 / 3 character delay latency.
|
||||
*/
|
||||
#define IOSSDATALAT _IOW('T', 0, unsigned long)
|
||||
#define IOSSDATALAT_32 _IOW('T', 0, user_us_t)
|
||||
#define IOSSDATALAT_64 _IOW('T', 0, user_ul_t)
|
||||
|
||||
/*
|
||||
* Controls the pre-emptible status of IOSS based serial dial in devices
|
||||
* (i.e. /dev/tty.* devices). If true an open tty.* device is pre-emptible by
|
||||
* a dial out call. Once a dial in call is established then setting pre-empt
|
||||
* to false will halt any further call outs on the cu device.
|
||||
*/
|
||||
#define IOSSPREEMPT _IOW('T', 1, int)
|
||||
|
||||
/*
|
||||
* Sets the input speed and output speed to a non-traditional baud rate
|
||||
*/
|
||||
#define IOSSIOSPEED _IOW('T', 2, speed_t)
|
||||
#define IOSSIOSPEED_32 _IOW('T', 2, user_shspeed_t)
|
||||
#define IOSSIOSPEED_64 _IOW('T', 2, user_speed_t)
|
||||
|
||||
#endif /*_POSIX_SOURCE */
|
||||
|
||||
/*
|
||||
* END OF PROTECTED INCLUDE.
|
||||
*/
|
||||
#endif /* !_SYS_IOSS_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user