summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/doom/rockdoom.c19
-rw-r--r--apps/plugins/midiplay.c15
-rw-r--r--apps/plugins/mp3_encoder.c14
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c14
-rw-r--r--apps/plugins/pacbox/pacbox.c22
-rw-r--r--apps/plugins/rockboy/rockboy.c16
-rw-r--r--apps/plugins/zxbox/zxbox.c17
7 files changed, 17 insertions, 100 deletions
diff --git a/apps/plugins/doom/rockdoom.c b/apps/plugins/doom/rockdoom.c
index 2b42322daa..8b73a5bb96 100644
--- a/apps/plugins/doom/rockdoom.c
+++ b/apps/plugins/doom/rockdoom.c
@@ -39,14 +39,7 @@
#include "st_stuff.h"
PLUGIN_HEADER
-
-#ifdef USE_IRAM
-extern char iramcopy[];
-extern char iramstart[];
-extern char iramend[];
-extern char iedata[];
-extern char iend[];
-#endif
+PLUGIN_IRAM_DECLARE
extern boolean timingdemo, singledemo, demoplayback, fastdemo; // killough
@@ -785,13 +778,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->cpu_boost(true);
#endif
-#ifdef USE_IRAM
- /* We need to stop audio playback in order to use IRAM */
- rb->audio_stop();
-
- memcpy(iramstart, iramcopy, iramend-iramstart);
- memset(iedata, 0, iend - iedata);
-#endif
+ PLUGIN_IRAM_INIT(rb)
rb->lcd_setfont(0);
@@ -830,7 +817,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
if (result < 0)
{
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
- rb->cpu_boost(false);
+ rb->cpu_boost(false);
#endif
if( result == -1 ) return PLUGIN_OK; // Quit was selected
else if( result == -2 ) return PLUGIN_ERROR; // Missing base wads
diff --git a/apps/plugins/midiplay.c b/apps/plugins/midiplay.c
index 585c7eec25..a0e7d0e3c2 100644
--- a/apps/plugins/midiplay.c
+++ b/apps/plugins/midiplay.c
@@ -19,7 +19,7 @@
#include "../../plugin.h"
PLUGIN_HEADER
-
+PLUGIN_IRAM_DECLARE
/* variable button definitions */
#if CONFIG_KEYPAD == RECORDER_PAD
@@ -102,14 +102,6 @@ short gmbuf[BUF_SIZE*NBUF] IBSS_ATTR;
int quit=0;
struct plugin_api * rb;
-#ifdef USE_IRAM
-extern char iramcopy[];
-extern char iramstart[];
-extern char iramend[];
-extern char iedata[];
-extern char iend[];
-#endif
-
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
int retval = 0;
@@ -122,10 +114,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
}
rb->lcd_setfont(0);
-#ifdef USE_IRAM
- rb->memcpy(iramstart, iramcopy, iramend-iramstart);
- rb->memset(iedata, 0, iend - iedata);
-#endif
+ PLUGIN_IRAM_INIT(rb)
#if defined(HAVE_ADJUSTABLE_CPU_FREQ)
rb->cpu_boost(true);
diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c
index 6d66111d16..5bfd384349 100644
--- a/apps/plugins/mp3_encoder.c
+++ b/apps/plugins/mp3_encoder.c
@@ -14,17 +14,10 @@
#include "plugin.h"
PLUGIN_HEADER
+PLUGIN_IRAM_DECLARE
static struct plugin_api* rb;
-#ifdef USE_IRAM
-extern char iramcopy[];
-extern char iramstart[];
-extern char iramend[];
-extern char iedata[];
-extern char iend[];
-#endif
-
#define SAMP_PER_FRAME 1152
#define SAMPL2 576
#define SBLIMIT 32
@@ -2377,10 +2370,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
asm volatile ("move.l #0, %macsr"); /* integer mode */
#endif
-#ifdef USE_IRAM
- memcpy(iramstart, iramcopy, iramend - iramstart);
- memset(iedata, 0, iend - iedata);
-#endif
+ PLUGIN_IRAM_INIT(rb)
rb->lcd_setfont(FONT_SYSFIXED);
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 980061f050..0fbd0f01e6 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -31,14 +31,7 @@
#include "video_out.h"
PLUGIN_HEADER
-
-#ifdef USE_IRAM
-extern char iramcopy[];
-extern char iramstart[];
-extern char iramend[];
-extern char iedata[];
-extern char iend[];
-#endif
+PLUGIN_IRAM_DECLARE
struct plugin_api* rb;
@@ -319,10 +312,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
if (buffer == NULL)
return PLUGIN_ERROR;
-#ifdef USE_IRAM
- rb->memcpy(iramstart, iramcopy, iramend-iramstart);
- rb->memset(iedata, 0, iend - iedata);
-#endif
+ PLUGIN_IRAM_INIT(rb)
rb->lcd_set_backdrop(NULL);
diff --git a/apps/plugins/pacbox/pacbox.c b/apps/plugins/pacbox/pacbox.c
index 7c2d1e21ca..62f5bcd413 100644
--- a/apps/plugins/pacbox/pacbox.c
+++ b/apps/plugins/pacbox/pacbox.c
@@ -29,14 +29,7 @@
#include "lib/configfile.h"
PLUGIN_HEADER
-
-#ifdef USE_IRAM
-extern char iramcopy[];
-extern char iramstart[];
-extern char iramend[];
-extern char iedata[];
-extern char iend[];
-#endif
+PLUGIN_IRAM_DECLARE
struct plugin_api* rb;
@@ -370,21 +363,10 @@ static int gameProc( void )
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{
(void)parameter;
-#ifdef USE_IRAM
- void* audiobuf;
- int audiosize;
-#endif
rb = api;
-#ifdef USE_IRAM
- /* We need to stop audio playback in order to use IRAM, so we grab
- the audio buffer - but we don't use it. */
- audiobuf = rb->plugin_get_audio_buffer(&audiosize);
-
- rb->memcpy(iramstart, iramcopy, iramend-iramstart);
- rb->memset(iedata, 0, iend - iedata);
-#endif
+ PLUGIN_IRAM_INIT(rb)
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
rb->cpu_boost(true);
diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c
index f82b0c283a..6a72856bbb 100644
--- a/apps/plugins/rockboy/rockboy.c
+++ b/apps/plugins/rockboy/rockboy.c
@@ -21,14 +21,7 @@
#include "rockmacros.h"
PLUGIN_HEADER
-
-#ifdef USE_IRAM
-extern char iramcopy[];
-extern char iramstart[];
-extern char iramend[];
-extern char iedata[];
-extern char iend[];
-#endif
+PLUGIN_IRAM_DECLARE
/* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls
@@ -187,10 +180,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
audio_buffer_free = plugin_start_addr - (unsigned char *)audio_bufferbase;
#endif
setoptions();
-#ifdef USE_IRAM
- memcpy(iramstart, iramcopy, iramend-iramstart);
- memset(iedata, 0, iend - iedata);
-#endif
+
+ PLUGIN_IRAM_INIT(rb)
+
shut=0;
cleanshut=0;
diff --git a/apps/plugins/zxbox/zxbox.c b/apps/plugins/zxbox/zxbox.c
index 54a11d010e..753fb1ff5b 100644
--- a/apps/plugins/zxbox/zxbox.c
+++ b/apps/plugins/zxbox/zxbox.c
@@ -20,6 +20,7 @@
#include "zxconfig.h"
PLUGIN_HEADER
+PLUGIN_IRAM_DECLARE
struct plugin_api* rb;
@@ -37,14 +38,6 @@ int use_shm = 0;
int small_screen,pause_on_iconify;
int vga_pause_bg;
-#ifdef USE_IRAM
-extern char iramcopy[];
-extern char iramstart[];
-extern char iramend[];
-extern char iedata[];
-extern char iend[];
-#endif
-
#include "keymaps.h"
#include "zxvid_com.h"
#include "spmain.h"
@@ -75,13 +68,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
rb->lcd_set_backdrop(NULL);
rb->splash(HZ, true, "Welcome to ZXBox");
-#ifdef USE_IRAM
- /* We need to stop audio playback in order to use IRAM */
- rb->audio_stop();
-
- rb->memcpy(iramstart, iramcopy, iramend-iramstart);
- rb->memset(iedata, 0, iend - iedata);
-#endif
+ PLUGIN_IRAM_INIT(rb)
sp_init();