X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fsoc.c;h=68b2c892dd8d9b3d394ee43523a44f5616ef8bd2;hb=fa5e045bdc817112c1abf19e65e2d3481d51c48a;hp=d34077dbce2cbd4f0218fa95175bc3884505ff87;hpb=d572cbad9886a04f8c51edb825dc6aaec9b02e23;p=libpicofe.git diff --git a/gp2x/soc.c b/gp2x/soc.c index d34077d..68b2c89 100644 --- a/gp2x/soc.c +++ b/gp2x/soc.c @@ -9,18 +9,20 @@ #include "soc.h" #include "../common/emu.h" -gp2x_soc_t gp2x_soc = -1; - gp2x_soc_t soc_detect(void) { volatile unsigned short *memregs; volatile unsigned int *memregl; + static gp2x_soc_t ret = -1; int pollux_chipname[0x30/4 + 1]; char *pollux_chipname_c = (char *)pollux_chipname; - gp2x_soc_t ret = -1; int memdev; int i; + if (ret != -1) + /* already detected */ + return ret; + memdev = open("/dev/mem", O_RDONLY); if (memdev == -1) { @@ -72,7 +74,6 @@ not_pollux_like: out: munmap((void *)memregs, 0x20000); close(memdev); - gp2x_soc = ret; return ret; }