From 22b7701fe75cce9afdbc27046821dc089f9e7dac Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 22 Feb 2005 12:19:12 +0000 Subject: Build cleanup and general fixes. fprintf() is now fdprintf(), the separation between uisimulator files and firmware/apps files are better done. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6031 a1c6a512-1295-4272-9138-f99709370657 --- apps/Makefile | 16 +++++- apps/playlist.c | 18 +++--- apps/plugin.c | 60 +++++-------------- apps/plugin.h | 38 +++++++----- apps/plugins/Makefile | 6 ++ apps/plugins/calendar.c | 14 ++--- apps/plugins/lib/configfile.c | 8 +-- apps/settings.c | 20 +++---- firmware/common/sprintf.c | 2 +- firmware/debug.c | 24 -------- firmware/export/kernel.h | 4 ++ firmware/export/lcd.h | 8 +-- firmware/export/mpeg.h | 4 ++ firmware/include/dir.h | 36 ++++++------ firmware/include/file.h | 36 ++++-------- firmware/include/sprintf.h | 2 +- firmware/include/stdio.h | 1 - firmware/include/sys/types.h | 49 ++++++++++++++++ firmware/kernel.c | 7 +++ firmware/mpeg.c | 2 - tools/configure | 14 ++++- tools/make.inc | 2 +- uisimulator/common/Makefile | 6 +- uisimulator/common/dir.h | 45 --------------- uisimulator/common/file.h | 76 ------------------------ uisimulator/common/io.c | 124 +++++++++++++++++++++++++++++++++++++--- uisimulator/common/lcd-common.c | 4 +- uisimulator/common/stubs.c | 3 +- uisimulator/win32/Makefile | 15 ++--- uisimulator/win32/SOURCES | 2 + uisimulator/win32/dir-win32.h | 1 - uisimulator/x11/Makefile | 3 +- uisimulator/x11/kernel.h | 31 ---------- uisimulator/x11/thread.c | 15 +++++ 34 files changed, 342 insertions(+), 354 deletions(-) create mode 100644 firmware/include/sys/types.h delete mode 100644 uisimulator/common/dir.h delete mode 100644 uisimulator/common/file.h delete mode 100644 uisimulator/x11/kernel.h diff --git a/apps/Makefile b/apps/Makefile index bcdc1ef265..4f80e045b7 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -43,6 +43,8 @@ MAXOUTFILE = $(OBJDIR)/romstart ifdef SIMVER # this is a sim build all: $(OBJDIR)/$(BINARY) $(CODECS) $(ROCKS) + @$(MAKE) -C $(SIMDIR) + @$(MAKE) -C $(ROOTDIR)/uisimulator/common else # regular target build all: $(OBJDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM) @@ -101,12 +103,22 @@ $(OBJDIR)/$(BINARY) : $(OBJDIR)/rockbox.bin else # this is a simulator build -$(OBJDIR)/$(BINARY) : $(OBJS) $(OBJDIR)/librockbox.a $(DEPFILE) $(OBJDIR)/libsim.a + +ifeq ($(SIMVER), win32) +# OK, this is ugly but we need it on the link line to make it do right +EXTRAOBJ = $(OBJDIR)/uisw32-res.o +endif + + +$(OBJDIR)/$(BINARY) : $(OBJS) $(OBJDIR)/librockbox.a $(DEPFILE) $(OBJDIR)/libsim.a $(OBJDIR)/libcomsim.a @echo "LD $(BINARY)" - $(CC) $(GCCOPTS) -o $@ $(OBJS) $(LDOPTS) -L$(OBJDIR) -lrockbox -lsim -Wl,-Map,$(OBJDIR)/rockbox.map + $(CC) $(GCCOPTS) -o $@ $(OBJS) -L$(OBJDIR) -lrockbox -lsim -lcomsim $(LDOPTS) $(EXTRAOBJ) -Wl,-Map,$(OBJDIR)/rockbox.map $(OBJDIR)/libsim.a: @$(MAKE) -C $(SIMDIR) + +$(OBJDIR)/libcomsim.a: + @$(MAKE) -C $(ROOTDIR)/uisimulator/common endif $(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin diff --git a/apps/playlist.c b/apps/playlist.c index 5e7f679800..cb9d2ba3ea 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -231,7 +231,7 @@ static void new_playlist(struct playlist_info* playlist, const char *dir, if (playlist->control_fd >= 0) { - if (fprintf(playlist->control_fd, "P:%d:%s:%s\n", + if (fdprintf(playlist->control_fd, "P:%d:%s:%s\n", PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) fsync(playlist->control_fd); else @@ -279,7 +279,7 @@ static int check_control(struct playlist_info* playlist) playlist->filename[playlist->dirlen-1] = '\0'; - if (fprintf(playlist->control_fd, "P:%d:%s:%s\n", + if (fdprintf(playlist->control_fd, "P:%d:%s:%s\n", PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0) fsync(playlist->control_fd); else @@ -499,13 +499,13 @@ static int add_track_to_playlist(struct playlist_info* playlist, if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) { - if (fprintf(playlist->control_fd, "%c:%d:%d:", (queue?'Q':'A'), + if (fdprintf(playlist->control_fd, "%c:%d:%d:", (queue?'Q':'A'), position, playlist->last_insert_pos) > 0) { /* save the position in file where track name is written */ seek_pos = lseek(playlist->control_fd, 0, SEEK_CUR); - if (fprintf(playlist->control_fd, "%s\n", filename) > 0) + if (fdprintf(playlist->control_fd, "%s\n", filename) > 0) result = 0; } } @@ -697,7 +697,7 @@ static int remove_track_from_playlist(struct playlist_info* playlist, if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) { - if (fprintf(playlist->control_fd, "D:%d\n", position) > 0) + if (fdprintf(playlist->control_fd, "D:%d\n", position) > 0) { fsync(playlist->control_fd); result = 0; @@ -1098,10 +1098,10 @@ static int flush_pending_control(struct playlist_info* playlist) if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) { if (global_settings.resume_seed == 0) - result = fprintf(playlist->control_fd, "U:%d\n", + result = fdprintf(playlist->control_fd, "U:%d\n", playlist->first_index); else - result = fprintf(playlist->control_fd, "S:%d:%d\n", + result = fdprintf(playlist->control_fd, "S:%d:%d\n", global_settings.resume_seed, playlist->first_index); if (result > 0) @@ -1737,7 +1737,7 @@ int playlist_next(int steps) if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) { - if (fprintf(playlist->control_fd, "R\n") > 0) + if (fdprintf(playlist->control_fd, "R\n") > 0) { fsync(playlist->control_fd); result = 0; @@ -2407,7 +2407,7 @@ int playlist_save(struct playlist_info* playlist, char *filename) break; } - if (fprintf(fd, "%s\n", tmp_buf) < 0) + if (fdprintf(fd, "%s\n", tmp_buf) < 0) { splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR)); result = -1; diff --git a/apps/plugin.c b/apps/plugin.c index 10daeaf325..194ec34484 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -50,18 +50,6 @@ #include "widgets.h" #endif -#ifdef SIMULATOR - #include - #ifdef WIN32 - #include "plugin-win32.h" - #else - #include - #endif - #define PREFIX(_x_) sim_ ## _x_ -#else -#define PREFIX(_x_) _x_ -#endif - #if MEM >= 32 #define PLUGIN_BUFFER_SIZE 0xC0000 #else @@ -70,7 +58,9 @@ #ifdef SIMULATOR static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; +void *sim_plugin_load(char *plugin, int *fd); #else +#define sim_plugin_close(x) extern unsigned char pluginbuf[]; #include "bitswap.h" #endif @@ -142,16 +132,16 @@ static const struct plugin_api rockbox_api = { /* file */ (open_func)PREFIX(open), - PREFIX(close), + close, (read_func)read, lseek, (creat_func)PREFIX(creat), (write_func)write, PREFIX(remove), PREFIX(rename), - ftruncate, + PREFIX(ftruncate), PREFIX(filesize), - fprintf, + fdprintf, read_line, settings_parseline, #ifndef SIMULATOR @@ -189,6 +179,9 @@ static const struct plugin_api rockbox_api = { memcpy, _ctype_, atoi, + strchr, + strcat, + memcmp, /* sound */ mpeg_sound_set, @@ -201,7 +194,7 @@ static const struct plugin_api rockbox_api = { #endif /* playback control */ - mpeg_play, + PREFIX(mpeg_play), mpeg_stop, mpeg_pause, mpeg_resume, @@ -264,10 +257,6 @@ static const struct plugin_api rockbox_api = { /* new stuff at the end, sort into place next time the API gets incompatible */ - - strchr, - strcat, - memcmp }; int plugin_load(const char* plugin, void* parameter) @@ -275,12 +264,8 @@ int plugin_load(const char* plugin, void* parameter) enum plugin_status (*plugin_start)(struct plugin_api* api, void* param); int rc; char buf[64]; -#ifdef SIMULATOR - void* pd; - char path[256]; -#else int fd; -#endif + #ifdef HAVE_LCD_BITMAP int xm,ym; #endif @@ -301,26 +286,9 @@ int plugin_load(const char* plugin, void* parameter) lcd_clear_display(); #endif #ifdef SIMULATOR - snprintf(path, sizeof path, "archos%s", plugin); - - pd = dlopen(path, RTLD_NOW); - if (!pd) { - snprintf(buf, sizeof buf, str(LANG_PLUGIN_CANT_OPEN), plugin); - splash(HZ*2, true, buf); - DEBUGF("dlopen(%s): %s\n",path,dlerror()); - dlclose(pd); + plugin_start = sim_plugin_load(plugin, &fd); + if(!plugin_start) return -1; - } - - plugin_start = dlsym(pd, "plugin_start"); - if (!plugin_start) { - plugin_start = dlsym(pd, "_plugin_start"); - if (!plugin_start) { - splash(HZ*2, true, "Can't find entry point"); - dlclose(pd); - return -1; - } - } #else fd = open(plugin, O_RDONLY); if (fd < 0) { @@ -379,9 +347,7 @@ int plugin_load(const char* plugin, void* parameter) break; } -#ifdef SIMULATOR - dlclose(pd); -#endif + sim_plugin_close(fd); #ifdef HAVE_LCD_BITMAP /* restore margins */ diff --git a/apps/plugin.h b/apps/plugin.h index 96a9aabe1d..896565e9a0 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -32,6 +32,7 @@ #include #include #include +#include #include "config.h" #include "dir.h" #include "kernel.h" @@ -51,7 +52,9 @@ #ifdef PLUGIN #if defined(DEBUG) || defined(SIMULATOR) +#undef DEBUGF #define DEBUGF rb->debugf +#undef LDEBUGF #define LDEBUGF rb->debugf #else #define DEBUGF(...) @@ -59,13 +62,19 @@ #endif #endif +#ifdef SIMULATOR +#define PREFIX(_x_) sim_ ## _x_ +#else +#define PREFIX(_x_) _x_ +#endif + /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 31 +#define PLUGIN_API_VERSION 32 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define PLUGIN_MIN_API_VERSION 29 +#define PLUGIN_MIN_API_VERSION 32 /* plugin return codes */ enum plugin_status { @@ -165,17 +174,17 @@ struct plugin_api { void (*button_clear_queue)(void); /* file */ - int (*open)(const char* pathname, int flags); + int (*PREFIX(open))(const char* pathname, int flags); int (*close)(int fd); ssize_t (*read)(int fd, void* buf, size_t count); off_t (*lseek)(int fd, off_t offset, int whence); - int (*creat)(const char *pathname, mode_t mode); + int (*PREFIX(creat))(const char *pathname, mode_t mode); ssize_t (*write)(int fd, const void* buf, size_t count); - int (*remove)(const char* pathname); - int (*rename)(const char* path, const char* newname); - int (*ftruncate)(int fd, off_t length); - off_t (*filesize)(int fd); - int (*fprintf)(int fd, const char *fmt, ...); + int (*PREFIX(remove))(const char* pathname); + int (*PREFIX(rename))(const char* path, const char* newname); + int (*PREFIX(ftruncate))(int fd, off_t length); + off_t (*PREFIX(filesize))(int fd); + int (*fdprintf)(int fd, const char *fmt, ...); int (*read_line)(int fd, char* buffer, int buffer_size); bool (*settings_parseline)(char* line, char** name, char** value); #ifndef SIMULATOR @@ -188,7 +197,7 @@ struct plugin_api { struct dirent* (*readdir)(DIR* dir); /* kernel/ system */ - void (*sleep)(int ticks); + void (*PREFIX(sleep))(int ticks); void (*yield)(void); long* current_tick; long (*default_event_handler)(long event); @@ -213,6 +222,9 @@ struct plugin_api { void* (*memcpy)(void *out, const void *in, size_t n); const char *_ctype_; int (*atoi)(const char *str); + char *(*strchr)(const char *s, int c); + char *(*strcat)(char *s1, const char *s2); + int (*memcmp)(const void *s1, const void *s2, size_t n); /* sound */ void (*mpeg_sound_set)(int setting, int value); @@ -225,7 +237,7 @@ struct plugin_api { #endif /* playback control */ - void (*mpeg_play)(int offset); + void (*PREFIX(mpeg_play))(int offset); void (*mpeg_stop)(void); void (*mpeg_pause)(void); void (*mpeg_resume)(void); @@ -295,10 +307,6 @@ struct plugin_api { /* new stuff at the end, sort into place next time the API gets incompatible */ - - char *(*strchr)(const char *s, int c); - char *(*strcat)(char *s1, const char *s2); - int (*memcmp)(const void *s1, const void *s2, size_t n); }; /* defined by the plugin loader (plugin.c) */ diff --git a/apps/plugins/Makefile b/apps/plugins/Makefile index 9549959bbd..ef506a9c4a 100644 --- a/apps/plugins/Makefile +++ b/apps/plugins/Makefile @@ -71,7 +71,13 @@ $(OBJDIR)/%.rock : $(OBJDIR)/%.o $(APPSDIR)/plugin.h @echo "DLL $@" @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< @$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/libplugin.a -o $@ +ifeq ($(UNAME),CYGWIN) +# 'x' must be kept or you'll have "Win32 error 5" +# $ fgrep 5 /usr/include/w32api/winerror.h | head -1 +# #define ERROR_ACCESS_DENIED 5L +else @chmod -x $@ +endif endif # end of win32-simulator endif # end of simulator section diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 44b3685c40..8627c9a558 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -325,13 +325,13 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown) } if (new_mod) { - rb->fprintf(fq, "%02d%02d%04d%01d%01d%s\n", - memos[changed].day, - memos[changed].month, - memos[changed].year, - memos[changed].wday, - memos[changed].type, - memos[changed].message); + rb->fdprintf(fq, "%02d%02d%04d%01d%01d%s\n", + memos[changed].day, + memos[changed].month, + memos[changed].year, + memos[changed].wday, + memos[changed].type, + memos[changed].message); } rb->lseek(fp, memos[changed].file_pointer_end, SEEK_SET); for (i = memos[changed].file_pointer_end; diff --git a/apps/plugins/lib/configfile.c b/apps/plugins/lib/configfile.c index ff4809a3f4..f2f0a39da0 100644 --- a/apps/plugins/lib/configfile.c +++ b/apps/plugins/lib/configfile.c @@ -38,24 +38,24 @@ int configfile_save(const char *filename, struct configdata *cfg, if(fd < 0) return fd*10 - 1; - cfg_rb->fprintf(fd, "file version: %d\n", version); + cfg_rb->fdprintf(fd, "file version: %d\n", version); for(i = 0;i < num_items;i++) { switch(cfg[i].type) { case TYPE_INT: - cfg_rb->fprintf(fd, "%s: %d\n", + cfg_rb->fdprintf(fd, "%s: %d\n", cfg[i].name, *cfg[i].val); break; case TYPE_ENUM: - cfg_rb->fprintf(fd, "%s: %s\n", + cfg_rb->fdprintf(fd, "%s: %s\n", cfg[i].name, cfg[i].values[*cfg[i].val]); break; case TYPE_STRING: - cfg_rb->fprintf(fd, "%s: %s\n", + cfg_rb->fdprintf(fd, "%s: %s\n", cfg[i].name, cfg[i].string); break; diff --git a/apps/settings.c b/apps/settings.c index ba80bfb9d9..86c1178745 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -1127,13 +1127,13 @@ static void save_cfg_table(const struct bit_entry* p_table, int count, int fd) if (p_run->cfg_val == NULL) /* write as number */ { - fprintf(fd, "%s: %ld\r\n", p_run->cfg_name, value); + fdprintf(fd, "%s: %ld\r\n", p_run->cfg_name, value); } else /* write as item */ { const char* p = p_run->cfg_val; - fprintf(fd, "%s: ", p_run->cfg_name); + fdprintf(fd, "%s: ", p_run->cfg_name); while(value >= 0) { @@ -1146,9 +1146,9 @@ static void save_cfg_table(const struct bit_entry* p_table, int count, int fd) write(fd, &c, 1); /* char by char, this is lame, OK */ } - fprintf(fd, "\r\n"); + fdprintf(fd, "\r\n"); if (p_run->cfg_val != off_on) /* explaination for non-bool */ - fprintf(fd, "# (possible values: %s)\r\n", p_run->cfg_val); + fdprintf(fd, "# (possible values: %s)\r\n", p_run->cfg_val); } } } @@ -1195,21 +1195,21 @@ bool settings_save_config(void) return false; } - fprintf(fd, "# >>> .cfg file created by rockbox %s <<<\r\n", appsversion); - fprintf(fd, "# >>> http://rockbox.haxx.se <<<\r\n#\r\n"); - fprintf(fd, "#\r\n# wps / language / font \r\n#\r\n"); + fdprintf(fd, "# .cfg file created by rockbox %s - ", appsversion); + fdprintf(fd, "http://www.rockbox.org\r\n#\r\n"); + fdprintf(fd, "#\r\n# wps / language / font \r\n#\r\n"); if (global_settings.wps_file[0] != 0) - fprintf(fd, "wps: %s/%s.wps\r\n", ROCKBOX_DIR, + fdprintf(fd, "wps: %s/%s.wps\r\n", ROCKBOX_DIR, global_settings.wps_file); if (global_settings.lang_file[0] != 0) - fprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR LANG_DIR, + fdprintf(fd, "lang: %s/%s.lng\r\n", ROCKBOX_DIR LANG_DIR, global_settings.lang_file); #ifdef HAVE_LCD_BITMAP if (global_settings.font_file[0] != 0) - fprintf(fd, "font: %s/%s.fnt\r\n", ROCKBOX_DIR FONT_DIR, + fdprintf(fd, "font: %s/%s.fnt\r\n", ROCKBOX_DIR FONT_DIR, global_settings.font_file); #endif diff --git a/firmware/common/sprintf.c b/firmware/common/sprintf.c index 8683945211..3518a1ba5e 100644 --- a/firmware/common/sprintf.c +++ b/firmware/common/sprintf.c @@ -231,7 +231,7 @@ static int fprfunc(void *pr, unsigned char letter) } -int fprintf(int fd, const char *fmt, ...) +int fdprintf(int fd, const char *fmt, ...) { bool ok; va_list ap; diff --git a/firmware/debug.c b/firmware/debug.c index 0989e80b17..e3be2de168 100644 --- a/firmware/debug.c +++ b/firmware/debug.c @@ -216,28 +216,4 @@ void debugf(const char *fmt, ...) #endif } - -#else /* SIMULATOR code coming up */ - -void debug_init(void) -{ -} -extern void *stderr; - -void debugf(const char *fmt, ...) -{ - va_list ap; - va_start( ap, fmt ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); -} - -void ldebugf(const char* file, int line, const char *fmt, ...) -{ - va_list ap; - va_start( ap, fmt ); - fprintf( stderr, "%s:%d ", file, line ); - vfprintf( stderr, fmt, ap ); - va_end( ap ); -} #endif diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 8a4a642a86..bbb4c68ff9 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h @@ -65,6 +65,10 @@ struct mutex /* global tick variable */ extern long current_tick; +#ifdef SIMULATOR +#define sleep(x) sim_sleep(x) +#endif + /* kernel functions */ extern void kernel_init(void); extern void yield(void); diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 6d485c2f43..98e2a58a53 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -27,6 +27,10 @@ #define STYLE_DEFAULT 0 #define STYLE_INVERT 1 +#ifdef SIMULATOR +#define lcd_icon(x,y) sim_lcd_icon(x,y) +#endif + /* common functions */ extern void lcd_init(void); extern void lcd_clear_display(void); @@ -61,10 +65,6 @@ extern void lcd_update_rect(int x, int y, int width, int height); #define lcd_update_rect(x,y,w,h) #endif -#if defined(SIMULATOR) -#include "sim_icons.h" -#endif - #ifdef HAVE_LCD_CHARCELLS /* Icon definitions for lcd_icon() */ diff --git a/firmware/export/mpeg.h b/firmware/export/mpeg.h index 671f9389f0..479c5f2317 100644 --- a/firmware/export/mpeg.h +++ b/firmware/export/mpeg.h @@ -42,6 +42,10 @@ /* For ID3 info and VBR header */ #define MPEG_RESERVED_HEADER_SPACE (4096 + 1500) +#ifdef SIMULATOR +#define mpeg_play(x) sim_mpeg_play(x) +#endif + struct mpeg_debug { int mp3buflen; diff --git a/firmware/include/dir.h b/firmware/include/dir.h index 12ec724692..26ccd03ed3 100644 --- a/firmware/include/dir.h +++ b/firmware/include/dir.h @@ -30,6 +30,16 @@ #define ATTR_ARCHIVE 0x20 #define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ +#ifdef SIMULATOR +#define dirent sim_dirent +#define DIR SIM_DIR +#define opendir(x) sim_opendir(x) +#define readdir(x) sim_readdir(x) +#define closedir(x) sim_closedir(x) +#define mkdir(x, y) sim_mkdir(x, y) +#define rmdir(x) sim_rmdir(x) +#endif + #ifndef DIRENT_DEFINED struct dirent { @@ -42,12 +52,10 @@ struct dirent { }; #endif - -#ifndef SIMULATOR - #include "fat.h" typedef struct { +#ifndef SIMULATOR bool busy; int startcluster; struct fat_dir fatdir; @@ -56,25 +64,13 @@ typedef struct { #ifdef HAVE_MULTIVOLUME int volumecounter; /* running counter for faked volume entries */ #endif +#else + /* simulator: */ + void *dir; /* actually a DIR* dir */ + char *name; +#endif } DIR; -#else /* SIMULATOR */ - -#ifdef WIN32 -#ifndef __MINGW32__ -#include -#endif /* __MINGW32__ */ - -typedef struct DIRtag -{ - struct dirent fd; - int handle; -} DIR; - -#endif /* WIN32 */ - -#endif /* SIMULATOR */ - #ifndef DIRFUNCTIONS_DEFINED extern DIR* opendir(const char* name); diff --git a/firmware/include/file.h b/firmware/include/file.h index af1ad72be9..694de48348 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h @@ -20,6 +20,8 @@ #ifndef _FILE_H_ #define _FILE_H_ +#include + #undef MAX_PATH /* this avoids problems when building simulator */ #define MAX_PATH 260 @@ -42,30 +44,14 @@ #define O_TRUNC 0x10 #endif -#if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) -#define __ssize_t_defined -#define _SSIZE_T_ -#define ssize_t ssize_t -typedef signed long ssize_t; -#endif - -#if !defined(__off_t_defined) && !defined(_OFF_T_) && !defined(off_t) -#define __off_t_defined -#define _OFF_T_ -#define off_t off_t -typedef signed long off_t; -#endif - -#if !defined(__mode_t_defined) && !defined(_MODE_T_) && !defined(mode_t) -#define __mode_t_defined -#define _MODE_T_ -#define mode_t mode_t -typedef unsigned int mode_t; -#endif - -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned long size_t; +#ifdef SIMULATOR +#define open(x,y) sim_open(x,y) +#define creat(x,y) sim_creat(x,y) +#define remove(x) sim_remove(x) +#define rename(x,y) sim_rename(x,y) +#define filesize(x) sim_filesize(x) +#define fsync(x) sim_fsync(x) +#define ftruncate(x,y) sim_ftruncate(x,y) #endif typedef int (*open_func)(const char* pathname, int flags); @@ -75,7 +61,6 @@ typedef ssize_t (*write_func)(int fd, const void *buf, size_t count); typedef void (*qsort_func)(void *base, size_t nmemb, size_t size, int(*_compar)(const void *, const void *)); -#ifndef SIMULATOR extern int open(const char* pathname, int flags); extern int close(int fd); extern int fsync(int fd); @@ -88,6 +73,5 @@ extern int rename(const char* path, const char* newname); extern int ftruncate(int fd, off_t length); extern off_t filesize(int fd); extern int release_files(int volume); -#endif /* SIMULATOR */ #endif diff --git a/firmware/include/sprintf.h b/firmware/include/sprintf.h index d68647ee72..b667a0406b 100644 --- a/firmware/include/sprintf.h +++ b/firmware/include/sprintf.h @@ -33,7 +33,7 @@ int snprintf (char *buf, size_t size, const char *fmt, ...) ATTRIBUTE_PRINTF(3, 4); int vsnprintf (char *buf, int size, const char *fmt, va_list ap); -int fprintf (int fd, const char *fmt, ...) +int fdprintf (int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); #endif /* __SPRINTF_H__ */ diff --git a/firmware/include/stdio.h b/firmware/include/stdio.h index dd22f7d5b1..968bd59aab 100644 --- a/firmware/include/stdio.h +++ b/firmware/include/stdio.h @@ -39,7 +39,6 @@ int vsnprintf (char *buf, int size, const char *fmt, __VALIST ap); #ifdef SIMULATOR typedef void FILE; int vfprintf(FILE *stream, const char *format, __VALIST ap); -int fprintf(FILE *stream, const char *format, ...); #ifdef WIN32 #define FILENAME_MAX 260 /* ugly hard-coded value of a limit that is set in file.h */ diff --git a/firmware/include/sys/types.h b/firmware/include/sys/types.h new file mode 100644 index 0000000000..7bca33b78d --- /dev/null +++ b/firmware/include/sys/types.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2005 by Daniel Stenberg + * + * All files in this archive are subject to the GNU General Public License. + * See the file COPYING in the source tree root for full license agreement. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef _SYS_TYPES_H_ +#define _SYS_TYPES_H_ + +#if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) +#define __ssize_t_defined +#define _SSIZE_T_ +#define ssize_t ssize_t +typedef signed long ssize_t; +#endif + +#if !defined(__off_t_defined) && !defined(_OFF_T_) && !defined(off_t) +#define __off_t_defined +#define _OFF_T_ +#define off_t off_t +typedef signed long off_t; +#endif + +#if !defined(__mode_t_defined) && !defined(_MODE_T_) && !defined(mode_t) +#define __mode_t_defined +#define _MODE_T_ +#define mode_t mode_t +typedef unsigned int mode_t; +#endif + +#ifndef _SIZE_T +#define _SIZE_T +typedef unsigned long size_t; +#endif + +#endif /* _SYS_TYPES_H */ diff --git a/firmware/kernel.c b/firmware/kernel.c index 1306b4b524..d21244202f 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c @@ -352,6 +352,11 @@ int tick_remove_task(void (*f)(void)) return -1; } +#ifndef SIMULATOR +/* + * Simulator versions in uisimulator/SIMVER/ + */ + /**************************************************************************** * Simple mutex functions ****************************************************************************/ @@ -375,3 +380,5 @@ void mutex_unlock(struct mutex *m) { m->locked = false; } + +#endif diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 8673da9980..5d4c5daa5c 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -39,8 +39,6 @@ #include "usb.h" #include "file.h" #include "hwcompat.h" -#else -#include "mpegplay.h" #endif /* #ifndef SIMULATOR */ #include "bitswap.h" diff --git a/tools/configure b/tools/configure index 364a3d707e..c56f28edba 100755 --- a/tools/configure +++ b/tools/configure @@ -48,19 +48,29 @@ simcc () { # default tool setup for native building prefixtools "" - GCCOPTS='-W -Wall -g -fno-builtin -I$(ROOTDIR)/uisimulator/common -I$(ROOTDIR)/uisimulator/$(SIMVER)' + GCCOPTS='-W -Wall -g -fno-builtin' output="rockboxui" # use this as default output binary name case $uname in CYGWIN*) echo "Cygwin host detected" - LDOPTS='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread' + + if [ "$simver" = "win32" ]; then + # win32 version + GCCOPTS="$GCCOPTS -mno-cygwin -DNOCYGWIN" + LDOPTS="-lgdi32 -luser32 -mno-cygwin" + else + # x11 version + GCCOPTS="$GCCOPTS -DNOCYGWIN" + LDOPTS='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread' + fi output="rockboxui.exe" # use this as output binary name ;; Linux) echo "Linux host detected" + GCCOPTS="$GCCOPTS" LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread' if [ "$simver" = "win32" ]; then crosswincc # setup cross-compiler diff --git a/tools/make.inc b/tools/make.inc index 0da7a8b17c..7823d08b67 100644 --- a/tools/make.inc +++ b/tools/make.inc @@ -3,7 +3,7 @@ $(OBJDIR)/%.o: %.c @mkdir -p `dirname $@` @echo "CC $<" - @$(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) -c $< -o $@ $(OBJDIR)/%.o: %.S @mkdir -p `dirname $@` diff --git a/uisimulator/common/Makefile b/uisimulator/common/Makefile index b044440adf..e2b6b2a4f8 100644 --- a/uisimulator/common/Makefile +++ b/uisimulator/common/Makefile @@ -23,7 +23,7 @@ RM = rm -f DEBUG = -g # Use this for simulator-only files -INCLUDES = -I. -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR) +INCLUDES = -I. -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR) -I$(ROOTDIR)/uisimulator/$(SIMVER) SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) @@ -38,7 +38,7 @@ DIRS = . CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS) -OUTFILE = $(OBJDIR)/libsim.a +OUTFILE = $(OBJDIR)/libcomsim.a all: $(OUTFILE) @@ -46,7 +46,7 @@ include $(TOOLSDIR)/make.inc clean: @echo "cleaning commonsim" - @$(RM) $(OBJS) *~ core $(DEPFILE) + @$(RM) $(OBJS) *~ core $(DEPFILE) $(OUTFILE) $(OUTFILE): $(OBJS) @echo "AR+RANLIB $@" diff --git a/uisimulator/common/dir.h b/uisimulator/common/dir.h deleted file mode 100644 index 18cfbb3736..0000000000 --- a/uisimulator/common/dir.h +++ /dev/null @@ -1,45 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Daniel Stenberg - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#ifndef _SIM_DIR_H_ -#define _SIM_DIR_H_ - -#include - -#define DIRFUNCTIONS_DEFINED /* prevent those prototypes */ -#define dirent sim_dirent -#include "../../firmware/include/dir.h" -#undef dirent - -typedef void * MYDIR; - -extern MYDIR *sim_opendir(const char *name); -extern struct sim_dirent* sim_readdir(MYDIR* dir); -extern int sim_closedir(MYDIR *dir); -extern int sim_mkdir(const char *name, int mode); -extern int sim_rmdir(char *name); - -#define DIR MYDIR -#define dirent sim_dirent -#define opendir(x) sim_opendir(x) -#define readdir(x) sim_readdir(x) -#define closedir(x) sim_closedir(x) -#define mkdir(x, y) sim_mkdir(x, y) -#define rmdir(x) sim_rmdir(x) - -#endif diff --git a/uisimulator/common/file.h b/uisimulator/common/file.h deleted file mode 100644 index 7ea59a0b74..0000000000 --- a/uisimulator/common/file.h +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Daniel Stenberg - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#ifndef _SIM_FILE_H_ -#define _SIM_FILE_H_ - -#ifdef WIN32 -#include -#include -#else -#include -#endif - -#include - -#ifdef WIN32 -#ifndef _commit -extern int _commit( int handle ); - -#ifdef _MSC_VER -typedef unsigned int mode_t; -#endif - -#endif -#endif - -int sim_open(const char *name, int opts); -int sim_close(int fd); -int sim_rename(const char *oldpath, const char *newpath); -off_t sim_filesize(int fd); -int sim_creat(const char *name, mode_t mode); -int sim_remove(const char *name); - -#ifndef NO_REDEFINES_PLEASE -#define open(x,y) sim_open(x,y) -#define close(x) sim_close(x) -#define filesize(x) sim_filesize(x) -#define creat(x,y) sim_creat(x,y) -#define remove(x) sim_remove(x) -#define rename(x,y) sim_rename(x,y) -#ifdef WIN32 -#define fsync _commit -#endif -#endif - -#include "../../firmware/include/file.h" - -#ifndef WIN32 -int open(const char* pathname, int flags); -int close(int fd); -int printf(const char *format, ...); -int ftruncate(int fd, off_t length); -int fsync(int fd); - -off_t lseek(int fildes, off_t offset, int whence); -ssize_t read(int fd, void *buf, size_t count); -ssize_t write(int fd, const void *buf, size_t count); -#endif - -#endif diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 6335735f8f..48b888a027 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #ifdef __FreeBSD__ #include @@ -28,6 +29,10 @@ #include #endif +#ifdef WIN32 +#include +#endif + #ifndef _MSC_VER #include #include @@ -35,18 +40,27 @@ #include "dir-win32.h" #endif +#define MAX_PATH 260 + #include #include "debug.h" -#define DIRFUNCTIONS_DEFINED /* prevent those prototypes */ -#define dirent sim_dirent -#define DIR SIMDIR -#include "../../firmware/include/dir.h" -#undef dirent -#undef DIR - #define SIMULATOR_ARCHOS_ROOT "archos" +struct sim_dirent { + unsigned char d_name[MAX_PATH]; + int attribute; + int size; + int startcluster; + unsigned short wrtdate; /* Last write date */ + unsigned short wrttime; /* Last write time */ +}; + +struct dirstruct { + void *dir; /* actually a DIR* dir */ + char *name; +} SIM_DIR; + struct mydir { DIR *dir; char *name; @@ -113,6 +127,8 @@ struct sim_dirent *sim_readdir(MYDIR *dir) dir->name, x11->d_name); stat(buffer, &s); /* get info */ +#define ATTR_DIRECTORY 0x10 + secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0; secret.size = s.st_size; secret.wrtdate = (unsigned short)(s.st_mtime >> 16); @@ -181,6 +197,7 @@ int sim_mkdir(const char *name, mode_t mode) debugf("We create the real directory '%s'\n", buffer); #ifdef WIN32 + /* since we build with -DNOCYGWIN we have the plain win32 version */ return (mkdir)(buffer); #else return (mkdir)(buffer, 0666); @@ -260,3 +277,96 @@ void fat_size(unsigned int* size, unsigned int* free) } #endif } + +int sim_fsync(int fd) +{ +#ifdef WIN32 + return _commit(fd); +#else + return fsync(fd); +#endif +} + +#ifdef WIN32 +/* sim-win32 */ +typedef enum plugin_status (*plugin_fn)(void* api, void* param); +#define dlopen(_x_, _y_) LoadLibrary(_x_) +#define dlsym(_x_, _y_) (plugin_fn)GetProcAddress(_x_, _y_) +#define dlclose(_x_) FreeLibrary(_x_) +#define dlerror() "Unknown" +#else +/* sim-x11 */ +#include +#endif + +void *sim_plugin_load(char *plugin, int *fd) +{ + void* pd; + char path[256]; + char buf[256]; + int (*plugin_start)(void * api, void* param); + + snprintf(path, sizeof path, "archos%s", plugin); + + *fd = -1; + + pd = dlopen(path, RTLD_NOW); + if (!pd) { + snprintf(buf, sizeof buf, "failed to load %s", plugin); + DEBUGF("dlopen(%s): %s\n",path,dlerror()); + dlclose(pd); + return NULL; + } + + plugin_start = dlsym(pd, "plugin_start"); + if (!plugin_start) { + plugin_start = dlsym(pd, "_plugin_start"); + if (!plugin_start) { + dlclose(pd); + return NULL; + } + } + *fd = pd; /* success */ + return plugin_start; +} + +void sim_plugin_close(int pd) +{ + dlclose(pd); +} + +#ifndef WIN32 +/* the win32 version is in debug-win32.c */ + +void debug_init(void) +{ + /* nothing to be done */ +} + +void debugf(const char *fmt, ...) +{ + va_list ap; + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); +} + +void ldebugf(const char* file, int line, const char *fmt, ...) +{ + va_list ap; + va_start( ap, fmt ); + fprintf( stderr, "%s:%d ", file, line ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); +} + +#endif + +int sim_ftruncate(int fd, off_t length) +{ +#ifdef WIN32 + return _chsize(fd, length); +#else + return ftruncate(fd, length); +#endif +} diff --git a/uisimulator/common/lcd-common.c b/uisimulator/common/lcd-common.c index c69ef06f1f..95c42ad8db 100644 --- a/uisimulator/common/lcd-common.c +++ b/uisimulator/common/lcd-common.c @@ -25,9 +25,9 @@ #include "lcd.h" #ifdef WIN32 - #include "lcd-win32.h" +#include "lcd-win32.h" #else - #include "lcd-x11.h" +#include "lcd-x11.h" #endif void lcd_blit(const unsigned char* p_data, int x, int y, int width, int height, diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index c43fb5f1f2..3ed16e8e34 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c @@ -28,7 +28,7 @@ #include "string.h" #include "lcd.h" -#include "settings.h" + #include "ata.h" /* for volume definitions */ extern char having_new_lcd; @@ -285,5 +285,6 @@ void remove_thread(int threadnum) } /* assure an unused place to direct virtual pointers to */ +#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */ unsigned char vp_dummy[VIRT_SIZE]; diff --git a/uisimulator/win32/Makefile b/uisimulator/win32/Makefile index 4878d85bf1..f429cad8b5 100644 --- a/uisimulator/win32/Makefile +++ b/uisimulator/win32/Makefile @@ -29,8 +29,6 @@ INCLUDES = -I. -I$(SIMCOMMON) -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR) DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ $(TARGET) -DAPPSVERSION=\"$(VERSION)\" -DMEM=${MEMORYSIZE} $(EXTRA_DEFINES) -LDFLAGS = -lgdi32 -luser32 - SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) OBJS := $(SRC:%.c=$(OBJDIR)/%.o) @@ -40,20 +38,15 @@ DIRS = . CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall -mno-cygwin -DLLTOOLFLAGS = --export-all -DLLWRAPFLAGS = -s --entry _DllMain@12 --target=i386-mingw32 -mno-cygwin - OUTFILE = $(OBJDIR)/libsim.a all: $(OUTFILE) @echo "MAKE in common sim" $(MAKE) -C $(SIMCOMMON) -include $(TOOLSDIR)/make.inc - -$(OUTFILE): $(OBJS) +$(OUTFILE): $(OBJS) $(OBJDIR)/UI256.bmp $(OBJDIR)/uisw32-res.o @echo "AR+RANLIB $@" - @$(AR) ruv $@ $(OBJS) >/dev/null 2>&1 + @$(AR) ruv $@ $(OBJS) $(OBJDIR)/uisw32-res.o >/dev/null 2>&1 @$(RANLIB) $@ clean: @@ -68,6 +61,8 @@ $(OBJDIR)/UI256.bmp: UI-$(ARCHOS).bmp @cp $< $@ $(OBJDIR)/uisw32-res.o: uisw32.rc $(OBJDIR)/UI256.bmp - $(WINDRES) -I$(OBJDIR) -i $< -o $@ + $(WINDRES) --include-dir $(OBJDIR) -i $< -o $@ + +include $(TOOLSDIR)/make.inc -include $(DEPFILE) diff --git a/uisimulator/win32/SOURCES b/uisimulator/win32/SOURCES index 6a52c5ed5e..a88115ade6 100644 --- a/uisimulator/win32/SOURCES +++ b/uisimulator/win32/SOURCES @@ -1,6 +1,8 @@ button.c debug-win32.c +#if 0 /* this is only for non-cygwin simulator builds */ dir-win32.c +#endif kernel.c lcd-win32.c mpeg-win32.c diff --git a/uisimulator/win32/dir-win32.h b/uisimulator/win32/dir-win32.h index 888a83767a..95ce326e9f 100644 --- a/uisimulator/win32/dir-win32.h +++ b/uisimulator/win32/dir-win32.h @@ -20,7 +20,6 @@ #define _DIR_WIN32_H_ #include -#include "file.h" struct dirent { unsigned char d_name[MAX_PATH]; diff --git a/uisimulator/x11/Makefile b/uisimulator/x11/Makefile index 68815fe8d8..0c0c31183d 100644 --- a/uisimulator/x11/Makefile +++ b/uisimulator/x11/Makefile @@ -43,8 +43,7 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS) OUTFILE = $(OBJDIR)/libsim.a all: $(OUTFILE) - @echo "MAKE in common sim" - $(MAKE) -C $(SIMCOMMON) + @$(MAKE) -C $(SIMCOMMON) include $(TOOLSDIR)/make.inc diff --git a/uisimulator/x11/kernel.h b/uisimulator/x11/kernel.h deleted file mode 100644 index f165d92eb3..0000000000 --- a/uisimulator/x11/kernel.h +++ /dev/null @@ -1,31 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2002 by Daniel Stenberg - * - * All files in this archive are subject to the GNU General Public License. - * See the file COPYING in the source tree root for full license agreement. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ - -#include "../../firmware/export/kernel.h" - -#ifndef NO_REDEFINES_PLEASE - -#define sleep(x) sim_sleep(x) -#define mutex_init(x) (void)x -#define mutex_lock(x) (void)x -#define mutex_unlock(x) (void)x - -#endif - -void sim_sleep(int); diff --git a/uisimulator/x11/thread.c b/uisimulator/x11/thread.c index e37373dc54..25adf6a3c0 100644 --- a/uisimulator/x11/thread.c +++ b/uisimulator/x11/thread.c @@ -94,3 +94,18 @@ void sim_sleep(int ticks) pthread_mutex_lock(&mp); /* get it again */ } + +void mutex_init(struct mutex *m) +{ + (void)m; +} + +void mutex_lock(struct mutex *m) +{ + (void)m; +} + +void mutex_unlock(struct mutex *m) +{ + (void)m; +} -- cgit v1.2.3