// This file is written/copyright 2004 Mirko Roller
#include "gp32.h"
void gp_ButtonInit() {
rPBCON=0x0; // Init, all Input
//rPECON=0x0;
}
u16 gp_ButtonResult() {
u16 back=0;
u32 pressedb = ((~rPBDAT >> 8) & 0xFF);
u32 pressedc = ((~rPEDAT >> 6) & 0x3 ); // Bit 6&7 // 1=start 2=select
back = (pressedc<<8)|(pressedb<<0);
return back;
}
#define rPBCON (*(volatile unsigned *)0x15600008)
#define rPBDAT (*(volatile unsigned *)0x1560000c)
#define rPBUP (*(volatile unsigned *)0x15600010)
#define BLEFT 1
#define BDOWN 2
#define BRIGHT 4
#define BUP 8
#define BL 16
#define BB 32
#define BA 64
#define BR 128
#define BSTART 256
#define BSELECT 512
#define rPECON (*(volatile unsigned *)0x1560002c)
#define rPEDAT (*(volatile unsigned *)0x15600030)
#define rPEUP (*(volatile unsigned *)0x15600034)
void main(){
ButtonInit();
while (gp_ButtonResult()&BUP);
}
I think, integrating it into the kernel is a good idea, seeing as everyone who's going to use GP32Linux is bound to have a gp32, everyone has the required hardware: The D-Pad.now i must build a module for the mouse or integrate the driver into the kernel directly
in your opinion what is the best solution?
PORTE (or whatever it was for SELECT & START keys) can generate an interrupt. They are not enabled by the BIOS so one has to fiddle a bit around.It doesn't use the interrupt, as far as I know, the keys arn't wired up to any interrupts, I should check the datasheet though.