2003-06-29 16:33:04 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-05-05 10:32:46 +00:00
|
|
|
* Copyright (C) 2002 Björn Stenberg
|
2003-06-29 16:33:04 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2003-06-29 16:33:04 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2006-11-11 05:11:05 +00:00
|
|
|
#include "plugin.h"
|
|
|
|
#include <ctype.h>
|
2003-06-29 16:33:04 +00:00
|
|
|
#include <string.h>
|
2008-04-28 16:18:04 +00:00
|
|
|
#include <stdlib.h>
|
2004-06-10 13:29:52 +00:00
|
|
|
#include "debug.h"
|
2006-11-11 05:47:42 +00:00
|
|
|
#include "i2c.h"
|
2003-06-29 16:33:04 +00:00
|
|
|
#include "lang.h"
|
2007-07-29 03:43:37 +00:00
|
|
|
#include "led.h"
|
2003-07-09 22:36:23 +00:00
|
|
|
#include "keyboard.h"
|
2004-01-30 22:30:40 +00:00
|
|
|
#include "buffer.h"
|
|
|
|
#include "backlight.h"
|
2006-03-26 22:33:25 +00:00
|
|
|
#include "sound_menu.h"
|
2004-06-10 13:29:52 +00:00
|
|
|
#include "mp3data.h"
|
2004-06-15 22:54:37 +00:00
|
|
|
#include "powermgmt.h"
|
2005-11-16 15:12:15 +00:00
|
|
|
#include "splash.h"
|
2006-11-11 08:00:28 +00:00
|
|
|
#include "logf.h"
|
2007-07-11 05:41:23 +00:00
|
|
|
#include "option_select.h"
|
2007-10-03 16:17:36 +00:00
|
|
|
#include "talk.h"
|
2008-09-22 19:59:00 +00:00
|
|
|
#include "version.h"
|
2008-11-01 16:14:28 +00:00
|
|
|
#include "storage.h"
|
2009-10-29 16:52:12 +00:00
|
|
|
#include "pcmbuf.h"
|
2009-12-24 17:07:20 +00:00
|
|
|
#include "errno.h"
|
2010-04-07 17:22:16 +00:00
|
|
|
#include "diacritic.h"
|
2003-07-09 22:36:23 +00:00
|
|
|
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2006-02-07 14:46:03 +00:00
|
|
|
#include "power.h"
|
|
|
|
#endif
|
|
|
|
|
2003-07-09 22:36:23 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-11-19 14:11:42 +00:00
|
|
|
#include "scrollbar.h"
|
2007-04-10 14:18:30 +00:00
|
|
|
#include "peakmeter.h"
|
2005-04-25 07:42:10 +00:00
|
|
|
#include "bmp.h"
|
2006-07-19 19:47:34 +00:00
|
|
|
#include "bidi.h"
|
2003-07-09 22:36:23 +00:00
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
2009-09-30 10:06:04 +00:00
|
|
|
#ifdef USB_ENABLE_HID
|
2009-07-18 12:58:29 +00:00
|
|
|
#include "usbstack/usb_hid.h"
|
|
|
|
#endif
|
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2009-01-07 09:53:46 +00:00
|
|
|
#define PREFIX(_x_) sim_ ## _x_
|
|
|
|
#else
|
|
|
|
#define PREFIX
|
|
|
|
#endif
|
|
|
|
|
2010-02-11 19:15:37 +00:00
|
|
|
#if defined(HAVE_PLUGIN_CHECK_OPEN_CLOSE) && (MAX_OPEN_FILES>32)
|
|
|
|
#warning "MAX_OPEN_FILES>32, disabling plugin file open/close checking"
|
|
|
|
#undef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
|
|
|
static unsigned int open_files;
|
|
|
|
#endif
|
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2003-07-25 23:04:59 +00:00
|
|
|
static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
|
2006-03-02 01:08:38 +00:00
|
|
|
void *sim_plugin_load(char *plugin, void **pd);
|
|
|
|
void sim_plugin_close(void *pd);
|
2009-02-09 00:32:59 +00:00
|
|
|
void sim_lcd_ex_init(unsigned long (*getpixel)(int, int));
|
2006-02-26 13:37:42 +00:00
|
|
|
void sim_lcd_ex_update_rect(int x, int y, int width, int height);
|
2003-07-25 23:04:59 +00:00
|
|
|
#else
|
2005-02-22 12:19:12 +00:00
|
|
|
#define sim_plugin_close(x)
|
2003-07-25 23:04:59 +00:00
|
|
|
extern unsigned char pluginbuf[];
|
2004-09-26 09:25:59 +00:00
|
|
|
#include "bitswap.h"
|
2003-07-25 23:04:59 +00:00
|
|
|
#endif
|
|
|
|
|
2005-06-22 02:47:54 +00:00
|
|
|
/* for actual plugins only, not for codecs */
|
2003-07-25 23:04:59 +00:00
|
|
|
static bool plugin_loaded = false;
|
|
|
|
static int plugin_size = 0;
|
2006-10-31 11:30:37 +00:00
|
|
|
static bool (*pfn_tsr_exit)(bool reenter) = NULL; /* TSR exit callback */
|
2006-10-31 11:17:00 +00:00
|
|
|
static char current_plugin[MAX_PATH];
|
2003-07-25 23:04:59 +00:00
|
|
|
|
2007-08-06 13:42:52 +00:00
|
|
|
char *plugin_get_current_filename(void);
|
|
|
|
|
2010-02-11 19:15:37 +00:00
|
|
|
/* Some wrappers used to monitor open and close and detect leaks*/
|
2010-05-06 17:35:13 +00:00
|
|
|
static int open_wrapper(const char* pathname, int flags, ...);
|
|
|
|
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
2010-02-11 19:15:37 +00:00
|
|
|
static int close_wrapper(int fd);
|
2010-05-06 17:35:04 +00:00
|
|
|
static int creat_wrapper(const char *pathname, mode_t mode);
|
2010-02-11 19:15:37 +00:00
|
|
|
#endif
|
|
|
|
|
2004-07-20 21:37:36 +00:00
|
|
|
static const struct plugin_api rockbox_api = {
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
/* lcd */
|
2009-03-30 16:06:02 +00:00
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
2005-06-24 22:33:21 +00:00
|
|
|
lcd_set_contrast,
|
2009-03-30 16:06:02 +00:00
|
|
|
#endif
|
2007-03-31 09:58:49 +00:00
|
|
|
lcd_update,
|
2003-06-29 16:33:04 +00:00
|
|
|
lcd_clear_display,
|
2007-03-26 07:52:13 +00:00
|
|
|
lcd_getstringsize,
|
|
|
|
lcd_putsxy,
|
2003-06-29 16:33:04 +00:00
|
|
|
lcd_puts,
|
|
|
|
lcd_puts_scroll,
|
|
|
|
lcd_stop_scroll,
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
lcd_define_pattern,
|
2003-07-24 09:35:32 +00:00
|
|
|
lcd_get_locked_pattern,
|
|
|
|
lcd_unlock_pattern,
|
|
|
|
lcd_putc,
|
2004-07-27 14:10:48 +00:00
|
|
|
lcd_put_cursor,
|
|
|
|
lcd_remove_cursor,
|
2007-04-03 18:06:13 +00:00
|
|
|
lcd_icon,
|
2005-09-02 05:39:09 +00:00
|
|
|
lcd_double_height,
|
2003-06-29 16:33:04 +00:00
|
|
|
#else
|
2008-03-24 00:35:53 +00:00
|
|
|
&lcd_framebuffer[0][0],
|
2008-03-24 00:45:03 +00:00
|
|
|
lcd_update_rect,
|
2005-06-24 22:33:21 +00:00
|
|
|
lcd_set_drawmode,
|
|
|
|
lcd_get_drawmode,
|
|
|
|
lcd_setfont,
|
|
|
|
lcd_drawpixel,
|
|
|
|
lcd_drawline,
|
2005-06-28 23:15:47 +00:00
|
|
|
lcd_hline,
|
|
|
|
lcd_vline,
|
2005-06-24 22:33:21 +00:00
|
|
|
lcd_drawrect,
|
|
|
|
lcd_fillrect,
|
2005-07-06 22:58:02 +00:00
|
|
|
lcd_mono_bitmap_part,
|
|
|
|
lcd_mono_bitmap,
|
2005-07-26 20:01:11 +00:00
|
|
|
#if LCD_DEPTH > 1
|
|
|
|
lcd_set_foreground,
|
|
|
|
lcd_get_foreground,
|
|
|
|
lcd_set_background,
|
|
|
|
lcd_get_background,
|
|
|
|
lcd_bitmap_part,
|
|
|
|
lcd_bitmap,
|
2007-06-22 09:34:57 +00:00
|
|
|
lcd_get_backdrop,
|
2006-11-19 14:11:42 +00:00
|
|
|
lcd_set_backdrop,
|
2006-02-07 20:38:55 +00:00
|
|
|
#endif
|
|
|
|
#if LCD_DEPTH == 16
|
|
|
|
lcd_bitmap_transparent_part,
|
|
|
|
lcd_bitmap_transparent,
|
2009-06-21 14:09:48 +00:00
|
|
|
#if MEMORYSIZE > 2
|
2008-03-24 00:35:53 +00:00
|
|
|
lcd_blit_yuv,
|
|
|
|
#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \
|
2009-07-15 22:02:42 +00:00
|
|
|
|| defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) \
|
2010-03-28 02:41:29 +00:00
|
|
|
|| defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) \
|
|
|
|
|| defined(TOSHIBA_GIGABEAT_S)
|
2008-03-24 00:35:53 +00:00
|
|
|
lcd_yuv_set_options,
|
2005-07-26 20:01:11 +00:00
|
|
|
#endif
|
2009-06-21 14:09:48 +00:00
|
|
|
#endif /* MEMORYSIZE > 2 */
|
2010-06-21 16:53:00 +00:00
|
|
|
#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2008-03-24 00:35:53 +00:00
|
|
|
lcd_blit_mono,
|
|
|
|
lcd_blit_grey_phase,
|
|
|
|
#endif /* LCD_DEPTH */
|
2009-05-06 04:53:56 +00:00
|
|
|
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
|
|
|
|
lcd_blit_pal256,
|
|
|
|
lcd_pal256_update_pal,
|
|
|
|
#endif
|
2008-03-24 00:35:53 +00:00
|
|
|
lcd_puts_style,
|
|
|
|
lcd_puts_scroll_style,
|
2008-05-15 06:58:36 +00:00
|
|
|
#ifdef HAVE_LCD_INVERT
|
|
|
|
lcd_set_invert_display,
|
|
|
|
#endif /* HAVE_LCD_INVERT */
|
2009-05-06 04:53:56 +00:00
|
|
|
#if defined(HAVE_LCD_MODES)
|
|
|
|
lcd_set_mode,
|
|
|
|
#endif
|
2009-03-17 02:43:47 +00:00
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
2008-06-23 13:20:35 +00:00
|
|
|
&button_queue,
|
|
|
|
#endif
|
2006-09-16 16:18:11 +00:00
|
|
|
bidi_l2v,
|
2010-05-24 16:42:32 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
is_diacritic,
|
|
|
|
#endif
|
2006-09-16 16:18:11 +00:00
|
|
|
font_get_bits,
|
|
|
|
font_load,
|
2005-06-24 22:33:21 +00:00
|
|
|
font_get,
|
2005-07-26 20:01:11 +00:00
|
|
|
font_getstringsize,
|
2006-01-15 18:20:18 +00:00
|
|
|
font_get_width,
|
2007-08-06 13:42:52 +00:00
|
|
|
screen_clear_area,
|
2008-03-24 00:35:53 +00:00
|
|
|
gui_scrollbar_draw,
|
2008-12-10 08:57:10 +00:00
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
|
|
|
get_codepage_name,
|
2008-03-24 00:35:53 +00:00
|
|
|
|
2004-07-27 14:10:48 +00:00
|
|
|
backlight_on,
|
|
|
|
backlight_off,
|
2004-10-23 09:59:53 +00:00
|
|
|
backlight_set_timeout,
|
2008-05-15 06:58:36 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
backlight_set_brightness,
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
2008-04-23 21:15:07 +00:00
|
|
|
|
2007-08-13 22:31:11 +00:00
|
|
|
#if CONFIG_CHARGING
|
|
|
|
backlight_set_timeout_plugged,
|
|
|
|
#endif
|
2008-04-04 19:38:46 +00:00
|
|
|
is_backlight_on,
|
2008-08-15 08:27:39 +00:00
|
|
|
splash,
|
|
|
|
splashf,
|
2008-03-24 00:35:53 +00:00
|
|
|
|
2005-04-15 12:55:31 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2005-06-18 01:25:47 +00:00
|
|
|
/* remote lcd */
|
2005-06-29 01:39:50 +00:00
|
|
|
lcd_remote_set_contrast,
|
2005-04-25 07:42:10 +00:00
|
|
|
lcd_remote_clear_display,
|
2005-04-25 23:47:51 +00:00
|
|
|
lcd_remote_puts,
|
|
|
|
lcd_remote_puts_scroll,
|
|
|
|
lcd_remote_stop_scroll,
|
2005-06-29 01:39:50 +00:00
|
|
|
lcd_remote_set_drawmode,
|
|
|
|
lcd_remote_get_drawmode,
|
|
|
|
lcd_remote_setfont,
|
|
|
|
lcd_remote_getstringsize,
|
|
|
|
lcd_remote_drawpixel,
|
|
|
|
lcd_remote_drawline,
|
|
|
|
lcd_remote_hline,
|
|
|
|
lcd_remote_vline,
|
|
|
|
lcd_remote_drawrect,
|
|
|
|
lcd_remote_fillrect,
|
2005-07-07 00:05:29 +00:00
|
|
|
lcd_remote_mono_bitmap_part,
|
|
|
|
lcd_remote_mono_bitmap,
|
2005-04-25 23:47:51 +00:00
|
|
|
lcd_remote_putsxy,
|
|
|
|
lcd_remote_puts_style,
|
|
|
|
lcd_remote_puts_scroll_style,
|
2005-06-29 01:39:50 +00:00
|
|
|
&lcd_remote_framebuffer[0][0],
|
2005-04-25 23:47:51 +00:00
|
|
|
lcd_remote_update,
|
|
|
|
lcd_remote_update_rect,
|
2005-06-18 01:25:47 +00:00
|
|
|
|
2005-11-21 23:55:39 +00:00
|
|
|
remote_backlight_on,
|
|
|
|
remote_backlight_off,
|
2008-03-24 00:35:53 +00:00
|
|
|
remote_backlight_set_timeout,
|
|
|
|
#if CONFIG_CHARGING
|
|
|
|
remote_backlight_set_timeout_plugged,
|
2005-04-15 12:55:31 +00:00
|
|
|
#endif
|
2008-03-24 00:35:53 +00:00
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2006-09-16 16:18:11 +00:00
|
|
|
#if NB_SCREENS == 2
|
|
|
|
{&screens[SCREEN_MAIN], &screens[SCREEN_REMOTE]},
|
|
|
|
#else
|
|
|
|
{&screens[SCREEN_MAIN]},
|
|
|
|
#endif
|
|
|
|
#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
|
|
|
|
lcd_remote_set_foreground,
|
|
|
|
lcd_remote_get_foreground,
|
|
|
|
lcd_remote_set_background,
|
|
|
|
lcd_remote_get_background,
|
|
|
|
lcd_remote_bitmap_part,
|
|
|
|
lcd_remote_bitmap,
|
|
|
|
#endif
|
2008-03-26 03:35:24 +00:00
|
|
|
viewport_set_defaults,
|
2010-02-14 06:26:16 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
viewportmanager_theme_enable,
|
|
|
|
viewportmanager_theme_undo,
|
|
|
|
#endif
|
2008-03-26 03:35:24 +00:00
|
|
|
|
2006-09-16 16:18:11 +00:00
|
|
|
/* list */
|
|
|
|
gui_synclist_init,
|
|
|
|
gui_synclist_set_nb_items,
|
|
|
|
gui_synclist_set_icon_callback,
|
|
|
|
gui_synclist_get_nb_items,
|
|
|
|
gui_synclist_get_sel_pos,
|
|
|
|
gui_synclist_draw,
|
|
|
|
gui_synclist_select_item,
|
|
|
|
gui_synclist_add_item,
|
|
|
|
gui_synclist_del_item,
|
|
|
|
gui_synclist_limit_scroll,
|
|
|
|
gui_synclist_do_button,
|
2006-11-30 22:29:48 +00:00
|
|
|
gui_synclist_set_title,
|
2008-08-14 22:35:00 +00:00
|
|
|
gui_syncyesno_run,
|
2008-06-23 13:20:35 +00:00
|
|
|
simplelist_info_init,
|
|
|
|
simplelist_show_list,
|
2006-10-14 01:32:58 +00:00
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
/* button */
|
|
|
|
button_get,
|
|
|
|
button_get_w_tmo,
|
2004-07-27 14:10:48 +00:00
|
|
|
button_status,
|
2008-05-15 06:58:36 +00:00
|
|
|
#ifdef HAVE_BUTTON_DATA
|
|
|
|
button_get_data,
|
2009-10-20 21:54:59 +00:00
|
|
|
button_status_wdata,
|
2008-05-15 06:58:36 +00:00
|
|
|
#endif
|
2004-07-27 14:10:48 +00:00
|
|
|
button_clear_queue,
|
2007-10-16 01:25:17 +00:00
|
|
|
button_queue_count,
|
2006-05-01 05:45:18 +00:00
|
|
|
#ifdef HAS_BUTTON_HOLD
|
2005-06-18 01:25:47 +00:00
|
|
|
button_hold,
|
|
|
|
#endif
|
2008-08-23 09:46:38 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
touchscreen_set_mode,
|
2008-05-15 06:58:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
|
|
|
buttonlight_set_timeout,
|
|
|
|
buttonlight_off,
|
|
|
|
buttonlight_on,
|
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
buttonlight_set_brightness,
|
|
|
|
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
/* file */
|
2010-02-14 06:26:16 +00:00
|
|
|
open_utf8,
|
2010-02-11 19:15:37 +00:00
|
|
|
(open_func)open_wrapper,
|
2010-05-06 17:35:13 +00:00
|
|
|
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
2010-02-11 19:15:37 +00:00
|
|
|
close_wrapper,
|
|
|
|
#else
|
2007-10-09 15:15:00 +00:00
|
|
|
PREFIX(close),
|
2010-05-06 17:35:13 +00:00
|
|
|
#endif
|
2007-09-08 12:20:53 +00:00
|
|
|
(read_func)PREFIX(read),
|
2005-02-28 18:32:57 +00:00
|
|
|
PREFIX(lseek),
|
2010-02-11 19:15:37 +00:00
|
|
|
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
|
|
|
(creat_func)creat_wrapper,
|
|
|
|
#else
|
2003-12-09 06:48:55 +00:00
|
|
|
(creat_func)PREFIX(creat),
|
2010-02-11 19:15:37 +00:00
|
|
|
#endif
|
2007-09-08 12:20:53 +00:00
|
|
|
(write_func)PREFIX(write),
|
2004-07-23 14:51:49 +00:00
|
|
|
PREFIX(remove),
|
|
|
|
PREFIX(rename),
|
2005-02-22 12:19:12 +00:00
|
|
|
PREFIX(ftruncate),
|
2003-06-29 16:33:04 +00:00
|
|
|
PREFIX(filesize),
|
2005-02-22 12:19:12 +00:00
|
|
|
fdprintf,
|
2003-06-29 16:33:04 +00:00
|
|
|
read_line,
|
2004-07-27 14:10:48 +00:00
|
|
|
settings_parseline,
|
2008-11-01 16:14:28 +00:00
|
|
|
storage_sleep,
|
|
|
|
storage_spin,
|
|
|
|
storage_spindown,
|
|
|
|
#if USING_STORAGE_CALLBACK
|
|
|
|
register_storage_idle_func,
|
|
|
|
unregister_storage_idle_func,
|
|
|
|
#endif /* USING_STORAGE_CALLBACK */
|
2006-09-16 16:18:11 +00:00
|
|
|
reload_directory,
|
2007-06-22 09:34:57 +00:00
|
|
|
create_numbered_filename,
|
2008-03-24 00:35:53 +00:00
|
|
|
file_exists,
|
2009-02-11 16:37:12 +00:00
|
|
|
strip_extension,
|
2010-02-14 06:26:16 +00:00
|
|
|
crc_32,
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
/* dir */
|
2007-07-20 17:06:55 +00:00
|
|
|
opendir,
|
|
|
|
closedir,
|
|
|
|
readdir,
|
|
|
|
mkdir,
|
|
|
|
rmdir,
|
2008-03-24 00:35:53 +00:00
|
|
|
dir_exists,
|
2003-06-29 16:33:04 +00:00
|
|
|
|
2004-10-23 09:59:53 +00:00
|
|
|
/* kernel/ system */
|
2009-02-11 16:37:12 +00:00
|
|
|
#ifdef CPU_ARM
|
|
|
|
__div0,
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
PREFIX(sleep),
|
2004-07-27 14:10:48 +00:00
|
|
|
yield,
|
2003-06-29 16:33:04 +00:00
|
|
|
¤t_tick,
|
2004-07-27 14:10:48 +00:00
|
|
|
default_event_handler,
|
2004-10-23 09:59:53 +00:00
|
|
|
default_event_handler_ex,
|
2004-07-27 14:10:48 +00:00
|
|
|
create_thread,
|
2008-03-25 02:34:12 +00:00
|
|
|
thread_exit,
|
2008-03-24 00:35:53 +00:00
|
|
|
thread_wait,
|
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
2009-01-05 10:31:19 +00:00
|
|
|
thread_thaw,
|
|
|
|
#ifdef HAVE_PRIORITY_SCHEDULING
|
|
|
|
thread_set_priority,
|
|
|
|
#endif
|
2008-03-24 00:35:53 +00:00
|
|
|
mutex_init,
|
|
|
|
mutex_lock,
|
|
|
|
mutex_unlock,
|
|
|
|
#endif
|
|
|
|
|
2004-07-27 19:16:58 +00:00
|
|
|
reset_poweroff_timer,
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2004-10-23 09:59:53 +00:00
|
|
|
system_memory_guard,
|
2005-06-18 01:25:47 +00:00
|
|
|
&cpu_frequency,
|
2007-01-22 10:41:25 +00:00
|
|
|
|
2005-06-18 01:25:47 +00:00
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
2007-01-22 10:41:25 +00:00
|
|
|
#ifdef CPU_BOOST_LOGGING
|
|
|
|
cpu_boost_,
|
|
|
|
#else
|
2005-06-18 01:25:47 +00:00
|
|
|
cpu_boost,
|
2007-01-22 10:41:25 +00:00
|
|
|
#endif
|
2008-03-24 00:35:53 +00:00
|
|
|
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
|
2010-06-21 16:53:00 +00:00
|
|
|
#endif /* PLATFORM_NATIVE */
|
2008-03-24 00:35:53 +00:00
|
|
|
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
|
|
|
trigger_cpu_boost,
|
|
|
|
cancel_cpu_boost,
|
2007-07-29 03:43:37 +00:00
|
|
|
#endif
|
2009-02-11 12:55:51 +00:00
|
|
|
#if NUM_CORES > 1
|
|
|
|
cpucache_flush,
|
|
|
|
cpucache_invalidate,
|
2005-06-18 01:25:47 +00:00
|
|
|
#endif
|
2005-07-26 20:01:11 +00:00
|
|
|
timer_register,
|
|
|
|
timer_unregister,
|
|
|
|
timer_set_period,
|
2007-07-29 03:43:37 +00:00
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
queue_init,
|
|
|
|
queue_delete,
|
|
|
|
queue_post,
|
|
|
|
queue_wait_w_tmo,
|
2008-03-24 00:35:53 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
queue_enable_queue_send,
|
|
|
|
queue_empty,
|
|
|
|
queue_wait,
|
|
|
|
queue_send,
|
|
|
|
queue_reply,
|
|
|
|
#endif
|
2006-02-07 20:38:55 +00:00
|
|
|
usb_acknowledge,
|
2009-09-30 10:06:04 +00:00
|
|
|
#ifdef USB_ENABLE_HID
|
2009-08-03 15:09:41 +00:00
|
|
|
usb_hid_send,
|
|
|
|
#endif
|
2006-02-07 20:38:55 +00:00
|
|
|
#ifdef RB_PROFILE
|
|
|
|
profile_thread,
|
|
|
|
profstop,
|
2008-07-28 22:43:41 +00:00
|
|
|
__cyg_profile_func_enter,
|
|
|
|
__cyg_profile_func_exit,
|
2006-02-07 20:38:55 +00:00
|
|
|
#endif
|
2009-10-20 21:54:59 +00:00
|
|
|
add_event,
|
|
|
|
remove_event,
|
|
|
|
send_event,
|
2003-06-29 16:33:04 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2006-03-11 09:28:49 +00:00
|
|
|
/* special simulator hooks */
|
|
|
|
#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
|
|
|
|
sim_lcd_ex_init,
|
|
|
|
sim_lcd_ex_update_rect,
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
/* strings and memory */
|
|
|
|
snprintf,
|
2006-09-16 16:18:11 +00:00
|
|
|
vsnprintf,
|
2003-06-29 16:33:04 +00:00
|
|
|
strcpy,
|
2009-07-14 13:57:45 +00:00
|
|
|
strlcpy,
|
2003-06-29 16:33:04 +00:00
|
|
|
strlen,
|
2004-07-13 14:14:30 +00:00
|
|
|
strrchr,
|
2004-07-27 14:10:48 +00:00
|
|
|
strcmp,
|
2005-07-26 20:01:11 +00:00
|
|
|
strncmp,
|
2004-07-27 14:10:48 +00:00
|
|
|
strcasecmp,
|
2004-10-23 09:59:53 +00:00
|
|
|
strncasecmp,
|
2003-06-29 16:33:04 +00:00
|
|
|
memset,
|
|
|
|
memcpy,
|
2006-02-07 20:38:55 +00:00
|
|
|
memmove,
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2004-07-13 14:01:41 +00:00
|
|
|
_ctype_,
|
2010-05-14 12:37:05 +00:00
|
|
|
#endif
|
2004-07-27 19:16:58 +00:00
|
|
|
atoi,
|
2005-02-22 12:19:12 +00:00
|
|
|
strchr,
|
|
|
|
strcat,
|
2010-02-14 06:26:16 +00:00
|
|
|
strlcat,
|
2006-09-16 16:18:11 +00:00
|
|
|
memchr,
|
2005-02-22 12:19:12 +00:00
|
|
|
memcmp,
|
2005-06-18 01:25:47 +00:00
|
|
|
strcasestr,
|
2006-10-31 11:17:00 +00:00
|
|
|
strtok_r,
|
2006-01-15 18:20:18 +00:00
|
|
|
/* unicode stuff */
|
|
|
|
utf8decode,
|
|
|
|
iso_decode,
|
|
|
|
utf16LEdecode,
|
|
|
|
utf16BEdecode,
|
|
|
|
utf8encode,
|
|
|
|
utf8length,
|
2006-09-16 16:18:11 +00:00
|
|
|
utf8seek,
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
/* sound */
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set,
|
2008-03-24 00:35:53 +00:00
|
|
|
sound_default,
|
2006-01-15 18:20:18 +00:00
|
|
|
sound_min,
|
|
|
|
sound_max,
|
2008-03-24 00:35:53 +00:00
|
|
|
sound_unit,
|
|
|
|
sound_val2phys,
|
2010-05-24 16:42:32 +00:00
|
|
|
#ifdef AUDIOHW_HAVE_EQ
|
|
|
|
sound_enum_hw_eq_band_setting,
|
|
|
|
#endif
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2004-07-27 14:10:48 +00:00
|
|
|
mp3_play_data,
|
|
|
|
mp3_play_pause,
|
|
|
|
mp3_play_stop,
|
|
|
|
mp3_is_playing,
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2004-07-27 14:10:48 +00:00
|
|
|
bitswap,
|
2005-06-06 00:34:07 +00:00
|
|
|
#endif
|
2007-01-01 13:21:19 +00:00
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2007-04-10 14:18:30 +00:00
|
|
|
&audio_master_sampr_list[0],
|
|
|
|
&hw_freq_sampr[0],
|
|
|
|
pcm_apply_settings,
|
2006-05-01 05:45:18 +00:00
|
|
|
pcm_play_data,
|
2005-06-18 01:25:47 +00:00
|
|
|
pcm_play_stop,
|
|
|
|
pcm_set_frequency,
|
|
|
|
pcm_is_playing,
|
2007-04-10 14:18:30 +00:00
|
|
|
pcm_is_paused,
|
2005-06-18 01:25:47 +00:00
|
|
|
pcm_play_pause,
|
2007-04-10 14:18:30 +00:00
|
|
|
pcm_get_bytes_waiting,
|
2006-03-11 09:38:12 +00:00
|
|
|
pcm_calculate_peaks,
|
2010-02-10 19:44:11 +00:00
|
|
|
pcm_get_peak_buffer,
|
2008-03-24 00:35:53 +00:00
|
|
|
pcm_play_lock,
|
|
|
|
pcm_play_unlock,
|
2010-02-14 06:26:16 +00:00
|
|
|
pcmbuf_beep,
|
2007-04-10 14:18:30 +00:00
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
&rec_freq_sampr[0],
|
|
|
|
pcm_init_recording,
|
|
|
|
pcm_close_recording,
|
|
|
|
pcm_record_data,
|
|
|
|
pcm_stop_recording,
|
|
|
|
pcm_calculate_rec_peaks,
|
|
|
|
audio_set_recording_gain,
|
|
|
|
#endif /* HAVE_RECORDING */
|
2007-06-08 23:42:04 +00:00
|
|
|
#if INPUT_SRC_CAPS != 0
|
|
|
|
audio_set_output_source,
|
|
|
|
audio_set_input_source,
|
2003-06-29 16:33:04 +00:00
|
|
|
#endif
|
2008-03-24 00:35:53 +00:00
|
|
|
dsp_set_crossfeed,
|
|
|
|
dsp_set_eq,
|
|
|
|
dsp_dither_enable,
|
|
|
|
dsp_configure,
|
|
|
|
dsp_process,
|
2009-08-12 18:12:25 +00:00
|
|
|
dsp_input_count,
|
|
|
|
dsp_output_count,
|
2007-06-08 23:42:04 +00:00
|
|
|
#endif /* CONFIG_CODEC == SWCODEC */
|
2005-06-18 01:25:47 +00:00
|
|
|
|
2004-07-27 14:10:48 +00:00
|
|
|
/* playback control */
|
2007-04-10 14:18:30 +00:00
|
|
|
playlist_amount,
|
|
|
|
playlist_resume,
|
|
|
|
playlist_start,
|
2009-06-01 21:08:49 +00:00
|
|
|
playlist_add,
|
|
|
|
playlist_sync,
|
|
|
|
playlist_remove_all_tracks,
|
|
|
|
playlist_create,
|
|
|
|
playlist_insert_track,
|
2009-07-05 18:07:58 +00:00
|
|
|
playlist_insert_directory,
|
2009-06-01 21:08:49 +00:00
|
|
|
playlist_shuffle,
|
2005-04-04 12:06:29 +00:00
|
|
|
PREFIX(audio_play),
|
|
|
|
audio_stop,
|
|
|
|
audio_pause,
|
|
|
|
audio_resume,
|
|
|
|
audio_next,
|
|
|
|
audio_prev,
|
|
|
|
audio_ff_rewind,
|
|
|
|
audio_next_track,
|
|
|
|
audio_status,
|
|
|
|
audio_current_track,
|
|
|
|
audio_flush_and_reload_tracks,
|
|
|
|
audio_get_file_pos,
|
2005-08-29 21:15:27 +00:00
|
|
|
#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
|
2005-04-25 08:21:10 +00:00
|
|
|
mpeg_get_last_header,
|
2005-04-25 08:59:19 +00:00
|
|
|
#endif
|
2006-03-05 19:46:33 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
|
|
|
|
(CONFIG_CODEC == SWCODEC)
|
2005-04-01 13:41:03 +00:00
|
|
|
sound_set_pitch,
|
2006-03-05 19:46:33 +00:00
|
|
|
#endif
|
2004-07-27 19:16:58 +00:00
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
|
2004-07-27 19:16:58 +00:00
|
|
|
/* MAS communication */
|
|
|
|
mas_readmem,
|
|
|
|
mas_writemem,
|
|
|
|
mas_readreg,
|
|
|
|
mas_writereg,
|
2005-08-29 21:15:27 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2004-07-27 19:16:58 +00:00
|
|
|
mas_codec_writereg,
|
|
|
|
mas_codec_readreg,
|
2006-09-16 16:18:11 +00:00
|
|
|
i2c_begin,
|
|
|
|
i2c_end,
|
|
|
|
i2c_write,
|
2004-07-27 19:16:58 +00:00
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
#endif /* !SIMULATOR && CONFIG_CODEC != SWCODEC */
|
2004-07-27 14:10:48 +00:00
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
/* menu */
|
2007-03-07 13:00:46 +00:00
|
|
|
do_menu,
|
2007-05-08 11:55:43 +00:00
|
|
|
/* statusbars */
|
|
|
|
&statusbars,
|
|
|
|
gui_syncstatusbar_draw,
|
|
|
|
/* options */
|
2008-12-10 08:57:10 +00:00
|
|
|
get_settings_list,
|
2007-07-11 05:41:23 +00:00
|
|
|
find_setting,
|
|
|
|
option_screen,
|
2006-03-21 09:36:13 +00:00
|
|
|
set_option,
|
2007-06-22 09:34:57 +00:00
|
|
|
set_bool_options,
|
2006-09-16 16:18:11 +00:00
|
|
|
set_int,
|
|
|
|
set_bool,
|
2007-06-22 09:34:57 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
set_color,
|
|
|
|
#endif
|
2006-01-15 18:20:18 +00:00
|
|
|
|
2006-09-16 16:18:11 +00:00
|
|
|
/* action handling */
|
|
|
|
get_custom_action,
|
|
|
|
get_action,
|
2009-06-01 21:08:49 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
action_get_touchscreen_press,
|
|
|
|
#endif
|
2006-09-16 16:18:11 +00:00
|
|
|
action_userabort,
|
2006-10-14 01:32:58 +00:00
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
/* power */
|
|
|
|
battery_level,
|
|
|
|
battery_level_safe,
|
|
|
|
battery_time,
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2006-05-01 05:45:18 +00:00
|
|
|
battery_voltage,
|
2006-02-07 20:38:55 +00:00
|
|
|
#endif
|
2007-02-18 05:32:06 +00:00
|
|
|
#if CONFIG_CHARGING
|
2006-02-07 20:38:55 +00:00
|
|
|
charger_inserted,
|
2009-03-24 21:59:44 +00:00
|
|
|
# if CONFIG_CHARGING >= CHARGING_MONITOR
|
2006-02-07 20:38:55 +00:00
|
|
|
charging_state,
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_USB_POWER
|
2008-04-04 19:38:46 +00:00
|
|
|
usb_powered,
|
2006-02-07 20:38:55 +00:00
|
|
|
#endif
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
/* misc */
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2010-02-14 06:26:16 +00:00
|
|
|
&errno,
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
srand,
|
|
|
|
rand,
|
2003-12-09 06:48:55 +00:00
|
|
|
(qsort_func)qsort,
|
2003-07-09 22:36:23 +00:00
|
|
|
kbd_input,
|
2003-07-25 23:04:59 +00:00
|
|
|
get_time,
|
2004-07-27 19:16:58 +00:00
|
|
|
set_time,
|
2007-07-30 05:19:05 +00:00
|
|
|
#if CONFIG_RTC
|
|
|
|
mktime,
|
|
|
|
#endif
|
2003-07-25 23:04:59 +00:00
|
|
|
plugin_get_buffer,
|
2005-04-05 11:33:58 +00:00
|
|
|
plugin_get_audio_buffer,
|
2004-07-27 14:10:48 +00:00
|
|
|
plugin_tsr,
|
2007-08-06 13:42:52 +00:00
|
|
|
plugin_get_current_filename,
|
2007-11-18 17:12:19 +00:00
|
|
|
#ifdef PLUGIN_USE_IRAM
|
2007-04-10 14:18:30 +00:00
|
|
|
plugin_iram_init,
|
|
|
|
#endif
|
2004-06-10 13:29:52 +00:00
|
|
|
#if defined(DEBUG) || defined(SIMULATOR)
|
|
|
|
debugf,
|
2005-07-26 20:01:11 +00:00
|
|
|
#endif
|
|
|
|
#ifdef ROCKBOX_HAS_LOGF
|
2006-11-11 08:00:28 +00:00
|
|
|
_logf,
|
2004-06-10 13:29:52 +00:00
|
|
|
#endif
|
2004-07-27 19:16:58 +00:00
|
|
|
&global_settings,
|
2007-04-10 14:18:30 +00:00
|
|
|
&global_status,
|
2007-10-19 15:31:42 +00:00
|
|
|
talk_disable,
|
2007-10-16 01:25:17 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2009-01-05 10:31:19 +00:00
|
|
|
codec_thread_do_callback,
|
2007-10-16 01:25:17 +00:00
|
|
|
codec_load_file,
|
|
|
|
get_codec_filename,
|
2010-05-24 16:42:32 +00:00
|
|
|
find_array_ptr,
|
|
|
|
remove_array_ptr,
|
|
|
|
round_value_to_list32,
|
|
|
|
#endif /* CONFIG_CODEC == SWCODEC */
|
2009-03-06 01:08:02 +00:00
|
|
|
get_metadata,
|
2004-06-10 13:29:52 +00:00
|
|
|
mp3info,
|
|
|
|
count_mp3_frames,
|
|
|
|
create_xing_header,
|
2004-10-23 09:59:53 +00:00
|
|
|
find_next_frame,
|
2005-08-29 21:15:27 +00:00
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2004-07-29 13:59:04 +00:00
|
|
|
peak_meter_scale_value,
|
2004-10-23 09:59:53 +00:00
|
|
|
peak_meter_set_use_dbfs,
|
2004-07-29 13:59:04 +00:00
|
|
|
peak_meter_get_use_dbfs,
|
|
|
|
#endif
|
2005-04-25 07:42:10 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
read_bmp_file,
|
2009-05-06 04:53:56 +00:00
|
|
|
read_bmp_fd,
|
|
|
|
#ifdef HAVE_JPEG
|
|
|
|
read_jpeg_file,
|
|
|
|
read_jpeg_fd,
|
|
|
|
#endif
|
2006-01-15 18:20:18 +00:00
|
|
|
screen_dump_set_hook,
|
2005-04-25 07:42:10 +00:00
|
|
|
#endif
|
2005-09-02 05:39:09 +00:00
|
|
|
show_logo,
|
2006-03-11 09:28:49 +00:00
|
|
|
tree_get_context,
|
2007-08-06 13:42:52 +00:00
|
|
|
set_current_file,
|
|
|
|
set_dirfilter,
|
2005-06-18 01:25:47 +00:00
|
|
|
|
2006-09-26 19:25:52 +00:00
|
|
|
#ifdef HAVE_WHEEL_POSITION
|
|
|
|
wheel_status,
|
|
|
|
wheel_send_events,
|
|
|
|
#endif
|
2006-10-31 11:17:00 +00:00
|
|
|
|
2007-01-12 18:34:00 +00:00
|
|
|
#ifdef IRIVER_H100_SERIES
|
|
|
|
/* Routines for the iriver_flash -plugin. */
|
|
|
|
detect_original_firmware,
|
|
|
|
detect_flashed_ramimage,
|
|
|
|
detect_flashed_romimage,
|
2007-10-16 01:25:17 +00:00
|
|
|
#endif
|
|
|
|
led,
|
2007-12-09 18:48:02 +00:00
|
|
|
#if (CONFIG_CODEC == SWCODEC)
|
|
|
|
bufopen,
|
|
|
|
bufalloc,
|
|
|
|
bufclose,
|
|
|
|
bufseek,
|
|
|
|
bufadvance,
|
|
|
|
bufread,
|
|
|
|
bufgetdata,
|
|
|
|
bufgettail,
|
|
|
|
bufcuttail,
|
|
|
|
|
|
|
|
buf_get_offset,
|
|
|
|
buf_handle_offset,
|
|
|
|
buf_request_buffer_handle,
|
|
|
|
buf_set_base_handle,
|
|
|
|
buf_used,
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_TAGCACHE
|
|
|
|
tagcache_search,
|
|
|
|
tagcache_search_set_uniqbuf,
|
|
|
|
tagcache_search_add_filter,
|
|
|
|
tagcache_get_next,
|
|
|
|
tagcache_retrieve,
|
|
|
|
tagcache_search_finish,
|
2008-08-14 22:35:00 +00:00
|
|
|
tagcache_get_numeric,
|
2009-06-01 21:08:49 +00:00
|
|
|
#ifdef HAVE_TC_RAMCACHE
|
|
|
|
tagcache_fill_tags,
|
|
|
|
#endif
|
2007-12-09 18:48:02 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_ALBUMART
|
|
|
|
search_albumart_files,
|
|
|
|
#endif
|
2007-12-29 19:46:35 +00:00
|
|
|
|
2008-09-23 09:59:06 +00:00
|
|
|
#ifdef HAVE_SEMAPHORE_OBJECTS
|
2008-09-20 22:13:39 +00:00
|
|
|
semaphore_init,
|
|
|
|
semaphore_wait,
|
|
|
|
semaphore_release,
|
2008-09-23 09:59:06 +00:00
|
|
|
#endif
|
2008-10-23 13:13:00 +00:00
|
|
|
|
2010-05-27 09:41:46 +00:00
|
|
|
rbversion,
|
2008-03-24 00:35:53 +00:00
|
|
|
/* new stuff at the end, sort into place next time
|
2008-06-24 10:20:22 +00:00
|
|
|
the API gets incompatible */
|
2003-06-29 16:33:04 +00:00
|
|
|
};
|
|
|
|
|
2008-05-13 09:57:56 +00:00
|
|
|
int plugin_load(const char* plugin, const void* parameter)
|
2003-06-29 16:33:04 +00:00
|
|
|
{
|
2009-12-09 07:25:46 +00:00
|
|
|
int rc, i;
|
2006-01-17 20:39:44 +00:00
|
|
|
struct plugin_header *hdr;
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2006-03-02 01:08:38 +00:00
|
|
|
void *pd;
|
2010-06-21 16:53:00 +00:00
|
|
|
#else /* PLATFOR_NATIVE */
|
2006-03-02 01:08:38 +00:00
|
|
|
int fd;
|
2006-01-15 18:20:18 +00:00
|
|
|
ssize_t readsize;
|
2008-04-06 13:26:39 +00:00
|
|
|
#if NUM_CORES > 1
|
|
|
|
unsigned my_core;
|
2005-02-22 12:56:58 +00:00
|
|
|
#endif
|
2010-06-21 16:53:00 +00:00
|
|
|
#endif /* CONFIG_PLATFORM */
|
2006-11-15 06:14:27 +00:00
|
|
|
|
2006-11-13 00:45:21 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2006-02-02 20:42:56 +00:00
|
|
|
fb_data* old_backdrop;
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
2004-04-30 20:37:11 +00:00
|
|
|
if (pfn_tsr_exit != NULL) /* if we have a resident old plugin: */
|
|
|
|
{
|
2007-08-08 07:27:07 +00:00
|
|
|
if (pfn_tsr_exit(!strcmp(current_plugin, plugin)) == false )
|
2006-10-31 11:17:00 +00:00
|
|
|
{
|
|
|
|
/* not allowing another plugin to load */
|
|
|
|
return PLUGIN_OK;
|
|
|
|
}
|
2004-04-30 20:37:11 +00:00
|
|
|
pfn_tsr_exit = NULL;
|
2005-11-10 08:07:31 +00:00
|
|
|
plugin_loaded = false;
|
2004-04-30 20:37:11 +00:00
|
|
|
}
|
2007-04-10 14:18:30 +00:00
|
|
|
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(0, ID2P(LANG_WAIT));
|
2007-08-08 07:27:07 +00:00
|
|
|
strcpy(current_plugin, plugin);
|
2006-02-16 22:36:04 +00:00
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2006-03-02 01:08:38 +00:00
|
|
|
hdr = sim_plugin_load((char *)plugin, &pd);
|
|
|
|
if (pd == NULL) {
|
2008-08-15 08:27:39 +00:00
|
|
|
splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin);
|
2003-06-29 16:33:04 +00:00
|
|
|
return -1;
|
2006-01-16 23:20:58 +00:00
|
|
|
}
|
|
|
|
if (hdr == NULL
|
|
|
|
|| hdr->magic != PLUGIN_MAGIC
|
2006-01-18 08:34:32 +00:00
|
|
|
|| hdr->target_id != TARGET_ID) {
|
2006-03-02 01:08:38 +00:00
|
|
|
sim_plugin_close(pd);
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*2, str(LANG_PLUGIN_WRONG_MODEL));
|
2006-01-16 23:20:58 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (hdr->api_version > PLUGIN_API_VERSION
|
|
|
|
|| hdr->api_version < PLUGIN_MIN_API_VERSION) {
|
2006-03-02 01:08:38 +00:00
|
|
|
sim_plugin_close(pd);
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*2, str(LANG_PLUGIN_WRONG_VERSION));
|
2006-01-16 23:20:58 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2003-06-29 16:33:04 +00:00
|
|
|
#else
|
|
|
|
fd = open(plugin, O_RDONLY);
|
|
|
|
if (fd < 0) {
|
2008-08-15 08:27:39 +00:00
|
|
|
splashf(HZ*2, str(LANG_PLUGIN_CANT_OPEN), plugin);
|
2003-06-29 16:33:04 +00:00
|
|
|
return fd;
|
|
|
|
}
|
2008-04-06 13:26:39 +00:00
|
|
|
#if NUM_CORES > 1
|
|
|
|
/* Make sure COP cache is flushed and invalidated before loading */
|
|
|
|
my_core = switch_core(CURRENT_CORE ^ 1);
|
2009-02-11 12:55:51 +00:00
|
|
|
cpucache_invalidate();
|
2008-04-06 13:26:39 +00:00
|
|
|
switch_core(my_core);
|
|
|
|
#endif
|
2006-01-17 20:39:44 +00:00
|
|
|
|
|
|
|
readsize = read(fd, pluginbuf, PLUGIN_BUFFER_SIZE);
|
2006-01-16 23:20:58 +00:00
|
|
|
close(fd);
|
2006-01-15 18:20:18 +00:00
|
|
|
|
2006-01-18 08:34:32 +00:00
|
|
|
if (readsize < 0) {
|
2008-08-15 08:27:39 +00:00
|
|
|
splashf(HZ*2, str(LANG_READ_FAILED), plugin);
|
2006-01-15 18:20:18 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2006-01-17 20:39:44 +00:00
|
|
|
hdr = (struct plugin_header *)pluginbuf;
|
|
|
|
|
2006-01-18 08:34:32 +00:00
|
|
|
if ((unsigned)readsize <= sizeof(struct plugin_header)
|
|
|
|
|| hdr->magic != PLUGIN_MAGIC
|
2006-01-17 20:39:44 +00:00
|
|
|
|| hdr->target_id != TARGET_ID
|
|
|
|
|| hdr->load_addr != pluginbuf
|
|
|
|
|| hdr->end_addr > pluginbuf + PLUGIN_BUFFER_SIZE) {
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*2, str(LANG_PLUGIN_WRONG_MODEL));
|
2006-01-15 18:20:18 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2006-01-17 20:39:44 +00:00
|
|
|
if (hdr->api_version > PLUGIN_API_VERSION
|
|
|
|
|| hdr->api_version < PLUGIN_MIN_API_VERSION) {
|
2008-08-15 08:27:39 +00:00
|
|
|
splash(HZ*2, str(LANG_PLUGIN_WRONG_VERSION));
|
2006-01-15 18:20:18 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2006-01-17 20:39:44 +00:00
|
|
|
plugin_size = hdr->end_addr - pluginbuf;
|
2006-04-06 18:26:14 +00:00
|
|
|
|
|
|
|
/* zero out bss area only, above guards end of pluginbuf */
|
2007-04-12 05:18:53 +00:00
|
|
|
if (plugin_size > readsize)
|
|
|
|
memset(pluginbuf + readsize, 0, plugin_size - readsize);
|
2003-06-29 16:33:04 +00:00
|
|
|
#endif
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
*(hdr->api) = &rockbox_api;
|
2003-07-25 23:04:59 +00:00
|
|
|
plugin_loaded = true;
|
2008-06-23 13:20:35 +00:00
|
|
|
|
2007-04-10 14:18:30 +00:00
|
|
|
|
2007-04-06 22:55:00 +00:00
|
|
|
#if defined HAVE_LCD_BITMAP && LCD_DEPTH > 1
|
2006-02-14 00:39:11 +00:00
|
|
|
old_backdrop = lcd_get_backdrop();
|
2006-02-16 22:36:04 +00:00
|
|
|
#endif
|
|
|
|
lcd_clear_display();
|
2006-02-14 00:39:11 +00:00
|
|
|
lcd_update();
|
|
|
|
|
2006-02-18 00:13:44 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
lcd_remote_clear_display();
|
|
|
|
lcd_remote_update();
|
|
|
|
#endif
|
|
|
|
|
2009-12-09 07:25:46 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
|
|
|
viewportmanager_theme_enable(i, false, NULL);
|
2009-08-16 22:20:11 +00:00
|
|
|
|
|
|
|
cpucache_invalidate();
|
2009-04-19 12:46:04 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
touchscreen_set_mode(TOUCHSCREEN_BUTTON);
|
|
|
|
#endif
|
2007-03-21 07:26:07 +00:00
|
|
|
|
2010-02-11 19:15:37 +00:00
|
|
|
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
|
|
|
open_files = 0;
|
|
|
|
#endif
|
|
|
|
|
2009-01-16 10:34:40 +00:00
|
|
|
rc = hdr->entry_point(parameter);
|
2010-02-11 19:15:37 +00:00
|
|
|
|
2009-08-04 05:22:10 +00:00
|
|
|
/* Go back to the global setting in case the plugin changed it */
|
2009-04-19 12:46:04 +00:00
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
2009-08-04 05:22:10 +00:00
|
|
|
touchscreen_set_mode(global_settings.touch_mode);
|
2009-04-19 12:46:04 +00:00
|
|
|
#endif
|
2007-04-10 14:18:30 +00:00
|
|
|
|
2004-07-21 08:02:23 +00:00
|
|
|
button_clear_queue();
|
2006-02-18 00:13:44 +00:00
|
|
|
|
2005-06-24 22:33:21 +00:00
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2009-05-14 18:22:24 +00:00
|
|
|
lcd_setfont(FONT_UI);
|
2005-07-14 18:12:27 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2006-10-09 07:00:50 +00:00
|
|
|
lcd_set_backdrop(old_backdrop);
|
2006-11-13 00:45:21 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-05-01 05:45:18 +00:00
|
|
|
lcd_set_drawinfo(DRMODE_SOLID, global_settings.fg_color,
|
2006-02-26 02:48:05 +00:00
|
|
|
global_settings.bg_color);
|
|
|
|
#else
|
2005-11-16 21:09:23 +00:00
|
|
|
lcd_set_drawinfo(DRMODE_SOLID, LCD_DEFAULT_FG, LCD_DEFAULT_BG);
|
2006-02-26 02:48:05 +00:00
|
|
|
#endif
|
2005-07-19 10:33:41 +00:00
|
|
|
#else /* LCD_DEPTH == 1 */
|
2005-06-24 22:33:21 +00:00
|
|
|
lcd_set_drawmode(DRMODE_SOLID);
|
2005-07-19 10:33:41 +00:00
|
|
|
#endif /* LCD_DEPTH */
|
2007-04-06 22:55:00 +00:00
|
|
|
#endif /* HAVE_LCD_BITMAP */
|
|
|
|
|
2006-02-18 00:13:44 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2006-10-09 07:00:50 +00:00
|
|
|
#if LCD_REMOTE_DEPTH > 1
|
2006-10-14 01:32:58 +00:00
|
|
|
lcd_remote_set_drawinfo(DRMODE_SOLID, LCD_REMOTE_DEFAULT_FG,
|
2006-10-09 07:00:50 +00:00
|
|
|
LCD_REMOTE_DEFAULT_BG);
|
|
|
|
#else
|
2006-02-18 00:13:44 +00:00
|
|
|
lcd_remote_set_drawmode(DRMODE_SOLID);
|
2006-10-09 07:00:50 +00:00
|
|
|
#endif
|
2009-07-05 22:12:42 +00:00
|
|
|
#endif
|
2007-10-16 01:25:17 +00:00
|
|
|
|
2009-12-10 13:53:38 +00:00
|
|
|
lcd_clear_display();
|
|
|
|
#ifdef HAVE_LCD_REMOTE
|
|
|
|
lcd_remote_clear_display();
|
|
|
|
#endif
|
|
|
|
|
2009-12-09 07:25:46 +00:00
|
|
|
FOR_NB_SCREENS(i)
|
2009-12-21 05:19:12 +00:00
|
|
|
viewportmanager_theme_undo(i, false);
|
2007-10-16 01:25:17 +00:00
|
|
|
|
2005-11-10 08:07:31 +00:00
|
|
|
if (pfn_tsr_exit == NULL)
|
|
|
|
plugin_loaded = false;
|
2003-07-25 23:04:59 +00:00
|
|
|
|
2010-02-11 19:15:37 +00:00
|
|
|
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
|
|
|
if(open_files != 0 && !plugin_loaded)
|
|
|
|
{
|
|
|
|
int fd;
|
|
|
|
logf("Plugin '%s' leaks file handles", plugin);
|
|
|
|
|
|
|
|
static const char *lines[] =
|
|
|
|
{ ID2P(LANG_PLUGIN_ERROR),
|
|
|
|
"#leak-file-handles" };
|
|
|
|
static const struct text_message message={ lines, 2 };
|
|
|
|
button_clear_queue(); /* Empty the keyboard buffer */
|
|
|
|
gui_syncyesno_run(&message, NULL, NULL);
|
|
|
|
|
|
|
|
for(fd=0; fd < MAX_OPEN_FILES; fd++)
|
|
|
|
if(open_files & (1<<fd))
|
|
|
|
close_wrapper(fd);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-03-02 01:08:38 +00:00
|
|
|
sim_plugin_close(pd);
|
2006-01-16 23:20:58 +00:00
|
|
|
|
2009-07-05 22:12:42 +00:00
|
|
|
if (rc == PLUGIN_ERROR)
|
|
|
|
splash(HZ*2, str(LANG_PLUGIN_ERROR));
|
2008-12-13 02:48:36 +00:00
|
|
|
|
2009-07-05 22:12:42 +00:00
|
|
|
return rc;
|
2003-06-29 16:33:04 +00:00
|
|
|
}
|
|
|
|
|
2003-07-25 23:04:59 +00:00
|
|
|
/* Returns a pointer to the portion of the plugin buffer that is not already
|
|
|
|
being used. If no plugin is loaded, returns the entire plugin buffer */
|
2007-04-21 18:38:25 +00:00
|
|
|
void* plugin_get_buffer(size_t *buffer_size)
|
2003-07-25 23:04:59 +00:00
|
|
|
{
|
|
|
|
int buffer_pos;
|
|
|
|
|
|
|
|
if (plugin_loaded)
|
|
|
|
{
|
|
|
|
if (plugin_size >= PLUGIN_BUFFER_SIZE)
|
|
|
|
return NULL;
|
2006-05-01 05:45:18 +00:00
|
|
|
|
2003-07-25 23:04:59 +00:00
|
|
|
*buffer_size = PLUGIN_BUFFER_SIZE-plugin_size;
|
|
|
|
buffer_pos = plugin_size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*buffer_size = PLUGIN_BUFFER_SIZE;
|
|
|
|
buffer_pos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return &pluginbuf[buffer_pos];
|
|
|
|
}
|
|
|
|
|
2006-05-01 05:45:18 +00:00
|
|
|
/* Returns a pointer to the mp3 buffer.
|
2006-11-06 18:07:30 +00:00
|
|
|
Playback gets stopped, to avoid conflicts.
|
|
|
|
Talk buffer is stolen as well.
|
|
|
|
*/
|
2007-04-21 18:38:25 +00:00
|
|
|
void* plugin_get_audio_buffer(size_t *buffer_size)
|
2004-01-30 22:30:40 +00:00
|
|
|
{
|
2006-11-06 18:07:30 +00:00
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2007-04-21 18:38:25 +00:00
|
|
|
return audio_get_buffer(true, buffer_size);
|
2006-11-06 18:07:30 +00:00
|
|
|
#else
|
2005-04-04 12:06:29 +00:00
|
|
|
audio_stop();
|
2004-03-14 21:33:53 +00:00
|
|
|
talk_buffer_steal(); /* we use the mp3 buffer, need to tell */
|
2005-04-05 11:33:58 +00:00
|
|
|
*buffer_size = audiobufend - audiobuf;
|
|
|
|
return audiobuf;
|
2006-11-18 02:18:29 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2007-11-18 17:12:19 +00:00
|
|
|
#ifdef PLUGIN_USE_IRAM
|
2006-11-18 02:18:29 +00:00
|
|
|
/* Initializes plugin IRAM */
|
|
|
|
void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size,
|
|
|
|
char *iedata, size_t iedata_size)
|
|
|
|
{
|
2007-11-18 17:12:19 +00:00
|
|
|
/* We need to stop audio playback in order to use codec IRAM */
|
|
|
|
audio_hard_stop();
|
2006-11-18 02:18:29 +00:00
|
|
|
memcpy(iramstart, iramcopy, iram_size);
|
|
|
|
memset(iedata, 0, iedata_size);
|
2006-11-26 18:31:41 +00:00
|
|
|
memset(iramcopy, 0, iram_size);
|
2007-08-04 00:11:41 +00:00
|
|
|
#if NUM_CORES > 1
|
|
|
|
/* writeback cleared iedata and iramcopy areas */
|
2009-02-11 12:55:51 +00:00
|
|
|
cpucache_flush();
|
2007-08-04 00:11:41 +00:00
|
|
|
#endif
|
2004-01-30 22:30:40 +00:00
|
|
|
}
|
2007-11-18 17:12:19 +00:00
|
|
|
#endif /* PLUGIN_USE_IRAM */
|
2004-01-30 22:30:40 +00:00
|
|
|
|
2004-04-30 20:37:11 +00:00
|
|
|
/* The plugin wants to stay resident after leaving its main function, e.g.
|
2006-05-01 05:45:18 +00:00
|
|
|
runs from timer or own thread. The callback is registered to later
|
2004-04-30 20:37:11 +00:00
|
|
|
instruct it to free its resources before a new plugin gets loaded. */
|
2006-10-31 11:17:00 +00:00
|
|
|
void plugin_tsr(bool (*exit_callback)(bool))
|
2004-04-30 20:37:11 +00:00
|
|
|
{
|
|
|
|
pfn_tsr_exit = exit_callback; /* remember the callback for later */
|
|
|
|
}
|
2007-08-06 13:42:52 +00:00
|
|
|
|
|
|
|
char *plugin_get_current_filename(void)
|
|
|
|
{
|
|
|
|
return current_plugin;
|
|
|
|
}
|
2010-02-11 19:15:37 +00:00
|
|
|
|
2010-05-06 17:35:13 +00:00
|
|
|
static int open_wrapper(const char* pathname, int flags, ...)
|
2010-02-11 19:15:37 +00:00
|
|
|
{
|
2010-05-06 17:35:13 +00:00
|
|
|
/* we don't have an 'open' function. it's a define. and we need
|
|
|
|
* the real file_open, hence PREFIX() doesn't work here */
|
|
|
|
int fd;
|
2010-06-21 16:53:00 +00:00
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2010-05-06 17:35:13 +00:00
|
|
|
if (flags & O_CREAT)
|
|
|
|
{
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, flags);
|
2010-05-07 16:56:40 +00:00
|
|
|
fd = sim_open(pathname, flags, va_arg(ap, unsigned int));
|
2010-05-06 17:35:13 +00:00
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fd = sim_open(pathname, flags);
|
|
|
|
#else
|
|
|
|
fd = file_open(pathname,flags);
|
|
|
|
#endif
|
2010-02-11 19:15:37 +00:00
|
|
|
|
2010-05-06 17:35:13 +00:00
|
|
|
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
2010-02-11 19:15:37 +00:00
|
|
|
if(fd >= 0)
|
|
|
|
open_files |= 1<<fd;
|
2010-05-06 17:35:13 +00:00
|
|
|
#endif
|
2010-02-11 19:15:37 +00:00
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
|
2010-05-06 17:35:13 +00:00
|
|
|
#ifdef HAVE_PLUGIN_CHECK_OPEN_CLOSE
|
2010-02-11 19:15:37 +00:00
|
|
|
static int close_wrapper(int fd)
|
|
|
|
{
|
|
|
|
if((~open_files) & (1<<fd))
|
|
|
|
{
|
|
|
|
logf("double close from plugin");
|
|
|
|
}
|
|
|
|
if(fd >= 0)
|
|
|
|
open_files &= (~(1<<fd));
|
|
|
|
|
|
|
|
return PREFIX(close)(fd);
|
|
|
|
}
|
|
|
|
|
2010-05-06 17:35:04 +00:00
|
|
|
static int creat_wrapper(const char *pathname, mode_t mode)
|
2010-02-11 19:15:37 +00:00
|
|
|
{
|
2010-05-06 17:35:04 +00:00
|
|
|
int fd = PREFIX(creat)(pathname, mode);
|
2010-02-11 19:15:37 +00:00
|
|
|
|
|
|
|
if(fd >= 0)
|
|
|
|
open_files |= (1<<fd);
|
|
|
|
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
#endif /* HAVE_PLUGIN_CHECK_OPEN_CLOSE */
|