Hardyx said:
Geca said:
I take a look at u-boot 1.1.6 to find the source from the settings panel where the serial is displayed, but i can't find the resource...
uboot is the OS loader program, you must to look at the firmware/menu source, if available.
Geca said:
Can you make a example to read one of these registers using pollux ? Thanks..
Is a bit complex, but you can see the libcastor initialization source code for reading hardware registers.
You must open the Linux "/dev/mem" device and access the locations of the registers to read the values.
If you know old BASIC language is like using instruction PEEK to read the memory.
You have an example for reading (other) registers in the wiki:
http://wiki.gp2x.org/wiki/Setting_the_8_bit_palette_from_Linux
From gmenu2x:
GMenu2X::GMenu2X(int argc, char *argv[]) {
//Detect firmware version and type
if (fileExists("/etc/open2x")) {
fwType = "open2x";
fwVersion = "";
} else {
fwType = "gph";
fwVersion = "";
void GMenu2X::gp2x_init() {
#ifdef TARGET_GP2X
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];
batteryHandle = open(f200 ? "/dev/mmsp2adc" : "/dev/batt", O_RDONLY);
if (f200) {
//if wm97xx fails to open, set f200 to false to prevent any further access to the touchscreen
f200 = ts.init();
}
#endif
#ifdef TARGET_WIZ
/* open /dev/mem to access registers */
wiz_mem = open("/dev/mem", O_RDWR);
if (wiz_mem < 0) {
printf("Could not open /dev/mem!\n");
}
/* get access to the registers */
else {
wiz_memregs = (volatile uint32_t*)mmap(0, 0x20000, PROT_READ|PROT_WRITE, MAP_SHARED, wiz_mem, 0xC0000000);
if(wiz_memregs == (volatile uint32_t*)0xFFFFFFFF) {
printf("Could not mmap hardware registers!\n");
close(wiz_mem);
}
}
/* get access to battery device */
batteryHandle = open("/dev/pollux_batt", O_RDONLY);
printf( "System Init Done!\n" );
#endif