Hi,
I noticed that when I underclock GP2X F200 to under 166MHz, touch screen does not work anymore. It just stops sensing pressure on screen.
I have no idea why these two (underclocking and touch pad) are related. If somebody has an idea to explain this / how to work around it, it would be greatly appreciated.
Thank you.
The code I used to change the clock is as follows, borrowed from gmenu2x:
// set CPU clock speed - with MHz
#include <sys/mman.h>
// from gmenu2X
#define GP2X_CLK_FREQ 7372800
void setClock(unsigned mhz) {
// variables
unsigned long gp2x_mem;
unsigned short *gp2x_memregs;
volatile unsigned short *MEM_REG;
// open MEM_REG
gp2x_mem = open("/dev/mem", O_RDWR);
gp2x_memregs=(unsigned short *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_mem, 0xc0000000);
MEM_REG=&gp2x_memregs[0];
//mhz = constrain(mhz,50,maxClock);
unsigned v;
unsigned mdiv,pdiv=3,scale=0;
mhz*=1000000;
mdiv=(mhz*pdiv)/GP2X_CLK_FREQ;
mdiv=((mdiv-8)<<8) & 0xff00;
pdiv=((pdiv-2)<<2) & 0xfc;
scale&=3;
v=mdiv | pdiv | scale;
MEM_REG[0x910>>1]=v;
}
Also, the code I used to read touch screen is as follows:
fd = open( "/dev/touchscreen/wm97xx", O_RDONLY | O_NOCTTY );
SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
read(fd, &ts_event, sizeof(TS_EVENT));
...
I noticed that when I underclock GP2X F200 to under 166MHz, touch screen does not work anymore. It just stops sensing pressure on screen.
I have no idea why these two (underclocking and touch pad) are related. If somebody has an idea to explain this / how to work around it, it would be greatly appreciated.
Thank you.
The code I used to change the clock is as follows, borrowed from gmenu2x:
// set CPU clock speed - with MHz
#include <sys/mman.h>
// from gmenu2X
#define GP2X_CLK_FREQ 7372800
void setClock(unsigned mhz) {
// variables
unsigned long gp2x_mem;
unsigned short *gp2x_memregs;
volatile unsigned short *MEM_REG;
// open MEM_REG
gp2x_mem = open("/dev/mem", O_RDWR);
gp2x_memregs=(unsigned short *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_mem, 0xc0000000);
MEM_REG=&gp2x_memregs[0];
//mhz = constrain(mhz,50,maxClock);
unsigned v;
unsigned mdiv,pdiv=3,scale=0;
mhz*=1000000;
mdiv=(mhz*pdiv)/GP2X_CLK_FREQ;
mdiv=((mdiv-8)<<8) & 0xff00;
pdiv=((pdiv-2)<<2) & 0xfc;
scale&=3;
v=mdiv | pdiv | scale;
MEM_REG[0x910>>1]=v;
}
Also, the code I used to read touch screen is as follows:
fd = open( "/dev/touchscreen/wm97xx", O_RDONLY | O_NOCTTY );
SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
read(fd, &ts_event, sizeof(TS_EVENT));
...