Game Gear Micro >> C/C++

Overclock


main.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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;   
}


返回上一頁