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
This commit is contained in:
Daniel Stenberg 2005-02-22 12:19:12 +00:00
parent 376057d2b6
commit 22b7701fe7
33 changed files with 327 additions and 339 deletions

View file

@ -43,6 +43,8 @@ MAXOUTFILE = $(OBJDIR)/romstart
ifdef SIMVER ifdef SIMVER
# this is a sim build # this is a sim build
all: $(OBJDIR)/$(BINARY) $(CODECS) $(ROCKS) all: $(OBJDIR)/$(BINARY) $(CODECS) $(ROCKS)
@$(MAKE) -C $(SIMDIR)
@$(MAKE) -C $(ROOTDIR)/uisimulator/common
else else
# regular target build # regular target build
all: $(OBJDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM) all: $(OBJDIR)/$(BINARY) $(FLASHFILE) $(CODECS) $(ROCKS) $(ARCHOSROM)
@ -101,12 +103,22 @@ $(OBJDIR)/$(BINARY) : $(OBJDIR)/rockbox.bin
else else
# this is a simulator build # 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)" @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: $(OBJDIR)/libsim.a:
@$(MAKE) -C $(SIMDIR) @$(MAKE) -C $(SIMDIR)
$(OBJDIR)/libcomsim.a:
@$(MAKE) -C $(ROOTDIR)/uisimulator/common
endif endif
$(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin $(OBJDIR)/rockbox.ucl: $(OBJDIR)/rockbox.bin

View file

@ -231,7 +231,7 @@ static void new_playlist(struct playlist_info* playlist, const char *dir,
if (playlist->control_fd >= 0) 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) PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
fsync(playlist->control_fd); fsync(playlist->control_fd);
else else
@ -279,7 +279,7 @@ static int check_control(struct playlist_info* playlist)
playlist->filename[playlist->dirlen-1] = '\0'; 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) PLAYLIST_CONTROL_FILE_VERSION, dir, file) > 0)
fsync(playlist->control_fd); fsync(playlist->control_fd);
else 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 (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) position, playlist->last_insert_pos) > 0)
{ {
/* save the position in file where track name is written */ /* save the position in file where track name is written */
seek_pos = lseek(playlist->control_fd, 0, SEEK_CUR); 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; 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 (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); fsync(playlist->control_fd);
result = 0; 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 (lseek(playlist->control_fd, 0, SEEK_END) >= 0)
{ {
if (global_settings.resume_seed == 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); playlist->first_index);
else 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); global_settings.resume_seed, playlist->first_index);
if (result > 0) if (result > 0)
@ -1737,7 +1737,7 @@ int playlist_next(int steps)
if (lseek(playlist->control_fd, 0, SEEK_END) >= 0) 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); fsync(playlist->control_fd);
result = 0; result = 0;
@ -2407,7 +2407,7 @@ int playlist_save(struct playlist_info* playlist, char *filename)
break; 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)); splash(HZ*2, true, str(LANG_PLAYLIST_CONTROL_UPDATE_ERROR));
result = -1; result = -1;

View file

@ -50,18 +50,6 @@
#include "widgets.h" #include "widgets.h"
#endif #endif
#ifdef SIMULATOR
#include <debug.h>
#ifdef WIN32
#include "plugin-win32.h"
#else
#include <dlfcn.h>
#endif
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX(_x_) _x_
#endif
#if MEM >= 32 #if MEM >= 32
#define PLUGIN_BUFFER_SIZE 0xC0000 #define PLUGIN_BUFFER_SIZE 0xC0000
#else #else
@ -70,7 +58,9 @@
#ifdef SIMULATOR #ifdef SIMULATOR
static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
void *sim_plugin_load(char *plugin, int *fd);
#else #else
#define sim_plugin_close(x)
extern unsigned char pluginbuf[]; extern unsigned char pluginbuf[];
#include "bitswap.h" #include "bitswap.h"
#endif #endif
@ -142,16 +132,16 @@ static const struct plugin_api rockbox_api = {
/* file */ /* file */
(open_func)PREFIX(open), (open_func)PREFIX(open),
PREFIX(close), close,
(read_func)read, (read_func)read,
lseek, lseek,
(creat_func)PREFIX(creat), (creat_func)PREFIX(creat),
(write_func)write, (write_func)write,
PREFIX(remove), PREFIX(remove),
PREFIX(rename), PREFIX(rename),
ftruncate, PREFIX(ftruncate),
PREFIX(filesize), PREFIX(filesize),
fprintf, fdprintf,
read_line, read_line,
settings_parseline, settings_parseline,
#ifndef SIMULATOR #ifndef SIMULATOR
@ -189,6 +179,9 @@ static const struct plugin_api rockbox_api = {
memcpy, memcpy,
_ctype_, _ctype_,
atoi, atoi,
strchr,
strcat,
memcmp,
/* sound */ /* sound */
mpeg_sound_set, mpeg_sound_set,
@ -201,7 +194,7 @@ static const struct plugin_api rockbox_api = {
#endif #endif
/* playback control */ /* playback control */
mpeg_play, PREFIX(mpeg_play),
mpeg_stop, mpeg_stop,
mpeg_pause, mpeg_pause,
mpeg_resume, mpeg_resume,
@ -264,10 +257,6 @@ static const struct plugin_api rockbox_api = {
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ the API gets incompatible */
strchr,
strcat,
memcmp
}; };
int plugin_load(const char* plugin, void* parameter) 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); enum plugin_status (*plugin_start)(struct plugin_api* api, void* param);
int rc; int rc;
char buf[64]; char buf[64];
#ifdef SIMULATOR
void* pd;
char path[256];
#else
int fd; int fd;
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
int xm,ym; int xm,ym;
#endif #endif
@ -301,26 +286,9 @@ int plugin_load(const char* plugin, void* parameter)
lcd_clear_display(); lcd_clear_display();
#endif #endif
#ifdef SIMULATOR #ifdef SIMULATOR
snprintf(path, sizeof path, "archos%s", plugin); plugin_start = sim_plugin_load(plugin, &fd);
if(!plugin_start)
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);
return -1; 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 #else
fd = open(plugin, O_RDONLY); fd = open(plugin, O_RDONLY);
if (fd < 0) { if (fd < 0) {
@ -379,9 +347,7 @@ int plugin_load(const char* plugin, void* parameter)
break; break;
} }
#ifdef SIMULATOR sim_plugin_close(fd);
dlclose(pd);
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
/* restore margins */ /* restore margins */

View file

@ -32,6 +32,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/types.h>
#include "config.h" #include "config.h"
#include "dir.h" #include "dir.h"
#include "kernel.h" #include "kernel.h"
@ -51,7 +52,9 @@
#ifdef PLUGIN #ifdef PLUGIN
#if defined(DEBUG) || defined(SIMULATOR) #if defined(DEBUG) || defined(SIMULATOR)
#undef DEBUGF
#define DEBUGF rb->debugf #define DEBUGF rb->debugf
#undef LDEBUGF
#define LDEBUGF rb->debugf #define LDEBUGF rb->debugf
#else #else
#define DEBUGF(...) #define DEBUGF(...)
@ -59,13 +62,19 @@
#endif #endif
#endif #endif
#ifdef SIMULATOR
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX(_x_) _x_
#endif
/* increase this every time the api struct changes */ /* 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 /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */ 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 */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -165,17 +174,17 @@ struct plugin_api {
void (*button_clear_queue)(void); void (*button_clear_queue)(void);
/* file */ /* file */
int (*open)(const char* pathname, int flags); int (*PREFIX(open))(const char* pathname, int flags);
int (*close)(int fd); int (*close)(int fd);
ssize_t (*read)(int fd, void* buf, size_t count); ssize_t (*read)(int fd, void* buf, size_t count);
off_t (*lseek)(int fd, off_t offset, int whence); 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); ssize_t (*write)(int fd, const void* buf, size_t count);
int (*remove)(const char* pathname); int (*PREFIX(remove))(const char* pathname);
int (*rename)(const char* path, const char* newname); int (*PREFIX(rename))(const char* path, const char* newname);
int (*ftruncate)(int fd, off_t length); int (*PREFIX(ftruncate))(int fd, off_t length);
off_t (*filesize)(int fd); off_t (*PREFIX(filesize))(int fd);
int (*fprintf)(int fd, const char *fmt, ...); int (*fdprintf)(int fd, const char *fmt, ...);
int (*read_line)(int fd, char* buffer, int buffer_size); int (*read_line)(int fd, char* buffer, int buffer_size);
bool (*settings_parseline)(char* line, char** name, char** value); bool (*settings_parseline)(char* line, char** name, char** value);
#ifndef SIMULATOR #ifndef SIMULATOR
@ -188,7 +197,7 @@ struct plugin_api {
struct dirent* (*readdir)(DIR* dir); struct dirent* (*readdir)(DIR* dir);
/* kernel/ system */ /* kernel/ system */
void (*sleep)(int ticks); void (*PREFIX(sleep))(int ticks);
void (*yield)(void); void (*yield)(void);
long* current_tick; long* current_tick;
long (*default_event_handler)(long event); long (*default_event_handler)(long event);
@ -213,6 +222,9 @@ struct plugin_api {
void* (*memcpy)(void *out, const void *in, size_t n); void* (*memcpy)(void *out, const void *in, size_t n);
const char *_ctype_; const char *_ctype_;
int (*atoi)(const char *str); 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 */ /* sound */
void (*mpeg_sound_set)(int setting, int value); void (*mpeg_sound_set)(int setting, int value);
@ -225,7 +237,7 @@ struct plugin_api {
#endif #endif
/* playback control */ /* playback control */
void (*mpeg_play)(int offset); void (*PREFIX(mpeg_play))(int offset);
void (*mpeg_stop)(void); void (*mpeg_stop)(void);
void (*mpeg_pause)(void); void (*mpeg_pause)(void);
void (*mpeg_resume)(void); void (*mpeg_resume)(void);
@ -295,10 +307,6 @@ struct plugin_api {
/* new stuff at the end, sort into place next time /* new stuff at the end, sort into place next time
the API gets incompatible */ 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) */ /* defined by the plugin loader (plugin.c) */

View file

@ -71,7 +71,13 @@ $(OBJDIR)/%.rock : $(OBJDIR)/%.o $(APPSDIR)/plugin.h
@echo "DLL $@" @echo "DLL $@"
@$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $< @$(DLLTOOL) $(DLLTOOLFLAGS) -z $(OBJDIR)/$*.def $<
@$(DLLWRAP) $(DLLWRAPFLAGS) --def $(OBJDIR)/$*.def $< $(OBJDIR)/libplugin.a -o $@ @$(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 $@ @chmod -x $@
endif
endif # end of win32-simulator endif # end of win32-simulator
endif # end of simulator section endif # end of simulator section

View file

@ -325,7 +325,7 @@ static bool save_memo(int changed, bool new_mod, struct shown *shown)
} }
if (new_mod) if (new_mod)
{ {
rb->fprintf(fq, "%02d%02d%04d%01d%01d%s\n", rb->fdprintf(fq, "%02d%02d%04d%01d%01d%s\n",
memos[changed].day, memos[changed].day,
memos[changed].month, memos[changed].month,
memos[changed].year, memos[changed].year,

View file

@ -38,24 +38,24 @@ int configfile_save(const char *filename, struct configdata *cfg,
if(fd < 0) if(fd < 0)
return fd*10 - 1; 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++) { for(i = 0;i < num_items;i++) {
switch(cfg[i].type) { switch(cfg[i].type) {
case TYPE_INT: case TYPE_INT:
cfg_rb->fprintf(fd, "%s: %d\n", cfg_rb->fdprintf(fd, "%s: %d\n",
cfg[i].name, cfg[i].name,
*cfg[i].val); *cfg[i].val);
break; break;
case TYPE_ENUM: case TYPE_ENUM:
cfg_rb->fprintf(fd, "%s: %s\n", cfg_rb->fdprintf(fd, "%s: %s\n",
cfg[i].name, cfg[i].name,
cfg[i].values[*cfg[i].val]); cfg[i].values[*cfg[i].val]);
break; break;
case TYPE_STRING: case TYPE_STRING:
cfg_rb->fprintf(fd, "%s: %s\n", cfg_rb->fdprintf(fd, "%s: %s\n",
cfg[i].name, cfg[i].name,
cfg[i].string); cfg[i].string);
break; break;

View file

@ -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 */ 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 */ else /* write as item */
{ {
const char* p = p_run->cfg_val; const char* p = p_run->cfg_val;
fprintf(fd, "%s: ", p_run->cfg_name); fdprintf(fd, "%s: ", p_run->cfg_name);
while(value >= 0) 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 */ 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 */ 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; return false;
} }
fprintf(fd, "# >>> .cfg file created by rockbox %s <<<\r\n", appsversion); fdprintf(fd, "# .cfg file created by rockbox %s - ", appsversion);
fprintf(fd, "# >>> http://rockbox.haxx.se <<<\r\n#\r\n"); fdprintf(fd, "http://www.rockbox.org\r\n#\r\n");
fprintf(fd, "#\r\n# wps / language / font \r\n#\r\n"); fdprintf(fd, "#\r\n# wps / language / font \r\n#\r\n");
if (global_settings.wps_file[0] != 0) 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); global_settings.wps_file);
if (global_settings.lang_file[0] != 0) 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); global_settings.lang_file);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
if (global_settings.font_file[0] != 0) 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); global_settings.font_file);
#endif #endif

View file

@ -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; bool ok;
va_list ap; va_list ap;

View file

@ -216,28 +216,4 @@ void debugf(const char *fmt, ...)
#endif #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 #endif

View file

@ -65,6 +65,10 @@ struct mutex
/* global tick variable */ /* global tick variable */
extern long current_tick; extern long current_tick;
#ifdef SIMULATOR
#define sleep(x) sim_sleep(x)
#endif
/* kernel functions */ /* kernel functions */
extern void kernel_init(void); extern void kernel_init(void);
extern void yield(void); extern void yield(void);

View file

@ -27,6 +27,10 @@
#define STYLE_DEFAULT 0 #define STYLE_DEFAULT 0
#define STYLE_INVERT 1 #define STYLE_INVERT 1
#ifdef SIMULATOR
#define lcd_icon(x,y) sim_lcd_icon(x,y)
#endif
/* common functions */ /* common functions */
extern void lcd_init(void); extern void lcd_init(void);
extern void lcd_clear_display(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) #define lcd_update_rect(x,y,w,h)
#endif #endif
#if defined(SIMULATOR)
#include "sim_icons.h"
#endif
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
/* Icon definitions for lcd_icon() */ /* Icon definitions for lcd_icon() */

View file

@ -42,6 +42,10 @@
/* For ID3 info and VBR header */ /* For ID3 info and VBR header */
#define MPEG_RESERVED_HEADER_SPACE (4096 + 1500) #define MPEG_RESERVED_HEADER_SPACE (4096 + 1500)
#ifdef SIMULATOR
#define mpeg_play(x) sim_mpeg_play(x)
#endif
struct mpeg_debug struct mpeg_debug
{ {
int mp3buflen; int mp3buflen;

View file

@ -30,6 +30,16 @@
#define ATTR_ARCHIVE 0x20 #define ATTR_ARCHIVE 0x20
#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ #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 #ifndef DIRENT_DEFINED
struct dirent { struct dirent {
@ -42,12 +52,10 @@ struct dirent {
}; };
#endif #endif
#ifndef SIMULATOR
#include "fat.h" #include "fat.h"
typedef struct { typedef struct {
#ifndef SIMULATOR
bool busy; bool busy;
int startcluster; int startcluster;
struct fat_dir fatdir; struct fat_dir fatdir;
@ -56,25 +64,13 @@ typedef struct {
#ifdef HAVE_MULTIVOLUME #ifdef HAVE_MULTIVOLUME
int volumecounter; /* running counter for faked volume entries */ int volumecounter; /* running counter for faked volume entries */
#endif #endif
#else
/* simulator: */
void *dir; /* actually a DIR* dir */
char *name;
#endif
} DIR; } DIR;
#else /* SIMULATOR */
#ifdef WIN32
#ifndef __MINGW32__
#include <io.h>
#endif /* __MINGW32__ */
typedef struct DIRtag
{
struct dirent fd;
int handle;
} DIR;
#endif /* WIN32 */
#endif /* SIMULATOR */
#ifndef DIRFUNCTIONS_DEFINED #ifndef DIRFUNCTIONS_DEFINED
extern DIR* opendir(const char* name); extern DIR* opendir(const char* name);

View file

@ -20,6 +20,8 @@
#ifndef _FILE_H_ #ifndef _FILE_H_
#define _FILE_H_ #define _FILE_H_
#include <sys/types.h>
#undef MAX_PATH /* this avoids problems when building simulator */ #undef MAX_PATH /* this avoids problems when building simulator */
#define MAX_PATH 260 #define MAX_PATH 260
@ -42,30 +44,14 @@
#define O_TRUNC 0x10 #define O_TRUNC 0x10
#endif #endif
#if !defined(__ssize_t_defined) && !defined(_SSIZE_T_) && !defined(ssize_t) #ifdef SIMULATOR
#define __ssize_t_defined #define open(x,y) sim_open(x,y)
#define _SSIZE_T_ #define creat(x,y) sim_creat(x,y)
#define ssize_t ssize_t #define remove(x) sim_remove(x)
typedef signed long ssize_t; #define rename(x,y) sim_rename(x,y)
#endif #define filesize(x) sim_filesize(x)
#define fsync(x) sim_fsync(x)
#if !defined(__off_t_defined) && !defined(_OFF_T_) && !defined(off_t) #define ftruncate(x,y) sim_ftruncate(x,y)
#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
typedef int (*open_func)(const char* pathname, int flags); 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, typedef void (*qsort_func)(void *base, size_t nmemb, size_t size,
int(*_compar)(const void *, const void *)); int(*_compar)(const void *, const void *));
#ifndef SIMULATOR
extern int open(const char* pathname, int flags); extern int open(const char* pathname, int flags);
extern int close(int fd); extern int close(int fd);
extern int fsync(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 int ftruncate(int fd, off_t length);
extern off_t filesize(int fd); extern off_t filesize(int fd);
extern int release_files(int volume); extern int release_files(int volume);
#endif /* SIMULATOR */
#endif #endif

View file

@ -33,7 +33,7 @@ int snprintf (char *buf, size_t size, const char *fmt, ...)
ATTRIBUTE_PRINTF(3, 4); ATTRIBUTE_PRINTF(3, 4);
int vsnprintf (char *buf, int size, const char *fmt, va_list ap); 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); ATTRIBUTE_PRINTF(2, 3);
#endif /* __SPRINTF_H__ */ #endif /* __SPRINTF_H__ */

View file

@ -39,7 +39,6 @@ int vsnprintf (char *buf, int size, const char *fmt, __VALIST ap);
#ifdef SIMULATOR #ifdef SIMULATOR
typedef void FILE; typedef void FILE;
int vfprintf(FILE *stream, const char *format, __VALIST ap); int vfprintf(FILE *stream, const char *format, __VALIST ap);
int fprintf(FILE *stream, const char *format, ...);
#ifdef WIN32 #ifdef WIN32
#define FILENAME_MAX 260 /* ugly hard-coded value of a limit that is set #define FILENAME_MAX 260 /* ugly hard-coded value of a limit that is set
in file.h */ in file.h */

View file

@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/ * \/ \/ \/ \/ \/
* $Id$ * $Id$
* *
* Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se> * Copyright (C) 2005 by Daniel Stenberg
* *
* All files in this archive are subject to the GNU General Public License. * 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. * See the file COPYING in the source tree root for full license agreement.
@ -17,15 +17,33 @@
* *
****************************************************************************/ ****************************************************************************/
#include "../../firmware/export/kernel.h" #ifndef _SYS_TYPES_H_
#define _SYS_TYPES_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
#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 #endif
void sim_sleep(int); #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 */

View file

@ -352,6 +352,11 @@ int tick_remove_task(void (*f)(void))
return -1; return -1;
} }
#ifndef SIMULATOR
/*
* Simulator versions in uisimulator/SIMVER/
*/
/**************************************************************************** /****************************************************************************
* Simple mutex functions * Simple mutex functions
****************************************************************************/ ****************************************************************************/
@ -375,3 +380,5 @@ void mutex_unlock(struct mutex *m)
{ {
m->locked = false; m->locked = false;
} }
#endif

View file

@ -39,8 +39,6 @@
#include "usb.h" #include "usb.h"
#include "file.h" #include "file.h"
#include "hwcompat.h" #include "hwcompat.h"
#else
#include "mpegplay.h"
#endif /* #ifndef SIMULATOR */ #endif /* #ifndef SIMULATOR */
#include "bitswap.h" #include "bitswap.h"

12
tools/configure vendored
View file

@ -48,19 +48,29 @@ simcc () {
# default tool setup for native building # default tool setup for native building
prefixtools "" 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 output="rockboxui" # use this as default output binary name
case $uname in case $uname in
CYGWIN*) CYGWIN*)
echo "Cygwin host detected" echo "Cygwin host detected"
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' LDOPTS='-L/usr/X11R6/lib -lSM -lICE -lXt -lX11 -lXmu -lSM -lICE -lX11 -lpthread'
fi
output="rockboxui.exe" # use this as output binary name output="rockboxui.exe" # use this as output binary name
;; ;;
Linux) Linux)
echo "Linux host detected" echo "Linux host detected"
GCCOPTS="$GCCOPTS"
LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread' LDOPTS='-L/usr/X11R6/lib -lX11 -lm -lXt -lXmu -lnsl -ldl -lpthread'
if [ "$simver" = "win32" ]; then if [ "$simver" = "win32" ]; then
crosswincc # setup cross-compiler crosswincc # setup cross-compiler

View file

@ -3,7 +3,7 @@
$(OBJDIR)/%.o: %.c $(OBJDIR)/%.o: %.c
@mkdir -p `dirname $@` @mkdir -p `dirname $@`
@echo "CC $<" @echo "CC $<"
@$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: %.S $(OBJDIR)/%.o: %.S
@mkdir -p `dirname $@` @mkdir -p `dirname $@`

View file

@ -23,7 +23,7 @@ RM = rm -f
DEBUG = -g DEBUG = -g
# Use this for simulator-only files # 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) \ SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \
$(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - )
@ -38,7 +38,7 @@ DIRS = .
CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS) CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS)
OUTFILE = $(OBJDIR)/libsim.a OUTFILE = $(OBJDIR)/libcomsim.a
all: $(OUTFILE) all: $(OUTFILE)
@ -46,7 +46,7 @@ include $(TOOLSDIR)/make.inc
clean: clean:
@echo "cleaning commonsim" @echo "cleaning commonsim"
@$(RM) $(OBJS) *~ core $(DEPFILE) @$(RM) $(OBJS) *~ core $(DEPFILE) $(OUTFILE)
$(OUTFILE): $(OBJS) $(OUTFILE): $(OBJS)
@echo "AR+RANLIB $@" @echo "AR+RANLIB $@"

View file

@ -1,45 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
*
* 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 <sys/types.h>
#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

View file

@ -1,76 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Daniel Stenberg <daniel@haxx.se>
*
* 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 <io.h>
#include <fcntl.h>
#else
#include <stdio.h>
#endif
#include <sys/types.h>
#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

View file

@ -20,6 +20,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h>
#include <sys/stat.h> #include <sys/stat.h>
#ifdef __FreeBSD__ #ifdef __FreeBSD__
#include <sys/param.h> #include <sys/param.h>
@ -28,6 +29,10 @@
#include <sys/vfs.h> #include <sys/vfs.h>
#endif #endif
#ifdef WIN32
#include <windows.h>
#endif
#ifndef _MSC_VER #ifndef _MSC_VER
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
@ -35,18 +40,27 @@
#include "dir-win32.h" #include "dir-win32.h"
#endif #endif
#define MAX_PATH 260
#include <fcntl.h> #include <fcntl.h>
#include "debug.h" #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" #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 { struct mydir {
DIR *dir; DIR *dir;
char *name; char *name;
@ -113,6 +127,8 @@ struct sim_dirent *sim_readdir(MYDIR *dir)
dir->name, x11->d_name); dir->name, x11->d_name);
stat(buffer, &s); /* get info */ stat(buffer, &s); /* get info */
#define ATTR_DIRECTORY 0x10
secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0; secret.attribute = S_ISDIR(s.st_mode)?ATTR_DIRECTORY:0;
secret.size = s.st_size; secret.size = s.st_size;
secret.wrtdate = (unsigned short)(s.st_mtime >> 16); 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); debugf("We create the real directory '%s'\n", buffer);
#ifdef WIN32 #ifdef WIN32
/* since we build with -DNOCYGWIN we have the plain win32 version */
return (mkdir)(buffer); return (mkdir)(buffer);
#else #else
return (mkdir)(buffer, 0666); return (mkdir)(buffer, 0666);
@ -260,3 +277,96 @@ void fat_size(unsigned int* size, unsigned int* free)
} }
#endif #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 <dlfcn.h>
#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
}

View file

@ -25,9 +25,9 @@
#include "lcd.h" #include "lcd.h"
#ifdef WIN32 #ifdef WIN32
#include "lcd-win32.h" #include "lcd-win32.h"
#else #else
#include "lcd-x11.h" #include "lcd-x11.h"
#endif #endif
void lcd_blit(const unsigned char* p_data, int x, int y, int width, int height, void lcd_blit(const unsigned char* p_data, int x, int y, int width, int height,

View file

@ -28,7 +28,7 @@
#include "string.h" #include "string.h"
#include "lcd.h" #include "lcd.h"
#include "settings.h"
#include "ata.h" /* for volume definitions */ #include "ata.h" /* for volume definitions */
extern char having_new_lcd; extern char having_new_lcd;
@ -285,5 +285,6 @@ void remove_thread(int threadnum)
} }
/* assure an unused place to direct virtual pointers to */ /* 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]; unsigned char vp_dummy[VIRT_SIZE];

View file

@ -29,8 +29,6 @@ INCLUDES = -I. -I$(SIMCOMMON) -I$(OBJDIR) -I$(FIRMDIR)/export -I$(APPSDIR)
DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \ DEFINES = -DHAVE_CONFIG_H -DGETTIMEOFDAY_TWO_ARGS -DSIMULATOR \
$(TARGET) -DAPPSVERSION=\"$(VERSION)\" -DMEM=${MEMORYSIZE} $(EXTRA_DEFINES) $(TARGET) -DAPPSVERSION=\"$(VERSION)\" -DMEM=${MEMORYSIZE} $(EXTRA_DEFINES)
LDFLAGS = -lgdi32 -luser32
SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \ SRC := $(shell cat SOURCES | gcc -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) \
$(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - )
OBJS := $(SRC:%.c=$(OBJDIR)/%.o) OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
@ -40,20 +38,15 @@ DIRS = .
CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) -W -Wall -mno-cygwin 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 OUTFILE = $(OBJDIR)/libsim.a
all: $(OUTFILE) all: $(OUTFILE)
@echo "MAKE in common sim" @echo "MAKE in common sim"
$(MAKE) -C $(SIMCOMMON) $(MAKE) -C $(SIMCOMMON)
include $(TOOLSDIR)/make.inc $(OUTFILE): $(OBJS) $(OBJDIR)/UI256.bmp $(OBJDIR)/uisw32-res.o
$(OUTFILE): $(OBJS)
@echo "AR+RANLIB $@" @echo "AR+RANLIB $@"
@$(AR) ruv $@ $(OBJS) >/dev/null 2>&1 @$(AR) ruv $@ $(OBJS) $(OBJDIR)/uisw32-res.o >/dev/null 2>&1
@$(RANLIB) $@ @$(RANLIB) $@
clean: clean:
@ -68,6 +61,8 @@ $(OBJDIR)/UI256.bmp: UI-$(ARCHOS).bmp
@cp $< $@ @cp $< $@
$(OBJDIR)/uisw32-res.o: uisw32.rc $(OBJDIR)/UI256.bmp $(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) -include $(DEPFILE)

View file

@ -1,6 +1,8 @@
button.c button.c
debug-win32.c debug-win32.c
#if 0 /* this is only for non-cygwin simulator builds */
dir-win32.c dir-win32.c
#endif
kernel.c kernel.c
lcd-win32.c lcd-win32.c
mpeg-win32.c mpeg-win32.c

View file

@ -20,7 +20,6 @@
#define _DIR_WIN32_H_ #define _DIR_WIN32_H_
#include <stdbool.h> #include <stdbool.h>
#include "file.h"
struct dirent { struct dirent {
unsigned char d_name[MAX_PATH]; unsigned char d_name[MAX_PATH];

View file

@ -43,8 +43,7 @@ CFLAGS = $(DEBUG) $(DEFINES) $(INCLUDES) $(GCCOPTS)
OUTFILE = $(OBJDIR)/libsim.a OUTFILE = $(OBJDIR)/libsim.a
all: $(OUTFILE) all: $(OUTFILE)
@echo "MAKE in common sim" @$(MAKE) -C $(SIMCOMMON)
$(MAKE) -C $(SIMCOMMON)
include $(TOOLSDIR)/make.inc include $(TOOLSDIR)/make.inc

View file

@ -94,3 +94,18 @@ void sim_sleep(int ticks)
pthread_mutex_lock(&mp); /* get it again */ 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;
}