summaryrefslogtreecommitdiffstats
path: root/tools/checkwps
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-03-26 23:35:34 +0000
committerDave Chapman <dave@dchapman.com>2008-03-26 23:35:34 +0000
commit78d29f535ff14a5f213125baf63fa2961be17d79 (patch)
treea3d0992ab3a87ab073ed5aafa0529821dcedd31e /tools/checkwps
parentd75bb78fdad9f3252df21e469c6f07346e250de4 (diff)
downloadrockbox-78d29f535ff14a5f213125baf63fa2961be17d79.tar.gz
rockbox-78d29f535ff14a5f213125baf63fa2961be17d79.tar.bz2
rockbox-78d29f535ff14a5f213125baf63fa2961be17d79.zip
Major cleanup of checkwps - fix all warnings and add a script to build versions for all supported targets (plus some unsupported ones). You now need to run the version of checkwps that matches the device your WPS is for.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16831 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/checkwps')
-rw-r--r--tools/checkwps/Makefile25
-rw-r--r--tools/checkwps/README23
-rwxr-xr-xtools/checkwps/buildall.sh8
-rw-r--r--tools/checkwps/checkwps.c28
-rwxr-xr-xtools/checkwps/cleanall.sh7
-rw-r--r--tools/checkwps/file.h7
-rw-r--r--tools/checkwps/targets.txt33
7 files changed, 118 insertions, 13 deletions
diff --git a/tools/checkwps/Makefile b/tools/checkwps/Makefile
index 70b6e0a963..069b1e4334 100644
--- a/tools/checkwps/Makefile
+++ b/tools/checkwps/Makefile
@@ -7,12 +7,25 @@
# $Id$
#
-all: checkwps
+ROOT=../..
-checkwps: checkwps.c ../../apps/gui/wps_parser.c ../../apps/gui/wps_debug.c ../../firmware/common/ctype.c ../../apps/misc.c ../../apps/recorder/bmp.c
- $(SILENT)$(CC) -g -I ../../apps/gui -I../../firmware/export \
--D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN -D WPS_DIR=\".\" \
--I../../apps -I../../firmware/target/arm/ipod -I../../firmware/include $+ -o $@
+COMMON=$(ROOT)/apps/gui/wps_parser.c \
+ $(ROOT)/apps/gui/wps_debug.c \
+ $(ROOT)/apps/misc.c \
+ $(ROOT)/apps/recorder/bmp.c
+
+INCLUDE=-I $(ROOT)/apps/gui \
+ -I $(ROOT)/firmware/export \
+ -I $(ROOT)/apps \
+ -I .
+
+CFLAGS = -g -D__PCTOOL__ -DDEBUG -DROCKBOX_DIR_LEN=9 -DWPS_DIR=\".\"
+
+all: checkwps.$(MODEL)
+
+checkwps.$(MODEL): checkwps.c $(COMMON)
+ @echo CC [$(TARGET)]
+ @$(CC) $(INCLUDE) $(CFLAGS) $(COMMON) -D$(TARGET) checkwps.c -o $@
clean:
- rm -f cleanwps
+ rm -f checkwps.$(MODEL)
diff --git a/tools/checkwps/README b/tools/checkwps/README
new file mode 100644
index 0000000000..a94882fdff
--- /dev/null
+++ b/tools/checkwps/README
@@ -0,0 +1,23 @@
+This directory contains the checkwps tool which can be used to
+validate wps files outside of Rockbox.
+
+checkwps uses the Rockbox WPS parser and is therefore built in
+target-specific versions (to avoid making lots of changes to the core
+code).
+
+To compile
+----------
+
+Just run the ./buildall.sh script
+
+
+To remove all compiled files
+----------------------------
+
+./cleanall.sh
+
+
+To add a new target
+-------------------
+
+Add $target and $modelname from tools/configure to targets.txt
diff --git a/tools/checkwps/buildall.sh b/tools/checkwps/buildall.sh
new file mode 100755
index 0000000000..faec663ab8
--- /dev/null
+++ b/tools/checkwps/buildall.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+cat targets.txt | (
+ while read target model
+ do
+ rm -f checkwps.$model
+ make MODEL=$model TARGET=$target
+ done
+)
diff --git a/tools/checkwps/checkwps.c b/tools/checkwps/checkwps.c
index ddaaf49b73..1051244538 100644
--- a/tools/checkwps/checkwps.c
+++ b/tools/checkwps/checkwps.c
@@ -1,5 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <fcntl.h>
+#include "config.h"
#include "gwps.h"
#define MIN(x,y) ((x) > (y) ? (y) : (x))
@@ -20,7 +22,7 @@ int errno;
unsigned short letoh16(unsigned short x)
{
unsigned short n = 0x1234;
- unsigned char* ch = &n;
+ unsigned char* ch = (unsigned char*)&n;
if (*ch == 0x34)
{
@@ -34,7 +36,7 @@ unsigned short letoh16(unsigned short x)
unsigned int htole32(unsigned int x)
{
unsigned short n = 0x1234;
- unsigned char* ch = &n;
+ unsigned char* ch = (unsigned char*)&n;
if (*ch == 0x34)
{
@@ -80,6 +82,11 @@ bool load_wps_backdrop(char* filename)
return true;
}
+bool load_remote_wps_backdrop(char* filename)
+{
+ return true;
+}
+
static char pluginbuf[PLUGIN_BUFFER_SIZE];
static int dummy_func1(void)
@@ -105,12 +112,17 @@ struct screen screens[NB_SCREENS] =
.width=LCD_WIDTH,
.height=LCD_HEIGHT,
.depth=LCD_DEPTH,
+#ifdef HAVE_LCD_COLOR
.is_color=true,
- .has_disk_led=false,
+#else
+ .is_color=false,
+#endif
.getxmargin=dummy_func1,
.getymargin=dummy_func1,
+#if LCD_DEPTH > 1
.get_foreground=dummy_func2,
.get_background=dummy_func2,
+#endif
},
#ifdef HAVE_REMOTE_LCD
{
@@ -119,10 +131,12 @@ struct screen screens[NB_SCREENS] =
.height=LCD_REMOTE_HEIGHT,
.depth=LCD_REMOTE_DEPTH,
.is_color=false,/* No color remotes yet */
- .getxmargin=dummy_func,
- .getymargin=dummy_func,
- .get_foreground=dummy_func,
- .get_background=dummy_func,
+ .getxmargin=dummy_func1,
+ .getymargin=dummy_func1,
+#if LCD_REMOTE_DEPTH > 1
+ .get_foreground=dummy_func2,
+ .get_background=dummy_func2,
+#endif
}
#endif
};
diff --git a/tools/checkwps/cleanall.sh b/tools/checkwps/cleanall.sh
new file mode 100755
index 0000000000..6cd1a90676
--- /dev/null
+++ b/tools/checkwps/cleanall.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+cat targets.txt | (
+ while read target model
+ do
+ rm -f checkwps.$model
+ done
+)
diff --git a/tools/checkwps/file.h b/tools/checkwps/file.h
new file mode 100644
index 0000000000..4256c1ee37
--- /dev/null
+++ b/tools/checkwps/file.h
@@ -0,0 +1,7 @@
+#ifndef MAX_PATH
+#define MAX_PATH 260
+#endif
+
+/* Wrapper - required for O_RDONLY */
+
+#include <fcntl.h>
diff --git a/tools/checkwps/targets.txt b/tools/checkwps/targets.txt
new file mode 100644
index 0000000000..d2c54378d9
--- /dev/null
+++ b/tools/checkwps/targets.txt
@@ -0,0 +1,33 @@
+ARCHOS_RECORDER recorder
+ARCHOS_FMRECORDER fmrecorder
+ARCHOS_RECORDERV2 recorderv2
+ARCHOS_ONDIOSP ondiosp
+ARCHOS_ONDIOFM ondiofm
+IRIVER_H120 h120
+IRIVER_H300 h300
+IRIVER_H100 h100
+IRIVER_IFP7XX ifp7xx
+IRIVER_H10 h10
+IRIVER_H10_5GB h10_5gb
+IPOD_COLOR ipodcolor
+IPOD_NANO ipodnano
+IPOD_VIDEO ipodvideo
+IPOD_3G ipod3g
+IPOD_4G ipod4g
+IPOD_MINI ipodmini
+IPOD_MINI2G ipodmini2g
+IPOD_1G2G ipod1g2g
+IAUDIO_X5 x5
+IAUDIO_M5 m5
+COWON_D2 cowond2
+IAUDIO_M3 m3
+GIGABEAT_F gigabeatf
+GIGABEAT_S gigabeats
+MROBE_500 mrobe500
+MROBE_100 mrobe100
+LOGIK_DAX logikdax
+CREATIVE_ZVM creativezvm
+SANSA_E200 e200
+SANSA_E200 e200r
+SANSA_C200 c200
+ELIO_TPJ1022 tpj1022