IO Device:81801

From LEXWiKi

(Difference between revisions)
Jump to: navigation, search
(The Sample code source you can download from)
Current revision (12:31, 25 February 2022) (edit) (undo)
 
(13 intermediate revisions not shown.)
Line 2: Line 2:
== 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/Windows_Base/81801UWDTw_src_v10.rar 81801UWDTw_src_v10.rar]
+
<Google Drive>
-
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/Windows_Base/81801UWDTw_bin_v10.rar 81801UWDTw_bin_v11.rar]
+
Source file: [https://drive.google.com/file/d/1qe-cB0fu0vSJ_OccXGu2R6JeaO_OfSd_/view?usp=sharing 81801U_WDT_v1.1W_Src_x86][https://drive.google.com/file/d/1YYOIHsOFlYSTFSIPrxwb_sHJsabbqFYa/view?usp=sharing 81801U_WDT_v1.1W_Src_x64]
 +
 
 +
Binary file: [https://drive.google.com/file/d/11vZQP8nB3xuhDy_D9vZwZu_rH8rgrusG/view?usp=sharing 81801U_WDT_v1.1W_Bin_x86][https://drive.google.com/file/d/1gbpVKHJWFC_0E8Yd9D4nkrWXyLunApJ9/view?usp=sharing 81801U_WDT_v1.1W_Bin_x64]
 +
 
 +
<FTP>
 +
 
 +
Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/Windows_Base/81801U_WDTw_src_v1.1.rar 81801U_WDT_v1.1W_Src_x86][ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/Windows_Base/81801U_WDTw_Src_v1.1(64bit).zip 81801U_WDT_v1.1W_Src_x64]
 +
 
 +
Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/Windows_Base/81801U_WDTw_bin_v1.1.rar 81801U_WDT_v1.1W_Bin_x86][ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/81801_WDT/Windows_Base/81801U_WDTw_Bin_v1.1(64bit).zip 81801U_WDT_v1.1W_Bin_x64]
== How to use the DEMO Application ==
== How to use the DEMO Application ==
Line 24: Line 32:
define LDNSET 0x07<br />
define LDNSET 0x07<br />
define WDTTDE 0x30<br />
define WDTTDE 0x30<br />
 +
define WTE 0xf0<br />
define WDTC 0xf6<br />
define WDTC 0xf6<br />
define WDTUS 0xf5<br />
define WDTUS 0xf5<br />
Line 29: Line 38:
== Enable WDT Function ==
== Enable WDT Function ==
<br />
<br />
-
void CMy81801UWDTDlg::WDTenable(int timer)
+
void CMy81801UWDTDlg::WDTenable(int timer)
-
{
+
{
DWORD dwPortVal;
DWORD dwPortVal;
DWORD dwMemVal;
DWORD dwMemVal;
Line 37: Line 46:
if (bResult)
if (bResult)
{ /*Enter configuration is write twice data 0x87 into Configuration Index Port.*/
{ /*Enter configuration is write twice data 0x87 into Configuration Index Port.*/
-
SetPortVal(INDEXPORT, ENTRYKEY,1);<br />
+
SetPortVal(INDEXPORT, ENTRYKEY,1);
-
SetPortVal(INDEXPORT, ENTRYKEY,1);<br />
+
SetPortVal(INDEXPORT, ENTRYKEY,1);
-
SetPortVal(INDEXPORT, LDNSET, 1);<br />
+
SetPortVal(INDEXPORT, LDNSET, 1);
-
SetPortVal(DATAPORT, 0x07, 1);<br />
+
SetPortVal(DATAPORT, 0x07, 1);
-
SetPortVal(INDEXPORT, WDTTDE, 1);<br />
+
SetPortVal(INDEXPORT, WDTTDE, 1);
-
SetPortVal(DATAPORT, 0x01, 1);<br />
+
SetPortVal(DATAPORT, 0x01, 1);
-
SetPortVal(INDEXPORT, WDTC, 1);<br />
+
SetPortVal(INDEXPORT, WTE, 1);//WDT timer enable register
-
SetPortVal(DATAPORT, timer, 1);//System will reboot after timer sec.<br />
+
SetPortVal(DATAPORT, 0x80, 1);
-
SetPortVal(INDEXPORT, WDTUS, 1);<br />
+
SetPortVal(INDEXPORT, WDTC, 1);
-
SetPortVal(DATAPORT, 0x31, 1);<br />
+
SetPortVal(DATAPORT, timer, 1);//System will reboot after timer sec.
-
ShutdownWinIo();}<br />
+
SetPortVal(INDEXPORT, WDTUS, 1);
 +
SetPortVal(DATAPORT, 0x31, 1);
 +
ShutdownWinIo();}
else MessageBox(NULL,TEXT("Error for WinIO init error!!"));
else MessageBox(NULL,TEXT("Error for WinIO init error!!"));
-
}
+
}
 +
 
== Disable WDT Function ==
== Disable WDT Function ==
-
void CMy81801UWDTDlg::WDTDisable(void)
+
void CMy81801UWDTDlg::WDTDisable(void)
-
{
+
{
DWORD dwPortVal;
DWORD dwPortVal;
DWORD dwMemVal;
DWORD dwMemVal;
bool bResult;
bool bResult;
-
 
+
bResult = InitializeWinIo();
bResult = InitializeWinIo();
if (bResult)
if (bResult)
{
{
-
SetPortVal(INDEXPORT, WDTUS, 1);<br />
+
SetPortVal(INDEXPORT, WDTUS, 1);<br />
-
SetPortVal(DATAPORT, 0x51, 1); <br />
+
SetPortVal(DATAPORT, 0x51, 1); <br />
-
ShutdownWinIo();<br />
+
ShutdownWinIo();<br />
}
}
else MessageBox(NULL,TEXT("Error for WinIO init error!!"));
else MessageBox(NULL,TEXT("Error for WinIO init error!!"));
-
}
+
}

Current revision

Contents

The Sample code source you can download from

<Google Drive>

Source file: 81801U_WDT_v1.1W_Src_x8681801U_WDT_v1.1W_Src_x64

Binary file: 81801U_WDT_v1.1W_Bin_x8681801U_WDT_v1.1W_Bin_x64

<FTP>

Source file: 81801U_WDT_v1.1W_Src_x8681801U_WDT_v1.1W_Src_x64

Binary file: 81801U_WDT_v1.1W_Bin_x8681801U_WDT_v1.1W_Bin_x64

How to use the DEMO Application

Image:81801WDT.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.

SDK Reference Code Introduction

Define for 81801U register,in datasheet F81801U_V0.13P.pdf page 47 and page 60,The page 60 have mistake for Index,So that need to change to

  • Configuration Register Index 00h to F0h
  • Watchdog Timer Configuration Register 1 Index 05h to F5h
  • Watchdog Timer Configuration Register 2 Index 06h to F6h

define ENTRYKEY 0x87
define INDEXPORT 0x2e
define DATAPORT 0x2f
define LDNSET 0x07
define WDTTDE 0x30
define WTE 0xf0
define WDTC 0xf6
define WDTUS 0xf5

Enable WDT Function


void CMy81801UWDTDlg::WDTenable(int timer)
{
 DWORD dwPortVal;
 DWORD dwMemVal;
 bool bResult;
 bResult = InitializeWinIo();
 if (bResult)
 {		/*Enter configuration is write twice data 0x87 into Configuration Index Port.*/
 		SetPortVal(INDEXPORT, ENTRYKEY,1); 
		SetPortVal(INDEXPORT, ENTRYKEY,1);
		SetPortVal(INDEXPORT, LDNSET,  1);
		SetPortVal(DATAPORT,  0x07,    1);
		SetPortVal(INDEXPORT, WDTTDE,  1);
		SetPortVal(DATAPORT,  0x01,    1);
                SetPortVal(INDEXPORT, WTE,     1);//WDT timer enable register
		SetPortVal(DATAPORT,  0x80,    1);
                SetPortVal(INDEXPORT, WDTC,    1);
                SetPortVal(DATAPORT,  timer,   1);//System will reboot after timer sec.
		SetPortVal(INDEXPORT, WDTUS,   1);
		SetPortVal(DATAPORT,  0x31,    1);
		ShutdownWinIo();}
 else MessageBox(NULL,TEXT("Error for WinIO init error!!"));
}

Disable WDT Function

void CMy81801UWDTDlg::WDTDisable(void)
{
 DWORD dwPortVal;
 DWORD dwMemVal;
 bool bResult;

 bResult = InitializeWinIo();
 if (bResult)
 {
		SetPortVal(INDEXPORT, WDTUS, 1);
SetPortVal(DATAPORT, 0x51, 1);
ShutdownWinIo();
} else MessageBox(NULL,TEXT("Error for WinIO init error!!")); }
Personal tools