1/* 2 * Copyright (c) 1998-2001 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#ifndef _IOKIT_IOFIREWIREAVCPROTOCOLUSERCLIENT_H 24#define _IOKIT_IOFIREWIREAVCPROTOCOLUSERCLIENT_H 25 26#include <IOKit/IOUserClient.h> 27#include <IOKit/firewire/IOFWAddressSpace.h> 28#include <IOKit/avc/IOFireWireAVCUserClientCommon.h> 29#include <IOKit/avc/IOFireWireAVCTargetSpace.h> 30 31//#include <IOKit/firewire/IOFireWireController.h> 32class IOFireWireNub; 33class IOFireWirePCRSpace; 34class IOFireWireAVCTargetSpace; 35 36class IOFireWireAVCProtocolUserClient : public IOUserClient 37{ 38 OSDeclareDefaultStructors(IOFireWireAVCProtocolUserClient) 39 40protected: 41 task_t fTask; 42 bool fStarted; 43 IOFireWireNub * fDevice; 44 IOFireWireBus * fBus; 45 IOFireWirePCRSpace * fPCRSpace; 46 IOFireWireAVCTargetSpace * fAVCTargetSpace; 47 OSSet * fInputPlugs; 48 OSSet * fOutputPlugs; 49 50 static void forwardPlugWrite(void *refcon, UInt16 nodeID, UInt32 plug, UInt32 oldVal, UInt32 newVal); 51 52 static void avcTargetCommandHandler(const AVCCommandHandlerInfo *pCmdInfo, 53 UInt32 generation, 54 UInt16 nodeID, 55 const void *command, 56 UInt32 cmdLen, 57 IOFWSpeed &speed, 58 UInt32 handlerSearchIndex); 59 60 static void avcSubunitPlugHandler(const AVCSubunitInfo *pSubunitInfo, 61 IOFWAVCSubunitPlugMessages plugMessage, 62 IOFWAVCPlugTypes plugType, 63 UInt32 plugNum, 64 UInt32 messageParams, 65 UInt32 generation, 66 UInt16 nodeID); 67 68 virtual IOReturn sendAVCResponse(UInt32 generation, UInt16 nodeID, const char *buffer, UInt32 size); 69 virtual IOReturn allocateInputPlug(io_user_reference_t *asyncRef, uint64_t userRefcon, uint64_t *plug); 70 virtual IOReturn freeInputPlug(UInt32 plug); 71 virtual IOReturn readInputPlug(UInt32 plug, uint64_t *val); 72 virtual IOReturn updateInputPlug(UInt32 plug, UInt32 oldVal, UInt32 newVal); 73 virtual IOReturn allocateOutputPlug(io_user_reference_t *asyncRef, uint64_t userRefcon, uint64_t *plug); 74 virtual IOReturn freeOutputPlug(UInt32 plug); 75 virtual IOReturn readOutputPlug(UInt32 plug, uint64_t *val); 76 virtual IOReturn updateOutputPlug(UInt32 plug, UInt32 oldVal, UInt32 newVal); 77 virtual IOReturn readOutputMasterPlug(uint64_t *val); 78 virtual IOReturn updateOutputMasterPlug(UInt32 oldVal, UInt32 newVal); 79 virtual IOReturn readInputMasterPlug(uint64_t *val); 80 virtual IOReturn updateInputMasterPlug(UInt32 oldVal, UInt32 newVal); 81 virtual IOReturn publishAVCUnitDirectory(void); 82 virtual IOReturn installAVCCommandHandler(io_user_reference_t *asyncRef, uint64_t subUnitTypeAndID, uint64_t opCode, uint64_t callback, uint64_t refCon); 83 virtual IOReturn addSubunit(io_user_reference_t *asyncRef, 84 uint64_t subunitType, 85 uint64_t numSourcePlugs, 86 uint64_t numDestPlugs, 87 uint64_t callBack, 88 uint64_t refCon, 89 uint64_t *subUnitTypeAndID); 90 virtual IOReturn setSubunitPlugSignalFormat(UInt32 subunitTypeAndID, 91 IOFWAVCPlugTypes plugType, 92 UInt32 plugNum, 93 UInt32 signalFormat); 94 95 virtual IOReturn getSubunitPlugSignalFormat(UInt32 subunitTypeAndID, 96 IOFWAVCPlugTypes plugType, 97 UInt32 plugNum, 98 uint64_t *pSignalFormat); 99 100 virtual IOReturn connectTargetPlugs(AVCConnectTargetPlugsInParams *inParams, 101 AVCConnectTargetPlugsOutParams *outParams); 102 103 virtual IOReturn disconnectTargetPlugs(UInt32 sourceSubunitTypeAndID, 104 IOFWAVCPlugTypes sourcePlugType, 105 UInt32 sourcePlugNum, 106 UInt32 destSubunitTypeAndID, 107 IOFWAVCPlugTypes destPlugType, 108 UInt32 destPlugNum); 109 110 virtual IOReturn getTargetPlugConnection(AVCGetTargetPlugConnectionInParams *inParams, 111 AVCGetTargetPlugConnectionOutParams *outParams); 112 113 virtual IOReturn AVCRequestNotHandled(UInt32 generation, 114 UInt16 nodeID, 115 IOFWSpeed speed, 116 UInt32 handlerSearchIndex, 117 const char *pCmdBuf, 118 UInt32 cmdLen); 119 120 virtual IOReturn externalMethod( uint32_t selector, 121 IOExternalMethodArguments * arguments, 122 IOExternalMethodDispatch * dispatch, 123 OSObject * target, 124 void * reference); 125 126 virtual void free(); 127 128public: 129 virtual bool start( IOService * provider ); 130 virtual IOReturn newUserClient( task_t owningTask, void * securityID, 131 UInt32 type, OSDictionary * properties, 132 IOUserClient ** handler ); 133 virtual IOReturn clientClose( void ); 134 virtual IOReturn clientDied( void ); 135 136 // Make it easy to find 137 virtual bool matchPropertyTable(OSDictionary * table); 138 139}; 140 141#endif // _IOKIT_IOFIREWIREAVCPROTOCOLUSERCLIENT_H 142 143