請先看『使用說明』
IO Device:81801 Linux
From LEXWiKi
(Difference between revisions)
(4 intermediate revisions not shown.) | |||
Line 4: | Line 4: | ||
== 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/81801_WDT/ | + | <Google Drive> |
- | Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/ | + | |
+ | Source file: [https://drive.google.com/file/d/1GfdFnygoVoOAV_wlWl45rydEx-pBSf2A/view?usp=sharing 81801U_WDT_v1.0L_Src] | ||
+ | |||
+ | Binary file: [https://drive.google.com/file/d/1GBgPVN66Tei4RvQByAnp-OPn2eb3sgwD/view?usp=sharing 81801U_WDT_v1.0L_Bin] | ||
+ | |||
+ | <FTP> | ||
+ | |||
+ | Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/linux_Base/81801UWDT_v1.0_src.tar.gz 81801U_WDT_v1.0L_Src] | ||
+ | |||
+ | Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/linux_Base/81801UWDT_v1.0_bin.tar.gz 81801U_WDT_v1.0L_Bin] | ||
== How to compile source code == | == How to compile source code == | ||
Line 23: | Line 32: | ||
== How to use the DEMO Application == | == How to use the DEMO Application == | ||
- | + | [[Image:81801WDT_linux.jpg]] | |
*'''Step 1:Key-in the 1~255 value in Red number 1.'''<br /> | *'''Step 1:Key-in the 1~255 value in Red number 1.'''<br /> | ||
*'''Step 2:Press the "WDT Enable" button in Red number 2,the system will reboot after step 1 you key-in Sec.'''<br /> | *'''Step 2:Press the "WDT Enable" button in Red number 2,the system will reboot after step 1 you key-in Sec.'''<br /> | ||
*'''Step 3:Press the "WDT Disable" button in Red number 3,It will stop WDT function.'''<br /> | *'''Step 3:Press the "WDT Disable" button in Red number 3,It will stop WDT function.'''<br /> | ||
So you can make the loop with Enable and Disable to protection your system when crash.<br /> | So you can make the loop with Enable and Disable to protection your system when crash.<br /> | ||
+ | |||
+ | |||
+ | == Enable WDT function == | ||
+ | |||
+ | void enable() | ||
+ | { | ||
+ | outb(EntryKey,IndexPort); | ||
+ | outb(EntryKey,IndexPort); | ||
+ | outb(LDNSET,IndexPort); | ||
+ | outb(0x07,DataPort); //Select WDT device configuration registers. | ||
+ | outb(WDTDE,IndexPort); | ||
+ | outb(0x01,DataPort); //Set WDT "Device" Enable | ||
+ | outb(WDTEnable,IndexPort); //WDT "timer" enable register | ||
+ | outb(0x80,DataPort); //Set watchdog timer enable | ||
+ | outb(WDTCount,IndexPort); | ||
+ | outb(0x05,DataPort); //System will reboot after timer sec. | ||
+ | outb(WDTUS,IndexPort); | ||
+ | outb(0x31,DataPort); //Set WDTRST output mode: Pulse(width: 25ms) | ||
+ | } | ||
+ | == Disable WDT function == | ||
+ | void disable() | ||
+ | { | ||
+ | outb(WDTUS,IndexPort); | ||
+ | outb(0x51,DataPort); | ||
+ | } |
Current revision
Contents |
The Sample code source you can download from
<Google Drive>
Source file: 81801U_WDT_v1.0L_Src
Binary file: 81801U_WDT_v1.0L_Bin
<FTP>
Source file: 81801U_WDT_v1.0L_Src
Binary file: 81801U_WDT_v1.0L_Bin
How to compile source code
1. Compile source code with Code::Blocks
- download and install the Code::Block and libgtk2.0-dev with command "apt-get install codeblocks libgtk2.0-dev"
- Open an exist project(lanbypass.cbp) in Code::Blocks
- add an option `pkg-config gtk+-2.0 --cflags`-std=gnu99 in "Project->Build Option->compiler setting->Other option"
- add an option `pkg-config gtk+-2.0 --libs` in "Project->Build Option->Linker Setting->Other linker option"
- click the compile button
2.Compile source code with "make"
- download and install the libgtk2.0-dev with command "apt-get install libgtk2.0-dev"
- cd lanbypass
- ./configure
- make
- cd src/lanbypass // execute the binary file()
How to use the DEMO Application
- Step 1:Key-in the 1~255 value in Red number 1.
- Step 2:Press the "WDT Enable" button in Red number 2,the system will reboot after step 1 you key-in Sec.
- Step 3:Press the "WDT Disable" button in Red number 3,It will stop WDT function.
So you can make the loop with Enable and Disable to protection your system when crash.
Enable WDT function
void enable() { outb(EntryKey,IndexPort); outb(EntryKey,IndexPort); outb(LDNSET,IndexPort); outb(0x07,DataPort); //Select WDT device configuration registers. outb(WDTDE,IndexPort); outb(0x01,DataPort); //Set WDT "Device" Enable outb(WDTEnable,IndexPort); //WDT "timer" enable register outb(0x80,DataPort); //Set watchdog timer enable outb(WDTCount,IndexPort); outb(0x05,DataPort); //System will reboot after timer sec. outb(WDTUS,IndexPort); outb(0x31,DataPort); //Set WDTRST output mode: Pulse(width: 25ms) }
Disable WDT function
void disable() { outb(WDTUS,IndexPort); outb(0x51,DataPort); }