add global proxy / cache settings to httpget class. This removes the need of passing...
[Rockbox.git] / apps / plugin.c
blob6862ddb08e092fea4d1c08ffabf8e2de7bc8d77a
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Björn Stenberg
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include "plugin.h"
20 #include <ctype.h>
21 #include <string.h>
22 #include <sprintf.h>
23 #include <atoi.h>
24 #include "debug.h"
25 #include "i2c.h"
26 #include "lang.h"
27 #include "led.h"
28 #include "keyboard.h"
29 #include "buffer.h"
30 #include "backlight.h"
31 #include "sound_menu.h"
32 #include "mp3data.h"
33 #include "powermgmt.h"
34 #include "splash.h"
35 #include "logf.h"
36 #include "option_select.h"
37 #include "talk.h"
39 #if CONFIG_CHARGING
40 #include "power.h"
41 #endif
43 #ifdef HAVE_LCD_BITMAP
44 #include "scrollbar.h"
45 #include "peakmeter.h"
46 #include "bmp.h"
47 #include "bidi.h"
48 #endif
50 #ifdef SIMULATOR
51 static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
52 void *sim_plugin_load(char *plugin, void **pd);
53 void sim_plugin_close(void *pd);
54 void sim_lcd_ex_init(int shades, unsigned long (*getpixel)(int, int));
55 void sim_lcd_ex_update_rect(int x, int y, int width, int height);
56 #else
57 #define sim_plugin_close(x)
58 extern unsigned char pluginbuf[];
59 #include "bitswap.h"
60 #endif
62 /* for actual plugins only, not for codecs */
63 static bool plugin_loaded = false;
64 static int plugin_size = 0;
65 static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */
66 static char current_plugin[MAX_PATH];
68 char *plugin_get_current_filename(void);
70 extern struct thread_entry threads[MAXTHREADS];
72 static const struct plugin_api rockbox_api = {
74 /* lcd */
75 lcd_set_contrast,
76 lcd_update,
77 lcd_clear_display,
78 lcd_setmargins,
79 lcd_getstringsize,
80 lcd_putsxy,
81 lcd_puts,
82 lcd_puts_scroll,
83 lcd_stop_scroll,
84 #ifdef HAVE_LCD_CHARCELLS
85 lcd_define_pattern,
86 lcd_get_locked_pattern,
87 lcd_unlock_pattern,
88 lcd_putc,
89 lcd_put_cursor,
90 lcd_remove_cursor,
91 lcd_icon,
92 lcd_double_height,
93 #else
94 lcd_set_drawmode,
95 lcd_get_drawmode,
96 lcd_setfont,
97 lcd_drawpixel,
98 lcd_drawline,
99 lcd_hline,
100 lcd_vline,
101 lcd_drawrect,
102 lcd_fillrect,
103 lcd_mono_bitmap_part,
104 lcd_mono_bitmap,
105 #if LCD_DEPTH > 1
106 lcd_set_foreground,
107 lcd_get_foreground,
108 lcd_set_background,
109 lcd_get_background,
110 lcd_bitmap_part,
111 lcd_bitmap,
112 lcd_get_backdrop,
113 lcd_set_backdrop,
114 #endif
115 #if LCD_DEPTH == 16
116 lcd_bitmap_transparent_part,
117 lcd_bitmap_transparent,
118 #endif
119 bidi_l2v,
120 font_get_bits,
121 font_load,
122 lcd_puts_style,
123 lcd_puts_scroll_style,
124 &lcd_framebuffer[0][0],
125 lcd_blit,
126 lcd_update_rect,
127 gui_scrollbar_draw,
128 font_get,
129 font_getstringsize,
130 font_get_width,
131 screen_clear_area,
132 #endif
133 backlight_on,
134 backlight_off,
135 backlight_set_timeout,
136 #if CONFIG_CHARGING
137 backlight_set_timeout_plugged,
138 #endif
139 gui_syncsplash,
140 #ifdef HAVE_REMOTE_LCD
141 /* remote lcd */
142 lcd_remote_set_contrast,
143 lcd_remote_clear_display,
144 lcd_remote_setmargins,
145 lcd_remote_puts,
146 lcd_remote_puts_scroll,
147 lcd_remote_stop_scroll,
148 lcd_remote_set_drawmode,
149 lcd_remote_get_drawmode,
150 lcd_remote_setfont,
151 lcd_remote_getstringsize,
152 lcd_remote_drawpixel,
153 lcd_remote_drawline,
154 lcd_remote_hline,
155 lcd_remote_vline,
156 lcd_remote_drawrect,
157 lcd_remote_fillrect,
158 lcd_remote_mono_bitmap_part,
159 lcd_remote_mono_bitmap,
160 lcd_remote_putsxy,
161 lcd_remote_puts_style,
162 lcd_remote_puts_scroll_style,
163 &lcd_remote_framebuffer[0][0],
164 lcd_remote_update,
165 lcd_remote_update_rect,
167 remote_backlight_on,
168 remote_backlight_off,
169 #endif
170 #if NB_SCREENS == 2
171 {&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]},
172 #else
173 {&screens[SCREEN_MAIN]},
174 #endif
175 #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
176 lcd_remote_set_foreground,
177 lcd_remote_get_foreground,
178 lcd_remote_set_background,
179 lcd_remote_get_background,
180 lcd_remote_bitmap_part,
181 lcd_remote_bitmap,
182 #endif
184 #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && !defined(SIMULATOR)
185 lcd_grey_phase_blit,
186 #endif
187 #if defined(HAVE_LCD_COLOR)
188 lcd_yuv_blit,
189 #endif
190 #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \
191 || defined (IRIVER_H10)
192 lcd_yuv_set_options,
193 #endif
194 /* list */
195 gui_synclist_init,
196 gui_synclist_set_nb_items,
197 gui_synclist_set_icon_callback,
198 gui_synclist_get_nb_items,
199 gui_synclist_get_sel_pos,
200 gui_synclist_draw,
201 gui_synclist_select_item,
202 gui_synclist_add_item,
203 gui_synclist_del_item,
204 gui_synclist_limit_scroll,
205 gui_synclist_do_button,
206 gui_synclist_set_title,
208 /* button */
209 button_get,
210 button_get_w_tmo,
211 button_status,
212 button_clear_queue,
213 button_queue_count,
214 #ifdef HAS_BUTTON_HOLD
215 button_hold,
216 #endif
218 /* file */
219 (open_func)PREFIX(open),
220 PREFIX(close),
221 (read_func)PREFIX(read),
222 PREFIX(lseek),
223 (creat_func)PREFIX(creat),
224 (write_func)PREFIX(write),
225 PREFIX(remove),
226 PREFIX(rename),
227 PREFIX(ftruncate),
228 PREFIX(filesize),
229 fdprintf,
230 read_line,
231 settings_parseline,
232 #ifndef SIMULATOR
233 ata_sleep,
234 ata_disk_is_active,
235 #endif
236 ata_spindown,
237 reload_directory,
238 create_numbered_filename,
240 /* dir */
241 opendir,
242 closedir,
243 readdir,
244 mkdir,
245 rmdir,
247 /* kernel/ system */
248 PREFIX(sleep),
249 yield,
250 #ifdef HAVE_PRIORITY_SCHEDULING
251 priority_yield,
252 #endif
253 &current_tick,
254 default_event_handler,
255 default_event_handler_ex,
256 threads,
257 create_thread,
258 remove_thread,
259 reset_poweroff_timer,
260 #ifndef SIMULATOR
261 system_memory_guard,
262 &cpu_frequency,
264 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
265 #ifdef CPU_BOOST_LOGGING
266 cpu_boost_,
267 #else
268 cpu_boost,
269 #endif
270 #endif
271 #endif
272 timer_register,
273 timer_unregister,
274 timer_set_period,
276 queue_init,
277 queue_delete,
278 queue_post,
279 queue_wait_w_tmo,
280 usb_acknowledge,
281 #ifdef RB_PROFILE
282 profile_thread,
283 profstop,
284 profile_func_enter,
285 profile_func_exit,
286 #endif
288 #ifdef SIMULATOR
289 /* special simulator hooks */
290 #if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
291 sim_lcd_ex_init,
292 sim_lcd_ex_update_rect,
293 #endif
294 #endif
296 /* strings and memory */
297 snprintf,
298 vsnprintf,
299 strcpy,
300 strncpy,
301 strlen,
302 strrchr,
303 strcmp,
304 strncmp,
305 strcasecmp,
306 strncasecmp,
307 memset,
308 memcpy,
309 memmove,
310 _ctype_,
311 atoi,
312 strchr,
313 strcat,
314 memchr,
315 memcmp,
316 strcasestr,
317 strtok_r,
318 /* unicode stuff */
319 utf8decode,
320 iso_decode,
321 utf16LEdecode,
322 utf16BEdecode,
323 utf8encode,
324 utf8length,
325 utf8seek,
327 /* sound */
328 #if CONFIG_CODEC == SWCODEC
329 sound_default,
330 #endif
331 sound_set,
333 sound_min,
334 sound_max,
335 #ifndef SIMULATOR
336 mp3_play_data,
337 mp3_play_pause,
338 mp3_play_stop,
339 mp3_is_playing,
340 #if CONFIG_CODEC != SWCODEC
341 bitswap,
342 #endif
343 #endif
344 #if CONFIG_CODEC == SWCODEC
345 &audio_master_sampr_list[0],
346 &hw_freq_sampr[0],
347 pcm_apply_settings,
348 pcm_play_data,
349 pcm_play_stop,
350 pcm_set_frequency,
351 pcm_is_playing,
352 pcm_is_paused,
353 pcm_play_pause,
354 pcm_get_bytes_waiting,
355 pcm_calculate_peaks,
356 #ifdef HAVE_RECORDING
357 &rec_freq_sampr[0],
358 pcm_init_recording,
359 pcm_close_recording,
360 pcm_record_data,
361 pcm_record_more,
362 pcm_stop_recording,
363 pcm_calculate_rec_peaks,
364 audio_set_recording_gain,
365 #endif /* HAVE_RECORDING */
366 #if INPUT_SRC_CAPS != 0
367 audio_set_output_source,
368 audio_set_input_source,
369 #endif
370 #endif /* CONFIG_CODEC == SWCODEC */
372 /* playback control */
373 playlist_amount,
374 playlist_resume,
375 playlist_start,
376 PREFIX(audio_play),
377 audio_stop,
378 audio_pause,
379 audio_resume,
380 audio_next,
381 audio_prev,
382 audio_ff_rewind,
383 audio_next_track,
384 audio_status,
385 audio_has_changed_track,
386 audio_current_track,
387 audio_flush_and_reload_tracks,
388 audio_get_file_pos,
389 #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
390 mpeg_get_last_header,
391 #endif
392 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
393 (CONFIG_CODEC == SWCODEC)
394 sound_set_pitch,
395 #endif
397 #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
398 /* MAS communication */
399 mas_readmem,
400 mas_writemem,
401 mas_readreg,
402 mas_writereg,
403 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
404 mas_codec_writereg,
405 mas_codec_readreg,
406 i2c_begin,
407 i2c_end,
408 i2c_write,
409 #endif
410 #endif /* !SIMULATOR && CONFIG_CODEC != SWCODEC */
412 /* menu */
413 do_menu,
414 /* statusbars */
415 &statusbars,
416 gui_syncstatusbar_draw,
417 /* options */
418 find_setting,
419 option_screen,
420 set_option,
421 set_bool_options,
422 set_int,
423 set_bool,
424 #ifdef HAVE_LCD_COLOR
425 set_color,
426 #endif
428 /* action handling */
429 get_custom_action,
430 get_action,
431 action_userabort,
433 /* power */
434 battery_level,
435 battery_level_safe,
436 battery_time,
437 #ifndef SIMULATOR
438 battery_voltage,
439 #endif
440 #if CONFIG_CHARGING
441 charger_inserted,
442 # if CONFIG_CHARGING == CHARGING_MONITOR
443 charging_state,
444 # endif
445 #endif
446 #ifdef HAVE_USB_POWER
447 usb_powered,
448 #endif
450 /* misc */
451 srand,
452 rand,
453 (qsort_func)qsort,
454 kbd_input,
455 get_time,
456 set_time,
457 #if CONFIG_RTC
458 mktime,
459 #endif
460 plugin_get_buffer,
461 plugin_get_audio_buffer,
462 plugin_tsr,
463 plugin_get_current_filename,
464 #ifdef PLUGIN_USE_IRAM
465 plugin_iram_init,
466 #endif
467 #if defined(DEBUG) || defined(SIMULATOR)
468 debugf,
469 #endif
470 #ifdef ROCKBOX_HAS_LOGF
471 _logf,
472 #endif
473 &global_settings,
474 &global_status,
475 talk_disable,
476 #if CONFIG_CODEC == SWCODEC
477 codec_load_file,
478 get_codec_filename,
479 get_metadata,
480 #endif
481 mp3info,
482 count_mp3_frames,
483 create_xing_header,
484 find_next_frame,
485 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
486 peak_meter_scale_value,
487 peak_meter_set_use_dbfs,
488 peak_meter_get_use_dbfs,
489 #endif
490 #ifdef HAVE_LCD_BITMAP
491 read_bmp_file,
492 screen_dump_set_hook,
493 #endif
494 show_logo,
495 tree_get_context,
496 set_current_file,
497 set_dirfilter,
499 #ifdef HAVE_WHEEL_POSITION
500 wheel_status,
501 wheel_send_events,
502 #endif
504 #ifdef IRIVER_H100_SERIES
505 /* Routines for the iriver_flash -plugin. */
506 detect_original_firmware,
507 detect_flashed_ramimage,
508 detect_flashed_romimage,
509 #endif
510 led,
511 #ifdef CACHE_FUNCTIONS_AS_CALL
512 flush_icache,
513 invalidate_icache,
514 #endif
515 /* new stuff at the end, sort into place next time
516 the API gets incompatible */
518 #if (CONFIG_CODEC == SWCODEC)
519 mutex_init,
520 mutex_lock,
521 mutex_unlock,
522 #endif
524 thread_wait,
526 #if (CONFIG_CODEC == SWCODEC)
527 align_buffer,
528 #endif
530 file_exists,
531 dir_exists,
533 #ifdef HAVE_REMOTE_LCD
534 remote_backlight_set_timeout,
535 #if CONFIG_CHARGING
536 remote_backlight_set_timeout_plugged,
537 #endif
538 #endif /* HAVE_REMOTE_LCD */
540 #if (CONFIG_CODEC == SWCODEC)
541 bufopen,
542 bufalloc,
543 bufclose,
544 bufseek,
545 bufadvance,
546 bufread,
547 bufgetdata,
548 bufgettail,
549 bufcuttail,
551 buf_get_offset,
552 buf_handle_offset,
553 buf_request_buffer_handle,
554 buf_set_base_handle,
555 buf_used,
556 #endif
558 #ifdef HAVE_TAGCACHE
559 tagcache_search,
560 tagcache_search_set_uniqbuf,
561 tagcache_search_add_filter,
562 tagcache_get_next,
563 tagcache_retrieve,
564 tagcache_search_finish,
565 #endif
567 #ifdef HAVE_ALBUMART
568 find_albumart,
569 search_albumart_files,
570 #endif
572 #if CONFIG_CODEC == SWCODEC
573 pcm_play_lock,
574 pcm_play_unlock,
575 queue_enable_queue_send,
576 queue_empty,
577 queue_wait,
578 queue_send,
579 queue_reply,
580 #ifndef HAVE_FLASH_STORAGE
581 ata_spin,
582 #endif
583 #ifdef HAVE_SCHEDULER_BOOSTCTRL
584 trigger_cpu_boost,
585 cancel_cpu_boost,
586 #endif
587 sound_unit,
588 sound_val2phys,
589 dsp_set_crossfeed,
590 dsp_set_eq,
591 dsp_dither_enable,
592 dsp_configure,
593 dsp_process,
594 #endif /* CONFIG_CODEC == SWCODEC */
597 int plugin_load(const char* plugin, void* parameter)
599 int rc;
600 struct plugin_header *hdr;
601 #ifdef SIMULATOR
602 void *pd;
603 #else
604 int fd;
605 ssize_t readsize;
606 #endif
607 int xm, ym;
608 #ifdef HAVE_REMOTE_LCD
609 int rxm, rym;
610 #endif
612 #if LCD_DEPTH > 1
613 fb_data* old_backdrop;
614 #endif
616 if (pfn_tsr_exit != NULL) /* if we have a resident old plugin: */
618 if (pfn_tsr_exit(!strcmp(current_plugin, plugin)) == false )
620 /* not allowing another plugin to load */
621 return PLUGIN_OK;
623 pfn_tsr_exit = NULL;
624 plugin_loaded = false;
627 gui_syncsplash(0, ID2P(LANG_WAIT));
628 strcpy(current_plugin, plugin);
630 #ifdef SIMULATOR
631 hdr = sim_plugin_load((char *)plugin, &pd);
632 if (pd == NULL) {
633 gui_syncsplash(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin);
634 return -1;
636 if (hdr == NULL
637 || hdr->magic != PLUGIN_MAGIC
638 || hdr->target_id != TARGET_ID) {
639 sim_plugin_close(pd);
640 gui_syncsplash(HZ*2, str(LANG_PLUGIN_WRONG_MODEL));
641 return -1;
643 if (hdr->api_version > PLUGIN_API_VERSION
644 || hdr->api_version < PLUGIN_MIN_API_VERSION) {
645 sim_plugin_close(pd);
646 gui_syncsplash(HZ*2, str(LANG_PLUGIN_WRONG_VERSION));
647 return -1;
649 #else
650 fd = open(plugin, O_RDONLY);
651 if (fd < 0) {
652 gui_syncsplash(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin);
653 return fd;
656 readsize = read(fd, pluginbuf, PLUGIN_BUFFER_SIZE);
657 close(fd);
659 if (readsize < 0) {
660 gui_syncsplash(HZ*2, str(LANG_READ_FAILED), plugin);
661 return -1;
663 hdr = (struct plugin_header *)pluginbuf;
665 if ((unsigned)readsize <= sizeof(struct plugin_header)
666 || hdr->magic != PLUGIN_MAGIC
667 || hdr->target_id != TARGET_ID
668 || hdr->load_addr != pluginbuf
669 || hdr->end_addr > pluginbuf + PLUGIN_BUFFER_SIZE) {
670 gui_syncsplash(HZ*2, str(LANG_PLUGIN_WRONG_MODEL));
671 return -1;
673 if (hdr->api_version > PLUGIN_API_VERSION
674 || hdr->api_version < PLUGIN_MIN_API_VERSION) {
675 gui_syncsplash(HZ*2, str(LANG_PLUGIN_WRONG_VERSION));
676 return -1;
678 plugin_size = hdr->end_addr - pluginbuf;
680 /* zero out bss area only, above guards end of pluginbuf */
681 if (plugin_size > readsize)
682 memset(pluginbuf + readsize, 0, plugin_size - readsize);
683 #endif
685 plugin_loaded = true;
687 xm = lcd_getxmargin();
688 ym = lcd_getymargin();
689 lcd_setmargins(0,0);
691 #if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1
692 old_backdrop = lcd_get_backdrop();
693 #endif
694 lcd_clear_display();
695 lcd_update();
697 #ifdef HAVE_REMOTE_LCD
698 rxm = lcd_remote_getxmargin();
699 rym = lcd_remote_getymargin();
700 lcd_remote_setmargins(0, 0);
701 lcd_remote_clear_display();
702 lcd_remote_update();
703 #endif
705 invalidate_icache();
707 rc = hdr->entry_point((struct plugin_api*) &rockbox_api, parameter);
708 /* explicitly casting the pointer here to avoid touching every plugin. */
710 button_clear_queue();
712 #ifdef HAVE_LCD_BITMAP
713 #if LCD_DEPTH > 1
714 lcd_set_backdrop(old_backdrop);
715 #ifdef HAVE_LCD_COLOR
716 lcd_set_drawinfo(DRMODE_SOLID, global_settings.fg_color,
717 global_settings.bg_color);
718 #else
719 lcd_set_drawinfo(DRMODE_SOLID, LCD_DEFAULT_FG, LCD_DEFAULT_BG);
720 #endif
721 #else /* LCD_DEPTH == 1 */
722 lcd_set_drawmode(DRMODE_SOLID);
723 #endif /* LCD_DEPTH */
724 #endif /* HAVE_LCD_BITMAP */
726 /* restore margins */
727 lcd_setmargins(xm,ym);
728 lcd_clear_display();
729 lcd_update();
731 #ifdef HAVE_REMOTE_LCD
732 #if LCD_REMOTE_DEPTH > 1
733 lcd_remote_set_drawinfo(DRMODE_SOLID, LCD_REMOTE_DEFAULT_FG,
734 LCD_REMOTE_DEFAULT_BG);
735 #else
736 lcd_remote_set_drawmode(DRMODE_SOLID);
737 #endif
738 lcd_remote_setmargins(rxm, rym);
739 lcd_remote_clear_display();
742 lcd_remote_update();
745 #endif
747 if (pfn_tsr_exit == NULL)
748 plugin_loaded = false;
750 sim_plugin_close(pd);
752 switch (rc) {
753 case PLUGIN_OK:
754 break;
756 case PLUGIN_USB_CONNECTED:
757 return PLUGIN_USB_CONNECTED;
759 default:
760 gui_syncsplash(HZ*2, str(LANG_PLUGIN_ERROR));
761 break;
763 return PLUGIN_OK;
766 /* Returns a pointer to the portion of the plugin buffer that is not already
767 being used. If no plugin is loaded, returns the entire plugin buffer */
768 void* plugin_get_buffer(size_t *buffer_size)
770 int buffer_pos;
772 if (plugin_loaded)
774 if (plugin_size >= PLUGIN_BUFFER_SIZE)
775 return NULL;
777 *buffer_size = PLUGIN_BUFFER_SIZE-plugin_size;
778 buffer_pos = plugin_size;
780 else
782 *buffer_size = PLUGIN_BUFFER_SIZE;
783 buffer_pos = 0;
786 return &pluginbuf[buffer_pos];
789 /* Returns a pointer to the mp3 buffer.
790 Playback gets stopped, to avoid conflicts.
791 Talk buffer is stolen as well.
793 void* plugin_get_audio_buffer(size_t *buffer_size)
795 #if CONFIG_CODEC == SWCODEC
796 return audio_get_buffer(true, buffer_size);
797 #else
798 audio_stop();
799 talk_buffer_steal(); /* we use the mp3 buffer, need to tell */
800 *buffer_size = audiobufend - audiobuf;
801 return audiobuf;
802 #endif
805 #ifdef PLUGIN_USE_IRAM
806 /* Initializes plugin IRAM */
807 void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size,
808 char *iedata, size_t iedata_size)
810 /* We need to stop audio playback in order to use codec IRAM */
811 audio_hard_stop();
812 memcpy(iramstart, iramcopy, iram_size);
813 memset(iedata, 0, iedata_size);
814 memset(iramcopy, 0, iram_size);
815 #if NUM_CORES > 1
816 /* writeback cleared iedata and iramcopy areas */
817 flush_icache();
818 #endif
820 #endif /* PLUGIN_USE_IRAM */
822 /* The plugin wants to stay resident after leaving its main function, e.g.
823 runs from timer or own thread. The callback is registered to later
824 instruct it to free its resources before a new plugin gets loaded. */
825 void plugin_tsr(bool (*exit_callback)(bool))
827 pfn_tsr_exit = exit_callback; /* remember the callback for later */
830 char *plugin_get_current_filename(void)
832 return current_plugin;