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#include "IOFireWireSBP2Diagnostics.h" 24 25OSDefineMetaClassAndStructors(IOFireWireSBP2Diagnostics, OSObject) 26 27OSObject * IOFireWireSBP2Diagnostics::createDiagnostics( void ) 28{ 29 IOFireWireSBP2Diagnostics * diagnostics; 30 31 diagnostics = new IOFireWireSBP2Diagnostics; 32 if( diagnostics && !diagnostics->init() ) 33 { 34 diagnostics->release(); 35 diagnostics = NULL; 36 } 37 38 return diagnostics; 39} 40 41bool IOFireWireSBP2Diagnostics::serialize( OSSerialize * s ) const 42{ 43 OSDictionary * dictionary; 44 bool ok; 45 46 dictionary = OSDictionary::withCapacity( 4 ); 47 if( !dictionary ) 48 return false; 49 50 ///////// 51 52 updateNumberEntry( dictionary, fExecutedORBCount, "Executed ORB Count" ); 53 54 ///////// 55 56 ok = dictionary->serialize(s); 57 dictionary->release(); 58 59 return ok; 60} 61 62void IOFireWireSBP2Diagnostics::updateNumberEntry( OSDictionary * dictionary, UInt32 value, const char * name ) 63{ 64 OSNumber * number; 65 66 number = OSNumber::withNumber( value, 32 ); 67 if( !number ) 68 return; 69 70 dictionary->setObject( name, number ); 71 number->release(); 72} 73 74/////////////////////////// 75 76void IOFireWireSBP2Diagnostics::incrementExecutedORBCount( void ) 77{ 78 fExecutedORBCount++; 79} 80 81 82