Update several codec Makefiles so that the codec libs build again on Coldfire targets...
[Rockbox.git] / apps / plugin.h
blob609f4cc65b091f678596583c7faa4976e2d12ecc
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Björn Stenberg
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #ifndef _PLUGIN_H_
20 #define _PLUGIN_H_
22 /* instruct simulator code to not redefine any symbols when compiling plugins.
23 (the PLUGIN macro is defined in apps/plugins/Makefile) */
24 #ifdef PLUGIN
25 #define NO_REDEFINES_PLEASE
26 #endif
28 #ifndef MEM
29 #define MEM 2
30 #endif
32 #include <stdarg.h>
33 #include <stdbool.h>
34 #include <stdio.h>
35 #include <stdlib.h>
36 #include <sys/types.h>
37 #include "config.h"
38 #include "dir.h"
39 #include "kernel.h"
40 #include "button.h"
41 #include "action.h"
42 #include "usb.h"
43 #include "font.h"
44 #include "system.h"
45 #include "lcd.h"
46 #include "id3.h"
47 #include "mpeg.h"
48 #include "audio.h"
49 #include "mp3_playback.h"
50 #include "tree.h"
51 #ifdef RB_PROFILE
52 #include "profile.h"
53 #endif
54 #include "misc.h"
55 #if (CONFIG_CODEC == SWCODEC)
56 #include "pcm_playback.h"
57 #include "dsp.h"
58 #else
59 #include "mas.h"
60 #endif
61 #include "settings.h"
62 #include "timer.h"
63 #include "thread.h"
64 #include "playlist.h"
65 #ifdef HAVE_LCD_BITMAP
66 #include "widgets.h"
67 #endif
68 #include "sound.h"
69 #include "menu.h"
70 #include "rbunicode.h"
71 #include "list.h"
72 #include "talk.h"
74 #ifdef HAVE_REMOTE_LCD
75 #include "lcd-remote.h"
76 #endif
78 #ifdef PLUGIN
80 #if defined(DEBUG) || defined(SIMULATOR)
81 #undef DEBUGF
82 #define DEBUGF rb->debugf
83 #undef LDEBUGF
84 #define LDEBUGF rb->debugf
85 #else
86 #define DEBUGF(...)
87 #define LDEBUGF(...)
88 #endif
90 #ifdef ROCKBOX_HAS_LOGF
91 #undef LOGF
92 #define LOGF rb->logf
93 #else
94 #define LOGF(...)
95 #endif
97 #endif
99 #ifdef SIMULATOR
100 #define PREFIX(_x_) sim_ ## _x_
101 #else
102 #define PREFIX(_x_) _x_
103 #endif
105 #define PLUGIN_MAGIC 0x526F634B /* RocK */
107 /* increase this every time the api struct changes */
108 #define PLUGIN_API_VERSION 33
110 /* update this to latest version if a change to the api struct breaks
111 backwards compatibility (and please take the opportunity to sort in any
112 new function which are "waiting" at the end of the function table) */
113 #define PLUGIN_MIN_API_VERSION 30
115 /* plugin return codes */
116 enum plugin_status {
117 PLUGIN_OK = 0,
118 PLUGIN_USB_CONNECTED,
119 PLUGIN_ERROR = -1,
122 /* NOTE: To support backwards compatibility, only add new functions at
123 the end of the structure. Every time you add a new function,
124 remember to increase PLUGIN_API_VERSION. If you make changes to the
125 existing APIs then also update PLUGIN_MIN_API_VERSION to current
126 version
128 struct plugin_api {
130 /* lcd */
131 void (*lcd_set_contrast)(int x);
132 void (*lcd_clear_display)(void);
133 void (*lcd_puts)(int x, int y, const unsigned char *string);
134 void (*lcd_puts_scroll)(int x, int y, const unsigned char* string);
135 void (*lcd_stop_scroll)(void);
136 #ifdef HAVE_LCD_CHARCELLS
137 void (*lcd_define_pattern)(int which,const char *pattern);
138 unsigned char (*lcd_get_locked_pattern)(void);
139 void (*lcd_unlock_pattern)(unsigned char pat);
140 void (*lcd_putc)(int x, int y, unsigned short ch);
141 void (*lcd_put_cursor)(int x, int y, char cursor_char);
142 void (*lcd_remove_cursor)(void);
143 void (*PREFIX(lcd_icon))(int icon, bool enable);
144 void (*lcd_double_height)(bool on);
145 #else
146 void (*lcd_setmargins)(int x, int y);
147 void (*lcd_set_drawmode)(int mode);
148 int (*lcd_get_drawmode)(void);
149 void (*lcd_setfont)(int font);
150 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
151 void (*lcd_drawpixel)(int x, int y);
152 void (*lcd_drawline)(int x1, int y1, int x2, int y2);
153 void (*lcd_hline)(int x1, int x2, int y);
154 void (*lcd_vline)(int x, int y1, int y2);
155 void (*lcd_drawrect)(int x, int y, int width, int height);
156 void (*lcd_fillrect)(int x, int y, int width, int height);
157 void (*lcd_mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
158 int stride, int x, int y, int width, int height);
159 void (*lcd_mono_bitmap)(const unsigned char *src, int x, int y,
160 int width, int height);
161 #if LCD_DEPTH > 1
162 void (*lcd_set_foreground)(unsigned foreground);
163 unsigned (*lcd_get_foreground)(void);
164 void (*lcd_set_background)(unsigned foreground);
165 unsigned (*lcd_get_background)(void);
166 void (*lcd_bitmap_part)(const fb_data *src, int src_x, int src_y,
167 int stride, int x, int y, int width, int height);
168 void (*lcd_bitmap)(const fb_data *src, int x, int y, int width,
169 int height);
170 #endif
171 #if LCD_DEPTH == 16
172 void (*lcd_bitmap_transparent_part)(const fb_data *src,
173 int src_x, int src_y, int stride,
174 int x, int y, int width, int height);
175 void (*lcd_bitmap_transparent)(const fb_data *src, int x, int y,
176 int width, int height);
177 #endif
178 unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation );
179 const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code );
180 struct font* (*font_load)(const char *path);
181 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
182 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
183 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
184 int style);
185 fb_data* lcd_framebuffer;
186 void (*lcd_blit) (const fb_data* data, int x, int by, int width,
187 int bheight, int stride);
188 void (*lcd_update)(void);
189 void (*lcd_update_rect)(int x, int y, int width, int height);
190 void (*scrollbar)(int x, int y, int width, int height, int items,
191 int min_shown, int max_shown, int orientation);
192 void (*checkbox)(int x, int y, int width, int height, bool checked);
193 struct font* (*font_get)(int font);
194 int (*font_getstringsize)(const unsigned char *str, int *w, int *h,
195 int fontnumber);
196 int (*font_get_width)(struct font* pf, unsigned short char_code);
197 #endif
198 void (*backlight_on)(void);
199 void (*backlight_off)(void);
200 void (*backlight_set_timeout)(int index);
201 void (*splash)(int ticks, bool center, const unsigned char *fmt, ...);
203 #ifdef HAVE_REMOTE_LCD
204 /* remote lcd */
205 void (*lcd_remote_set_contrast)(int x);
206 void (*lcd_remote_clear_display)(void);
207 void (*lcd_remote_puts)(int x, int y, const unsigned char *string);
208 void (*lcd_remote_lcd_puts_scroll)(int x, int y, const unsigned char* string);
209 void (*lcd_remote_lcd_stop_scroll)(void);
210 void (*lcd_remote_set_drawmode)(int mode);
211 int (*lcd_remote_get_drawmode)(void);
212 void (*lcd_remote_setfont)(int font);
213 int (*lcd_remote_getstringsize)(const unsigned char *str, int *w, int *h);
214 void (*lcd_remote_drawpixel)(int x, int y);
215 void (*lcd_remote_drawline)(int x1, int y1, int x2, int y2);
216 void (*lcd_remote_hline)(int x1, int x2, int y);
217 void (*lcd_remote_vline)(int x, int y1, int y2);
218 void (*lcd_remote_drawrect)(int x, int y, int nx, int ny);
219 void (*lcd_remote_fillrect)(int x, int y, int nx, int ny);
220 void (*lcd_remote_mono_bitmap_part)(const unsigned char *src, int src_x,
221 int src_y, int stride, int x, int y,
222 int width, int height);
223 void (*lcd_remote_mono_bitmap)(const unsigned char *src, int x, int y,
224 int width, int height);
225 void (*lcd_remote_putsxy)(int x, int y, const unsigned char *string);
226 void (*lcd_remote_puts_style)(int x, int y, const unsigned char *str, int style);
227 void (*lcd_remote_puts_scroll_style)(int x, int y, const unsigned char* string,
228 int style);
229 fb_remote_data* lcd_remote_framebuffer;
230 void (*lcd_remote_update)(void);
231 void (*lcd_remote_update_rect)(int x, int y, int width, int height);
233 void (*remote_backlight_on)(void);
234 void (*remote_backlight_off)(void);
235 #endif
236 struct screen* screens[NB_SCREENS];
237 #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
238 void (*lcd_remote_set_foreground)(unsigned foreground);
239 unsigned (*lcd_remote_get_foreground)(void);
240 void (*lcd_remote_set_background)(unsigned background);
241 unsigned (*lcd_remote_get_background)(void);
242 void (*lcd_remote_bitmap_part)(const fb_remote_data *src, int src_x, int src_y,
243 int stride, int x, int y, int width, int height);
244 void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y, int width,
245 int height);
246 #endif
247 #if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR)
248 void (*lcd_yuv_blit)(unsigned char * const src[3],
249 int src_x, int src_y, int stride,
250 int x, int y, int width, int height);
251 #endif
253 /* list */
254 void (*gui_synclist_init)(struct gui_synclist * lists,
255 list_get_name callback_get_item_name,void * data,
256 bool scroll_all,int selected_size);
257 void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items);
258 void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists, list_get_icon icon_callback);
259 int (*gui_synclist_get_nb_items)(struct gui_synclist * lists);
260 int (*gui_synclist_get_sel_pos)(struct gui_synclist * lists);
261 void (*gui_synclist_draw)(struct gui_synclist * lists);
262 void (*gui_synclist_select_item)(struct gui_synclist * lists,
263 int item_number);
264 void (*gui_synclist_select_next)(struct gui_synclist * lists);
265 void (*gui_synclist_select_previous)(struct gui_synclist * lists);
266 void (*gui_synclist_select_next_page)(struct gui_synclist * lists,
267 enum screen_type screen);
268 void (*gui_synclist_select_previous_page)(struct gui_synclist * lists,
269 enum screen_type screen);
270 void (*gui_synclist_add_item)(struct gui_synclist * lists);
271 void (*gui_synclist_del_item)(struct gui_synclist * lists);
272 void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll);
273 void (*gui_synclist_flash)(struct gui_synclist * lists);
274 #ifdef HAVE_LCD_BITMAP
275 void (*gui_synclist_scroll_right)(struct gui_synclist * lists);
276 void (*gui_synclist_scroll_left)(struct gui_synclist * lists);
277 #endif
278 unsigned (*gui_synclist_do_button)(struct gui_synclist * lists, unsigned button);
280 /* button */
281 long (*button_get)(bool block);
282 long (*button_get_w_tmo)(int ticks);
283 int (*button_status)(void);
284 void (*button_clear_queue)(void);
285 #ifdef HAS_BUTTON_HOLD
286 bool (*button_hold)(void);
287 #endif
289 /* file */
290 int (*PREFIX(open))(const char* pathname, int flags);
291 int (*close)(int fd);
292 ssize_t (*read)(int fd, void* buf, size_t count);
293 off_t (*PREFIX(lseek))(int fd, off_t offset, int whence);
294 int (*PREFIX(creat))(const char *pathname, mode_t mode);
295 ssize_t (*write)(int fd, const void* buf, size_t count);
296 int (*PREFIX(remove))(const char* pathname);
297 int (*PREFIX(rename))(const char* path, const char* newname);
298 int (*PREFIX(ftruncate))(int fd, off_t length);
299 off_t (*PREFIX(filesize))(int fd);
300 int (*fdprintf)(int fd, const char *fmt, ...);
301 int (*read_line)(int fd, char* buffer, int buffer_size);
302 bool (*settings_parseline)(char* line, char** name, char** value);
303 #ifndef SIMULATOR
304 void (*ata_sleep)(void);
305 bool (*ata_disk_is_active)(void);
306 #endif
307 void (*reload_directory)(void);
309 /* dir */
310 DIR* (*PREFIX(opendir))(const char* name);
311 int (*PREFIX(closedir))(DIR* dir);
312 struct dirent* (*PREFIX(readdir))(DIR* dir);
313 int (*PREFIX(mkdir))(const char *name, int mode);
314 int (*PREFIX(rmdir))(const char *name);
316 /* kernel/ system */
317 void (*PREFIX(sleep))(int ticks);
318 void (*yield)(void);
319 long* current_tick;
320 long (*default_event_handler)(long event);
321 long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter);
322 struct thread_entry* (*create_thread)(void (*function)(void), void* stack,
323 int stack_size, const char *name
324 IF_PRIO(, int priority));
325 void (*remove_thread)(struct thread_entry *thread);
326 void (*reset_poweroff_timer)(void);
327 #ifndef SIMULATOR
328 int (*system_memory_guard)(int newmode);
329 long *cpu_frequency;
330 #ifdef HAVE_ADJUSTABLE_CPU_FREQ
331 void (*cpu_boost)(bool on_off);
332 #endif
333 bool (*timer_register)(int reg_prio, void (*unregister_callback)(void),
334 long cycles, int int_prio,
335 void (*timer_callback)(void));
336 void (*timer_unregister)(void);
337 bool (*timer_set_period)(long count);
338 #endif
339 void (*queue_init)(struct event_queue *q, bool register_queue);
340 void (*queue_delete)(struct event_queue *q);
341 void (*queue_post)(struct event_queue *q, long id, void *data);
342 void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev,
343 int ticks);
344 void (*usb_acknowledge)(long id);
345 #ifdef RB_PROFILE
346 void (*profile_thread)(void);
347 void (*profstop)(void);
348 void (*profile_func_enter)(void *this_fn, void *call_site);
349 void (*profile_func_exit)(void *this_fn, void *call_site);
350 #endif
352 #ifdef SIMULATOR
353 /* special simulator hooks */
354 #if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
355 void (*sim_lcd_ex_init)(int shades, unsigned long (*getpixel)(int, int));
356 void (*sim_lcd_ex_update_rect)(int x, int y, int width, int height);
357 #endif
358 #endif
360 /* strings and memory */
361 int (*snprintf)(char *buf, size_t size, const char *fmt, ...);
362 int (*vsnprintf)(char *buf, int size, const char *fmt, va_list ap);
363 char* (*strcpy)(char *dst, const char *src);
364 char* (*strncpy)(char *dst, const char *src, size_t length);
365 size_t (*strlen)(const char *str);
366 char * (*strrchr)(const char *s, int c);
367 int (*strcmp)(const char *, const char *);
368 int (*strncmp)(const char *, const char *, size_t);
369 int (*strcasecmp)(const char *, const char *);
370 int (*strncasecmp)(const char *s1, const char *s2, size_t n);
371 void* (*memset)(void *dst, int c, size_t length);
372 void* (*memcpy)(void *out, const void *in, size_t n);
373 void* (*memmove)(void *out, const void *in, size_t n);
374 const unsigned char *_ctype_;
375 int (*atoi)(const char *str);
376 char *(*strchr)(const char *s, int c);
377 char *(*strcat)(char *s1, const char *s2);
378 void *(*memchr)(const void *s1, int c, size_t n);
379 int (*memcmp)(const void *s1, const void *s2, size_t n);
380 char *(*strcasestr) (const char* phaystack, const char* pneedle);
381 /* unicode stuff */
382 const unsigned char* (*utf8decode)(const unsigned char *utf8, unsigned short *ucs);
383 unsigned char* (*iso_decode)(const unsigned char *iso, unsigned char *utf8, int cp, int count);
384 unsigned char* (*utf16LEdecode)(const unsigned char *utf16, unsigned char *utf8, int count);
385 unsigned char* (*utf16BEdecode)(const unsigned char *utf16, unsigned char *utf8, int count);
386 unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8);
387 unsigned long (*utf8length)(const unsigned char *utf8);
388 int (*utf8seek)(const unsigned char* utf8, int offset);
390 /* sound */
391 void (*sound_set)(int setting, int value);
392 bool (*set_sound)(const unsigned char * string,
393 int* variable, int setting);
394 int (*sound_min)(int setting);
395 int (*sound_max)(int setting);
396 #ifndef SIMULATOR
397 void (*mp3_play_data)(const unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size));
398 void (*mp3_play_pause)(bool play);
399 void (*mp3_play_stop)(void);
400 bool (*mp3_is_playing)(void);
401 #if CONFIG_CODEC != SWCODEC
402 void (*bitswap)(unsigned char *data, int length);
403 #endif
404 #if CONFIG_CODEC == SWCODEC
405 void (*pcm_play_data)(void (*get_more)(unsigned char** start, size_t*size),
406 unsigned char* start, size_t size);
407 void (*pcm_play_stop)(void);
408 void (*pcm_set_frequency)(unsigned int frequency);
409 bool (*pcm_is_playing)(void);
410 void (*pcm_play_pause)(bool play);
411 #endif
412 #endif /* !SIMULATOR */
413 #if CONFIG_CODEC == SWCODEC
414 void (*pcm_calculate_peaks)(int *left, int *right);
415 #endif
417 /* playback control */
418 void (*PREFIX(audio_play))(long offset);
419 void (*audio_stop)(void);
420 void (*audio_pause)(void);
421 void (*audio_resume)(void);
422 void (*audio_next)(void);
423 void (*audio_prev)(void);
424 void (*audio_ff_rewind)(long newtime);
425 struct mp3entry* (*audio_next_track)(void);
426 int (*playlist_amount)(void);
427 int (*audio_status)(void);
428 bool (*audio_has_changed_track)(void);
429 struct mp3entry* (*audio_current_track)(void);
430 void (*audio_flush_and_reload_tracks)(void);
431 int (*audio_get_file_pos)(void);
432 #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
433 unsigned long (*mpeg_get_last_header)(void);
434 #endif
435 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
436 (CONFIG_CODEC == SWCODEC)
437 void (*sound_set_pitch)(int pitch);
438 #endif
440 /* MAS communication */
441 #if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
442 int (*mas_readmem)(int bank, int addr, unsigned long* dest, int len);
443 int (*mas_writemem)(int bank, int addr, const unsigned long* src, int len);
444 int (*mas_readreg)(int reg);
445 int (*mas_writereg)(int reg, unsigned int val);
446 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
447 int (*mas_codec_writereg)(int reg, unsigned int val);
448 int (*mas_codec_readreg)(int reg);
449 void (*i2c_begin)(void);
450 void (*i2c_end)(void);
451 int (*i2c_write)(int address, unsigned char* buf, int count );
452 #endif
453 #endif
455 /* menu */
456 int (*menu_init)(const struct menu_item* mitems, int count,
457 int (*callback)(int, int),
458 const char *button1, const char *button2, const char *button3);
459 void (*menu_exit)(int menu);
460 int (*menu_show)(int m);
461 bool (*menu_run)(int menu);
462 int (*menu_cursor)(int menu);
463 char* (*menu_description)(int menu, int position);
464 void (*menu_delete)(int menu, int position);
465 int (*menu_count)(int menu);
466 bool (*menu_moveup)(int menu);
467 bool (*menu_movedown)(int menu);
468 void (*menu_draw)(int menu);
469 void (*menu_insert)(int menu, int position, char *desc, bool (*function) (void));
470 void (*menu_set_cursor)(int menu, int position);
472 bool (*set_option)(const char* string, void* variable,
473 enum optiontype type, const struct opt_items* options,
474 int numoptions, void (*function)(int));
475 bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
476 int* variable, void (*function)(int), int step, int min,
477 int max, void (*formatter)(char*, int, int, const char*) );
478 bool (*set_bool)(const char* string, bool* variable );
480 /* action handling */
481 int (*get_custom_action)(int context,int timeout,
482 const struct button_mapping* (*get_context_map)(int));
483 int (*get_action)(int context, int timeout);
484 void (*action_signalscreenchange)(void);
485 bool (*action_userabort)(int timeout);
487 /* power */
488 int (*battery_level)(void);
489 bool (*battery_level_safe)(void);
490 int (*battery_time)(void);
491 #ifndef SIMULATOR
492 unsigned int (*battery_voltage)(void);
493 #endif
494 #ifdef CONFIG_CHARGING
495 bool (*charger_inserted)(void);
496 # if CONFIG_CHARGING == CHARGING_MONITOR
497 bool (*charging_state)(void);
498 # endif
499 #endif
500 #ifdef HAVE_USB_POWER
501 bool (*usb_powered)(void);
502 #endif
504 /* misc */
505 void (*srand)(unsigned int seed);
506 int (*rand)(void);
507 void (*qsort)(void *base, size_t nmemb, size_t size,
508 int(*compar)(const void *, const void *));
509 int (*kbd_input)(char* buffer, int buflen);
510 struct tm* (*get_time)(void);
511 int (*set_time)(const struct tm *tm);
512 void* (*plugin_get_buffer)(int* buffer_size);
513 void* (*plugin_get_audio_buffer)(int* buffer_size);
514 void (*plugin_tsr)(void (*exit_callback)(void));
515 #if defined(DEBUG) || defined(SIMULATOR)
516 void (*debugf)(const char *fmt, ...);
517 #endif
518 #ifdef ROCKBOX_HAS_LOGF
519 void (*logf)(const char *fmt, ...);
520 #endif
521 struct user_settings* global_settings;
522 bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first);
523 int (*count_mp3_frames)(int fd, int startpos, int filesize,
524 void (*progressfunc)(int));
525 int (*create_xing_header)(int fd, long startpos, long filesize,
526 unsigned char *buf, unsigned long num_frames,
527 unsigned long rec_time, unsigned long header_template,
528 void (*progressfunc)(int), bool generate_toc);
529 unsigned long (*find_next_frame)(int fd, long *offset,
530 long max_offset, unsigned long last_header);
532 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
533 unsigned short (*peak_meter_scale_value)(unsigned short val,
534 int meterwidth);
535 void (*peak_meter_set_use_dbfs)(bool use);
536 bool (*peak_meter_get_use_dbfs)(void);
537 #endif
538 #ifdef HAVE_LCD_BITMAP
539 int (*read_bmp_file)(char* filename, struct bitmap *bm, int maxsize,
540 int format);
541 void (*screen_dump_set_hook)(void (*hook)(int fh));
542 #endif
543 int (*show_logo)(void);
544 struct tree_context* (*tree_get_context)(void);
546 /* new stuff at the end, sort into place next time
547 the API gets incompatible */
549 char* (*strtok_r)(char *ptr, const char *sep, char **end);
551 #ifdef HAVE_WHEEL_POSITION
552 int (*wheel_status)(void);
553 void (*wheel_send_events)(bool send);
554 #endif
555 void (*ata_spindown)(int seconds);
558 /* plugin header */
559 struct plugin_header {
560 unsigned long magic;
561 unsigned short target_id;
562 unsigned short api_version;
563 unsigned char *load_addr;
564 unsigned char *end_addr;
565 enum plugin_status(*entry_point)(struct plugin_api*, void*);
567 #ifdef PLUGIN
568 #ifndef SIMULATOR
569 extern unsigned char plugin_start_addr[];
570 extern unsigned char plugin_end_addr[];
571 #define PLUGIN_HEADER \
572 const struct plugin_header __header \
573 __attribute__ ((section (".header")))= { \
574 PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
575 plugin_start_addr, plugin_end_addr, plugin_start };
576 #else /* SIMULATOR */
577 #define PLUGIN_HEADER \
578 const struct plugin_header __header = { \
579 PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
580 NULL, NULL, plugin_start };
581 #endif
582 #endif
584 int plugin_load(const char* plugin, void* parameter);
585 void* plugin_get_buffer(int *buffer_size);
586 void* plugin_get_audio_buffer(int *buffer_size);
587 void plugin_tsr(void (*exit_callback)(void));
589 /* defined by the plugin */
590 enum plugin_status plugin_start(struct plugin_api* rockbox, void* parameter)
591 NO_PROF_ATTR;
593 #endif