Posted by Roastbeef on 04-02-2000 00:18:46 A.M.
/*
* leds.c - Example app to play with i-opener LEDs
* Released to the Public Domain
* - Roastbeef 04/01/2000
*/
#include "stdio.h"
#include "stdlib.h"
main()
{
char c;
int byebye=0;
printf("LEDS - Toggle those i-Opener lights");
printf("by Roastbeef");
printf("Press '1' to toggle the email LED");
printf("Press '2' to toggle the phone LED");
printf("Any other key exits.");
while (!byebye) {
if (kbhit()) {
switch(getch()) {
case '1':
c=inp(0x404C);
c=c^0x01;
outp(0x404C,c);
break;
case '2':
c=inp(0x404C);
c=c^0x02;
outp(0x404C,c);
break;
default:
byebye=1;
}
}
}
}
Posted by Roastbeef on 04-01-2000 05:26:44 P.M.
Let me tell you how to control those lovely LEDs at the top of your unit:
The short story: I/O port x'404C', bit 0 controls the Mail LED, bit 1 controls the Telephone LED. Inverse logic (i.e. bit=0 turns the LED on, bit=1 turns the LED off) Note that there are other important things being controlled by this register. Read/Modify bits 0&1/Write... don't trash the other bits or your machine *WILL* hang.
The long story: Find the Via686 ACPI device (bus 0, device 0, function 4, should be vendor=1106 device=3057). At offset x'48' in PCI config space is the Power Management I/O base address (DWORD). Read the value, AND off the lower 7 bits. This is the base address. The GPIO control is at offset x'4C' from this base address.
Ta da!
--Roastbeef
Posted by Roastbeef on 04-02-2000 03:37:30 P.M.
I've just discovered where the base address is programmed in the BIOS. It's hard coded... so nothing you add to the system should change the 404C address. Sweet!
--Roastbeef