3 watchdog, gpio programming, Watchdog, gpio programming, Gpio sample code – Acrosser AR-B5890 User Manual
Page 16
 
AR-B5890 User Manual
16
3
WATCHDOG, GPIO PROGRAMMING
GPIO Sample Code
//=========================================================================== 
// Turbo C++ Version 3.0 Copyright(c) 1990, 1992 by Borland International,Inc. 
//=========================================================================== 
// Describe : GPIO30~GPIO37 Test utility for ITE8718F. 
// Date : 02/09/2009 
// Author : Willy 
//=========================================================================== 
 
//=========================================================================== 
// Language include files 
//=========================================================================== 
#include <conio.h> 
#include <stdio.h> 
 
//=========================================================================== 
// Normal procedure 
//=========================================================================== 
void Show_Help(); 
void Show_Fail(); 
void Show_Pass(); 
 
//=========================================================================== 
// Main procedure 
//=========================================================================== 
int main(int argc) 
{ 
 char *Model_Name="AR-B5890"; 
 unsigned char 
IO_PORT_BASE=0x2E; // DATA_PORT = IO_PORT_BASE + 1;
 unsigned short int SIMPLE_IO_BASE; 
 unsigned char data; 
 int result=0; 
 
 if ( argc >1 ) 
 { Show_Help(); return 1; } 
 
 clrscr(); 
 textcolor(WHITE); 
 gotoxy(1, 1); cprintf("<>==========================================================================<>"); 
 gotoxy(1, 2); cprintf("|| ITE8712F GPIO Test Utility v1.0 Acrosser Technology Co., Ltd. ||"); 
 gotoxy(1, 3); cprintf("<>==========================================================================<>"); 
 gotoxy(1, 4); cprintf("<>==========================================================================<>"); 
 gotoxy(1, 5); cprintf("|| Model Name : ||"); 
 gotoxy(1, 6); cprintf("|| SIO IO Base : ||"); 
 gotoxy(1, 7); cprintf("|| Simple I/O Base : ||"); 
 gotoxy(1, 8); cprintf("<>==========================================================================<>"); 
 
 // Enter ITE8712F Config 
 outportb(IO_PORT_BASE,0x87); 
 outportb(IO_PORT_BASE,0x01); 
 outportb(IO_PORT_BASE,0x55); 
 outportb(IO_PORT_BASE,0x55); 
 
 // Select Logic Device number 7 
 outportb(IO_PORT_BASE,0x07); 
 outportb(IO_PORT_BASE+1,0x07); 
 
 // Set Multi-function Pins to GPIO30~GPIO37 
 outportb(IO_PORT_BASE,0x27); 
 outportb(IO_PORT_BASE+1,0xFF); 
 
 // GPIO30~GPIO37 Used Simple I/O Finction 
 outportb(IO_PORT_BASE,0xC2); 
 outportb(IO_PORT_BASE+1,0xFF);