Chapter 13 factory default information – IBASE FWA8206 User Manual

Page 31

Advertising
background image

Chapter 13

Factory Default Information

We offer a Factory Default Setting function for more flexibility.
The programmer could design a function such as loading the software default setting. It will
restore the software default setting after the user presses the Factory Default button.
The following is the example code for the Factory Default Setting function.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>

#include <asm/io.h> /* linux-specific */


#ifdef __GLIBC__
# include <sys/perm.h>
#endif


int fd_polling ( void ) {

unsigned int i=0;

//Enter Extended Function Mode
outb(0x87,0x4e);
outb(0x87,0x4e);

//Select logic device 7
outb(0x7,0x4e);
outb(0x7,0x4f);

//Assign GPIO1 (GP15)
outb(0x2a,0x4e);
i = inb(0x4f);
i |= 0x82;
outb(0x2a,0x4e);
outb(i,0x4f);

//Active logic device 7
outb(0x30,0x4e);
outb(0x1,0x4f);

//Select I/O mode
//Configure GP15 as an input port.
outb(0xf0,0x4e);
i = inb(0x4f);
i &= 0xff;
i |= 0x20;
outb(i,0x4f);

//Select inversion mode
outb(0xf2,0x4e);
i = inb(0x4f);

Advertising