2003-06-29 16:33:04 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002 Bj<EFBFBD>rn Stenberg
|
|
|
|
|
*
|
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
|
*
|
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
|
* KIND, either express or implied.
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
#ifndef _PLUGIN_H_
|
|
|
|
|
#define _PLUGIN_H_
|
|
|
|
|
|
|
|
|
|
/* instruct simulator code to not redefine any symbols when compiling plugins.
|
|
|
|
|
(the PLUGIN macro is defined in apps/plugins/Makefile) */
|
|
|
|
|
#ifdef PLUGIN
|
|
|
|
|
#define NO_REDEFINES_PLEASE
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-07-13 22:15:19 +00:00
|
|
|
|
#ifndef MEM
|
|
|
|
|
#define MEM 2
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
2005-02-22 12:19:12 +00:00
|
|
|
|
#include <sys/types.h>
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "dir.h"
|
|
|
|
|
#include "kernel.h"
|
|
|
|
|
#include "button.h"
|
2006-01-25 18:29:56 +00:00
|
|
|
|
#include "usb.h"
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include "font.h"
|
|
|
|
|
#include "system.h"
|
|
|
|
|
#include "lcd.h"
|
2003-07-20 21:29:16 +00:00
|
|
|
|
#include "id3.h"
|
|
|
|
|
#include "mpeg.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
|
#include "audio.h"
|
2004-01-30 22:30:40 +00:00
|
|
|
|
#include "mp3_playback.h"
|
2006-02-18 20:51:34 +00:00
|
|
|
|
#include "tree.h"
|
2006-01-18 20:54:13 +00:00
|
|
|
|
#ifdef RB_PROFILE
|
|
|
|
|
#include "profile.h"
|
|
|
|
|
#endif
|
2005-09-02 05:39:09 +00:00
|
|
|
|
#include "misc.h"
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if (HWCODEC == SWCODEC)
|
2005-03-28 00:00:24 +00:00
|
|
|
|
#include "pcm_playback.h"
|
2006-03-05 19:34:54 +00:00
|
|
|
|
#include "dsp.h"
|
2005-04-25 08:21:10 +00:00
|
|
|
|
#endif
|
2004-01-30 22:30:40 +00:00
|
|
|
|
#include "settings.h"
|
2005-07-26 20:01:11 +00:00
|
|
|
|
#include "timer.h"
|
2004-04-30 20:37:11 +00:00
|
|
|
|
#include "thread.h"
|
2004-06-19 09:36:03 +00:00
|
|
|
|
#include "playlist.h"
|
2004-07-08 13:14:44 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
|
|
|
|
#include "widgets.h"
|
|
|
|
|
#endif
|
2005-04-01 13:41:03 +00:00
|
|
|
|
#include "sound.h"
|
2005-09-22 08:54:48 +00:00
|
|
|
|
#include "menu.h"
|
2005-12-06 13:27:15 +00:00
|
|
|
|
#include "rbunicode.h"
|
2003-07-24 09:35:32 +00:00
|
|
|
|
|
2005-04-15 12:55:31 +00:00
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
|
#include "lcd-remote.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-06-10 13:29:52 +00:00
|
|
|
|
#ifdef PLUGIN
|
2005-06-18 19:19:12 +00:00
|
|
|
|
|
2004-06-10 13:29:52 +00:00
|
|
|
|
#if defined(DEBUG) || defined(SIMULATOR)
|
2005-02-22 12:19:12 +00:00
|
|
|
|
#undef DEBUGF
|
2004-08-30 19:52:45 +00:00
|
|
|
|
#define DEBUGF rb->debugf
|
2005-02-22 12:19:12 +00:00
|
|
|
|
#undef LDEBUGF
|
2004-06-10 13:29:52 +00:00
|
|
|
|
#define LDEBUGF rb->debugf
|
|
|
|
|
#else
|
|
|
|
|
#define DEBUGF(...)
|
|
|
|
|
#define LDEBUGF(...)
|
|
|
|
|
#endif
|
2005-06-18 19:19:12 +00:00
|
|
|
|
|
|
|
|
|
#ifdef ROCKBOX_HAS_LOGF
|
|
|
|
|
#undef LOGF
|
|
|
|
|
#define LOGF rb->logf
|
|
|
|
|
#else
|
|
|
|
|
#define LOGF(...)
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-06-10 13:29:52 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2005-02-22 12:19:12 +00:00
|
|
|
|
#ifdef SIMULATOR
|
|
|
|
|
#define PREFIX(_x_) sim_ ## _x_
|
|
|
|
|
#else
|
|
|
|
|
#define PREFIX(_x_) _x_
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
#define PLUGIN_MAGIC 0x526F634B /* RocK */
|
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
/* increase this every time the api struct changes */
|
2006-03-21 09:36:13 +00:00
|
|
|
|
#define PLUGIN_API_VERSION 13
|
2003-07-25 23:04:59 +00:00
|
|
|
|
|
|
|
|
|
/* update this to latest version if a change to the api struct breaks
|
2004-02-03 23:56:25 +00:00
|
|
|
|
backwards compatibility (and please take the opportunity to sort in any
|
|
|
|
|
new function which are "waiting" at the end of the function table) */
|
2006-03-21 09:36:13 +00:00
|
|
|
|
#define PLUGIN_MIN_API_VERSION 13
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* plugin return codes */
|
|
|
|
|
enum plugin_status {
|
|
|
|
|
PLUGIN_OK = 0,
|
|
|
|
|
PLUGIN_USB_CONNECTED,
|
2006-01-15 18:20:18 +00:00
|
|
|
|
PLUGIN_ERROR = -1,
|
2003-06-29 16:33:04 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-07-25 23:04:59 +00:00
|
|
|
|
/* NOTE: To support backwards compatibility, only add new functions at
|
|
|
|
|
the end of the structure. Every time you add a new function,
|
|
|
|
|
remember to increase PLUGIN_API_VERSION. If you make changes to the
|
|
|
|
|
existing APIs then also update PLUGIN_MIN_API_VERSION to current
|
|
|
|
|
version
|
|
|
|
|
*/
|
2003-06-29 16:33:04 +00:00
|
|
|
|
struct plugin_api {
|
|
|
|
|
|
|
|
|
|
/* lcd */
|
2005-06-24 22:33:21 +00:00
|
|
|
|
void (*lcd_set_contrast)(int x);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
void (*lcd_clear_display)(void);
|
2004-08-01 21:50:57 +00:00
|
|
|
|
void (*lcd_puts)(int x, int y, const unsigned char *string);
|
2004-08-16 23:37:23 +00:00
|
|
|
|
void (*lcd_puts_scroll)(int x, int y, const unsigned char* string);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
void (*lcd_stop_scroll)(void);
|
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
2004-08-17 01:45:48 +00:00
|
|
|
|
void (*lcd_define_pattern)(int which,const char *pattern);
|
2003-07-24 09:35:32 +00:00
|
|
|
|
unsigned char (*lcd_get_locked_pattern)(void);
|
|
|
|
|
void (*lcd_unlock_pattern)(unsigned char pat);
|
|
|
|
|
void (*lcd_putc)(int x, int y, unsigned short ch);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*lcd_put_cursor)(int x, int y, char cursor_char);
|
|
|
|
|
void (*lcd_remove_cursor)(void);
|
2005-02-22 13:02:33 +00:00
|
|
|
|
void (*PREFIX(lcd_icon))(int icon, bool enable);
|
2005-09-02 05:39:09 +00:00
|
|
|
|
void (*lcd_double_height)(bool on);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#else
|
2005-06-24 22:33:21 +00:00
|
|
|
|
void (*lcd_set_drawmode)(int mode);
|
|
|
|
|
int (*lcd_get_drawmode)(void);
|
|
|
|
|
void (*lcd_setfont)(int font);
|
|
|
|
|
int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
|
|
|
|
|
void (*lcd_drawpixel)(int x, int y);
|
|
|
|
|
void (*lcd_drawline)(int x1, int y1, int x2, int y2);
|
2005-06-28 23:15:47 +00:00
|
|
|
|
void (*lcd_hline)(int x1, int x2, int y);
|
|
|
|
|
void (*lcd_vline)(int x, int y1, int y2);
|
|
|
|
|
void (*lcd_drawrect)(int x, int y, int width, int height);
|
|
|
|
|
void (*lcd_fillrect)(int x, int y, int width, int height);
|
2005-07-06 22:58:02 +00:00
|
|
|
|
void (*lcd_mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
|
|
|
|
|
int stride, int x, int y, int width, int height);
|
|
|
|
|
void (*lcd_mono_bitmap)(const unsigned char *src, int x, int y,
|
|
|
|
|
int width, int height);
|
2005-07-26 20:01:11 +00:00
|
|
|
|
#if LCD_DEPTH > 1
|
2005-11-16 21:09:23 +00:00
|
|
|
|
void (*lcd_set_foreground)(unsigned foreground);
|
|
|
|
|
unsigned (*lcd_get_foreground)(void);
|
|
|
|
|
void (*lcd_set_background)(unsigned foreground);
|
|
|
|
|
unsigned (*lcd_get_background)(void);
|
2005-11-14 20:43:49 +00:00
|
|
|
|
void (*lcd_bitmap_part)(const fb_data *src, int src_x, int src_y,
|
2005-07-26 20:01:11 +00:00
|
|
|
|
int stride, int x, int y, int width, int height);
|
2005-11-14 20:43:49 +00:00
|
|
|
|
void (*lcd_bitmap)(const fb_data *src, int x, int y, int width,
|
2005-07-26 20:01:11 +00:00
|
|
|
|
int height);
|
2006-02-07 20:38:55 +00:00
|
|
|
|
#endif
|
|
|
|
|
#if LCD_DEPTH == 16
|
|
|
|
|
void (*lcd_bitmap_transparent_part)(const fb_data *src,
|
|
|
|
|
int src_x, int src_y, int stride,
|
|
|
|
|
int x, int y, int width, int height);
|
2006-03-05 19:34:54 +00:00
|
|
|
|
void (*lcd_bitmap_transparent)(const fb_data *src, int x, int y,
|
2006-02-07 20:38:55 +00:00
|
|
|
|
int width, int height);
|
2005-07-26 20:01:11 +00:00
|
|
|
|
#endif
|
2004-07-19 21:46:37 +00:00
|
|
|
|
void (*lcd_putsxy)(int x, int y, const unsigned char *string);
|
2004-08-01 21:50:57 +00:00
|
|
|
|
void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
|
2004-10-23 09:59:53 +00:00
|
|
|
|
void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
|
|
|
|
|
int style);
|
2005-11-14 20:43:49 +00:00
|
|
|
|
fb_data* lcd_framebuffer;
|
|
|
|
|
void (*lcd_blit) (const fb_data* data, int x, int by, int width,
|
2005-06-28 23:15:47 +00:00
|
|
|
|
int bheight, int stride);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
void (*lcd_update)(void);
|
|
|
|
|
void (*lcd_update_rect)(int x, int y, int width, int height);
|
2003-07-09 22:36:23 +00:00
|
|
|
|
void (*scrollbar)(int x, int y, int width, int height, int items,
|
|
|
|
|
int min_shown, int max_shown, int orientation);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*checkbox)(int x, int y, int width, int height, bool checked);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
struct font* (*font_get)(int font);
|
2005-07-26 20:01:11 +00:00
|
|
|
|
int (*font_getstringsize)(const unsigned char *str, int *w, int *h,
|
|
|
|
|
int fontnumber);
|
2006-01-15 18:20:18 +00:00
|
|
|
|
int (*font_get_width)(struct font* pf, unsigned short char_code);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#endif
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*backlight_on)(void);
|
|
|
|
|
void (*backlight_off)(void);
|
2004-10-23 09:59:53 +00:00
|
|
|
|
void (*backlight_set_timeout)(int index);
|
2005-12-05 22:44:42 +00:00
|
|
|
|
void (*splash)(int ticks, bool center, const unsigned char *fmt, ...);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2005-04-15 12:55:31 +00:00
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2005-06-18 01:25:47 +00:00
|
|
|
|
/* remote lcd */
|
2005-06-29 01:39:50 +00:00
|
|
|
|
void (*lcd_remote_set_contrast)(int x);
|
|
|
|
|
void (*lcd_remote_clear_display)(void);
|
|
|
|
|
void (*lcd_remote_puts)(int x, int y, const unsigned char *string);
|
|
|
|
|
void (*lcd_remote_lcd_puts_scroll)(int x, int y, const unsigned char* string);
|
|
|
|
|
void (*lcd_remote_lcd_stop_scroll)(void);
|
|
|
|
|
void (*lcd_remote_set_drawmode)(int mode);
|
|
|
|
|
int (*lcd_remote_get_drawmode)(void);
|
|
|
|
|
void (*lcd_remote_setfont)(int font);
|
|
|
|
|
int (*lcd_remote_getstringsize)(const unsigned char *str, int *w, int *h);
|
|
|
|
|
void (*lcd_remote_drawpixel)(int x, int y);
|
|
|
|
|
void (*lcd_remote_drawline)(int x1, int y1, int x2, int y2);
|
|
|
|
|
void (*lcd_remote_hline)(int x1, int x2, int y);
|
|
|
|
|
void (*lcd_remote_vline)(int x, int y1, int y2);
|
|
|
|
|
void (*lcd_remote_drawrect)(int x, int y, int nx, int ny);
|
|
|
|
|
void (*lcd_remote_fillrect)(int x, int y, int nx, int ny);
|
2005-07-07 00:05:29 +00:00
|
|
|
|
void (*lcd_remote_mono_bitmap_part)(const unsigned char *src, int src_x,
|
|
|
|
|
int src_y, int stride, int x, int y,
|
|
|
|
|
int width, int height);
|
|
|
|
|
void (*lcd_remote_mono_bitmap)(const unsigned char *src, int x, int y,
|
2005-06-29 01:39:50 +00:00
|
|
|
|
int width, int height);
|
|
|
|
|
void (*lcd_remote_putsxy)(int x, int y, const unsigned char *string);
|
|
|
|
|
void (*lcd_remote_puts_style)(int x, int y, const unsigned char *str, int style);
|
|
|
|
|
void (*lcd_remote_puts_scroll_style)(int x, int y, const unsigned char* string,
|
|
|
|
|
int style);
|
|
|
|
|
unsigned char* lcd_remote_framebuffer;
|
|
|
|
|
void (*lcd_remote_update)(void);
|
|
|
|
|
void (*lcd_remote_update_rect)(int x, int y, int width, int height);
|
2005-06-18 01:25:47 +00:00
|
|
|
|
|
2005-04-15 12:55:31 +00:00
|
|
|
|
void (*remote_backlight_on)(void);
|
2005-06-18 01:25:47 +00:00
|
|
|
|
void (*remote_backlight_off)(void);
|
2005-04-15 12:55:31 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
/* button */
|
2005-02-07 23:11:20 +00:00
|
|
|
|
long (*button_get)(bool block);
|
|
|
|
|
long (*button_get_w_tmo)(int ticks);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
int (*button_status)(void);
|
|
|
|
|
void (*button_clear_queue)(void);
|
2006-03-21 09:36:13 +00:00
|
|
|
|
#ifdef HAS_BUTTON_HOLD
|
2005-06-18 01:25:47 +00:00
|
|
|
|
bool (*button_hold)(void);
|
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* file */
|
2005-02-22 12:19:12 +00:00
|
|
|
|
int (*PREFIX(open))(const char* pathname, int flags);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
int (*close)(int fd);
|
2003-12-08 21:58:38 +00:00
|
|
|
|
ssize_t (*read)(int fd, void* buf, size_t count);
|
2005-02-28 18:32:57 +00:00
|
|
|
|
off_t (*PREFIX(lseek))(int fd, off_t offset, int whence);
|
2005-02-22 12:19:12 +00:00
|
|
|
|
int (*PREFIX(creat))(const char *pathname, mode_t mode);
|
2003-12-08 21:58:38 +00:00
|
|
|
|
ssize_t (*write)(int fd, const void* buf, size_t count);
|
2005-02-22 12:19:12 +00:00
|
|
|
|
int (*PREFIX(remove))(const char* pathname);
|
|
|
|
|
int (*PREFIX(rename))(const char* path, const char* newname);
|
|
|
|
|
int (*PREFIX(ftruncate))(int fd, off_t length);
|
|
|
|
|
off_t (*PREFIX(filesize))(int fd);
|
|
|
|
|
int (*fdprintf)(int fd, const char *fmt, ...);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
int (*read_line)(int fd, char* buffer, int buffer_size);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
bool (*settings_parseline)(char* line, char** name, char** value);
|
2004-07-27 19:16:58 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2005-11-07 23:19:06 +00:00
|
|
|
|
void (*ata_sleep)(void);
|
2006-02-07 20:38:55 +00:00
|
|
|
|
bool (*ata_disk_is_active)(void);
|
2004-07-27 19:16:58 +00:00
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* dir */
|
2005-02-28 21:58:09 +00:00
|
|
|
|
DIR* (*PREFIX(opendir))(const char* name);
|
|
|
|
|
int (*PREFIX(closedir))(DIR* dir);
|
|
|
|
|
struct dirent* (*PREFIX(readdir))(DIR* dir);
|
2005-06-18 01:25:47 +00:00
|
|
|
|
int (*PREFIX(mkdir))(const char *name, int mode);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2004-10-23 09:59:53 +00:00
|
|
|
|
/* kernel/ system */
|
2005-02-22 12:19:12 +00:00
|
|
|
|
void (*PREFIX(sleep))(int ticks);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*yield)(void);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
long* current_tick;
|
2005-02-07 22:56:37 +00:00
|
|
|
|
long (*default_event_handler)(long event);
|
|
|
|
|
long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter);
|
2005-07-12 10:05:13 +00:00
|
|
|
|
int (*create_thread)(void (*function)(void), void* stack, int stack_size, const char *name);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*remove_thread)(int threadnum);
|
2004-07-27 19:16:58 +00:00
|
|
|
|
void (*reset_poweroff_timer)(void);
|
2004-10-23 09:59:53 +00:00
|
|
|
|
#ifndef SIMULATOR
|
|
|
|
|
int (*system_memory_guard)(int newmode);
|
2005-06-18 01:25:47 +00:00
|
|
|
|
long *cpu_frequency;
|
|
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
|
|
|
|
void (*cpu_boost)(bool on_off);
|
|
|
|
|
#endif
|
2005-07-26 20:01:11 +00:00
|
|
|
|
bool (*timer_register)(int reg_prio, void (*unregister_callback)(void),
|
|
|
|
|
long cycles, int int_prio,
|
|
|
|
|
void (*timer_callback)(void));
|
|
|
|
|
void (*timer_unregister)(void);
|
|
|
|
|
bool (*timer_set_period)(long count);
|
2004-10-23 09:59:53 +00:00
|
|
|
|
#endif
|
2006-02-07 20:38:55 +00:00
|
|
|
|
void (*queue_init)(struct event_queue *q);
|
|
|
|
|
void (*queue_delete)(struct event_queue *q);
|
|
|
|
|
void (*queue_post)(struct event_queue *q, long id, void *data);
|
|
|
|
|
void (*queue_wait_w_tmo)(struct event_queue *q, struct event *ev,
|
|
|
|
|
int ticks);
|
|
|
|
|
void (*usb_acknowledge)(long id);
|
|
|
|
|
#ifdef RB_PROFILE
|
|
|
|
|
void (*profile_thread)(void);
|
|
|
|
|
void (*profstop)(void);
|
|
|
|
|
void (*profile_func_enter)(void *this_fn, void *call_site);
|
|
|
|
|
void (*profile_func_exit)(void *this_fn, void *call_site);
|
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2006-03-11 09:28:49 +00:00
|
|
|
|
#ifdef SIMULATOR
|
|
|
|
|
/* special simulator hooks */
|
|
|
|
|
#if defined(HAVE_LCD_BITMAP) && LCD_DEPTH < 8
|
|
|
|
|
void (*sim_lcd_ex_init)(int shades, unsigned long (*getpixel)(int, int));
|
|
|
|
|
void (*sim_lcd_ex_update_rect)(int x, int y, int width, int height);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
/* strings and memory */
|
2004-10-23 09:59:53 +00:00
|
|
|
|
int (*snprintf)(char *buf, size_t size, const char *fmt, ...);
|
|
|
|
|
char* (*strcpy)(char *dst, const char *src);
|
|
|
|
|
char* (*strncpy)(char *dst, const char *src, size_t length);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
size_t (*strlen)(const char *str);
|
2004-07-13 14:14:30 +00:00
|
|
|
|
char * (*strrchr)(const char *s, int c);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
int (*strcmp)(const char *, const char *);
|
2005-07-26 20:01:11 +00:00
|
|
|
|
int (*strncmp)(const char *, const char *, size_t);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
int (*strcasecmp)(const char *, const char *);
|
2004-10-23 09:59:53 +00:00
|
|
|
|
int (*strncasecmp)(const char *s1, const char *s2, size_t n);
|
|
|
|
|
void* (*memset)(void *dst, int c, size_t length);
|
|
|
|
|
void* (*memcpy)(void *out, const void *in, size_t n);
|
2006-02-07 20:38:55 +00:00
|
|
|
|
void* (*memmove)(void *out, const void *in, size_t n);
|
2005-07-12 11:06:38 +00:00
|
|
|
|
const unsigned char *_ctype_;
|
2004-07-27 19:16:58 +00:00
|
|
|
|
int (*atoi)(const char *str);
|
2005-02-22 12:19:12 +00:00
|
|
|
|
char *(*strchr)(const char *s, int c);
|
|
|
|
|
char *(*strcat)(char *s1, const char *s2);
|
|
|
|
|
int (*memcmp)(const void *s1, const void *s2, size_t n);
|
2005-06-18 01:25:47 +00:00
|
|
|
|
char *(*strcasestr) (const char* phaystack, const char* pneedle);
|
2006-01-15 18:20:18 +00:00
|
|
|
|
/* unicode stuff */
|
|
|
|
|
const unsigned char* (*utf8decode)(const unsigned char *utf8, unsigned short *ucs);
|
|
|
|
|
unsigned char* (*iso_decode)(const unsigned char *iso, unsigned char *utf8, int cp, int count);
|
|
|
|
|
unsigned char* (*utf16LEdecode)(const unsigned char *utf16, unsigned char *utf8, unsigned int count);
|
|
|
|
|
unsigned char* (*utf16BEdecode)(const unsigned char *utf16, unsigned char *utf8, unsigned int count);
|
|
|
|
|
unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8);
|
|
|
|
|
unsigned long (*utf8length)(const unsigned char *utf8);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* sound */
|
2005-04-01 13:41:03 +00:00
|
|
|
|
void (*sound_set)(int setting, int value);
|
2006-01-15 18:20:18 +00:00
|
|
|
|
int (*sound_min)(int setting);
|
|
|
|
|
int (*sound_max)(int setting);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2004-08-16 23:37:23 +00:00
|
|
|
|
void (*mp3_play_data)(const unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size));
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*mp3_play_pause)(bool play);
|
|
|
|
|
void (*mp3_play_stop)(void);
|
|
|
|
|
bool (*mp3_is_playing)(void);
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*bitswap)(unsigned char *data, int length);
|
2005-06-06 00:34:07 +00:00
|
|
|
|
#endif
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
2006-02-07 20:38:55 +00:00
|
|
|
|
void (*pcm_play_data)(void (*get_more)(unsigned char** start, size_t*size),
|
|
|
|
|
unsigned char* start, size_t size);
|
2005-06-18 01:25:47 +00:00
|
|
|
|
void (*pcm_play_stop)(void);
|
|
|
|
|
void (*pcm_set_frequency)(unsigned int frequency);
|
|
|
|
|
bool (*pcm_is_playing)(void);
|
|
|
|
|
void (*pcm_play_pause)(bool play);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#endif
|
2005-06-18 01:25:47 +00:00
|
|
|
|
#endif /* !SIMULATOR */
|
2006-03-11 09:38:12 +00:00
|
|
|
|
#if CONFIG_CODEC == SWCODEC
|
|
|
|
|
void (*pcm_calculate_peaks)(int *left, int *right);
|
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2004-07-27 14:10:48 +00:00
|
|
|
|
/* playback control */
|
2006-03-03 02:09:58 +00:00
|
|
|
|
void (*PREFIX(audio_play))(long offset);
|
2005-04-04 12:06:29 +00:00
|
|
|
|
void (*audio_stop)(void);
|
|
|
|
|
void (*audio_pause)(void);
|
|
|
|
|
void (*audio_resume)(void);
|
|
|
|
|
void (*audio_next)(void);
|
|
|
|
|
void (*audio_prev)(void);
|
2006-03-03 02:09:58 +00:00
|
|
|
|
void (*audio_ff_rewind)(long newtime);
|
2005-04-04 12:06:29 +00:00
|
|
|
|
struct mp3entry* (*audio_next_track)(void);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
int (*playlist_amount)(void);
|
2005-04-04 12:06:29 +00:00
|
|
|
|
int (*audio_status)(void);
|
|
|
|
|
bool (*audio_has_changed_track)(void);
|
|
|
|
|
struct mp3entry* (*audio_current_track)(void);
|
|
|
|
|
void (*audio_flush_and_reload_tracks)(void);
|
|
|
|
|
int (*audio_get_file_pos)(void);
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
|
2005-04-25 08:21:10 +00:00
|
|
|
|
unsigned long (*mpeg_get_last_header)(void);
|
2005-04-25 08:59:19 +00:00
|
|
|
|
#endif
|
2006-03-05 19:46:33 +00:00
|
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
|
|
|
|
|
(CONFIG_CODEC == SWCODEC)
|
2005-04-01 13:41:03 +00:00
|
|
|
|
void (*sound_set_pitch)(int pitch);
|
2006-03-05 19:46:33 +00:00
|
|
|
|
#endif
|
2004-07-27 19:16:58 +00:00
|
|
|
|
|
|
|
|
|
/* MAS communication */
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if !defined(SIMULATOR) && (CONFIG_CODEC != SWCODEC)
|
2004-07-27 19:16:58 +00:00
|
|
|
|
int (*mas_readmem)(int bank, int addr, unsigned long* dest, int len);
|
2004-08-17 01:45:48 +00:00
|
|
|
|
int (*mas_writemem)(int bank, int addr, const unsigned long* src, int len);
|
2004-07-27 19:16:58 +00:00
|
|
|
|
int (*mas_readreg)(int reg);
|
|
|
|
|
int (*mas_writereg)(int reg, unsigned int val);
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2004-07-27 19:16:58 +00:00
|
|
|
|
int (*mas_codec_writereg)(int reg, unsigned int val);
|
|
|
|
|
int (*mas_codec_readreg)(int reg);
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
2004-10-23 09:59:53 +00:00
|
|
|
|
|
2005-06-18 01:25:47 +00:00
|
|
|
|
/* tag database */
|
|
|
|
|
struct tagdb_header *tagdbheader;
|
|
|
|
|
int *tagdb_fd;
|
|
|
|
|
int *tagdb_initialized;
|
|
|
|
|
int (*tagdb_init) (void);
|
2005-07-26 20:01:11 +00:00
|
|
|
|
/* runtime database */
|
|
|
|
|
struct rundb_header *rundbheader;
|
|
|
|
|
int *rundb_fd;
|
|
|
|
|
int *rundb_initialized;
|
2005-06-18 01:25:47 +00:00
|
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
/* menu */
|
|
|
|
|
int (*menu_init)(const struct menu_item* mitems, int count,
|
|
|
|
|
int (*callback)(int, int),
|
|
|
|
|
const char *button1, const char *button2, const char *button3);
|
|
|
|
|
void (*menu_exit)(int menu);
|
|
|
|
|
int (*menu_show)(int m);
|
|
|
|
|
bool (*menu_run)(int menu);
|
|
|
|
|
int (*menu_cursor)(int menu);
|
|
|
|
|
char* (*menu_description)(int menu, int position);
|
|
|
|
|
void (*menu_delete)(int menu, int position);
|
|
|
|
|
int (*menu_count)(int menu);
|
|
|
|
|
bool (*menu_moveup)(int menu);
|
|
|
|
|
bool (*menu_movedown)(int menu);
|
|
|
|
|
void (*menu_draw)(int menu);
|
|
|
|
|
void (*menu_insert)(int menu, int position, char *desc, bool (*function) (void));
|
|
|
|
|
void (*menu_set_cursor)(int menu, int position);
|
|
|
|
|
|
2006-03-21 09:36:13 +00:00
|
|
|
|
bool (*set_option)(const char* string, void* variable,
|
|
|
|
|
enum optiontype type, const struct opt_items* options,
|
|
|
|
|
int numoptions, void (*function)(int));
|
|
|
|
|
|
|
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
|
/* power */
|
|
|
|
|
int (*battery_level)(void);
|
|
|
|
|
bool (*battery_level_safe)(void);
|
|
|
|
|
int (*battery_time)(void);
|
|
|
|
|
#ifndef SIMULATOR
|
|
|
|
|
unsigned int (*battery_voltage)(void);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_CHARGING
|
|
|
|
|
bool (*charger_inserted)(void);
|
|
|
|
|
# ifdef HAVE_CHARGE_STATE
|
|
|
|
|
bool (*charging_state)(void);
|
2006-03-05 19:34:54 +00:00
|
|
|
|
# endif
|
2006-02-07 20:38:55 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
|
bool (*usb_powered)(void);
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
/* misc */
|
2005-02-15 13:28:39 +00:00
|
|
|
|
void (*srand)(unsigned int seed);
|
|
|
|
|
int (*rand)(void);
|
2003-06-29 21:42:15 +00:00
|
|
|
|
void (*qsort)(void *base, size_t nmemb, size_t size,
|
|
|
|
|
int(*compar)(const void *, const void *));
|
2003-07-09 22:36:23 +00:00
|
|
|
|
int (*kbd_input)(char* buffer, int buflen);
|
2003-07-24 10:02:45 +00:00
|
|
|
|
struct tm* (*get_time)(void);
|
2004-08-17 01:45:48 +00:00
|
|
|
|
int (*set_time)(const struct tm *tm);
|
2003-07-25 23:04:59 +00:00
|
|
|
|
void* (*plugin_get_buffer)(int* buffer_size);
|
2005-04-05 11:33:58 +00:00
|
|
|
|
void* (*plugin_get_audio_buffer)(int* buffer_size);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*plugin_tsr)(void (*exit_callback)(void));
|
2004-06-10 13:29:52 +00:00
|
|
|
|
#if defined(DEBUG) || defined(SIMULATOR)
|
2004-08-18 19:59:06 +00:00
|
|
|
|
void (*debugf)(const char *fmt, ...);
|
2005-07-26 20:01:11 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef ROCKBOX_HAS_LOGF
|
|
|
|
|
void (*logf)(const char *fmt, ...);
|
2004-06-10 13:48:53 +00:00
|
|
|
|
#endif
|
2004-07-27 19:16:58 +00:00
|
|
|
|
struct user_settings* global_settings;
|
2004-08-16 23:37:23 +00:00
|
|
|
|
bool (*mp3info)(struct mp3entry *entry, const char *filename, bool v1first);
|
2004-07-27 19:16:58 +00:00
|
|
|
|
int (*count_mp3_frames)(int fd, int startpos, int filesize,
|
|
|
|
|
void (*progressfunc)(int));
|
2005-09-15 05:29:26 +00:00
|
|
|
|
int (*create_xing_header)(int fd, long startpos, long filesize,
|
2006-02-07 20:38:55 +00:00
|
|
|
|
unsigned char *buf, unsigned long num_frames,
|
|
|
|
|
unsigned long rec_time, unsigned long header_template,
|
|
|
|
|
void (*progressfunc)(int), bool generate_toc);
|
2005-01-30 14:33:33 +00:00
|
|
|
|
unsigned long (*find_next_frame)(int fd, long *offset,
|
2006-02-07 20:38:55 +00:00
|
|
|
|
long max_offset, unsigned long last_header);
|
|
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
2004-07-29 13:59:04 +00:00
|
|
|
|
unsigned short (*peak_meter_scale_value)(unsigned short val,
|
|
|
|
|
int meterwidth);
|
2005-08-29 20:07:17 +00:00
|
|
|
|
void (*peak_meter_set_use_dbfs)(bool use);
|
|
|
|
|
bool (*peak_meter_get_use_dbfs)(void);
|
2004-08-30 19:52:45 +00:00
|
|
|
|
#endif
|
2005-04-25 07:42:10 +00:00
|
|
|
|
#ifdef HAVE_LCD_BITMAP
|
2006-01-28 12:12:42 +00:00
|
|
|
|
int (*read_bmp_file)(char* filename, struct bitmap *bm, int maxsize,
|
|
|
|
|
int format);
|
2006-01-15 18:20:18 +00:00
|
|
|
|
void (*screen_dump_set_hook)(void (*hook)(int fh));
|
2005-04-25 07:42:10 +00:00
|
|
|
|
#endif
|
2005-09-02 05:39:09 +00:00
|
|
|
|
int (*show_logo)(void);
|
2006-02-18 20:51:34 +00:00
|
|
|
|
struct tree_context* (*tree_get_context)(void);
|
2006-03-05 19:34:54 +00:00
|
|
|
|
|
|
|
|
|
/* new stuff at the end, sort into place next time
|
|
|
|
|
the API gets incompatible */
|
|
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
};
|
2005-10-01 10:46:13 +00:00
|
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
/* plugin header */
|
|
|
|
|
struct plugin_header {
|
|
|
|
|
unsigned long magic;
|
|
|
|
|
unsigned short target_id;
|
|
|
|
|
unsigned short api_version;
|
|
|
|
|
unsigned char *load_addr;
|
|
|
|
|
unsigned char *end_addr;
|
|
|
|
|
enum plugin_status(*entry_point)(struct plugin_api*, void*);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
};
|
2006-01-15 18:20:18 +00:00
|
|
|
|
#ifdef PLUGIN
|
2006-01-16 23:20:58 +00:00
|
|
|
|
#ifndef SIMULATOR
|
2006-01-15 18:20:18 +00:00
|
|
|
|
extern unsigned char plugin_start_addr[];
|
|
|
|
|
extern unsigned char plugin_end_addr[];
|
|
|
|
|
#define PLUGIN_HEADER \
|
|
|
|
|
const struct plugin_header __header \
|
|
|
|
|
__attribute__ ((section (".header")))= { \
|
|
|
|
|
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
|
|
|
|
|
plugin_start_addr, plugin_end_addr, plugin_start };
|
|
|
|
|
#else /* SIMULATOR */
|
2006-01-16 23:20:58 +00:00
|
|
|
|
#define PLUGIN_HEADER \
|
|
|
|
|
const struct plugin_header __header = { \
|
|
|
|
|
PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
|
|
|
|
|
NULL, NULL, plugin_start };
|
|
|
|
|
#endif
|
2006-01-15 18:20:18 +00:00
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2004-08-18 01:09:31 +00:00
|
|
|
|
int plugin_load(const char* plugin, void* parameter);
|
2003-07-25 23:04:59 +00:00
|
|
|
|
void* plugin_get_buffer(int *buffer_size);
|
2005-04-05 11:33:58 +00:00
|
|
|
|
void* plugin_get_audio_buffer(int *buffer_size);
|
2004-04-30 20:37:11 +00:00
|
|
|
|
void plugin_tsr(void (*exit_callback)(void));
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* defined by the plugin */
|
2006-03-16 17:06:20 +00:00
|
|
|
|
enum plugin_status plugin_start(struct plugin_api* rockbox, void* parameter)
|
|
|
|
|
NO_PROF_ATTR;
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
#endif
|