Annotation of XNU/iokit/Families/IOADBBus/IOADBControllerUserClient.cpp, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*
        !            23:  * Copyright (c) 1999 Apple Computer, Inc.  All rights reserved.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: #include <IOKit/assert.h>
        !            28: #include <IOKit/IOLib.h>
        !            29: #include <IOKit/IOBufferMemoryDescriptor.h>
        !            30: #include "IOADBControllerUserClient.h"
        !            31: 
        !            32: #define super IOUserClient
        !            33: 
        !            34: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            35: 
        !            36: OSDefineMetaClassAndStructors(IOADBControllerUserClient, IOUserClient)
        !            37: 
        !            38: /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
        !            39: 
        !            40: IOADBControllerUserClient *IOADBControllerUserClient::withTask(task_t owningTask)
        !            41: {
        !            42:     IOADBControllerUserClient * me;
        !            43: 
        !            44:     me = new IOADBControllerUserClient;
        !            45:     if ( me ) {
        !            46:         if  (! me->init() ) {
        !            47:             me->release();
        !            48:             return NULL;
        !            49:         }
        !            50:         me->fTask = owningTask;
        !            51:     }
        !            52:     return me;
        !            53: }
        !            54: 
        !            55: bool IOADBControllerUserClient::start( IOService * provider )
        !            56: {
        !            57:     assert(OSDynamicCast(IOADBController, provider));
        !            58:     if(!super::start(provider))
        !            59:         return false;
        !            60:     fOwner = (IOADBController *)provider;
        !            61: 
        !            62:     // Got the owner, so initialize the call structures
        !            63:     fMethods[kADBReadDevice].object = provider;
        !            64:     fMethods[kADBReadDevice].func = (IOMethod)&IOADBController::readDeviceForUser;
        !            65:     fMethods[kADBReadDevice].count0 = 2;
        !            66:     fMethods[kADBReadDevice].count1 = 8;
        !            67:     fMethods[kADBReadDevice].flags = kIOUCScalarIStructO;
        !            68: 
        !            69:     fMethods[kADBWriteDevice].object = provider;
        !            70:     fMethods[kADBWriteDevice].func = (IOMethod)&IOADBController::writeDeviceForUser;
        !            71:     fMethods[kADBWriteDevice].count0 = 4;
        !            72:     fMethods[kADBWriteDevice].count1 = 0;
        !            73:     fMethods[kADBWriteDevice].flags = kIOUCScalarIScalarO;
        !            74: 
        !            75:     fMethods[kADBClaimDevice].object = provider;
        !            76:     fMethods[kADBClaimDevice].func = (IOMethod)&IOADBController::claimDevice;
        !            77:     fMethods[kADBClaimDevice].count0 = 1;
        !            78:     fMethods[kADBClaimDevice].count1 = 0;
        !            79:     fMethods[kADBClaimDevice].flags = kIOUCScalarIScalarO;
        !            80: 
        !            81:     fMethods[kADBReleaseDevice].object = provider;
        !            82:     fMethods[kADBReleaseDevice].func = (IOMethod)&IOADBController::releaseDevice;
        !            83:     fMethods[kADBReleaseDevice].count0 = 1;
        !            84:     fMethods[kADBReleaseDevice].count1 = 0;
        !            85:     fMethods[kADBReleaseDevice].flags = kIOUCScalarIScalarO;
        !            86: 
        !            87:     return true;
        !            88: }
        !            89: 
        !            90: IOReturn IOADBControllerUserClient::clientMemoryForType( UInt32 type,
        !            91:     UInt32 * flags, IOLogicalAddress * address, IOByteCount * size )
        !            92: {
        !            93:     return kIOReturnUnsupported;
        !            94: }
        !            95: 
        !            96: IOReturn IOADBControllerUserClient::clientClose( void )
        !            97: {
        !            98:     detach( fOwner);
        !            99: 
        !           100:     return kIOReturnSuccess;
        !           101: }
        !           102: 
        !           103: IOReturn IOADBControllerUserClient::clientDied( void )
        !           104: {
        !           105:     return( clientClose());
        !           106: }
        !           107: 
        !           108: IOReturn IOADBControllerUserClient::connectClient( IOUserClient * client )
        !           109: {
        !           110:     return kIOReturnSuccess;
        !           111: }
        !           112: 
        !           113: IOExternalMethod * IOADBControllerUserClient::getExternalMethodForIndex( UInt32 index )
        !           114: {
        !           115:     if(index >= kNumADBMethods)
        !           116:        return NULL;
        !           117:     else
        !           118:         return &fMethods[index];
        !           119: }
        !           120: 
        !           121: IOReturn IOADBControllerUserClient::registerNotificationPort ( mach_port_t port, UInt32 type )
        !           122: {
        !           123:     return kIOReturnUnsupported;
        !           124: }
        !           125: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.