X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=gp2x%2Fsoc.c;h=3d4ad0415b89e11da001048038e73aad5849e90c;hb=f89d84717ae3536779f04cdfb57cf940d2bd8ade;hp=d5326bef9660138d5c35fad289ffd571672564d8;hpb=053bef765a5dba9d5a050c0944676e96412e293d;p=libpicofe.git diff --git a/gp2x/soc.c b/gp2x/soc.c index d5326be..3d4ad04 100644 --- a/gp2x/soc.c +++ b/gp2x/soc.c @@ -1,3 +1,14 @@ +/* + * (C) Gražvydas "notaz" Ignotas, 2009-2010 + * + * This work is licensed under the terms of any of these licenses + * (at your option): + * - GNU GPL, version 2 or later. + * - GNU LGPL, version 2.1 or later. + * - MAME license. + * See the COPYING file in the top-level directory. + */ + #include #include #include @@ -25,18 +36,21 @@ void (*set_ram_timings)(void); void (*unset_ram_timings)(void); int (*gp2x_read_battery)(void); +unsigned int (*gp2x_get_ticks_ms)(void); +unsigned int (*gp2x_get_ticks_us)(void); + gp2x_soc_t soc_detect(void) { volatile unsigned short *memregs; volatile unsigned int *memregl; - static gp2x_soc_t ret = -1; + static gp2x_soc_t ret = -2; int pollux_chipname[0x30/4 + 1]; char *pollux_chipname_c = (char *)pollux_chipname; int memdev; int i; - if (ret != -1) + if ((int)ret != -2) /* already detected */ return ret; @@ -44,6 +58,7 @@ gp2x_soc_t soc_detect(void) if (memdev == -1) { perror("open(/dev/mem)"); + ret = -1; return -1; } @@ -52,6 +67,7 @@ gp2x_soc_t soc_detect(void) { perror("mmap(memregs)"); close(memdev); + ret = -1; return -1; } memregl = (volatile void *)memregs;