請先看『使用說明』
VT1211(VIA CX700/VIA CN700) Hardware Monitor under Linux
From LEXWiKi
(Difference between revisions)
(New page: == The Sample code source you can download from == Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/LCM_release/Linux_base/LCMctl_v2.2L_Src.tar.gz LCMctl_v2.2L_Src.tar.gz]...) |
(→Open VT1211) |
||
Line 21: | Line 21: | ||
== Sample code Introduction == | == Sample code Introduction == | ||
===Open VT1211=== | ===Open VT1211=== | ||
- | outb(0x87, | + | outb(0x87,VT1211A_CONFIGURATIN_INDEX_REGISTER); |
- | outb(0x87, | + | outb(0x87,VT1211A_CONFIGURATIN_INDEX_REGISTER); |
- | if ((VT1211_Read( | + | if ((VT1211_Read(VT1211A_CHIPSET_DEVICE_ID) == VT1211A_CHIPSET_DEFAULT_DEVICEID) ) |
{ | { | ||
VT1211_Write(0x07,VT1211_HARDWAREMONTIOR_LDN); | VT1211_Write(0x07,VT1211_HARDWAREMONTIOR_LDN); | ||
- | m_HardwareMonitor_IOBase = ( VT1211_Read ( | + | m_HardwareMonitor_IOBase = ( VT1211_Read (VT1211A_HARDWAREMONTIOR_IOBASE) << 8 ) | VT1211_Read (VT1211A_HARDWAREMONTIOR_IOBASE+1); |
return TRUE; | return TRUE; | ||
} | } |
Revision as of 18:03, 6 July 2011
Contents |
The Sample code source you can download from
Source file: LCMctl_v2.2L_Src.tar.gz
About source code. 1.We suggest using Code::Blocks as an IDE in Linux. 2.Or you can just use "make" to compile the source code in the vt1211hw/ folder or vt1211hw/src/ folder. And you can excute "vt1211hw" file in the LCMctlv22LSrc/src/ folder $cd vt1211hw/src/ $make $./vt1211hw
Binary file: LCMctl_v2.2L_Bin.tar.gz
How to use the DEMO application
- Press the "Read Value" button , and then you can find the values in the below text boxes.
Sample code Introduction
Open VT1211
outb(0x87,VT1211A_CONFIGURATIN_INDEX_REGISTER); outb(0x87,VT1211A_CONFIGURATIN_INDEX_REGISTER); if ((VT1211_Read(VT1211A_CHIPSET_DEVICE_ID) == VT1211A_CHIPSET_DEFAULT_DEVICEID) ) { VT1211_Write(0x07,VT1211_HARDWAREMONTIOR_LDN); m_HardwareMonitor_IOBase = ( VT1211_Read (VT1211A_HARDWAREMONTIOR_IOBASE) << 8 ) | VT1211_Read (VT1211A_HARDWAREMONTIOR_IOBASE+1); return TRUE; } else return FALSE; return FALSE; }
Read Data
DWORD dwPortVal; dwPortVal = inb((WORD)(m_HardwareMonitor_IOBase + dwOffset)); return ( dwPortVal & 0x00FF);
GetTemperature
switch (dwOffset) { case VT1211_TEMPERATURE_SYSTEM: return VT1211_TempTable[VT1211_ReadDate(VT1211_TEMPERATURE_SYSTEM)]; case VT1211_TEMPERATURE_CPU: return VT1211_TempTable[VT1211_ReadDate(VT1211_TEMPERATURE_CPU)]; }
GetVoltage
float value ; switch (dwOffset) { case VT1211_VOLTAGE_CORE: value = (float)VT1211_ReadDate(VT1211_VOLTAGE_CORE) -3 ; return (float)(value / 95.8); case VT1211_VOLTAGE_3V: value = (float)VT1211_ReadDate(VT1211_VOLTAGE_3V) -3 ; return (float)(value / 95.8 /0.5952 ); case VT1211_VOLTAGE_12V: value = (float)VT1211_ReadDate(VT1211_VOLTAGE_12V) -3 ; return (float)(value / 95.8 / 0.1754 ); case VT1211_VOLTAGE_VCC: value = (float)VT1211_ReadDate(VT1211_VOLTAGE_VCC) -3 ; return (float)(value / 95.8 / 0.6296 ); }