請先看『使用說明』
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]...) |
(→The Sample code source you can download from) |
||
(13 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
+ | [[Category:AllowPages]] | ||
== The Sample code source you can download from == | == The Sample code source you can download from == | ||
- | Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/ | + | Source file: |
+ | |||
+ | <Google Drive> [https://drive.google.com/file/d/1un5UQWQCuGPBDZKTv4VOYTvk09SQzDby/view?usp=sharing vt1211hw_Src] | ||
+ | |||
+ | <FTP> [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/HardwareMonitor/vt1211hw_src.tar.gz vt1211hw_Src] | ||
+ | |||
About source code. | About source code. | ||
- | 1.We suggest using Code::Blocks as an IDE in Linux. | + | 1.Install libgtk2.0-dev first |
+ | |||
+ | 2.We suggest using Code::Blocks as an IDE in Linux. | ||
- | + | 3.Or you can just use "make" to compile the source code in the vt1211hw_src/ folder or vt1211hw_src/src/ folder. | |
- | And you can excute "vt1211hw" file in the | + | And you can excute "vt1211hw" file in the vt1211hw_src/src/ folder |
- | + | $cd vt1211hw_src | |
- | $ | + | $./configure |
$make | $make | ||
- | $ | + | $src/vt1211hw |
- | Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/ | + | If you want to execute the hardware monitor utility under user account , you can follow the procedure: |
+ | |||
+ | 1.Login by user account. | ||
+ | |||
+ | 2.go to the vt1211hw_src/src folder | ||
+ | $cd vt1211hw_src/src/ | ||
+ | |||
+ | 3.copy the vt1211hw into the ForUser folder | ||
+ | $cp vt1211hw ForUser | ||
+ | |||
+ | 4.build SetForUser | ||
+ | $gcc -o vt1211hw SetForUser.c | ||
+ | |||
+ | 5.change the file mode | ||
+ | $sudo chown root.root vt1211hw | ||
+ | $sudo chmod 4755 vt1211hw | ||
+ | |||
+ | 6.then you can execute the hardware monitor utility | ||
+ | $./vt1211hw | ||
+ | or double click vt2111hw | ||
+ | |||
+ | Binary file: | ||
+ | |||
+ | <Google Drive> [https://drive.google.com/file/d/1DqnfB95Fal86Yu4gjNXxHvH69yqfMy24/view?usp=sharing vt1211hw_Bin] | ||
+ | |||
+ | <FTP> [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/HardwareMonitor/vt1211hw_bin.tar.gz vt1211hw_Bin] | ||
== How to use the DEMO application == | == How to use the DEMO application == | ||
Line 20: | Line 53: | ||
== Sample code Introduction == | == Sample code Introduction == | ||
+ | ===Define Registry=== | ||
+ | #define VT1211A_CONFIGURATIN_INDEX_REGISTER 0x2E | ||
+ | #define VT1211A_CONFIGURATIN_INDEX_DATA 0x2F | ||
+ | #define VT1211A_CHIPSET_DEFAULT_DEVICEID 0x3C | ||
+ | #define VT1211A_CHIPSET_DEVICE_ID 0x20 | ||
+ | #define VT1211A_CHIPSET_REVISION 0x21 | ||
+ | #define VT1211A_HARDWAREMONTIOR_LDN 0x0B | ||
+ | #define VT1211A_HARDWAREMONTIOR_IOBASE 0x60 | ||
+ | #define VT1211A_VOLTAGE_CORE 0x24 | ||
+ | #define VT1211A_VOLTAGE_3V 0x23 | ||
+ | #define VT1211A_VOLTAGE_12V 0x21 | ||
+ | #define VT1211A_VOLTAGE_5V 0x22 | ||
+ | #define VT1211A_VOLTAGE_VCC 0x26 | ||
+ | #define VT1211A_TEMPERATURE_SYSTEM 0x25 | ||
+ | #define VT1211A_TEMPERATURE_CPU 0x1F | ||
+ | |||
===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; | ||
} | } | ||
Line 43: | Line 92: | ||
switch (dwOffset) | switch (dwOffset) | ||
{ | { | ||
- | case | + | case VT1211A_TEMPERATURE_SYSTEM: |
- | return | + | return VT1211A_TempTable[VT1211_ReadData(VT1211A_TEMPERATURE_SYSTEM)]; |
- | case | + | case VT1211A_TEMPERATURE_CPU: |
- | return | + | return (VT1211_ReadData(VT1211A_TEMPERATURE_CPU)-73.869)/0.9528; |
} | } | ||
- | |||
===GetVoltage=== | ===GetVoltage=== | ||
Line 55: | Line 103: | ||
{ | { | ||
case VT1211_VOLTAGE_CORE: | case VT1211_VOLTAGE_CORE: | ||
- | value = (float) | + | value = (float)VT1211_ReadData(VT1211A_VOLTAGE_CORE) -3 ; |
return (float)(value / 95.8); | return (float)(value / 95.8); | ||
+ | case VT1211A_VOLTAGE_5V: | ||
+ | value = (float)VT1211_ReadData(VT1211A_VOLTAGE_5V) -3 ; | ||
+ | return (float)(value / 95.8 /0.4167 ); | ||
case VT1211_VOLTAGE_3V: | case VT1211_VOLTAGE_3V: | ||
- | value = (float) | + | value = (float)VT1211_ReadData(VT1211A_VOLTAGE_3V) -3 ; |
return (float)(value / 95.8 /0.5952 ); | return (float)(value / 95.8 /0.5952 ); | ||
case VT1211_VOLTAGE_12V: | case VT1211_VOLTAGE_12V: | ||
- | value = (float) | + | value = (float)VT1211_ReadData(VT1211A_VOLTAGE_12V) -3 ; |
return (float)(value / 95.8 / 0.1754 ); | return (float)(value / 95.8 / 0.1754 ); | ||
case VT1211_VOLTAGE_VCC: | case VT1211_VOLTAGE_VCC: | ||
- | value = (float) | + | value = (float)VT1211_ReadData(VT1211A_VOLTAGE_VCC) -3 ; |
return (float)(value / 95.8 / 0.6296 ); | return (float)(value / 95.8 / 0.6296 ); | ||
} | } |
Current revision
Contents |
The Sample code source you can download from
Source file:
<Google Drive> vt1211hw_Src
<FTP> vt1211hw_Src
About source code. 1.Install libgtk2.0-dev first 2.We suggest using Code::Blocks as an IDE in Linux. 3.Or you can just use "make" to compile the source code in the vt1211hw_src/ folder or vt1211hw_src/src/ folder. And you can excute "vt1211hw" file in the vt1211hw_src/src/ folder $cd vt1211hw_src $./configure $make $src/vt1211hw
If you want to execute the hardware monitor utility under user account , you can follow the procedure: 1.Login by user account. 2.go to the vt1211hw_src/src folder $cd vt1211hw_src/src/ 3.copy the vt1211hw into the ForUser folder $cp vt1211hw ForUser 4.build SetForUser $gcc -o vt1211hw SetForUser.c 5.change the file mode $sudo chown root.root vt1211hw $sudo chmod 4755 vt1211hw 6.then you can execute the hardware monitor utility $./vt1211hw or double click vt2111hw
Binary file:
<Google Drive> vt1211hw_Bin
<FTP> vt1211hw_Bin
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
Define Registry
#define VT1211A_CONFIGURATIN_INDEX_REGISTER 0x2E #define VT1211A_CONFIGURATIN_INDEX_DATA 0x2F #define VT1211A_CHIPSET_DEFAULT_DEVICEID 0x3C #define VT1211A_CHIPSET_DEVICE_ID 0x20 #define VT1211A_CHIPSET_REVISION 0x21 #define VT1211A_HARDWAREMONTIOR_LDN 0x0B #define VT1211A_HARDWAREMONTIOR_IOBASE 0x60 #define VT1211A_VOLTAGE_CORE 0x24 #define VT1211A_VOLTAGE_3V 0x23 #define VT1211A_VOLTAGE_12V 0x21 #define VT1211A_VOLTAGE_5V 0x22 #define VT1211A_VOLTAGE_VCC 0x26 #define VT1211A_TEMPERATURE_SYSTEM 0x25 #define VT1211A_TEMPERATURE_CPU 0x1F
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 VT1211A_TEMPERATURE_SYSTEM: return VT1211A_TempTable[VT1211_ReadData(VT1211A_TEMPERATURE_SYSTEM)]; case VT1211A_TEMPERATURE_CPU: return (VT1211_ReadData(VT1211A_TEMPERATURE_CPU)-73.869)/0.9528; }
GetVoltage
float value ; switch (dwOffset) { case VT1211_VOLTAGE_CORE: value = (float)VT1211_ReadData(VT1211A_VOLTAGE_CORE) -3 ; return (float)(value / 95.8); case VT1211A_VOLTAGE_5V: value = (float)VT1211_ReadData(VT1211A_VOLTAGE_5V) -3 ; return (float)(value / 95.8 /0.4167 ); case VT1211_VOLTAGE_3V: value = (float)VT1211_ReadData(VT1211A_VOLTAGE_3V) -3 ; return (float)(value / 95.8 /0.5952 ); case VT1211_VOLTAGE_12V: value = (float)VT1211_ReadData(VT1211A_VOLTAGE_12V) -3 ; return (float)(value / 95.8 / 0.1754 ); case VT1211_VOLTAGE_VCC: value = (float)VT1211_ReadData(VT1211A_VOLTAGE_VCC) -3 ; return (float)(value / 95.8 / 0.6296 ); }