diff options
-rw-r--r-- | apps/metadata.c | 2 | ||||
-rw-r--r-- | apps/tagcache.c | 16 | ||||
-rw-r--r-- | firmware/common/unicode.c | 5 | ||||
-rw-r--r-- | firmware/include/time.h | 7 | ||||
-rw-r--r-- | tools/Makefile | 11 | ||||
-rw-r--r-- | tools/database.c | 14 | ||||
-rw-r--r-- | tools/database/Makefile | 37 | ||||
-rw-r--r-- | tools/database/database.c | 49 | ||||
-rw-r--r-- | uisimulator/common/io.c | 18 |
9 files changed, 122 insertions, 37 deletions
diff --git a/apps/metadata.c b/apps/metadata.c index fa11fa787c..0892fc65fd 100644 --- a/apps/metadata.c +++ b/apps/metadata.c | |||
@@ -397,6 +397,7 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname) | |||
397 | return true; | 397 | return true; |
398 | } | 398 | } |
399 | 399 | ||
400 | #ifndef __PCTOOL__ | ||
400 | #if CONFIG_CODEC == SWCODEC | 401 | #if CONFIG_CODEC == SWCODEC |
401 | void strip_tags(int handle_id) | 402 | void strip_tags(int handle_id) |
402 | { | 403 | { |
@@ -434,6 +435,7 @@ void strip_tags(int handle_id) | |||
434 | bufcuttail(handle_id, len); | 435 | bufcuttail(handle_id, len); |
435 | } | 436 | } |
436 | #endif /* CONFIG_CODEC == SWCODEC */ | 437 | #endif /* CONFIG_CODEC == SWCODEC */ |
438 | #endif /* ! __PCTOOL__ */ | ||
437 | 439 | ||
438 | void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig) | 440 | void adjust_mp3entry(struct mp3entry *entry, void *dest, const void *orig) |
439 | { | 441 | { |
diff --git a/apps/tagcache.c b/apps/tagcache.c index b6cfcd5ef5..8e14b9ff17 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -155,10 +155,12 @@ struct tagcache_command_entry { | |||
155 | int32_t data; | 155 | int32_t data; |
156 | }; | 156 | }; |
157 | 157 | ||
158 | #ifndef __PCTOOL__ | ||
158 | static struct tagcache_command_entry command_queue[TAGCACHE_COMMAND_QUEUE_LENGTH]; | 159 | static struct tagcache_command_entry command_queue[TAGCACHE_COMMAND_QUEUE_LENGTH]; |
159 | static volatile int command_queue_widx = 0; | 160 | static volatile int command_queue_widx = 0; |
160 | static volatile int command_queue_ridx = 0; | 161 | static volatile int command_queue_ridx = 0; |
161 | static struct mutex command_queue_mutex; | 162 | static struct mutex command_queue_mutex; |
163 | #endif | ||
162 | 164 | ||
163 | /* Tag database structures. */ | 165 | /* Tag database structures. */ |
164 | 166 | ||
@@ -633,6 +635,8 @@ static bool get_index(int masterfd, int idxid, | |||
633 | return true; | 635 | return true; |
634 | } | 636 | } |
635 | 637 | ||
638 | #ifndef __PCTOOL__ | ||
639 | |||
636 | static bool write_index(int masterfd, int idxid, struct index_entry *idx) | 640 | static bool write_index(int masterfd, int idxid, struct index_entry *idx) |
637 | { | 641 | { |
638 | /* We need to exclude all memory only flags & tags when writing to disk. */ | 642 | /* We need to exclude all memory only flags & tags when writing to disk. */ |
@@ -678,6 +682,8 @@ static bool write_index(int masterfd, int idxid, struct index_entry *idx) | |||
678 | return true; | 682 | return true; |
679 | } | 683 | } |
680 | 684 | ||
685 | #endif /* !__PCTOOL__ */ | ||
686 | |||
681 | static bool open_files(struct tagcache_search *tcs, int tag) | 687 | static bool open_files(struct tagcache_search *tcs, int tag) |
682 | { | 688 | { |
683 | if (tcs->idxfd[tag] < 0) | 689 | if (tcs->idxfd[tag] < 0) |
@@ -2993,6 +2999,8 @@ static void free_tempbuf(void) | |||
2993 | tempbuf_size = 0; | 2999 | tempbuf_size = 0; |
2994 | } | 3000 | } |
2995 | 3001 | ||
3002 | #ifndef __PCTOOL__ | ||
3003 | |||
2996 | static bool modify_numeric_entry(int masterfd, int idx_id, int tag, long data) | 3004 | static bool modify_numeric_entry(int masterfd, int idx_id, int tag, long data) |
2997 | { | 3005 | { |
2998 | struct index_entry idx; | 3006 | struct index_entry idx; |
@@ -3040,6 +3048,7 @@ static bool command_queue_is_full(void) | |||
3040 | 3048 | ||
3041 | return (next == command_queue_ridx); | 3049 | return (next == command_queue_ridx); |
3042 | } | 3050 | } |
3051 | |||
3043 | static bool command_queue_sync_callback(void) | 3052 | static bool command_queue_sync_callback(void) |
3044 | { | 3053 | { |
3045 | 3054 | ||
@@ -3152,6 +3161,7 @@ void tagcache_update_numeric(int idx_id, int tag, long data) | |||
3152 | { | 3161 | { |
3153 | queue_command(CMD_UPDATE_NUMERIC, idx_id, tag, data); | 3162 | queue_command(CMD_UPDATE_NUMERIC, idx_id, tag, data); |
3154 | } | 3163 | } |
3164 | #endif /* !__PCTOOL__ */ | ||
3155 | 3165 | ||
3156 | long tagcache_get_serial(void) | 3166 | long tagcache_get_serial(void) |
3157 | { | 3167 | { |
@@ -3187,6 +3197,8 @@ static bool write_tag(int fd, const char *tagstr, const char *datastr) | |||
3187 | return true; | 3197 | return true; |
3188 | } | 3198 | } |
3189 | 3199 | ||
3200 | #ifndef __PCTOOL__ | ||
3201 | |||
3190 | static bool read_tag(char *dest, long size, | 3202 | static bool read_tag(char *dest, long size, |
3191 | const char *src, const char *tagstr) | 3203 | const char *src, const char *tagstr) |
3192 | { | 3204 | { |
@@ -3326,7 +3338,6 @@ static int parse_changelog_line(int line_n, const char *buf, void *parameters) | |||
3326 | return write_index(masterfd, idx_id, &idx) ? 0 : -5; | 3338 | return write_index(masterfd, idx_id, &idx) ? 0 : -5; |
3327 | } | 3339 | } |
3328 | 3340 | ||
3329 | #ifndef __PCTOOL__ | ||
3330 | bool tagcache_import_changelog(void) | 3341 | bool tagcache_import_changelog(void) |
3331 | { | 3342 | { |
3332 | struct master_header myhdr; | 3343 | struct master_header myhdr; |
@@ -3373,7 +3384,8 @@ bool tagcache_import_changelog(void) | |||
3373 | 3384 | ||
3374 | return true; | 3385 | return true; |
3375 | } | 3386 | } |
3376 | #endif | 3387 | |
3388 | #endif /* !__PCTOOL__ */ | ||
3377 | 3389 | ||
3378 | bool tagcache_create_changelog(struct tagcache_search *tcs) | 3390 | bool tagcache_create_changelog(struct tagcache_search *tcs) |
3379 | { | 3391 | { |
diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c index 713a8e70f9..61989e5ab0 100644 --- a/firmware/common/unicode.c +++ b/firmware/common/unicode.c | |||
@@ -83,9 +83,8 @@ static const char *name_codepages[NUM_CODEPAGES+1] = | |||
83 | #define MAX_CP_TABLE_SIZE 640 | 83 | #define MAX_CP_TABLE_SIZE 640 |
84 | #define NUM_TABLES 1 | 84 | #define NUM_TABLES 1 |
85 | 85 | ||
86 | static const char *filename[NUM_TABLES] = | 86 | static const char *filename[NUM_TABLES] = { |
87 | { | 87 | CODEPAGE_DIR"/isomini.cp" |
88 | CODEPAGE_DIR"/isomini.cp", | ||
89 | }; | 88 | }; |
90 | 89 | ||
91 | static const char cp_2_table[NUM_CODEPAGES] = | 90 | static const char cp_2_table[NUM_CODEPAGES] = |
diff --git a/firmware/include/time.h b/firmware/include/time.h index 9200e82232..9010d99cc2 100644 --- a/firmware/include/time.h +++ b/firmware/include/time.h | |||
@@ -37,6 +37,13 @@ struct tm *localtime(const time_t *timep); | |||
37 | 37 | ||
38 | #endif /* SIMULATOR */ | 38 | #endif /* SIMULATOR */ |
39 | 39 | ||
40 | #ifdef __PCTOOL__ | ||
41 | /* this time.h does not define struct timespec, | ||
42 | so tell sys/stat.h not to use it */ | ||
43 | #undef __USE_MISC | ||
44 | #endif | ||
45 | |||
46 | |||
40 | #endif /* _TIME_H_ */ | 47 | #endif /* _TIME_H_ */ |
41 | 48 | ||
42 | 49 | ||
diff --git a/tools/Makefile b/tools/Makefile index 569a727139..43f53e2569 100644 --- a/tools/Makefile +++ b/tools/Makefile | |||
@@ -12,7 +12,7 @@ LDFLAGS := -g | |||
12 | .PHONY: rbspeexenc uclpack | 12 | .PHONY: rbspeexenc uclpack |
13 | 13 | ||
14 | CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \ | 14 | CLEANALL := scramble descramble iriver sh2d bmp2rb rdf2binary convbdf \ |
15 | generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat database \ | 15 | generate_rocklatin mkboot ipod_fw codepages uclpack mi4 gigabeat \ |
16 | lngdump telechips gigabeats creative hmac-sha1 mktccboot mknkboot rbspeexenc mkzenboot | 16 | lngdump telechips gigabeats creative hmac-sha1 mktccboot mknkboot rbspeexenc mkzenboot |
17 | 17 | ||
18 | all: scramble descramble sh2d rdf2binary mkboot mktccboot mknkboot mkzenboot \ | 18 | all: scramble descramble sh2d rdf2binary mkboot mktccboot mknkboot mkzenboot \ |
@@ -66,15 +66,6 @@ lngdump: lngdump.c | |||
66 | ipod_fw: ipod_fw.c | 66 | ipod_fw: ipod_fw.c |
67 | $(SILENT)$(CC) $(CFLAGS) $+ -o $@ | 67 | $(SILENT)$(CC) $(CFLAGS) $+ -o $@ |
68 | 68 | ||
69 | database: database.c ../apps/tagcache.c ../apps/metadata.c \ | ||
70 | ../firmware/id3.c ../firmware/common/unicode.c \ | ||
71 | ../firmware/common/crc32.c ../uisimulator/common/io.c \ | ||
72 | ../firmware/mp3data.c ../firmware/logf.c ../firmware/replaygain.c \ | ||
73 | ../firmware/common/structec.c | ||
74 | $(SILENT)$(CC) $(CFLAGS) -I../firmware/export -iquote ../firmware/include \ | ||
75 | -D__PCTOOL__ -DHAVE_TAGCACHE -DROCKBOX_HAS_LOGF -DSIMULATOR \ | ||
76 | -DCONFIG_CODEC=1 -ldl -I../apps $+ -o $@ | ||
77 | |||
78 | checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c ../apps/misc.c ../apps/recorder/bmp.c | 69 | checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c ../apps/misc.c ../apps/recorder/bmp.c |
79 | $(SILENT)$(CC) $(CFLAGS) -I ../apps/gui -I../firmware/export \ | 70 | $(SILENT)$(CC) $(CFLAGS) -I ../apps/gui -I../firmware/export \ |
80 | -D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN -D WPS_DIR=\".\" \ | 71 | -D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN -D WPS_DIR=\".\" \ |
diff --git a/tools/database.c b/tools/database.c deleted file mode 100644 index 9f0c620c2a..0000000000 --- a/tools/database.c +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* A _very_ skeleton file to demonstrate building tagcache db on host. */ | ||
2 | |||
3 | #include <stdio.h> | ||
4 | #include "tagcache.h" | ||
5 | |||
6 | int main(int argc, char **argv) | ||
7 | { | ||
8 | tagcache_init(); | ||
9 | tagcache_build("/export/stuff/mp3"); | ||
10 | tagcache_reverse_scan(); | ||
11 | |||
12 | return 0; | ||
13 | } | ||
14 | |||
diff --git a/tools/database/Makefile b/tools/database/Makefile new file mode 100644 index 0000000000..01416eca0d --- /dev/null +++ b/tools/database/Makefile | |||
@@ -0,0 +1,37 @@ | |||
1 | INCLUDE = -I../../firmware/export \ | ||
2 | -I../../apps -I../../uisimulator/sdl -I/usr/include/SDL | ||
3 | FIRMINC = -I../../firmware/include -fno-builtin | ||
4 | DEFINES = -D__PCTOOL__ -DHAVE_TAGCACHE -DSIMULATOR -DCONFIG_CODEC=1 \ | ||
5 | -DROCKBOX_LITTLE_ENDIAN -DROCKBOX_DIR=\".rockbox\" -DROCKBOX_HAS_LOGF \ | ||
6 | -DCONFIG_CODEC=1 | ||
7 | CFLAGS = -g $(INCLUDE) $(DEFINES) -Wno-pointer-sign | ||
8 | |||
9 | SRC = database.o tagcache.o replaygain.o \ | ||
10 | metadata.o metadata_common.o mp3data.o \ | ||
11 | a52.o mp3.o adx.o mp4.o aiff.o mpc.o ape.o ogg.o \ | ||
12 | asap.o sid.o asf.o spc.o flac.o vorbis.o wave.o \ | ||
13 | mod.o wavpack.o monkeys.o \ | ||
14 | logf.o unicode.o ctype.o structec.o crc32.o io.o | ||
15 | |||
16 | OBJ = $(SRC:.c=.o) | ||
17 | |||
18 | # source code search path | ||
19 | VPATH = ../../apps ../../apps/metadata ../../firmware/common ../../firmware/ \ | ||
20 | ../../uisimulator/common | ||
21 | |||
22 | all: database | ||
23 | |||
24 | %.o : ../../uisimulator/common/%.c | ||
25 | @echo $(<F) | ||
26 | @$(CC) $(CFLAGS) -c -o $@ $< | ||
27 | |||
28 | %.o : %.c $< | ||
29 | @echo $(<F) | ||
30 | @$(CC) $(FIRMINC) $(CFLAGS) -c -o $@ $< | ||
31 | |||
32 | database: $(OBJ) | ||
33 | @echo Linking $@ | ||
34 | @$(CC) -g -ldl -o $@ $+ | ||
35 | |||
36 | clean: | ||
37 | rm $(OBJ) | ||
diff --git a/tools/database/database.c b/tools/database/database.c new file mode 100644 index 0000000000..a8be48ab4b --- /dev/null +++ b/tools/database/database.c | |||
@@ -0,0 +1,49 @@ | |||
1 | /* A _very_ skeleton file to demonstrate building tagcache db on host. */ | ||
2 | |||
3 | #include <stdio.h> | ||
4 | #include "tagcache.h" | ||
5 | |||
6 | int main(int argc, char **argv) | ||
7 | { | ||
8 | tagcache_init(); | ||
9 | tagcache_build("."); | ||
10 | tagcache_reverse_scan(); | ||
11 | |||
12 | return 0; | ||
13 | } | ||
14 | |||
15 | /* stub to avoid including all of apps/misc.c */ | ||
16 | bool file_exists(const char *file) | ||
17 | { | ||
18 | if (!stat(file)) | ||
19 | return true; | ||
20 | return false; | ||
21 | } | ||
22 | |||
23 | /* stubs to avoid including thread-sdl.c */ | ||
24 | #include "kernel.h" | ||
25 | void mutex_init(struct mutex *m) | ||
26 | { | ||
27 | (void)m; | ||
28 | } | ||
29 | |||
30 | void mutex_lock(struct mutex *m) | ||
31 | { | ||
32 | (void)m; | ||
33 | } | ||
34 | |||
35 | void mutex_unlock(struct mutex *m) | ||
36 | { | ||
37 | (void)m; | ||
38 | } | ||
39 | |||
40 | void thread_sdl_thread_lock(void *me) | ||
41 | { | ||
42 | (void)me; | ||
43 | } | ||
44 | |||
45 | void * thread_sdl_thread_unlock(void) | ||
46 | { | ||
47 | return (void*)1; | ||
48 | } | ||
49 | |||
diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 52df94901b..185e46260c 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c | |||
@@ -252,19 +252,22 @@ static ssize_t io_trigger_and_wait(int cmd) | |||
252 | return result; | 252 | return result; |
253 | } | 253 | } |
254 | 254 | ||
255 | #ifndef __PCTOOL__ | ||
255 | static const char *get_sim_rootdir() | 256 | static const char *get_sim_rootdir() |
256 | { | 257 | { |
257 | if (sim_root_dir != NULL) | 258 | if (sim_root_dir != NULL) |
258 | return sim_root_dir; | 259 | return sim_root_dir; |
259 | return SIMULATOR_DEFAULT_ROOT; | 260 | return SIMULATOR_DEFAULT_ROOT; |
260 | } | 261 | } |
262 | #endif | ||
261 | 263 | ||
262 | MYDIR *sim_opendir(const char *name) | 264 | MYDIR *sim_opendir(const char *name) |
263 | { | 265 | { |
264 | char buffer[MAX_PATH]; /* sufficiently big */ | ||
265 | DIR_T *dir; | 266 | DIR_T *dir; |
266 | 267 | ||
267 | #ifndef __PCTOOL__ | 268 | #ifndef __PCTOOL__ |
269 | char buffer[MAX_PATH]; /* sufficiently big */ | ||
270 | |||
268 | if(name[0] == '/') | 271 | if(name[0] == '/') |
269 | { | 272 | { |
270 | snprintf(buffer, sizeof(buffer), "%s%s", get_sim_rootdir(), name); | 273 | snprintf(buffer, sizeof(buffer), "%s%s", get_sim_rootdir(), name); |
@@ -277,7 +280,8 @@ MYDIR *sim_opendir(const char *name) | |||
277 | if(dir) { | 280 | if(dir) { |
278 | MYDIR *my = (MYDIR *)malloc(sizeof(MYDIR)); | 281 | MYDIR *my = (MYDIR *)malloc(sizeof(MYDIR)); |
279 | my->dir = dir; | 282 | my->dir = dir; |
280 | my->name = (char *)strdup(name); | 283 | my->name = (char *)malloc(strlen(name)+1); |
284 | strcpy(my->name, name); | ||
281 | 285 | ||
282 | return my; | 286 | return my; |
283 | } | 287 | } |
@@ -357,12 +361,10 @@ int sim_open(const char *name, int o) | |||
357 | name); | 361 | name); |
358 | return -1; | 362 | return -1; |
359 | #else | 363 | #else |
360 | if (num_openfiles < MAX_OPEN_FILES) | 364 | ret = OPEN(name, opts, 0666); |
361 | { | 365 | if (ret >= 0) |
362 | ret = OPEN(buffer, opts, 0666); | 366 | num_openfiles++; |
363 | if (ret >= 0) num_openfiles++; | 367 | return ret; |
364 | return ret; | ||
365 | } | ||
366 | #endif | 368 | #endif |
367 | } | 369 | } |
368 | 370 | ||