00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #define LIBSMBIOS_SOURCE
00021 #include "smbios/compat.h"
00022
00023 #include <sys/io.h>
00024
00025 #include "CmosRWImpl.h"
00026
00027 using namespace std;
00028
00029 namespace cmos
00030 {
00031
00032
00033
00034
00035
00036
00037 CmosRWIo::CmosRWIo ()
00038 : ICmosRW(), Suppressable()
00039 {}
00040
00041
00042 CmosRWIo::CmosRWIo (const CmosRWIo &)
00043 : ICmosRW(), Suppressable()
00044 {}
00045
00046
00047 CmosRWIo & CmosRWIo::operator = (const CmosRWIo &)
00048 {
00049 return *this;
00050 }
00051
00052
00053
00054 u8 CmosRWIo::readByte (u32 indexPort, u32 dataPort, u32 offset) const
00055 {
00056 if(iopl(3) < 0)
00057 throw smbios::InternalErrorImpl("iopl() failed. probably not root.");
00058 outb_p (offset, indexPort);
00059 return (inb_p (dataPort));
00060 }
00061
00062
00063
00064 void CmosRWIo::writeByte (u32 indexPort, u32 dataPort, u32 offset, u8 byte) const
00065 {
00066 if(iopl(3) < 0)
00067 throw smbios::InternalErrorImpl("iopl() failed. probably not root.");
00068 outb_p (offset, indexPort);
00069 outb_p (byte, dataPort);
00070
00071 if(! isNotifySuppressed() )
00072 {
00073
00074
00075
00076 notify();
00077 }
00078 }
00079
00080 }