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* IOFireWireLibPhysicalAddressSpace.h 24* IOFireWireLib 25* 26* Created by NWG on Fri Dec 08 2000. 27* Copyright (c) 2000 Apple Computer, Inc. All rights reserved. 28* 29*/ 30 31#import "IOFireWireLibIUnknown.h" 32#import "IOFireWireLibPriv.h" 33 34namespace IOFireWireLib { 35 36 class Device ; 37 class PhysicalAddressSpace: IOFireWireIUnknown 38 { 39 typedef ::IOFireWirePhysicalAddressSpaceInterface Interface ; 40 41 public: 42 // 43 // === COM ===================================== 44 // 45 46 struct InterfaceMap 47 { 48 IUnknownVTbl * pseudoVTable; 49 PhysicalAddressSpace* obj; 50 }; 51 52 // interfaces 53 static Interface sInterface ; 54 55 // QueryInterface 56 virtual HRESULT QueryInterface( 57 REFIID iid, 58 LPVOID* ppv) ; 59 // static allocator 60 static IUnknownVTbl** Alloc( 61 Device& inUserClient, 62 UserObjectHandle inKernPhysicalAddrSpaceRef, 63 UInt32 inSize, 64 void* inBackingStore, 65 UInt32 inFlags) ; 66 67 // 68 // === STATIC METHODS ========================== 69 // 70 static void SGetPhysicalSegments( 71 IOFireWireLibPhysicalAddressSpaceRef self, 72 UInt32* ioSegmentCount, 73 IOByteCount outSegments[], 74 IOPhysicalAddress outAddresses[]) ; 75 static IOPhysicalAddress SGetPhysicalSegment( 76 IOFireWireLibPhysicalAddressSpaceRef self, 77 IOByteCount offset, 78 IOByteCount* length) ; 79 static IOPhysicalAddress SGetPhysicalAddress( 80 IOFireWireLibPhysicalAddressSpaceRef self) ; 81 82 static void SGetFWAddress( 83 IOFireWireLibPhysicalAddressSpaceRef self, 84 FWAddress* outAddr ) ; 85 static void* SGetBuffer( 86 IOFireWireLibPhysicalAddressSpaceRef self) ; 87 static const UInt32 SGetBufferSize( 88 IOFireWireLibPhysicalAddressSpaceRef self) ; 89 90 // --- constructor/destructor ------------------ 91 PhysicalAddressSpace( 92 Device& inUserClient, 93 UserObjectHandle inKernPhysicalAddrSpaceRef, 94 UInt32 inSize, 95 void* inBackingStore, 96 UInt32 inFlags) ; 97 virtual ~PhysicalAddressSpace() ; 98 IOReturn Init() ; 99 100 // --- accessors ------------------------------- 101 virtual void GetPhysicalSegments( 102 UInt32* ioSegmentCount, 103 IOByteCount outSegments[], 104 IOPhysicalAddress outAddresses[]) ; 105 virtual IOPhysicalAddress GetPhysicalSegment( 106 IOByteCount offset, 107 IOByteCount* length) ; 108 protected: 109 // --- member data ----------------------------- 110 Device& mUserClient ; 111 UserObjectHandle mKernPhysicalAddrSpaceRef ; 112 UInt32 mSize ; 113 void* mBackingStore ; 114 FWAddress mFWAddress ; 115 116 FWPhysicalSegment32 * mSegments ; 117 UInt32 mSegmentCount ; 118 } ; 119} 120