Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
Nicolas Pennequin | 357ffb3 | 2008-05-05 10:32:46 +0000 | [diff] [blame] | 10 | * Copyright (C) 2002 Björn Stenberg |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 21 | #define DIRFUNCTIONS_DEFINED |
| 22 | #define FILEFUNCTIONS_DEFINED |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 23 | #include "plugin.h" |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 24 | #include <ctype.h> |
| 25 | #include <string.h> |
Bertrik Sikken | 2843469 | 2008-04-28 16:18:04 +0000 | [diff] [blame] | 26 | #include <stdlib.h> |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 27 | #include "debug.h" |
Michael Sevakis | 466e066 | 2006-11-11 05:47:42 +0000 | [diff] [blame] | 28 | #include "i2c.h" |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 29 | #include "lang.h" |
Kevin Ferrare | 81aac2a | 2007-07-29 03:43:37 +0000 | [diff] [blame] | 30 | #include "led.h" |
Björn Stenberg | 0ef911d | 2003-07-09 22:36:23 +0000 | [diff] [blame] | 31 | #include "keyboard.h" |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 32 | #include "backlight.h" |
Linus Nielsen Feltzing | 6f4d721 | 2006-03-26 22:33:25 +0000 | [diff] [blame] | 33 | #include "sound_menu.h" |
Linus Nielsen Feltzing | a6142ab | 2004-06-10 13:29:52 +0000 | [diff] [blame] | 34 | #include "mp3data.h" |
Björn Stenberg | dd26583 | 2004-06-15 22:54:37 +0000 | [diff] [blame] | 35 | #include "powermgmt.h" |
Kevin Ferrare | e991bee | 2005-11-16 15:12:15 +0000 | [diff] [blame] | 36 | #include "splash.h" |
Miika Pekkarinen | 202b726 | 2006-11-11 08:00:28 +0000 | [diff] [blame] | 37 | #include "logf.h" |
Jonathan Gordon | a5278fa | 2007-07-11 05:41:23 +0000 | [diff] [blame] | 38 | #include "option_select.h" |
Steve Bavin | 5a78a06 | 2007-10-03 16:17:36 +0000 | [diff] [blame] | 39 | #include "talk.h" |
Frank Gevaerts | 0a1d365 | 2008-09-22 19:59:00 +0000 | [diff] [blame] | 40 | #include "version.h" |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame] | 41 | #include "storage.h" |
Maurus Cuelenaere | 8fb2588 | 2009-10-29 16:52:12 +0000 | [diff] [blame] | 42 | #include "pcmbuf.h" |
Amaury Pouly | 081da63 | 2009-12-24 17:07:20 +0000 | [diff] [blame] | 43 | #include "errno.h" |
Tomer Shalev | 9e4bd41 | 2010-04-07 17:22:16 +0000 | [diff] [blame] | 44 | #include "diacritic.h" |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 45 | #include "pathfuncs.h" |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 46 | #include "load_code.h" |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 47 | #include "file.h" |
Björn Stenberg | 0ef911d | 2003-07-09 22:36:23 +0000 | [diff] [blame] | 48 | |
Jonathan Gordon | 9a6f419 | 2007-02-18 05:32:06 +0000 | [diff] [blame] | 49 | #if CONFIG_CHARGING |
Hristo Kovachev | 14cfc65 | 2006-02-07 14:46:03 +0000 | [diff] [blame] | 50 | #include "power.h" |
| 51 | #endif |
| 52 | |
Björn Stenberg | 0ef911d | 2003-07-09 22:36:23 +0000 | [diff] [blame] | 53 | #ifdef HAVE_LCD_BITMAP |
Jonathan Gordon | 6288523 | 2006-11-19 14:11:42 +0000 | [diff] [blame] | 54 | #include "scrollbar.h" |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 55 | #include "peakmeter.h" |
Linus Nielsen Feltzing | 250678b | 2005-04-25 07:42:10 +0000 | [diff] [blame] | 56 | #include "bmp.h" |
Antoine Cellerier | 06e6acd | 2006-07-19 19:47:34 +0000 | [diff] [blame] | 57 | #include "bidi.h" |
Björn Stenberg | 0ef911d | 2003-07-09 22:36:23 +0000 | [diff] [blame] | 58 | #endif |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 59 | |
Tomer Shalev | 8c5141b | 2009-09-30 10:06:04 +0000 | [diff] [blame] | 60 | #ifdef USB_ENABLE_HID |
Frank Gevaerts | e409fba | 2009-07-18 12:58:29 +0000 | [diff] [blame] | 61 | #include "usbstack/usb_hid.h" |
| 62 | #endif |
| 63 | |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 64 | #define WRAPPER(_x_) _x_ ## _wrapper |
Amaury Pouly | e5caf93 | 2010-02-11 19:15:37 +0000 | [diff] [blame] | 65 | |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 66 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 67 | static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE]; |
Jens Arnold | 0d935ce | 2009-02-09 00:32:59 +0000 | [diff] [blame] | 68 | void sim_lcd_ex_init(unsigned long (*getpixel)(int, int)); |
Jens Arnold | 6a972e0 | 2006-02-26 13:37:42 +0000 | [diff] [blame] | 69 | void sim_lcd_ex_update_rect(int x, int y, int width, int height); |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 70 | #else |
| 71 | extern unsigned char pluginbuf[]; |
Jens Arnold | 4341211 | 2004-09-26 09:25:59 +0000 | [diff] [blame] | 72 | #include "bitswap.h" |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 73 | #endif |
| 74 | |
Linus Nielsen Feltzing | ecf2f747 | 2005-06-22 02:47:54 +0000 | [diff] [blame] | 75 | /* for actual plugins only, not for codecs */ |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 76 | static int plugin_size = 0; |
Jonathan Gordon | 0218a15 | 2006-10-31 11:30:37 +0000 | [diff] [blame] | 77 | static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */ |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 78 | static char current_plugin[MAX_PATH]; |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 79 | /* NULL if no plugin is loaded, otherwise the handle that lc_open() returned */ |
| 80 | static void *current_plugin_handle; |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 81 | |
Jonathan Gordon | fda7d72 | 2007-08-06 13:42:52 +0000 | [diff] [blame] | 82 | char *plugin_get_current_filename(void); |
| 83 | |
Thomas Martitz | 9576134 | 2014-04-09 09:00:36 +0200 | [diff] [blame] | 84 | static void* plugin_get_audio_buffer(size_t *buffer_size); |
| 85 | static void plugin_release_audio_buffer(void); |
| 86 | static void plugin_tsr(bool (*exit_callback)(bool)); |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 87 | |
| 88 | #ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE |
| 89 | /* File handle leak prophylaxis */ |
| 90 | #include "bitarray.h" |
| 91 | #include "file_internal.h" /* for MAX_OPEN_FILES */ |
| 92 | |
| 93 | #define PCOC_WRAPPER(_x_) WRAPPER(_x_) |
| 94 | |
| 95 | BITARRAY_TYPE_DECLARE(plugin_check_open_close_bitmap_t, open_files_bitmap, |
| 96 | MAX_OPEN_FILES) |
| 97 | |
| 98 | static plugin_check_open_close_bitmap_t open_files_bitmap; |
| 99 | |
| 100 | static void plugin_check_open_close__enter(void) |
| 101 | { |
| 102 | if (!current_plugin_handle) |
| 103 | open_files_bitmap_clear(&open_files_bitmap); |
| 104 | } |
| 105 | |
| 106 | static void plugin_check_open_close__open(int fildes) |
| 107 | { |
| 108 | if (fildes >= 0) |
| 109 | open_files_bitmap_set_bit(&open_files_bitmap, fildes); |
| 110 | } |
| 111 | |
| 112 | static void plugin_check_open_close__close(int fildes) |
| 113 | { |
| 114 | if (fildes < 0) |
| 115 | return; |
| 116 | |
| 117 | if (!open_files_bitmap_test_bit(&open_files_bitmap, fildes)) |
| 118 | { |
| 119 | logf("double close from plugin"); |
| 120 | } |
| 121 | |
| 122 | open_files_bitmap_clear_bit(&open_files_bitmap, fildes); |
| 123 | } |
| 124 | |
| 125 | static int WRAPPER(open)(const char *path, int oflag, ...) |
| 126 | { |
| 127 | int fildes = FS_PREFIX(open)(path, oflag __OPEN_MODE_ARG); |
| 128 | plugin_check_open_close__open(fildes); |
| 129 | return fildes; |
| 130 | } |
| 131 | |
| 132 | static int WRAPPER(creat)(const char *path, mode_t mode) |
| 133 | { |
| 134 | int fildes = FS_PREFIX(creat)(path __CREAT_MODE_ARG); |
| 135 | plugin_check_open_close__open(fildes); |
| 136 | return fildes; |
| 137 | (void)mode; |
| 138 | } |
| 139 | |
| 140 | static int WRAPPER(close)(int fildes) |
| 141 | { |
| 142 | int rc = FS_PREFIX(close)(fildes); |
| 143 | if (rc >= 0) |
| 144 | plugin_check_open_close__close(fildes); |
| 145 | |
| 146 | return rc; |
| 147 | } |
| 148 | |
| 149 | static void plugin_check_open_close__exit(void) |
| 150 | { |
| 151 | if (current_plugin_handle) |
| 152 | return; |
| 153 | |
| 154 | if (open_files_bitmap_is_clear(&open_files_bitmap)) |
| 155 | return; |
| 156 | |
Mihail Zenkov | 25fc7f1 | 2016-03-30 20:48:17 +0000 | [diff] [blame] | 157 | logf("Plugin '%s' leaks file handles", current_plugin); |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 158 | |
| 159 | static const char *lines[] = |
| 160 | { ID2P(LANG_PLUGIN_ERROR), "#leak-file-handles" }; |
| 161 | static const struct text_message message = { lines, 2 }; |
| 162 | button_clear_queue(); /* Empty the keyboard buffer */ |
| 163 | gui_syncyesno_run(&message, NULL, NULL); |
| 164 | |
| 165 | FOR_EACH_BITARRAY_SET_BIT(&open_files_bitmap, fildes) |
| 166 | WRAPPER(close)(fildes); |
| 167 | } |
| 168 | |
| 169 | #else /* !HAVE_PLUGIN_CHECK_OPEN_CLOSE */ |
| 170 | |
| 171 | #define PCOC_WRAPPER(_x_) FS_PREFIX(_x_) |
| 172 | #define plugin_check_open_close__enter() |
| 173 | #define plugin_check_open_close__exit() |
| 174 | |
| 175 | #endif /* HAVE_PLUGIN_CHECK_OPEN_CLOSE */ |
| 176 | |
Jens Arnold | 398e401 | 2004-07-20 21:37:36 +0000 | [diff] [blame] | 177 | static const struct plugin_api rockbox_api = { |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 178 | rbversion, |
| 179 | &global_settings, |
| 180 | &global_status, |
| 181 | language_strings, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 182 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 183 | /* lcd */ |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 184 | splash, |
| 185 | splashf, |
Thomas Martitz | 1034dea | 2009-03-30 16:06:02 +0000 | [diff] [blame] | 186 | #ifdef HAVE_LCD_CONTRAST |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 187 | lcd_set_contrast, |
Thomas Martitz | 1034dea | 2009-03-30 16:06:02 +0000 | [diff] [blame] | 188 | #endif |
Jens Arnold | 54ea2e4 | 2007-03-31 09:58:49 +0000 | [diff] [blame] | 189 | lcd_update, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 190 | lcd_clear_display, |
Jens Arnold | ad4e3d6 | 2007-03-26 07:52:13 +0000 | [diff] [blame] | 191 | lcd_getstringsize, |
| 192 | lcd_putsxy, |
Rafaël Carré | da16248 | 2010-08-30 20:47:53 +0000 | [diff] [blame] | 193 | lcd_putsxyf, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 194 | lcd_puts, |
Rafaël Carré | da16248 | 2010-08-30 20:47:53 +0000 | [diff] [blame] | 195 | lcd_putsf, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 196 | lcd_puts_scroll, |
Thomas Martitz | 1c5d0b4 | 2013-04-03 16:33:23 +0200 | [diff] [blame] | 197 | lcd_scroll_stop, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 198 | #ifdef HAVE_LCD_CHARCELLS |
| 199 | lcd_define_pattern, |
Daniel Stenberg | afd7042 | 2003-07-24 09:35:32 +0000 | [diff] [blame] | 200 | lcd_get_locked_pattern, |
| 201 | lcd_unlock_pattern, |
| 202 | lcd_putc, |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 203 | lcd_put_cursor, |
| 204 | lcd_remove_cursor, |
Jens Arnold | 323d75d | 2007-04-03 18:06:13 +0000 | [diff] [blame] | 205 | lcd_icon, |
Linus Nielsen Feltzing | 60895bc | 2005-09-02 05:39:09 +0000 | [diff] [blame] | 206 | lcd_double_height, |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 207 | #else /* HAVE_LCD_BITMAP */ |
Jonathan Gordon | b37e6bc | 2012-02-22 21:18:05 +1100 | [diff] [blame] | 208 | &lcd_static_framebuffer[0][0], |
Richard Quirk | 212e780 | 2012-12-09 21:04:17 +0100 | [diff] [blame] | 209 | lcd_set_viewport, |
| 210 | lcd_set_framebuffer, |
| 211 | lcd_bmp_part, |
Jens Arnold | c84e345 | 2008-03-24 00:45:03 +0000 | [diff] [blame] | 212 | lcd_update_rect, |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 213 | lcd_set_drawmode, |
| 214 | lcd_get_drawmode, |
Jonathan Gordon | aa0f4a4 | 2011-09-24 13:19:34 +0000 | [diff] [blame] | 215 | screen_helper_setfont, |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 216 | lcd_drawpixel, |
| 217 | lcd_drawline, |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 218 | lcd_hline, |
| 219 | lcd_vline, |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 220 | lcd_drawrect, |
| 221 | lcd_fillrect, |
Jens Arnold | f894a4c | 2005-07-06 22:58:02 +0000 | [diff] [blame] | 222 | lcd_mono_bitmap_part, |
| 223 | lcd_mono_bitmap, |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 224 | #if LCD_DEPTH > 1 |
| 225 | lcd_set_foreground, |
| 226 | lcd_get_foreground, |
| 227 | lcd_set_background, |
| 228 | lcd_get_background, |
| 229 | lcd_bitmap_part, |
| 230 | lcd_bitmap, |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 231 | lcd_get_backdrop, |
Jonathan Gordon | 6288523 | 2006-11-19 14:11:42 +0000 | [diff] [blame] | 232 | lcd_set_backdrop, |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 233 | #endif |
Thomas Martitz | a1842c0 | 2014-06-18 07:15:00 +0200 | [diff] [blame] | 234 | #if LCD_DEPTH >= 16 |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 235 | lcd_bitmap_transparent_part, |
| 236 | lcd_bitmap_transparent, |
Rafaël Carré | a98c54f | 2009-06-21 14:09:48 +0000 | [diff] [blame] | 237 | #if MEMORYSIZE > 2 |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 238 | lcd_blit_yuv, |
| 239 | #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ |
Jens Arnold | 27f5cda | 2009-07-15 22:02:42 +0000 | [diff] [blame] | 240 | || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) \ |
Rafaël Carré | 35500c2 | 2010-03-28 02:41:29 +0000 | [diff] [blame] | 241 | || defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) \ |
Michael Sevakis | 0dd74ca | 2011-01-11 01:21:31 +0000 | [diff] [blame] | 242 | || defined(TOSHIBA_GIGABEAT_S) || defined(PHILIPS_SA9200) |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 243 | lcd_yuv_set_options, |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 244 | #endif |
Rafaël Carré | a98c54f | 2009-06-21 14:09:48 +0000 | [diff] [blame] | 245 | #endif /* MEMORYSIZE > 2 */ |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 246 | #elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 247 | lcd_blit_mono, |
| 248 | lcd_blit_grey_phase, |
| 249 | #endif /* LCD_DEPTH */ |
Andrew Mahone | eef7945 | 2009-05-06 04:53:56 +0000 | [diff] [blame] | 250 | #if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256) |
| 251 | lcd_blit_pal256, |
| 252 | lcd_pal256_update_pal, |
| 253 | #endif |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 254 | #ifdef HAVE_LCD_INVERT |
| 255 | lcd_set_invert_display, |
| 256 | #endif /* HAVE_LCD_INVERT */ |
Andrew Mahone | eef7945 | 2009-05-06 04:53:56 +0000 | [diff] [blame] | 257 | #if defined(HAVE_LCD_MODES) |
| 258 | lcd_set_mode, |
| 259 | #endif |
Thomas Martitz | b7739fb | 2009-03-17 02:43:47 +0000 | [diff] [blame] | 260 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
Jonathan Gordon | bdbdb97 | 2008-06-23 13:20:35 +0000 | [diff] [blame] | 261 | &button_queue, |
| 262 | #endif |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 263 | bidi_l2v, |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 264 | is_diacritic, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 265 | font_get_bits, |
| 266 | font_load, |
Jonathan Gordon | aa0f4a4 | 2011-09-24 13:19:34 +0000 | [diff] [blame] | 267 | font_unload, |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 268 | font_get, |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 269 | font_getstringsize, |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 270 | font_get_width, |
Jonathan Gordon | fda7d72 | 2007-08-06 13:42:52 +0000 | [diff] [blame] | 271 | screen_clear_area, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 272 | gui_scrollbar_draw, |
Michael Sevakis | 8cfbd36 | 2008-12-10 08:57:10 +0000 | [diff] [blame] | 273 | #endif /* HAVE_LCD_BITMAP */ |
Frank Gevaerts | 859f762 | 2019-07-20 22:06:30 +0200 | [diff] [blame] | 274 | get_codepage_name, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 275 | |
Christian Gmeiner | c63430e | 2005-04-15 12:55:31 +0000 | [diff] [blame] | 276 | #ifdef HAVE_REMOTE_LCD |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 277 | /* remote lcd */ |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 278 | lcd_remote_set_contrast, |
Linus Nielsen Feltzing | 250678b | 2005-04-25 07:42:10 +0000 | [diff] [blame] | 279 | lcd_remote_clear_display, |
Christian Gmeiner | 7d98481 | 2005-04-25 23:47:51 +0000 | [diff] [blame] | 280 | lcd_remote_puts, |
| 281 | lcd_remote_puts_scroll, |
Thomas Martitz | 1c5d0b4 | 2013-04-03 16:33:23 +0200 | [diff] [blame] | 282 | lcd_remote_scroll_stop, |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 283 | lcd_remote_set_drawmode, |
| 284 | lcd_remote_get_drawmode, |
| 285 | lcd_remote_setfont, |
| 286 | lcd_remote_getstringsize, |
| 287 | lcd_remote_drawpixel, |
| 288 | lcd_remote_drawline, |
| 289 | lcd_remote_hline, |
| 290 | lcd_remote_vline, |
| 291 | lcd_remote_drawrect, |
| 292 | lcd_remote_fillrect, |
Jens Arnold | d7f9439 | 2005-07-07 00:05:29 +0000 | [diff] [blame] | 293 | lcd_remote_mono_bitmap_part, |
| 294 | lcd_remote_mono_bitmap, |
Christian Gmeiner | 7d98481 | 2005-04-25 23:47:51 +0000 | [diff] [blame] | 295 | lcd_remote_putsxy, |
Jonathan Gordon | b37e6bc | 2012-02-22 21:18:05 +1100 | [diff] [blame] | 296 | &lcd_remote_static_framebuffer[0][0], |
Christian Gmeiner | 7d98481 | 2005-04-25 23:47:51 +0000 | [diff] [blame] | 297 | lcd_remote_update, |
| 298 | lcd_remote_update_rect, |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 299 | #if (LCD_REMOTE_DEPTH > 1) |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 300 | lcd_remote_set_foreground, |
| 301 | lcd_remote_get_foreground, |
| 302 | lcd_remote_set_background, |
| 303 | lcd_remote_get_background, |
| 304 | lcd_remote_bitmap_part, |
| 305 | lcd_remote_bitmap, |
| 306 | #endif |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 307 | #endif /* HAVE_REMOTE_LCD */ |
| 308 | #if NB_SCREENS == 2 |
| 309 | {&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]}, |
| 310 | #else |
| 311 | {&screens[SCREEN_MAIN]}, |
| 312 | #endif |
| 313 | |
Jonathan Gordon | 5ca1539 | 2008-03-26 03:35:24 +0000 | [diff] [blame] | 314 | viewport_set_defaults, |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 315 | #ifdef HAVE_LCD_BITMAP |
| 316 | viewportmanager_theme_enable, |
| 317 | viewportmanager_theme_undo, |
Richard Quirk | 212e780 | 2012-12-09 21:04:17 +0100 | [diff] [blame] | 318 | viewport_set_fullscreen, |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 319 | #endif |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 320 | |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 321 | /* lcd backlight */ |
| 322 | /* The backlight_* functions must be present in the API regardless whether |
| 323 | * HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has |
| 324 | * no backlight but can be modded to have backlight (it's prepared on the |
| 325 | * PCB). This makes backlight an all-target feature API wise, and keeps API |
| 326 | * compatible between stock and modded Ondio. |
| 327 | * For OLED targets like the Sansa Clip, the backlight_* functions control |
| 328 | * the display enable, which has essentially the same effect. */ |
| 329 | is_backlight_on, |
| 330 | backlight_on, |
| 331 | backlight_off, |
| 332 | backlight_set_timeout, |
| 333 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
| 334 | backlight_set_brightness, |
| 335 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ |
| 336 | |
| 337 | #if CONFIG_CHARGING |
| 338 | backlight_set_timeout_plugged, |
| 339 | #endif |
| 340 | |
| 341 | #ifdef HAVE_REMOTE_LCD |
| 342 | remote_backlight_on, |
| 343 | remote_backlight_off, |
| 344 | remote_backlight_set_timeout, |
| 345 | #if CONFIG_CHARGING |
| 346 | remote_backlight_set_timeout_plugged, |
| 347 | #endif |
| 348 | #endif /* HAVE_REMOTE_LCD */ |
| 349 | |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 350 | /* list */ |
| 351 | gui_synclist_init, |
| 352 | gui_synclist_set_nb_items, |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 353 | gui_synclist_set_voice_callback, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 354 | gui_synclist_set_icon_callback, |
| 355 | gui_synclist_get_nb_items, |
| 356 | gui_synclist_get_sel_pos, |
| 357 | gui_synclist_draw, |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 358 | gui_synclist_speak_item, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 359 | gui_synclist_select_item, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 360 | gui_synclist_add_item, |
| 361 | gui_synclist_del_item, |
| 362 | gui_synclist_limit_scroll, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 363 | gui_synclist_do_button, |
Peter D'Hoye | 0f02e4f | 2006-11-30 22:29:48 +0000 | [diff] [blame] | 364 | gui_synclist_set_title, |
Bertrik Sikken | 9464fdd | 2008-08-14 22:35:00 +0000 | [diff] [blame] | 365 | gui_syncyesno_run, |
Jonathan Gordon | bdbdb97 | 2008-06-23 13:20:35 +0000 | [diff] [blame] | 366 | simplelist_info_init, |
| 367 | simplelist_show_list, |
Michael Sevakis | 6aa12c1 | 2006-10-14 01:32:58 +0000 | [diff] [blame] | 368 | |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 369 | /* action handling */ |
| 370 | get_custom_action, |
| 371 | get_action, |
| 372 | #ifdef HAVE_TOUCHSCREEN |
| 373 | action_get_touchscreen_press, |
| 374 | #endif |
| 375 | action_userabort, |
| 376 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 377 | /* button */ |
| 378 | button_get, |
| 379 | button_get_w_tmo, |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 380 | button_status, |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 381 | #ifdef HAVE_BUTTON_DATA |
| 382 | button_get_data, |
Thomas Martitz | d85c3ec | 2009-10-20 21:54:59 +0000 | [diff] [blame] | 383 | button_status_wdata, |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 384 | #endif |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 385 | button_clear_queue, |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 386 | button_queue_count, |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 387 | #ifdef HAS_BUTTON_HOLD |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 388 | button_hold, |
| 389 | #endif |
Maurus Cuelenaere | 1392dc2 | 2008-08-23 09:46:38 +0000 | [diff] [blame] | 390 | #ifdef HAVE_TOUCHSCREEN |
| 391 | touchscreen_set_mode, |
Thomas Martitz | b8439f2 | 2012-01-26 23:37:27 +0100 | [diff] [blame] | 392 | touchscreen_get_mode, |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 393 | #endif |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 394 | |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 395 | #ifdef HAVE_BUTTON_LIGHT |
| 396 | buttonlight_set_timeout, |
| 397 | buttonlight_off, |
| 398 | buttonlight_on, |
| 399 | #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS |
| 400 | buttonlight_set_brightness, |
| 401 | #endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */ |
| 402 | #endif /* HAVE_BUTTON_LIGHT */ |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 403 | |
| 404 | /* file */ |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 405 | open_utf8, |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 406 | PCOC_WRAPPER(open), |
| 407 | PCOC_WRAPPER(creat), |
| 408 | PCOC_WRAPPER(close), |
| 409 | FS_PREFIX(read), |
| 410 | FS_PREFIX(lseek), |
| 411 | FS_PREFIX(write), |
| 412 | FS_PREFIX(remove), |
| 413 | FS_PREFIX(rename), |
| 414 | FS_PREFIX(ftruncate), |
| 415 | FS_PREFIX(filesize), |
Daniel Stenberg | 22b7701 | 2005-02-22 12:19:12 +0000 | [diff] [blame] | 416 | fdprintf, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 417 | read_line, |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 418 | settings_parseline, |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame] | 419 | storage_sleep, |
| 420 | storage_spin, |
| 421 | storage_spindown, |
| 422 | #if USING_STORAGE_CALLBACK |
| 423 | register_storage_idle_func, |
| 424 | unregister_storage_idle_func, |
| 425 | #endif /* USING_STORAGE_CALLBACK */ |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 426 | reload_directory, |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 427 | create_numbered_filename, |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 428 | FS_PREFIX(file_exists), |
Thomas Martitz | 5481090 | 2009-02-11 16:37:12 +0000 | [diff] [blame] | 429 | strip_extension, |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 430 | crc_32, |
Michael Sevakis | 2da0f9b | 2011-01-20 17:11:23 +0000 | [diff] [blame] | 431 | filetype_get_attr, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 432 | |
| 433 | /* dir */ |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 434 | FS_PREFIX(opendir), |
| 435 | FS_PREFIX(closedir), |
| 436 | FS_PREFIX(readdir), |
| 437 | FS_PREFIX(mkdir), |
| 438 | FS_PREFIX(rmdir), |
| 439 | FS_PREFIX(dir_exists), |
Nils Wallménius | 8123dff | 2010-10-16 12:30:06 +0000 | [diff] [blame] | 440 | dir_get_info, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 441 | |
Michael Sevakis | 2da0f9b | 2011-01-20 17:11:23 +0000 | [diff] [blame] | 442 | /* browsing */ |
| 443 | browse_context_init, |
| 444 | rockbox_browse, |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 445 | tree_get_context, |
| 446 | tree_get_entries, |
| 447 | tree_get_entry_at, |
| 448 | set_current_file, |
| 449 | set_dirfilter, |
Michael Sevakis | 2da0f9b | 2011-01-20 17:11:23 +0000 | [diff] [blame] | 450 | |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 451 | /* talking */ |
| 452 | talk_id, |
| 453 | talk_file, |
| 454 | talk_file_or_spell, |
| 455 | talk_dir_or_spell, |
| 456 | talk_number, |
| 457 | talk_value, |
| 458 | talk_spell, |
| 459 | talk_time, |
| 460 | talk_date, |
| 461 | talk_disable, |
| 462 | talk_shutup, |
| 463 | talk_force_shutup, |
| 464 | talk_force_enqueue_next, |
| 465 | |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 466 | /* kernel/ system */ |
Rafaël Carré | 851be21 | 2010-08-03 19:00:29 +0000 | [diff] [blame] | 467 | #if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE |
Thomas Martitz | 5481090 | 2009-02-11 16:37:12 +0000 | [diff] [blame] | 468 | __div0, |
| 469 | #endif |
Thomas Martitz | 6eaab4d | 2010-09-01 21:29:34 +0000 | [diff] [blame] | 470 | sleep, |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 471 | yield, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 472 | ¤t_tick, |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 473 | default_event_handler, |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 474 | default_event_handler_ex, |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 475 | create_thread, |
Michael Sevakis | 56dd75d | 2011-03-16 05:38:37 +0000 | [diff] [blame] | 476 | thread_self, |
Michael Sevakis | 27cf677 | 2008-03-25 02:34:12 +0000 | [diff] [blame] | 477 | thread_exit, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 478 | thread_wait, |
| 479 | #if (CONFIG_CODEC == SWCODEC) |
Michael Sevakis | 2054627 | 2009-01-05 10:31:19 +0000 | [diff] [blame] | 480 | thread_thaw, |
| 481 | #ifdef HAVE_PRIORITY_SCHEDULING |
| 482 | thread_set_priority, |
| 483 | #endif |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 484 | mutex_init, |
| 485 | mutex_lock, |
| 486 | mutex_unlock, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 487 | #endif |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 488 | #ifdef HAVE_SEMAPHORE_OBJECTS |
| 489 | semaphore_init, |
| 490 | semaphore_wait, |
| 491 | semaphore_release, |
| 492 | #endif |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 493 | reset_poweroff_timer, |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 494 | set_sleeptimer_duration, /*stub*/ |
| 495 | get_sleep_timer, /*stub*/ |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 496 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 497 | system_memory_guard, |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 498 | &cpu_frequency, |
Jonathan Gordon | f8c68c7 | 2007-01-22 10:41:25 +0000 | [diff] [blame] | 499 | |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 500 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
Jonathan Gordon | f8c68c7 | 2007-01-22 10:41:25 +0000 | [diff] [blame] | 501 | #ifdef CPU_BOOST_LOGGING |
| 502 | cpu_boost_, |
| 503 | #else |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 504 | cpu_boost, |
| 505 | #endif |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 506 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 507 | #endif /* PLATFORM_NATIVE */ |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 508 | #ifdef HAVE_SCHEDULER_BOOSTCTRL |
| 509 | trigger_cpu_boost, |
| 510 | cancel_cpu_boost, |
Jonathan Gordon | f8c68c7 | 2007-01-22 10:41:25 +0000 | [diff] [blame] | 511 | #endif |
Nils Wallménius | 8123dff | 2010-10-16 12:30:06 +0000 | [diff] [blame] | 512 | |
Michael Sevakis | 6a67707 | 2011-12-17 07:27:24 +0000 | [diff] [blame] | 513 | commit_dcache, |
| 514 | commit_discard_dcache, |
Thomas Martitz | c6d69ae | 2012-01-27 09:31:34 +0100 | [diff] [blame] | 515 | commit_discard_idcache, |
Nils Wallménius | 8123dff | 2010-10-16 12:30:06 +0000 | [diff] [blame] | 516 | |
| 517 | lc_open, |
| 518 | lc_open_from_mem, |
| 519 | lc_get_header, |
| 520 | lc_close, |
| 521 | |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 522 | timer_register, |
| 523 | timer_unregister, |
| 524 | timer_set_period, |
Kevin Ferrare | 81aac2a | 2007-07-29 03:43:37 +0000 | [diff] [blame] | 525 | |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 526 | queue_init, |
| 527 | queue_delete, |
| 528 | queue_post, |
| 529 | queue_wait_w_tmo, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 530 | #if CONFIG_CODEC == SWCODEC |
| 531 | queue_enable_queue_send, |
| 532 | queue_empty, |
| 533 | queue_wait, |
| 534 | queue_send, |
| 535 | queue_reply, |
| 536 | #endif |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 537 | |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 538 | #ifdef RB_PROFILE |
| 539 | profile_thread, |
| 540 | profstop, |
Michael Giacomelli | 52bdcba | 2008-07-28 22:43:41 +0000 | [diff] [blame] | 541 | __cyg_profile_func_enter, |
| 542 | __cyg_profile_func_exit, |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 543 | #endif |
Thomas Martitz | d85c3ec | 2009-10-20 21:54:59 +0000 | [diff] [blame] | 544 | add_event, |
| 545 | remove_event, |
| 546 | send_event, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 547 | |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 548 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |
Jens Arnold | 06bc627 | 2006-03-11 09:28:49 +0000 | [diff] [blame] | 549 | /* special simulator hooks */ |
| 550 | #if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 |
| 551 | sim_lcd_ex_init, |
| 552 | sim_lcd_ex_update_rect, |
| 553 | #endif |
| 554 | #endif |
| 555 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 556 | /* strings and memory */ |
| 557 | snprintf, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 558 | vsnprintf, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 559 | strcpy, |
Nils Wallménius | 3d4701a | 2009-07-14 13:57:45 +0000 | [diff] [blame] | 560 | strlcpy, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 561 | strlen, |
Linus Nielsen Feltzing | a96a130 | 2004-07-13 14:14:30 +0000 | [diff] [blame] | 562 | strrchr, |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 563 | strcmp, |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 564 | strncmp, |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 565 | strcasecmp, |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 566 | strncasecmp, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 567 | memset, |
| 568 | memcpy, |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 569 | memmove, |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 570 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Linus Nielsen Feltzing | 0c458c0 | 2004-07-13 14:01:41 +0000 | [diff] [blame] | 571 | _ctype_, |
Thomas Martitz | 3cca7e8 | 2010-05-14 12:37:05 +0000 | [diff] [blame] | 572 | #endif |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 573 | atoi, |
Daniel Stenberg | 22b7701 | 2005-02-22 12:19:12 +0000 | [diff] [blame] | 574 | strchr, |
| 575 | strcat, |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 576 | strlcat, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 577 | memchr, |
Daniel Stenberg | 22b7701 | 2005-02-22 12:19:12 +0000 | [diff] [blame] | 578 | memcmp, |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 579 | strcasestr, |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 580 | strtok_r, |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 581 | /* unicode stuff */ |
| 582 | utf8decode, |
| 583 | iso_decode, |
| 584 | utf16LEdecode, |
| 585 | utf16BEdecode, |
| 586 | utf8encode, |
| 587 | utf8length, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 588 | utf8seek, |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 589 | |
Thomas Martitz | a13e964 | 2011-10-17 18:28:35 +0000 | [diff] [blame] | 590 | /* the buflib memory management library */ |
| 591 | buflib_init, |
| 592 | buflib_available, |
| 593 | buflib_alloc, |
| 594 | buflib_alloc_ex, |
| 595 | buflib_alloc_maximum, |
| 596 | buflib_buffer_in, |
| 597 | buflib_buffer_out, |
| 598 | buflib_free, |
| 599 | buflib_shrink, |
| 600 | buflib_get_data, |
| 601 | buflib_get_name, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 602 | |
| 603 | /* sound */ |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 604 | sound_set, |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 605 | sound_current, /*stub*/ |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 606 | sound_default, |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 607 | sound_min, |
| 608 | sound_max, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 609 | sound_unit, |
| 610 | sound_val2phys, |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 611 | #ifdef AUDIOHW_HAVE_EQ |
| 612 | sound_enum_hw_eq_band_setting, |
| 613 | #endif |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 614 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ |
| 615 | (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL) |
| 616 | sound_set_pitch, |
| 617 | #endif |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 618 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 619 | mp3_play_data, |
| 620 | mp3_play_pause, |
| 621 | mp3_play_stop, |
| 622 | mp3_is_playing, |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 623 | #if CONFIG_CODEC != SWCODEC |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 624 | bitswap, |
Jörg Hohensohn | facfec0 | 2004-02-03 23:56:25 +0000 | [diff] [blame] | 625 | #endif |
Dave Chapman | fd8bac8 | 2007-01-01 13:21:19 +0000 | [diff] [blame] | 626 | #endif |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 627 | #if CONFIG_CODEC == SWCODEC |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 628 | &audio_master_sampr_list[0], |
| 629 | &hw_freq_sampr[0], |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 630 | pcm_apply_settings, |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 631 | pcm_play_data, |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 632 | pcm_play_stop, |
| 633 | pcm_set_frequency, |
| 634 | pcm_is_playing, |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 635 | pcm_is_paused, |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 636 | pcm_play_pause, |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 637 | pcm_get_bytes_waiting, |
Jens Arnold | dae698c | 2006-03-11 09:38:12 +0000 | [diff] [blame] | 638 | pcm_calculate_peaks, |
Frank Gevaerts | 43264a9 | 2010-02-10 19:44:11 +0000 | [diff] [blame] | 639 | pcm_get_peak_buffer, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 640 | pcm_play_lock, |
| 641 | pcm_play_unlock, |
Michael Sevakis | a2b6703 | 2011-06-29 06:37:04 +0000 | [diff] [blame] | 642 | beep_play, |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 643 | #ifdef HAVE_RECORDING |
| 644 | &rec_freq_sampr[0], |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 645 | pcm_init_recording, |
| 646 | pcm_close_recording, |
| 647 | pcm_record_data, |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 648 | pcm_stop_recording, |
| 649 | pcm_calculate_rec_peaks, |
| 650 | audio_set_recording_gain, |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 651 | #endif /* HAVE_RECORDING */ |
Michael Sevakis | 2d48d0f | 2007-06-08 23:42:04 +0000 | [diff] [blame] | 652 | #if INPUT_SRC_CAPS != 0 |
| 653 | audio_set_output_source, |
| 654 | audio_set_input_source, |
Jens Arnold | dae698c | 2006-03-11 09:38:12 +0000 | [diff] [blame] | 655 | #endif |
Bertrik Sikken | afc9608 | 2012-05-01 03:58:27 -0400 | [diff] [blame] | 656 | dsp_set_crossfeed_type , |
Michael Sevakis | c9bcbe2 | 2012-03-27 19:52:15 -0400 | [diff] [blame] | 657 | dsp_eq_enable, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 658 | dsp_dither_enable, |
Nils Wallménius | d29a11b | 2012-05-08 16:34:26 +0200 | [diff] [blame] | 659 | #ifdef HAVE_PITCHCONTROL |
Michael Sevakis | c9bcbe2 | 2012-03-27 19:52:15 -0400 | [diff] [blame] | 660 | dsp_set_timestretch, |
| 661 | #endif |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 662 | dsp_configure, |
Michael Sevakis | c9bcbe2 | 2012-03-27 19:52:15 -0400 | [diff] [blame] | 663 | dsp_get_config, |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 664 | dsp_process, |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 665 | |
Thomas Martitz | 589879b | 2011-08-03 09:52:23 +0000 | [diff] [blame] | 666 | mixer_channel_status, |
| 667 | mixer_channel_get_buffer, |
| 668 | mixer_channel_calculate_peaks, |
| 669 | mixer_channel_play_data, |
| 670 | mixer_channel_play_pause, |
| 671 | mixer_channel_stop, |
| 672 | mixer_channel_set_amplitude, |
| 673 | mixer_channel_get_bytes_waiting, |
Richard Quirk | 212e780 | 2012-12-09 21:04:17 +0100 | [diff] [blame] | 674 | mixer_channel_set_buffer_hook, |
Thomas Martitz | 1fc1904 | 2013-12-14 23:15:45 +0100 | [diff] [blame] | 675 | mixer_set_frequency, |
| 676 | mixer_get_frequency, |
Thomas Martitz | 589879b | 2011-08-03 09:52:23 +0000 | [diff] [blame] | 677 | |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 678 | pcmbuf_fade, |
Thomas Martitz | 589879b | 2011-08-03 09:52:23 +0000 | [diff] [blame] | 679 | system_sound_play, |
| 680 | keyclick_click, |
Michael Sevakis | c9bcbe2 | 2012-03-27 19:52:15 -0400 | [diff] [blame] | 681 | #endif /* CONFIG_CODEC == SWCODEC */ |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 682 | |
| 683 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
| 684 | peak_meter_scale_value, |
| 685 | peak_meter_set_use_dbfs, |
| 686 | peak_meter_get_use_dbfs, |
| 687 | #endif |
| 688 | |
| 689 | |
| 690 | /* metadata */ |
| 691 | get_metadata, |
| 692 | mp3info, |
| 693 | count_mp3_frames, |
| 694 | create_xing_header, |
| 695 | find_next_frame, |
| 696 | #ifdef HAVE_TAGCACHE |
| 697 | tagcache_search, |
| 698 | tagcache_search_set_uniqbuf, |
| 699 | tagcache_search_add_filter, |
| 700 | tagcache_get_next, |
| 701 | tagcache_retrieve, |
| 702 | tagcache_search_finish, |
| 703 | tagcache_get_numeric, |
| 704 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
| 705 | tagcache_fill_tags, |
| 706 | #endif |
| 707 | #endif /* HAVE_TAGCACHE */ |
| 708 | |
| 709 | #ifdef HAVE_ALBUMART |
| 710 | search_albumart_files, |
| 711 | #endif |
| 712 | |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 713 | /* playback control */ |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 714 | playlist_amount, |
| 715 | playlist_resume, |
Richard Quirk | 212e780 | 2012-12-09 21:04:17 +0100 | [diff] [blame] | 716 | playlist_resume_track, |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 717 | playlist_start, |
Andrew Mahone | c1c3d05 | 2009-06-01 21:08:49 +0000 | [diff] [blame] | 718 | playlist_add, |
| 719 | playlist_sync, |
| 720 | playlist_remove_all_tracks, |
| 721 | playlist_create, |
| 722 | playlist_insert_track, |
Jonathan Gordon | f1034e0 | 2009-07-05 18:07:58 +0000 | [diff] [blame] | 723 | playlist_insert_directory, |
Andrew Mahone | c1c3d05 | 2009-06-01 21:08:49 +0000 | [diff] [blame] | 724 | playlist_shuffle, |
Thomas Martitz | 6eaab4d | 2010-09-01 21:29:34 +0000 | [diff] [blame] | 725 | audio_play, |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 726 | audio_stop, |
| 727 | audio_pause, |
| 728 | audio_resume, |
| 729 | audio_next, |
| 730 | audio_prev, |
| 731 | audio_ff_rewind, |
| 732 | audio_next_track, |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 733 | audio_status, |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 734 | audio_current_track, |
| 735 | audio_flush_and_reload_tracks, |
| 736 | audio_get_file_pos, |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 737 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
Linus Nielsen Feltzing | 78c829f | 2005-04-25 08:21:10 +0000 | [diff] [blame] | 738 | mpeg_get_last_header, |
Linus Nielsen Feltzing | ef73c2e | 2005-04-25 08:59:19 +0000 | [diff] [blame] | 739 | #endif |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 740 | |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 741 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 742 | /* MAS communication */ |
Linus Nielsen Feltzing | 8fc5b78 | 2004-06-10 13:48:53 +0000 | [diff] [blame] | 743 | mas_readmem, |
| 744 | mas_writemem, |
| 745 | mas_readreg, |
| 746 | mas_writereg, |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 747 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
Linus Nielsen Feltzing | 8fc5b78 | 2004-06-10 13:48:53 +0000 | [diff] [blame] | 748 | mas_codec_writereg, |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 749 | mas_codec_readreg, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 750 | i2c_begin, |
| 751 | i2c_end, |
| 752 | i2c_write, |
Linus Nielsen Feltzing | 8fc5b78 | 2004-06-10 13:48:53 +0000 | [diff] [blame] | 753 | #endif |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 754 | #endif /* !SIMULATOR && CONFIG_CODEC != SWCODEC */ |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 755 | |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 756 | /* menu */ |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 757 | root_menu_get_options, |
Jonathan Gordon | 3452146 | 2007-03-07 13:00:46 +0000 | [diff] [blame] | 758 | do_menu, |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 759 | root_menu_set_default, |
| 760 | root_menu_write_to_cfg, |
| 761 | root_menu_load_from_cfg, |
| 762 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 763 | /* statusbars */ |
| 764 | &statusbars, |
| 765 | gui_syncstatusbar_draw, |
Yoshihisa Uchida | e5a2576 | 2010-07-07 11:35:30 +0000 | [diff] [blame] | 766 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 767 | /* options */ |
Michael Sevakis | 8cfbd36 | 2008-12-10 08:57:10 +0000 | [diff] [blame] | 768 | get_settings_list, |
Jonathan Gordon | a5278fa | 2007-07-11 05:41:23 +0000 | [diff] [blame] | 769 | find_setting, |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 770 | settings_save, |
Jonathan Gordon | a5278fa | 2007-07-11 05:41:23 +0000 | [diff] [blame] | 771 | option_screen, |
Hristo Kovachev | f53f64a | 2006-03-21 09:36:13 +0000 | [diff] [blame] | 772 | set_option, |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 773 | set_bool_options, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 774 | set_int, |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 775 | set_int_ex, |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 776 | set_bool, |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 777 | #ifdef HAVE_LCD_COLOR |
| 778 | set_color, |
| 779 | #endif |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 780 | |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 781 | /* power */ |
| 782 | battery_level, |
| 783 | battery_level_safe, |
| 784 | battery_time, |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 785 | battery_voltage, |
Jonathan Gordon | 9a6f419 | 2007-02-18 05:32:06 +0000 | [diff] [blame] | 786 | #if CONFIG_CHARGING |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 787 | charger_inserted, |
Bertrik Sikken | 52d2980 | 2009-03-24 21:59:44 +0000 | [diff] [blame] | 788 | # if CONFIG_CHARGING >= CHARGING_MONITOR |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 789 | charging_state, |
| 790 | # endif |
| 791 | #endif |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 792 | /* usb */ |
Amaury Pouly | dc127f2 | 2015-01-02 22:15:31 +0100 | [diff] [blame] | 793 | usb_inserted, |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 794 | usb_acknowledge, |
| 795 | #ifdef USB_ENABLE_HID |
| 796 | usb_hid_send, |
| 797 | #endif |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 798 | /* misc */ |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 799 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Michael Sevakis | 355b540 | 2014-04-28 09:15:06 -0400 | [diff] [blame] | 800 | __errno, |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 801 | #endif |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 802 | srand, |
| 803 | rand, |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 804 | (void *)qsort, |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 805 | kbd_input, |
| 806 | get_time, |
Björn Stenberg | c05b7d7 | 2004-06-16 19:35:20 +0000 | [diff] [blame] | 807 | set_time, |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 808 | gmtime_r, |
Tom Ross | e1147b8 | 2007-07-30 05:19:05 +0000 | [diff] [blame] | 809 | #if CONFIG_RTC |
| 810 | mktime, |
| 811 | #endif |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 812 | |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 813 | #if defined(DEBUG) || defined(SIMULATOR) |
| 814 | debugf, |
| 815 | #endif |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 816 | #ifdef ROCKBOX_HAS_LOGF |
Miika Pekkarinen | 202b726 | 2006-11-11 08:00:28 +0000 | [diff] [blame] | 817 | _logf, |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 818 | #endif |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 819 | #if CONFIG_CODEC == SWCODEC |
Michael Sevakis | 2054627 | 2009-01-05 10:31:19 +0000 | [diff] [blame] | 820 | codec_thread_do_callback, |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 821 | codec_load_file, |
Michael Sevakis | c537d59 | 2011-04-27 03:08:23 +0000 | [diff] [blame] | 822 | codec_run_proc, |
Michael Sevakis | 6510973 | 2011-02-23 14:31:13 +0000 | [diff] [blame] | 823 | codec_close, |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 824 | get_codec_filename, |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 825 | find_array_ptr, |
| 826 | remove_array_ptr, |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 827 | round_value_to_list32, |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 828 | #endif /* CONFIG_CODEC == SWCODEC */ |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 829 | |
Linus Nielsen Feltzing | 250678b | 2005-04-25 07:42:10 +0000 | [diff] [blame] | 830 | #ifdef HAVE_LCD_BITMAP |
| 831 | read_bmp_file, |
Andrew Mahone | eef7945 | 2009-05-06 04:53:56 +0000 | [diff] [blame] | 832 | read_bmp_fd, |
| 833 | #ifdef HAVE_JPEG |
| 834 | read_jpeg_file, |
| 835 | read_jpeg_fd, |
| 836 | #endif |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 837 | screen_dump_set_hook, |
Linus Nielsen Feltzing | 250678b | 2005-04-25 07:42:10 +0000 | [diff] [blame] | 838 | #endif |
Linus Nielsen Feltzing | 60895bc | 2005-09-02 05:39:09 +0000 | [diff] [blame] | 839 | show_logo, |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 840 | |
Dave Chapman | 491458e | 2006-09-26 19:25:52 +0000 | [diff] [blame] | 841 | #ifdef HAVE_WHEEL_POSITION |
| 842 | wheel_status, |
| 843 | wheel_send_events, |
| 844 | #endif |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 845 | |
Miika Pekkarinen | 0ea4d31 | 2007-01-12 18:34:00 +0000 | [diff] [blame] | 846 | #ifdef IRIVER_H100_SERIES |
| 847 | /* Routines for the iriver_flash -plugin. */ |
| 848 | detect_original_firmware, |
| 849 | detect_flashed_ramimage, |
| 850 | detect_flashed_romimage, |
| 851 | #endif |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 852 | led, |
Nicolas Pennequin | 90ce826 | 2007-12-09 18:48:02 +0000 | [diff] [blame] | 853 | |
William Wilgus | 6392e05 | 2019-07-20 04:46:14 -0500 | [diff] [blame] | 854 | /*plugin*/ |
| 855 | plugin_get_buffer, |
| 856 | plugin_get_audio_buffer, /* defined in plugin.c */ |
| 857 | plugin_release_audio_buffer, /* defined in plugin.c */ |
| 858 | plugin_tsr, /* defined in plugin.c */ |
| 859 | plugin_get_current_filename, |
| 860 | #ifdef PLUGIN_USE_IRAM |
| 861 | audio_hard_stop, |
Jonathan Gordon | 468edbb | 2008-09-23 09:59:06 +0000 | [diff] [blame] | 862 | #endif |
Michael Sevakis | effceea | 2008-10-23 13:13:00 +0000 | [diff] [blame] | 863 | |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 864 | /* new stuff at the end, sort into place next time |
Jonathan Gordon | 8358dff | 2008-06-24 10:20:22 +0000 | [diff] [blame] | 865 | the API gets incompatible */ |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 866 | }; |
| 867 | |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 868 | static int plugin_buffer_handle; |
Michael Sevakis | 81f5a22 | 2017-10-14 05:59:09 -0400 | [diff] [blame] | 869 | static size_t plugin_buffer_size; |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 870 | |
Steve Bavin | 6526577 | 2008-05-13 09:57:56 +0000 | [diff] [blame] | 871 | int plugin_load(const char* plugin, const void* parameter) |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 872 | { |
Thomas Martitz | 0d4585b | 2010-09-09 16:17:21 +0000 | [diff] [blame] | 873 | struct plugin_header *p_hdr; |
| 874 | struct lc_header *hdr; |
Karl Kurbjun | d6b0c97 | 2006-11-15 06:14:27 +0000 | [diff] [blame] | 875 | |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 876 | if (current_plugin_handle && pfn_tsr_exit) |
| 877 | { /* if we have a resident old plugin and a callback */ |
Jonathan Gordon | d7d2e69 | 2007-08-08 07:27:07 +0000 | [diff] [blame] | 878 | if (pfn_tsr_exit(!strcmp(current_plugin, plugin)) == false ) |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 879 | { |
| 880 | /* not allowing another plugin to load */ |
| 881 | return PLUGIN_OK; |
| 882 | } |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 883 | lc_close(current_plugin_handle); |
| 884 | current_plugin_handle = pfn_tsr_exit = NULL; |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 885 | if (plugin_buffer_handle > 0) |
| 886 | plugin_buffer_handle = core_free(plugin_buffer_handle); |
Jörg Hohensohn | 6800276 | 2004-04-30 20:37:11 +0000 | [diff] [blame] | 887 | } |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 888 | |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 889 | splash(0, ID2P(LANG_WAIT)); |
Jonathan Gordon | d7d2e69 | 2007-08-08 07:27:07 +0000 | [diff] [blame] | 890 | strcpy(current_plugin, plugin); |
Jens Arnold | 7ea4d59 | 2006-02-16 22:36:04 +0000 | [diff] [blame] | 891 | |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 892 | current_plugin_handle = lc_open(plugin, pluginbuf, PLUGIN_BUFFER_SIZE); |
| 893 | if (current_plugin_handle == NULL) { |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 894 | splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 895 | return -1; |
Jens Arnold | a790277 | 2006-01-16 23:20:58 +0000 | [diff] [blame] | 896 | } |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 897 | |
Thomas Martitz | 0d4585b | 2010-09-09 16:17:21 +0000 | [diff] [blame] | 898 | p_hdr = lc_get_header(current_plugin_handle); |
| 899 | |
| 900 | hdr = p_hdr ? &p_hdr->lc_hdr : NULL; |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 901 | |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 902 | |
Jens Arnold | a790277 | 2006-01-16 23:20:58 +0000 | [diff] [blame] | 903 | if (hdr == NULL |
| 904 | || hdr->magic != PLUGIN_MAGIC |
Thomas Martitz | 97d2a6e | 2010-08-27 00:16:26 +0000 | [diff] [blame] | 905 | || hdr->target_id != TARGET_ID |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 906 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Thomas Martitz | 97d2a6e | 2010-08-27 00:16:26 +0000 | [diff] [blame] | 907 | || hdr->load_addr != pluginbuf |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 908 | || hdr->end_addr > pluginbuf + PLUGIN_BUFFER_SIZE |
| 909 | #endif |
| 910 | ) |
| 911 | { |
| 912 | lc_close(current_plugin_handle); |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 913 | splash(HZ*2, ID2P(LANG_PLUGIN_WRONG_MODEL)); |
Thomas Martitz | 97d2a6e | 2010-08-27 00:16:26 +0000 | [diff] [blame] | 914 | return -1; |
| 915 | } |
| 916 | if (hdr->api_version > PLUGIN_API_VERSION |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 917 | || hdr->api_version < PLUGIN_MIN_API_VERSION) |
| 918 | { |
| 919 | lc_close(current_plugin_handle); |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 920 | splash(HZ*2, ID2P(LANG_PLUGIN_WRONG_VERSION)); |
Thomas Martitz | 97d2a6e | 2010-08-27 00:16:26 +0000 | [diff] [blame] | 921 | return -1; |
| 922 | } |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 923 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
William Wilgus | e1475a3 | 2019-07-17 00:39:14 -0500 | [diff] [blame] | 924 | /* tlsf crashes observed on arm with 0x4 aligned addresses */ |
| 925 | plugin_size = ALIGN_UP(hdr->end_addr - pluginbuf, 0x8); |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 926 | #else |
| 927 | plugin_size = 0; |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 928 | #endif |
| 929 | |
Thomas Martitz | 0d4585b | 2010-09-09 16:17:21 +0000 | [diff] [blame] | 930 | *(p_hdr->api) = &rockbox_api; |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 931 | |
Jens Arnold | 7ea4d59 | 2006-02-16 22:36:04 +0000 | [diff] [blame] | 932 | lcd_clear_display(); |
Dave Chapman | 1c39855 | 2006-02-14 00:39:11 +0000 | [diff] [blame] | 933 | lcd_update(); |
Dave Chapman | 1c39855 | 2006-02-14 00:39:11 +0000 | [diff] [blame] | 934 | |
Jens Arnold | 35e05ca | 2006-02-18 00:13:44 +0000 | [diff] [blame] | 935 | #ifdef HAVE_REMOTE_LCD |
Jens Arnold | 35e05ca | 2006-02-18 00:13:44 +0000 | [diff] [blame] | 936 | lcd_remote_clear_display(); |
| 937 | lcd_remote_update(); |
| 938 | #endif |
Jonathan Gordon | 32dfc0c | 2011-08-04 13:40:24 +0000 | [diff] [blame] | 939 | push_current_activity(ACTIVITY_PLUGIN); |
Thomas Martitz | baa070c | 2011-08-30 14:01:45 +0000 | [diff] [blame] | 940 | /* some plugins assume the entry cache doesn't move and save pointers to it |
| 941 | * they should be fixed properly instead of this lock */ |
| 942 | tree_lock_cache(tree_get_context()); |
Jens Arnold | 35e05ca | 2006-02-18 00:13:44 +0000 | [diff] [blame] | 943 | |
Jonathan Gordon | b2eb44c | 2009-12-09 07:25:46 +0000 | [diff] [blame] | 944 | FOR_NB_SCREENS(i) |
| 945 | viewportmanager_theme_enable(i, false, NULL); |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 946 | |
Maurus Cuelenaere | a10ff23 | 2009-04-19 12:46:04 +0000 | [diff] [blame] | 947 | #ifdef HAVE_TOUCHSCREEN |
Maurus Cuelenaere | a10ff23 | 2009-04-19 12:46:04 +0000 | [diff] [blame] | 948 | touchscreen_set_mode(TOUCHSCREEN_BUTTON); |
| 949 | #endif |
Jonathan Gordon | e4689fd | 2007-03-21 07:26:07 +0000 | [diff] [blame] | 950 | |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 951 | /* allow voice to back off if the plugin needs lots of memory */ |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 952 | if (!global_settings.talk_menu) |
| 953 | talk_buffer_set_policy(TALK_BUFFER_LOOSE); |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 954 | |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 955 | plugin_check_open_close__enter(); |
Amaury Pouly | e5caf93 | 2010-02-11 19:15:37 +0000 | [diff] [blame] | 956 | |
Björn Stenberg | 0942e2a | 2011-10-15 19:35:02 +0000 | [diff] [blame] | 957 | int rc = p_hdr->entry_point(parameter); |
Solomon Peachy | 55eb1c5 | 2019-02-03 20:12:50 -0500 | [diff] [blame] | 958 | |
Thomas Martitz | baa070c | 2011-08-30 14:01:45 +0000 | [diff] [blame] | 959 | tree_unlock_cache(tree_get_context()); |
Jonathan Gordon | 32dfc0c | 2011-08-04 13:40:24 +0000 | [diff] [blame] | 960 | pop_current_activity(); |
Amaury Pouly | e5caf93 | 2010-02-11 19:15:37 +0000 | [diff] [blame] | 961 | |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 962 | if (!pfn_tsr_exit) |
| 963 | { /* close handle if plugin is no tsr one */ |
| 964 | lc_close(current_plugin_handle); |
| 965 | current_plugin_handle = NULL; |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 966 | if (plugin_buffer_handle > 0) |
| 967 | plugin_buffer_handle = core_free(plugin_buffer_handle); |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 968 | } |
| 969 | |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 970 | talk_buffer_set_policy(TALK_BUFFER_DEFAULT); |
| 971 | |
Karl Kurbjun | c2480c3 | 2009-08-04 05:22:10 +0000 | [diff] [blame] | 972 | /* Go back to the global setting in case the plugin changed it */ |
Maurus Cuelenaere | a10ff23 | 2009-04-19 12:46:04 +0000 | [diff] [blame] | 973 | #ifdef HAVE_TOUCHSCREEN |
Karl Kurbjun | c2480c3 | 2009-08-04 05:22:10 +0000 | [diff] [blame] | 974 | touchscreen_set_mode(global_settings.touch_mode); |
Maurus Cuelenaere | a10ff23 | 2009-04-19 12:46:04 +0000 | [diff] [blame] | 975 | #endif |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 976 | |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 977 | #ifdef HAVE_LCD_BITMAP |
Jonathan Gordon | aa0f4a4 | 2011-09-24 13:19:34 +0000 | [diff] [blame] | 978 | screen_helper_setfont(FONT_UI); |
Jens Arnold | 34a610b | 2005-07-14 18:12:27 +0000 | [diff] [blame] | 979 | #if LCD_DEPTH > 1 |
Jens Arnold | 0297873 | 2006-11-13 00:45:21 +0000 | [diff] [blame] | 980 | #ifdef HAVE_LCD_COLOR |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 981 | lcd_set_drawinfo(DRMODE_SOLID, global_settings.fg_color, |
Dave Chapman | 603f87f | 2006-02-26 02:48:05 +0000 | [diff] [blame] | 982 | global_settings.bg_color); |
| 983 | #else |
Jens Arnold | 5b2cba1 | 2005-11-16 21:09:23 +0000 | [diff] [blame] | 984 | lcd_set_drawinfo(DRMODE_SOLID, LCD_DEFAULT_FG, LCD_DEFAULT_BG); |
Dave Chapman | 603f87f | 2006-02-26 02:48:05 +0000 | [diff] [blame] | 985 | #endif |
Jens Arnold | b0e056b | 2005-07-19 10:33:41 +0000 | [diff] [blame] | 986 | #else /* LCD_DEPTH == 1 */ |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 987 | lcd_set_drawmode(DRMODE_SOLID); |
Jens Arnold | b0e056b | 2005-07-19 10:33:41 +0000 | [diff] [blame] | 988 | #endif /* LCD_DEPTH */ |
Jens Arnold | f9b90e9 | 2007-04-06 22:55:00 +0000 | [diff] [blame] | 989 | #endif /* HAVE_LCD_BITMAP */ |
| 990 | |
Jens Arnold | 35e05ca | 2006-02-18 00:13:44 +0000 | [diff] [blame] | 991 | |
| 992 | #ifdef HAVE_REMOTE_LCD |
Jens Arnold | d8dda93 | 2006-10-09 07:00:50 +0000 | [diff] [blame] | 993 | #if LCD_REMOTE_DEPTH > 1 |
Michael Sevakis | 6aa12c1 | 2006-10-14 01:32:58 +0000 | [diff] [blame] | 994 | lcd_remote_set_drawinfo(DRMODE_SOLID, LCD_REMOTE_DEFAULT_FG, |
Jens Arnold | d8dda93 | 2006-10-09 07:00:50 +0000 | [diff] [blame] | 995 | LCD_REMOTE_DEFAULT_BG); |
| 996 | #else |
Jens Arnold | 35e05ca | 2006-02-18 00:13:44 +0000 | [diff] [blame] | 997 | lcd_remote_set_drawmode(DRMODE_SOLID); |
Jens Arnold | d8dda93 | 2006-10-09 07:00:50 +0000 | [diff] [blame] | 998 | #endif |
Jens Arnold | 35e05ca | 2006-02-18 00:13:44 +0000 | [diff] [blame] | 999 | #endif |
Thomas Martitz | df6f955 | 2009-07-05 22:12:42 +0000 | [diff] [blame] | 1000 | |
Teruaki Kawashima | 19b1fe4 | 2009-12-10 13:53:38 +0000 | [diff] [blame] | 1001 | lcd_clear_display(); |
Nils Wallménius | 296ac7f | 2010-07-24 10:53:58 +0000 | [diff] [blame] | 1002 | #ifdef HAVE_REMOTE_LCD |
Teruaki Kawashima | 19b1fe4 | 2009-12-10 13:53:38 +0000 | [diff] [blame] | 1003 | lcd_remote_clear_display(); |
| 1004 | #endif |
| 1005 | |
Jonathan Gordon | b2eb44c | 2009-12-09 07:25:46 +0000 | [diff] [blame] | 1006 | FOR_NB_SCREENS(i) |
Jonathan Gordon | 08d285b | 2011-09-14 12:47:26 +0000 | [diff] [blame] | 1007 | viewportmanager_theme_undo(i, true); |
Thomas Martitz | df6f955 | 2009-07-05 22:12:42 +0000 | [diff] [blame] | 1008 | |
Michael Sevakis | 7d1a47c | 2013-08-05 22:02:45 -0400 | [diff] [blame] | 1009 | plugin_check_open_close__exit(); |
Amaury Pouly | e5caf93 | 2010-02-11 19:15:37 +0000 | [diff] [blame] | 1010 | |
Solomon Peachy | 2d70fdc | 2019-08-05 22:05:32 -0400 | [diff] [blame] | 1011 | status_save(); |
| 1012 | |
Thomas Martitz | df6f955 | 2009-07-05 22:12:42 +0000 | [diff] [blame] | 1013 | if (rc == PLUGIN_ERROR) |
| 1014 | splash(HZ*2, str(LANG_PLUGIN_ERROR)); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 1015 | |
Thomas Martitz | df6f955 | 2009-07-05 22:12:42 +0000 | [diff] [blame] | 1016 | return rc; |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 1017 | } |
| 1018 | |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 1019 | /* Returns a pointer to the portion of the plugin buffer that is not already |
| 1020 | being used. If no plugin is loaded, returns the entire plugin buffer */ |
Michael Sevakis | 26d242a | 2007-04-21 18:38:25 +0000 | [diff] [blame] | 1021 | void* plugin_get_buffer(size_t *buffer_size) |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 1022 | { |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 1023 | int buffer_pos; |
| 1024 | |
Thomas Martitz | 194174a | 2010-08-27 00:29:50 +0000 | [diff] [blame] | 1025 | if (current_plugin_handle) |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 1026 | { |
| 1027 | if (plugin_size >= PLUGIN_BUFFER_SIZE) |
| 1028 | return NULL; |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 1029 | |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 1030 | *buffer_size = PLUGIN_BUFFER_SIZE-plugin_size; |
| 1031 | buffer_pos = plugin_size; |
| 1032 | } |
| 1033 | else |
| 1034 | { |
| 1035 | *buffer_size = PLUGIN_BUFFER_SIZE; |
| 1036 | buffer_pos = 0; |
| 1037 | } |
| 1038 | |
| 1039 | return &pluginbuf[buffer_pos]; |
| 1040 | } |
| 1041 | |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 1042 | /* Returns a pointer to the mp3 buffer. |
Michael Sevakis | 0f5cb94 | 2006-11-06 18:07:30 +0000 | [diff] [blame] | 1043 | Playback gets stopped, to avoid conflicts. |
| 1044 | Talk buffer is stolen as well. |
| 1045 | */ |
Thomas Martitz | 9576134 | 2014-04-09 09:00:36 +0200 | [diff] [blame] | 1046 | static void* plugin_get_audio_buffer(size_t *buffer_size) |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 1047 | { |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 1048 | /* dummy ops with no callbacks, needed because by |
| 1049 | * default buflib buffers can be moved around which must be avoided */ |
| 1050 | static struct buflib_callbacks dummy_ops; |
Michael Sevakis | 81f5a22 | 2017-10-14 05:59:09 -0400 | [diff] [blame] | 1051 | if (plugin_buffer_handle <= 0) |
| 1052 | { |
| 1053 | plugin_buffer_handle = core_alloc_maximum("plugin audio buf", |
| 1054 | &plugin_buffer_size, |
| 1055 | &dummy_ops); |
| 1056 | } |
| 1057 | |
| 1058 | if (buffer_size) |
| 1059 | *buffer_size = plugin_buffer_size; |
| 1060 | |
Thomas Martitz | 22e802e | 2013-05-30 11:24:16 +0200 | [diff] [blame] | 1061 | return core_get_data(plugin_buffer_handle); |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 1062 | } |
| 1063 | |
Thomas Martitz | 9576134 | 2014-04-09 09:00:36 +0200 | [diff] [blame] | 1064 | static void plugin_release_audio_buffer(void) |
| 1065 | { |
| 1066 | if (plugin_buffer_handle > 0) |
Michael Sevakis | 81f5a22 | 2017-10-14 05:59:09 -0400 | [diff] [blame] | 1067 | { |
Thomas Martitz | 9576134 | 2014-04-09 09:00:36 +0200 | [diff] [blame] | 1068 | plugin_buffer_handle = core_free(plugin_buffer_handle); |
Michael Sevakis | 81f5a22 | 2017-10-14 05:59:09 -0400 | [diff] [blame] | 1069 | plugin_buffer_size = 0; |
| 1070 | } |
Thomas Martitz | 9576134 | 2014-04-09 09:00:36 +0200 | [diff] [blame] | 1071 | } |
| 1072 | |
Jörg Hohensohn | 6800276 | 2004-04-30 20:37:11 +0000 | [diff] [blame] | 1073 | /* The plugin wants to stay resident after leaving its main function, e.g. |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 1074 | runs from timer or own thread. The callback is registered to later |
Jörg Hohensohn | 6800276 | 2004-04-30 20:37:11 +0000 | [diff] [blame] | 1075 | instruct it to free its resources before a new plugin gets loaded. */ |
Thomas Martitz | 9576134 | 2014-04-09 09:00:36 +0200 | [diff] [blame] | 1076 | static void plugin_tsr(bool (*exit_callback)(bool)) |
Jörg Hohensohn | 6800276 | 2004-04-30 20:37:11 +0000 | [diff] [blame] | 1077 | { |
| 1078 | pfn_tsr_exit = exit_callback; /* remember the callback for later */ |
| 1079 | } |
Jonathan Gordon | fda7d72 | 2007-08-06 13:42:52 +0000 | [diff] [blame] | 1080 | |
| 1081 | char *plugin_get_current_filename(void) |
| 1082 | { |
| 1083 | return current_plugin; |
| 1084 | } |