beautypg.com

Chapter 14 gpo led information – IBASE FWA8206 User Manual

Page 33

background image

FWA8206 Series User’s Manual

2

Chapter 14

GPO LED Information

The following is an example code for the GPO LED function.

#include
#include
#include
#include
#include
#include
#include
#include
#include

#include /* linux-specific */


#ifdef __GLIBC__
# include
#endif


void gpo_onoff ( unsigned int pos , int flag ) {


unsigned int led,i=0;

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

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

//Assign pin121-128 bit(7...2) to be 1
outb(0x2f,0x4e);
i = inb(0x4f);
i |= 0xfc;
outb(0x2f,0x4e);
outb(i,0x4f);

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

//Select I/O mode
outb(0xf0,0x4e);
i = inb(0x4f);
i &= 0x3;
outb(0xf0,0x4e);
outb(i,0x4f);

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