diff options
Diffstat (limited to 'apps/plugin.h')
-rw-r--r-- | apps/plugin.h | 113 |
1 files changed, 49 insertions, 64 deletions
diff --git a/apps/plugin.h b/apps/plugin.h index 74700879b4..51607a53e6 100644 --- a/apps/plugin.h +++ b/apps/plugin.h | |||
@@ -60,12 +60,12 @@ | |||
60 | #endif | 60 | #endif |
61 | 61 | ||
62 | /* increase this every time the api struct changes */ | 62 | /* increase this every time the api struct changes */ |
63 | #define PLUGIN_API_VERSION 24 | 63 | #define PLUGIN_API_VERSION 25 |
64 | 64 | ||
65 | /* update this to latest version if a change to the api struct breaks | 65 | /* update this to latest version if a change to the api struct breaks |
66 | backwards compatibility (and please take the opportunity to sort in any | 66 | backwards compatibility (and please take the opportunity to sort in any |
67 | new function which are "waiting" at the end of the function table) */ | 67 | new function which are "waiting" at the end of the function table) */ |
68 | #define PLUGIN_MIN_API_VERSION 19 | 68 | #define PLUGIN_MIN_API_VERSION 25 |
69 | 69 | ||
70 | /* plugin return codes */ | 70 | /* plugin return codes */ |
71 | enum plugin_status { | 71 | enum plugin_status { |
@@ -114,13 +114,18 @@ struct plugin_api { | |||
114 | void (*lcd_puts)(int x, int y, unsigned char *string); | 114 | void (*lcd_puts)(int x, int y, unsigned char *string); |
115 | void (*lcd_puts_scroll)(int x, int y, unsigned char* string); | 115 | void (*lcd_puts_scroll)(int x, int y, unsigned char* string); |
116 | void (*lcd_stop_scroll)(void); | 116 | void (*lcd_stop_scroll)(void); |
117 | void (*lcd_set_contrast)(int x); | ||
117 | #ifdef HAVE_LCD_CHARCELLS | 118 | #ifdef HAVE_LCD_CHARCELLS |
118 | void (*lcd_define_pattern)(int which,char *pattern); | 119 | void (*lcd_define_pattern)(int which,char *pattern); |
119 | unsigned char (*lcd_get_locked_pattern)(void); | 120 | unsigned char (*lcd_get_locked_pattern)(void); |
120 | void (*lcd_unlock_pattern)(unsigned char pat); | 121 | void (*lcd_unlock_pattern)(unsigned char pat); |
121 | void (*lcd_putc)(int x, int y, unsigned short ch); | 122 | void (*lcd_putc)(int x, int y, unsigned short ch); |
123 | void (*lcd_put_cursor)(int x, int y, char cursor_char); | ||
124 | void (*lcd_remove_cursor)(void); | ||
125 | void (*lcd_icon)(int icon, bool enable); | ||
122 | #else | 126 | #else |
123 | void (*lcd_putsxy)(int x, int y, const unsigned char *string); | 127 | void (*lcd_putsxy)(int x, int y, const unsigned char *string); |
128 | void (*lcd_puts_style)(int x, int y, unsigned char *str, int style); | ||
124 | void (*lcd_bitmap)(const unsigned char *src, int x, int y, | 129 | void (*lcd_bitmap)(const unsigned char *src, int x, int y, |
125 | int nx, int ny, bool clear); | 130 | int nx, int ny, bool clear); |
126 | void (*lcd_drawline)(int x1, int y1, int x2, int y2); | 131 | void (*lcd_drawline)(int x1, int y1, int x2, int y2); |
@@ -128,6 +133,7 @@ struct plugin_api { | |||
128 | void (*lcd_drawpixel)(int x, int y); | 133 | void (*lcd_drawpixel)(int x, int y); |
129 | void (*lcd_clearpixel)(int x, int y); | 134 | void (*lcd_clearpixel)(int x, int y); |
130 | void (*lcd_setfont)(int font); | 135 | void (*lcd_setfont)(int font); |
136 | struct font* (*font_get)(int font); | ||
131 | void (*lcd_clearrect)(int x, int y, int nx, int ny); | 137 | void (*lcd_clearrect)(int x, int y, int nx, int ny); |
132 | void (*lcd_fillrect)(int x, int y, int nx, int ny); | 138 | void (*lcd_fillrect)(int x, int y, int nx, int ny); |
133 | void (*lcd_drawrect)(int x, int y, int nx, int ny); | 139 | void (*lcd_drawrect)(int x, int y, int nx, int ny); |
@@ -137,14 +143,21 @@ struct plugin_api { | |||
137 | void (*lcd_update_rect)(int x, int y, int width, int height); | 143 | void (*lcd_update_rect)(int x, int y, int width, int height); |
138 | void (*scrollbar)(int x, int y, int width, int height, int items, | 144 | void (*scrollbar)(int x, int y, int width, int height, int items, |
139 | int min_shown, int max_shown, int orientation); | 145 | int min_shown, int max_shown, int orientation); |
146 | void (*checkbox)(int x, int y, int width, int height, bool checked); | ||
147 | unsigned char* lcd_framebuffer; | ||
148 | void (*lcd_blit) (unsigned char* p_data, int x, int y, int width, int height, int stride); | ||
140 | #ifndef SIMULATOR | 149 | #ifndef SIMULATOR |
141 | void (*lcd_roll)(int pixels); | 150 | void (*lcd_roll)(int pixels); |
142 | #endif | 151 | #endif |
143 | #endif | 152 | #endif |
153 | void (*backlight_on)(void); | ||
154 | void (*backlight_off)(void); | ||
144 | 155 | ||
145 | /* button */ | 156 | /* button */ |
146 | int (*button_get)(bool block); | 157 | int (*button_get)(bool block); |
147 | int (*button_get_w_tmo)(int ticks); | 158 | int (*button_get_w_tmo)(int ticks); |
159 | int (*button_status)(void); | ||
160 | void (*button_clear_queue)(void); | ||
148 | 161 | ||
149 | /* file */ | 162 | /* file */ |
150 | int (*open)(const char* pathname, int flags); | 163 | int (*open)(const char* pathname, int flags); |
@@ -159,6 +172,7 @@ struct plugin_api { | |||
159 | int (*filesize)(int fd); | 172 | int (*filesize)(int fd); |
160 | int (*fprintf)(int fd, const char *fmt, ...); | 173 | int (*fprintf)(int fd, const char *fmt, ...); |
161 | int (*read_line)(int fd, char* buffer, int buffer_size); | 174 | int (*read_line)(int fd, char* buffer, int buffer_size); |
175 | bool (*settings_parseline)(char* line, char** name, char** value); | ||
162 | 176 | ||
163 | /* dir */ | 177 | /* dir */ |
164 | DIR* (*opendir)(const char* name); | 178 | DIR* (*opendir)(const char* name); |
@@ -167,14 +181,21 @@ struct plugin_api { | |||
167 | 181 | ||
168 | /* kernel */ | 182 | /* kernel */ |
169 | void (*sleep)(int ticks); | 183 | void (*sleep)(int ticks); |
184 | void (*yield)(void); | ||
170 | void (*usb_screen)(void); | 185 | void (*usb_screen)(void); |
171 | long* current_tick; | 186 | long* current_tick; |
187 | int (*default_event_handler)(int event); | ||
188 | int (*create_thread)(void* function, void* stack, int stack_size, char *name); | ||
189 | void (*remove_thread)(int threadnum); | ||
172 | 190 | ||
173 | /* strings and memory */ | 191 | /* strings and memory */ |
174 | int (*snprintf)(char *buf, size_t size, const char *fmt, ...); | 192 | int (*snprintf)(char *buf, size_t size, const char *fmt, ...); |
175 | char* (*strcpy)(char *dst, const char *src); | 193 | char* (*strcpy)(char *dst, const char *src); |
194 | char *(*strncpy)(char *dst, const char *src, size_t length); | ||
176 | size_t (*strlen)(const char *str); | 195 | size_t (*strlen)(const char *str); |
177 | char * (*strrchr)(const char *s, int c); | 196 | char * (*strrchr)(const char *s, int c); |
197 | int (*strcmp)(const char *, const char *); | ||
198 | int (*strcasecmp)(const char *, const char *); | ||
178 | void* (*memset)(void *dst, int c, size_t length); | 199 | void* (*memset)(void *dst, int c, size_t length); |
179 | void* (*memcpy)(void *out, const void *in, size_t n); | 200 | void* (*memcpy)(void *out, const void *in, size_t n); |
180 | #ifndef SIMULATOR | 201 | #ifndef SIMULATOR |
@@ -182,12 +203,31 @@ struct plugin_api { | |||
182 | #endif | 203 | #endif |
183 | 204 | ||
184 | /* sound */ | 205 | /* sound */ |
206 | void (*mpeg_sound_set)(int setting, int value); | ||
185 | #ifndef SIMULATOR | 207 | #ifndef SIMULATOR |
208 | void (*mp3_play_data)(unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size)); | ||
209 | void (*mp3_play_pause)(bool play); | ||
210 | void (*mp3_play_stop)(void); | ||
211 | bool (*mp3_is_playing)(void); | ||
212 | void (*bitswap)(unsigned char *data, int length); | ||
186 | #ifdef HAVE_MAS3587F | 213 | #ifdef HAVE_MAS3587F |
187 | int (*mas_codec_readreg)(int reg); | 214 | int (*mas_codec_readreg)(int reg); |
188 | #endif | 215 | #endif |
189 | #endif | 216 | #endif |
190 | 217 | ||
218 | /* playback control */ | ||
219 | void (*mpeg_play)(int offset); | ||
220 | void (*mpeg_stop)(void); | ||
221 | void (*mpeg_pause)(void); | ||
222 | void (*mpeg_resume)(void); | ||
223 | void (*mpeg_next)(void); | ||
224 | void (*mpeg_prev)(void); | ||
225 | void (*mpeg_ff_rewind)(int newtime); | ||
226 | struct mp3entry* (*mpeg_next_track)(void); | ||
227 | int (*playlist_amount)(void); | ||
228 | int (*mpeg_status)(void); | ||
229 | bool (*mpeg_has_changed_track)(void); | ||
230 | |||
191 | /* misc */ | 231 | /* misc */ |
192 | void (*srand)(unsigned int seed); | 232 | void (*srand)(unsigned int seed); |
193 | int (*rand)(void); | 233 | int (*rand)(void); |
@@ -199,61 +239,26 @@ struct plugin_api { | |||
199 | int (*atoi)(const char *str); | 239 | int (*atoi)(const char *str); |
200 | struct tm* (*get_time)(void); | 240 | struct tm* (*get_time)(void); |
201 | void* (*plugin_get_buffer)(int* buffer_size); | 241 | void* (*plugin_get_buffer)(int* buffer_size); |
202 | |||
203 | /* new stuff, sort in next time the API gets broken! */ | ||
204 | #ifndef HAVE_LCD_CHARCELLS | ||
205 | unsigned char* lcd_framebuffer; | ||
206 | void (*lcd_blit) (unsigned char* p_data, int x, int y, int width, int height, int stride); | ||
207 | #endif | ||
208 | void (*yield)(void); | ||
209 | |||
210 | void* (*plugin_get_mp3_buffer)(int* buffer_size); | 242 | void* (*plugin_get_mp3_buffer)(int* buffer_size); |
211 | void (*mpeg_sound_set)(int setting, int value); | ||
212 | #ifndef SIMULATOR | 243 | #ifndef SIMULATOR |
213 | void (*mp3_play_data)(unsigned char* start, int size, void (*get_more)(unsigned char** start, int* size)); | 244 | int (*plugin_register_timer)(int cycles, int prio, void (*timer_callback)(void)); |
214 | void (*mp3_play_pause)(bool play); | 245 | void (*plugin_unregister_timer)(void); |
215 | void (*mp3_play_stop)(void); | ||
216 | bool (*mp3_is_playing)(void); | ||
217 | void (*bitswap)(unsigned char *data, int length); | ||
218 | #endif | 246 | #endif |
247 | void (*plugin_tsr)(void (*exit_callback)(void)); | ||
248 | |||
249 | /* new stuff, sort in next time the API gets broken! */ | ||
250 | |||
219 | struct user_settings* global_settings; | 251 | struct user_settings* global_settings; |
220 | void (*backlight_set_timeout)(int index); | 252 | void (*backlight_set_timeout)(int index); |
221 | #ifndef SIMULATOR | 253 | #ifndef SIMULATOR |
222 | int (*ata_sleep)(void); | 254 | int (*ata_sleep)(void); |
223 | #endif | 255 | #endif |
224 | #ifdef HAVE_LCD_BITMAP | ||
225 | void (*checkbox)(int x, int y, int width, int height, bool checked); | ||
226 | #endif | ||
227 | #ifndef SIMULATOR | ||
228 | int (*plugin_register_timer)(int cycles, int prio, void (*timer_callback)(void)); | ||
229 | void (*plugin_unregister_timer)(void); | ||
230 | #endif | ||
231 | void (*plugin_tsr)(void (*exit_callback)(void)); | ||
232 | int (*create_thread)(void* function, void* stack, int stack_size, char *name); | ||
233 | void (*remove_thread)(int threadnum); | ||
234 | void (*lcd_set_contrast)(int x); | ||
235 | 256 | ||
236 | /* playback control */ | ||
237 | void (*mpeg_play)(int offset); | ||
238 | void (*mpeg_stop)(void); | ||
239 | void (*mpeg_pause)(void); | ||
240 | void (*mpeg_resume)(void); | ||
241 | void (*mpeg_next)(void); | ||
242 | void (*mpeg_prev)(void); | ||
243 | void (*mpeg_ff_rewind)(int newtime); | ||
244 | struct mp3entry* (*mpeg_next_track)(void); | ||
245 | int (*playlist_amount)(void); | ||
246 | int (*mpeg_status)(void); | ||
247 | bool (*mpeg_has_changed_track)(void); | ||
248 | |||
249 | #ifdef HAVE_LCD_BITMAP | ||
250 | struct font* (*font_get)(int font); | ||
251 | #endif | ||
252 | 257 | ||
253 | #if defined(DEBUG) || defined(SIMULATOR) | 258 | #if defined(DEBUG) || defined(SIMULATOR) |
254 | void (*debugf)(char *fmt, ...); | 259 | void (*debugf)(char *fmt, ...); |
255 | #endif | 260 | #endif |
256 | bool (*mp3info)(struct mp3entry *entry, char *filename) ; | 261 | bool (*mp3info)(struct mp3entry *entry, char *filename, bool v1first); |
257 | int (*count_mp3_frames)(int fd, int startpos, int filesize, | 262 | int (*count_mp3_frames)(int fd, int startpos, int filesize, |
258 | void (*progressfunc)(int)); | 263 | void (*progressfunc)(int)); |
259 | int (*create_xing_header)(int fd, int startpos, int filesize, | 264 | int (*create_xing_header)(int fd, int startpos, int filesize, |
@@ -274,26 +279,6 @@ struct plugin_api { | |||
274 | int (*set_time)(struct tm *tm); | 279 | int (*set_time)(struct tm *tm); |
275 | void (*reset_poweroff_timer)(void); | 280 | void (*reset_poweroff_timer)(void); |
276 | 281 | ||
277 | void (*backlight_on)(void); | ||
278 | void (*backlight_off)(void); | ||
279 | |||
280 | #ifdef HAVE_LCD_CHARCELLS | ||
281 | void (*lcd_icon)(int icon, bool enable); | ||
282 | #endif | ||
283 | #ifdef HAVE_LCD_BITMAP | ||
284 | void (*lcd_puts_style)(int x, int y, unsigned char *str, int style); | ||
285 | #endif | ||
286 | #ifdef HAVE_LCD_CHARCELLS | ||
287 | void (*lcd_put_cursor)(int x, int y, char cursor_char); | ||
288 | void (*lcd_remove_cursor)(void); | ||
289 | #endif | ||
290 | bool (*settings_parseline)(char* line, char** name, char** value); | ||
291 | int (*strcmp)(const char *, const char *); | ||
292 | int (*button_status)(void); | ||
293 | void (*button_clear_queue)(void); | ||
294 | char *(*strncpy)(char *dst, const char *src, size_t length); | ||
295 | int (*strcasecmp)(const char *, const char *); | ||
296 | int (*default_event_handler)(int event); | ||
297 | }; | 282 | }; |
298 | 283 | ||
299 | /* defined by the plugin loader (plugin.c) */ | 284 | /* defined by the plugin loader (plugin.c) */ |