From 78d29f535ff14a5f213125baf63fa2961be17d79 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Wed, 26 Mar 2008 23:35:34 +0000 Subject: 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 --- apps/gui/gwps-common.c | 1 + apps/gui/gwps.h | 1 - apps/gui/wps_parser.c | 3 ++- apps/misc.c | 12 ++++++------ apps/recorder/bmp.c | 2 +- apps/root_menu.c | 1 + firmware/export/button.h | 2 ++ firmware/export/lcd-remote.h | 3 +-- firmware/rolo.c | 1 + tools/checkwps/Makefile | 25 +++++++++++++++++++------ tools/checkwps/README | 23 +++++++++++++++++++++++ tools/checkwps/buildall.sh | 8 ++++++++ tools/checkwps/checkwps.c | 28 +++++++++++++++++++++------- tools/checkwps/cleanall.sh | 7 +++++++ tools/checkwps/file.h | 7 +++++++ tools/checkwps/targets.txt | 33 +++++++++++++++++++++++++++++++++ 16 files changed, 133 insertions(+), 24 deletions(-) create mode 100644 tools/checkwps/README create mode 100755 tools/checkwps/buildall.sh create mode 100755 tools/checkwps/cleanall.sh create mode 100644 tools/checkwps/file.h create mode 100644 tools/checkwps/targets.txt diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 37b2b7c5d1..a6bb917a5a 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -53,6 +53,7 @@ #include "dsp.h" #include "action.h" #include "cuesheet.h" +#include "playlist.h" #if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1)) #include "backdrop.h" diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index b24c243cd7..127fd99511 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -22,7 +22,6 @@ #include "screen_access.h" #include "statusbar.h" #include "id3.h" -#include "playlist.h" /* constants used in line_type and as refresh_mode for wps_refresh */ #define WPS_REFRESH_STATIC 1 /* line doesn't change over time */ diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index e8c3c9f629..9bbdb2e5d0 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -20,6 +20,8 @@ #include #include #include "gwps.h" +#include "file.h" +#include "misc.h" #ifdef __PCTOOL__ #define DEBUGF printf #define FONT_SYSFIXED 0 @@ -39,7 +41,6 @@ #include "atoi.h" #include "gwps.h" #include "settings.h" -#include "misc.h" #include "plugin.h" #ifdef HAVE_LCD_BITMAP diff --git a/apps/misc.c b/apps/misc.c index 1ce65c0108..1d83640dc4 100644 --- a/apps/misc.c +++ b/apps/misc.c @@ -18,14 +18,16 @@ ****************************************************************************/ #include #include +#include "config.h" +#include "lcd.h" +#include "file.h" +#ifdef __PCTOOL__ +#include +#else #include "sprintf.h" -#ifndef __PCTOOL__ #include "lang.h" #include "string.h" -#include "config.h" -#include "file.h" #include "dir.h" -#include "lcd.h" #include "lcd-remote.h" #include "errno.h" #include "system.h" @@ -49,7 +51,6 @@ #include "tagcache.h" #include "scrobbler.h" #include "sound.h" -#endif #ifdef HAVE_MMC #include "ata_mmc.h" @@ -77,7 +78,6 @@ #endif #endif -#ifndef __PCTOOL__ /* Format a large-range value for output, using the appropriate unit so that * the displayed value is in the range 1 <= display < 1000 (1024 for "binary" * units) if possible, and 3 significant digits are shown. If a buffer is diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c index f844c8908f..e2d5713aa5 100644 --- a/apps/recorder/bmp.c +++ b/apps/recorder/bmp.c @@ -35,11 +35,11 @@ #include "inttypes.h" #include "debug.h" #include "lcd.h" +#include "file.h" #ifdef HAVE_REMOTE_LCD #include "lcd-remote.h" #endif #ifndef __PCTOOL__ -#include "file.h" #include "config.h" #include "system.h" #include "bmp.h" diff --git a/apps/root_menu.c b/apps/root_menu.c index ae7f92fc9b..281a528574 100644 --- a/apps/root_menu.c +++ b/apps/root_menu.c @@ -59,6 +59,7 @@ #endif #include "gwps-common.h" #include "bookmark.h" +#include "playlist.h" #include "tagtree.h" #include "menus/exported_menus.h" #ifdef HAVE_RTC_ALARM diff --git a/firmware/export/button.h b/firmware/export/button.h index f50f3dd9a4..95da7adc42 100644 --- a/firmware/export/button.h +++ b/firmware/export/button.h @@ -22,7 +22,9 @@ #include #include #include "config.h" +#ifndef __PCTOOL__ #include "button-target.h" +#endif extern struct event_queue button_queue; diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index b046c0736d..55d3f6fb38 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h @@ -23,12 +23,11 @@ #include #include "cpu.h" #include "config.h" -#include "adc.h" #include "lcd.h" #ifdef HAVE_REMOTE_LCD -#if defined(TARGET_TREE) +#if defined(TARGET_TREE) && !defined(__PCTOOL__) #include "lcd-remote-target.h" #endif diff --git a/firmware/rolo.c b/firmware/rolo.c index 30eba91316..bfc0c13ff7 100644 --- a/firmware/rolo.c +++ b/firmware/rolo.c @@ -28,6 +28,7 @@ #include "audio.h" #include "system.h" #include "i2c.h" +#include "adc.h" #include "string.h" #include "buffer.h" 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 #include +#include +#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 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 -- cgit v1.2.3