cleanup: remove cpu ctrl files, move tests
authornotaz <notaz@pixelinis>
Fri, 22 May 2009 15:33:46 +0000 (18:33 +0300)
committernotaz <notaz@pixelinis>
Fri, 22 May 2009 15:33:46 +0000 (18:33 +0300)
18 files changed:
gp2x/Makefile
gp2x/cmdline.c [deleted file]
gp2x/cmdline.h [deleted file]
gp2x/cpu_speed.c [deleted file]
gp2x/cpuctrl.h [deleted file]
gp2x/cpuctrl_mmsp2.c [moved from gp2x/cpuctrl.c with 99% similarity]
gp2x/daemon.c [deleted file]
gp2x/daemon.h [deleted file]
gp2x/display.c [deleted file]
gp2x/display.h [deleted file]
gp2x/font.c [deleted file]
gp2x/gp2x.c
gp2x/gp2xminilib.c [deleted file]
gp2x/gp2xminilib.h [deleted file]
gp2x/speedtest.c [deleted file]
gp2x/speedtest.h [deleted file]
gp2x/test/align_test.c [moved from gp2x/align_test.c with 100% similarity]
gp2x/test/load_imm_test.c [moved from gp2x/load_imm_test.c with 100% similarity]

index 2552ce5..c17af14 100644 (file)
@@ -9,8 +9,7 @@ CC        = $(PREFIX)/bin/arm-open2x-linux-gcc
 STRIP     = $(PREFIX)/bin/arm-open2x-linux-strip
 
 OBJS      = main.o cpu.o memory.u video.o input.o sound.o gp2x.o gui.o        \
-            cheats.o zip.o cpu_threaded.z cpu_speed.o cpuctrl.o               \
-            gp2xminilib.o font.o display.o speedtest.o cmdline.o daemon.o     \
+            cheats.o zip.o cpu_threaded.z cpuctrl_mmsp2.o                     \
             arm_stub.o video_blend.o flush_cache.o
 BIN       = gpsp.gpe 
 
diff --git a/gp2x/cmdline.c b/gp2x/cmdline.c
deleted file mode 100644 (file)
index 6b50e17..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-
-/*  commandline.c for GP2X Version 2.0
-    Copyright (C) 2006 god_at_hell 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "cpuctrl.h"
-#include "gp2xminilib.h"
-#include "cpuctrl.h"
-
-
-void fallback(int argc, char *argv[])
-{
-       //beginning commandline-utilizing
-       if (argc == 3)
-       {
-               if (atoi(argv[1]) == 0)
-               {
-                       if(atoi(argv[2]) > 36){gp2x_deinit();exit(1);}
-                       if(atoi(argv[2]) < -20){gp2x_deinit();exit(1);}
-                       set_add_FLCDCLK(atoi(argv[2]));
-               }
-               else
-               {
-                       if(atoi(argv[2]) > 10){gp2x_deinit();exit(1);}
-                       if(atoi(argv[2]) < -5){gp2x_deinit();exit(1);}
-                       set_add_ULCDCLK(atoi(argv[2]));
-               }
-       }
-
-       if (argc == 4)
-       {
-               if(atoi(argv[3]) > 320){gp2x_deinit();exit(1);}
-               if(atoi(argv[3]) < 33){gp2x_deinit();exit(1);}
-               if (atoi(argv[1]) == 0)
-               {
-                       if(atoi(argv[2]) > 36){gp2x_deinit();exit(1);}
-                       if(atoi(argv[2]) < -20){gp2x_deinit();exit(1);}
-                       set_add_FLCDCLK(atoi(argv[2]));
-               }
-               else
-               {
-                       if(atoi(argv[2]) > 10){gp2x_deinit();exit(1);}
-                       if(atoi(argv[2]) < -5){gp2x_deinit();exit(1);}
-                       set_add_ULCDCLK(atoi(argv[2]));
-               }
-               set_FCLK(atoi(argv[3]));
-       }
-       
-       if (argc == 5)
-       {
-               if(atoi(argv[3]) > 320){gp2x_deinit();exit(1);}
-               if(atoi(argv[3]) < 33){gp2x_deinit();exit(1);}
-               if(atof(argv[4]) > 10){gp2x_deinit();exit(1);}
-               if(atof(argv[4]) < 0.02){gp2x_deinit();exit(1);}
-               if (atoi(argv[1]) == 0)
-               {
-                       if(atoi(argv[2]) > 36){gp2x_deinit();exit(1);}
-                       if(atoi(argv[2]) < -20){gp2x_deinit();exit(1);}
-                       set_add_FLCDCLK(atoi(argv[2]));
-               }
-               else
-               {
-                       if(atoi(argv[2]) > 10){gp2x_deinit();exit(1);}
-                       if(atoi(argv[2]) < -5){gp2x_deinit();exit(1);}
-                       set_add_ULCDCLK(atoi(argv[2]));
-               }
-               set_FCLK(atoi(argv[3]));
-               set_gamma(atof(argv[4]));
-       }
-}
-
-void cmdhelp()
-{
-       printf ("\ngpSP2X v0.9003 Beta by Exophase/ZodTTD\r\n");
-       printf ("cpu_speed by god_at_hell\r\n");
-       printf ("Usage: cpu_speed.gpe [option1] [value1] [option2]...\r\n");
-       printf ("Options:\r\n");
-       printf (" RAM-Options\r\n");
-       printf (" -----------\r\n");
-       printf (" --cas                 CAS Latency. Delay in clock cycles between the registration \n\t\tof a READ command and the first bit of output data. \n\t\tValid values are 2 and 3 cycles.\r\n");
-       printf (" --trc                 ACTIVE to ACTIVE /AUTOREFRESH command delay. Defines ACTIVE \n\t\tto ACTIVE/auto refresh command period delay. \n\t\tValid values are from 1 to 16 cycles.\r\n");
-       printf (" --tras        ACTIVE to PRECHARGE delay. Defines the delay between the ACTIVE \n\t\tand PRECHARGE commands. \n\t\tValid values are from 1 to 16 cycles.\r\n");
-       printf (" --twr                 Write recovery time in cycles.\n\t\tValid values are from 1 to 16 cycles.\r\n");
-       printf (" --tmrd        LOAD MODE REGISTER command cycle time.\n\t\tValid values are from 1 to 16 cycles.\r\n");
-       printf (" --trfc        AUTO REFRESH command period in cycles.\n\t\tValid values are from 1 to 16 cycles.\r\n");
-       printf (" --trp                 PRECHARGE command period in cycles.\n\t\tValid values are from 1 to 16 cycles.\r\n");
-       printf (" --trcd        RAS to CAS Delay in cycles.\n\t\tValid values are from 1 to 16 cycles.\r\n");
-       printf (" --refperd     Refresh Period. Defines maximum time period between \n\t\tAUTOREFRESH commands.\n\t\tValid values are from 1 to 65535 (default ~ 250) cycles.\r\n");
-       printf (" --ramdiv      Divider for the Memory-Clock which is 1/2 of the CPU-Clock. \n\t\tValid values are from 1 to 8.\r\n");
-       printf ("\n CPU-Options\r\n");
-       printf (" -----------\r\n");
-       printf (" --cpuclk      Sets the CPU-Frequency in Mhz. \n\t\tValid values are from 33 to 340.\r\n");
-       printf (" --cpudiv      Divider for the CPU-Clock. \n\t\tValid values are from 1 to 8.\r\n");
-       printf ("\n Display-Options\r\n");
-       printf ("----------------\r\n");
-       printf (" --fpll                Sets clockgenerator to fpll (for firmware 1.0 - 1.0.1).\r\n");
-       printf (" --upll                Sets clockgenerator to upll (for the rest).\r\n");
-       printf (" --timing      Timing Prescaler to eliminate flickering. \n\t\tValid values are: -20 to 36 with fpll.\n\t\t\t\t  -6 to 10 with upll.\r\n");
-       printf (" --gamma       Regulates the gamma. \n\t\tValid values are from 0.0001 to 15.0000.\r\n");
-       printf ("\n Daemon-Mode \r\n");
-       printf ("----------------\r\n");
-       printf ("Usage: cpu_speed.gpe --daemon [option1] [value1] [option2]...\r\n");
-       printf ("Shutdown: cpu_speed.gpe --kill[-daemon]\r\n");
-       printf ("Options:\r\n");
-       printf (" --min Sets the minimum CPU-Frequency in Mhz. \n\t\tValid values are from 33 to 340.\r\n");
-       printf (" --max Sets the maximum CPU-Frequency in Mhz. \n\t\tValid values are from 33 to 340.\r\n");
-       printf (" --start       Sets the CPU-Frequency in Mhz. \n\t\tValid values are from 33 to 340.\r\n");
-       printf (" --step        Sets the CPU-Frequency step in Mhz. \n\t\tValid values are from 1 to 340.\r\n");
-       printf (" --hotkey      Sets the hotkey. (Default: LR) \n\t\tValid values are a combination of LRXYZAB+-S/@ or ``None''\n\t\t (+- are volume, S is Start, / is Select, @ is Stick).\r\n");
-       printf (" --incr        Sets the increment key. (Default: +) \n\t\tValid values are a combination of LRXYZAB+-S/@ or ``None''\n\t\t (+- are volume, S is Start, / is Select, @ is Stick).\r\n");
-       printf (" --decr        Sets the decrement key. (Default: -) \n\t\tValid values are a combination of LRXYZAB+-S/@ or ``None''\n\t\t (+- are volume, S is Start, / is Select, @ is Stick).\r\n");
-       printf (" --no-hotkey   Alias for --hotkey None.\r\n");
-       printf (" --no-incr     Alias for --incr None.\r\n");
-       printf (" --no-decr     Alias for --decr None.\r\n");
-       printf (" --foreground  Do not switch to daemon mode. (Useful for debugging)\r\n");
-       printf (" --background  Switch to daemon mode. (Default)\r\n");
-       printf (" --display     Enable on screen display. COMING SOON!\r\n");
-       printf (" --no-display  Disable on screen display.\r\n");
-       printf ("\nNOTE:\nThe old commandline-settings are working ... read more about this in the readme\n\n");
-}
-
-void cmdline(int argc, char *argv[])
-{
-       short i,n;
-       short varis = 11;
-       char clockgen = get_Clkgen();
-       char var[11][9]={"--cas","--trc","--tras","--twr","--tmrd","--trfc","--trp","--trcd","--ramdiv","--cpuclk","--cpudiv"};
-
-       short val[varis];
-       for(n=0;n<varis;n++) //initialize the variable-array
-       {
-               val[n] = -1;
-       }
-
-       short timing = -100;
-       int refperd = -1;
-       float gamma = -1.;
-
-       
-       for(i=1; i<argc; i++)
-       {
-               if(strcmp(argv[i], "--fpll") == 0) clockgen = 0;
-               if(strcmp(argv[i], "--upll") == 0) clockgen = 1;
-               
-               for(n=0; n<varis; n++)
-               {
-                       if(strcmp(argv[i], var[n]) == 0)
-                       {
-                               if(i+1 == argc){printf ("%s is missing it's parameter\r\n",var[n]);gp2x_deinit();exit(1);}
-                               val[n] = atoi(argv[i+1]);
-                       }
-               }
-               if(strcmp(argv[i], "--refperd") == 0)
-               {
-                       if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-                       refperd = atoi(argv[i+1]);
-               } 
-               if(strcmp(argv[i], "--gamma") == 0)
-               {
-                       if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-                       gamma = atof(argv[i+1]);
-               }
-               if(strcmp(argv[i], "--timing") == 0)
-               {
-                       if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-                       timing = atoi(argv[i+1]);
-               }
-       }
-       
-       if(clockgen == 0)
-       {
-               if(timing > -21)
-               {
-                       if(timing < 37) set_add_FLCDCLK(timing);
-               }
-               else set_add_FLCDCLK(get_LCDClk(clockgen));
-       }
-       if(clockgen == 1)
-       {
-               if(timing > -7)
-               {
-                       if(timing < 11) set_add_ULCDCLK(timing);
-               }
-               else set_add_ULCDCLK(get_LCDClk(clockgen));
-       }
-       if(refperd-1 > -1)
-       {
-               if(refperd-1 < 0xffff) set_REFPERD(refperd-1);
-       }
-       if(gamma > 0.)
-       {
-               if(gamma < 15.) set_gamma(gamma);
-       }
-       if(val[0]-2 > -1)
-       {
-               if(val[0]-2 < 2) set_CAS(val[0]-2);
-       }
-       if(val[1]-1 > -1)
-       {
-               if(val[1]-1 < 16) set_tRC(val[1]-1);
-       }
-       if(val[2]-1 > -1)
-       {
-               if(val[2]-1 < 16) set_tRAS(val[2]-1);
-       }
-       if(val[3]-1 > -1)
-       {
-               if(val[3]-1 < 16) set_tWR(val[3]-1);
-       }
-       if(val[4]-1 > -1)
-       {
-               if(val[4]-1 < 16) set_tMRD(val[4]-1);
-       }
-       if(val[5]-1 > -1)
-       {
-               if(val[5]-1 < 16) set_tRFC(val[5]-1);
-       }
-       if(val[6]-1 > -1)
-       {
-               if(val[6] < 16) set_tRP(val[6]-1);
-       }
-       if(val[7]-1 > -1)
-       {
-               if(val[7]-1 < 16) set_tRCD(val[7]-1);
-       }
-       if(val[8]-1 > -1)
-       {
-               if(val[8]-1 < 8) set_DCLK_Div(val[8]-1);
-       }
-       if(val[9] > 32)
-       {
-               if(val[9] < 341) set_FCLK(val[9]);
-       }
-       if(val[10]-1 > -1)
-       {
-               if(val[10]-1 < 8) set_920_Div(val[10]-1);
-       }
-}
diff --git a/gp2x/cmdline.h b/gp2x/cmdline.h
deleted file mode 100644 (file)
index e80b968..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-void fallback(int argc, char *argv[]);
-void cmdhelp();
-void cmdline(int argc, char *argv[]);
diff --git a/gp2x/cpu_speed.c b/gp2x/cpu_speed.c
deleted file mode 100644 (file)
index 519a2f6..0000000
+++ /dev/null
@@ -1,1276 +0,0 @@
-
-/*  CPU/LCD/RAM-Tuner for GP2X Version 2.0
-    Copyright (C) 2006 god_at_hell
-    original CPU-Overclocker (c) by Hermes/PS2Reality
-  the gamma-routine was provided by theoddbot
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <math.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "display.h"
-#include "cpuctrl.h"
-#include "gp2xminilib.h"
-#include "speedtest.h"
-#include "cmdline.h"
-#include "daemon.h"
-
-int cpuspeed_exit = 0;
-
-unsigned COLORFONDO=0xB00000; // background-color
-unsigned WHITE=0xFFFFFF;
-unsigned TEXTBACK=0x0000B0;
-
-unsigned gp2x_nKeys=0;
-int oldtime=0;
-char pageshift;
-short menupoint;
-unsigned char cad[256];
-short cpusettings[2],dispsettings[3],ramsettings[10];
-extern int daemonsettings[8];
-extern unsigned MDIV,PDIV,SCALE;
-
-void cleardisp()
-{
-    ClearScreen(COLORFONDO);
-    sprintf(cad,"gpSP2X v0.9008 with CPU_SPEED");
-    v_putcad(1,1,WHITE,COLORFONDO,cad);
-    v_putcad(28,5,WHITE,COLORFONDO,"Item Help");
-    v_putcad(2,26,WHITE,COLORFONDO,"Start:Quit Stick:UP/DOWN");
-    
-    DrawBox(WHITE);
-}
-
-void itemhelp(char item[])
-{
-  if(strcmp(item, "menu") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Enter submenu");
-    v_putcad(26,9,0xffffff,COLORFONDO,"with B.");
-  }
-  if(strcmp(item, "cpuclk") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Choose a");
-    v_putcad(26,9,0xffffff,COLORFONDO,"clockspeed");
-    v_putcad(26,10,0xffffff,COLORFONDO,"with R/L or");
-    v_putcad(26,11,0xffffff,COLORFONDO,"Vol UP/Down.");
-    v_putcad(26,13,0xffffff,COLORFONDO,"Valid speeds");
-    v_putcad(26,14,0xffffff,COLORFONDO,"are:");
-    v_putcad(26,15,0xffffff,COLORFONDO,"33 to 340Mhz");
-  }
-  if(strcmp(item, "cpudiv") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Choose with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"The CPU-clock");
-    v_putcad(26,12,0xffffff,COLORFONDO,"will be");
-    v_putcad(26,13,0xffffff,COLORFONDO,"divided by");
-    v_putcad(26,14,0xffffff,COLORFONDO,"this value.");
-    v_putcad(26,16,0xffffff,COLORFONDO,"Valid values");
-    v_putcad(26,17,0xffffff,COLORFONDO,"are from");
-    v_putcad(26,18,0xffffff,COLORFONDO,"1 to 8");
-  }
-  if(strcmp(item, "test") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"The test");
-    v_putcad(26,12,0xffffff,COLORFONDO,"checks how");
-    v_putcad(26,13,0xffffff,COLORFONDO,"high you can");
-    v_putcad(26,14,0xffffff,COLORFONDO,"clock the");
-    v_putcad(26,15,0xffffff,COLORFONDO,"CPU.");
-    v_putcad(26,17,0xffffff,COLORFONDO,"Check the");
-    v_putcad(26,18,0xffffff,COLORFONDO,"Readme for");
-    v_putcad(26,19,0xffffff,COLORFONDO,"more infos.");
-  }
-  if(strcmp(item, "gotest") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Start the");
-    v_putcad(26,9,0xffffff,COLORFONDO,"test with B.");
-  }
-  if(strcmp(item, "clockgen") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change the");
-    v_putcad(26,9,0xffffff,COLORFONDO,"clockgen with");
-    v_putcad(26,10,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,12,0xffffff,COLORFONDO,"FPLL is for");
-    v_putcad(26,13,0xffffff,COLORFONDO,"FW 1.0");
-    v_putcad(26,14,0xffffff,COLORFONDO,"UPLL for the");
-    v_putcad(26,15,0xffffff,COLORFONDO,"rest.");
-  }
-  if(strcmp(item, "timing") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Choose the");
-    v_putcad(26,9,0xffffff,COLORFONDO,"LCD-Timing");
-    v_putcad(26,10,0xffffff,COLORFONDO,"with R/L.");
-    v_putcad(26,12,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,13,0xffffff,COLORFONDO,"values from");
-    v_putcad(26,14,0xffffff,COLORFONDO,"-20 to 36");
-    v_putcad(26,15,0xffffff,COLORFONDO,"for FPLL");
-    v_putcad(26,16,0xffffff,COLORFONDO,"and -6 to 10");
-    v_putcad(26,17,0xffffff,COLORFONDO,"for UPLL");
-  }
-  if(strcmp(item, "gamma") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change gamma");
-    v_putcad(26,9,0xffffff,COLORFONDO,"with R/L or");
-    v_putcad(26,10,0xffffff,COLORFONDO,"Vol UP/DOWN");
-    v_putcad(26,12,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,13,0xffffff,COLORFONDO,"values from");
-    v_putcad(26,14,0xffffff,COLORFONDO,"0.01 to 10.00");
-  }
-  if(strcmp(item, "CAS") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Choose the");
-    v_putcad(26,9,0xffffff,COLORFONDO,"CAS Latency");
-    v_putcad(26,10,0xffffff,COLORFONDO,"with R/L");
-    v_putcad(26,12,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,13,0xffffff,COLORFONDO,"2 or 3 cycles");
-    v_putcad(26,15,0xffffff,COLORFONDO,"Delay between");
-    v_putcad(26,16,0xffffff,COLORFONDO,"registration");
-    v_putcad(26,17,0xffffff,COLORFONDO,"of a READ");
-    v_putcad(26,18,0xffffff,COLORFONDO,"command and");
-    v_putcad(26,19,0xffffff,COLORFONDO,"outputdata.");
-    v_putcad(27,21,0x0000DD,COLORFONDO,"!INSTABLE!");
-  }
-  if(strcmp(item, "tRC") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,12,0xffffff,COLORFONDO,"1 to 16");
-    v_putcad(26,13,0xffffff,COLORFONDO,"cycles.");
-    v_putcad(26,15,0xffffff,COLORFONDO,"ACTIVE to");
-    v_putcad(26,16,0xffffff,COLORFONDO,"ACTIVE/");
-    v_putcad(26,17,0xffffff,COLORFONDO,"AUTOREFRESH");
-    v_putcad(26,18,0xffffff,COLORFONDO,"command");
-    v_putcad(26,19,0xffffff,COLORFONDO,"period delay.");
-  }
-  if(strcmp(item, "tRAS") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,12,0xffffff,COLORFONDO,"1 to 16");
-    v_putcad(26,13,0xffffff,COLORFONDO,"cycles.");
-    v_putcad(26,15,0xffffff,COLORFONDO,"Delay between");
-    v_putcad(26,16,0xffffff,COLORFONDO,"the ACTIVE");
-    v_putcad(26,17,0xffffff,COLORFONDO,"and PRECHARGE");
-    v_putcad(26,18,0xffffff,COLORFONDO,"commands.");
-  }
-  if(strcmp(item, "tWR") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,12,0xffffff,COLORFONDO,"1 to 16");
-    v_putcad(26,13,0xffffff,COLORFONDO,"cycles.");
-    v_putcad(26,15,0xffffff,COLORFONDO,"Write");
-    v_putcad(26,16,0xffffff,COLORFONDO,"recovery time");
-    v_putcad(26,17,0xffffff,COLORFONDO,"in cycles.");
-  }
-  if(strcmp(item, "tMRD") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,12,0xffffff,COLORFONDO,"1 to 16");
-    v_putcad(26,13,0xffffff,COLORFONDO,"cycles.");
-    v_putcad(26,15,0xffffff,COLORFONDO,"LOAD MODE");
-    v_putcad(26,16,0xffffff,COLORFONDO,"REGISTER");
-    v_putcad(26,17,0xffffff,COLORFONDO,"command cycle");
-    v_putcad(26,18,0xffffff,COLORFONDO,"time.");
-  }
-  if(strcmp(item, "tRFC") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,12,0xffffff,COLORFONDO,"1 to 16");
-    v_putcad(26,13,0xffffff,COLORFONDO,"cycles.");
-    v_putcad(26,15,0xffffff,COLORFONDO,"AUTOREFRESH");
-    v_putcad(26,16,0xffffff,COLORFONDO,"command");
-    v_putcad(26,17,0xffffff,COLORFONDO,"period.");
-  }
-  if(strcmp(item, "tRP") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,12,0xffffff,COLORFONDO,"1 to 16");
-    v_putcad(26,13,0xffffff,COLORFONDO,"cycles.");
-    v_putcad(26,15,0xffffff,COLORFONDO,"PRECHARGE");
-    v_putcad(26,16,0xffffff,COLORFONDO,"command");
-    v_putcad(26,17,0xffffff,COLORFONDO,"period.");
-  }
-  if(strcmp(item, "tRCD") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Change with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,12,0xffffff,COLORFONDO,"1 to 16");
-    v_putcad(26,13,0xffffff,COLORFONDO,"cycles.");
-    v_putcad(26,15,0xffffff,COLORFONDO,"RAS to CAS");
-    v_putcad(26,16,0xffffff,COLORFONDO,"Delay in");
-    v_putcad(26,17,0xffffff,COLORFONDO,"cycles.");
-  }
-  if(strcmp(item, "REFPERD") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Choose the");
-    v_putcad(26,9,0xffffff,COLORFONDO,"RAM Refresh");
-    v_putcad(26,9,0xffffff,COLORFONDO,"Period");
-    v_putcad(26,10,0xffffff,COLORFONDO,"with R/L");
-    v_putcad(26,12,0xffffff,COLORFONDO,"Valid are");
-    v_putcad(26,13,0xffffff,COLORFONDO,"1 to 65535 ");
-    v_putcad(26,14,0xffffff,COLORFONDO,"cycles.");
-    v_putcad(26,16,0xffffff,COLORFONDO,"Max. cycles");
-    v_putcad(26,17,0xffffff,COLORFONDO,"between");
-    v_putcad(26,18,0xffffff,COLORFONDO,"AUTOREFRESH");
-    v_putcad(26,19,0xffffff,COLORFONDO,"commands.");
-    v_putcad(26,21,0xFFFF,COLORFONDO,"Default ~250");
-  }
-  if(strcmp(item, "DCLK_Div") == 0)
-  {
-    v_putcad(26,8,0xffffff,COLORFONDO,"Choose with");
-    v_putcad(26,9,0xffffff,COLORFONDO,"R/L.");
-    v_putcad(26,11,0xffffff,COLORFONDO,"The CPU-clock");
-    v_putcad(26,12,0xffffff,COLORFONDO,"will be");
-    v_putcad(26,13,0xffffff,COLORFONDO,"divided by");
-    v_putcad(26,14,0xffffff,COLORFONDO,"this value.");
-    v_putcad(26,15,0xffffff,COLORFONDO,"Valid values");
-    v_putcad(26,17,0xffffff,COLORFONDO,"are from");
-    v_putcad(26,18,0xffffff,COLORFONDO,"1 to 8");
-    v_putcad(26,20,0xffffff,COLORFONDO,"RAM-Clock =");
-    v_putcad(26,21,0xffffff,COLORFONDO,"CPU-Clock / 2");
-  }
-}
-
-short cpumenu()
-{
-  unsigned sysfreq=0, cpufreq, cpu_div;
-  
-  short test = 1;
-  
-  if(cpusettings[0] == -1)
-  {
-    //get the setted values from system
-    cpu_div = get_920_Div();
-    sysfreq=get_freq_920_CLK();
-    sysfreq*=cpu_div+1;
-    cpufreq=sysfreq/1000000;
-  }
-  else
-  {
-    //use old settings
-    cpufreq = cpusettings[0];
-    cpu_div = cpusettings[1];
-  }
-  
-  menupoint = 0;
-  
-  do
-  { 
-    cleardisp();
-    
-    //cpu menu
-    v_putcad(12,2,WHITE,COLORFONDO,"CPU Clock Setup");
-    sprintf(cad,"CPU Frequency = %uMhz",cpufreq);
-    if(menupoint==0){v_putcad(2,5,0xffffff,TEXTBACK,cad);itemhelp("cpuclk");}
-    else v_putcad(2,5,0xffff,COLORFONDO,cad);
-    sprintf(cad,"CPU Divider: %u",cpu_div+1);
-    if(menupoint==1){v_putcad(2,7,0xffffff,TEXTBACK,cad);itemhelp("cpudiv");}
-    else v_putcad(2,7,0xffff,COLORFONDO,cad);
-    v_putcad(2,12,0xffff00,COLORFONDO,"CPU Speedtest");
-    if(test==0) sprintf(cad,"Test 2: Primnumber");
-    if(test==1) sprintf(cad,"Test 1: Walking Ant");
-    if(menupoint==2){v_putcad(2,15,0xffffff,TEXTBACK,cad);itemhelp("test");}
-    else v_putcad(2,15,0xffff,COLORFONDO,cad);
-    if(menupoint==3){v_putcad(8,17,0xffffff,TEXTBACK,"GO!!!");itemhelp("gotest");}
-    else v_putcad(8,17,0xffff,COLORFONDO,"GO!!!");
-
-    gp2x_video_flip();
-
-    while(1)
-    {
-      gp2x_nKeys=gp2x_joystick_read();
-
-      if((gp2x_nKeys & GP2X_START))
-      {
-        while(1)
-        {
-          gp2x_nKeys=gp2x_joystick_read();
-          if(!(gp2x_nKeys & GP2X_START)) break;
-        }
-        cpusettings[0] = cpufreq;
-        cpusettings[1] = cpu_div;
-        return 0;
-      }
-
-      if((gp2x_nKeys & GP2X_DOWN))
-      {
-        menupoint++;
-        if(menupoint>3) menupoint=0;
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_UP))
-      {
-        menupoint--;
-        if(menupoint<0) menupoint=3;
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_R))
-      {
-        if (menupoint == 0)
-        {
-          cpufreq+=10;
-          if (cpufreq > 340) cpufreq = 33;
-        }
-        if (menupoint == 1)
-        {
-          cpu_div++;
-          if (cpu_div == 8) cpu_div = 0;
-        }
-        if (menupoint == 2)
-        {
-          test++;
-          if (test == 2) test = 0;
-        }
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_L))
-      {
-        if (menupoint == 0)
-        {
-          cpufreq-=10;
-          if (cpufreq < 33) cpufreq = 340;
-        }
-        if (menupoint == 1)
-        {
-          cpu_div--;
-          if (cpu_div == -1) cpu_div = 7;
-        }
-        if (menupoint == 2)
-        {
-          cpu_div--;
-          if (cpu_div == -1) cpu_div = 1;
-        }
-        delay_us(200000);
-        break;
-      }
-      
-      if((gp2x_nKeys & GP2X_VOL_DOWN))
-      {
-        if (menupoint == 0)
-        {
-          cpufreq++;
-          if (cpufreq == 340) cpufreq = 33;
-        }
-        delay_us(200000);
-        break;
-      }
-            
-      if((gp2x_nKeys & GP2X_VOL_UP))
-      {
-        if (menupoint == 0)
-        {
-          cpufreq--;
-          if (cpufreq == 32) cpufreq = 340;
-        }
-        delay_us(200000);
-        break;
-      }
-      
-      if((gp2x_nKeys & GP2X_B))
-      {
-        if (menupoint == 3) speedtest(test);
-        delay_us(200000);
-        break;
-      }
-    }
-  }
-  while(1);
-}
-
-short lcdmenu()
-{
-  short clockgen, LCDClk;
-  float gamma;
-  
-  if(dispsettings[0] == -1)
-  {
-    //get the setted values from system
-    clockgen = get_Clkgen();
-    LCDClk = get_LCDClk(clockgen);
-    gamma = 1.0;
-  }
-  else
-  {
-    //use old settings
-    clockgen = dispsettings[0];
-    LCDClk = dispsettings[1];
-    gamma = dispsettings[2]/100;
-  }
-  
-  menupoint = 0;
-  
-  do
-  { 
-    cleardisp();
-    
-    //display menu
-    v_putcad(9,2,WHITE,COLORFONDO,"Display Setting Setup");
-    if (clockgen == 0)
-    {
-      sprintf(cad,"Clockgen = FPLL");
-      if(menupoint==0){v_putcad(2,5,0xffffff,TEXTBACK,cad);itemhelp("clockgen");}
-      else v_putcad(2,5,0xffff,COLORFONDO,cad);
-    }
-    else
-    {
-      sprintf(cad,"Clockgen = UPLL");
-      if(menupoint==0){v_putcad(2,5,0xffffff,TEXTBACK,cad);itemhelp("clockgen");}
-      else v_putcad(2,5,0xffff,COLORFONDO,cad);
-    }
-    sprintf(cad,"Timing: %i",LCDClk);
-    if(menupoint==1){v_putcad(2,7,0xffffff,TEXTBACK,cad);itemhelp("timing");}
-    else v_putcad(2,7,0xffff,COLORFONDO,cad);
-    sprintf(cad,"Gamma: %.2f",gamma);
-    if(menupoint==2){v_putcad(2,9,0xffffff,TEXTBACK,cad);itemhelp("gamma");}
-    else v_putcad(2,9,0xffff,COLORFONDO,cad); 
-
-    gp2x_video_flip();
-
-    while(1)
-    {
-      gp2x_nKeys=gp2x_joystick_read();
-
-      if((gp2x_nKeys & GP2X_START))
-      {
-        while(1)
-        {
-          gp2x_nKeys=gp2x_joystick_read();
-          if(!(gp2x_nKeys & GP2X_START)) break;
-        }
-        dispsettings[0] = clockgen;
-        dispsettings[1] = LCDClk;
-        dispsettings[2] = (int)(gamma*100);
-        return 0;
-      }
-
-      if((gp2x_nKeys & GP2X_DOWN))
-      {
-        menupoint++;
-        if(menupoint>2) menupoint=0;
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_UP))
-      {
-        menupoint--;
-        if(menupoint<0) menupoint=2;
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_R))
-      {
-        if (menupoint == 0)
-        {
-          clockgen++;
-          if (clockgen == 2) clockgen = 0;
-        }
-        if (menupoint == 1)
-        {
-          LCDClk++;
-          if (clockgen == 0)
-          {
-            if (LCDClk == 37) LCDClk = -20;
-            set_add_FLCDCLK(LCDClk);
-          }
-          else
-          {
-            if (LCDClk == 11) LCDClk = -6;
-            set_add_ULCDCLK(LCDClk);
-          }
-        }
-        if (menupoint == 2)
-        {
-          gamma += 0.2;
-          if (gamma > 10) gamma = 0.2;
-          set_gamma(gamma);
-        }
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_L))
-      {
-        if (menupoint == 0)
-        {
-          clockgen--;
-          if (clockgen == -1) clockgen = 1;
-        }
-        if (menupoint == 1)
-        {
-          LCDClk--;
-          if(clockgen == 0)
-          {
-            if (LCDClk == -21) LCDClk = 36;
-            set_add_FLCDCLK(LCDClk);
-          }
-          else
-          {
-            if (LCDClk == -7) LCDClk = 10;
-            set_add_ULCDCLK(LCDClk);
-          }
-        }
-        if (menupoint == 2)
-        {
-          gamma -= 0.2;
-          if (gamma < 0.01) gamma = 10;
-          set_gamma(gamma);
-        }
-        delay_us(200000);
-        break;
-      }
-      
-      if((gp2x_nKeys & GP2X_VOL_DOWN))
-      {
-        if (menupoint == 2)
-        {
-          gamma += 0.01;
-          if (gamma > 10) gamma = 0.01;
-          set_gamma(gamma);
-        }
-        delay_us(200000);
-        break;
-      }
-            
-      if((gp2x_nKeys & GP2X_VOL_UP))
-      {
-        if (menupoint == 2)
-        {
-          gamma -= 0.01;
-          if (gamma < 0.01) gamma = 10;
-          set_gamma(gamma);
-        }
-        delay_us(200000);
-        break;
-      }
-    }
-  }
-  while(1);
-}
-
-short rammenu()
-{
-  short CAS,tRC,tRAS,tWR,tMRD,tRFC,tRP,tRCD,DCLK_Div;
-  int REFPERD;
-  
-  if(ramsettings[0] == -1)
-  {
-    //get the setted values from system
-    CAS = get_CAS();
-    tRC = get_tRC();
-    tRAS = get_tRAS();
-    tWR = get_tWR();
-    tMRD = get_tMRD();
-    tRFC = get_tRFC();
-    tRP = get_tRP();
-    tRCD = get_tRCD();
-    REFPERD = get_REFPERD();
-    DCLK_Div = get_DCLK_Div();
-  }
-  else
-  {
-    //use old settings
-    CAS = ramsettings[0];
-    tRC = ramsettings[1];
-    tRAS = ramsettings[2];
-    tWR = ramsettings[3];
-    tMRD = ramsettings[4];
-    tRFC = ramsettings[5];
-    tRP = ramsettings[6];
-    tRCD = ramsettings[7];
-    REFPERD = ramsettings[8];
-    DCLK_Div = ramsettings[9];
-  }
-  
-  pageshift = 0;
-  menupoint = 0;
-  
-  do
-  { 
-    cleardisp();
-    
-    //ram menu
-    v_putcad(11,2,WHITE,COLORFONDO,"RAM Setting Setup");
-    if(pageshift == 0)
-    { 
-      sprintf(cad,"CAS: %u",CAS+2);
-      if(menupoint==0){v_putcad(2,5,0xffffff,TEXTBACK,cad);itemhelp("CAS");}
-      else v_putcad(2,5,0xffff,COLORFONDO,cad);
-    }
-    else v_putcad(13,5,0xffff,COLORFONDO,"^");
-    sprintf(cad,"tRC: %u",tRC+1);
-    if(menupoint==1){v_putcad(2,7-pageshift,0xffffff,TEXTBACK,cad);itemhelp("tRC");}
-    else v_putcad(2,7-pageshift,0xffff,COLORFONDO,cad);
-    sprintf(cad,"tRAS: %u",tRAS+1);
-    if(menupoint==2){v_putcad(2,9-pageshift,0xffffff,TEXTBACK,cad);itemhelp("tRAS");}
-    else v_putcad(2,9-pageshift,0xffff,COLORFONDO,cad);
-    sprintf(cad,"tWR: %u",tWR+1);
-    if(menupoint==3){v_putcad(2,11-pageshift,0xffffff,TEXTBACK,cad);itemhelp("tWR");}
-    else v_putcad(2,11-pageshift,0xffff,COLORFONDO,cad);
-    sprintf(cad,"tMRD: %u",tMRD+1);
-    if(menupoint==4){v_putcad(2,13-pageshift,0xffffff,TEXTBACK,cad);itemhelp("tMRD");}
-    else v_putcad(2,13-pageshift,0xffff,COLORFONDO,cad);
-    sprintf(cad,"tRFC: %u",tRFC+1);
-    if(menupoint==5){v_putcad(2,15-pageshift,0xffffff,TEXTBACK,cad);itemhelp("tRFC");}
-    else v_putcad(2,15-pageshift,0xffff,COLORFONDO,cad);
-    sprintf(cad,"tRP: %u",tRP+1);
-    if(menupoint==6){v_putcad(2,17-pageshift,0xffffff,TEXTBACK,cad);itemhelp("tRP");}
-    else v_putcad(2,17-pageshift,0xffff,COLORFONDO,cad);
-    sprintf(cad,"tRCD: %u",tRCD+1);
-    if(menupoint==7){v_putcad(2,19-pageshift,0xffffff,TEXTBACK,cad);itemhelp("tRCD");}
-    else v_putcad(2,19-pageshift,0xffff,COLORFONDO,cad);
-    sprintf(cad,"Refresh Period: %u",REFPERD+1);
-    if(menupoint==8){v_putcad(2,21-pageshift,0xffffff,TEXTBACK,cad);itemhelp("REFPERD");}
-    else v_putcad(2,21-pageshift,0xffff,COLORFONDO,cad);
-    if(pageshift == 1)
-    { 
-      sprintf(cad,"RAM Divider: %u",DCLK_Div+1);
-      if(menupoint==9){v_putcad(2,23,0xffffff,TEXTBACK,cad);itemhelp("DCLK_Div");}
-      else v_putcad(2,23,0xffff,COLORFONDO,cad);
-    }
-    else v_putcad(13,23,0xffff,COLORFONDO,"v");
-    
-
-    gp2x_video_flip();
-
-    while(1)
-    {
-      gp2x_nKeys=gp2x_joystick_read();
-
-      if((gp2x_nKeys & GP2X_START))
-      {
-        while(1)
-        {
-          gp2x_nKeys=gp2x_joystick_read();
-          if(!(gp2x_nKeys & GP2X_START)) break;
-        }
-        ramsettings[0] = CAS;
-        ramsettings[1] = tRC;
-        ramsettings[2] = tRAS;
-        ramsettings[3] = tWR;
-        ramsettings[4] = tMRD;
-        ramsettings[5] = tRFC;
-        ramsettings[6] = tRP;
-        ramsettings[7] = tRCD;
-        ramsettings[8] = REFPERD;
-        ramsettings[9] = DCLK_Div;
-        return 0;
-      }
-
-      if((gp2x_nKeys & GP2X_DOWN))
-      {
-        menupoint++;
-        if(menupoint==9) pageshift = 1;
-        if(menupoint>9) {menupoint=0; pageshift = 0;} 
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_UP))
-      {
-        menupoint--;
-        if(menupoint==0) pageshift = 0;
-        if(menupoint<0) { menupoint=9; pageshift = 1;}  
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_R))
-      {
-        if (menupoint == 0)
-        {
-          CAS++;
-          if (CAS == 2) CAS = 0;
-        }
-        if (menupoint == 1)
-        {
-          tRC++;
-          if (tRC == 16) tRC = 0;
-        }
-        if (menupoint == 2)
-        {
-          tRAS++;
-          if (tRAS == 16) tRAS = 0;
-        }
-        if (menupoint == 3)
-        {
-          tWR++;
-          if (tWR == 16) tWR = 0;
-        }
-        if (menupoint == 4)
-        {
-          tMRD++;
-          if (tMRD == 16) tMRD = 0;
-        }
-        if (menupoint == 5)
-        {
-          tRFC++;
-          if (tRFC == 16) tRFC = 0;
-        }
-        if (menupoint == 6)
-        {
-          tRP++;
-          if (tRP == 16) tRP = 0;
-        }
-        if (menupoint == 7)
-        {
-          tRCD++;
-          if (tRCD == 16) tRCD = 0;
-        }
-        if (menupoint == 8)
-        {
-          REFPERD += 10;
-          if (REFPERD == 0xffff) REFPERD = 0;
-        }
-        if (menupoint == 9)
-        {
-          DCLK_Div++;
-          if (DCLK_Div == 8) DCLK_Div = 0;
-        }
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_L))
-      {
-        if (menupoint == 0)
-        {
-          CAS--;
-          if (CAS == -1) CAS = 1;
-        }
-        if (menupoint == 1)
-        {
-          tRC--;
-          if (tRC == -1) tRC = 15;
-        }
-        if (menupoint == 2)
-        {
-          tRAS--;
-          if (tRAS == -1) tRAS = 15;
-        }
-        if (menupoint == 3)
-        {
-          tWR--;
-          if (tWR == -1) tWR = 15;
-        }
-        if (menupoint == 4)
-        {
-          tMRD--;
-          if (tMRD == -1) tMRD = 15;
-        }
-        if (menupoint == 5)
-        {
-          tRFC--;
-          if (tRFC == -1) tRFC = 15;
-        }
-        if (menupoint == 6)
-        {
-          tRP--;
-          if (tRP == -1) tRP = 15;
-        }
-        if (menupoint == 7)
-        {
-          tRCD--;
-          if (tRCD == -1) tRCD = 15;
-        }
-        if (menupoint == 8)
-        {
-          REFPERD -= 10;
-          if (REFPERD == -1) REFPERD = 0xfffe;
-        }
-        if (menupoint == 9)
-        {
-          DCLK_Div--;
-          if (DCLK_Div == -1) DCLK_Div = 7;
-        }
-        delay_us(200000);
-        break;
-      }
-    }
-  }
-  while(1);
-}
-
-int exit_cpu_speed(char* runfile)
-{
-  gp2x_deinit();
-  cpuspeed_exit = 1;
-#if 0
-  system("sync");
-  if(strcmp(runfile, "gp2xmenu") == 0) chdir("/usr/gp2x");
-  execl(runfile,NULL);
-  exit(0);
-#endif
-} 
-
-/****************************************************************************************************************************************/
-//  MAIN
-/****************************************************************************************************************************************/
-
-int main_cpuspeed(int argc, char *argv[])
-{
-  unsigned sysfreq=0;
-  int cpufreq, n;
-  short run = 0;
-  int start_daemon = 0;
-  short mainmenupoint = 0;
-  ramsettings[0] = -1;
-  ramsettings[1] = -1;
-  ramsettings[2] = -1;
-  ramsettings[3] = -1;
-  ramsettings[4] = -1;
-  ramsettings[5] = -1;
-  ramsettings[6] = -1;
-  ramsettings[7] = -1;
-  ramsettings[8] = -1;
-  ramsettings[9] = -1;
-  dispsettings[0] = -1;
-  dispsettings[1] = -100;
-  dispsettings[2] = -1;
-  cpusettings[0] = -1;
-  cpusettings[1] = -1;
-  daemonsettings[0] = -1;
-  daemonsettings[1] = 260;
-  daemonsettings[2] = 5;
-  daemonsettings[3] = 5;
-  daemonsettings[4] = GP2X_L | GP2X_R;
-  daemonsettings[5] = GP2X_VOL_DOWN;
-  daemonsettings[6] = GP2X_VOL_UP;
-  daemonsettings[7] = 1;
-  
-  char *runfile;
-
-  FILE *settings;
-  char sets[41][40];
-  char* comps[25] = {
-      "CPU-Clock\n","CPU-Div\n","FPLL\n","UPLL\n","Gamma\n","CAS\n","tRC\n",
-      "tRAS\n","tWR\n","tMRD\n","tRFC\n","tRP\n","tRCD\n","Refresh-Period\n","RAM-Div\n","Run\n",
-      "Daemon-Min\n","Daemon-Max\n","Daemon-Step\n","Daemon-Delay\n","Daemon-Hotkey\n","Daemon-Incr-Key\n","Daemon-Decr-Key\n",
-      "Daemon-OSD\n","Daemon-Run\n"
-  };
-  
-  gp2x_init(16,44100,16,1,50);
-  cpuctrl_init();  // ATENCION: si no se hace esto, cuelgue seguro (aprovecho la definicion de rlyeh y debe ir despues de gp2x_init)
-  
-  settings = fopen ("./cpu_speed.cfg", "r");
-  
-  if (settings == NULL)
-    {
-    printf("No file found\n");
-    }
-    else
-    {
-    char *ReturnCode;
-    for(n=0; n<40; n++)
-    {
-      ReturnCode = fgets(sets[n],40,settings);
-      if (ReturnCode == NULL)
-      { 
-        sets[40][0] = (char)n;
-        break;
-      }
-    }
-    
-    for(n=0; n<(int)sets[40][0]; n=n+2)
-    {
-      if(strcmp(sets[n],comps[0]) == 0)
-      {
-        if(atoi(sets[n+1]) > 33)
-        if(atoi(sets[n+1]) < 341)
-        cpusettings[0] = atoi(sets[n+1]);
-      }
-      if(strcmp(sets[n],comps[1]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 9)
-        cpusettings[1] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[2]) == 0)
-      {
-        if(atoi(sets[n+1]) > -21)
-        if(atoi(sets[n+1]) < 37)
-        dispsettings[0] = 0;
-        dispsettings[1] = atoi(sets[n+1]);
-        
-      }
-      if(strcmp(sets[n],comps[3]) == 0)
-      {
-        if(atoi(sets[n+1]) > -7)
-        if(atoi(sets[n+1]) < 11)
-        dispsettings[0] = 1;
-        dispsettings[1] = atoi(sets[n+1]);
-      }
-      if(strcmp(sets[n],comps[4]) == 0)
-      {
-        if(atof(sets[n+1]) > 0)
-        if(atof(sets[n+1]) <= 10)
-        dispsettings[2] = (int)(atof(sets[n+1])*100);
-      }
-      if(strcmp(sets[n],comps[5]) == 0)
-      {
-        if(atoi(sets[n+1]) > 1)
-        if(atoi(sets[n+1]) < 4)
-        ramsettings[0] = atoi(sets[n+1])-2;
-      }
-      if(strcmp(sets[n],comps[6]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 17)
-        ramsettings[1] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[7]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 17)
-        ramsettings[2] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[8]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 17)
-        ramsettings[3] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[9]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 17)
-        ramsettings[4] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[10]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 17)
-        ramsettings[5] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[11]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 17)
-        ramsettings[6] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[12]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 17)
-        ramsettings[7] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[13]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 65536)
-        ramsettings[8] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[14]) == 0)
-      {
-        if(atoi(sets[n+1]) > 0)
-        if(atoi(sets[n+1]) < 9)
-        ramsettings[9] = atoi(sets[n+1])-1;
-      }
-      if(strcmp(sets[n],comps[15]) == 0)
-      {
-        run = 1;
-        runfile = sets[n+1];
-      }
-      if(strcmp(sets[n],comps[16]) == 0)
-      {
-        if(atoi(sets[n+1]) >= 33)
-        if(atoi(sets[n+1]) <= 340)
-        daemonsettings[0] = atoi(sets[n+1]);
-      }
-      if(strcmp(sets[n],comps[17]) == 0)
-      {
-        if(atoi(sets[n+1]) >= 33)
-        if(atoi(sets[n+1]) <= 340)
-        daemonsettings[1] = atoi(sets[n+1]);
-      }
-      if(strcmp(sets[n],comps[18]) == 0)
-      {
-        if(atoi(sets[n+1]) >= daemonsettings[1])
-        if(atoi(sets[n+1]) <= 340)
-        daemonsettings[2] = atoi(sets[n+1]);
-      }
-      if(strcmp(sets[n],comps[19]) == 0)
-      {
-        daemonsettings[3] = (int)(atof(sets[n+1])*10+0.5);
-        if(daemonsettings[3] < 1)
-            daemonsettings[3] = 5;
-      }
-      if(strcmp(sets[n],comps[20]) == 0)
-      {
-        daemonsettings[4] = parse_key_sequence(sets[n+1]);
-      }
-      if(strcmp(sets[n],comps[21]) == 0)
-      {
-        daemonsettings[5] = parse_key_sequence(sets[n+1]);
-      }
-      if(strcmp(sets[n],comps[22]) == 0)
-      {
-        daemonsettings[6] = parse_key_sequence(sets[n+1]);
-      }
-      if(strcmp(sets[n],comps[23]) == 0)
-      {
-        daemonsettings[7] = (sets[n+1][1] == 'n' ? 1 : 0);
-      }
-      if(strcmp(sets[n],comps[24]) == 0)
-      {
-        start_daemon = 1;
-      }
-    }
-  }
-  
-  if(run == 1)
-  {
-    if (cpusettings[0] > -1) set_FCLK(cpusettings[0]);
-    if (cpusettings[1] > -1) set_920_Div(cpusettings[1]);
-    if (dispsettings[0] == 0)
-    if (dispsettings[1] > -100) set_add_FLCDCLK(dispsettings[1]);
-    if (dispsettings[0] == 1)
-    if (dispsettings[1] > -100) set_add_ULCDCLK(dispsettings[1]);
-    if (dispsettings[2] > -1) set_gamma((float)(dispsettings[2]/100));
-    if (ramsettings[0] > -1) set_CAS(ramsettings[0]);
-    if (ramsettings[1] > -1) set_tRC(ramsettings[1]);
-    if (ramsettings[2] > -1) set_tRAS(ramsettings[2]);
-    if (ramsettings[3] > -1) set_tWR(ramsettings[3]);
-    if (ramsettings[4] > -1) set_tMRD(ramsettings[4]);
-    if (ramsettings[5] > -1) set_tRFC(ramsettings[5]);
-    if (ramsettings[6] > -1) set_tRP(ramsettings[6]);
-    if (ramsettings[7] > -1) set_tRCD(ramsettings[7]);
-    if (ramsettings[8] > -1) set_REFPERD(ramsettings[8]);
-    if (ramsettings[9] > -1) set_DCLK_Div(ramsettings[9]);
-    exit_cpu_speed(runfile);
-    return 0;
-  }
-
-  sysfreq=get_freq_920_CLK();
-  sysfreq*=get_920_Div()+1;
-  cpufreq=sysfreq/1000000;
-  
-#if 0
-  if(argc > 1)
-  {
-    if(strcmp(argv[1], "0") == 0) fallback(argc, argv);
-    else if(strcmp(argv[1], "1") == 0) fallback(argc, argv);
-    else if(strcmp(argv[1], "--help") == 0) cmdhelp();
-    else if(strcmp(argv[1], "--daemon") == 0) cmd_daemon(argc, argv);
-    else if(strcmp(argv[1], "--kill-daemon") == 0) kill_running_daemon() || printf("no daemon running\r\n");
-    else if(strcmp(argv[1], "--kill") == 0) kill_running_daemon() || printf("no daemon running\r\n");
-    else cmdline(argc, argv);
-    gp2x_deinit();
-    return 0;
-  }
-#endif
-  
-  if(start_daemon)
-      start_daemon_by_settings();
-  
-  set_gamma(1.0);
-  
-  do
-  { 
-    cleardisp();
-    
-    //main menu
-    v_putcad(27,26,WHITE,COLORFONDO,"Y:Save to SD");
-    v_putcad(2,27,WHITE,COLORFONDO,"Select: Set setting and quit");
-    itemhelp("menu");
-    if(mainmenupoint==0) v_putcad(2,6,0xffffff,TEXTBACK,"> CPU Clock");
-    else v_putcad(2,6,0xffff,COLORFONDO,"> CPU Clock");
-    if(mainmenupoint==1) v_putcad(2,8,0xffffff,TEXTBACK,"> Display Settings");
-    else v_putcad(2,8,0xffff,COLORFONDO,"> Display Settings");
-    if(mainmenupoint==2) v_putcad(2,10,0xffffff,TEXTBACK,"> RAM Settings");
-    else v_putcad(2,10,0xffff,COLORFONDO,"> RAM Settings");
-    if(mainmenupoint==3) v_putcad(2,12,0xffffff,TEXTBACK,"> Daemon");
-    else v_putcad(2,12,0xffff,COLORFONDO,"> Daemon");
-    v_putcad(2,17,0xffff00,COLORFONDO,"Information:");
-    sprintf(cad,"Sys.-Frq: %u Hz",sysfreq);
-    v_putcad(2,19,0xffffff,COLORFONDO,cad);
-    sprintf(cad,"UCLK-Frq:  %u Hz",get_freq_UCLK());
-    v_putcad(2,20,0xffffff,COLORFONDO,cad);
-    sprintf(cad,"ACLK-Frq: %u Hz",get_freq_ACLK());
-    v_putcad(2,21,0xffffff,COLORFONDO,cad);
-    gp2x_video_flip();
-
-    while(1)
-    {
-      gp2x_nKeys=gp2x_joystick_read();
-
-      if((gp2x_nKeys & GP2X_START))
-      {
-        while(1)
-        {
-          gp2x_nKeys=gp2x_joystick_read();
-          if(!(gp2x_nKeys & GP2X_START)) break;
-        }
-        exit_cpu_speed("gp2xmenu");
-        return 0;
-      }
-
-      if((gp2x_nKeys & GP2X_SELECT))
-      {
-        if (cpusettings[0] > -1)
-        {
-          set_FCLK(cpusettings[0]);
-          set_920_Div(cpusettings[1]);
-        }
-        if (ramsettings[0] > -1)
-        {
-          set_CAS(ramsettings[0]);
-          set_tRC(ramsettings[1]);
-          set_tRAS(ramsettings[2]);
-          set_tWR(ramsettings[3]);
-          set_tMRD(ramsettings[4]);
-          set_tRFC(ramsettings[5]);
-          set_tRP(ramsettings[6]);
-          set_tRCD(ramsettings[7]);
-          set_REFPERD(ramsettings[8]);
-          set_DCLK_Div(ramsettings[9]);
-        }
-        while(1)
-        {
-          gp2x_nKeys=gp2x_joystick_read();
-          if(!(gp2x_nKeys & GP2X_START)) break;
-        }
-        exit_cpu_speed("gp2xmenu");
-        return 0;
-      }
-
-      if((gp2x_nKeys & GP2X_DOWN))
-      {
-        mainmenupoint=mainmenupoint+1;
-        if(mainmenupoint>3) mainmenupoint=0;  
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_UP))
-      {
-        mainmenupoint=mainmenupoint-1;
-        if(mainmenupoint<0) mainmenupoint=3;  
-        delay_us(200000);
-        break;
-      }
-
-      if((gp2x_nKeys & GP2X_Y))
-      {
-        settings = fopen("./cpu_speed.cfg", "w");
-        if(cpusettings[0] > -1)
-        {
-          fprintf(settings,"CPU-Clock\n%u\n", cpusettings[0]);
-          fprintf(settings,"CPU-Div\n%i\n", cpusettings[1]+1);
-        }
-        if(dispsettings[0] > -1)
-        {
-          if(dispsettings[0] == 0) fprintf(settings,"FPLL\n%i\n", dispsettings[1]);
-          if(dispsettings[0] == 1) fprintf(settings,"UPLL\n%i\n", dispsettings[1]);
-        fprintf(settings,"Gamma\n%.2f\n", (float)(dispsettings[2]/100));
-        }
-        if(ramsettings[0] > -1)
-        {
-        fprintf(settings,"CAS\n%i\n", ramsettings[0]+2);
-        fprintf(settings,"tRC\n%i\n", ramsettings[1]+1);
-        fprintf(settings,"tRAS\n%i\n", ramsettings[2]+1);
-        fprintf(settings,"tWR\n%i\n", ramsettings[3]+1);
-        fprintf(settings,"tMRD\n%i\n", ramsettings[4]+1);
-        fprintf(settings,"tRFC\n%i\n", ramsettings[5]+1);
-        fprintf(settings,"tRP\n%i\n", ramsettings[6]+1);
-        fprintf(settings,"tRCD\n%i\n", ramsettings[7]+1);
-        fprintf(settings,"Refresh-Period\n%i\n", ramsettings[8]+1);
-        fprintf(settings,"RAM-Div\n%i\n", ramsettings[9]+1);
-        }
-        if(daemonsettings[0] > -1)
-        {
-            fprintf(settings,"Daemon-Min\n%i\n", daemonsettings[0]);
-            fprintf(settings,"Daemon-Max\n%i\n", daemonsettings[1]);
-            fprintf(settings,"Daemon-Step\n%i\n", daemonsettings[2]);
-            fprintf(settings,"Daemon-Delay\n%.1f\n", daemonsettings[3]/10.f);
-        
-            char test[256];
-            sprintf(test,"");
-            formatkey(test,daemonsettings[4]);
-            fprintf(settings,"Daemon-Hotkey\n%s\n",test);
-            sprintf(test,"");
-            formatkey(test,daemonsettings[5]);
-            fprintf(settings,"Daemon-Incr-Key\n%s\n",test);
-            sprintf(test,"");
-            formatkey(test,daemonsettings[6]);
-            fprintf(settings,"Daemon-Decr-Key\n%s\n",test);
-        
-            fprintf(settings,"Daemon-OSD\n%s\n",(daemonsettings[7]?"On":"Off"));
-            if(!access("/tmp/cpu_daemon.pid",R_OK))
-                fprintf(settings,"Daemon-Run\nOn\n");
-        
-        }
-        
-        
-        fclose(settings);
-        system("sync");
-        while(1)
-        {
-          gp2x_nKeys=gp2x_joystick_read();
-          if(!(gp2x_nKeys & GP2X_Y)) break;
-        } 
-        break;
-      }
-
-
-      if((gp2x_nKeys & GP2X_B))
-      {
-        if(mainmenupoint==0) cpumenu();
-        if(mainmenupoint==1) lcdmenu();
-        if(mainmenupoint==2) rammenu();
-        if(mainmenupoint==3) daemonmenu();
-        while(1)
-        {
-          gp2x_nKeys=gp2x_joystick_read();
-          if(!(gp2x_nKeys & GP2X_B)) break;
-        } 
-        break;
-      }
-    }
-  }
-  while(cpuspeed_exit == 0);  
-}
diff --git a/gp2x/cpuctrl.h b/gp2x/cpuctrl.h
deleted file mode 100644 (file)
index 13ffa26..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#if !defined(_CPUCTRL_)
-#define _CPUCTRL_
-
-void cpuctrl_init(); // call this at first
-
-void save_system_regs(); // save some registers
-void load_system_regs();
-
-void set_FCLK(unsigned MHZ); // adjust the clock frequency (in Mhz units)
-void set_add_ULCDCLK(int addclock);
-void set_add_FLCDCLK(int addclock);
-
-unsigned get_FCLK();
-unsigned get_freq_UCLK();
-unsigned get_freq_ACLK();
-unsigned get_freq_920_CLK();
-unsigned get_freq_940_CLK();
-unsigned get_freq_DCLK();
-unsigned get_LCDClk();
-char get_Clkgen();
-unsigned get_state940();
-
-void set_920_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-unsigned short get_920_Div();
-
-void set_940_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-unsigned short get_940_Div();
-
-void set_DCLK_Div(unsigned short div); /* 0 to 7 divider (freq=FCLK/(1+div)) */
-unsigned short get_DCLK_Div();
-
-unsigned short Disable_Int_920();
-unsigned short Disable_Int_940();
-
-void Enable_Int_920(unsigned short flag);
-void Enable_Int_940(unsigned short flag);
-
-void Disable_940(); // 940t down
-
-extern volatile unsigned  *arm940code; // memory address of 940t code
-
-void Load_940_code(unsigned *code,int size); // enable 940t, load 940t code  and clock 940t off
-
-void clock_940_off(); // 940t stops
-void clock_940_on();  // 940t running
-
-//Memory Timings
-unsigned get_CAS();    //CAS Latency
-unsigned get_tRC();    //ACTIVE to ACTIVE /AUTOREFRESH command delay
-unsigned get_tRAS();   //ACTIVE to PRECHARGE delay
-unsigned get_tWR();    //Write recovery time
-unsigned get_tMRD();   //LOAD MODE REGISTER command cycle time
-unsigned get_tRFC();   //AUTO REFRESH command period
-unsigned get_tRP();    //PRECHARGE command period
-unsigned get_tRCD();   //RAS to CAS Delay
-unsigned get_REFPERD();//Refresh Period
-
-void set_CAS();
-void set_tRC();
-void set_tRAS();
-void set_tWR();
-void set_tMRD();
-void set_tRFC();
-void set_tRP();
-void set_tRCD();
-void set_REFPERD();
-
-void set_gamma(float gamma);
-
-unsigned get_YBNKLVL();
-void set_YBNKLVL(unsigned short val);
-#endif
similarity index 99%
rename from gp2x/cpuctrl.c
rename to gp2x/cpuctrl_mmsp2.c
index ab165fc..60cd6dc 100644 (file)
 // CPU CONTROL
 /****************************************************************************************************************************************/
 
-#include <sys/mman.h>
+//#include <sys/mman.h>
 #include <math.h>
 #include <stdio.h>
-#include "gp2xminilib.h"
+//#include "gp2xminilib.h"
 
 #define SYS_CLK_FREQ 7372800
 
 //from minimal library rlyeh
 
-extern unsigned long   gp2x_dev[4];
+//extern unsigned long   gp2x_dev[4];
 extern unsigned short *gp2x_memregs;
 
 // system registers
@@ -117,6 +117,7 @@ unsigned get_FCLK()
        return MEM_REG[0x910>>1];
 }
 
+#if 0
 void set_add_FLCDCLK(int addclock)
 {
        //Set LCD controller to use FPLL
@@ -320,6 +321,7 @@ void clock_940_on()
 {
        MEM_REG[0x904>>1]|=1;
 }
+#endif
 
 
 //--------------
diff --git a/gp2x/daemon.c b/gp2x/daemon.c
deleted file mode 100644 (file)
index 11b42b4..0000000
+++ /dev/null
@@ -1,671 +0,0 @@
-/*  daemon.c for GP2X Version 2.0
-    Copyright (C) 2006 jannis harder 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-*/
-
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <pthread.h>
-
-#include "gp2xminilib.h"
-#include "cpuctrl.h"
-#include "display.h"
-
-#include "daemon.h"
-
-
-extern unsigned COLORFONDO; // background-color
-extern unsigned WHITE;
-extern unsigned TEXTBACK;
-
-extern unsigned char cad[256];
-
-extern unsigned short *gp2x_memregs;
-extern pthread_t       gp2x_sound_thread;
-
-int start_daemon(
-        unsigned int minimal_cpu_speed, unsigned int maximal_cpu_speed, unsigned int start_cpu_speed, int cpu_speed_step,
-        unsigned long hotkey, unsigned long incrementkey, unsigned long decrementkey,
-        int speed_display, int foreground,
-        unsigned long delay)
-{
-    pid_t pid, sid;
-    
-    if(!foreground) {
-        kill_running_daemon();
-    
-    
-        FILE * pidfile = fopen("/tmp/cpu_daemon.pid","w");
-    
-        if(!pidfile) {
-            printf("couldn't write pidfile\r\n");
-            exit(-2);
-        }
-    
-        pid = fork();
-        
-        if(pid > 0) {
-            fprintf(pidfile,"%i\n",pid);
-            fclose(pidfile);
-        }
-        if(pid != 0)
-            return pid;
-
-    
-        fclose(pidfile);
-    
-        umask(0);
-        sid = setsid();
-    
-    
-        close(STDIN_FILENO);
-        close(STDOUT_FILENO);
-        close(STDERR_FILENO);
-    }
-    
-    if(foreground)
-        printf("daemon ready\r\n");
-    
-    nano_setup(); // loading the full minilib would be overkill and i guess some games/emus wouldn't like it
-    
-    
-    unsigned int current_cpu_speed = start_cpu_speed;
-    
-    while(1) {
-        usleep(delay);
-        unsigned long keystate = gp2x_joystick_read();
-        
-        unsigned int last_cpu_speed = 0;
-            
-        while(
-            (hotkey && (keystate & hotkey) == hotkey) ||
-            ((!hotkey) && (
-                (incrementkey && (keystate & incrementkey) == incrementkey) || 
-                (decrementkey && (keystate & decrementkey) == decrementkey)
-            ))
-        ) {
-            if(foreground && !last_cpu_speed)
-                printf("cpu daemon activated!\r\n");
-                
-            if(incrementkey && (keystate & incrementkey) == incrementkey) {
-                current_cpu_speed += cpu_speed_step;
-                while((keystate & incrementkey) == incrementkey) usleep(100000),keystate = gp2x_joystick_read();
-            }
-            else if(decrementkey && (keystate & decrementkey) == decrementkey) {
-                current_cpu_speed -= cpu_speed_step;
-                while((keystate & decrementkey) == decrementkey) usleep(100000),keystate = gp2x_joystick_read();
-            }
-            
-            if(current_cpu_speed < minimal_cpu_speed)
-                current_cpu_speed = minimal_cpu_speed;
-            if(current_cpu_speed > maximal_cpu_speed)
-                current_cpu_speed = maximal_cpu_speed;
-                
-
-            
-            if(last_cpu_speed != current_cpu_speed) {
-                set_FCLK(current_cpu_speed);
-            }
-            last_cpu_speed = current_cpu_speed;
-            keystate = gp2x_joystick_read();
-        }
-
-    }
-    
-}
-
-int kill_running_daemon() {
-    
-    FILE * pidfile = fopen("/tmp/cpu_daemon.pid","r");
-    char pid_buffer[14];
-    pid_buffer[0] = 'k';
-    pid_buffer[1] = 'i';
-    pid_buffer[2] = 'l';
-    pid_buffer[3] = 'l';
-    pid_buffer[4] = ' ';
-    pid_buffer[5] = 0;
-    if(pidfile) {
-        printf("found pidfile\r\n");
-        fgets(&(pid_buffer[5]),10,pidfile);
-        fclose(pidfile);
-        int return_code = system(pid_buffer);
-        if(return_code) 
-            printf("daemon wasn't running\r\n");
-        else
-            printf("killed old daemon\r\n");
-        unlink("/tmp/cpu_daemon.pid");
-        return 1;
-    }
-    return 0;
-}
-
-
-void nano_setup() {
-    if(!gp2x_sound_thread) {
-        gp2x_memregs=(unsigned short *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, open("/dev/mem", O_RDWR), 0xc0000000);
-        cpuctrl_init();
-    }
-}
-
-void cmd_daemon(int argc, char *argv[]) {
-    
-    int cpu_div = get_920_Div();
-       int sysfreq=get_freq_920_CLK();
-       sysfreq*=cpu_div+1;
-       int cpufreq=sysfreq/1000000;
-    
-    unsigned int minimal_value = 33;
-    unsigned int maximal_value = 260;
-    unsigned int start_value = cpufreq;
-    unsigned int step = 10;
-    unsigned long hotkey = GP2X_L | GP2X_R;
-    unsigned long downkey = GP2X_VOL_UP;
-    unsigned long upkey = GP2X_VOL_DOWN;
-    int foreground = 0;
-    int display = 1;
-    float delay = 1;
-    
-    int i;
-    for( i = 2; i < argc; i++) {
-        if(!strcmp(argv[i],"--min")) {
-            if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-            minimal_value = atoi(argv[i+1]);
-            if(minimal_value < 33)
-                minimal_value = 33;
-        }
-        else if(!strcmp(argv[i],"--max")) {
-            if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-            maximal_value = atoi(argv[i+1]);
-            if(maximal_value > 340)
-                maximal_value = 340;
-        }
-        else if(!strcmp(argv[i],"--start")) {
-            if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-            start_value = atoi(argv[i+1]);
-        }
-        else if(!strcmp(argv[i],"--step")) {
-            if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-            step = atoi(argv[i+1]);
-        }
-        else if(!strcmp(argv[i],"--hotkey")) {
-            if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-            hotkey = parse_key_sequence(argv[i+1]);
-        }
-        else if(!strcmp(argv[i],"--incr")) {
-            if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-            upkey = parse_key_sequence(argv[i+1]);
-        }
-        else if(!strcmp(argv[i],"--decr")) {
-            if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-            downkey = parse_key_sequence(argv[i+1]);
-        }
-        else if(!strcmp(argv[i],"--delay")) {
-            if(i+1 == argc){printf ("%s is missing it's parameter\r\n",argv[i]);gp2x_deinit();exit(1);}
-            delay = atof(argv[i+1]);
-        }
-        else if(!strcmp(argv[i],"--no-incr")) {
-            upkey = 0;
-        }
-        else if(!strcmp(argv[i],"--no-decr")) {
-            downkey = 0;
-        }
-        else if(!strcmp(argv[i],"--no-hotkey")) {
-            hotkey = 0;
-        }
-        else if(!strcmp(argv[i],"--foreground")) {
-            foreground = 1;
-        }
-        else if(!strcmp(argv[i],"--background")) {
-            foreground = 0;
-        }
-        else if(!strcmp(argv[i],"--display")) {
-            display = 1;
-        }
-        else if(!strcmp(argv[i],"--no-display")) {
-            display = 0;
-        }
-    }
-    
-    if((hotkey & downkey) == downkey)
-        printf("warning: hotkey includes decrement keypress!\r\n");
-    if((hotkey & upkey) == upkey)
-        printf("warning: hotkey includes increment keypress!\r\n");
-    
-    int pid = start_daemon(minimal_value, maximal_value, start_value, step, hotkey, upkey, downkey, display, foreground, delay* 1000000);
-    
-        if(pid < 0) {
-            printf("couldn't start daemon\r\n");
-            exit(1);
-        }
-        else if(pid > 0) {
-            printf("daemon started\r\n");
-            exit(0);
-        }
-}
-
-unsigned long parse_key_sequence(char *key_sequence) {
-    unsigned long hotkey = 0;
-    if(!strcmp(key_sequence,"None"))
-        return 0;
-    char *mask = key_sequence;
-    while(*mask) {
-        switch(*mask) {
-        case 'l':
-        case 'L':
-            hotkey |= GP2X_L;
-            break;
-        case 'r':
-        case 'R':
-            hotkey |= GP2X_R;
-            break;
-        case 'a':
-        case 'A':
-            hotkey |= GP2X_A;
-            break;
-        case 'b':
-        case 'B':
-            hotkey |= GP2X_B;
-            break;
-        case 'x':
-        case 'X':
-            hotkey |= GP2X_X;
-            break;
-        case 'y':
-        case 'Y':
-            hotkey |= GP2X_Y;
-            break;
-        case '+':
-            hotkey |= GP2X_VOL_DOWN;
-            break;
-        case '-':
-            hotkey |= GP2X_VOL_UP;
-            break;
-        case 'S':
-        case 's':
-            hotkey |= GP2X_START;
-            break;
-        case '/':
-            hotkey |= GP2X_SELECT;
-            break;
-        case '@':
-            hotkey |= GP2X_PUSH;
-            break;
-        case '\n':
-            break;
-        default:
-            printf("unknown key %c\r\n",*mask);
-        }
-        mask++;
-    }
-    return hotkey;
-}
-
-int daemonsettings[8];
-
-
-void cleardisp();
-
-
-void formatkey(char * base, unsigned long keyseq) {
-    
-    if(!keyseq)
-        strcat(base,"None");
-        
-    if(keyseq & GP2X_L)
-        strcat(base,"L");
-    if(keyseq & GP2X_R)    
-        strcat(base,"R");
-    if(keyseq & GP2X_A)    
-        strcat(base,"A");
-    if(keyseq & GP2X_B)    
-        strcat(base,"B");
-    if(keyseq & GP2X_X)    
-        strcat(base,"X");
-    if(keyseq & GP2X_Y)    
-        strcat(base,"Y");
-    if(keyseq & GP2X_VOL_DOWN)
-        strcat(base,"+");
-    if(keyseq & GP2X_VOL_UP)  
-        strcat(base,"-");
-    if(keyseq & GP2X_START)
-        strcat(base,"S");
-    if(keyseq & GP2X_SELECT)
-        strcat(base,"/");
-    if(keyseq & GP2X_PUSH)
-        strcat(base,"@");
-}
-
-
-
-#define VALID_KEYS ((GP2X_L) | (GP2X_R) | (GP2X_X) | (GP2X_Y) | (GP2X_A) | (GP2X_B) | (GP2X_START) | (GP2X_SELECT) | (GP2X_VOL_UP) | (GP2X_VOL_DOWN) | (GP2X_PUSH) )
-
-int running;
-
-void daemon_itemhelp(int menuitem)
-{
-       switch(menuitem) {
-       case 0:
-               v_putcad(26,8,0xffffff,COLORFONDO,"Choose a");
-               v_putcad(26,9,0xffffff,COLORFONDO,"minimal");
-               v_putcad(26,10,0xffffff,COLORFONDO,"clockspeed");
-               v_putcad(26,11,0xffffff,COLORFONDO,"with R/L or");
-               v_putcad(26,12,0xffffff,COLORFONDO,"Vol UP/Down.");
-               v_putcad(26,14,0xffffff,COLORFONDO,"Valid speeds");
-               v_putcad(26,15,0xffffff,COLORFONDO,"are:");
-               v_putcad(26,16,0xffffff,COLORFONDO,"33 to 340Mhz");
-           break;
-       case 1:
-               v_putcad(26,8,0xffffff,COLORFONDO,"Choose a");
-               v_putcad(26,9,0xffffff,COLORFONDO,"maximal");
-               v_putcad(26,10,0xffffff,COLORFONDO,"clockspeed");
-               v_putcad(26,11,0xffffff,COLORFONDO,"with R/L or");
-               v_putcad(26,12,0xffffff,COLORFONDO,"Vol UP/Down.");
-               v_putcad(26,14,0xffffff,COLORFONDO,"Valid speeds");
-               v_putcad(26,15,0xffffff,COLORFONDO,"are:");
-               v_putcad(26,16,0xffffff,COLORFONDO,"33 to 340Mhz");
-           break;
-       case 2:
-               v_putcad(26,8,0xffffff,COLORFONDO,"Choose a step");
-               v_putcad(26,9,0xffffff,COLORFONDO,"width for");
-               v_putcad(26,10,0xffffff,COLORFONDO,"changing the");
-               v_putcad(26,11,0xffffff,COLORFONDO,"clockspeed.");
-               v_putcad(26,13,0xffffff,COLORFONDO,"Use R/L or");
-               v_putcad(26,14,0xffffff,COLORFONDO,"Vol UP/Down.");
-               break;
-    case 3:
-               v_putcad(26,8,0xffffff,COLORFONDO,"Choose a");
-               v_putcad(26,9,0xffffff,COLORFONDO,"delay between");
-               v_putcad(26,10,0xffffff,COLORFONDO,"each hotkey");
-               v_putcad(26,11,0xffffff,COLORFONDO,"check");
-               v_putcad(26,13,0xffffff,COLORFONDO,"Use R/L or");
-               v_putcad(26,14,0xffffff,COLORFONDO,"Vol UP/Down.");
-               break;
-    case 4:
-               v_putcad(26,8,0xffffff,COLORFONDO,"Choose a");
-               v_putcad(26,9,0xffffff,COLORFONDO,"hotkey.");
-               v_putcad(26,10,0xffffff,COLORFONDO,"Add or delete");
-               v_putcad(26,11,0xffffff,COLORFONDO,"a button by");
-               v_putcad(26,12,0xffffff,COLORFONDO,"pressing it.");
-               v_putcad(26,14,0x0000DD,COLORFONDO,"Joystick is");
-               v_putcad(26,15,0x0000DD,COLORFONDO,"not allowed.");
-               break;
-    case 5:
-               v_putcad(26,8,0xffffff,COLORFONDO,"Choose a");
-               v_putcad(26,9,0xffffff,COLORFONDO,"key for");
-               v_putcad(26,10,0xffffff,COLORFONDO,"incrementing");
-               v_putcad(26,11,0xffffff,COLORFONDO,"the clkspeed.");
-               v_putcad(26,12,0xffffff,COLORFONDO,"Add or delete");
-               v_putcad(26,13,0xffffff,COLORFONDO,"a button by");
-               v_putcad(26,14,0xffffff,COLORFONDO,"pressing it.");
-               v_putcad(26,16,0x0000DD,COLORFONDO,"Joystick is");
-               v_putcad(26,17,0x0000DD,COLORFONDO,"not allowed.");
-               break;
-    case 6:
-               v_putcad(26,8,0xffffff,COLORFONDO,"Choose a");
-               v_putcad(26,9,0xffffff,COLORFONDO,"key for");
-               v_putcad(26,10,0xffffff,COLORFONDO,"decrementing");
-               v_putcad(26,11,0xffffff,COLORFONDO,"the clkspeed.");
-               v_putcad(26,12,0xffffff,COLORFONDO,"Add or delete");
-               v_putcad(26,13,0xffffff,COLORFONDO,"a button by");
-               v_putcad(26,14,0xffffff,COLORFONDO,"pressing it.");
-               v_putcad(26,16,0x0000DD,COLORFONDO,"Joystick is");
-               v_putcad(26,17,0x0000DD,COLORFONDO,"not allowed.");
-               break;
-    case 7:
-       /*      v_putcad(26,8,0xffffff,COLORFONDO,"Enable or");
-               v_putcad(26,9,0xffffff,COLORFONDO,"disable");
-               v_putcad(26,10,0xffffff,COLORFONDO,"on screen");
-               v_putcad(26,11,0xffffff,COLORFONDO,"display.");
-               v_putcad(26,13,0x0000DD,COLORFONDO,"May cause");
-               v_putcad(26,14,0x0000DD,COLORFONDO,"conflicts");
-               v_putcad(26,15,0x0000DD,COLORFONDO,"with");
-               v_putcad(26,16,0x0000DD,COLORFONDO,"some apps!");*/
-               v_putcad(26,8,0x0000DD,COLORFONDO,"COMING SOON");
-               break;
-    case 8:
-        if(running) {
-                   v_putcad(26,8,0xffffff,COLORFONDO,"Press B to");
-                   v_putcad(26,9,0xffffff,COLORFONDO,"kill the");
-                   v_putcad(26,10,0xffffff,COLORFONDO,"running");
-                   v_putcad(26,11,0xffffff,COLORFONDO,"daemon");
-                   v_putcad(26,12,0xffffff,COLORFONDO,"process.");
-           }
-           else {
-               v_putcad(26,8,0xffffff,COLORFONDO,"Press B to");
-                   v_putcad(26,9,0xffffff,COLORFONDO,"start the ");
-                   v_putcad(26,10,0xffffff,COLORFONDO,"daemon in the");
-                   v_putcad(26,11,0xffffff,COLORFONDO, "background.");
-           }
-               break;
-       }
-}
-
-void daemonmenu() {
-    
-    int menupoint = 0;
-    running = !access("/tmp/cpu_daemon.pid",R_OK);
-
-    
-    unsigned long gp2x_nKeys;
-    while(1) {
-        
-               if(daemonsettings[0] < 33)
-                           daemonsettings[0] = 33;
-                       if(daemonsettings[1] > 340)
-                           daemonsettings[1] = 340;
-                       if(daemonsettings[1] < daemonsettings[0])
-                           daemonsettings[1] = daemonsettings[0];
-                       if(daemonsettings[0] > daemonsettings[1])
-                           daemonsettings[0] = daemonsettings[1];
-                       if(daemonsettings[2] < 1)
-                           daemonsettings[2] = 1;
-                       if(daemonsettings[3] < 1)
-                           daemonsettings[3] = 1;
-                       //if(daemonsettings[7] == 10 || daemonsettings[7] == -10)
-                        //   daemonsettings[7] = 1;
-                       //if(daemonsettings[7] == 11 || daemonsettings[7] == -9)
-                           daemonsettings[7] = 0;
-        
-            
-        
-        cleardisp();
-        v_putcad(13,2,WHITE,COLORFONDO,"Daemon Setup");
-        
-        v_putcad(2,5,0xffff00,COLORFONDO,"CPU Clockspeed:");
-        
-        sprintf(cad,"From: %huMhz",daemonsettings[0]);
-        
-        v_putcad(2,7,0xffff,COLORFONDO,cad);
-        if(menupoint == 0)
-            v_putcad(2,7,0xffff,TEXTBACK,cad);
-            
-        sprintf(cad,"To: %huMhz",daemonsettings[1]);
-        
-        v_putcad(2,8,0xffff,COLORFONDO,cad);
-        if(menupoint == 1)
-            v_putcad(2,8,0xffff,TEXTBACK,cad);
-        
-        sprintf(cad,"Step: %huMhz",daemonsettings[2]);
-        
-        v_putcad(2,9,0xffff,COLORFONDO,cad);
-        if(menupoint == 2)
-            v_putcad(2,9,0xffff,TEXTBACK,cad);
-            
-            
-        v_putcad(2,11,0xffff00,COLORFONDO,"Buttons:");
-            
-        sprintf(cad,"Delay: %0.1fsec",daemonsettings[3]/10.0f);
-        
-        v_putcad(2,13,0xffff,COLORFONDO,cad);
-        if(menupoint == 3)
-            v_putcad(2,13,0xffff,TEXTBACK,cad);
-            
-        sprintf(cad,"Hotkey: ");
-        
-        formatkey(cad,daemonsettings[4]);
-        
-        v_putcad(2,15,0xffff,COLORFONDO,cad);
-        if(menupoint == 4)
-            v_putcad(2,15,0xffff,TEXTBACK,cad);
-        
-        
-        sprintf(cad,"IncrKey: ");
-        
-        formatkey(cad,daemonsettings[5]);
-        
-        v_putcad(2,16,0xffff,COLORFONDO,cad);
-        if(menupoint == 5)
-            v_putcad(2,16,0xffff,TEXTBACK,cad);
-        
-        sprintf(cad,"DecrKey: ");
-        
-        formatkey(cad,daemonsettings[6]);
-        
-        v_putcad(2,17,0xffff,COLORFONDO,cad);
-        if(menupoint == 6)
-            v_putcad(2,17,0xffff,TEXTBACK,cad);
-        
-        if(menupoint >= 4 && menupoint <=6)
-            v_putcad(2,26,WHITE,COLORFONDO,"---------- Stick:UP/DOWN");
-        
-        v_putcad(2,19,0xffff00,COLORFONDO,"Misc:");
-        
-        
-        v_putcad(2,21,0xffff,COLORFONDO,(daemonsettings[7] ? "On Screen Display: On" : "On Screen Display: Off"));
-        if(menupoint == 7)
-            v_putcad(2,21,0xffff,TEXTBACK,(daemonsettings[7] ? "On Screen Display: On" : "On Screen Display: Off"));
-        
-
-        v_putcad(2,23,0xffff,COLORFONDO,(running ? "Kill Running Daemon" : "Start Daemon"));
-        if(menupoint == 8)
-            v_putcad(2,23,0xffff,TEXTBACK,(running ? "Kill Running Daemon" : "Start Daemon"));
-
-        
-        
-        daemon_itemhelp(menupoint);
-        
-        gp2x_video_flip();
-        while(1)
-               {
-                       gp2x_nKeys=gp2x_joystick_read();
-
-                       
-                       
-                       if((gp2x_nKeys & GP2X_DOWN)) 
-                       {
-                               menupoint++; 
-                               if(menupoint>8) menupoint=0;
-                               usleep(200000);
-                               break;
-                       }
-
-                       if((gp2x_nKeys & GP2X_UP)) 
-                       { 
-                               menupoint--; 
-                               if(menupoint<0) menupoint=8;
-                               usleep(200000);
-                               break;
-                       }
-                       
-                       if((menupoint >= 4) && (menupoint <= 6) && (gp2x_nKeys & VALID_KEYS))
-                       {
-                           daemonsettings[menupoint] ^= (gp2x_nKeys & VALID_KEYS);
-                           usleep(200000);  
-                           break;
-                       }
-                       
-                       if(menupoint < 8 &&(gp2x_nKeys & GP2X_R))
-                       {
-                           daemonsettings[menupoint] += 10;
-                           usleep(200000);
-                           break;
-                       }
-                       
-                       if(menupoint < 4 && (gp2x_nKeys & GP2X_VOL_UP))
-                       {
-                           daemonsettings[menupoint] -= 1;
-                           usleep(200000); 
-                           break;
-                       }
-                       
-                       if(menupoint < 4 && (gp2x_nKeys & GP2X_VOL_DOWN))
-                       {
-                           daemonsettings[menupoint] += 1;
-                           usleep(200000); 
-                           break;
-                       }
-                       
-                       if(menupoint < 8 && (gp2x_nKeys & GP2X_L))
-                       {
-                           daemonsettings[menupoint] -= 10;
-                           usleep(200000);
-                           break;
-                       }
-                       if(menupoint == 8 && (gp2x_nKeys & GP2X_B))
-                       {
-                           if(running)
-                               kill_running_daemon();
-                           else {
-                               int cpu_div = get_920_Div();
-                       int sysfreq=get_freq_920_CLK();
-                    sysfreq*=cpu_div+1;
-                       int cpufreq=sysfreq/1000000;
-                       
-                               start_daemon_by_settings();
-                           }
-                           usleep(200000);
-                               running = !access("/tmp/cpu_daemon.pid",R_OK);
-                               break; 
-                       }
-
-                       
-                       if((gp2x_nKeys & GP2X_START)) 
-                       {
-                               while(1)
-                               {
-                                       gp2x_nKeys=gp2x_joystick_read();
-                                       if(!(gp2x_nKeys & GP2X_START)) break;
-                               }
-                               
-                               if(running) { // update values!
-                                   start_daemon_by_settings();
-                               }
-                               
-                               
-                               return;
-                       }
-                       
-               }
-    }
-}
-
-void start_daemon_by_settings() {
-    int cpu_div = get_920_Div();
-    int sysfreq=get_freq_920_CLK();
-    sysfreq*=cpu_div+1;
-    int cpufreq=sysfreq/1000000;
-    
-    start_daemon(daemonsettings[0], daemonsettings[1], cpufreq, daemonsettings[2], daemonsettings[4], daemonsettings[5],
-                    daemonsettings[6], daemonsettings[7], 0, daemonsettings[3] * 100000);
-}
diff --git a/gp2x/daemon.h b/gp2x/daemon.h
deleted file mode 100644 (file)
index 18fbf4e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-int start_daemon(
-        unsigned int minimal_cpu_speed, unsigned int maximal_cpu_speed, unsigned int start_cpu_speed, int cpu_speed_step,
-        unsigned long hotkey, unsigned long incrementkey, unsigned long decrmentkey,
-        int speed_display, int foreground,
-        unsigned long delay);
-        
-int kill_running_daemon();
-
-void nano_setup();
-void cmd_daemon(int argc, char *argv[]);
-
-unsigned long parse_key_sequence(char *key_sequence);
-
-void daemonmenu();
-
-void formatkey(char * base, unsigned long keyseq);
-
-void start_daemon_by_settings();
diff --git a/gp2x/display.c b/gp2x/display.c
deleted file mode 100644 (file)
index 82eb31c..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*  display.c for GP2X (CPU/LCD/RAM-Tuner Version 2.0)
-    Copyright (C) 2006 god_at_hell 
-    original CPU-Overclocker (c) by Hermes/PS2Reality 
-       parts (c) Rlyehs Work
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-*/
-
-#include <stdio.h>
-#include <sys/mman.h>
-#include <fcntl.h>
-#include <math.h>
-#include <unistd.h>
-
-#include "gp2xminilib.h"
-#include "cpuctrl.h"
-#define WIDTH  320
-#define HEIGHT 240
-
-//unsigned TEXTBACK=0x900000; // text-background-color
-
-extern unsigned char msx[];  // define la fuente externa usada para dibujar letras y numeros 
-
-void ClearScreen(unsigned val) // se usa para 'borrar' la pantalla virtual con un color
-{
-       int n;
-       unsigned char *c;
-       unsigned short col;
-       c=&val;
-       col=gp2x_video_color15(c[0],c[1],c[2],0);
-       for(n=0;n<320*240;n++)
-       {
-               gp2x_screen15[n]=col;
-       }
-}
-
-void DrawBox(unsigned val)
-{
-       int n;
-       unsigned char *c;
-       unsigned short col;
-       c=&val;
-       col=gp2x_video_color15(c[0],c[1],c[2],0);
-       
-       for(n=320*27+2;n<320*28-1;n++)
-       {
-               gp2x_screen15[n]=col;
-               gp2x_screen15[n+320*209]=col;
-       }
-       
-       for(n=320*29+4;n<320*30-3;n++)
-       {
-               gp2x_screen15[n]=col;
-               gp2x_screen15[n+320*169]=col;
-               gp2x_screen15[n+320*205]=col;
-       }
-       
-       for(n=320*28;n<320*237;n=n+320)
-       {
-               gp2x_screen15[n+2]=col;
-               gp2x_screen15[n-2]=col;
-       }
-       
-       for(n=320*30;n<320*235;n=n+320)
-       {
-               gp2x_screen15[n+4]=col;
-               gp2x_screen15[n-4]=col;
-       }
-       
-       for(n=320*30;n<320*199;n=n+320)
-       {
-               gp2x_screen15[n-120]=col;
-       }
-       
-       for(n=320*55-120;n<320*55-4;n++)
-       {
-               gp2x_screen15[n]=col;
-       }
-       
-}
-
-void v_putchar( unsigned x, unsigned y, unsigned color, unsigned textback, unsigned char ch) // rutina usada para dibujar caracteres (coordenadas de 8x8)
-{
-       int i,j,v;
-       unsigned char   *font;
-       unsigned char *c;
-       unsigned short col,col2;
-       if(x>=WIDTH || y>=HEIGHT) return;
-       c=&color;
-       col=gp2x_video_color15(c[0],c[1],c[2],0);
-       c=&textback;
-       col2=gp2x_video_color15(c[0],c[1],c[2],0);
-       v=(y*320*8);
-       font = &msx[ (int)ch * 8];
-       for (i=0; i < 8; i++, font++)
-       {  
-               for (j=0; j < 8; j++)
-               {
-                       if ((*font & (128 >> j)))
-                       { 
-                               gp2x_screen15[v+(((x<<3)+j))]=col;
-                       }
-                       else gp2x_screen15[v+(((x<<3)+j))]=col2;
-               }
-               v+=WIDTH;
-       }
-}
-
-// display array of chars
-
-void v_putcad(int x,int y,unsigned color,unsigned textback,char *cad)  // dibuja una cadena de texto
-{      
-       while(cad[0]!=0) {v_putchar(x,y,color,textback,cad[0]);cad++;x++;}
-}
-
-
-void gp2x_sound_frame(void *unused, unsigned char *stream, int samples)
-{
-       int n;
-       short *pu;
-       pu=stream;
-       for(n=0;n<(samples);n++)
-       {
-               *pu++=0;*pu++=0;
-       }
-}
diff --git a/gp2x/display.h b/gp2x/display.h
deleted file mode 100644 (file)
index c037480..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-void ClearScreen(unsigned val);
-void DrawBox(unsigned val);
-void v_putchar( unsigned x, unsigned y, unsigned color, unsigned textback, unsigned char ch);
-void v_putcad(int x,int y,unsigned color,unsigned textback,char *cad);
-void gp2x_sound_frame(void *unused, unsigned char *stream, int samples);
diff --git a/gp2x/font.c b/gp2x/font.c
deleted file mode 100644 (file)
index e0d776b..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*      
-  _____     ___ ____ 
-   ____|   |    ____|      PSX2 OpenSource Project
-  |     ___|   |____       (C)2001, Gustavo Scotti (gustavo@scotti.com)
-  ------------------------------------------------------------------------
-  font.c
-                       EE UGLY DEBUG ON SCREEN - FONT BASE
-                        This is mostly based on Duke's work
-*/
-//#include <tamtypes.h>
-
-unsigned char msx[]=
-"\x00\x00\x00\x00\x00\x00\x00\x00\x3c\x42\xa5\x81\xa5\x99\x42\x3c"
-"\x3c\x7e\xdb\xff\xff\xdb\x66\x3c\x6c\xfe\xfe\xfe\x7c\x38\x10\x00"
-"\x10\x38\x7c\xfe\x7c\x38\x10\x00\x10\x38\x54\xfe\x54\x10\x38\x00"
-"\x10\x38\x7c\xfe\xfe\x10\x38\x00\x00\x00\x00\x30\x30\x00\x00\x00"
-"\xff\xff\xff\xe7\xe7\xff\xff\xff\x38\x44\x82\x82\x82\x44\x38\x00"
-"\xc7\xbb\x7d\x7d\x7d\xbb\xc7\xff\x0f\x03\x05\x79\x88\x88\x88\x70"
-"\x38\x44\x44\x44\x38\x10\x7c\x10\x30\x28\x24\x24\x28\x20\xe0\xc0"
-"\x3c\x24\x3c\x24\x24\xe4\xdc\x18\x10\x54\x38\xee\x38\x54\x10\x00"
-"\x10\x10\x10\x7c\x10\x10\x10\x10\x10\x10\x10\xff\x00\x00\x00\x00"
-"\x00\x00\x00\xff\x10\x10\x10\x10\x10\x10\x10\xf0\x10\x10\x10\x10"
-"\x10\x10\x10\x1f\x10\x10\x10\x10\x10\x10\x10\xff\x10\x10\x10\x10"
-"\x10\x10\x10\x10\x10\x10\x10\x10\x00\x00\x00\xff\x00\x00\x00\x00"
-"\x00\x00\x00\x1f\x10\x10\x10\x10\x00\x00\x00\xf0\x10\x10\x10\x10"
-"\x10\x10\x10\x1f\x00\x00\x00\x00\x10\x10\x10\xf0\x00\x00\x00\x00"
-"\x81\x42\x24\x18\x18\x24\x42\x81\x01\x02\x04\x08\x10\x20\x40\x80"
-"\x80\x40\x20\x10\x08\x04\x02\x01\x00\x10\x10\xff\x10\x10\x00\x00"
-"\x00\x00\x00\x00\x00\x00\x00\x00\x20\x20\x20\x20\x00\x00\x20\x00"
-"\x50\x50\x50\x00\x00\x00\x00\x00\x50\x50\xf8\x50\xf8\x50\x50\x00"
-"\x20\x78\xa0\x70\x28\xf0\x20\x00\xc0\xc8\x10\x20\x40\x98\x18\x00"
-"\x40\xa0\x40\xa8\x90\x98\x60\x00\x10\x20\x40\x00\x00\x00\x00\x00"
-"\x10\x20\x40\x40\x40\x20\x10\x00\x40\x20\x10\x10\x10\x20\x40\x00"
-"\x20\xa8\x70\x20\x70\xa8\x20\x00\x00\x20\x20\xf8\x20\x20\x00\x00"
-"\x00\x00\x00\x00\x00\x20\x20\x40\x00\x00\x00\x78\x00\x00\x00\x00"
-"\x00\x00\x00\x00\x00\x60\x60\x00\x00\x00\x08\x10\x20\x40\x80\x00"
-"\x70\x88\x98\xa8\xc8\x88\x70\x00\x20\x60\xa0\x20\x20\x20\xf8\x00"
-"\x70\x88\x08\x10\x60\x80\xf8\x00\x70\x88\x08\x30\x08\x88\x70\x00"
-"\x10\x30\x50\x90\xf8\x10\x10\x00\xf8\x80\xe0\x10\x08\x10\xe0\x00"
-"\x30\x40\x80\xf0\x88\x88\x70\x00\xf8\x88\x10\x20\x20\x20\x20\x00"
-"\x70\x88\x88\x70\x88\x88\x70\x00\x70\x88\x88\x78\x08\x10\x60\x00"
-"\x00\x00\x20\x00\x00\x20\x00\x00\x00\x00\x20\x00\x00\x20\x20\x40"
-"\x18\x30\x60\xc0\x60\x30\x18\x00\x00\x00\xf8\x00\xf8\x00\x00\x00"
-"\xc0\x60\x30\x18\x30\x60\xc0\x00\x70\x88\x08\x10\x20\x00\x20\x00"
-"\x70\x88\x08\x68\xa8\xa8\x70\x00\x20\x50\x88\x88\xf8\x88\x88\x00"
-"\xf0\x48\x48\x70\x48\x48\xf0\x00\x30\x48\x80\x80\x80\x48\x30\x00"
-"\xe0\x50\x48\x48\x48\x50\xe0\x00\xf8\x80\x80\xf0\x80\x80\xf8\x00"
-"\xf8\x80\x80\xf0\x80\x80\x80\x00\x70\x88\x80\xb8\x88\x88\x70\x00"
-"\x88\x88\x88\xf8\x88\x88\x88\x00\x70\x20\x20\x20\x20\x20\x70\x00"
-"\x38\x10\x10\x10\x90\x90\x60\x00\x88\x90\xa0\xc0\xa0\x90\x88\x00"
-"\x80\x80\x80\x80\x80\x80\xf8\x00\x88\xd8\xa8\xa8\x88\x88\x88\x00"
-"\x88\xc8\xc8\xa8\x98\x98\x88\x00\x70\x88\x88\x88\x88\x88\x70\x00"
-"\xf0\x88\x88\xf0\x80\x80\x80\x00\x70\x88\x88\x88\xa8\x90\x68\x00"
-"\xf0\x88\x88\xf0\xa0\x90\x88\x00\x70\x88\x80\x70\x08\x88\x70\x00"
-"\xf8\x20\x20\x20\x20\x20\x20\x00\x88\x88\x88\x88\x88\x88\x70\x00"
-"\x88\x88\x88\x88\x50\x50\x20\x00\x88\x88\x88\xa8\xa8\xd8\x88\x00"
-"\x88\x88\x50\x20\x50\x88\x88\x00\x88\x88\x88\x70\x20\x20\x20\x00"
-"\xf8\x08\x10\x20\x40\x80\xf8\x00\x70\x40\x40\x40\x40\x40\x70\x00"
-"\x00\x00\x80\x40\x20\x10\x08\x00\x70\x10\x10\x10\x10\x10\x70\x00"
-"\x20\x50\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\x00"
-"\x40\x20\x10\x00\x00\x00\x00\x00\x00\x00\x70\x08\x78\x88\x78\x00"
-"\x80\x80\xb0\xc8\x88\xc8\xb0\x00\x00\x00\x70\x88\x80\x88\x70\x00"
-"\x08\x08\x68\x98\x88\x98\x68\x00\x00\x00\x70\x88\xf8\x80\x70\x00"
-"\x10\x28\x20\xf8\x20\x20\x20\x00\x00\x00\x68\x98\x98\x68\x08\x70"
-"\x80\x80\xf0\x88\x88\x88\x88\x00\x20\x00\x60\x20\x20\x20\x70\x00"
-"\x10\x00\x30\x10\x10\x10\x90\x60\x40\x40\x48\x50\x60\x50\x48\x00"
-"\x60\x20\x20\x20\x20\x20\x70\x00\x00\x00\xd0\xa8\xa8\xa8\xa8\x00"
-"\x00\x00\xb0\xc8\x88\x88\x88\x00\x00\x00\x70\x88\x88\x88\x70\x00"
-"\x00\x00\xb0\xc8\xc8\xb0\x80\x80\x00\x00\x68\x98\x98\x68\x08\x08"
-"\x00\x00\xb0\xc8\x80\x80\x80\x00\x00\x00\x78\x80\xf0\x08\xf0\x00"
-"\x40\x40\xf0\x40\x40\x48\x30\x00\x00\x00\x90\x90\x90\x90\x68\x00"
-"\x00\x00\x88\x88\x88\x50\x20\x00\x00\x00\x88\xa8\xa8\xa8\x50\x00"
-"\x00\x00\x88\x50\x20\x50\x88\x00\x00\x00\x88\x88\x98\x68\x08\x70"
-"\x00\x00\xf8\x10\x20\x40\xf8\x00\x18\x20\x20\x40\x20\x20\x18\x00"
-"\x20\x20\x20\x00\x20\x20\x20\x00\xc0\x20\x20\x10\x20\x20\xc0\x00"
-"\x40\xa8\x10\x00\x00\x00\x00\x00\x00\x00\x20\x50\xf8\x00\x00\x00"
-"\x70\x88\x80\x80\x88\x70\x20\x60\x90\x00\x00\x90\x90\x90\x68\x00"
-"\x10\x20\x70\x88\xf8\x80\x70\x00\x20\x50\x70\x08\x78\x88\x78\x00"
-"\x48\x00\x70\x08\x78\x88\x78\x00\x20\x10\x70\x08\x78\x88\x78\x00"
-"\x20\x00\x70\x08\x78\x88\x78\x00\x00\x70\x80\x80\x80\x70\x10\x60"
-"\x20\x50\x70\x88\xf8\x80\x70\x00\x50\x00\x70\x88\xf8\x80\x70\x00"
-"\x20\x10\x70\x88\xf8\x80\x70\x00\x50\x00\x00\x60\x20\x20\x70\x00"
-"\x20\x50\x00\x60\x20\x20\x70\x00\x40\x20\x00\x60\x20\x20\x70\x00"
-"\x50\x00\x20\x50\x88\xf8\x88\x00\x20\x00\x20\x50\x88\xf8\x88\x00"
-"\x10\x20\xf8\x80\xf0\x80\xf8\x00\x00\x00\x6c\x12\x7e\x90\x6e\x00"
-"\x3e\x50\x90\x9c\xf0\x90\x9e\x00\x60\x90\x00\x60\x90\x90\x60\x00"
-"\x90\x00\x00\x60\x90\x90\x60\x00\x40\x20\x00\x60\x90\x90\x60\x00"
-"\x40\xa0\x00\xa0\xa0\xa0\x50\x00\x40\x20\x00\xa0\xa0\xa0\x50\x00"
-"\x90\x00\x90\x90\xb0\x50\x10\xe0\x50\x00\x70\x88\x88\x88\x70\x00"
-"\x50\x00\x88\x88\x88\x88\x70\x00\x20\x20\x78\x80\x80\x78\x20\x20"
-"\x18\x24\x20\xf8\x20\xe2\x5c\x00\x88\x50\x20\xf8\x20\xf8\x20\x00"
-"\xc0\xa0\xa0\xc8\x9c\x88\x88\x8c\x18\x20\x20\xf8\x20\x20\x20\x40"
-"\x10\x20\x70\x08\x78\x88\x78\x00\x10\x20\x00\x60\x20\x20\x70\x00"
-"\x20\x40\x00\x60\x90\x90\x60\x00\x20\x40\x00\x90\x90\x90\x68\x00"
-"\x50\xa0\x00\xa0\xd0\x90\x90\x00\x28\x50\x00\xc8\xa8\x98\x88\x00"
-"\x00\x70\x08\x78\x88\x78\x00\xf8\x00\x60\x90\x90\x90\x60\x00\xf0"
-"\x20\x00\x20\x40\x80\x88\x70\x00\x00\x00\x00\xf8\x80\x80\x00\x00"
-"\x00\x00\x00\xf8\x08\x08\x00\x00\x84\x88\x90\xa8\x54\x84\x08\x1c"
-"\x84\x88\x90\xa8\x58\xa8\x3c\x08\x20\x00\x00\x20\x20\x20\x20\x00"
-"\x00\x00\x24\x48\x90\x48\x24\x00\x00\x00\x90\x48\x24\x48\x90\x00"
-"\x28\x50\x20\x50\x88\xf8\x88\x00\x28\x50\x70\x08\x78\x88\x78\x00"
-"\x28\x50\x00\x70\x20\x20\x70\x00\x28\x50\x00\x20\x20\x20\x70\x00"
-"\x28\x50\x00\x70\x88\x88\x70\x00\x50\xa0\x00\x60\x90\x90\x60\x00"
-"\x28\x50\x00\x88\x88\x88\x70\x00\x50\xa0\x00\xa0\xa0\xa0\x50\x00"
-"\xfc\x48\x48\x48\xe8\x08\x50\x20\x00\x50\x00\x50\x50\x50\x10\x20"
-"\xc0\x44\xc8\x54\xec\x54\x9e\x04\x10\xa8\x40\x00\x00\x00\x00\x00"
-"\x00\x20\x50\x88\x50\x20\x00\x00\x88\x10\x20\x40\x80\x28\x00\x00"
-"\x7c\xa8\xa8\x68\x28\x28\x28\x00\x38\x40\x30\x48\x48\x30\x08\x70"
-"\x00\x00\x00\x00\x00\x00\xff\xff\xf0\xf0\xf0\xf0\x0f\x0f\x0f\x0f"
-"\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00"
-"\x00\x00\x00\x3c\x3c\x00\x00\x00\xff\xff\xff\xff\xff\xff\x00\x00"
-"\xc0\xc0\xc0\xc0\xc0\xc0\xc0\xc0\x0f\x0f\x0f\x0f\xf0\xf0\xf0\xf0"
-"\xfc\xfc\xfc\xfc\xfc\xfc\xfc\xfc\x03\x03\x03\x03\x03\x03\x03\x03"
-"\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x3f\x11\x22\x44\x88\x11\x22\x44\x88"
-"\x88\x44\x22\x11\x88\x44\x22\x11\xfe\x7c\x38\x10\x00\x00\x00\x00"
-"\x00\x00\x00\x00\x10\x38\x7c\xfe\x80\xc0\xe0\xf0\xe0\xc0\x80\x00"
-"\x01\x03\x07\x0f\x07\x03\x01\x00\xff\x7e\x3c\x18\x18\x3c\x7e\xff"
-"\x81\xc3\xe7\xff\xff\xe7\xc3\x81\xf0\xf0\xf0\xf0\x00\x00\x00\x00"
-"\x00\x00\x00\x00\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x00\x00\x00\x00"
-"\x00\x00\x00\x00\xf0\xf0\xf0\xf0\x33\x33\xcc\xcc\x33\x33\xcc\xcc"
-"\x00\x20\x20\x50\x50\x88\xf8\x00\x20\x20\x70\x20\x70\x20\x20\x00"
-"\x00\x00\x00\x50\x88\xa8\x50\x00\xff\xff\xff\xff\xff\xff\xff\xff"
-"\x00\x00\x00\x00\xff\xff\xff\xff\xf0\xf0\xf0\xf0\xf0\xf0\xf0\xf0"
-"\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\xff\xff\xff\xff\x00\x00\x00\x00"
-"\x00\x00\x68\x90\x90\x90\x68\x00\x30\x48\x48\x70\x48\x48\x70\xc0"
-"\xf8\x88\x80\x80\x80\x80\x80\x00\xf8\x50\x50\x50\x50\x50\x98\x00"
-"\xf8\x88\x40\x20\x40\x88\xf8\x00\x00\x00\x78\x90\x90\x90\x60\x00"
-"\x00\x50\x50\x50\x50\x68\x80\x80\x00\x50\xa0\x20\x20\x20\x20\x00"
-"\xf8\x20\x70\xa8\xa8\x70\x20\xf8\x20\x50\x88\xf8\x88\x50\x20\x00"
-"\x70\x88\x88\x88\x50\x50\xd8\x00\x30\x40\x40\x20\x50\x50\x50\x20"
-"\x00\x00\x00\x50\xa8\xa8\x50\x00\x08\x70\xa8\xa8\xa8\x70\x80\x00"
-"\x38\x40\x80\xf8\x80\x40\x38\x00\x70\x88\x88\x88\x88\x88\x88\x00"
-"\x00\xf8\x00\xf8\x00\xf8\x00\x00\x20\x20\xf8\x20\x20\x00\xf8\x00"
-"\xc0\x30\x08\x30\xc0\x00\xf8\x00\x18\x60\x80\x60\x18\x00\xf8\x00"
-"\x10\x28\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\xa0\x40"
-"\x00\x20\x00\xf8\x00\x20\x00\x00\x00\x50\xa0\x00\x50\xa0\x00\x00"
-"\x00\x18\x24\x24\x18\x00\x00\x00\x00\x30\x78\x78\x30\x00\x00\x00"
-"\x00\x00\x00\x00\x30\x00\x00\x00\x3e\x20\x20\x20\xa0\x60\x20\x00"
-"\xa0\x50\x50\x50\x00\x00\x00\x00\x40\xa0\x20\x40\xe0\x00\x00\x00"
-"\x00\x38\x38\x38\x38\x38\x38\x00\x00\x00\x00\x00\x00\x00\x00";
-
-
-
index 7f723b5..608907f 100644 (file)
@@ -34,7 +34,7 @@ u32 gpsp_gp2x_dev = 0;
 
 volatile u16 *gpsp_gp2x_memregs;
 volatile u32 *gpsp_gp2x_memregl;
-extern unsigned short *gp2x_memregs;
+unsigned short *gp2x_memregs;
 
 static volatile u16 *MEM_REG;
 
diff --git a/gp2x/gp2xminilib.c b/gp2x/gp2xminilib.c
deleted file mode 100644 (file)
index 098da6b..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-
-/*
-  GP2X minimal library v0.5 by rlyeh, 2005.
-  + GP2X video library with double buffering.
-  + GP2X soundring buffer library with double buffering.
-  + GP2X joystick library.
-  Thanks to Squidge, Robster, snaff and NK, for the help & previous work! :-)
-  What's new
-  ==========
-  0.5: patched sound for real stereo (using NK's solution); better init code.
-  0.4: lots of cleanups; sound is threaded now, double buffered too; 8 bpp video support; better exiting code.
-  0.3: shorter library; improved joystick diagonal detection.
-  0.2: better code layout; public release.
-  0.1: beta release
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-#include <linux/fb.h>
-#include <pthread.h>
-#include "gp2xminilib.h"
-
-extern void gp2x_sound_frame(void *blah, void *bufferg, int samples);
-
-
-         unsigned long   gp2x_dev[4]={0,0,0,0}, gp2x_physvram[4];
-         unsigned short *gp2x_memregs, *gp2x_screen15, *gp2x_logvram15[2], gp2x_sound_buffer[4+(44100*2)*4]; //*2=stereo, *4=max buffers
-volatile unsigned short  gp2x_palette[512][2];
-         unsigned char  *gp2x_screen8, *gp2x_logvram8[2];
-         pthread_t       gp2x_sound_thread=0, gp2x_sound_thread_exit=0;
-
-void gp2x_video_flip(void)
-{
-  unsigned long address=gp2x_physvram[gp2x_physvram[3]];
-  gp2x_screen15=gp2x_logvram15[gp2x_physvram[3]^=1]; 
-  gp2x_screen8 =gp2x_logvram8 [gp2x_physvram[3]   ]; 
-  gp2x_memregs[0x290E>>1]=(unsigned short)(address & 0xffff);
-  gp2x_memregs[0x2910>>1]=(unsigned short)(address >> 16);
-  gp2x_memregs[0x2912>>1]=(unsigned short)(address & 0xffff);
-  gp2x_memregs[0x2914>>1]=(unsigned short)(address >> 16);
-}
-void gp2x_video_setpalette(void)
-{int i;
- gp2x_memregs[0x2958>>1]=0; 
- for(i=0; i<512; i++) gp2x_memregs[0x295A>>1]=gp2x_palette[i][0], gp2x_memregs[0x295A>>1]=gp2x_palette[i][1];
-}
-unsigned long gp2x_joystick_read(void)
-{
-  unsigned long value=(gp2x_memregs[0x1198>>1] & 0x00FF);
-  if(value==0xFD) value=0xFA;
-  if(value==0xF7) value=0xEB;
-  if(value==0xDF) value=0xAF;
-  if(value==0x7F) value=0xBE;
-  return ~((gp2x_memregs[0x1184>>1] & 0xFF00) | value | (gp2x_memregs[0x1186>>1] << 16));
-}
-#if 0
-void *gp2x_sound_play(void *blah)
-{
-  struct timespec ts;
-  int flip=0;
-  ts.tv_sec=0, ts.tv_nsec=gp2x_sound_buffer[2];
-  while(! gp2x_sound_thread_exit)
-  {
-   gp2x_sound_frame(blah, (void *)(&gp2x_sound_buffer[4+flip]), gp2x_sound_buffer[0]);
-   write(gp2x_dev[3], (void *)(&gp2x_sound_buffer[4+flip]), gp2x_sound_buffer[1]);
-   flip^=gp2x_sound_buffer[1];
-   //nanosleep(&ts, NULL);
-  }
-  return NULL;
-}
-#endif
-
-void gp2x_deinit(void)
-{int i;
-  if(gp2x_sound_thread) { gp2x_sound_thread_exit=1; for(i=0;i<1000000;i++); }
-  gp2x_memregs[0x28DA>>1]=0x4AB; 
-  gp2x_memregs[0x290C>>1]=640;   
-  close(gp2x_dev[0]);
-  close(gp2x_dev[1]);
-  close(gp2x_dev[2]);
-  //close(gp2x_dev[3]);
-  //fcloseall();
-}
-void gp2x_init(int bpp, int rate, int bits, int stereo, int Hz)
-{
-  struct fb_fix_screeninfo fixed_info;
-  if(!gp2x_dev[0]) gp2x_dev[0] = open("/dev/fb0", O_RDWR);
-  if(!gp2x_dev[1]) gp2x_dev[1] = open("/dev/fb1", O_RDWR);
-  if(!gp2x_dev[2]) gp2x_dev[2] = open("/dev/mem", O_RDWR);
-  //if(!gp2x_dev[3]) gp2x_dev[3] = open("/dev/dsp", O_WRONLY);
-  gp2x_memregs=(unsigned short *)mmap(0, 0x10000, PROT_READ|PROT_WRITE, MAP_SHARED, gp2x_dev[2], 0xc0000000);
-  if(!gp2x_sound_thread) { gp2x_memregs[0x0F16>>1] = 0x830a; sleep(1); 
-                           gp2x_memregs[0x0F58>>1] = 0x100c; sleep(1); }
-                ioctl (gp2x_dev[0], FBIOGET_FSCREENINFO, &fixed_info); 
-   gp2x_screen15=gp2x_logvram15[0]=(unsigned short *)mmap(0,  320*240*2, PROT_WRITE, MAP_SHARED, gp2x_dev[0], 0);
-     gp2x_screen8=gp2x_logvram8[0]=(unsigned char *)gp2x_logvram15[0];
-                  gp2x_physvram[0]=fixed_info.smem_start;
-                ioctl (gp2x_dev[1], FBIOGET_FSCREENINFO, &fixed_info);
-                 gp2x_logvram15[1]=(unsigned short *)mmap(0,  320*240*2, PROT_WRITE, MAP_SHARED, gp2x_dev[1], 0);
-                  gp2x_logvram8[1]=(unsigned char *)gp2x_logvram15[1];
-                  gp2x_physvram[1]=fixed_info.smem_start;
-  gp2x_memregs[0x28DA>>1]=(((bpp+1)/8)<<9)|0xAB; /*8/15/16/24bpp...*/
-  gp2x_memregs[0x290C>>1]=320*((bpp+1)/8);       /*line width in bytes*/
-  ioctl(gp2x_dev[3], SNDCTL_DSP_SPEED,  &rate);
-  ioctl(gp2x_dev[3], SNDCTL_DSP_SETFMT, &bits);
-  ioctl(gp2x_dev[3], SNDCTL_DSP_STEREO, &stereo);
-  gp2x_sound_buffer[1]=(gp2x_sound_buffer[0]=(rate/Hz)) << (stereo + (bits==16));
-  gp2x_sound_buffer[2]=(1000000/Hz);
-  if(!gp2x_sound_thread) { gp2x_sound_thread = 1; //pthread_create( &gp2x_sound_thread, NULL, gp2x_sound_play, NULL);
-                           atexit(gp2x_deinit); }
-}
-/*
-EXAMPLE
-=======
-   now supply your own function for 16 bits, stereo:
-   void gp2x_sound_frame(void *blah, void *bufferg, int samples)
-   {
-     signed short *buffer=(signed short *)bufferg;
-     while(samples--)
-     {
-       *buffer++=0; //Left channel
-       *buffer++=0; //Right channel
-     }
-   }
-   or 16 bits mono:
-   void gp2x_sound_frame(void *blah, void *bufferg, int samples)
-   {
-     signed short *buffer=(signed short *)bufferg;
-     while(samples--)
-     {
-       *buffer++=0; //Central channel
-     }
-   }
-  now the main program...
-  hicolor example:
-  int main(int argc, char *argv[])
-  {
-   //this sets video to hicolor (16 bpp)
-   //it also sets sound to 44100,16bits,stereo and syncs audio to 50 Hz (PAL timing)
-   //Warning: GP2X does not support 8bit sound sampling! (at least within Linux)
-   gp2x_init(16,44100,16,1,50);
-   while(1)
-   {
-    unsigned long  pad=gp2x_joystick_read();
-    unsigned short color=gp2x_video_color15(255,255,255,0);
-    if(pad & GP2X_L) if(pad & GP2X_R) exit();           
-    if(pad & GP2X_A) color=gp2x_color15(255,255,255,0);  //white
-     else            color=gp2x_color15(255,0,0,0);      //red
-    gp2x_screen15[160+120*320]=color;                    //x=160, y=120
-    gp2x_video_flip();
-   }
-  }
-  palettized example:
-  int main(int argc, char *argv[])
-  {
-   //this sets video to palette mode (8 bpp)
-   //it also sets sound to 11025,16bits,stereo and syncs audio to 60 Hz (NSTC timing)
-   //Warning: GP2X does not support 8bit sound sampling! (at least within Linux)
-   gp2x_init(8,11025,16,1,60);
-   gp2x_video_color8(0,0,0,0);       //color #0 is black for us
-   gp2x_video_color8(1,255,255,255); //color #1 is white for us
-   gp2x_video_color8(2,255,0,0);     //color #2 is red   for us
-   gp2x_video_setpalette();
-   while(1)
-   {
-    unsigned long pad=gp2x_joystick_read();
-    unsigned char color;
-    if(pad & GP2X_L) if(pad & GP2X_R) exit();           
-    if(pad & GP2X_A) color=1;  //white
-     else            color=2;  //red
-    gp2x_screen8[160+120*320]=color;                      //x=160, y=120
-    gp2x_video_flip();
-   }
-  }
-*/
-
diff --git a/gp2x/gp2xminilib.h b/gp2x/gp2xminilib.h
deleted file mode 100644 (file)
index cf3c00b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-  GP2X minimal library v0.5 by rlyeh, 2005.
-  + GP2X video library with double buffering.
-  + GP2X soundring buffer library with double buffering.
-  + GP2X joystick library.
-  Thanks to Squidge, Robster, snaff and NK, for the help & previous work! :-)
-  What's new
-  ==========
-  0.5: patched sound for real stereo (using NK's solution); better init code.
-  0.4: lots of cleanups; sound is threaded now, double buffered too; 8 bpp video support; better exiting code.
-  0.3: shorter library; improved joystick diagonal detection.
-  0.2: better code layout; public release.
-  0.1: beta release
-*/
-
-/* .h by Hermes/PS2Reality*/
-
-#if !defined(GP2XMINILIB)
-#define GP2XMINILIB
-
-enum  { GP2X_UP=0x1,       GP2X_LEFT=0x4,       GP2X_DOWN=0x10,  GP2X_RIGHT=0x40,
-        GP2X_START=1<<8,   GP2X_SELECT=1<<9,    GP2X_L=1<<10,    GP2X_R=1<<11,
-        GP2X_A=1<<12,      GP2X_B=1<<13,        GP2X_X=1<<14,    GP2X_Y=1<<15,
-        GP2X_VOL_UP=1<<22, GP2X_VOL_DOWN=1<<23, GP2X_PUSH=1<<27, };
-#define gp2x_video_color15(R,G,B,A)  (((R&0xF8)<<8)|((G&0xF8)<<3)|((B&0xF8)>>3)|(A<<5))
-#define gp2x_video_color8 (C,R,G,B)  gp2x_palette[C][0]=(G<<8)|B,gp2x_palette[C][1]=R;
-
-
-
-
-     
-extern unsigned short *gp2x_memregs, *gp2x_screen15, *gp2x_logvram15[2], gp2x_sound_buffer[4+(44100*2)*4]; //*2=stereo, *4=max buffers
-
-        
-extern unsigned long   gp2x_dev[4];
-
-
-void gp2x_video_flip(void);
-void gp2x_video_setpalette(void);
-unsigned long gp2x_joystick_read(void);
-void *gp2x_sound_play(void *blah);
-void gp2x_deinit(void);
-void gp2x_init(int bpp, int rate, int bits, int stereo, int Hz);
-
-
-
-#endif
diff --git a/gp2x/speedtest.c b/gp2x/speedtest.c
deleted file mode 100644 (file)
index b6ce78a..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*  speedtest.c for GP2X (CPU/LCD/RAM-Tuner Version 2.0)
-    Copyright (C) 2006 god_at_hell 
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <fcntl.h>
-#include <math.h>                                             
-#include <unistd.h>
-
-#include "display.h"
-#include "cpuctrl.h"
-#include "gp2xminilib.h"
-
-void prim()
-{
-       //FILE *primout;
-       unsigned char cad[256];
-    char p = 0;
-    int primnumber;
-    int l = 1;
-    float g = 0;
-    int i = 3;
-    
-    while(i != 500000)
-    {
-                       int m = 2;
-            float temp = sqrt(i);
-            float ifloat = (float)i;
-            
-            if(temp == (int)temp)
-            {
-                      m = i;
-                      p = 1;
-            }
-            
-            while(m < temp)
-            {
-                    g = ifloat/m;
-                    if (g == (int)g)
-                    {
-                          m = i;
-                          p = 1;
-                    }
-                       m++;
-            }
-
-            if (p == 0)
-            {
-                  l += 1;
-                  primnumber = i;
-                  sprintf(cad,"%u is primnumber",i);
-                                 v_putcad(1,13,0xffffff,0xB00000,cad);
-                                 //primout = fopen("/mnt/sd/primnumber.txt", "a");
-                                 //fprintf(primout,"%u: %u\n", l, i);
-                                 //fclose(primout);
-                                 //execl("sync",NULL);
-                                 gp2x_video_flip();
-            }
-            p = 0;
-            i++;
-    }               
-}
-
-void ant()
-{
-       int i,n;
-       unsigned char cad[256];
-       short direction = 0; //clockwise ... 0 = Up, 1 = Right
-       unsigned short col1, col2;
-       col1=gp2x_video_color15(0,0,0,0);
-       col2=gp2x_video_color15(0xFF,0xFF,0xFF,0);
-       short antx = 200;
-       short anty = 140;
-       for(i = 0; i < 9000; i++)
-       {
-               for(n = 0; n < 500000; n++);
-               if(gp2x_screen15[(320*anty) + antx]==col1)
-               {       
-                       for(n = 0; n < 3; n++)
-                       {
-                               int m = 0;
-                               for(m = 0; m < 3; m++)
-                               {
-                                       gp2x_screen15[320*(anty+n)+antx+m] = col2;
-                               }
-                       }
-                       sprintf(cad,"%u steps left ",8999-i);
-                       v_putcad(1,3,0x000000,0xffffff,cad);
-                       gp2x_video_flip();
-                       for(n = 0; n < 3; n++)
-                       {
-                               int m = 0;
-                               for(m = 0; m < 3; m++)
-                               {
-                                       gp2x_screen15[320*(anty+n)+antx+m] = col2;
-                               }
-                       }
-                       sprintf(cad,"%u steps left ",8999-i);
-                       v_putcad(1,3,0x000000,0xffffff,cad);
-                       gp2x_video_flip();
-                       if(direction == 0) antx-=3;
-                       if(direction == 1) anty-=3;
-                       if(direction == 2) antx+=3;
-                       if(direction == 3) anty+=3;
-                       direction--;
-                       if(direction < 0) direction=3;
-               }
-               if(gp2x_screen15[(320*anty) + antx]==col2)
-               {
-                       for(n = 0; n < 3; n++)
-                       {
-                               int m = 0;
-                               for(m = 0; m < 3; m++)
-                               {
-                                       gp2x_screen15[320*(anty+n)+antx+m] = col1;
-                               }
-                       }
-                       sprintf(cad,"%u steps left ",8999-i);
-                       v_putcad(1,3,0x000000,0xffffff,cad);
-                       gp2x_video_flip();
-                       for(n = 0; n < 3; n++)
-                       {
-                               int m = 0;
-                               for(m = 0; m < 3; m++)
-                               {
-                                       gp2x_screen15[320*(anty+n)+antx+m] = col1;
-                               }
-                       }
-                       sprintf(cad,"%u steps left ",8999-i);
-                       v_putcad(1,3,0x000000,0xffffff,cad);
-                       gp2x_video_flip();
-                       if(direction == 0) antx+=3;
-                       if(direction == 1) anty+=3;
-                       if(direction == 2) antx-=3;
-                       if(direction == 3) anty-=3;
-                       direction++;
-                       if(direction > 3) direction=0;
-               }
-       }
-}
-
-void speedtest(short test)
-{
-       unsigned BACKGROUND;
-       if(test == 0) BACKGROUND=0xB00000;
-       if(test == 1) BACKGROUND=0xFFFFFF;
-       short start = 240;
-       short cpuspeed = start;
-       unsigned char cad[256];
-       FILE *speed;
-       
-       do
-       {       
-               speed = fopen("/mnt/sd/speed.txt", "w");
-               ClearScreen(BACKGROUND);
-               if(test == 0) v_putcad(1,1,0x00ff00,BACKGROUND,"Prim-Speedtest");
-               if(test == 1) v_putcad(1,1,0x006600,BACKGROUND,"Ant-Speedtest");
-               v_putcad(1,6,0xffffff,BACKGROUND,"Testing Speed");
-               if(cpuspeed > start) 
-               {
-                       sprintf(cad,"%uMhz checked",cpuspeed-5);
-                       v_putcad(1,9,0xffffff,BACKGROUND,cad);
-               }
-               gp2x_video_flip();
-               ClearScreen(BACKGROUND);
-               if(test == 0) v_putcad(1,1,0x00ff00,BACKGROUND,"Prim-Speedtest");
-               if(test == 1) v_putcad(1,1,0x006600,BACKGROUND,"Ant-Speedtest");
-               v_putcad(1,6,0xffffff,BACKGROUND,"Testing Speed");
-               if(cpuspeed > start) 
-               {
-                       sprintf(cad,"%uMhz checked",cpuspeed-5);
-                       if(test == 0) v_putcad(1,9,0xffffff,BACKGROUND,cad);
-                       if(test == 1) v_putcad(1,9,0x000000,BACKGROUND,cad);
-               }
-               gp2x_video_flip();
-               fprintf (speed,"set CPU-Frequency = %uMHz\r\n",cpuspeed);
-               set_FCLK(cpuspeed);
-               
-               if(test == 0) prim();
-               if(test == 1) ant();
-               
-               fprintf(speed,"%uMhz checked\n\n", cpuspeed);
-               cpuspeed = cpuspeed + 5;
-               fclose(speed);
-               execl("sync",NULL);
-       }
-       while(1);       
-}
diff --git a/gp2x/speedtest.h b/gp2x/speedtest.h
deleted file mode 100644 (file)
index d3f5b3e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-void prim();
-void ant();
-void speedtest(short test);
similarity index 100%
rename from gp2x/align_test.c
rename to gp2x/test/align_test.c