blob: 113296c19a4d046cfe4c05e30c0d390a313ca393 [file] [log] [blame]
Björn Stenbergba371fb2003-06-29 16:33:04 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
Nicolas Pennequin396aeaf2009-03-23 17:08:46 +000010 * Copyright (C) 2002 Björn Stenberg
Björn Stenbergba371fb2003-06-29 16:33:04 +000011 *
Daniel Stenberg2acc0ac2008-06-28 18:10:04 +000012 * 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 Stenbergba371fb2003-06-29 16:33:04 +000016 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _PLUGIN_H_
22#define _PLUGIN_H_
23
24/* instruct simulator code to not redefine any symbols when compiling plugins.
25 (the PLUGIN macro is defined in apps/plugins/Makefile) */
26#ifdef PLUGIN
27#define NO_REDEFINES_PLEASE
28#endif
29
Michael Sevakis6689cb02007-04-10 14:18:30 +000030#include <stdbool.h>
Thomas Martitz50a6ca32010-05-06 21:04:40 +000031#include <inttypes.h>
Michael Sevakis806d8f32006-11-11 05:11:05 +000032#include <sys/types.h>
33#include <stdarg.h>
Björn Stenbergba371fb2003-06-29 16:33:04 +000034#include <stdio.h>
35#include <stdlib.h>
Bertrik Sikkenef879332008-08-12 20:11:18 +000036#include <string.h>
Thomas Martitz50a6ca32010-05-06 21:04:40 +000037#include "string-extra.h"
Rafaël Carréa72aa852010-07-25 14:44:29 +000038#include "gcc_extensions.h"
Nils Wallméniusa21004d2008-05-19 14:37:16 +000039
Nils Wallménius3d4701a2009-07-14 13:57:45 +000040char* strncpy(char *, const char *, size_t);
Nils Wallméniusa21004d2008-05-19 14:37:16 +000041void* plugin_get_buffer(size_t *buffer_size);
42
43#ifndef __PCTOOL__
Björn Stenbergba371fb2003-06-29 16:33:04 +000044#include "config.h"
Michael Sevakis806d8f32006-11-11 05:11:05 +000045#include "system.h"
Björn Stenbergba371fb2003-06-29 16:33:04 +000046#include "dir.h"
Michael Sevakis57d71e42007-11-08 05:17:20 +000047#include "general.h"
Björn Stenbergba371fb2003-06-29 16:33:04 +000048#include "kernel.h"
Michael Sevakis806d8f32006-11-11 05:11:05 +000049#include "thread.h"
Björn Stenbergba371fb2003-06-29 16:33:04 +000050#include "button.h"
Linus Nielsen Feltzing224c0a12006-08-15 12:27:07 +000051#include "action.h"
Thomas Martitz0d4585b2010-09-09 16:17:21 +000052#include "load_code.h"
Hristo Kovachev495c63f2006-01-25 18:29:56 +000053#include "usb.h"
Björn Stenbergba371fb2003-06-29 16:33:04 +000054#include "font.h"
Björn Stenbergba371fb2003-06-29 16:33:04 +000055#include "lcd.h"
Björn Stenberg51b45d52008-10-15 06:38:51 +000056#include "metadata.h"
Michael Sevakis806d8f32006-11-11 05:11:05 +000057#include "sound.h"
Jerome Kuptzc7d42bb2003-07-20 21:29:16 +000058#include "mpeg.h"
Linus Nielsen Feltzing8a237a82005-04-04 12:06:29 +000059#include "audio.h"
Jörg Hohensohn95298a92004-01-30 22:30:40 +000060#include "mp3_playback.h"
Michael Sevakis806d8f32006-11-11 05:11:05 +000061#include "talk.h"
Brandon Low05dccc32006-01-18 20:54:13 +000062#ifdef RB_PROFILE
63#include "profile.h"
64#endif
Linus Nielsen Feltzing60895bc2005-09-02 05:39:09 +000065#include "misc.h"
Thomas Martitz9c0b2472010-08-01 16:15:27 +000066#include "filefuncs.h"
Jens Arnold0c09f3e2006-03-26 23:00:24 +000067#if (CONFIG_CODEC == SWCODEC)
Michael Sevakisa2b67032011-06-29 06:37:04 +000068#include "pcm_mixer.h"
Dan Evertond1088492006-03-05 19:34:54 +000069#include "dsp.h"
Dave Chapman7cdd0fe2007-05-07 17:23:31 +000070#include "codecs.h"
71#include "playback.h"
Jeffrey Goode9a4420b2009-10-31 19:17:36 +000072#include "codec_thread.h"
Michael Sevakis806d8f32006-11-11 05:11:05 +000073#ifdef HAVE_RECORDING
74#include "recording.h"
75#endif
Jens Arnold0c09f3e2006-03-26 23:00:24 +000076#else
Marcin Bukat56c4e9f2010-10-31 21:09:34 +000077#include "mas35xx.h"
Michael Sevakis806d8f32006-11-11 05:11:05 +000078#endif /* CONFIG_CODEC == SWCODEC */
Jörg Hohensohn95298a92004-01-30 22:30:40 +000079#include "settings.h"
Jens Arnolde44372e2005-07-26 20:01:11 +000080#include "timer.h"
Jörg Hohensohn92e19db2004-06-19 09:36:03 +000081#include "playlist.h"
Linus Nielsen Feltzing24410612004-07-08 13:14:44 +000082#ifdef HAVE_LCD_BITMAP
Jens Arnold11ad7b42009-02-10 23:43:37 +000083#include "screendump.h"
Jonathan Gordon62885232006-11-19 14:11:42 +000084#include "scrollbar.h"
Andrew Mahone60d42092009-05-01 23:24:23 +000085#include "jpeg_load.h"
Andrew Mahonef7fa7e52008-12-26 07:03:22 +000086#include "../recorder/bmp.h"
Linus Nielsen Feltzing24410612004-07-08 13:14:44 +000087#endif
Jonathan Gordon77a458a2007-05-08 11:55:43 +000088#include "statusbar.h"
Dave Chapman548c1b72005-09-22 08:54:48 +000089#include "menu.h"
Marcoen Hirschbergb0fee172005-12-06 13:27:15 +000090#include "rbunicode.h"
Hristo Kovachev38deb8f2006-04-03 08:51:08 +000091#include "list.h"
Michael Sevakis806d8f32006-11-11 05:11:05 +000092#include "tree.h"
Jonathan Gordon46e186f2007-06-18 13:37:57 +000093#include "color_picker.h"
Nicolas Pennequin90ce8262007-12-09 18:48:02 +000094#include "buffering.h"
95#include "tagcache.h"
Jonathan Gordon5ca15392008-03-26 03:35:24 +000096#include "viewport.h"
Bertrik Sikken9464fdd2008-08-14 22:35:00 +000097#include "ata_idle_notify.h"
Jonathan Gordon9e2807f2008-10-26 11:44:21 +000098#include "settings_list.h"
Bertrik Sikkenb24fafb2009-03-08 20:28:15 +000099#include "timefuncs.h"
Nils Wallménius4279c9f2009-11-22 18:48:07 +0000100#include "crc32.h"
Nicolas Pennequinec8ce3b2007-12-09 19:14:31 +0000101
102#ifdef HAVE_ALBUMART
Nicolas Pennequin90ce8262007-12-09 18:48:02 +0000103#include "albumart.h"
Nicolas Pennequinec8ce3b2007-12-09 19:14:31 +0000104#endif
Daniel Stenbergafd70422003-07-24 09:35:32 +0000105
Christian Gmeinerc63430e2005-04-15 12:55:31 +0000106#ifdef HAVE_REMOTE_LCD
107#include "lcd-remote.h"
108#endif
109
Nils Wallméniusbd12def2008-07-07 14:04:18 +0000110#include "yesno.h"
111
Mustapha Senhaji39b3c9a2010-12-28 14:18:37 +0000112#include "filetypes.h"
113
Tomer Shalev8c5141b2009-09-30 10:06:04 +0000114#ifdef USB_ENABLE_HID
Frank Gevaertse409fba2009-07-18 12:58:29 +0000115#include "usbstack/usb_hid_usage_tables.h"
116#endif
117
Thomas Martitz50a6ca32010-05-06 21:04:40 +0000118
119/* on some platforms strcmp() seems to be a tricky define which
120 * breaks if we write down strcmp's prototype */
121#undef strcmp
122
Linus Nielsen Feltzinga6142ab2004-06-10 13:29:52 +0000123#ifdef PLUGIN
Dave Chapman33001cb2005-06-18 19:19:12 +0000124
Linus Nielsen Feltzinga6142ab2004-06-10 13:29:52 +0000125#if defined(DEBUG) || defined(SIMULATOR)
Daniel Stenberg22b77012005-02-22 12:19:12 +0000126#undef DEBUGF
Jens Arnold06cb2372004-08-30 19:52:45 +0000127#define DEBUGF rb->debugf
Daniel Stenberg22b77012005-02-22 12:19:12 +0000128#undef LDEBUGF
Linus Nielsen Feltzinga6142ab2004-06-10 13:29:52 +0000129#define LDEBUGF rb->debugf
130#else
Rafaël Carré88c45ff2010-05-18 18:45:10 +0000131#undef DEBUGF
132#define DEBUGF(...) do { } while(0)
133#undef LDEBUGF
134#define LDEBUGF(...) do { } while(0)
Linus Nielsen Feltzinga6142ab2004-06-10 13:29:52 +0000135#endif
Dave Chapman33001cb2005-06-18 19:19:12 +0000136
137#ifdef ROCKBOX_HAS_LOGF
138#undef LOGF
139#define LOGF rb->logf
140#else
141#define LOGF(...)
142#endif
143
Linus Nielsen Feltzinga6142ab2004-06-10 13:29:52 +0000144#endif
145
Jens Arnolda36b1d42006-01-15 18:20:18 +0000146#define PLUGIN_MAGIC 0x526F634B /* RocK */
147
Björn Stenbergba371fb2003-06-29 16:33:04 +0000148/* increase this every time the api struct changes */
Michael Sevakisa2b67032011-06-29 06:37:04 +0000149#define PLUGIN_API_VERSION 206
Hardeep Sidhu48c2d0f2003-07-25 23:04:59 +0000150
151/* update this to latest version if a change to the api struct breaks
Zakk Roberts07fcf772006-05-01 05:45:18 +0000152 backwards compatibility (and please take the opportunity to sort in any
Jörg Hohensohnfacfec02004-02-03 23:56:25 +0000153 new function which are "waiting" at the end of the function table) */
Michael Sevakis5a8f5b82011-05-09 21:19:11 +0000154#define PLUGIN_MIN_API_VERSION 205
Björn Stenbergba371fb2003-06-29 16:33:04 +0000155
156/* plugin return codes */
Thomas Martitzcae4ae22010-08-24 14:30:46 +0000157/* internal returns start at 0x100 to make exit(1..255) work */
158#define INTERNAL_PLUGIN_RETVAL_START 0x100
Björn Stenbergba371fb2003-06-29 16:33:04 +0000159enum plugin_status {
Thomas Martitzcae4ae22010-08-24 14:30:46 +0000160 PLUGIN_OK = 0, /* PLUGIN_OK == EXIT_SUCCESS */
161 /* 1...255 reserved for exit() */
162 PLUGIN_USB_CONNECTED = INTERNAL_PLUGIN_RETVAL_START,
163 PLUGIN_POWEROFF,
Thomas Martitzdf6f9552009-07-05 22:12:42 +0000164 PLUGIN_GOTO_WPS,
Jens Arnolda36b1d42006-01-15 18:20:18 +0000165 PLUGIN_ERROR = -1,
Björn Stenbergba371fb2003-06-29 16:33:04 +0000166};
167
Hardeep Sidhu48c2d0f2003-07-25 23:04:59 +0000168/* NOTE: To support backwards compatibility, only add new functions at
169 the end of the structure. Every time you add a new function,
170 remember to increase PLUGIN_API_VERSION. If you make changes to the
171 existing APIs then also update PLUGIN_MIN_API_VERSION to current
172 version
173 */
Björn Stenbergba371fb2003-06-29 16:33:04 +0000174struct plugin_api {
Björn Stenbergba371fb2003-06-29 16:33:04 +0000175
176 /* lcd */
Thomas Martitz1034dea2009-03-30 16:06:02 +0000177
178#ifdef HAVE_LCD_CONTRAST
Jens Arnold04daef12005-06-24 22:33:21 +0000179 void (*lcd_set_contrast)(int x);
Thomas Martitz1034dea2009-03-30 16:06:02 +0000180#endif
Jens Arnold54ea2e42007-03-31 09:58:49 +0000181 void (*lcd_update)(void);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000182 void (*lcd_clear_display)(void);
Jens Arnoldad4e3d62007-03-26 07:52:13 +0000183 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
184 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
Rafaël Carréda162482010-08-30 20:47:53 +0000185 void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...);
Jens Arnoldabe77a12004-08-01 21:50:57 +0000186 void (*lcd_puts)(int x, int y, const unsigned char *string);
Rafaël Carréda162482010-08-30 20:47:53 +0000187 void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...);
Jens Arnoldc76c5682004-08-16 23:37:23 +0000188 void (*lcd_puts_scroll)(int x, int y, const unsigned char* string);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000189 void (*lcd_stop_scroll)(void);
190#ifdef HAVE_LCD_CHARCELLS
Jens Arnoldad4e3d62007-03-26 07:52:13 +0000191 void (*lcd_define_pattern)(unsigned long ucs, const char *pattern);
192 unsigned long (*lcd_get_locked_pattern)(void);
193 void (*lcd_unlock_pattern)(unsigned long ucs);
194 void (*lcd_putc)(int x, int y, unsigned long ucs);
195 void (*lcd_put_cursor)(int x, int y, unsigned long ucs);
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000196 void (*lcd_remove_cursor)(void);
Jens Arnold323d75d2007-04-03 18:06:13 +0000197 void (*lcd_icon)(int icon, bool enable);
Linus Nielsen Feltzing60895bc2005-09-02 05:39:09 +0000198 void (*lcd_double_height)(bool on);
Jens Arnold68a21682008-03-24 00:35:53 +0000199#else /* HAVE_LCD_BITMAP */
200 fb_data* lcd_framebuffer;
Jens Arnoldc84e3452008-03-24 00:45:03 +0000201 void (*lcd_update_rect)(int x, int y, int width, int height);
Jens Arnold04daef12005-06-24 22:33:21 +0000202 void (*lcd_set_drawmode)(int mode);
203 int (*lcd_get_drawmode)(void);
204 void (*lcd_setfont)(int font);
Jens Arnold04daef12005-06-24 22:33:21 +0000205 void (*lcd_drawpixel)(int x, int y);
206 void (*lcd_drawline)(int x1, int y1, int x2, int y2);
Jens Arnold7e11acb2005-06-28 23:15:47 +0000207 void (*lcd_hline)(int x1, int x2, int y);
208 void (*lcd_vline)(int x, int y1, int y2);
209 void (*lcd_drawrect)(int x, int y, int width, int height);
210 void (*lcd_fillrect)(int x, int y, int width, int height);
Jens Arnoldf894a4c2005-07-06 22:58:02 +0000211 void (*lcd_mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
212 int stride, int x, int y, int width, int height);
213 void (*lcd_mono_bitmap)(const unsigned char *src, int x, int y,
214 int width, int height);
Jens Arnolde44372e2005-07-26 20:01:11 +0000215#if LCD_DEPTH > 1
Jens Arnold5b2cba12005-11-16 21:09:23 +0000216 void (*lcd_set_foreground)(unsigned foreground);
217 unsigned (*lcd_get_foreground)(void);
218 void (*lcd_set_background)(unsigned foreground);
219 unsigned (*lcd_get_background)(void);
Linus Nielsen Feltzing0cb4a462005-11-14 20:43:49 +0000220 void (*lcd_bitmap_part)(const fb_data *src, int src_x, int src_y,
Jens Arnolde44372e2005-07-26 20:01:11 +0000221 int stride, int x, int y, int width, int height);
Linus Nielsen Feltzing0cb4a462005-11-14 20:43:49 +0000222 void (*lcd_bitmap)(const fb_data *src, int x, int y, int width,
Jens Arnolde44372e2005-07-26 20:01:11 +0000223 int height);
Michael Sevakisea255fb2007-06-22 09:34:57 +0000224 fb_data* (*lcd_get_backdrop)(void);
Jonathan Gordon62885232006-11-19 14:11:42 +0000225 void (*lcd_set_backdrop)(fb_data* backdrop);
Jens Arnolde44372e2005-07-26 20:01:11 +0000226#endif
Brandon Low413da2a2006-02-07 20:38:55 +0000227#if LCD_DEPTH == 16
228 void (*lcd_bitmap_transparent_part)(const fb_data *src,
229 int src_x, int src_y, int stride,
230 int x, int y, int width, int height);
Dan Evertond1088492006-03-05 19:34:54 +0000231 void (*lcd_bitmap_transparent)(const fb_data *src, int x, int y,
Brandon Low413da2a2006-02-07 20:38:55 +0000232 int width, int height);
Rafaël Carréa98c54f2009-06-21 14:09:48 +0000233#if MEMORYSIZE > 2
Jens Arnold68a21682008-03-24 00:35:53 +0000234 void (*lcd_blit_yuv)(unsigned char * const src[3],
235 int src_x, int src_y, int stride,
236 int x, int y, int width, int height);
237#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \
Jens Arnold27f5cda2009-07-15 22:02:42 +0000238 || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) \
Rafaël Carré35500c22010-03-28 02:41:29 +0000239 || defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) \
Michael Sevakis0dd74ca2011-01-11 01:21:31 +0000240 || defined(TOSHIBA_GIGABEAT_S) || defined(PHILIPS_SA9200)
Jens Arnold68a21682008-03-24 00:35:53 +0000241 void (*lcd_yuv_set_options)(unsigned options);
Brandon Low413da2a2006-02-07 20:38:55 +0000242#endif
Rafaël Carréa98c54f2009-06-21 14:09:48 +0000243#endif /* MEMORYSIZE > 2 */
Thomas Martitz35e8b142010-06-21 16:53:00 +0000244#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
Jens Arnold68a21682008-03-24 00:35:53 +0000245 void (*lcd_blit_mono)(const unsigned char *data, int x, int by, int width,
246 int bheight, int stride);
247 void (*lcd_blit_grey_phase)(unsigned char *values, unsigned char *phases,
248 int bx, int by, int bwidth, int bheight,
249 int stride);
250#endif /* LCD_DEPTH */
Andrew Mahoneeef79452009-05-06 04:53:56 +0000251#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
252 void (*lcd_blit_pal256)(unsigned char *src, int src_x, int src_y, int x, int y,
253 int width, int height);
254 void (*lcd_pal256_update_pal)(fb_data *palette);
255#endif
Jens Arnoldabe77a12004-08-01 21:50:57 +0000256 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
Jens Arnold1c841b82004-10-23 09:59:53 +0000257 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
258 int style);
Jonathan Gordon3e5b3892008-05-15 06:58:36 +0000259#ifdef HAVE_LCD_INVERT
260 void (*lcd_set_invert_display)(bool yesno);
261#endif /* HAVE_LCD_INVERT */
Andrew Mahoneeef79452009-05-06 04:53:56 +0000262#if defined(HAVE_LCD_MODES)
263 void (*lcd_set_mode)(int mode);
264#endif
Michael Giacomelli0e783b02008-12-25 04:24:47 +0000265
Thomas Martitzb7739fb2009-03-17 02:43:47 +0000266#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
Jonathan Gordonbdbdb972008-06-23 13:20:35 +0000267 struct event_queue *button_queue;
268#endif
Jens Arnold68a21682008-03-24 00:35:53 +0000269 unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation );
Michael Sevakisd5699982010-05-24 16:42:32 +0000270#ifdef HAVE_LCD_BITMAP
271 bool (*is_diacritic)(const unsigned short char_code, bool *is_rtl);
272#endif
Jens Arnold68a21682008-03-24 00:35:53 +0000273 const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code );
Jonathan Gordon1c2aa352010-02-14 06:26:16 +0000274 int (*font_load)(struct font*, const char *path);
Jens Arnold04daef12005-06-24 22:33:21 +0000275 struct font* (*font_get)(int font);
Jens Arnolde44372e2005-07-26 20:01:11 +0000276 int (*font_getstringsize)(const unsigned char *str, int *w, int *h,
277 int fontnumber);
Jens Arnolda36b1d42006-01-15 18:20:18 +0000278 int (*font_get_width)(struct font* pf, unsigned short char_code);
Jonathan Gordonfda7d722007-08-06 13:42:52 +0000279 void (*screen_clear_area)(struct screen * display, int xstart, int ystart,
280 int width, int height);
Jens Arnold68a21682008-03-24 00:35:53 +0000281 void (*gui_scrollbar_draw)(struct screen * screen, int x, int y,
282 int width, int height, int items,
283 int min_shown, int max_shown,
284 unsigned flags);
285#endif /* HAVE_LCD_BITMAP */
Michael Sevakis8cfbd362008-12-10 08:57:10 +0000286 const char* (*get_codepage_name)(int cp);
Jens Arnold68a21682008-03-24 00:35:53 +0000287
288 /* backlight */
Jens Arnold3aa58322008-10-31 20:06:08 +0000289 /* The backlight_* functions must be present in the API regardless whether
290 * HAVE_BACKLIGHT is defined or not. The reason is that the stock Ondio has
291 * no backlight but can be modded to have backlight (it's prepared on the
292 * PCB). This makes backlight an all-target feature API wise, and keeps API
293 * compatible between stock and modded Ondio.
294 * For OLED targets like the Sansa Clip, the backlight_* functions control
295 * the display enable, which has essentially the same effect. */
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000296 void (*backlight_on)(void);
297 void (*backlight_off)(void);
Jens Arnold1c841b82004-10-23 09:59:53 +0000298 void (*backlight_set_timeout)(int index);
Jonathan Gordon3e5b3892008-05-15 06:58:36 +0000299#ifdef HAVE_BACKLIGHT_BRIGHTNESS
300 void (*backlight_set_brightness)(int val);
301#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
Peter D'Hoye39718e32008-04-23 21:15:07 +0000302
Peter D'Hoyea5d4d672007-08-13 22:31:11 +0000303#if CONFIG_CHARGING
304 void (*backlight_set_timeout_plugged)(int index);
305#endif
Jens Arnoldac9b9272008-04-04 19:38:46 +0000306 bool (*is_backlight_on)(bool ignore_always_off);
Nils Wallménius01729e72008-08-15 08:27:39 +0000307 void (*splash)(int ticks, const char *str);
308 void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000309
Christian Gmeinerc63430e2005-04-15 12:55:31 +0000310#ifdef HAVE_REMOTE_LCD
Jens Arnold4c7da882005-06-18 01:25:47 +0000311 /* remote lcd */
Jens Arnold576908d2005-06-29 01:39:50 +0000312 void (*lcd_remote_set_contrast)(int x);
313 void (*lcd_remote_clear_display)(void);
314 void (*lcd_remote_puts)(int x, int y, const unsigned char *string);
Dave Chapmane9373102007-12-31 00:04:27 +0000315 void (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string);
316 void (*lcd_remote_stop_scroll)(void);
Jens Arnold576908d2005-06-29 01:39:50 +0000317 void (*lcd_remote_set_drawmode)(int mode);
318 int (*lcd_remote_get_drawmode)(void);
319 void (*lcd_remote_setfont)(int font);
320 int (*lcd_remote_getstringsize)(const unsigned char *str, int *w, int *h);
321 void (*lcd_remote_drawpixel)(int x, int y);
322 void (*lcd_remote_drawline)(int x1, int y1, int x2, int y2);
323 void (*lcd_remote_hline)(int x1, int x2, int y);
324 void (*lcd_remote_vline)(int x, int y1, int y2);
325 void (*lcd_remote_drawrect)(int x, int y, int nx, int ny);
326 void (*lcd_remote_fillrect)(int x, int y, int nx, int ny);
Jens Arnoldd7f94392005-07-07 00:05:29 +0000327 void (*lcd_remote_mono_bitmap_part)(const unsigned char *src, int src_x,
328 int src_y, int stride, int x, int y,
329 int width, int height);
330 void (*lcd_remote_mono_bitmap)(const unsigned char *src, int x, int y,
Jens Arnold576908d2005-06-29 01:39:50 +0000331 int width, int height);
Jens Arnold576908d2005-06-29 01:39:50 +0000332 void (*lcd_remote_putsxy)(int x, int y, const unsigned char *string);
333 void (*lcd_remote_puts_style)(int x, int y, const unsigned char *str, int style);
334 void (*lcd_remote_puts_scroll_style)(int x, int y, const unsigned char* string,
335 int style);
Jens Arnold05ddd9a2006-07-28 07:35:45 +0000336 fb_remote_data* lcd_remote_framebuffer;
Jens Arnold576908d2005-06-29 01:39:50 +0000337 void (*lcd_remote_update)(void);
338 void (*lcd_remote_update_rect)(int x, int y, int width, int height);
Jens Arnold4c7da882005-06-18 01:25:47 +0000339
Christian Gmeinerc63430e2005-04-15 12:55:31 +0000340 void (*remote_backlight_on)(void);
Jens Arnold4c7da882005-06-18 01:25:47 +0000341 void (*remote_backlight_off)(void);
Jens Arnold68a21682008-03-24 00:35:53 +0000342 void (*remote_backlight_set_timeout)(int index);
343#if CONFIG_CHARGING
344 void (*remote_backlight_set_timeout_plugged)(int index);
Christian Gmeinerc63430e2005-04-15 12:55:31 +0000345#endif
Jens Arnold68a21682008-03-24 00:35:53 +0000346#endif /* HAVE_REMOTE_LCD */
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000347 struct screen* screens[NB_SCREENS];
348#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
349 void (*lcd_remote_set_foreground)(unsigned foreground);
350 unsigned (*lcd_remote_get_foreground)(void);
Michael Sevakis6aa12c12006-10-14 01:32:58 +0000351 void (*lcd_remote_set_background)(unsigned background);
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000352 unsigned (*lcd_remote_get_background)(void);
Teruaki Kawashima0cbf2102009-12-20 12:59:25 +0000353 void (*lcd_remote_bitmap_part)(const fb_remote_data *src,
354 int src_x, int src_y, int stride,
355 int x, int y, int width, int height);
356 void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y,
357 int width, int height);
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000358#endif
Teruaki Kawashima0cbf2102009-12-20 12:59:25 +0000359 void (*viewport_set_defaults)(struct viewport *vp,
Jonathan Gordon1c2aa352010-02-14 06:26:16 +0000360 const enum screen_type screen);
361#ifdef HAVE_LCD_BITMAP
362 void (*viewportmanager_theme_enable)(enum screen_type screen, bool enable,
363 struct viewport *viewport);
364 void (*viewportmanager_theme_undo)(enum screen_type screen, bool force_redraw);
365#endif
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000366 /* list */
367 void (*gui_synclist_init)(struct gui_synclist * lists,
Steve Bavin65265772008-05-13 09:57:56 +0000368 list_get_name callback_get_item_name, void * data,
Jonathan Gordon5ca15392008-03-26 03:35:24 +0000369 bool scroll_all,int selected_size,
370 struct viewport parent[NB_SCREENS]);
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000371 void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items);
Teruaki Kawashima0cbf2102009-12-20 12:59:25 +0000372 void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists,
373 list_get_icon icon_callback);
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000374 int (*gui_synclist_get_nb_items)(struct gui_synclist * lists);
375 int (*gui_synclist_get_sel_pos)(struct gui_synclist * lists);
376 void (*gui_synclist_draw)(struct gui_synclist * lists);
377 void (*gui_synclist_select_item)(struct gui_synclist * lists,
Teruaki Kawashima0cbf2102009-12-20 12:59:25 +0000378 int item_number);
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000379 void (*gui_synclist_add_item)(struct gui_synclist * lists);
380 void (*gui_synclist_del_item)(struct gui_synclist * lists);
381 void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll);
Jonathan Gordoncf1cef52007-09-17 10:08:50 +0000382 bool (*gui_synclist_do_button)(struct gui_synclist * lists,
Jonathan Gordone385ee12008-12-31 05:59:26 +0000383 int *action, enum list_wrap wrap);
Nils Wallménius8e33c2f2009-10-11 09:40:47 +0000384 void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title,
Andrew Mahone1bc67c82009-07-11 00:22:26 +0000385 enum themable_icons icon);
Bertrik Sikken9464fdd2008-08-14 22:35:00 +0000386 enum yesno_res (*gui_syncyesno_run)(const struct text_message * main_message,
387 const struct text_message * yes_message,
388 const struct text_message * no_message);
Jonathan Gordonbdbdb972008-06-23 13:20:35 +0000389 void (*simplelist_info_init)(struct simplelist_info *info, char* title,
Teruaki Kawashima0cbf2102009-12-20 12:59:25 +0000390 int count, void* data);
Jonathan Gordonbdbdb972008-06-23 13:20:35 +0000391 bool (*simplelist_show_list)(struct simplelist_info *info);
Michael Sevakis6aa12c12006-10-14 01:32:58 +0000392
Björn Stenbergba371fb2003-06-29 16:33:04 +0000393 /* button */
Jean-Philippe Bernardy58046642005-02-07 23:11:20 +0000394 long (*button_get)(bool block);
395 long (*button_get_w_tmo)(int ticks);
Jonathan Gordon7e264122008-05-15 07:13:03 +0000396 int (*button_status)(void);
Jonathan Gordon3e5b3892008-05-15 06:58:36 +0000397#ifdef HAVE_BUTTON_DATA
398 intptr_t (*button_get_data)(void);
Thomas Martitzd85c3ec2009-10-20 21:54:59 +0000399 int (*button_status_wdata)(int *pdata);
Jonathan Gordon3e5b3892008-05-15 06:58:36 +0000400#endif
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000401 void (*button_clear_queue)(void);
Michael Giacomelli0e783b02008-12-25 04:24:47 +0000402 int (*button_queue_count)(void);
Zakk Roberts07fcf772006-05-01 05:45:18 +0000403#ifdef HAS_BUTTON_HOLD
Jens Arnold4c7da882005-06-18 01:25:47 +0000404 bool (*button_hold)(void);
405#endif
Maurus Cuelenaere1392dc22008-08-23 09:46:38 +0000406#ifdef HAVE_TOUCHSCREEN
407 void (*touchscreen_set_mode)(enum touchscreen_mode);
Jonathan Gordon7e264122008-05-15 07:13:03 +0000408#endif
Jonathan Gordon3e5b3892008-05-15 06:58:36 +0000409#ifdef HAVE_BUTTON_LIGHT
410 void (*buttonlight_set_timeout)(int value);
411 void (*buttonlight_off)(void);
412 void (*buttonlight_on)(void);
413#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
414 void (*buttonlight_set_brightness)(int val);
415#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
416#endif /* HAVE_BUTTON_LIGHT */
Björn Stenbergba371fb2003-06-29 16:33:04 +0000417
418 /* file */
Jonathan Gordon1c2aa352010-02-14 06:26:16 +0000419 int (*open_utf8)(const char* pathname, int flags);
Thomas Martitz0a1d7c22010-05-06 17:35:13 +0000420 int (*open)(const char* pathname, int flags, ...);
Björn Stenberga36cdf52009-01-07 09:53:46 +0000421 int (*close)(int fd);
422 ssize_t (*read)(int fd, void* buf, size_t count);
423 off_t (*lseek)(int fd, off_t offset, int whence);
Thomas Martitzc61e89c2010-05-06 17:35:04 +0000424 int (*creat)(const char *pathname, mode_t mode);
Björn Stenberga36cdf52009-01-07 09:53:46 +0000425 ssize_t (*write)(int fd, const void* buf, size_t count);
426 int (*remove)(const char* pathname);
427 int (*rename)(const char* path, const char* newname);
428 int (*ftruncate)(int fd, off_t length);
429 off_t (*filesize)(int fd);
Jens Arnold79c8a8c2007-03-17 09:02:53 +0000430 int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000431 int (*read_line)(int fd, char* buffer, int buffer_size);
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000432 bool (*settings_parseline)(char* line, char** name, char** value);
Frank Gevaerts2f8a0082008-11-01 16:14:28 +0000433 void (*storage_sleep)(void);
434 void (*storage_spin)(void);
435 void (*storage_spindown)(int seconds);
436#if USING_STORAGE_CALLBACK
Thomas Martitz774bacc2009-10-20 21:54:44 +0000437 void (*register_storage_idle_func)(void (*function)(void *data));
438 void (*unregister_storage_idle_func)(void (*function)(void *data), bool run);
Frank Gevaerts2f8a0082008-11-01 16:14:28 +0000439#endif /* USING_STORAGE_CALLBACK */
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000440 void (*reload_directory)(void);
Michael Sevakisea255fb2007-06-22 09:34:57 +0000441 char *(*create_numbered_filename)(char *buffer, const char *path,
442 const char *prefix, const char *suffix,
443 int numberlen IF_CNFN_NUM_(, int *num));
Jens Arnold68a21682008-03-24 00:35:53 +0000444 bool (*file_exists)(const char *file);
Thomas Martitz54810902009-02-11 16:37:12 +0000445 char* (*strip_extension)(char* buffer, int buffer_size, const char *filename);
Jonathan Gordon1c2aa352010-02-14 06:26:16 +0000446 unsigned (*crc_32)(const void *src, unsigned len, unsigned crc32);
Jens Arnold68a21682008-03-24 00:35:53 +0000447
Michael Sevakis2da0f9b2011-01-20 17:11:23 +0000448 int (*filetype_get_attr)(const char* file);
449
450
Zakk Roberts07fcf772006-05-01 05:45:18 +0000451
Björn Stenbergba371fb2003-06-29 16:33:04 +0000452 /* dir */
Kevin Ferrare011a3252007-07-20 17:06:55 +0000453 DIR* (*opendir)(const char* name);
454 int (*closedir)(DIR* dir);
455 struct dirent* (*readdir)(DIR* dir);
456 int (*mkdir)(const char *name);
457 int (*rmdir)(const char *name);
Jens Arnold68a21682008-03-24 00:35:53 +0000458 bool (*dir_exists)(const char *path);
Nils Wallménius8123dff2010-10-16 12:30:06 +0000459 struct dirinfo (*dir_get_info)(DIR* parent, struct dirent *entry);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000460
Michael Sevakis2da0f9b2011-01-20 17:11:23 +0000461 /* browsing */
462 void (*browse_context_init)(struct browse_context *browse,
463 int dirfilter, unsigned flags,
464 char *title, enum themable_icons icon,
465 const char *root, const char *selected);
466 int (*rockbox_browse)(struct browse_context *browse);
467
Jens Arnold1c841b82004-10-23 09:59:53 +0000468 /* kernel/ system */
Rafaël Carré851be212010-08-03 19:00:29 +0000469#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE
Thomas Martitz54810902009-02-11 16:37:12 +0000470 void (*__div0)(void);
471#endif
Thomas Martitz6eaab4d2010-09-01 21:29:34 +0000472 unsigned (*sleep)(unsigned ticks);
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000473 void (*yield)(void);
Michael Sevakis6bba70b2007-06-25 20:46:54 +0000474 volatile long* current_tick;
Jean-Philippe Bernardyf64939e2005-02-07 22:56:37 +0000475 long (*default_event_handler)(long event);
Teruaki Kawashima0cbf2102009-12-20 12:59:25 +0000476 long (*default_event_handler_ex)(long event,
477 void (*callback)(void *), void *parameter);
Michael Sevakis8cfbd362008-12-10 08:57:10 +0000478 unsigned int (*create_thread)(void (*function)(void), void* stack,
479 size_t stack_size, unsigned flags,
480 const char *name
481 IF_PRIO(, int priority)
482 IF_COP(, unsigned int core));
Michael Sevakis56dd75d2011-03-16 05:38:37 +0000483 unsigned int (*thread_self)(void);
Michael Sevakis27cf6772008-03-25 02:34:12 +0000484 void (*thread_exit)(void);
Michael Sevakis8cfbd362008-12-10 08:57:10 +0000485 void (*thread_wait)(unsigned int thread_id);
Jens Arnold68a21682008-03-24 00:35:53 +0000486#if CONFIG_CODEC == SWCODEC
Michael Sevakis20546272009-01-05 10:31:19 +0000487 void (*thread_thaw)(unsigned int thread_id);
488#ifdef HAVE_PRIORITY_SCHEDULING
489 int (*thread_set_priority)(unsigned int thread_id, int priority);
490#endif
Jens Arnold68a21682008-03-24 00:35:53 +0000491 void (*mutex_init)(struct mutex *m);
492 void (*mutex_lock)(struct mutex *m);
493 void (*mutex_unlock)(struct mutex *m);
Jens Arnold68a21682008-03-24 00:35:53 +0000494#endif
495
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000496 void (*reset_poweroff_timer)(void);
Thomas Martitz35e8b142010-06-21 16:53:00 +0000497#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
Jens Arnold1c841b82004-10-23 09:59:53 +0000498 int (*system_memory_guard)(int newmode);
Jens Arnold4c7da882005-06-18 01:25:47 +0000499 long *cpu_frequency;
500#ifdef HAVE_ADJUSTABLE_CPU_FREQ
Jonathan Gordonf8c68c72007-01-22 10:41:25 +0000501#ifdef CPU_BOOST_LOGGING
502 void (*cpu_boost_)(bool on_off,char*location,int line);
503#else
Jens Arnold4c7da882005-06-18 01:25:47 +0000504 void (*cpu_boost)(bool on_off);
505#endif
Jens Arnold68a21682008-03-24 00:35:53 +0000506#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
Thomas Martitz35e8b142010-06-21 16:53:00 +0000507#endif /* PLATFORM_NATIVE */
Jens Arnold68a21682008-03-24 00:35:53 +0000508#ifdef HAVE_SCHEDULER_BOOSTCTRL
509 void (*trigger_cpu_boost)(void);
510 void (*cancel_cpu_boost)(void);
Jonathan Gordonf8c68c72007-01-22 10:41:25 +0000511#endif
Nils Wallménius8123dff2010-10-16 12:30:06 +0000512
Michael Sevakis21f0c9a2009-02-11 12:55:51 +0000513 void (*cpucache_flush)(void);
514 void (*cpucache_invalidate)(void);
Nils Wallménius8123dff2010-10-16 12:30:06 +0000515
516 /* load code api for overlay */
517 void* (*lc_open)(const char *filename, unsigned char *buf, size_t buf_size);
518 void* (*lc_open_from_mem)(void* addr, size_t blob_size);
519 void* (*lc_get_header)(void *handle);
520 void (*lc_close)(void *handle);
521
Jens Arnolde44372e2005-07-26 20:01:11 +0000522 bool (*timer_register)(int reg_prio, void (*unregister_callback)(void),
Rafaël Carré89ccd5c2009-06-29 14:29:46 +0000523 long cycles, void (*timer_callback)(void)
524 IF_COP(, int core));
Jens Arnolde44372e2005-07-26 20:01:11 +0000525 void (*timer_unregister)(void);
526 bool (*timer_set_period)(long count);
Kevin Ferrare81aac2a2007-07-29 03:43:37 +0000527
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000528 void (*queue_init)(struct event_queue *q, bool register_queue);
Brandon Low413da2a2006-02-07 20:38:55 +0000529 void (*queue_delete)(struct event_queue *q);
Michael Sevakis4b902672006-12-19 16:50:07 +0000530 void (*queue_post)(struct event_queue *q, long id, intptr_t data);
Michael Sevakisa9b2fb52007-10-16 01:25:17 +0000531 void (*queue_wait_w_tmo)(struct event_queue *q, struct queue_event *ev,
Brandon Low413da2a2006-02-07 20:38:55 +0000532 int ticks);
Jens Arnold68a21682008-03-24 00:35:53 +0000533#if CONFIG_CODEC == SWCODEC
534 void (*queue_enable_queue_send)(struct event_queue *q,
Michael Sevakis27cf6772008-03-25 02:34:12 +0000535 struct queue_sender_list *send,
Michael Sevakis8cfbd362008-12-10 08:57:10 +0000536 unsigned int thread_id);
Jens Arnold68a21682008-03-24 00:35:53 +0000537 bool (*queue_empty)(const struct event_queue *q);
538 void (*queue_wait)(struct event_queue *q, struct queue_event *ev);
539 intptr_t (*queue_send)(struct event_queue *q, long id,
540 intptr_t data);
541 void (*queue_reply)(struct event_queue *q, intptr_t retval);
542#endif /* CONFIG_CODEC == SWCODEC */
543
Brandon Low413da2a2006-02-07 20:38:55 +0000544 void (*usb_acknowledge)(long id);
Tomer Shalev8c5141b2009-09-30 10:06:04 +0000545#ifdef USB_ENABLE_HID
Thomas Martitz2287dd92009-08-03 15:09:41 +0000546 void (*usb_hid_send)(usage_page_t usage_page, int id);
547#endif
Brandon Low413da2a2006-02-07 20:38:55 +0000548#ifdef RB_PROFILE
549 void (*profile_thread)(void);
550 void (*profstop)(void);
551 void (*profile_func_enter)(void *this_fn, void *call_site);
552 void (*profile_func_exit)(void *this_fn, void *call_site);
553#endif
Thomas Martitzd85c3ec2009-10-20 21:54:59 +0000554 /* event api */
555 bool (*add_event)(unsigned short id, bool oneshot, void (*handler)(void *data));
556 void (*remove_event)(unsigned short id, void (*handler)(void *data));
557 void (*send_event)(unsigned short id, void *data);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000558
Thomas Martitz35e8b142010-06-21 16:53:00 +0000559#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
Jens Arnold06bc6272006-03-11 09:28:49 +0000560 /* special simulator hooks */
561#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
Jens Arnold0d935ce2009-02-09 00:32:59 +0000562 void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int));
Jens Arnold06bc6272006-03-11 09:28:49 +0000563 void (*sim_lcd_ex_update_rect)(int x, int y, int width, int height);
564#endif
565#endif
566
Björn Stenbergba371fb2003-06-29 16:33:04 +0000567 /* strings and memory */
Jens Arnold79c8a8c2007-03-17 09:02:53 +0000568 int (*snprintf)(char *buf, size_t size, const char *fmt, ...)
569 ATTRIBUTE_PRINTF(3, 4);
Thomas Martitz50a6ca32010-05-06 21:04:40 +0000570 int (*vsnprintf)(char *buf, size_t size, const char *fmt, va_list ap);
Jens Arnold1c841b82004-10-23 09:59:53 +0000571 char* (*strcpy)(char *dst, const char *src);
Nils Wallménius3d4701a2009-07-14 13:57:45 +0000572 size_t (*strlcpy)(char *dst, const char *src, size_t length);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000573 size_t (*strlen)(const char *str);
Linus Nielsen Feltzinga96a1302004-07-13 14:14:30 +0000574 char * (*strrchr)(const char *s, int c);
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000575 int (*strcmp)(const char *, const char *);
Jens Arnolde44372e2005-07-26 20:01:11 +0000576 int (*strncmp)(const char *, const char *, size_t);
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000577 int (*strcasecmp)(const char *, const char *);
Jens Arnold1c841b82004-10-23 09:59:53 +0000578 int (*strncasecmp)(const char *s1, const char *s2, size_t n);
579 void* (*memset)(void *dst, int c, size_t length);
580 void* (*memcpy)(void *out, const void *in, size_t n);
Brandon Low413da2a2006-02-07 20:38:55 +0000581 void* (*memmove)(void *out, const void *in, size_t n);
Thomas Martitz35e8b142010-06-21 16:53:00 +0000582#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
Maurus Cuelenaerecf875972009-05-21 19:01:41 +0000583 const unsigned char *_rbctype_;
Thomas Martitz3cca7e82010-05-14 12:37:05 +0000584#endif
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000585 int (*atoi)(const char *str);
Daniel Stenberg22b77012005-02-22 12:19:12 +0000586 char *(*strchr)(const char *s, int c);
587 char *(*strcat)(char *s1, const char *s2);
Jonathan Gordon1c2aa352010-02-14 06:26:16 +0000588 size_t (*strlcat)(char *dst, const char *src, size_t length);
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000589 void *(*memchr)(const void *s1, int c, size_t n);
Daniel Stenberg22b77012005-02-22 12:19:12 +0000590 int (*memcmp)(const void *s1, const void *s2, size_t n);
Jens Arnold4c7da882005-06-18 01:25:47 +0000591 char *(*strcasestr) (const char* phaystack, const char* pneedle);
Jonathan Gordon29e259a2006-10-31 11:17:00 +0000592 char* (*strtok_r)(char *ptr, const char *sep, char **end);
Jens Arnolda36b1d42006-01-15 18:20:18 +0000593 /* unicode stuff */
594 const unsigned char* (*utf8decode)(const unsigned char *utf8, unsigned short *ucs);
595 unsigned char* (*iso_decode)(const unsigned char *iso, unsigned char *utf8, int cp, int count);
Miika Pekkarinenb40eb3d2006-07-25 18:12:57 +0000596 unsigned char* (*utf16LEdecode)(const unsigned char *utf16, unsigned char *utf8, int count);
597 unsigned char* (*utf16BEdecode)(const unsigned char *utf16, unsigned char *utf8, int count);
Jens Arnolda36b1d42006-01-15 18:20:18 +0000598 unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8);
599 unsigned long (*utf8length)(const unsigned char *utf8);
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000600 int (*utf8seek)(const unsigned char* utf8, int offset);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000601
602 /* sound */
Linus Nielsen Feltzing674eaca2005-04-01 13:41:03 +0000603 void (*sound_set)(int setting, int value);
Jens Arnold68a21682008-03-24 00:35:53 +0000604 int (*sound_default)(int setting);
Jens Arnolda36b1d42006-01-15 18:20:18 +0000605 int (*sound_min)(int setting);
606 int (*sound_max)(int setting);
Jens Arnold68a21682008-03-24 00:35:53 +0000607 const char * (*sound_unit)(int setting);
608 int (*sound_val2phys)(int setting, int value);
Michael Sevakisd5699982010-05-24 16:42:32 +0000609#ifdef AUDIOHW_HAVE_EQ
610 int (*sound_enum_hw_eq_band_setting)(unsigned int band,
611 unsigned int band_setting);
612#endif /* AUDIOHW_HAVE_EQ */
Thomas Martitz35e8b142010-06-21 16:53:00 +0000613#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
Teruaki Kawashima0cbf2102009-12-20 12:59:25 +0000614 void (*mp3_play_data)(const unsigned char* start, int size,
615 void (*get_more)(unsigned char** start, size_t* size));
Jörg Hohensohn95298a92004-01-30 22:30:40 +0000616 void (*mp3_play_pause)(bool play);
617 void (*mp3_play_stop)(void);
618 bool (*mp3_is_playing)(void);
Jens Arnoldd6c05452005-08-29 21:15:27 +0000619#if CONFIG_CODEC != SWCODEC
Jörg Hohensohn95298a92004-01-30 22:30:40 +0000620 void (*bitswap)(unsigned char *data, int length);
Jörg Hohensohnfacfec02004-02-03 23:56:25 +0000621#endif
Thomas Martitz35e8b142010-06-21 16:53:00 +0000622#endif /* PLATFORM_NATIVE */
Jens Arnoldd6c05452005-08-29 21:15:27 +0000623#if CONFIG_CODEC == SWCODEC
Michael Sevakis6689cb02007-04-10 14:18:30 +0000624 const unsigned long *audio_master_sampr_list;
625 const unsigned long *hw_freq_sampr;
Michael Sevakis6689cb02007-04-10 14:18:30 +0000626 void (*pcm_apply_settings)(void);
Michael Sevakisd5699982010-05-24 16:42:32 +0000627 void (*pcm_play_data)(pcm_play_callback_type get_more,
Brandon Low413da2a2006-02-07 20:38:55 +0000628 unsigned char* start, size_t size);
Jens Arnold4c7da882005-06-18 01:25:47 +0000629 void (*pcm_play_stop)(void);
630 void (*pcm_set_frequency)(unsigned int frequency);
631 bool (*pcm_is_playing)(void);
Michael Sevakis6689cb02007-04-10 14:18:30 +0000632 bool (*pcm_is_paused)(void);
Jens Arnold4c7da882005-06-18 01:25:47 +0000633 void (*pcm_play_pause)(bool play);
Michael Sevakis6689cb02007-04-10 14:18:30 +0000634 size_t (*pcm_get_bytes_waiting)(void);
Jens Arnolddae698c2006-03-11 09:38:12 +0000635 void (*pcm_calculate_peaks)(int *left, int *right);
Frank Gevaerts43264a92010-02-10 19:44:11 +0000636 const void* (*pcm_get_peak_buffer)(int *count);
Jens Arnold68a21682008-03-24 00:35:53 +0000637 void (*pcm_play_lock)(void);
638 void (*pcm_play_unlock)(void);
Michael Sevakisa2b67032011-06-29 06:37:04 +0000639 void (*beep_play)(unsigned int frequency, unsigned int duration,
640 unsigned int amplitude);
Michael Sevakis6689cb02007-04-10 14:18:30 +0000641#ifdef HAVE_RECORDING
642 const unsigned long *rec_freq_sampr;
Michael Sevakis6689cb02007-04-10 14:18:30 +0000643 void (*pcm_init_recording)(void);
644 void (*pcm_close_recording)(void);
Michael Sevakisd5699982010-05-24 16:42:32 +0000645 void (*pcm_record_data)(pcm_rec_callback_type more_ready,
Michael Sevakis6689cb02007-04-10 14:18:30 +0000646 void *start, size_t size);
Michael Sevakis6689cb02007-04-10 14:18:30 +0000647 void (*pcm_stop_recording)(void);
648 void (*pcm_calculate_rec_peaks)(int *left, int *right);
649 void (*audio_set_recording_gain)(int left, int right, int type);
Michael Sevakis6689cb02007-04-10 14:18:30 +0000650#endif /* HAVE_RECORDING */
Michael Sevakis2d48d0f2007-06-08 23:42:04 +0000651#if INPUT_SRC_CAPS != 0
652 void (*audio_set_output_source)(int monitor);
653 void (*audio_set_input_source)(int source, unsigned flags);
Jens Arnolddae698c2006-03-11 09:38:12 +0000654#endif
Jens Arnold68a21682008-03-24 00:35:53 +0000655 void (*dsp_set_crossfeed)(bool enable);
656 void (*dsp_set_eq)(bool enable);
657 void (*dsp_dither_enable)(bool enable);
658 intptr_t (*dsp_configure)(struct dsp_config *dsp, int setting,
659 intptr_t value);
660 int (*dsp_process)(struct dsp_config *dsp, char *dest,
661 const char *src[], int count);
Jeffrey Goode0dc2fb52009-08-12 18:12:25 +0000662 int (*dsp_input_count)(struct dsp_config *dsp, int count);
663 int (*dsp_output_count)(struct dsp_config *dsp, int count);
Michael Sevakis2d48d0f2007-06-08 23:42:04 +0000664#endif /* CONFIG_CODEC == SWCODC */
Jörg Hohensohn68002762004-04-30 20:37:11 +0000665
666 /* playback control */
Michael Sevakis6689cb02007-04-10 14:18:30 +0000667 int (*playlist_amount)(void);
668 int (*playlist_resume)(void);
Thomas Martitzf0aa8ba2009-05-31 14:33:33 +0000669 void (*playlist_start)(int start_index, int offset);
Andrew Mahonec1c3d052009-06-01 21:08:49 +0000670 int (*playlist_add)(const char *filename);
671 void (*playlist_sync)(struct playlist_info* playlist);
672 int (*playlist_remove_all_tracks)(struct playlist_info *playlist);
673 int (*playlist_create)(const char *dir, const char *file);
674 int (*playlist_insert_track)(struct playlist_info* playlist,
675 const char *filename, int position, bool queue, bool sync);
Jonathan Gordonf1034e02009-07-05 18:07:58 +0000676 int (*playlist_insert_directory)(struct playlist_info* playlist,
677 const char *dirname, int position, bool queue,
678 bool recurse);
Andrew Mahonec1c3d052009-06-01 21:08:49 +0000679 int (*playlist_shuffle)(int random_seed, int start_index);
Björn Stenberga36cdf52009-01-07 09:53:46 +0000680 void (*audio_play)(long offset);
Linus Nielsen Feltzing8a237a82005-04-04 12:06:29 +0000681 void (*audio_stop)(void);
682 void (*audio_pause)(void);
683 void (*audio_resume)(void);
684 void (*audio_next)(void);
685 void (*audio_prev)(void);
Steve Bavin135cc752008-03-28 12:51:33 +0000686 void (*audio_ff_rewind)(long newtime);
Linus Nielsen Feltzing8a237a82005-04-04 12:06:29 +0000687 struct mp3entry* (*audio_next_track)(void);
Linus Nielsen Feltzing8a237a82005-04-04 12:06:29 +0000688 int (*audio_status)(void);
Linus Nielsen Feltzing8a237a82005-04-04 12:06:29 +0000689 struct mp3entry* (*audio_current_track)(void);
690 void (*audio_flush_and_reload_tracks)(void);
691 int (*audio_get_file_pos)(void);
Jens Arnoldd6c05452005-08-29 21:15:27 +0000692#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
Linus Nielsen Feltzing78c829f2005-04-25 08:21:10 +0000693 unsigned long (*mpeg_get_last_header)(void);
Linus Nielsen Feltzingef73c2e2005-04-25 08:59:19 +0000694#endif
Frank Gevaertsf3660902010-09-17 20:28:47 +0000695#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
696 (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHSCREEN)
Alexander Levincc7c6652009-07-11 16:46:19 +0000697 void (*sound_set_pitch)(int32_t pitch);
Dan Everton76992552006-03-05 19:46:33 +0000698#endif
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000699
700 /* MAS communication */
Jens Arnoldd6c05452005-08-29 21:15:27 +0000701#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000702 int (*mas_readmem)(int bank, int addr, unsigned long* dest, int len);
Jens Arnold0ceaa5e2004-08-17 01:45:48 +0000703 int (*mas_writemem)(int bank, int addr, const unsigned long* src, int len);
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000704 int (*mas_readreg)(int reg);
705 int (*mas_writereg)(int reg, unsigned int val);
Jens Arnoldd6c05452005-08-29 21:15:27 +0000706#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000707 int (*mas_codec_writereg)(int reg, unsigned int val);
708 int (*mas_codec_readreg)(int reg);
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000709 void (*i2c_begin)(void);
710 void (*i2c_end)(void);
Bertrik Sikkene5319e02008-04-28 14:33:03 +0000711 int (*i2c_write)(int address, const unsigned char* buf, int count );
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000712#endif
713#endif
Jens Arnold1c841b82004-10-23 09:59:53 +0000714
Jens Arnolda36b1d42006-01-15 18:20:18 +0000715 /* menu */
Jonathan Gordon5ca15392008-03-26 03:35:24 +0000716 int (*do_menu)(const struct menu_item_ex *menu, int *start_selected,
Thomas Martitz5629d552010-01-26 20:14:42 +0000717 struct viewport parent[NB_SCREENS], bool hide_theme);
Jens Arnolda36b1d42006-01-15 18:20:18 +0000718
Jonathan Gordon77a458a2007-05-08 11:55:43 +0000719 /* scroll bar */
720 struct gui_syncstatusbar *statusbars;
721 void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw);
Michael Giacomelli0e783b02008-12-25 04:24:47 +0000722
Jonathan Gordon77a458a2007-05-08 11:55:43 +0000723 /* options */
Michael Sevakis8cfbd362008-12-10 08:57:10 +0000724 const struct settings_list* (*get_settings_list)(int*count);
Steve Bavincd88e2a2008-03-25 15:24:03 +0000725 const struct settings_list* (*find_setting)(const void* variable, int *id);
Jonathan Gordon3e5b3892008-05-15 06:58:36 +0000726 bool (*option_screen)(const struct settings_list *setting,
Jonathan Gordonfe9dca32008-04-23 11:07:40 +0000727 struct viewport parent[NB_SCREENS],
Jonathan Gordonfe2b3762007-07-23 05:40:45 +0000728 bool use_temp_var, unsigned char* option_title);
Steve Bavincd88e2a2008-03-25 15:24:03 +0000729 bool (*set_option)(const char* string, const void* variable,
Steve Bavin135cc752008-03-28 12:51:33 +0000730 enum optiontype type, const struct opt_items* options,
731 int numoptions, void (*function)(int));
Steve Bavincd88e2a2008-03-25 15:24:03 +0000732 bool (*set_bool_options)(const char* string, const bool* variable,
Steve Bavin135cc752008-03-28 12:51:33 +0000733 const char* yes_str, int yes_voice,
734 const char* no_str, int no_voice,
Michael Sevakisea255fb2007-06-22 09:34:57 +0000735 void (*function)(bool));
Steve Bavin135cc752008-03-28 12:51:33 +0000736 bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
Michael Giacomelli0e783b02008-12-25 04:24:47 +0000737 const int* variable, void (*function)(int), int step,
738 int min, int max,
Nils Wallménius3200d042009-08-20 16:47:44 +0000739 const char* (*formatter)(char*, size_t, int, const char*) );
Steve Bavincd88e2a2008-03-25 15:24:03 +0000740 bool (*set_bool)(const char* string, const bool* variable );
Hristo Kovachevf53f64a2006-03-21 09:36:13 +0000741
Michael Sevakisea255fb2007-06-22 09:34:57 +0000742#ifdef HAVE_LCD_COLOR
Teruaki Kawashima1549b192010-02-11 14:18:31 +0000743 bool (*set_color)(struct screen *display, char *title,
744 unsigned *color, unsigned banned_color);
Michael Sevakisea255fb2007-06-22 09:34:57 +0000745#endif
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000746 /* action handling */
747 int (*get_custom_action)(int context,int timeout,
748 const struct button_mapping* (*get_context_map)(int));
749 int (*get_action)(int context, int timeout);
Andrew Mahonec1c3d052009-06-01 21:08:49 +0000750#ifdef HAVE_TOUCHSCREEN
751 int (*action_get_touchscreen_press)(short *x, short *y);
752#endif
Miika Pekkarinena85044b2006-09-16 16:18:11 +0000753 bool (*action_userabort)(int timeout);
Hristo Kovachevf53f64a2006-03-21 09:36:13 +0000754
Brandon Low413da2a2006-02-07 20:38:55 +0000755 /* power */
756 int (*battery_level)(void);
757 bool (*battery_level_safe)(void);
758 int (*battery_time)(void);
Thomas Martitz35e8b142010-06-21 16:53:00 +0000759#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
Brandon Low413da2a2006-02-07 20:38:55 +0000760 unsigned int (*battery_voltage)(void);
761#endif
Jonathan Gordon9a6f4192007-02-18 05:32:06 +0000762#if CONFIG_CHARGING
Brandon Low413da2a2006-02-07 20:38:55 +0000763 bool (*charger_inserted)(void);
Bertrik Sikken52d29802009-03-24 21:59:44 +0000764# if CONFIG_CHARGING >= CHARGING_MONITOR
Brandon Low413da2a2006-02-07 20:38:55 +0000765 bool (*charging_state)(void);
Dan Evertond1088492006-03-05 19:34:54 +0000766# endif
Brandon Low413da2a2006-02-07 20:38:55 +0000767#endif
768#ifdef HAVE_USB_POWER
769 bool (*usb_powered)(void);
770#endif
771
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000772 /* misc */
Thomas Martitz35e8b142010-06-21 16:53:00 +0000773#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
Jonathan Gordon1c2aa352010-02-14 06:26:16 +0000774 int* __errno;
775#endif
Jean-Philippe Bernardyeffb1962005-02-15 13:28:39 +0000776 void (*srand)(unsigned int seed);
777 int (*rand)(void);
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000778 void (*qsort)(void *base, size_t nmemb, size_t size,
779 int(*compar)(const void *, const void *));
780 int (*kbd_input)(char* buffer, int buflen);
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000781 struct tm* (*get_time)(void);
Jens Arnold0ceaa5e2004-08-17 01:45:48 +0000782 int (*set_time)(const struct tm *tm);
Tom Rosse1147b82007-07-30 05:19:05 +0000783#if CONFIG_RTC
784 time_t (*mktime)(struct tm *t);
785#endif
Michael Sevakis26d242a2007-04-21 18:38:25 +0000786 void* (*plugin_get_buffer)(size_t *buffer_size);
787 void* (*plugin_get_audio_buffer)(size_t *buffer_size);
Jonathan Gordon29e259a2006-10-31 11:17:00 +0000788 void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
Jonathan Gordonfda7d722007-08-06 13:42:52 +0000789 char* (*plugin_get_current_filename)(void);
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000790#if defined(DEBUG) || defined(SIMULATOR)
Jens Arnold79c8a8c2007-03-17 09:02:53 +0000791 void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000792#endif
Jens Arnolde44372e2005-07-26 20:01:11 +0000793#ifdef ROCKBOX_HAS_LOGF
Jens Arnold79c8a8c2007-03-17 09:02:53 +0000794 void (*logf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
Jens Arnolde44372e2005-07-26 20:01:11 +0000795#endif
Linus Nielsen Feltzingf4f41112004-07-27 14:10:48 +0000796 struct user_settings* global_settings;
Michael Sevakis6689cb02007-04-10 14:18:30 +0000797 struct system_status *global_status;
Steve Bavin32a95752007-10-19 15:31:42 +0000798 void (*talk_disable)(bool disable);
Michael Sevakisa9b2fb52007-10-16 01:25:17 +0000799#if CONFIG_CODEC == SWCODEC
Michael Sevakis20546272009-01-05 10:31:19 +0000800 void (*codec_thread_do_callback)(void (*fn)(void),
801 unsigned int *audio_thread_id);
Michael Sevakisc537d592011-04-27 03:08:23 +0000802 int (*codec_load_file)(const char* codec, struct codec_api *api);
803 int (*codec_run_proc)(void);
804 int (*codec_close)(void);
Michael Sevakisa9b2fb52007-10-16 01:25:17 +0000805 const char *(*get_codec_filename)(int cod_spec);
Michael Sevakisd5699982010-05-24 16:42:32 +0000806 void ** (*find_array_ptr)(void **arr, void *ptr);
807 int (*remove_array_ptr)(void **arr, void *ptr);
Michael Sevakiscf733402010-07-01 00:26:01 +0000808 int (*round_value_to_list32)(unsigned long value,
809 const unsigned long list[],
810 int count,
811 bool signd);
Michael Sevakisd5699982010-05-24 16:42:32 +0000812#endif /* CONFIG_CODEC == SWCODEC */
Andrew Mahone6f030a02009-03-06 01:08:02 +0000813 bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
Thom Johansen294ec1d2007-09-19 10:40:55 +0000814 bool (*mp3info)(struct mp3entry *entry, const char *filename);
Linus Nielsen Feltzing70de4ec2004-07-27 19:16:58 +0000815 int (*count_mp3_frames)(int fd, int startpos, int filesize,
816 void (*progressfunc)(int));
Jens Arnoldba966c12005-09-15 05:29:26 +0000817 int (*create_xing_header)(int fd, long startpos, long filesize,
Brandon Low413da2a2006-02-07 20:38:55 +0000818 unsigned char *buf, unsigned long num_frames,
819 unsigned long rec_time, unsigned long header_template,
820 void (*progressfunc)(int), bool generate_toc);
Jean-Philippe Bernardy3f65c3f2005-01-30 14:33:33 +0000821 unsigned long (*find_next_frame)(int fd, long *offset,
Andree Buschmann25246f72011-03-16 18:45:03 +0000822 long max_offset, unsigned long reference_header);
Brandon Low413da2a2006-02-07 20:38:55 +0000823
Jens Arnoldd6c05452005-08-29 21:15:27 +0000824#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
Jens Arnold1c841b82004-10-23 09:59:53 +0000825 unsigned short (*peak_meter_scale_value)(unsigned short val,
826 int meterwidth);
Jens Arnold99a05982005-08-29 20:07:17 +0000827 void (*peak_meter_set_use_dbfs)(bool use);
828 bool (*peak_meter_get_use_dbfs)(void);
Jens Arnold1c841b82004-10-23 09:59:53 +0000829#endif
Linus Nielsen Feltzing250678b2005-04-25 07:42:10 +0000830#ifdef HAVE_LCD_BITMAP
Nicolas Pennequinec6569e2007-11-10 13:26:11 +0000831 int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize,
Andrew Mahone90586202008-12-26 07:05:13 +0000832 int format, const struct custom_format *cformat);
Andrew Mahoneeef79452009-05-06 04:53:56 +0000833 int (*read_bmp_fd)(int fd, struct bitmap *bm, int maxsize,
834 int format, const struct custom_format *cformat);
835#ifdef HAVE_JPEG
836 int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize,
837 int format, const struct custom_format *cformat);
838 int (*read_jpeg_fd)(int fd, struct bitmap *bm, int maxsize,
839 int format, const struct custom_format *cformat);
840#endif
Jens Arnolda36b1d42006-01-15 18:20:18 +0000841 void (*screen_dump_set_hook)(void (*hook)(int fh));
Linus Nielsen Feltzing250678b2005-04-25 07:42:10 +0000842#endif
Linus Nielsen Feltzing60895bc2005-09-02 05:39:09 +0000843 int (*show_logo)(void);
Hristo Kovachevcc6f37b2006-02-18 20:51:34 +0000844 struct tree_context* (*tree_get_context)(void);
Teruaki Kawashima368e89e2010-10-22 12:50:14 +0000845 void (*set_current_file)(const char* path);
Jonathan Gordonfda7d722007-08-06 13:42:52 +0000846 void (*set_dirfilter)(int l_dirfilter);
Dan Evertond1088492006-03-05 19:34:54 +0000847
Dave Chapman491458e2006-09-26 19:25:52 +0000848#ifdef HAVE_WHEEL_POSITION
849 int (*wheel_status)(void);
850 void (*wheel_send_events)(bool send);
851#endif
Jonathan Gordon29e259a2006-10-31 11:17:00 +0000852
Miika Pekkarinen0ea4d312007-01-12 18:34:00 +0000853#ifdef IRIVER_H100_SERIES
854 /* Routines for the iriver_flash -plugin. */
855 bool (*detect_original_firmware)(void);
856 bool (*detect_flashed_ramimage)(void);
857 bool (*detect_flashed_romimage)(void);
858#endif
Michael Sevakis9bfa2372007-04-14 02:46:15 +0000859
Kevin Ferrare81aac2a2007-07-29 03:43:37 +0000860 void (*led)(bool on);
Michael Sevakis287d6222007-09-25 02:59:42 +0000861
Michael Sevakisa9b2fb52007-10-16 01:25:17 +0000862#if (CONFIG_CODEC == SWCODEC)
Jens Arnold68a21682008-03-24 00:35:53 +0000863 /* buffering API */
Thomas Martitze9c10182009-10-16 19:14:41 +0000864 int (*bufopen)(const char *file, size_t offset, enum data_type type,
865 void *user_data);
Steve Bavin135cc752008-03-28 12:51:33 +0000866 int (*bufalloc)(const void *src, size_t size, enum data_type type);
867 bool (*bufclose)(int handle_id);
868 int (*bufseek)(int handle_id, size_t newpos);
869 int (*bufadvance)(int handle_id, off_t offset);
870 ssize_t (*bufread)(int handle_id, size_t size, void *dest);
871 ssize_t (*bufgetdata)(int handle_id, size_t size, void **data);
872 ssize_t (*bufgettail)(int handle_id, size_t size, void **data);
873 ssize_t (*bufcuttail)(int handle_id, size_t size);
Nicolas Pennequin90ce8262007-12-09 18:48:02 +0000874
Steve Bavin135cc752008-03-28 12:51:33 +0000875 ssize_t (*buf_handle_offset)(int handle_id);
Steve Bavin135cc752008-03-28 12:51:33 +0000876 void (*buf_set_base_handle)(int handle_id);
Nicolas Pennequin90ce8262007-12-09 18:48:02 +0000877 size_t (*buf_used)(void);
878#endif
879
880#ifdef HAVE_TAGCACHE
881 bool (*tagcache_search)(struct tagcache_search *tcs, int tag);
882 void (*tagcache_search_set_uniqbuf)(struct tagcache_search *tcs,
883 void *buffer, long length);
884 bool (*tagcache_search_add_filter)(struct tagcache_search *tcs,
885 int tag, int seek);
886 bool (*tagcache_get_next)(struct tagcache_search *tcs);
887 bool (*tagcache_retrieve)(struct tagcache_search *tcs, int idxid,
888 int tag, char *buf, long size);
889 void (*tagcache_search_finish)(struct tagcache_search *tcs);
Bertrik Sikken9464fdd2008-08-14 22:35:00 +0000890 long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag);
Teruaki Kawashima55a63602010-09-30 13:09:50 +0000891#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
Andrew Mahonec1c3d052009-06-01 21:08:49 +0000892 bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename);
893#endif
Nicolas Pennequin90ce8262007-12-09 18:48:02 +0000894#endif
895
896#ifdef HAVE_ALBUMART
Nicolas Pennequin90ce8262007-12-09 18:48:02 +0000897 bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string,
898 char *buf, int buflen);
899#endif
Michael Sevakisa222f272007-12-29 19:46:35 +0000900
Jonathan Gordon468edbb2008-09-23 09:59:06 +0000901#ifdef HAVE_SEMAPHORE_OBJECTS
Michael Giacomelliccd56bf2008-09-20 22:13:39 +0000902 void (*semaphore_init)(struct semaphore *s, int max, int start);
Michael Sevakis12375d12011-03-02 08:49:38 +0000903 int (*semaphore_wait)(struct semaphore *s, int timeout);
Michael Giacomelliccd56bf2008-09-20 22:13:39 +0000904 void (*semaphore_release)(struct semaphore *s);
Jonathan Gordon468edbb2008-09-23 09:59:06 +0000905#endif
Michael Giacomelliccd56bf2008-09-20 22:13:39 +0000906
Rafaël Carré5d236b22010-05-27 09:41:46 +0000907 const char *rbversion;
Yoshihisa Uchida36914352010-07-07 12:42:15 +0000908
Jens Arnold68a21682008-03-24 00:35:53 +0000909 /* new stuff at the end, sort into place next time
910 the API gets incompatible */
Michael Sevakisa2b67032011-06-29 06:37:04 +0000911 enum channel_status (*mixer_channel_status)(enum pcm_mixer_channel channel);
912 void * (*mixer_channel_get_buffer)(enum pcm_mixer_channel channel, int *count);
Björn Stenbergba371fb2003-06-29 16:33:04 +0000913};
914
Jens Arnolda36b1d42006-01-15 18:20:18 +0000915/* plugin header */
916struct plugin_header {
Thomas Martitz0d4585b2010-09-09 16:17:21 +0000917 struct lc_header lc_hdr; /* must be the first */
Andrew Mahone23d98122009-01-16 10:34:40 +0000918 enum plugin_status(*entry_point)(const void*);
919 const struct plugin_api **api;
Jens Arnolda36b1d42006-01-15 18:20:18 +0000920};
Michael Sevakisacc29d92006-11-18 02:18:29 +0000921
Jens Arnolda36b1d42006-01-15 18:20:18 +0000922#ifdef PLUGIN
Thomas Martitz35e8b142010-06-21 16:53:00 +0000923#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
Jens Arnolda36b1d42006-01-15 18:20:18 +0000924extern unsigned char plugin_start_addr[];
925extern unsigned char plugin_end_addr[];
926#define PLUGIN_HEADER \
Tom Ross5d190bc2009-02-27 07:30:41 +0000927 const struct plugin_api *rb DATA_ATTR; \
Jens Arnolda36b1d42006-01-15 18:20:18 +0000928 const struct plugin_header __header \
929 __attribute__ ((section (".header")))= { \
Thomas Martitz0d4585b2010-09-09 16:17:21 +0000930 { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
931 plugin_start_addr, plugin_end_addr }, plugin__start, &rb };
Thomas Martitz35e8b142010-06-21 16:53:00 +0000932#else /* PLATFORM_HOSTED */
Jens Arnolda7902772006-01-16 23:20:58 +0000933#define PLUGIN_HEADER \
Tom Ross5d190bc2009-02-27 07:30:41 +0000934 const struct plugin_api *rb DATA_ATTR; \
Nils Wallménius605949d2007-10-02 09:08:08 +0000935 const struct plugin_header __header \
936 __attribute__((visibility("default"))) = { \
Thomas Martitz12a28892010-09-09 16:29:21 +0000937 { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, NULL, NULL }, \
Thomas Martitz0d4585b2010-09-09 16:17:21 +0000938 plugin__start, &rb };
Thomas Martitz35e8b142010-06-21 16:53:00 +0000939#endif /* CONFIG_PLATFORM */
Michael Sevakisacc29d92006-11-18 02:18:29 +0000940#endif /* PLUGIN */
Jens Arnolda36b1d42006-01-15 18:20:18 +0000941
Steve Bavin65265772008-05-13 09:57:56 +0000942int plugin_load(const char* plugin, const void* parameter);
Michael Sevakis26d242a2007-04-21 18:38:25 +0000943void* plugin_get_audio_buffer(size_t *buffer_size);
Jonathan Gordon29e259a2006-10-31 11:17:00 +0000944
Michael Sevakis6689cb02007-04-10 14:18:30 +0000945/* plugin_tsr,
Jonathan Gordon29e259a2006-10-31 11:17:00 +0000946 callback returns true to allow the new plugin to load,
947 reenter means the currently running plugin is being reloaded */
948void plugin_tsr(bool (*exit_callback)(bool reenter));
Björn Stenbergba371fb2003-06-29 16:33:04 +0000949
950/* defined by the plugin */
Andrew Mahone23d98122009-01-16 10:34:40 +0000951extern const struct plugin_api *rb;
Thomas Martitzcae4ae22010-08-24 14:30:46 +0000952enum plugin_status plugin__start(const void* parameter)
Brandon Lowd4f9ebe2006-03-16 17:06:20 +0000953 NO_PROF_ATTR;
Björn Stenbergba371fb2003-06-29 16:33:04 +0000954
Nils Wallméniusa21004d2008-05-19 14:37:16 +0000955#endif /* __PCTOOL__ */
Björn Stenbergba371fb2003-06-29 16:33:04 +0000956#endif