Q
quasist
Guest
Since me is lacking the system programming skills I copy-paste some code from very popular tweaking untility.
Here is final version of code that is easy to add to program.
As far it works nicely.
But It will be good if some pro-gp2x-linux-coder would look through for some bug... and saving the innocent users
CODE
#ifdef GP2X
#include "sys/mman.h"
#include "fcntl.h"
volatile unsigned short *MEM_REG;
unsigned long gp2x_dev=0;
void RamHack(void)//I't me! RamHack!
{
gp2x_dev = open("/dev/mem", O_RDWR);
MEM_REG=(unsigned short *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_dev, 0xc0000000);
unsigned short v,timing;
//tRC
timing=5;
v = (unsigned short)(MEM_REG[0x3804>>1] & (~(0xF << 8)));
MEM_REG[0x3804>>1] = ((timing & 0xF) << 8) | v;
//tRAS
timing=3;
v = (unsigned short)(MEM_REG[0x3804>>1] & (~(0xF << 4)));
MEM_REG[0x3804>>1] = ((timing & 0xF) << 4) | v;
//tWR
timing=0;
v = (unsigned short)(MEM_REG[0x3804>>1] & (~(0xF)));
MEM_REG[0x3804>>1] = (timing & 0xF) | v;
//tMRD
timing=0;
v = (unsigned short)(MEM_REG[0x3802>>1] & (~(0xF << 12)));
MEM_REG[0x3802>>1] = ((timing & 0xF) << 12) | v;
//tRFC
timing=0;
v = (unsigned short)(MEM_REG[0x3802>>1] & (~(0xF << 8)));
MEM_REG[0x3802>>1] = ((timing & 0xF) << 8) | v;
//tRP
timing=1;
v = (unsigned short)(MEM_REG[0x3802>>1] & (~(0xF << 4)));
MEM_REG[0x3802>>1] = ((timing & 0xF) << 4) | v;
//tRCD
timing=1;
v = (unsigned short)(MEM_REG[0x3802>>1] & (~(0xF)));
MEM_REG[0x3802>>1] = (timing & 0xF) | v;
close(gp2x_dev);
}
#endif
Here is final version of code that is easy to add to program.
As far it works nicely.
But It will be good if some pro-gp2x-linux-coder would look through for some bug... and saving the innocent users
CODE
#ifdef GP2X
#include "sys/mman.h"
#include "fcntl.h"
volatile unsigned short *MEM_REG;
unsigned long gp2x_dev=0;
void RamHack(void)//I't me! RamHack!
{
gp2x_dev = open("/dev/mem", O_RDWR);
MEM_REG=(unsigned short *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_dev, 0xc0000000);
unsigned short v,timing;
//tRC
timing=5;
v = (unsigned short)(MEM_REG[0x3804>>1] & (~(0xF << 8)));
MEM_REG[0x3804>>1] = ((timing & 0xF) << 8) | v;
//tRAS
timing=3;
v = (unsigned short)(MEM_REG[0x3804>>1] & (~(0xF << 4)));
MEM_REG[0x3804>>1] = ((timing & 0xF) << 4) | v;
//tWR
timing=0;
v = (unsigned short)(MEM_REG[0x3804>>1] & (~(0xF)));
MEM_REG[0x3804>>1] = (timing & 0xF) | v;
//tMRD
timing=0;
v = (unsigned short)(MEM_REG[0x3802>>1] & (~(0xF << 12)));
MEM_REG[0x3802>>1] = ((timing & 0xF) << 12) | v;
//tRFC
timing=0;
v = (unsigned short)(MEM_REG[0x3802>>1] & (~(0xF << 8)));
MEM_REG[0x3802>>1] = ((timing & 0xF) << 8) | v;
//tRP
timing=1;
v = (unsigned short)(MEM_REG[0x3802>>1] & (~(0xF << 4)));
MEM_REG[0x3802>>1] = ((timing & 0xF) << 4) | v;
//tRCD
timing=1;
v = (unsigned short)(MEM_REG[0x3802>>1] & (~(0xF)));
MEM_REG[0x3802>>1] = (timing & 0xF) | v;
close(gp2x_dev);
}
#endif