From d2456b44f73e6a1310d8dc2c98db92364b70e793 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sun, 3 Jul 2005 14:05:12 +0000 Subject: Centralised the ICODE_ATTR and IDATA_ATTR #defines. Renamed some musepack and rockboy headers to avoid clashes with rockbox headers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6991 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs/codec.h | 9 --- apps/codecs/lib/codeclib.h | 9 --- apps/codecs/lib/xxx2wav.h | 9 +-- apps/codecs/libmusepack/Makefile | 2 +- apps/codecs/libmusepack/config-mpc.h | 105 +++++++++++++++++++++++++++++++++++ apps/codecs/libmusepack/config.h | 105 ----------------------------------- apps/plugins/rockboy/cpu-gb.h | 59 ++++++++++++++++++++ apps/plugins/rockboy/cpu.c | 2 +- apps/plugins/rockboy/cpu.h | 59 -------------------- apps/plugins/rockboy/cpuregs.h | 2 +- apps/plugins/rockboy/debug.c | 2 +- apps/plugins/rockboy/dynarec.c | 2 +- apps/plugins/rockboy/emu.c | 6 +- apps/plugins/rockboy/hw.c | 4 +- apps/plugins/rockboy/lcd-gb.h | 76 +++++++++++++++++++++++++ apps/plugins/rockboy/lcd.c | 3 +- apps/plugins/rockboy/lcd.h | 78 -------------------------- apps/plugins/rockboy/lcdc.c | 4 +- apps/plugins/rockboy/loader.c | 3 +- apps/plugins/rockboy/mem.c | 4 +- apps/plugins/rockboy/rockmacros.h | 20 ------- apps/plugins/rockboy/rtc-gb.h | 25 +++++++++ apps/plugins/rockboy/rtc.c | 2 +- apps/plugins/rockboy/rtc.h | 25 --------- apps/plugins/rockboy/save.c | 6 +- apps/plugins/rockboy/sound.c | 2 +- apps/plugins/rockboy/sys_rockbox.c | 2 +- firmware/export/config.h | 12 ++++ 28 files changed, 301 insertions(+), 336 deletions(-) create mode 100644 apps/codecs/libmusepack/config-mpc.h delete mode 100644 apps/codecs/libmusepack/config.h create mode 100644 apps/plugins/rockboy/cpu-gb.h delete mode 100644 apps/plugins/rockboy/cpu.h create mode 100644 apps/plugins/rockboy/lcd-gb.h delete mode 100644 apps/plugins/rockboy/lcd.h create mode 100644 apps/plugins/rockboy/rtc-gb.h delete mode 100644 apps/plugins/rockboy/rtc.h diff --git a/apps/codecs/codec.h b/apps/codecs/codec.h index 3b6e7796ee..c00d2bda95 100644 --- a/apps/codecs/codec.h +++ b/apps/codecs/codec.h @@ -21,15 +21,6 @@ #include "config.h" -#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR) -#define ICODE_ATTR __attribute__ ((section(".icode"))) -#define IDATA_ATTR __attribute__ ((section(".idata"))) -#define USE_IRAM 1 -#else -#define ICODE_ATTR -#define IDATA_ATTR -#endif - #include /* Get these functions 'out of the way' of the standard functions. Not doing diff --git a/apps/codecs/lib/codeclib.h b/apps/codecs/lib/codeclib.h index 116f210c5f..762b68dd95 100644 --- a/apps/codecs/lib/codeclib.h +++ b/apps/codecs/lib/codeclib.h @@ -22,15 +22,6 @@ /* Various codec "helper functions" */ -#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR) -#define ICODE_ATTR __attribute__ ((section(".icode"))) -#define IDATA_ATTR __attribute__ ((section(".idata"))) -#define USE_IRAM 1 -#else -#define ICODE_ATTR -#define IDATA_ATTR -#endif - extern int mem_ptr; extern int bufsize; extern unsigned char* mallocbuf; // 512K from the start of MP3 buffer diff --git a/apps/codecs/lib/xxx2wav.h b/apps/codecs/lib/xxx2wav.h index 1fa7dc9413..1cdbc99878 100644 --- a/apps/codecs/lib/xxx2wav.h +++ b/apps/codecs/lib/xxx2wav.h @@ -19,14 +19,7 @@ /* Various "helper functions" common to all the xxx2wav decoder plugins */ -#if CONFIG_CPU == MCF5249 && !defined(SIMULATOR) -#define ICODE_ATTR __attribute__ ((section(".icode"))) -#define IDATA_ATTR __attribute__ ((section(".idata"))) -#define USE_IRAM 1 -#else -#define ICODE_ATTR -#define IDATA_ATTR -#endif +#include "config.h" /* the main data structure of the program */ typedef struct { diff --git a/apps/codecs/libmusepack/Makefile b/apps/codecs/libmusepack/Makefile index 1e3eaf6232..79ebffe9b8 100644 --- a/apps/codecs/libmusepack/Makefile +++ b/apps/codecs/libmusepack/Makefile @@ -8,7 +8,7 @@ # INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ - -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers + -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR) ifdef APPEXTRA INCLUDES += -I$(APPSDIR)/$(APPEXTRA) diff --git a/apps/codecs/libmusepack/config-mpc.h b/apps/codecs/libmusepack/config-mpc.h new file mode 100644 index 0000000000..8d764c4031 --- /dev/null +++ b/apps/codecs/libmusepack/config-mpc.h @@ -0,0 +1,105 @@ +/* include/config.h. Generated by configure. */ +/* include/config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if the system has the type `ptrdiff_t'. */ +#define HAVE_PTRDIFF_T 1 + +/* Define to 1 if you have the `sqrt' function. */ +/* #undef HAVE_SQRT */ + +/* Define to 1 if stdbool.h conforms to C99. */ +#define HAVE_STDBOOL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if the system has the type `_Bool'. */ +#define HAVE__BOOL 1 + +/* Name of package */ +#define PACKAGE "libmusepack" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* The size of a `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of a `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "1.1" + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `long' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ diff --git a/apps/codecs/libmusepack/config.h b/apps/codecs/libmusepack/config.h deleted file mode 100644 index 8d764c4031..0000000000 --- a/apps/codecs/libmusepack/config.h +++ /dev/null @@ -1,105 +0,0 @@ -/* include/config.h. Generated by configure. */ -/* include/config.h.in. Generated from configure.in by autoheader. */ - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `memset' function. */ -#define HAVE_MEMSET 1 - -/* Define to 1 if the system has the type `ptrdiff_t'. */ -#define HAVE_PTRDIFF_T 1 - -/* Define to 1 if you have the `sqrt' function. */ -/* #undef HAVE_SQRT */ - -/* Define to 1 if stdbool.h conforms to C99. */ -#define HAVE_STDBOOL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if the system has the type `_Bool'. */ -#define HAVE__BOOL 1 - -/* Name of package */ -#define PACKAGE "libmusepack" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "" - -/* The size of a `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of a `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of a `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of a `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Version number of package */ -#define VERSION "1.1" - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `long' if does not define. */ -/* #undef off_t */ - -/* Define to `unsigned' if does not define. */ -/* #undef size_t */ diff --git a/apps/plugins/rockboy/cpu-gb.h b/apps/plugins/rockboy/cpu-gb.h new file mode 100644 index 0000000000..937b477b53 --- /dev/null +++ b/apps/plugins/rockboy/cpu-gb.h @@ -0,0 +1,59 @@ + + +#ifndef __CPU_GB_H__ +#define __CPU_GB_H__ + + + +#include "defs.h" + + +union reg +{ + byte b[2][2]; + word w[2]; + un32 d; /* padding for alignment, carry */ +}; + +struct cpu +{ +#ifdef DYNAREC + union reg a,b,c,d,e,hl,f,sp,pc; +#else + union reg pc, sp, bc, de, hl, af; +#endif + int ime, ima; + int speed; + int halt; + int div, tim; + int lcdc; + int snd; +}; + +extern struct cpu cpu; + +#ifdef DYNAREC +struct dynarec_block { + union reg address; + void *block; + int length; + struct dynarec_block *next; +}; + +#define HASH_SIGNIFICANT_LOWER_BITS 8 +#define HASH_BITMASK ((1<= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z'))) #define isalnum(c) (isdigit(c) || (isalpha(c))) -/* FIXME: This is a q&d fix for these #defines not being available from - * rockbox' lcd.h because rockboy has its own lcd.h. Renaming the file and - * adapting the other files produced weird errors I couldn't figure out - * -- amiconn 20050624 -- */ -#define DRMODE_COMPLEMENT 0 -#define DRMODE_BG 1 -#define DRMODE_FG 2 -#define DRMODE_SOLID 3 -#define DRMODE_INVERSEVID 4 /* used as bit modifier for basic modes */ - #ifdef SIMULATOR #undef opendir #define opendir(a) rb->sim_opendir((a)) @@ -72,22 +62,12 @@ void savestate(int fd); #define open(a,b) rb->sim_open((a),(b)) #undef lseek #define lseek(a,b,c) rb->sim_lseek((a),(b),(c)) -#define ICODE_ATTR -#define IDATA_ATTR #else /* !SIMULATOR */ #define opendir(a) rb->opendir((a)) #define closedir(a) rb->closedir((a)) #define mkdir(a,b) rb->mkdir((a),(b)) #define open(a,b) rb->open((a),(b)) #define lseek(a,b,c) rb->lseek((a),(b),(c)) -#if CONFIG_CPU == MCF5249 -#define ICODE_ATTR __attribute__ ((section(".icode"))) -#define IDATA_ATTR __attribute__ ((section(".idata"))) -#define USE_IRAM 1 -#else -#define ICODE_ATTR -#define IDATA_ATTR -#endif #endif /* !SIMULATOR */ #define strcat(a,b) rb->strcat((a),(b)) diff --git a/apps/plugins/rockboy/rtc-gb.h b/apps/plugins/rockboy/rtc-gb.h new file mode 100644 index 0000000000..39c6145161 --- /dev/null +++ b/apps/plugins/rockboy/rtc-gb.h @@ -0,0 +1,25 @@ + + +#ifndef __RTC_GB_H__ +#define __RTC_GB_H__ + + +struct rtc +{ + int batt; + int sel; + int latch; + int d, h, m, s, t; + int stop, carry; + byte regs[8]; +}; + +extern struct rtc rtc; + +void rtc_latch(byte b); +void rtc_write(byte b); +void rtc_tick(void); +void rtc_save_internal(int fd); +void rtc_load_internal(int fd); + +#endif diff --git a/apps/plugins/rockboy/rtc.c b/apps/plugins/rockboy/rtc.c index 99e71dcfae..51c641cdce 100644 --- a/apps/plugins/rockboy/rtc.c +++ b/apps/plugins/rockboy/rtc.c @@ -6,7 +6,7 @@ #include "defs.h" #include "mem.h" -#include "rtc.h" +#include "rtc-gb.h" #include "rc.h" struct rtc rtc; diff --git a/apps/plugins/rockboy/rtc.h b/apps/plugins/rockboy/rtc.h deleted file mode 100644 index 2665cd81c3..0000000000 --- a/apps/plugins/rockboy/rtc.h +++ /dev/null @@ -1,25 +0,0 @@ - - -#ifndef __RTC_H__ -#define __RTC_H__ - - -struct rtc -{ - int batt; - int sel; - int latch; - int d, h, m, s, t; - int stop, carry; - byte regs[8]; -}; - -extern struct rtc rtc; - -void rtc_latch(byte b); -void rtc_write(byte b); -void rtc_tick(void); -void rtc_save_internal(int fd); -void rtc_load_internal(int fd); - -#endif diff --git a/apps/plugins/rockboy/save.c b/apps/plugins/rockboy/save.c index f14a7191c1..0277eb53d1 100644 --- a/apps/plugins/rockboy/save.c +++ b/apps/plugins/rockboy/save.c @@ -4,12 +4,12 @@ #include #include "defs.h" -#include "cpu.h" +#include "cpu-gb.h" #include "cpuregs.h" #include "hw.h" #include "regs.h" -#include "lcd.h" -#include "rtc.h" +#include "lcd-gb.h" +#include "rtc-gb.h" #include "mem.h" #include "sound.h" diff --git a/apps/plugins/rockboy/sound.c b/apps/plugins/rockboy/sound.c index 10fc504063..accfda2540 100644 --- a/apps/plugins/rockboy/sound.c +++ b/apps/plugins/rockboy/sound.c @@ -5,7 +5,7 @@ #include "defs.h" #include "pcm.h" #include "sound.h" -#include "cpu.h" +#include "cpu-gb.h" #include "hw.h" #include "regs.h" #include "rc.h" diff --git a/apps/plugins/rockboy/sys_rockbox.c b/apps/plugins/rockboy/sys_rockbox.c index 0d4426987a..45608b9f36 100644 --- a/apps/plugins/rockboy/sys_rockbox.c +++ b/apps/plugins/rockboy/sys_rockbox.c @@ -21,7 +21,7 @@ #include "fb.h" #include "input.h" #include "rc.h" -#include "lcd.h" +#include "lcd-gb.h" #include "hw.h" #include "config.h" diff --git a/firmware/export/config.h b/firmware/export/config.h index 61c9899762..7de52c6e66 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -112,4 +112,16 @@ #define CODEC_SIZE 0 #endif +/* IRAM usage */ +#if !defined(SIMULATOR) && /* Not for simulators */ \ + (((CONFIG_CPU == SH7034) && !defined(PLUGIN)) || /* SH1 archos: core only */ \ + (CONFIG_CPU == MCF5249)) /* Coldfire: core, plugins, codecs */ +#define ICODE_ATTR __attribute__ ((section(".icode"))) +#define IDATA_ATTR __attribute__ ((section(".idata"))) +#define USE_IRAM +#else +#define ICODE_ATTR +#define IDATA_ATTR +#endif + #endif -- cgit v1.2.3