Game Gear Micro >> C/C++

Overclock


main.c

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>

int main(int argc, char* args[])
{
    int cpu=4;
    int memdev=-1;
    volatile uint32_t *memregs=NULL;

    memdev = open("/dev/mem", O_RDWR);
    if(memdev > 0){
        memregs = (uint32_t*)mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, memdev, 0x01c20000);

        // CPU Clock = 24MHz * (cpu + 1) * 4
        memregs[0] = (1 << 31) | ((cpu << 8) | (3 << 4));
        close(memdev);
    }
    return 0;    
}


返回上一頁