Annotation of driverkit/Examples/i386Loadable/NullDriver.m, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: /*     Copyright (c) 1993 NeXT Computer, Inc.  All rights reserved. 
        !            25:  *
        !            26:  * Example of a loadable i386 driver. This driver doesn't do anything
        !            27:  * other than show that it has been loaded, probed, and has a valid
        !            28:  * IOEISADeviceDescription.
        !            29:  *
        !            30:  * HISTORY
        !            31:  * 04-Feb-93    Doug Mitchell at NeXT
        !            32:  *      Created. 
        !            33:  */
        !            34: #import <driverkit/i386/directDevice.h>
        !            35: #import <driverkit/i386/IOEISADeviceDescription.h>
        !            36: #import <driverkit/generalFuncs.h>
        !            37: #import "NullDriver.h"
        !            38: #import <kernserv/kern_server_types.h>
        !            39: 
        !            40: /*
        !            41:  * Allocate an instance variable to be used by the kernel server interface
        !            42:  * routines for initializing and accessing this service.
        !            43:  */
        !            44: kern_server_t NullDriverInstance;
        !            45: 
        !            46: static int nullDriverUnit = 0;
        !            47: 
        !            48: @implementation NullDriver
        !            49: 
        !            50: /*
        !            51:  *  Probe, configure board and init new instance.
        !            52:  */
        !            53: + (BOOL)probe:deviceDescription
        !            54: {
        !            55:        NullDriver *driver = [self alloc];
        !            56: 
        !            57:        [driver setDeviceDescription:deviceDescription];
        !            58:        [driver initDriver];
        !            59:        return YES;
        !            60: }
        !            61: 
        !            62: - (void)initDriver
        !            63: {
        !            64:        id deviceDescription = [self deviceDescription];
        !            65:        char name[80];
        !            66:        
        !            67:        IOLog("NullDriver: interrupt %d channel %d\n",
        !            68:                [deviceDescription interrupt], 
        !            69:                [deviceDescription channel]);
        !            70:        [self setUnit:nullDriverUnit];
        !            71:        sprintf(name, "NullDriver%d", nullDriverUnit++);
        !            72:        [self setName:name];
        !            73:        [self setLocation:NULL];
        !            74:        [self registerDevice];
        !            75:        return; 
        !            76: }
        !            77: 

unix.superglobalmegacorp.com

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