Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 2 | * __________ __ ___. |
| 3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 7 | * \/ \/ \/ \/ \/ |
| 8 | * $Id$ |
| 9 | * |
Nicolas Pennequin | 396aeaf | 2009-03-23 17:08:46 +0000 | [diff] [blame] | 10 | * Copyright (C) 2002 Björn Stenberg |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 11 | * |
Daniel Stenberg | 2acc0ac | 2008-06-28 18:10:04 +0000 | [diff] [blame] | 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License |
| 14 | * as published by the Free Software Foundation; either version 2 |
| 15 | * of the License, or (at your option) any later version. |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 16 | * |
| 17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
| 18 | * KIND, either express or implied. |
| 19 | * |
| 20 | ****************************************************************************/ |
| 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 Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 30 | #include <stdbool.h> |
Thomas Martitz | 50a6ca3 | 2010-05-06 21:04:40 +0000 | [diff] [blame] | 31 | #include <inttypes.h> |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 32 | #include <sys/types.h> |
| 33 | #include <stdarg.h> |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 34 | #include <stdio.h> |
| 35 | #include <stdlib.h> |
Bertrik Sikken | ef87933 | 2008-08-12 20:11:18 +0000 | [diff] [blame] | 36 | #include <string.h> |
Thomas Martitz | 50a6ca3 | 2010-05-06 21:04:40 +0000 | [diff] [blame] | 37 | #include "string-extra.h" |
Rafaël Carré | a72aa85 | 2010-07-25 14:44:29 +0000 | [diff] [blame] | 38 | #include "gcc_extensions.h" |
Nils Wallménius | a21004d | 2008-05-19 14:37:16 +0000 | [diff] [blame] | 39 | |
Nils Wallménius | 3d4701a | 2009-07-14 13:57:45 +0000 | [diff] [blame] | 40 | char* strncpy(char *, const char *, size_t); |
Nils Wallménius | a21004d | 2008-05-19 14:37:16 +0000 | [diff] [blame] | 41 | void* plugin_get_buffer(size_t *buffer_size); |
| 42 | |
| 43 | #ifndef __PCTOOL__ |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 44 | #include "config.h" |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 45 | #include "system.h" |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 46 | #include "dir.h" |
Michael Sevakis | 57d71e4 | 2007-11-08 05:17:20 +0000 | [diff] [blame] | 47 | #include "general.h" |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 48 | #include "kernel.h" |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 49 | #include "thread.h" |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 50 | #include "button.h" |
Linus Nielsen Feltzing | 224c0a1 | 2006-08-15 12:27:07 +0000 | [diff] [blame] | 51 | #include "action.h" |
Thomas Martitz | 0d4585b | 2010-09-09 16:17:21 +0000 | [diff] [blame] | 52 | #include "load_code.h" |
Hristo Kovachev | 495c63f | 2006-01-25 18:29:56 +0000 | [diff] [blame] | 53 | #include "usb.h" |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 54 | #include "font.h" |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 55 | #include "lcd.h" |
Björn Stenberg | 51b45d5 | 2008-10-15 06:38:51 +0000 | [diff] [blame] | 56 | #include "metadata.h" |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 57 | #include "sound.h" |
Jerome Kuptz | c7d42bb | 2003-07-20 21:29:16 +0000 | [diff] [blame] | 58 | #include "mpeg.h" |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 59 | #include "audio.h" |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 60 | #include "mp3_playback.h" |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 61 | #include "talk.h" |
Brandon Low | 05dccc3 | 2006-01-18 20:54:13 +0000 | [diff] [blame] | 62 | #ifdef RB_PROFILE |
| 63 | #include "profile.h" |
| 64 | #endif |
Linus Nielsen Feltzing | 60895bc | 2005-09-02 05:39:09 +0000 | [diff] [blame] | 65 | #include "misc.h" |
Thomas Martitz | 9c0b247 | 2010-08-01 16:15:27 +0000 | [diff] [blame] | 66 | #include "filefuncs.h" |
Jens Arnold | 0c09f3e | 2006-03-26 23:00:24 +0000 | [diff] [blame] | 67 | #if (CONFIG_CODEC == SWCODEC) |
Michael Sevakis | a2b6703 | 2011-06-29 06:37:04 +0000 | [diff] [blame^] | 68 | #include "pcm_mixer.h" |
Dan Everton | d108849 | 2006-03-05 19:34:54 +0000 | [diff] [blame] | 69 | #include "dsp.h" |
Dave Chapman | 7cdd0fe | 2007-05-07 17:23:31 +0000 | [diff] [blame] | 70 | #include "codecs.h" |
| 71 | #include "playback.h" |
Jeffrey Goode | 9a4420b | 2009-10-31 19:17:36 +0000 | [diff] [blame] | 72 | #include "codec_thread.h" |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 73 | #ifdef HAVE_RECORDING |
| 74 | #include "recording.h" |
| 75 | #endif |
Jens Arnold | 0c09f3e | 2006-03-26 23:00:24 +0000 | [diff] [blame] | 76 | #else |
Marcin Bukat | 56c4e9f | 2010-10-31 21:09:34 +0000 | [diff] [blame] | 77 | #include "mas35xx.h" |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 78 | #endif /* CONFIG_CODEC == SWCODEC */ |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 79 | #include "settings.h" |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 80 | #include "timer.h" |
Jörg Hohensohn | 92e19db | 2004-06-19 09:36:03 +0000 | [diff] [blame] | 81 | #include "playlist.h" |
Linus Nielsen Feltzing | 2441061 | 2004-07-08 13:14:44 +0000 | [diff] [blame] | 82 | #ifdef HAVE_LCD_BITMAP |
Jens Arnold | 11ad7b4 | 2009-02-10 23:43:37 +0000 | [diff] [blame] | 83 | #include "screendump.h" |
Jonathan Gordon | 6288523 | 2006-11-19 14:11:42 +0000 | [diff] [blame] | 84 | #include "scrollbar.h" |
Andrew Mahone | 60d4209 | 2009-05-01 23:24:23 +0000 | [diff] [blame] | 85 | #include "jpeg_load.h" |
Andrew Mahone | f7fa7e5 | 2008-12-26 07:03:22 +0000 | [diff] [blame] | 86 | #include "../recorder/bmp.h" |
Linus Nielsen Feltzing | 2441061 | 2004-07-08 13:14:44 +0000 | [diff] [blame] | 87 | #endif |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 88 | #include "statusbar.h" |
Dave Chapman | 548c1b7 | 2005-09-22 08:54:48 +0000 | [diff] [blame] | 89 | #include "menu.h" |
Marcoen Hirschberg | b0fee17 | 2005-12-06 13:27:15 +0000 | [diff] [blame] | 90 | #include "rbunicode.h" |
Hristo Kovachev | 38deb8f | 2006-04-03 08:51:08 +0000 | [diff] [blame] | 91 | #include "list.h" |
Michael Sevakis | 806d8f3 | 2006-11-11 05:11:05 +0000 | [diff] [blame] | 92 | #include "tree.h" |
Jonathan Gordon | 46e186f | 2007-06-18 13:37:57 +0000 | [diff] [blame] | 93 | #include "color_picker.h" |
Nicolas Pennequin | 90ce826 | 2007-12-09 18:48:02 +0000 | [diff] [blame] | 94 | #include "buffering.h" |
| 95 | #include "tagcache.h" |
Jonathan Gordon | 5ca1539 | 2008-03-26 03:35:24 +0000 | [diff] [blame] | 96 | #include "viewport.h" |
Bertrik Sikken | 9464fdd | 2008-08-14 22:35:00 +0000 | [diff] [blame] | 97 | #include "ata_idle_notify.h" |
Jonathan Gordon | 9e2807f | 2008-10-26 11:44:21 +0000 | [diff] [blame] | 98 | #include "settings_list.h" |
Bertrik Sikken | b24fafb | 2009-03-08 20:28:15 +0000 | [diff] [blame] | 99 | #include "timefuncs.h" |
Nils Wallménius | 4279c9f | 2009-11-22 18:48:07 +0000 | [diff] [blame] | 100 | #include "crc32.h" |
Nicolas Pennequin | ec8ce3b | 2007-12-09 19:14:31 +0000 | [diff] [blame] | 101 | |
| 102 | #ifdef HAVE_ALBUMART |
Nicolas Pennequin | 90ce826 | 2007-12-09 18:48:02 +0000 | [diff] [blame] | 103 | #include "albumart.h" |
Nicolas Pennequin | ec8ce3b | 2007-12-09 19:14:31 +0000 | [diff] [blame] | 104 | #endif |
Daniel Stenberg | afd7042 | 2003-07-24 09:35:32 +0000 | [diff] [blame] | 105 | |
Christian Gmeiner | c63430e | 2005-04-15 12:55:31 +0000 | [diff] [blame] | 106 | #ifdef HAVE_REMOTE_LCD |
| 107 | #include "lcd-remote.h" |
| 108 | #endif |
| 109 | |
Nils Wallménius | bd12def | 2008-07-07 14:04:18 +0000 | [diff] [blame] | 110 | #include "yesno.h" |
| 111 | |
Mustapha Senhaji | 39b3c9a | 2010-12-28 14:18:37 +0000 | [diff] [blame] | 112 | #include "filetypes.h" |
| 113 | |
Tomer Shalev | 8c5141b | 2009-09-30 10:06:04 +0000 | [diff] [blame] | 114 | #ifdef USB_ENABLE_HID |
Frank Gevaerts | e409fba | 2009-07-18 12:58:29 +0000 | [diff] [blame] | 115 | #include "usbstack/usb_hid_usage_tables.h" |
| 116 | #endif |
| 117 | |
Thomas Martitz | 50a6ca3 | 2010-05-06 21:04:40 +0000 | [diff] [blame] | 118 | |
| 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 Feltzing | a6142ab | 2004-06-10 13:29:52 +0000 | [diff] [blame] | 123 | #ifdef PLUGIN |
Dave Chapman | 33001cb | 2005-06-18 19:19:12 +0000 | [diff] [blame] | 124 | |
Linus Nielsen Feltzing | a6142ab | 2004-06-10 13:29:52 +0000 | [diff] [blame] | 125 | #if defined(DEBUG) || defined(SIMULATOR) |
Daniel Stenberg | 22b7701 | 2005-02-22 12:19:12 +0000 | [diff] [blame] | 126 | #undef DEBUGF |
Jens Arnold | 06cb237 | 2004-08-30 19:52:45 +0000 | [diff] [blame] | 127 | #define DEBUGF rb->debugf |
Daniel Stenberg | 22b7701 | 2005-02-22 12:19:12 +0000 | [diff] [blame] | 128 | #undef LDEBUGF |
Linus Nielsen Feltzing | a6142ab | 2004-06-10 13:29:52 +0000 | [diff] [blame] | 129 | #define LDEBUGF rb->debugf |
| 130 | #else |
Rafaël Carré | 88c45ff | 2010-05-18 18:45:10 +0000 | [diff] [blame] | 131 | #undef DEBUGF |
| 132 | #define DEBUGF(...) do { } while(0) |
| 133 | #undef LDEBUGF |
| 134 | #define LDEBUGF(...) do { } while(0) |
Linus Nielsen Feltzing | a6142ab | 2004-06-10 13:29:52 +0000 | [diff] [blame] | 135 | #endif |
Dave Chapman | 33001cb | 2005-06-18 19:19:12 +0000 | [diff] [blame] | 136 | |
| 137 | #ifdef ROCKBOX_HAS_LOGF |
| 138 | #undef LOGF |
| 139 | #define LOGF rb->logf |
| 140 | #else |
| 141 | #define LOGF(...) |
| 142 | #endif |
| 143 | |
Linus Nielsen Feltzing | a6142ab | 2004-06-10 13:29:52 +0000 | [diff] [blame] | 144 | #endif |
| 145 | |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 146 | #define PLUGIN_MAGIC 0x526F634B /* RocK */ |
| 147 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 148 | /* increase this every time the api struct changes */ |
Michael Sevakis | a2b6703 | 2011-06-29 06:37:04 +0000 | [diff] [blame^] | 149 | #define PLUGIN_API_VERSION 206 |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 150 | |
| 151 | /* update this to latest version if a change to the api struct breaks |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 152 | backwards compatibility (and please take the opportunity to sort in any |
Jörg Hohensohn | facfec0 | 2004-02-03 23:56:25 +0000 | [diff] [blame] | 153 | new function which are "waiting" at the end of the function table) */ |
Michael Sevakis | 5a8f5b8 | 2011-05-09 21:19:11 +0000 | [diff] [blame] | 154 | #define PLUGIN_MIN_API_VERSION 205 |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 155 | |
| 156 | /* plugin return codes */ |
Thomas Martitz | cae4ae2 | 2010-08-24 14:30:46 +0000 | [diff] [blame] | 157 | /* internal returns start at 0x100 to make exit(1..255) work */ |
| 158 | #define INTERNAL_PLUGIN_RETVAL_START 0x100 |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 159 | enum plugin_status { |
Thomas Martitz | cae4ae2 | 2010-08-24 14:30:46 +0000 | [diff] [blame] | 160 | 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 Martitz | df6f955 | 2009-07-05 22:12:42 +0000 | [diff] [blame] | 164 | PLUGIN_GOTO_WPS, |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 165 | PLUGIN_ERROR = -1, |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 166 | }; |
| 167 | |
Hardeep Sidhu | 48c2d0f | 2003-07-25 23:04:59 +0000 | [diff] [blame] | 168 | /* 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 Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 174 | struct plugin_api { |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 175 | |
| 176 | /* lcd */ |
Thomas Martitz | 1034dea | 2009-03-30 16:06:02 +0000 | [diff] [blame] | 177 | |
| 178 | #ifdef HAVE_LCD_CONTRAST |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 179 | void (*lcd_set_contrast)(int x); |
Thomas Martitz | 1034dea | 2009-03-30 16:06:02 +0000 | [diff] [blame] | 180 | #endif |
Jens Arnold | 54ea2e4 | 2007-03-31 09:58:49 +0000 | [diff] [blame] | 181 | void (*lcd_update)(void); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 182 | void (*lcd_clear_display)(void); |
Jens Arnold | ad4e3d6 | 2007-03-26 07:52:13 +0000 | [diff] [blame] | 183 | 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é | da16248 | 2010-08-30 20:47:53 +0000 | [diff] [blame] | 185 | void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...); |
Jens Arnold | abe77a1 | 2004-08-01 21:50:57 +0000 | [diff] [blame] | 186 | void (*lcd_puts)(int x, int y, const unsigned char *string); |
Rafaël Carré | da16248 | 2010-08-30 20:47:53 +0000 | [diff] [blame] | 187 | void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...); |
Jens Arnold | c76c568 | 2004-08-16 23:37:23 +0000 | [diff] [blame] | 188 | void (*lcd_puts_scroll)(int x, int y, const unsigned char* string); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 189 | void (*lcd_stop_scroll)(void); |
| 190 | #ifdef HAVE_LCD_CHARCELLS |
Jens Arnold | ad4e3d6 | 2007-03-26 07:52:13 +0000 | [diff] [blame] | 191 | 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 Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 196 | void (*lcd_remove_cursor)(void); |
Jens Arnold | 323d75d | 2007-04-03 18:06:13 +0000 | [diff] [blame] | 197 | void (*lcd_icon)(int icon, bool enable); |
Linus Nielsen Feltzing | 60895bc | 2005-09-02 05:39:09 +0000 | [diff] [blame] | 198 | void (*lcd_double_height)(bool on); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 199 | #else /* HAVE_LCD_BITMAP */ |
| 200 | fb_data* lcd_framebuffer; |
Jens Arnold | c84e345 | 2008-03-24 00:45:03 +0000 | [diff] [blame] | 201 | void (*lcd_update_rect)(int x, int y, int width, int height); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 202 | void (*lcd_set_drawmode)(int mode); |
| 203 | int (*lcd_get_drawmode)(void); |
| 204 | void (*lcd_setfont)(int font); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 205 | void (*lcd_drawpixel)(int x, int y); |
| 206 | void (*lcd_drawline)(int x1, int y1, int x2, int y2); |
Jens Arnold | 7e11acb | 2005-06-28 23:15:47 +0000 | [diff] [blame] | 207 | 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 Arnold | f894a4c | 2005-07-06 22:58:02 +0000 | [diff] [blame] | 211 | 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 Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 215 | #if LCD_DEPTH > 1 |
Jens Arnold | 5b2cba1 | 2005-11-16 21:09:23 +0000 | [diff] [blame] | 216 | 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 Feltzing | 0cb4a46 | 2005-11-14 20:43:49 +0000 | [diff] [blame] | 220 | void (*lcd_bitmap_part)(const fb_data *src, int src_x, int src_y, |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 221 | int stride, int x, int y, int width, int height); |
Linus Nielsen Feltzing | 0cb4a46 | 2005-11-14 20:43:49 +0000 | [diff] [blame] | 222 | void (*lcd_bitmap)(const fb_data *src, int x, int y, int width, |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 223 | int height); |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 224 | fb_data* (*lcd_get_backdrop)(void); |
Jonathan Gordon | 6288523 | 2006-11-19 14:11:42 +0000 | [diff] [blame] | 225 | void (*lcd_set_backdrop)(fb_data* backdrop); |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 226 | #endif |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 227 | #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 Everton | d108849 | 2006-03-05 19:34:54 +0000 | [diff] [blame] | 231 | void (*lcd_bitmap_transparent)(const fb_data *src, int x, int y, |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 232 | int width, int height); |
Rafaël Carré | a98c54f | 2009-06-21 14:09:48 +0000 | [diff] [blame] | 233 | #if MEMORYSIZE > 2 |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 234 | 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 Arnold | 27f5cda | 2009-07-15 22:02:42 +0000 | [diff] [blame] | 238 | || defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) \ |
Rafaël Carré | 35500c2 | 2010-03-28 02:41:29 +0000 | [diff] [blame] | 239 | || defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) \ |
Michael Sevakis | 0dd74ca | 2011-01-11 01:21:31 +0000 | [diff] [blame] | 240 | || defined(TOSHIBA_GIGABEAT_S) || defined(PHILIPS_SA9200) |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 241 | void (*lcd_yuv_set_options)(unsigned options); |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 242 | #endif |
Rafaël Carré | a98c54f | 2009-06-21 14:09:48 +0000 | [diff] [blame] | 243 | #endif /* MEMORYSIZE > 2 */ |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 244 | #elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 245 | 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 Mahone | eef7945 | 2009-05-06 04:53:56 +0000 | [diff] [blame] | 251 | #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 Arnold | abe77a1 | 2004-08-01 21:50:57 +0000 | [diff] [blame] | 256 | void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 257 | void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string, |
| 258 | int style); |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 259 | #ifdef HAVE_LCD_INVERT |
| 260 | void (*lcd_set_invert_display)(bool yesno); |
| 261 | #endif /* HAVE_LCD_INVERT */ |
Andrew Mahone | eef7945 | 2009-05-06 04:53:56 +0000 | [diff] [blame] | 262 | #if defined(HAVE_LCD_MODES) |
| 263 | void (*lcd_set_mode)(int mode); |
| 264 | #endif |
Michael Giacomelli | 0e783b0 | 2008-12-25 04:24:47 +0000 | [diff] [blame] | 265 | |
Thomas Martitz | b7739fb | 2009-03-17 02:43:47 +0000 | [diff] [blame] | 266 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
Jonathan Gordon | bdbdb97 | 2008-06-23 13:20:35 +0000 | [diff] [blame] | 267 | struct event_queue *button_queue; |
| 268 | #endif |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 269 | unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation ); |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 270 | #ifdef HAVE_LCD_BITMAP |
| 271 | bool (*is_diacritic)(const unsigned short char_code, bool *is_rtl); |
| 272 | #endif |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 273 | const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code ); |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 274 | int (*font_load)(struct font*, const char *path); |
Jens Arnold | 04daef1 | 2005-06-24 22:33:21 +0000 | [diff] [blame] | 275 | struct font* (*font_get)(int font); |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 276 | int (*font_getstringsize)(const unsigned char *str, int *w, int *h, |
| 277 | int fontnumber); |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 278 | int (*font_get_width)(struct font* pf, unsigned short char_code); |
Jonathan Gordon | fda7d72 | 2007-08-06 13:42:52 +0000 | [diff] [blame] | 279 | void (*screen_clear_area)(struct screen * display, int xstart, int ystart, |
| 280 | int width, int height); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 281 | 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 Sevakis | 8cfbd36 | 2008-12-10 08:57:10 +0000 | [diff] [blame] | 286 | const char* (*get_codepage_name)(int cp); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 287 | |
| 288 | /* backlight */ |
Jens Arnold | 3aa5832 | 2008-10-31 20:06:08 +0000 | [diff] [blame] | 289 | /* 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 Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 296 | void (*backlight_on)(void); |
| 297 | void (*backlight_off)(void); |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 298 | void (*backlight_set_timeout)(int index); |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 299 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
| 300 | void (*backlight_set_brightness)(int val); |
| 301 | #endif /* HAVE_BACKLIGHT_BRIGHTNESS */ |
Peter D'Hoye | 39718e3 | 2008-04-23 21:15:07 +0000 | [diff] [blame] | 302 | |
Peter D'Hoye | a5d4d67 | 2007-08-13 22:31:11 +0000 | [diff] [blame] | 303 | #if CONFIG_CHARGING |
| 304 | void (*backlight_set_timeout_plugged)(int index); |
| 305 | #endif |
Jens Arnold | ac9b927 | 2008-04-04 19:38:46 +0000 | [diff] [blame] | 306 | bool (*is_backlight_on)(bool ignore_always_off); |
Nils Wallménius | 01729e7 | 2008-08-15 08:27:39 +0000 | [diff] [blame] | 307 | void (*splash)(int ticks, const char *str); |
| 308 | void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 309 | |
Christian Gmeiner | c63430e | 2005-04-15 12:55:31 +0000 | [diff] [blame] | 310 | #ifdef HAVE_REMOTE_LCD |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 311 | /* remote lcd */ |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 312 | 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 Chapman | e937310 | 2007-12-31 00:04:27 +0000 | [diff] [blame] | 315 | void (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string); |
| 316 | void (*lcd_remote_stop_scroll)(void); |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 317 | 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 Arnold | d7f9439 | 2005-07-07 00:05:29 +0000 | [diff] [blame] | 327 | 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 Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 331 | int width, int height); |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 332 | 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 Arnold | 05ddd9a | 2006-07-28 07:35:45 +0000 | [diff] [blame] | 336 | fb_remote_data* lcd_remote_framebuffer; |
Jens Arnold | 576908d | 2005-06-29 01:39:50 +0000 | [diff] [blame] | 337 | void (*lcd_remote_update)(void); |
| 338 | void (*lcd_remote_update_rect)(int x, int y, int width, int height); |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 339 | |
Christian Gmeiner | c63430e | 2005-04-15 12:55:31 +0000 | [diff] [blame] | 340 | void (*remote_backlight_on)(void); |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 341 | void (*remote_backlight_off)(void); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 342 | void (*remote_backlight_set_timeout)(int index); |
| 343 | #if CONFIG_CHARGING |
| 344 | void (*remote_backlight_set_timeout_plugged)(int index); |
Christian Gmeiner | c63430e | 2005-04-15 12:55:31 +0000 | [diff] [blame] | 345 | #endif |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 346 | #endif /* HAVE_REMOTE_LCD */ |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 347 | 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 Sevakis | 6aa12c1 | 2006-10-14 01:32:58 +0000 | [diff] [blame] | 351 | void (*lcd_remote_set_background)(unsigned background); |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 352 | unsigned (*lcd_remote_get_background)(void); |
Teruaki Kawashima | 0cbf210 | 2009-12-20 12:59:25 +0000 | [diff] [blame] | 353 | 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 Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 358 | #endif |
Teruaki Kawashima | 0cbf210 | 2009-12-20 12:59:25 +0000 | [diff] [blame] | 359 | void (*viewport_set_defaults)(struct viewport *vp, |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 360 | 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 Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 366 | /* list */ |
| 367 | void (*gui_synclist_init)(struct gui_synclist * lists, |
Steve Bavin | 6526577 | 2008-05-13 09:57:56 +0000 | [diff] [blame] | 368 | list_get_name callback_get_item_name, void * data, |
Jonathan Gordon | 5ca1539 | 2008-03-26 03:35:24 +0000 | [diff] [blame] | 369 | bool scroll_all,int selected_size, |
| 370 | struct viewport parent[NB_SCREENS]); |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 371 | void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items); |
Teruaki Kawashima | 0cbf210 | 2009-12-20 12:59:25 +0000 | [diff] [blame] | 372 | void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, |
| 373 | list_get_icon icon_callback); |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 374 | 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 Kawashima | 0cbf210 | 2009-12-20 12:59:25 +0000 | [diff] [blame] | 378 | int item_number); |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 379 | 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 Gordon | cf1cef5 | 2007-09-17 10:08:50 +0000 | [diff] [blame] | 382 | bool (*gui_synclist_do_button)(struct gui_synclist * lists, |
Jonathan Gordon | e385ee1 | 2008-12-31 05:59:26 +0000 | [diff] [blame] | 383 | int *action, enum list_wrap wrap); |
Nils Wallménius | 8e33c2f | 2009-10-11 09:40:47 +0000 | [diff] [blame] | 384 | void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title, |
Andrew Mahone | 1bc67c8 | 2009-07-11 00:22:26 +0000 | [diff] [blame] | 385 | enum themable_icons icon); |
Bertrik Sikken | 9464fdd | 2008-08-14 22:35:00 +0000 | [diff] [blame] | 386 | 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 Gordon | bdbdb97 | 2008-06-23 13:20:35 +0000 | [diff] [blame] | 389 | void (*simplelist_info_init)(struct simplelist_info *info, char* title, |
Teruaki Kawashima | 0cbf210 | 2009-12-20 12:59:25 +0000 | [diff] [blame] | 390 | int count, void* data); |
Jonathan Gordon | bdbdb97 | 2008-06-23 13:20:35 +0000 | [diff] [blame] | 391 | bool (*simplelist_show_list)(struct simplelist_info *info); |
Michael Sevakis | 6aa12c1 | 2006-10-14 01:32:58 +0000 | [diff] [blame] | 392 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 393 | /* button */ |
Jean-Philippe Bernardy | 5804664 | 2005-02-07 23:11:20 +0000 | [diff] [blame] | 394 | long (*button_get)(bool block); |
| 395 | long (*button_get_w_tmo)(int ticks); |
Jonathan Gordon | 7e26412 | 2008-05-15 07:13:03 +0000 | [diff] [blame] | 396 | int (*button_status)(void); |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 397 | #ifdef HAVE_BUTTON_DATA |
| 398 | intptr_t (*button_get_data)(void); |
Thomas Martitz | d85c3ec | 2009-10-20 21:54:59 +0000 | [diff] [blame] | 399 | int (*button_status_wdata)(int *pdata); |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 400 | #endif |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 401 | void (*button_clear_queue)(void); |
Michael Giacomelli | 0e783b0 | 2008-12-25 04:24:47 +0000 | [diff] [blame] | 402 | int (*button_queue_count)(void); |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 403 | #ifdef HAS_BUTTON_HOLD |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 404 | bool (*button_hold)(void); |
| 405 | #endif |
Maurus Cuelenaere | 1392dc2 | 2008-08-23 09:46:38 +0000 | [diff] [blame] | 406 | #ifdef HAVE_TOUCHSCREEN |
| 407 | void (*touchscreen_set_mode)(enum touchscreen_mode); |
Jonathan Gordon | 7e26412 | 2008-05-15 07:13:03 +0000 | [diff] [blame] | 408 | #endif |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 409 | #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 Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 417 | |
| 418 | /* file */ |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 419 | int (*open_utf8)(const char* pathname, int flags); |
Thomas Martitz | 0a1d7c2 | 2010-05-06 17:35:13 +0000 | [diff] [blame] | 420 | int (*open)(const char* pathname, int flags, ...); |
Björn Stenberg | a36cdf5 | 2009-01-07 09:53:46 +0000 | [diff] [blame] | 421 | 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 Martitz | c61e89c | 2010-05-06 17:35:04 +0000 | [diff] [blame] | 424 | int (*creat)(const char *pathname, mode_t mode); |
Björn Stenberg | a36cdf5 | 2009-01-07 09:53:46 +0000 | [diff] [blame] | 425 | 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 Arnold | 79c8a8c | 2007-03-17 09:02:53 +0000 | [diff] [blame] | 430 | int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 431 | int (*read_line)(int fd, char* buffer, int buffer_size); |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 432 | bool (*settings_parseline)(char* line, char** name, char** value); |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame] | 433 | void (*storage_sleep)(void); |
| 434 | void (*storage_spin)(void); |
| 435 | void (*storage_spindown)(int seconds); |
| 436 | #if USING_STORAGE_CALLBACK |
Thomas Martitz | 774bacc | 2009-10-20 21:54:44 +0000 | [diff] [blame] | 437 | void (*register_storage_idle_func)(void (*function)(void *data)); |
| 438 | void (*unregister_storage_idle_func)(void (*function)(void *data), bool run); |
Frank Gevaerts | 2f8a008 | 2008-11-01 16:14:28 +0000 | [diff] [blame] | 439 | #endif /* USING_STORAGE_CALLBACK */ |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 440 | void (*reload_directory)(void); |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 441 | 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 Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 444 | bool (*file_exists)(const char *file); |
Thomas Martitz | 5481090 | 2009-02-11 16:37:12 +0000 | [diff] [blame] | 445 | char* (*strip_extension)(char* buffer, int buffer_size, const char *filename); |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 446 | unsigned (*crc_32)(const void *src, unsigned len, unsigned crc32); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 447 | |
Michael Sevakis | 2da0f9b | 2011-01-20 17:11:23 +0000 | [diff] [blame] | 448 | int (*filetype_get_attr)(const char* file); |
| 449 | |
| 450 | |
Zakk Roberts | 07fcf77 | 2006-05-01 05:45:18 +0000 | [diff] [blame] | 451 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 452 | /* dir */ |
Kevin Ferrare | 011a325 | 2007-07-20 17:06:55 +0000 | [diff] [blame] | 453 | 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 Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 458 | bool (*dir_exists)(const char *path); |
Nils Wallménius | 8123dff | 2010-10-16 12:30:06 +0000 | [diff] [blame] | 459 | struct dirinfo (*dir_get_info)(DIR* parent, struct dirent *entry); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 460 | |
Michael Sevakis | 2da0f9b | 2011-01-20 17:11:23 +0000 | [diff] [blame] | 461 | /* 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 Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 468 | /* kernel/ system */ |
Rafaël Carré | 851be21 | 2010-08-03 19:00:29 +0000 | [diff] [blame] | 469 | #if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE |
Thomas Martitz | 5481090 | 2009-02-11 16:37:12 +0000 | [diff] [blame] | 470 | void (*__div0)(void); |
| 471 | #endif |
Thomas Martitz | 6eaab4d | 2010-09-01 21:29:34 +0000 | [diff] [blame] | 472 | unsigned (*sleep)(unsigned ticks); |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 473 | void (*yield)(void); |
Michael Sevakis | 6bba70b | 2007-06-25 20:46:54 +0000 | [diff] [blame] | 474 | volatile long* current_tick; |
Jean-Philippe Bernardy | f64939e | 2005-02-07 22:56:37 +0000 | [diff] [blame] | 475 | long (*default_event_handler)(long event); |
Teruaki Kawashima | 0cbf210 | 2009-12-20 12:59:25 +0000 | [diff] [blame] | 476 | long (*default_event_handler_ex)(long event, |
| 477 | void (*callback)(void *), void *parameter); |
Michael Sevakis | 8cfbd36 | 2008-12-10 08:57:10 +0000 | [diff] [blame] | 478 | 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 Sevakis | 56dd75d | 2011-03-16 05:38:37 +0000 | [diff] [blame] | 483 | unsigned int (*thread_self)(void); |
Michael Sevakis | 27cf677 | 2008-03-25 02:34:12 +0000 | [diff] [blame] | 484 | void (*thread_exit)(void); |
Michael Sevakis | 8cfbd36 | 2008-12-10 08:57:10 +0000 | [diff] [blame] | 485 | void (*thread_wait)(unsigned int thread_id); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 486 | #if CONFIG_CODEC == SWCODEC |
Michael Sevakis | 2054627 | 2009-01-05 10:31:19 +0000 | [diff] [blame] | 487 | 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 Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 491 | void (*mutex_init)(struct mutex *m); |
| 492 | void (*mutex_lock)(struct mutex *m); |
| 493 | void (*mutex_unlock)(struct mutex *m); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 494 | #endif |
| 495 | |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 496 | void (*reset_poweroff_timer)(void); |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 497 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 498 | int (*system_memory_guard)(int newmode); |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 499 | long *cpu_frequency; |
| 500 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ |
Jonathan Gordon | f8c68c7 | 2007-01-22 10:41:25 +0000 | [diff] [blame] | 501 | #ifdef CPU_BOOST_LOGGING |
| 502 | void (*cpu_boost_)(bool on_off,char*location,int line); |
| 503 | #else |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 504 | void (*cpu_boost)(bool on_off); |
| 505 | #endif |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 506 | #endif /* HAVE_ADJUSTABLE_CPU_FREQ */ |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 507 | #endif /* PLATFORM_NATIVE */ |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 508 | #ifdef HAVE_SCHEDULER_BOOSTCTRL |
| 509 | void (*trigger_cpu_boost)(void); |
| 510 | void (*cancel_cpu_boost)(void); |
Jonathan Gordon | f8c68c7 | 2007-01-22 10:41:25 +0000 | [diff] [blame] | 511 | #endif |
Nils Wallménius | 8123dff | 2010-10-16 12:30:06 +0000 | [diff] [blame] | 512 | |
Michael Sevakis | 21f0c9a | 2009-02-11 12:55:51 +0000 | [diff] [blame] | 513 | void (*cpucache_flush)(void); |
| 514 | void (*cpucache_invalidate)(void); |
Nils Wallménius | 8123dff | 2010-10-16 12:30:06 +0000 | [diff] [blame] | 515 | |
| 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 Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 522 | bool (*timer_register)(int reg_prio, void (*unregister_callback)(void), |
Rafaël Carré | 89ccd5c | 2009-06-29 14:29:46 +0000 | [diff] [blame] | 523 | long cycles, void (*timer_callback)(void) |
| 524 | IF_COP(, int core)); |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 525 | void (*timer_unregister)(void); |
| 526 | bool (*timer_set_period)(long count); |
Kevin Ferrare | 81aac2a | 2007-07-29 03:43:37 +0000 | [diff] [blame] | 527 | |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 528 | void (*queue_init)(struct event_queue *q, bool register_queue); |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 529 | void (*queue_delete)(struct event_queue *q); |
Michael Sevakis | 4b90267 | 2006-12-19 16:50:07 +0000 | [diff] [blame] | 530 | void (*queue_post)(struct event_queue *q, long id, intptr_t data); |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 531 | void (*queue_wait_w_tmo)(struct event_queue *q, struct queue_event *ev, |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 532 | int ticks); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 533 | #if CONFIG_CODEC == SWCODEC |
| 534 | void (*queue_enable_queue_send)(struct event_queue *q, |
Michael Sevakis | 27cf677 | 2008-03-25 02:34:12 +0000 | [diff] [blame] | 535 | struct queue_sender_list *send, |
Michael Sevakis | 8cfbd36 | 2008-12-10 08:57:10 +0000 | [diff] [blame] | 536 | unsigned int thread_id); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 537 | 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 Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 544 | void (*usb_acknowledge)(long id); |
Tomer Shalev | 8c5141b | 2009-09-30 10:06:04 +0000 | [diff] [blame] | 545 | #ifdef USB_ENABLE_HID |
Thomas Martitz | 2287dd9 | 2009-08-03 15:09:41 +0000 | [diff] [blame] | 546 | void (*usb_hid_send)(usage_page_t usage_page, int id); |
| 547 | #endif |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 548 | #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 Martitz | d85c3ec | 2009-10-20 21:54:59 +0000 | [diff] [blame] | 554 | /* 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 Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 558 | |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 559 | #if (CONFIG_PLATFORM & PLATFORM_HOSTED) |
Jens Arnold | 06bc627 | 2006-03-11 09:28:49 +0000 | [diff] [blame] | 560 | /* special simulator hooks */ |
| 561 | #if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8 |
Jens Arnold | 0d935ce | 2009-02-09 00:32:59 +0000 | [diff] [blame] | 562 | void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int)); |
Jens Arnold | 06bc627 | 2006-03-11 09:28:49 +0000 | [diff] [blame] | 563 | void (*sim_lcd_ex_update_rect)(int x, int y, int width, int height); |
| 564 | #endif |
| 565 | #endif |
| 566 | |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 567 | /* strings and memory */ |
Jens Arnold | 79c8a8c | 2007-03-17 09:02:53 +0000 | [diff] [blame] | 568 | int (*snprintf)(char *buf, size_t size, const char *fmt, ...) |
| 569 | ATTRIBUTE_PRINTF(3, 4); |
Thomas Martitz | 50a6ca3 | 2010-05-06 21:04:40 +0000 | [diff] [blame] | 570 | int (*vsnprintf)(char *buf, size_t size, const char *fmt, va_list ap); |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 571 | char* (*strcpy)(char *dst, const char *src); |
Nils Wallménius | 3d4701a | 2009-07-14 13:57:45 +0000 | [diff] [blame] | 572 | size_t (*strlcpy)(char *dst, const char *src, size_t length); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 573 | size_t (*strlen)(const char *str); |
Linus Nielsen Feltzing | a96a130 | 2004-07-13 14:14:30 +0000 | [diff] [blame] | 574 | char * (*strrchr)(const char *s, int c); |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 575 | int (*strcmp)(const char *, const char *); |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 576 | int (*strncmp)(const char *, const char *, size_t); |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 577 | int (*strcasecmp)(const char *, const char *); |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 578 | 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 Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 581 | void* (*memmove)(void *out, const void *in, size_t n); |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 582 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Maurus Cuelenaere | cf87597 | 2009-05-21 19:01:41 +0000 | [diff] [blame] | 583 | const unsigned char *_rbctype_; |
Thomas Martitz | 3cca7e8 | 2010-05-14 12:37:05 +0000 | [diff] [blame] | 584 | #endif |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 585 | int (*atoi)(const char *str); |
Daniel Stenberg | 22b7701 | 2005-02-22 12:19:12 +0000 | [diff] [blame] | 586 | char *(*strchr)(const char *s, int c); |
| 587 | char *(*strcat)(char *s1, const char *s2); |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 588 | size_t (*strlcat)(char *dst, const char *src, size_t length); |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 589 | void *(*memchr)(const void *s1, int c, size_t n); |
Daniel Stenberg | 22b7701 | 2005-02-22 12:19:12 +0000 | [diff] [blame] | 590 | int (*memcmp)(const void *s1, const void *s2, size_t n); |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 591 | char *(*strcasestr) (const char* phaystack, const char* pneedle); |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 592 | char* (*strtok_r)(char *ptr, const char *sep, char **end); |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 593 | /* 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 Pekkarinen | b40eb3d | 2006-07-25 18:12:57 +0000 | [diff] [blame] | 596 | 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 Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 598 | unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8); |
| 599 | unsigned long (*utf8length)(const unsigned char *utf8); |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 600 | int (*utf8seek)(const unsigned char* utf8, int offset); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 601 | |
| 602 | /* sound */ |
Linus Nielsen Feltzing | 674eaca | 2005-04-01 13:41:03 +0000 | [diff] [blame] | 603 | void (*sound_set)(int setting, int value); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 604 | int (*sound_default)(int setting); |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 605 | int (*sound_min)(int setting); |
| 606 | int (*sound_max)(int setting); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 607 | const char * (*sound_unit)(int setting); |
| 608 | int (*sound_val2phys)(int setting, int value); |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 609 | #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 Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 613 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Teruaki Kawashima | 0cbf210 | 2009-12-20 12:59:25 +0000 | [diff] [blame] | 614 | void (*mp3_play_data)(const unsigned char* start, int size, |
| 615 | void (*get_more)(unsigned char** start, size_t* size)); |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 616 | void (*mp3_play_pause)(bool play); |
| 617 | void (*mp3_play_stop)(void); |
| 618 | bool (*mp3_is_playing)(void); |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 619 | #if CONFIG_CODEC != SWCODEC |
Jörg Hohensohn | 95298a9 | 2004-01-30 22:30:40 +0000 | [diff] [blame] | 620 | void (*bitswap)(unsigned char *data, int length); |
Jörg Hohensohn | facfec0 | 2004-02-03 23:56:25 +0000 | [diff] [blame] | 621 | #endif |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 622 | #endif /* PLATFORM_NATIVE */ |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 623 | #if CONFIG_CODEC == SWCODEC |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 624 | const unsigned long *audio_master_sampr_list; |
| 625 | const unsigned long *hw_freq_sampr; |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 626 | void (*pcm_apply_settings)(void); |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 627 | void (*pcm_play_data)(pcm_play_callback_type get_more, |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 628 | unsigned char* start, size_t size); |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 629 | void (*pcm_play_stop)(void); |
| 630 | void (*pcm_set_frequency)(unsigned int frequency); |
| 631 | bool (*pcm_is_playing)(void); |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 632 | bool (*pcm_is_paused)(void); |
Jens Arnold | 4c7da88 | 2005-06-18 01:25:47 +0000 | [diff] [blame] | 633 | void (*pcm_play_pause)(bool play); |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 634 | size_t (*pcm_get_bytes_waiting)(void); |
Jens Arnold | dae698c | 2006-03-11 09:38:12 +0000 | [diff] [blame] | 635 | void (*pcm_calculate_peaks)(int *left, int *right); |
Frank Gevaerts | 43264a9 | 2010-02-10 19:44:11 +0000 | [diff] [blame] | 636 | const void* (*pcm_get_peak_buffer)(int *count); |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 637 | void (*pcm_play_lock)(void); |
| 638 | void (*pcm_play_unlock)(void); |
Michael Sevakis | a2b6703 | 2011-06-29 06:37:04 +0000 | [diff] [blame^] | 639 | void (*beep_play)(unsigned int frequency, unsigned int duration, |
| 640 | unsigned int amplitude); |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 641 | #ifdef HAVE_RECORDING |
| 642 | const unsigned long *rec_freq_sampr; |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 643 | void (*pcm_init_recording)(void); |
| 644 | void (*pcm_close_recording)(void); |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 645 | void (*pcm_record_data)(pcm_rec_callback_type more_ready, |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 646 | void *start, size_t size); |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 647 | 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 Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 650 | #endif /* HAVE_RECORDING */ |
Michael Sevakis | 2d48d0f | 2007-06-08 23:42:04 +0000 | [diff] [blame] | 651 | #if INPUT_SRC_CAPS != 0 |
| 652 | void (*audio_set_output_source)(int monitor); |
| 653 | void (*audio_set_input_source)(int source, unsigned flags); |
Jens Arnold | dae698c | 2006-03-11 09:38:12 +0000 | [diff] [blame] | 654 | #endif |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 655 | 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 Goode | 0dc2fb5 | 2009-08-12 18:12:25 +0000 | [diff] [blame] | 662 | int (*dsp_input_count)(struct dsp_config *dsp, int count); |
| 663 | int (*dsp_output_count)(struct dsp_config *dsp, int count); |
Michael Sevakis | 2d48d0f | 2007-06-08 23:42:04 +0000 | [diff] [blame] | 664 | #endif /* CONFIG_CODEC == SWCODC */ |
Jörg Hohensohn | 6800276 | 2004-04-30 20:37:11 +0000 | [diff] [blame] | 665 | |
| 666 | /* playback control */ |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 667 | int (*playlist_amount)(void); |
| 668 | int (*playlist_resume)(void); |
Thomas Martitz | f0aa8ba | 2009-05-31 14:33:33 +0000 | [diff] [blame] | 669 | void (*playlist_start)(int start_index, int offset); |
Andrew Mahone | c1c3d05 | 2009-06-01 21:08:49 +0000 | [diff] [blame] | 670 | 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 Gordon | f1034e0 | 2009-07-05 18:07:58 +0000 | [diff] [blame] | 676 | int (*playlist_insert_directory)(struct playlist_info* playlist, |
| 677 | const char *dirname, int position, bool queue, |
| 678 | bool recurse); |
Andrew Mahone | c1c3d05 | 2009-06-01 21:08:49 +0000 | [diff] [blame] | 679 | int (*playlist_shuffle)(int random_seed, int start_index); |
Björn Stenberg | a36cdf5 | 2009-01-07 09:53:46 +0000 | [diff] [blame] | 680 | void (*audio_play)(long offset); |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 681 | 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 Bavin | 135cc75 | 2008-03-28 12:51:33 +0000 | [diff] [blame] | 686 | void (*audio_ff_rewind)(long newtime); |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 687 | struct mp3entry* (*audio_next_track)(void); |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 688 | int (*audio_status)(void); |
Linus Nielsen Feltzing | 8a237a8 | 2005-04-04 12:06:29 +0000 | [diff] [blame] | 689 | struct mp3entry* (*audio_current_track)(void); |
| 690 | void (*audio_flush_and_reload_tracks)(void); |
| 691 | int (*audio_get_file_pos)(void); |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 692 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
Linus Nielsen Feltzing | 78c829f | 2005-04-25 08:21:10 +0000 | [diff] [blame] | 693 | unsigned long (*mpeg_get_last_header)(void); |
Linus Nielsen Feltzing | ef73c2e | 2005-04-25 08:59:19 +0000 | [diff] [blame] | 694 | #endif |
Frank Gevaerts | f366090 | 2010-09-17 20:28:47 +0000 | [diff] [blame] | 695 | #if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \ |
| 696 | (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHSCREEN) |
Alexander Levin | cc7c665 | 2009-07-11 16:46:19 +0000 | [diff] [blame] | 697 | void (*sound_set_pitch)(int32_t pitch); |
Dan Everton | 7699255 | 2006-03-05 19:46:33 +0000 | [diff] [blame] | 698 | #endif |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 699 | |
| 700 | /* MAS communication */ |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 701 | #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC) |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 702 | int (*mas_readmem)(int bank, int addr, unsigned long* dest, int len); |
Jens Arnold | 0ceaa5e | 2004-08-17 01:45:48 +0000 | [diff] [blame] | 703 | int (*mas_writemem)(int bank, int addr, const unsigned long* src, int len); |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 704 | int (*mas_readreg)(int reg); |
| 705 | int (*mas_writereg)(int reg, unsigned int val); |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 706 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 707 | int (*mas_codec_writereg)(int reg, unsigned int val); |
| 708 | int (*mas_codec_readreg)(int reg); |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 709 | void (*i2c_begin)(void); |
| 710 | void (*i2c_end)(void); |
Bertrik Sikken | e5319e0 | 2008-04-28 14:33:03 +0000 | [diff] [blame] | 711 | int (*i2c_write)(int address, const unsigned char* buf, int count ); |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 712 | #endif |
| 713 | #endif |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 714 | |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 715 | /* menu */ |
Jonathan Gordon | 5ca1539 | 2008-03-26 03:35:24 +0000 | [diff] [blame] | 716 | int (*do_menu)(const struct menu_item_ex *menu, int *start_selected, |
Thomas Martitz | 5629d55 | 2010-01-26 20:14:42 +0000 | [diff] [blame] | 717 | struct viewport parent[NB_SCREENS], bool hide_theme); |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 718 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 719 | /* scroll bar */ |
| 720 | struct gui_syncstatusbar *statusbars; |
| 721 | void (*gui_syncstatusbar_draw)(struct gui_syncstatusbar * bars, bool force_redraw); |
Michael Giacomelli | 0e783b0 | 2008-12-25 04:24:47 +0000 | [diff] [blame] | 722 | |
Jonathan Gordon | 77a458a | 2007-05-08 11:55:43 +0000 | [diff] [blame] | 723 | /* options */ |
Michael Sevakis | 8cfbd36 | 2008-12-10 08:57:10 +0000 | [diff] [blame] | 724 | const struct settings_list* (*get_settings_list)(int*count); |
Steve Bavin | cd88e2a | 2008-03-25 15:24:03 +0000 | [diff] [blame] | 725 | const struct settings_list* (*find_setting)(const void* variable, int *id); |
Jonathan Gordon | 3e5b389 | 2008-05-15 06:58:36 +0000 | [diff] [blame] | 726 | bool (*option_screen)(const struct settings_list *setting, |
Jonathan Gordon | fe9dca3 | 2008-04-23 11:07:40 +0000 | [diff] [blame] | 727 | struct viewport parent[NB_SCREENS], |
Jonathan Gordon | fe2b376 | 2007-07-23 05:40:45 +0000 | [diff] [blame] | 728 | bool use_temp_var, unsigned char* option_title); |
Steve Bavin | cd88e2a | 2008-03-25 15:24:03 +0000 | [diff] [blame] | 729 | bool (*set_option)(const char* string, const void* variable, |
Steve Bavin | 135cc75 | 2008-03-28 12:51:33 +0000 | [diff] [blame] | 730 | enum optiontype type, const struct opt_items* options, |
| 731 | int numoptions, void (*function)(int)); |
Steve Bavin | cd88e2a | 2008-03-25 15:24:03 +0000 | [diff] [blame] | 732 | bool (*set_bool_options)(const char* string, const bool* variable, |
Steve Bavin | 135cc75 | 2008-03-28 12:51:33 +0000 | [diff] [blame] | 733 | const char* yes_str, int yes_voice, |
| 734 | const char* no_str, int no_voice, |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 735 | void (*function)(bool)); |
Steve Bavin | 135cc75 | 2008-03-28 12:51:33 +0000 | [diff] [blame] | 736 | bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit, |
Michael Giacomelli | 0e783b0 | 2008-12-25 04:24:47 +0000 | [diff] [blame] | 737 | const int* variable, void (*function)(int), int step, |
| 738 | int min, int max, |
Nils Wallménius | 3200d04 | 2009-08-20 16:47:44 +0000 | [diff] [blame] | 739 | const char* (*formatter)(char*, size_t, int, const char*) ); |
Steve Bavin | cd88e2a | 2008-03-25 15:24:03 +0000 | [diff] [blame] | 740 | bool (*set_bool)(const char* string, const bool* variable ); |
Hristo Kovachev | f53f64a | 2006-03-21 09:36:13 +0000 | [diff] [blame] | 741 | |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 742 | #ifdef HAVE_LCD_COLOR |
Teruaki Kawashima | 1549b19 | 2010-02-11 14:18:31 +0000 | [diff] [blame] | 743 | bool (*set_color)(struct screen *display, char *title, |
| 744 | unsigned *color, unsigned banned_color); |
Michael Sevakis | ea255fb | 2007-06-22 09:34:57 +0000 | [diff] [blame] | 745 | #endif |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 746 | /* 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 Mahone | c1c3d05 | 2009-06-01 21:08:49 +0000 | [diff] [blame] | 750 | #ifdef HAVE_TOUCHSCREEN |
| 751 | int (*action_get_touchscreen_press)(short *x, short *y); |
| 752 | #endif |
Miika Pekkarinen | a85044b | 2006-09-16 16:18:11 +0000 | [diff] [blame] | 753 | bool (*action_userabort)(int timeout); |
Hristo Kovachev | f53f64a | 2006-03-21 09:36:13 +0000 | [diff] [blame] | 754 | |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 755 | /* power */ |
| 756 | int (*battery_level)(void); |
| 757 | bool (*battery_level_safe)(void); |
| 758 | int (*battery_time)(void); |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 759 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 760 | unsigned int (*battery_voltage)(void); |
| 761 | #endif |
Jonathan Gordon | 9a6f419 | 2007-02-18 05:32:06 +0000 | [diff] [blame] | 762 | #if CONFIG_CHARGING |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 763 | bool (*charger_inserted)(void); |
Bertrik Sikken | 52d2980 | 2009-03-24 21:59:44 +0000 | [diff] [blame] | 764 | # if CONFIG_CHARGING >= CHARGING_MONITOR |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 765 | bool (*charging_state)(void); |
Dan Everton | d108849 | 2006-03-05 19:34:54 +0000 | [diff] [blame] | 766 | # endif |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 767 | #endif |
| 768 | #ifdef HAVE_USB_POWER |
| 769 | bool (*usb_powered)(void); |
| 770 | #endif |
| 771 | |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 772 | /* misc */ |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 773 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Jonathan Gordon | 1c2aa35 | 2010-02-14 06:26:16 +0000 | [diff] [blame] | 774 | int* __errno; |
| 775 | #endif |
Jean-Philippe Bernardy | effb196 | 2005-02-15 13:28:39 +0000 | [diff] [blame] | 776 | void (*srand)(unsigned int seed); |
| 777 | int (*rand)(void); |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 778 | 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 Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 781 | struct tm* (*get_time)(void); |
Jens Arnold | 0ceaa5e | 2004-08-17 01:45:48 +0000 | [diff] [blame] | 782 | int (*set_time)(const struct tm *tm); |
Tom Ross | e1147b8 | 2007-07-30 05:19:05 +0000 | [diff] [blame] | 783 | #if CONFIG_RTC |
| 784 | time_t (*mktime)(struct tm *t); |
| 785 | #endif |
Michael Sevakis | 26d242a | 2007-04-21 18:38:25 +0000 | [diff] [blame] | 786 | void* (*plugin_get_buffer)(size_t *buffer_size); |
| 787 | void* (*plugin_get_audio_buffer)(size_t *buffer_size); |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 788 | void (*plugin_tsr)(bool (*exit_callback)(bool reenter)); |
Jonathan Gordon | fda7d72 | 2007-08-06 13:42:52 +0000 | [diff] [blame] | 789 | char* (*plugin_get_current_filename)(void); |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 790 | #if defined(DEBUG) || defined(SIMULATOR) |
Jens Arnold | 79c8a8c | 2007-03-17 09:02:53 +0000 | [diff] [blame] | 791 | void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 792 | #endif |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 793 | #ifdef ROCKBOX_HAS_LOGF |
Jens Arnold | 79c8a8c | 2007-03-17 09:02:53 +0000 | [diff] [blame] | 794 | void (*logf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2); |
Jens Arnold | e44372e | 2005-07-26 20:01:11 +0000 | [diff] [blame] | 795 | #endif |
Linus Nielsen Feltzing | f4f4111 | 2004-07-27 14:10:48 +0000 | [diff] [blame] | 796 | struct user_settings* global_settings; |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 797 | struct system_status *global_status; |
Steve Bavin | 32a9575 | 2007-10-19 15:31:42 +0000 | [diff] [blame] | 798 | void (*talk_disable)(bool disable); |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 799 | #if CONFIG_CODEC == SWCODEC |
Michael Sevakis | 2054627 | 2009-01-05 10:31:19 +0000 | [diff] [blame] | 800 | void (*codec_thread_do_callback)(void (*fn)(void), |
| 801 | unsigned int *audio_thread_id); |
Michael Sevakis | c537d59 | 2011-04-27 03:08:23 +0000 | [diff] [blame] | 802 | int (*codec_load_file)(const char* codec, struct codec_api *api); |
| 803 | int (*codec_run_proc)(void); |
| 804 | int (*codec_close)(void); |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 805 | const char *(*get_codec_filename)(int cod_spec); |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 806 | void ** (*find_array_ptr)(void **arr, void *ptr); |
| 807 | int (*remove_array_ptr)(void **arr, void *ptr); |
Michael Sevakis | cf73340 | 2010-07-01 00:26:01 +0000 | [diff] [blame] | 808 | int (*round_value_to_list32)(unsigned long value, |
| 809 | const unsigned long list[], |
| 810 | int count, |
| 811 | bool signd); |
Michael Sevakis | d569998 | 2010-05-24 16:42:32 +0000 | [diff] [blame] | 812 | #endif /* CONFIG_CODEC == SWCODEC */ |
Andrew Mahone | 6f030a0 | 2009-03-06 01:08:02 +0000 | [diff] [blame] | 813 | bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname); |
Thom Johansen | 294ec1d | 2007-09-19 10:40:55 +0000 | [diff] [blame] | 814 | bool (*mp3info)(struct mp3entry *entry, const char *filename); |
Linus Nielsen Feltzing | 70de4ec | 2004-07-27 19:16:58 +0000 | [diff] [blame] | 815 | int (*count_mp3_frames)(int fd, int startpos, int filesize, |
| 816 | void (*progressfunc)(int)); |
Jens Arnold | ba966c1 | 2005-09-15 05:29:26 +0000 | [diff] [blame] | 817 | int (*create_xing_header)(int fd, long startpos, long filesize, |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 818 | 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 Bernardy | 3f65c3f | 2005-01-30 14:33:33 +0000 | [diff] [blame] | 821 | unsigned long (*find_next_frame)(int fd, long *offset, |
Andree Buschmann | 25246f7 | 2011-03-16 18:45:03 +0000 | [diff] [blame] | 822 | long max_offset, unsigned long reference_header); |
Brandon Low | 413da2a | 2006-02-07 20:38:55 +0000 | [diff] [blame] | 823 | |
Jens Arnold | d6c0545 | 2005-08-29 21:15:27 +0000 | [diff] [blame] | 824 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 825 | unsigned short (*peak_meter_scale_value)(unsigned short val, |
| 826 | int meterwidth); |
Jens Arnold | 99a0598 | 2005-08-29 20:07:17 +0000 | [diff] [blame] | 827 | void (*peak_meter_set_use_dbfs)(bool use); |
| 828 | bool (*peak_meter_get_use_dbfs)(void); |
Jens Arnold | 1c841b8 | 2004-10-23 09:59:53 +0000 | [diff] [blame] | 829 | #endif |
Linus Nielsen Feltzing | 250678b | 2005-04-25 07:42:10 +0000 | [diff] [blame] | 830 | #ifdef HAVE_LCD_BITMAP |
Nicolas Pennequin | ec6569e | 2007-11-10 13:26:11 +0000 | [diff] [blame] | 831 | int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize, |
Andrew Mahone | 9058620 | 2008-12-26 07:05:13 +0000 | [diff] [blame] | 832 | int format, const struct custom_format *cformat); |
Andrew Mahone | eef7945 | 2009-05-06 04:53:56 +0000 | [diff] [blame] | 833 | 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 Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 841 | void (*screen_dump_set_hook)(void (*hook)(int fh)); |
Linus Nielsen Feltzing | 250678b | 2005-04-25 07:42:10 +0000 | [diff] [blame] | 842 | #endif |
Linus Nielsen Feltzing | 60895bc | 2005-09-02 05:39:09 +0000 | [diff] [blame] | 843 | int (*show_logo)(void); |
Hristo Kovachev | cc6f37b | 2006-02-18 20:51:34 +0000 | [diff] [blame] | 844 | struct tree_context* (*tree_get_context)(void); |
Teruaki Kawashima | 368e89e | 2010-10-22 12:50:14 +0000 | [diff] [blame] | 845 | void (*set_current_file)(const char* path); |
Jonathan Gordon | fda7d72 | 2007-08-06 13:42:52 +0000 | [diff] [blame] | 846 | void (*set_dirfilter)(int l_dirfilter); |
Dan Everton | d108849 | 2006-03-05 19:34:54 +0000 | [diff] [blame] | 847 | |
Dave Chapman | 491458e | 2006-09-26 19:25:52 +0000 | [diff] [blame] | 848 | #ifdef HAVE_WHEEL_POSITION |
| 849 | int (*wheel_status)(void); |
| 850 | void (*wheel_send_events)(bool send); |
| 851 | #endif |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 852 | |
Miika Pekkarinen | 0ea4d31 | 2007-01-12 18:34:00 +0000 | [diff] [blame] | 853 | #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 Sevakis | 9bfa237 | 2007-04-14 02:46:15 +0000 | [diff] [blame] | 859 | |
Kevin Ferrare | 81aac2a | 2007-07-29 03:43:37 +0000 | [diff] [blame] | 860 | void (*led)(bool on); |
Michael Sevakis | 287d622 | 2007-09-25 02:59:42 +0000 | [diff] [blame] | 861 | |
Michael Sevakis | a9b2fb5 | 2007-10-16 01:25:17 +0000 | [diff] [blame] | 862 | #if (CONFIG_CODEC == SWCODEC) |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 863 | /* buffering API */ |
Thomas Martitz | e9c1018 | 2009-10-16 19:14:41 +0000 | [diff] [blame] | 864 | int (*bufopen)(const char *file, size_t offset, enum data_type type, |
| 865 | void *user_data); |
Steve Bavin | 135cc75 | 2008-03-28 12:51:33 +0000 | [diff] [blame] | 866 | 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 Pennequin | 90ce826 | 2007-12-09 18:48:02 +0000 | [diff] [blame] | 874 | |
Steve Bavin | 135cc75 | 2008-03-28 12:51:33 +0000 | [diff] [blame] | 875 | ssize_t (*buf_handle_offset)(int handle_id); |
Steve Bavin | 135cc75 | 2008-03-28 12:51:33 +0000 | [diff] [blame] | 876 | void (*buf_set_base_handle)(int handle_id); |
Nicolas Pennequin | 90ce826 | 2007-12-09 18:48:02 +0000 | [diff] [blame] | 877 | 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 Sikken | 9464fdd | 2008-08-14 22:35:00 +0000 | [diff] [blame] | 890 | long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag); |
Teruaki Kawashima | 55a6360 | 2010-09-30 13:09:50 +0000 | [diff] [blame] | 891 | #if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE) |
Andrew Mahone | c1c3d05 | 2009-06-01 21:08:49 +0000 | [diff] [blame] | 892 | bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename); |
| 893 | #endif |
Nicolas Pennequin | 90ce826 | 2007-12-09 18:48:02 +0000 | [diff] [blame] | 894 | #endif |
| 895 | |
| 896 | #ifdef HAVE_ALBUMART |
Nicolas Pennequin | 90ce826 | 2007-12-09 18:48:02 +0000 | [diff] [blame] | 897 | bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string, |
| 898 | char *buf, int buflen); |
| 899 | #endif |
Michael Sevakis | a222f27 | 2007-12-29 19:46:35 +0000 | [diff] [blame] | 900 | |
Jonathan Gordon | 468edbb | 2008-09-23 09:59:06 +0000 | [diff] [blame] | 901 | #ifdef HAVE_SEMAPHORE_OBJECTS |
Michael Giacomelli | ccd56bf | 2008-09-20 22:13:39 +0000 | [diff] [blame] | 902 | void (*semaphore_init)(struct semaphore *s, int max, int start); |
Michael Sevakis | 12375d1 | 2011-03-02 08:49:38 +0000 | [diff] [blame] | 903 | int (*semaphore_wait)(struct semaphore *s, int timeout); |
Michael Giacomelli | ccd56bf | 2008-09-20 22:13:39 +0000 | [diff] [blame] | 904 | void (*semaphore_release)(struct semaphore *s); |
Jonathan Gordon | 468edbb | 2008-09-23 09:59:06 +0000 | [diff] [blame] | 905 | #endif |
Michael Giacomelli | ccd56bf | 2008-09-20 22:13:39 +0000 | [diff] [blame] | 906 | |
Rafaël Carré | 5d236b2 | 2010-05-27 09:41:46 +0000 | [diff] [blame] | 907 | const char *rbversion; |
Yoshihisa Uchida | 3691435 | 2010-07-07 12:42:15 +0000 | [diff] [blame] | 908 | |
Jens Arnold | 68a2168 | 2008-03-24 00:35:53 +0000 | [diff] [blame] | 909 | /* new stuff at the end, sort into place next time |
| 910 | the API gets incompatible */ |
Michael Sevakis | a2b6703 | 2011-06-29 06:37:04 +0000 | [diff] [blame^] | 911 | 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 Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 913 | }; |
| 914 | |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 915 | /* plugin header */ |
| 916 | struct plugin_header { |
Thomas Martitz | 0d4585b | 2010-09-09 16:17:21 +0000 | [diff] [blame] | 917 | struct lc_header lc_hdr; /* must be the first */ |
Andrew Mahone | 23d9812 | 2009-01-16 10:34:40 +0000 | [diff] [blame] | 918 | enum plugin_status(*entry_point)(const void*); |
| 919 | const struct plugin_api **api; |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 920 | }; |
Michael Sevakis | acc29d9 | 2006-11-18 02:18:29 +0000 | [diff] [blame] | 921 | |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 922 | #ifdef PLUGIN |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 923 | #if (CONFIG_PLATFORM & PLATFORM_NATIVE) |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 924 | extern unsigned char plugin_start_addr[]; |
| 925 | extern unsigned char plugin_end_addr[]; |
| 926 | #define PLUGIN_HEADER \ |
Tom Ross | 5d190bc | 2009-02-27 07:30:41 +0000 | [diff] [blame] | 927 | const struct plugin_api *rb DATA_ATTR; \ |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 928 | const struct plugin_header __header \ |
| 929 | __attribute__ ((section (".header")))= { \ |
Thomas Martitz | 0d4585b | 2010-09-09 16:17:21 +0000 | [diff] [blame] | 930 | { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \ |
| 931 | plugin_start_addr, plugin_end_addr }, plugin__start, &rb }; |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 932 | #else /* PLATFORM_HOSTED */ |
Jens Arnold | a790277 | 2006-01-16 23:20:58 +0000 | [diff] [blame] | 933 | #define PLUGIN_HEADER \ |
Tom Ross | 5d190bc | 2009-02-27 07:30:41 +0000 | [diff] [blame] | 934 | const struct plugin_api *rb DATA_ATTR; \ |
Nils Wallménius | 605949d | 2007-10-02 09:08:08 +0000 | [diff] [blame] | 935 | const struct plugin_header __header \ |
| 936 | __attribute__((visibility("default"))) = { \ |
Thomas Martitz | 12a2889 | 2010-09-09 16:29:21 +0000 | [diff] [blame] | 937 | { PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, NULL, NULL }, \ |
Thomas Martitz | 0d4585b | 2010-09-09 16:17:21 +0000 | [diff] [blame] | 938 | plugin__start, &rb }; |
Thomas Martitz | 35e8b14 | 2010-06-21 16:53:00 +0000 | [diff] [blame] | 939 | #endif /* CONFIG_PLATFORM */ |
Michael Sevakis | acc29d9 | 2006-11-18 02:18:29 +0000 | [diff] [blame] | 940 | #endif /* PLUGIN */ |
Jens Arnold | a36b1d4 | 2006-01-15 18:20:18 +0000 | [diff] [blame] | 941 | |
Steve Bavin | 6526577 | 2008-05-13 09:57:56 +0000 | [diff] [blame] | 942 | int plugin_load(const char* plugin, const void* parameter); |
Michael Sevakis | 26d242a | 2007-04-21 18:38:25 +0000 | [diff] [blame] | 943 | void* plugin_get_audio_buffer(size_t *buffer_size); |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 944 | |
Michael Sevakis | 6689cb0 | 2007-04-10 14:18:30 +0000 | [diff] [blame] | 945 | /* plugin_tsr, |
Jonathan Gordon | 29e259a | 2006-10-31 11:17:00 +0000 | [diff] [blame] | 946 | callback returns true to allow the new plugin to load, |
| 947 | reenter means the currently running plugin is being reloaded */ |
| 948 | void plugin_tsr(bool (*exit_callback)(bool reenter)); |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 949 | |
| 950 | /* defined by the plugin */ |
Andrew Mahone | 23d9812 | 2009-01-16 10:34:40 +0000 | [diff] [blame] | 951 | extern const struct plugin_api *rb; |
Thomas Martitz | cae4ae2 | 2010-08-24 14:30:46 +0000 | [diff] [blame] | 952 | enum plugin_status plugin__start(const void* parameter) |
Brandon Low | d4f9ebe | 2006-03-16 17:06:20 +0000 | [diff] [blame] | 953 | NO_PROF_ATTR; |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 954 | |
Nils Wallménius | a21004d | 2008-05-19 14:37:16 +0000 | [diff] [blame] | 955 | #endif /* __PCTOOL__ */ |
Björn Stenberg | ba371fb | 2003-06-29 16:33:04 +0000 | [diff] [blame] | 956 | #endif |