FWA8206 Series User’s Manual
32
Chapter 14 GPO LED Information
The following is an example code for the GPO LED 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
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);