input: in_gp2x refactoring
[libpicofe.git] / gp2x / soc.c
index d9b956f..43ebd85 100644 (file)
@@ -23,19 +23,23 @@ void (*set_lcd_gamma)(int g100, int A_SNs_curve);
 
 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;
 
@@ -43,6 +47,7 @@ gp2x_soc_t soc_detect(void)
        if (memdev == -1)
        {
                perror("open(/dev/mem)");
+               ret = -1;
                return -1;
        }
 
@@ -51,6 +56,7 @@ gp2x_soc_t soc_detect(void)
        {
                perror("mmap(memregs)");
                close(memdev);
+               ret = -1;
                return -1;
        }
        memregl = (volatile void *)memregs;