libsmbios_c library
|
00001 // vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c: 00002 /* 00003 * Copyright (C) 2005 Dell Inc. 00004 * by Michael Brown <Michael_E_Brown@dell.com> 00005 * Licensed under the Open Software License version 2.1 00006 * 00007 * Alternatively, you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published 00009 * by the Free Software Foundation; either version 2 of the License, 00010 * or (at your option) any later version. 00011 00012 * This program is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00015 * See the GNU General Public License for more details. 00016 */ 00017 00018 00019 #ifndef ICMOSRW_H 00020 #define ICMOSRW_H 00021 00022 // compat header should always be first header 00023 #include "smbios/compat.h" 00024 00025 // types.h should be first user-defined header. 00026 #include "smbios/types.h" 00027 00028 #include "smbios/IFactory.h" 00029 #include "smbios/IException.h" 00030 00031 // abi_prefix should be last header included before declarations 00032 #include "smbios/config/abi_prefix.hpp" 00033 00034 namespace cmos 00035 { 00037 00039 // Exceptions 00040 DECLARE_EXCEPTION( CmosException ); 00041 DECLARE_EXCEPTION_EX( InvalidCmosRWMode, cmos, CmosException ); 00042 00043 // forward declarations. 00044 class ICmosRW; 00045 00046 class CmosRWFactory : public virtual factory::IFactory 00047 { 00048 public: 00049 static CmosRWFactory *getFactory(); 00050 virtual ~CmosRWFactory() throw(); 00051 virtual ICmosRW *getSingleton( ) = 0; // returns singleton 00052 virtual ICmosRW *makeNew( ) = 0; // not for use 00053 protected: 00054 CmosRWFactory(); 00055 }; 00056 00057 class ICmosRW 00058 { 00059 public: 00060 explicit ICmosRW(); 00061 virtual u8 readByte( u32 indexPort, u32 dataPort, u32 offset ) const = 0; 00062 virtual void writeByte( u32 indexPort, u32 dataPort, u32 offset, u8 byte ) const = 0; 00063 virtual ~ICmosRW(); 00064 private: 00065 ICmosRW( const ICmosRW &source ); 00066 void operator = (const ICmosRW &source ); 00067 }; 00068 00082 void readByteArray( const ICmosRW &cmos, u32 indexPort, u32 dataPort, u32 offset, u8* target, u32 count); 00096 void writeByteArray( const ICmosRW &cmos, u32 indexPort, u32 dataPort, u32 offset, const u8* source, u32 count); 00097 00098 } 00099 00100 // always should be last thing in header file 00101 #include "smbios/config/abi_suffix.hpp" 00102 00103 #endif /* ICMOSRW_H */