Annotation of XNU/iokit/Drivers/platform/drvAppleCuda/AppleCuda.h, revision 1.1.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 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991  
                     24:  *              All Rights Reserved 
                     25:  *  
                     26:  * Permission to use, copy, modify, and distribute this software and 
                     27:  * its documentation for any purpose and without fee is hereby granted, 
                     28:  * provided that the above copyright notice appears in all copies and 
                     29:  * that both the copyright notice and this permission notice appear in 
                     30:  * supporting documentation. 
                     31:  *  
                     32:  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
                     33:  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
                     34:  * FOR A PARTICULAR PURPOSE. 
                     35:  *  
                     36:  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
                     37:  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
                     38:  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
                     39:  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
                     40:  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
                     41:  * 
                     42:  */
                     43: /*
                     44:  * Copyright 1996 1995 by Apple Computer, Inc. 1997 1996 1995 1994 1993 1992 1991  
                     45:  *              All Rights Reserved 
                     46:  *  
                     47:  * Permission to use, copy, modify, and distribute this software and 
                     48:  * its documentation for any purpose and without fee is hereby granted, 
                     49:  * provided that the above copyright notice appears in all copies and 
                     50:  * that both the copyright notice and this permission notice appear in 
                     51:  * supporting documentation. 
                     52:  *  
                     53:  * APPLE COMPUTER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
                     54:  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
                     55:  * FOR A PARTICULAR PURPOSE. 
                     56:  *  
                     57:  * IN NO EVENT SHALL APPLE COMPUTER BE LIABLE FOR ANY SPECIAL, INDIRECT, OR 
                     58:  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 
                     59:  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, 
                     60:  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 
                     61:  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
                     62:  */
                     63: /*
                     64:  * MKLINUX-1.0DR2
                     65:  */
                     66: 
                     67: /* 1 April 1997 Simon Douglas:
                     68:  * Stolen wholesale from MkLinux.
                     69:  * Added nonblocking adb poll from interrupt level for the debugger.
                     70:  * Acknowledge before response so polled mode can work from inside the adb handler.
                     71:  *
                     72:  * 18 June 1998 sdouglas
                     73:  * Start IOKit version. Fix errors from kCudaSRQAssertMask. Use ool cmd & reply buffers,
                     74:  * not fixed len in packet. Does queueing here.
                     75:  *
                     76:  * 20 Nov 1998 suurballe
                     77:  * Port to C++
                     78:  */
                     79: 
                     80: 
                     81: #include <mach/mach_types.h>
                     82: 
                     83: #include <IOKit/IOService.h>
                     84: 
                     85: extern "C" {
                     86: #include <pexpert/pexpert.h>
                     87: }
                     88: #include <IOKit/IOLocks.h>
                     89: #include "AppleCudaCommands.h"
                     90: #include "AppleCudaHW.h"
                     91: #include <IOKit/adb/adb.h>
                     92: 
                     93: //
                     94: //  CudaInterruptState - internal to CudaCore.c
                     95: //
                     96: 
                     97: enum CudaInterruptState
                     98: {
                     99:     CUDA_STATE_INTERRUPT_LIMBO         = -1,       //
                    100:     CUDA_STATE_IDLE                    = 0,        //
                    101:     CUDA_STATE_ATTN_EXPECTED           = 1,        //
                    102:     CUDA_STATE_TRANSMIT_EXPECTED       = 2,        //
                    103:     CUDA_STATE_RECEIVE_EXPECTED        = 3         //
                    104: };
                    105: 
                    106: typedef enum CudaInterruptState CudaInterruptState;
                    107: 
                    108: //
                    109: //  CudaTransactionFlag - internal to CudaCore.c
                    110: //
                    111: 
                    112: enum CudaTransactionFlag
                    113: {
                    114:     CUDA_TS_NO_REQUEST         = 0x0000,
                    115:     CUDA_TS_SYNC_RESPONSE      = 0x0001,
                    116:     CUDA_TS_ASYNC_RESPONSE     = 0x0002
                    117: };
                    118: 
                    119: typedef enum CudaTransactionFlag CudaTransactionFlag;
                    120: 
                    121: //typedef void (* ADB_input_func)(IOService * obj_id, UInt8 * buffer, UInt32 length, UInt8 command);
                    122: 
                    123: class IOCudaADBController;
                    124: class IOInterruptEventSource;
                    125: class IOWorkLoop;
                    126: 
                    127: 
                    128: class AppleCuda: public IOService
                    129: {
                    130: OSDeclareDefaultStructors(AppleCuda)
                    131: 
                    132: private:
                    133: 
                    134: IOService *                    cudaDevice;
                    135: IOWorkLoop *                   workLoop;
                    136: IOService *                    ADBid;
                    137: IOCudaADBController *          ourADBinterface;
                    138: ADB_callback_func              autopoll_handler;
                    139: 
                    140:        // number of autopoll buffers between interrupt and thread
                    141: #define NUM_AP_BUFFERS (1<<3)
                    142:        // max adb register size for autopoll
                    143: #define MAX_AP_RESPONSE (8)
                    144: 
                    145: unsigned char                  cuda_autopoll_buffers[ NUM_AP_BUFFERS ]
                    146:                                                     [ MAX_AP_RESPONSE ];
                    147: 
                    148: protected:
                    149: 
                    150: virtual void free( void );
                    151: 
                    152: public:
                    153: 
                    154: VIARegisterAddress             cuda_via_regs;
                    155: bool                           cuda_polled_mode;
                    156: IOSimpleLock *                 cuda_request_lock;
                    157: volatile cuda_request_t *      cuda_request;           // head of todo queue
                    158: volatile cuda_request_t *      cuda_last_request;      // tail of todo queue
                    159: volatile CudaInterruptState    cuda_interrupt_state;
                    160: volatile unsigned int          inIndex;
                    161: volatile unsigned int          outIndex;
                    162: volatile CudaTransactionFlag   cuda_transaction_state;
                    163: cuda_packet_t                  cuda_unsolicited[ NUM_AP_BUFFERS ];
                    164: bool                           cuda_is_header_transfer;
                    165: int                            cuda_transfer_count;
                    166: IOInterruptEventSource *       eventSrc;
                    167: cuda_packet_t *                        cuda_current_response;
                    168: bool                           cuda_is_packet_type;
                    169: AbsoluteTime                   cuda_state_transition_delay;
                    170: 
                    171: bool init ( OSDictionary * properties = 0 );
                    172: bool start ( IOService * );
                    173: virtual IOWorkLoop *getWorkLoop() const;
                    174: void serviceAutopolls ( void );
                    175: void registerForADBInterrupts ( ADB_callback_func handler, IOService * caller );
                    176: IOReturn doSyncRequest ( cuda_request_t * request );
                    177: };
                    178: 

unix.superglobalmegacorp.com

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