請先看『使用說明』
IO Device:SI852DIO
From LEXWiKi
(Difference between revisions)
(→The Sample code introduction) |
(→The Sample code source you can download from) |
||
(6 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
[[Category:AllowPages]] | [[Category:AllowPages]] | ||
- | == | + | == Introduction == |
+ | === Define Pin Address === | ||
+ | #define WDT_ENABLE 0x600 | ||
+ | #define WDT_DISABLE 0x604 | ||
+ | #define DO 0x60C | ||
+ | #define DI 0x608 | ||
- | + | === Set the I/O privilege level === | |
+ | iopl( 3 ); //iopl() changes the I/O privilege level of the current process , level 3 can read/write to i/o port | ||
- | == | + | === Set DO === |
- | + | DO: | |
+ | outb( 1 , DO ); //write data:1 to DO | ||
- | == | + | === Read DI/DO === |
- | + | DO: inb ( DO ); //read DO data | |
- | + | DI: inb ( DI ); //read DI data | |
- | + | ||
- | + | === Enable/Disable WDT === | |
- | + | Enable : outb ( 1 , WDT_ENABLE ); //set 1 sec to WDT enable port, system will reboot after 1 second | |
- | + | Disable: outb ( 1 , WDT_DISABLE ); //set 1 sec to WDT disable port , the disable signal will break off WDT enable signle | |
- | + | ||
- | + | ||
- | + | == The Sample code source you can download from == | |
- | + | ||
- | + | <Google Drive> | |
- | + | ||
- | + | Source file: [https://drive.google.com/file/d/1Hod5GN6grnyVUfTEtK4HO9ll0p1aTInq/view?usp=sharing 852_DIO_WDT_v2.1L_Src] | |
- | + | ||
- | + | Binary file: [https://drive.google.com/file/d/1gGLGNJ3bXMEme9QECqL7wyCCBOZqQ0TY/view?usp=sharing 852_DIO_WDT_v2.1L_Bin] | |
- | + | ||
- | + | <FTP> | |
- | // | + | |
- | + | Source file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/852_DIO_Sample_Linux/852_dio_wdt_v2.1L_Src.tar.gz 852_DIO_WDT_v2.1L_Src] | |
- | + | ||
- | + | Binary file: [ftp://ftp.lex.com.tw/Engineer/SoftSupport/AP_Module/852_DIO_Sample_Linux/852_dio_wdt_v2.1L_Bin.tar.gz 852_DIO_WDT_v2.1L_Bin] | |
- | + | ||
- | + | == How to use this Demo Application == | |
- | + | ||
- | // | + | 1. Press the "Start" button to test DIO function |
- | + | ||
- | + | 2. Press the "Enable" button to test WDT function | |
- | + | ||
- | + | 3. Press the "Disable" button when WDT enable to disable WDT | |
- | + | ||
- | + | [[Image:852_dio.jpg]] | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + |
Current revision
Contents |
Introduction
Define Pin Address
#define WDT_ENABLE 0x600 #define WDT_DISABLE 0x604 #define DO 0x60C #define DI 0x608
Set the I/O privilege level
iopl( 3 ); //iopl() changes the I/O privilege level of the current process , level 3 can read/write to i/o port
Set DO
DO: outb( 1 , DO ); //write data:1 to DO
Read DI/DO
DO: inb ( DO ); //read DO data DI: inb ( DI ); //read DI data
Enable/Disable WDT
Enable : outb ( 1 , WDT_ENABLE ); //set 1 sec to WDT enable port, system will reboot after 1 second Disable: outb ( 1 , WDT_DISABLE ); //set 1 sec to WDT disable port , the disable signal will break off WDT enable signle
The Sample code source you can download from
<Google Drive>
Source file: 852_DIO_WDT_v2.1L_Src
Binary file: 852_DIO_WDT_v2.1L_Bin
<FTP>
Source file: 852_DIO_WDT_v2.1L_Src
Binary file: 852_DIO_WDT_v2.1L_Bin
How to use this Demo Application
1. Press the "Start" button to test DIO function
2. Press the "Enable" button to test WDT function
3. Press the "Disable" button when WDT enable to disable WDT