IO Device:81801 Linux

From LEXWiKi

Jump to: navigation, search


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

  1. download and install the Code::Block and libgtk2.0-dev with command "apt-get install codeblocks libgtk2.0-dev"
  2. Open an exist project(lanbypass.cbp) in Code::Blocks
  3. add an option `pkg-config gtk+-2.0 --cflags`-std=gnu99 in "Project->Build Option->compiler setting->Other option"
  4. add an option `pkg-config gtk+-2.0 --libs` in "Project->Build Option->Linker Setting->Other linker option"
  5. click the compile button

2.Compile source code with "make"

  1. download and install the libgtk2.0-dev with command "apt-get install libgtk2.0-dev"
  2. cd lanbypass
  3. ./configure
  4. make
  5. cd src/lanbypass // execute the binary file()

How to use the DEMO Application

Image:81801WDT_linux.jpg

  • 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);
}
Personal tools