1/* 2 * Copyright (c) 1998-2002 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 * IOFWUserIsochPortProxy.h 24 * IOFireWireFamily 25 * 26 * Created by NWG on Tue Mar 20 2001. 27 * Copyright (c) 2001 Apple Computer, Inc. All rights reserved. 28 * 29 */ 30 31#ifndef _IOKIT_IOFWUserIsochPortProxy_H 32#define _IOKIT_IOFWUserIsochPortProxy_H 33 34#import "IOFireWireLibPriv.h" 35 36// public 37#import <IOKit/firewire/IOFWLocalIsochPort.h> 38#import <IOKit/IOLocks.h> 39#import <IOKit/OSMessageNotification.h> 40 41#pragma mark - 42 43class IODCLProgram ; 44class IOBufferMemoryDescriptor ; 45class IOFireWireUserClient ; 46class IOFWDCLPool ; 47 48class IOFWUserLocalIsochPort : public IOFWLocalIsochPort 49{ 50 OSDeclareDefaultStructors( IOFWUserLocalIsochPort ) 51 52 typedef ::IOFireWireLib::LocalIsochPortAllocateParams AllocateParams ; 53 54 protected: 55 56 IORecursiveLock* fLock ; 57 mach_vm_address_t fUserObj ; 58 IOFireWireUserClient * fUserClient ; 59 60 unsigned fProgramCount ; 61 DCLCommand ** fDCLTable ; // lookup table 62 OSAsyncReference64 fStopTokenAsyncRef ; 63 64 UInt8* fProgramBuffer ; // for old style programs 65 IOFWDCLPool * fDCLPool ; // for new style programs 66 bool fStarted ; 67 68 public: 69 70 // OSObject 71 virtual void free () ; 72#if IOFIREWIREDEBUG > 0 73 virtual bool serialize( OSSerialize * s ) const ; 74#endif 75 76 // IOFWLocalIsochPort 77 virtual IOReturn start () ; 78 virtual IOReturn stop () ; 79 80 // me 81 bool initWithUserDCLProgram ( 82 AllocateParams * params, 83 IOFireWireUserClient & userclient, 84 IOFireWireController & controller ) ; 85 IOReturn importUserProgram ( 86 IOMemoryDescriptor * userExportDesc, 87 unsigned bufferRangeCount, 88 IOAddressRange userBufferRanges [], 89 IOMemoryMap * bufferMap ) ; 90 static void s_dclCallProcHandler ( 91 DCLCallProc * dcl ) ; 92 IOReturn setAsyncRef_DCLCallProc ( 93 OSAsyncReference64 asyncRef ) ; 94 IOReturn modifyJumpDCL ( 95 UInt32 jumpCompilerData, 96 UInt32 labelCompilerData ) ; 97 IOReturn modifyDCLSize ( 98 UInt32 compilerData, 99 IOByteCount newSize ) ; 100 101 inline void lock () { IORecursiveLockLock ( fLock ) ; } 102 inline void unlock () { IORecursiveLockUnlock ( fLock ) ; } 103 104 IOReturn convertToKernelDCL ( UserExportDCLUpdateDCLList *pUserExportDCL, DCLUpdateDCLList * dcl ) ; 105 IOReturn convertToKernelDCL ( UserExportDCLJump *pUserExportDCL, DCLJump * dcl ) ; 106 IOReturn convertToKernelDCL ( UserExportDCLCallProc *pUserExportDCL, DCLCallProc * dcl ) ; 107 108 static void exporterCleanup( const OSObject * self ); 109 static void s_nuDCLCallout( void * refcon ) ; 110 IOReturn userNotify ( 111 UInt32 notificationType, 112 UInt32 numDCLs, 113 void * data, 114 IOByteCount dataSize ) ; 115 IOWorkLoop * createRealtimeThread() ; 116} ; 117 118#endif //_IOKIT_IOFWUserIsochPortProxy_H 119