Overclock in WIZ

Previous topic - Next topic

mentalthink

HI there.

Can be implement a command for make o.c to WIZ, how make the Mame emulator?Ã,¿.

Thanks.
Best Regards.
mentalthink

PS:If this is viable to implement in GLbasic, I think what this command will have a limit for O.C.

Kitty Hello

Code (glbasic) Select


INLINE
#ifdef GP2X_WIZ
extern "C"
{
typedef long off_t;
typedef long mode_t;
typedef long size_t;
int open(const char *path, int flags, ...);
void *mmap(void *addr, size_t LEN, int prot, int flags,     int fildes, off_t off);
}
#define MAP_SHARED 0x01
#define O_RDWR 0x02
#define PROT_READ 0x01
#define PROT_WRITE 0x02
#define SYS_CLK_FREQ 27

#define PLLSETREG0 (memregs32[0xF004>>2])
#define PWRMODE (memregs32[0xF07C>>2])

#endif

ENDINLINE

FUNCTION SetWizClock%: MHZ%
INLINE
#ifdef GP2X_WIZ
volatile unsigned int *memregs32;

int speed = 1000000 * MHZ;

int memfd = open("/dev/mem", O_RDWR);

memregs32 = (volatile unsigned int*) mmap(0, 0x20000, PROT_READ|PROT_WRITE, MAP_SHARED, memfd, 0xC0000000);

unsigned  long v;
unsigned mdiv, pdiv=9, sdiv=0;

mdiv= (speed * pdiv) / SYS_CLK_FREQ;
mdiv &= 0x3FF;
v= pdiv<<18 | mdiv<<8 | sdiv;

PLLSETREG0 = v;
PWRMODE |= 0x8000;
close(memfd);
#endif
ENDINLINE


ENDFUNCTION


I have not tested it - or... I did, bit it didn't change much. Maybe it's wrong.

mentalthink

HI, Gernott, thanks for your quick answer.