Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
diff --git a/apps/plugin.c b/apps/plugin.c index 767c593..8c4ddcb 100644 static const struct plugin_api rockbox_api = { lcd_clear_display, lcd_getstringsize, lcd_putsxy, + lcd_putsxyf, lcd_puts, + lcd_putsf, lcd_puts_scroll, lcd_stop_scroll, #ifdef HAVE_LCD_CHARCELLS static const struct plugin_api rockbox_api = { trigger_cpu_boost, cancel_cpu_boost, #endif -#if NUM_CORES > 1 cpucache_flush, cpucache_invalidate, -#endif timer_register, timer_unregister, timer_set_period, static const struct plugin_api rockbox_api = { plugin_get_audio_buffer, plugin_tsr, plugin_get_current_filename, -#ifdef PLUGIN_USE_IRAM - plugin_iram_init, -#endif #if defined(DEBUG) || defined(SIMULATOR) debugf, #endif static const struct plugin_api rockbox_api = { /* new stuff at the end, sort into place next time the API gets incompatible */ - - lcd_putsf, - lcd_putsxyf, }; int plugin_load(const char* plugin, const void* parameter) void* plugin_get_audio_buffer(size_t *buffer_size) #endif } -#ifdef PLUGIN_USE_IRAM -/* Initializes plugin IRAM */ -void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size, - char *iedata, size_t iedata_size) -{ - /* We need to stop audio playback in order to use codec IRAM */ - audio_hard_stop(); - memcpy(iramstart, iramcopy, iram_size); - memset(iedata, 0, iedata_size); - memset(iramcopy, 0, iram_size); -#if NUM_CORES > 1 - /* writeback cleared iedata and iramcopy areas */ - cpucache_flush(); -#endif -} -#endif /* PLUGIN_USE_IRAM */ - /* The plugin wants to stay resident after leaving its main function, e.g. runs from timer or own thread. The callback is registered to later instruct it to free its resources before a new plugin gets loaded. */ diff --git a/apps/plugin.h b/apps/plugin.h index 2f187f1..b82f8b6 100644 void* plugin_get_buffer(size_t *buffer_size); #define PLUGIN_MAGIC 0x526F634B /* RocK */ /* increase this every time the api struct changes */ -#define PLUGIN_API_VERSION 191 +#define PLUGIN_API_VERSION 192 /* 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 191 +#define PLUGIN_MIN_API_VERSION 192 /* plugin return codes */ /* internal returns start at 0x100 to make exit(1..255) work */ struct plugin_api { void (*lcd_clear_display)(void); int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h); void (*lcd_putsxy)(int x, int y, const unsigned char *string); + void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...); void (*lcd_puts)(int x, int y, const unsigned char *string); + void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); void (*lcd_puts_scroll)(int x, int y, const unsigned char* string); void (*lcd_stop_scroll)(void); #ifdef HAVE_LCD_CHARCELLS struct plugin_api { void (*trigger_cpu_boost)(void); void (*cancel_cpu_boost)(void); #endif -#if NUM_CORES > 1 void (*cpucache_flush)(void); void (*cpucache_invalidate)(void); -#endif bool (*timer_register)(int reg_prio, void (*unregister_callback)(void), long cycles, void (*timer_callback)(void) IF_COP(, int core)); struct plugin_api { void* (*plugin_get_audio_buffer)(size_t *buffer_size); void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); char* (*plugin_get_current_filename)(void); -#ifdef PLUGIN_USE_IRAM - void (*plugin_iram_init)(char *iramstart, char *iramcopy, size_t iram_size, - char *iedata, size_t iedata_size); -#endif #if defined(DEBUG) || defined(SIMULATOR) void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); #endif struct plugin_api { /* new stuff at the end, sort into place next time the API gets incompatible */ - - void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); - void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...); }; /* plugin header */ extern unsigned char plugin_end_addr[]; PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ NULL, NULL, plugin__start, &rb }; #endif /* CONFIG_PLATFORM */ - -#ifdef PLUGIN_USE_IRAM -/* Declare IRAM variables */ -#define PLUGIN_IRAM_DECLARE \ - extern char iramcopy[]; \ - extern char iramstart[]; \ - extern char iramend[]; \ - extern char iedata[]; \ - extern char iend[]; -/* Initialize IRAM */ -#define PLUGIN_IRAM_INIT(api) \ - (api)->plugin_iram_init(iramstart, iramcopy, iramend-iramstart, \ - iedata, iend-iedata); -#else -#define PLUGIN_IRAM_DECLARE -#define PLUGIN_IRAM_INIT(api) -#endif /* PLUGIN_USE_IRAM */ #endif /* PLUGIN */ int plugin_load(const char* plugin, const void* parameter); void* plugin_get_audio_buffer(size_t *buffer_size); -#ifdef PLUGIN_USE_IRAM -void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size, - char *iedata, size_t iedata_size); -#endif /* plugin_tsr, callback returns true to allow the new plugin to load, diff --git a/apps/plugins/plugin_crt0.c b/apps/plugins/plugin_crt0.c index e34124c..59496b7 100644 enum plugin_status plugin__start(const void *param) /* zero out the bss section */ #if (CONFIG_PLATFORM & PLATFORM_NATIVE) +/* IRAM must be copied before clearing the BSS ! */ +#ifdef PLUGIN_USE_IRAM + extern const char iramcopy[], iramstart[], iramend[], iedata[], iend[]; + const size_t iram_size = iramend - iramstart; + const size_t ibss_size = iend - iedata; + if (iram_size > 0 || ibss_size > 0) + { + /* We need to stop audio playback in order to use codec IRAM */ + rb->audio_stop(); + rb->memcpy((char*)iramstart, iramcopy, iram_size); + rb->memset((char*)iedata, 0, ibss_size); + /* writeback cleared iedata and iramcopy areas */ + rb->cpucache_flush(); + } +#endif /* PLUGIN_USE_IRAM */ + rb->memset(plugin_bss_start, 0, plugin_end_addr - plugin_bss_start); #endif + /* we come back here if exit() was called or the plugin returned normally */ exit_ret = setjmp(__exit_env); if (exit_ret == 0) |