diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/PLUGIN_API | 911 |
1 files changed, 911 insertions, 0 deletions
diff --git a/docs/PLUGIN_API b/docs/PLUGIN_API new file mode 100644 index 0000000000..634100212d --- /dev/null +++ b/docs/PLUGIN_API | |||
@@ -0,0 +1,911 @@ | |||
1 | $Id$ | ||
2 | __________ __ ___. | ||
3 | Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | \/ \/ \/ \/ \/ | ||
8 | |||
9 | Plugin API summmary | ||
10 | |||
11 | Plugin API Version 26 | ||
12 | (backwards compability up to version 25) | ||
13 | |||
14 | Info: To get the latest plugin api specs: | ||
15 | look at struct plugin_api in apps/plugin.h | ||
16 | (and apps/plugins/helloworld.c for an example) | ||
17 | |||
18 | Plugin Skeleton | ||
19 | =============== | ||
20 | |||
21 | #include "plugin.h" | ||
22 | |||
23 | static struct plugin_api* rb; | ||
24 | |||
25 | //plugin entry point | ||
26 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) | ||
27 | { | ||
28 | TEST_PLUGIN_API(api); | ||
29 | (void)parameter; | ||
30 | rb = api; | ||
31 | |||
32 | //insert your code here | ||
33 | |||
34 | return PLUGIN_OK; | ||
35 | } | ||
36 | |||
37 | to call a function, use the plugin_api structure this way : rb->function() | ||
38 | |||
39 | Plugin Internals | ||
40 | ================ | ||
41 | |||
42 | int version; | ||
43 | |||
44 | Plugin version number. | ||
45 | |||
46 | int plugin_test(int api_version, int model, int memsize); | ||
47 | |||
48 | This function is called by the TEST_PLUGIN_API() macro to test | ||
49 | compability of the plugin with current software. | ||
50 | Returns PLUGIN_OK if plugin is supported. | ||
51 | Returns PLUGIN_WRONG_API_VERSION if plugin version isn't compatible. | ||
52 | Returns PLUGIN_WRONG_MODEL if the model or memsize is wrong. | ||
53 | |||
54 | LCD | ||
55 | === | ||
56 | |||
57 | Generic | ||
58 | ------- | ||
59 | |||
60 | Most LCD functions are specific for which output we work with, due to the | ||
61 | huge differences. | ||
62 | |||
63 | void lcd_clear_display(void); | ||
64 | |||
65 | Clear the whole display | ||
66 | |||
67 | void backlight_on(void); | ||
68 | |||
69 | Turn the backlight on | ||
70 | |||
71 | void backlight_off(void); | ||
72 | |||
73 | Turn the backlight off | ||
74 | |||
75 | void splash(int ticks, bool center, char *fmt, ...); | ||
76 | |||
77 | Display a formated string in a box durring time ticks. If center is | ||
78 | FALSE, the display is left justified. If center is TRUE, the display | ||
79 | is centered horizontaly and verticaly. The string is formated as with | ||
80 | the printf function. | ||
81 | (There are HZ ticks per second) | ||
82 | |||
83 | void lcd_puts(int x, int y, const unsigned char *string); | ||
84 | |||
85 | Write a string at given character position. | ||
86 | |||
87 | void lcd_puts_scroll(int x, int y, unsigned char* string); | ||
88 | |||
89 | Print a scrolling string at screen coordinates (x,y). The scrolling | ||
90 | style is STYLE_DEFAULT. | ||
91 | |||
92 | void lcd_stop_scroll(void); | ||
93 | |||
94 | Stop all scrolling lines on the screen. | ||
95 | |||
96 | void lcd_set_contrast(int val); | ||
97 | |||
98 | Set the screen contrast. Argument val should be a value between | ||
99 | MIN_CONTRAST_SETTING and MAX_CONTRAST_SETTING. | ||
100 | |||
101 | Recorder | ||
102 | -------- | ||
103 | |||
104 | All the functions operate on a display buffer. You make the buffer get | ||
105 | shown on screen by calling lcd_update(). | ||
106 | |||
107 | void lcd_update(void); | ||
108 | |||
109 | Update the LCD according to the internal buffer. | ||
110 | |||
111 | void lcd_update_rect(int x, int y, int width, int height); | ||
112 | |||
113 | Update the given rectangle to the LCD. Give arguments measured in | ||
114 | pixels. Notice that the smallest vertical resolution in updates that the | ||
115 | hardware supports is even 8 pixels. This function will adjust to those. | ||
116 | |||
117 | void lcd_setfont(int font); | ||
118 | |||
119 | Set default font | ||
120 | |||
121 | struc font* font_get(int font); | ||
122 | |||
123 | Return a pointer to an incore font structure. If the requested font | ||
124 | isn't loaded/compiled-in, decrement the font number and try again. | ||
125 | |||
126 | void lcd_putsxy(int x, int y, const unsigned char *string); | ||
127 | |||
128 | Put a string at given coordinates. | ||
129 | |||
130 | void lcd_puts_style(int x, int y, const unsigned char *str, int style); | ||
131 | |||
132 | Put a string at given coordinates. Intger style can be STYLE_DEFAULT | ||
133 | for black text display or STYLE_INVERT for white text display. | ||
134 | |||
135 | void lcd_puts_scroll_style(int x, int y, unsigned char* string, int style); | ||
136 | |||
137 | Same as lcd_puts_style and scrolling is enabled. | ||
138 | {new in plugin API version 26} | ||
139 | |||
140 | void lcd_bitmap(const unsigned char *src, int x, int y, int width, | ||
141 | int height, bool clear); | ||
142 | |||
143 | Put a bitmap at given coordinates. If clear is true, the area is | ||
144 | cleared before the bitmap is put. | ||
145 | Element src[i] is the binary representation of column number i of | ||
146 | the bitmap read from bottom to top. | ||
147 | |||
148 | void lcd_clearrect(int x, int y, int width, int height); | ||
149 | |||
150 | Clear a rectangle area. | ||
151 | |||
152 | void lcd_fillrect(int x, int y, int width, int height); | ||
153 | |||
154 | Fill a rectangle area. | ||
155 | |||
156 | void lcd_drawrect(int x, int y, int width, int height); | ||
157 | |||
158 | Draw a rectangle. | ||
159 | |||
160 | void lcd_invertrect(int x, int y, int width, int height); | ||
161 | |||
162 | Revert the graphics of the given area. | ||
163 | |||
164 | void lcd_drawline(int x1, int y1, int x2, int y2); | ||
165 | |||
166 | Draw a line between the coordinates. | ||
167 | |||
168 | void lcd_clearline(int x1, int y1, int x2, int y2); | ||
169 | |||
170 | Clear a line between two coordinates. | ||
171 | |||
172 | void lcd_drawpixel(int x, int y); | ||
173 | |||
174 | Draw a pixel on the given coordinate. | ||
175 | |||
176 | void lcd_clearpixel(int x, int y); | ||
177 | |||
178 | Clear the pixel at the given coordinate. | ||
179 | |||
180 | int lcd_getstringsize(const unsigned char *str, int *w, int *h); | ||
181 | |||
182 | Get the height and width of string str as it would appear on display. | ||
183 | Return value is the width. | ||
184 | |||
185 | void scrollbar(int x, int y, int width, int height, int items, | ||
186 | int min_shown, int max_shown, int orientation); | ||
187 | |||
188 | Print a scroll bar at coordinates (x,y) of size width*height. | ||
189 | orientation can be VERTICAL for a vertical scroll bar or anything else | ||
190 | for a horizontal scroll bar. | ||
191 | Item is the total number of items which the scroll bar refers to, | ||
192 | min_show the rank of the first item displayed and max_show the | ||
193 | rank of the last displayed item. | ||
194 | |||
195 | void checkbox(int x, int y, int width, int height, bool checked); | ||
196 | |||
197 | Draw a checkbox area. If checked is TRUE, the checkbox is drawn | ||
198 | checked ! | ||
199 | |||
200 | void lcd_blit(unsigned char* p_data, int x, int y, int width, | ||
201 | int height, int stride); | ||
202 | |||
203 | ??? (see firmware/drivers/lcd-recorder.c:168) | ||
204 | |||
205 | void lcd_roll(int pixels); | ||
206 | |||
207 | Rolls up the lcd display by the specified amount of lines. | ||
208 | Lines that are rolled out over the top of the screen are rolled in | ||
209 | from the bottom again. This is a hardware remapping only and all | ||
210 | operations on the lcd are affected. | ||
211 | The screen is rolled up of pixel lines. The value must be between | ||
212 | 0 and LCD_HEIGHT. | ||
213 | [Not for simulator] | ||
214 | |||
215 | Player | ||
216 | ------ | ||
217 | |||
218 | void lcd_define_pattern(int pat, char *pattern); | ||
219 | |||
220 | Define a custom pattern of index pat. char *pattern is a 8x8 pixel | ||
221 | bitmap. | ||
222 | |||
223 | unsigned char lcd_get_locked_pattern(void); | ||
224 | |||
225 | Get a locked pattern index. | ||
226 | (see firmware/drivers/lcd-player.c:382) | ||
227 | |||
228 | void lcd_unlock_pattern(unsigned char pat); | ||
229 | |||
230 | Unlock pattern of index pat. | ||
231 | |||
232 | void lcd_putc(int x, int y, unsigned char ch); | ||
233 | |||
234 | Put character c at coordinates (x,y). | ||
235 | |||
236 | void lcd_put_cursor(int x, int y, char cursor_char); | ||
237 | |||
238 | Put cursor at coordinated (x,y). | ||
239 | See firmware/export/lcd.h for possible cursor_char values. | ||
240 | |||
241 | void lcd_remove_cursor(void); | ||
242 | |||
243 | Remove the cursor from the screen. | ||
244 | |||
245 | void lcd_icon(int icon, bool enable); | ||
246 | |||
247 | ??? (see firmware/drivers/lcd-player.c:463) | ||
248 | |||
249 | |||
250 | Buttons | ||
251 | ======= | ||
252 | |||
253 | These functions work the same regardless of which keypad you have, but they | ||
254 | return a different set of values. Note that the Recorder keypad has 10 | ||
255 | keys, while the Player keypad only features 6. | ||
256 | |||
257 | Possible return values can be found in the firmware/export/button.h file. | ||
258 | |||
259 | int button_get(bool block); | ||
260 | |||
261 | Returns a bitmask for which keys were pressed. If 'block' is set TRUE it | ||
262 | won't return until a key is pressed. | ||
263 | |||
264 | int button_get_w_tmo(int ticks); | ||
265 | |||
266 | Wait for a key press for ticks ticks. (There are HZ ticks per second) | ||
267 | Returns a bitmask for which keys were pressed. If no key was pressed, | ||
268 | return BUTTON_NONE. | ||
269 | |||
270 | int button_status(void); | ||
271 | |||
272 | Returns a bitmask for which keys are currently pressed. | ||
273 | |||
274 | void button_clear_queue(void); | ||
275 | |||
276 | Empty the button queue. | ||
277 | |||
278 | |||
279 | Files | ||
280 | ===== | ||
281 | |||
282 | (These functions are POSIX look-alikes) | ||
283 | |||
284 | int open(const char *pathname, int flags); | ||
285 | |||
286 | The open() function establishes the connection between a file and a file | ||
287 | descriptor. It creates an open file description that refers to a file | ||
288 | and a file descriptor that refers to that open file description. The file | ||
289 | descriptor is used by other I/O functions to refer to that file. | ||
290 | |||
291 | ssize_t read(int fd, void *buf, size_t count); | ||
292 | |||
293 | The read() function attempts to read count bytes from the file associated | ||
294 | with the open file descriptor, fd, into the buffer pointed to by buf. | ||
295 | |||
296 | off_t lseek(int fd, off_t offset, int whence); | ||
297 | |||
298 | The lseek() function sets the file pointer associated with the open file | ||
299 | descriptor specified by fd as follows: | ||
300 | |||
301 | o If whence is SEEK_SET, the pointer is set to offset bytes. | ||
302 | |||
303 | o If whence is SEEK_CUR, the pointer is set to its | ||
304 | current location plus offset. | ||
305 | |||
306 | o If whence is SEEK_END, the pointer is set to the size | ||
307 | of the file plus offset. | ||
308 | |||
309 | int creat(const char *pathname, mode_t mode) | ||
310 | |||
311 | Create a file with mode O_RDONLY, O_WRONLY or O_RDWR. Returns the | ||
312 | file descriptor associated to this file. | ||
313 | |||
314 | ssize_t write(int fd, const void *buf, size_t count); | ||
315 | |||
316 | Write writes up to count bytes to the file referenced by the file | ||
317 | descriptor fd from the buffer starting at buf. | ||
318 | |||
319 | int close(int fd); | ||
320 | |||
321 | The close() function will deallocate the file descriptor indicated by | ||
322 | fd. To deallocate means to make the file descriptor available for | ||
323 | return by subsequent calls to open() or other functions that allocate | ||
324 | file descriptors. | ||
325 | Returns 0 upon success. | ||
326 | |||
327 | int rename(const char *path, const char *newname); | ||
328 | |||
329 | The rename() function changes the name of a file. The path argument | ||
330 | points to the pathname of the file to be renamed. The newname argument | ||
331 | points to the new pathname of the file. | ||
332 | |||
333 | int remove(const char *pathname); | ||
334 | |||
335 | remove() deletes a name from the filesystem. It calls unlink for files, | ||
336 | and rmdir for directories. | ||
337 | |||
338 | int ftruncate(int fd, off_t length); | ||
339 | |||
340 | Truncate file to the specified length. | ||
341 | |||
342 | int filesize(int fd); | ||
343 | |||
344 | Returns size of a file. Upon error, returns -1. | ||
345 | |||
346 | int fprintf(int fd, const char *fmt, ...); | ||
347 | |||
348 | Write a formated string in the fd. | ||
349 | Returns the number of characters writen to file. | ||
350 | Returns a negative value upon error. | ||
351 | |||
352 | int read_line(int fd, char* buffer, int buffer_size); | ||
353 | |||
354 | Read (up to) a line of text from fd into buffer and return number of bytes | ||
355 | read (which may be larger than the number of bytes stored in buffer). If | ||
356 | an error occurs, -1 is returned (and buffer contains whatever could be | ||
357 | read). A line is terminated by a LF char. Neither LF nor CR chars are | ||
358 | stored in buffer. | ||
359 | |||
360 | int settings_parseline(char* line, char** name, char** value); | ||
361 | |||
362 | Parse a line from a configuration file. The line format is: | ||
363 | name: value | ||
364 | Any whitespace before setting name or value (after ':') is ignored. | ||
365 | A # as first non-whitespace character discards the whole line. | ||
366 | Function sets pointers to null-terminated setting name and value. | ||
367 | Returns false if no valid config entry was found | ||
368 | |||
369 | int ata_sleep(void) | ||
370 | |||
371 | Give the disk some rest. | ||
372 | [Not for simulator] | ||
373 | |||
374 | |||
375 | Directories | ||
376 | =========== | ||
377 | |||
378 | DIR *opendir(const char *name); | ||
379 | |||
380 | The opendir() function opens a directory stream corresponding to the | ||
381 | directory name, and returns a pointer to the directory stream. The | ||
382 | stream is positioned at the first entry in the directory. | ||
383 | |||
384 | struct dirent *readdir(DIR *dir); | ||
385 | |||
386 | The readdir() function returns a pointer to a dirent structure | ||
387 | representing the next directory entry in the directory stream pointed to | ||
388 | by dir. It returns NULL on reaching the end-of-file or if an error | ||
389 | occurred. | ||
390 | |||
391 | struct dirent { | ||
392 | unsigned char d_name[MAX_PATH]; | ||
393 | int attribute; | ||
394 | int size; | ||
395 | int startcluster; | ||
396 | unsigned short wrtdate; /* Last write date */ | ||
397 | unsigned short wrttime; /* Last write time */ | ||
398 | }; | ||
399 | |||
400 | int closedir(DIR *dir); | ||
401 | |||
402 | The closedir() function closes the directory stream associated with dir. | ||
403 | The directory stream descriptor dir is not available after this call. | ||
404 | |||
405 | |||
406 | Kernel | ||
407 | ====== | ||
408 | |||
409 | void sleep(ticks); | ||
410 | |||
411 | Sleep a specified number of ticks, we have HZ ticks per second. | ||
412 | |||
413 | void yield(void); | ||
414 | |||
415 | Let another thread run. This should be used as soon as you have to "wait" | ||
416 | for something or similar, and also if you do anything that takes "a long | ||
417 | time". This function is the entire foundation that our "cooperative | ||
418 | multitasking" is based on. Use it. | ||
419 | |||
420 | void usb_screen(void); | ||
421 | |||
422 | Show the usb connection screen. | ||
423 | |||
424 | long current_tick; | ||
425 | |||
426 | The global tick variable. | ||
427 | |||
428 | int default_event_handler(int event); | ||
429 | |||
430 | If event == SYS_USB_CONNECTED, call usb_screen and return | ||
431 | SYS_USB_CONNECTED. Else do nothing and return 0. | ||
432 | |||
433 | int create_thread(void* function, void* stack, int stack_size, | ||
434 | const char *name); | ||
435 | |||
436 | Create a thread. | ||
437 | ??? (see firmware/thread.c:145) | ||
438 | Return its ID if context area could be allocated, else return -1. | ||
439 | |||
440 | void remove_thread(int threadnum); | ||
441 | |||
442 | Remove a thread from the scheduler. | ||
443 | Parameter is the ID as returned from create_thread(). | ||
444 | |||
445 | void reset_poweroff_timer(void); | ||
446 | |||
447 | The function name pretty much says what it's supposed to do. | ||
448 | |||
449 | |||
450 | String/Memory | ||
451 | ============= | ||
452 | |||
453 | int strcmp(const char *a, const char *b); | ||
454 | |||
455 | strcmp compares the string a to string b. If a sorts lexicographically | ||
456 | after b, strcmp returns a number greater than zero. If the two strings | ||
457 | match, strcmp returns zero. If a sorts lexicographically before b, | ||
458 | strcmp returns a number less than zero. | ||
459 | |||
460 | char *strcpy(char *dst, const char *src); | ||
461 | |||
462 | strcpy copies the string pointed to by src (including the terminating | ||
463 | null character) to the arra pointed to by dst. | ||
464 | This function returns the initial value of dst. | ||
465 | |||
466 | void *memcpy(void *out, const void *in, size_t length); | ||
467 | |||
468 | Copies length bytes of data in memory from source to dest. | ||
469 | |||
470 | void *memset(void *dst, int c, size_t length); | ||
471 | |||
472 | Fills a memory region with specified byte value. | ||
473 | |||
474 | int snprintf(char *buf, size_t size, const char *fmt, ...); | ||
475 | |||
476 | Write a formated formated string in buffer buf of size size | ||
477 | (including the trailing '\0'). | ||
478 | Upon success, return the number of characters printed or that would have | ||
479 | been printed if the output was truncated (not including the trailing | ||
480 | '\0'). | ||
481 | These support %c, %s, %d and %x only with the width and zero padding | ||
482 | flag only. | ||
483 | |||
484 | char *strncpy(char *dst, const char *src, size_t length); | ||
485 | |||
486 | strncpy copies not more than length characters from the string pointed | ||
487 | to by src (including the terminating null character) to the array pointed | ||
488 | to by dst. If the string pointed to by src is shorter than length | ||
489 | characters, null characters are apended to the destination array until | ||
490 | a total of length characters have been written. | ||
491 | This function returns the initial value of dst. | ||
492 | |||
493 | size_t strlen(const char *str); | ||
494 | |||
495 | The strlen function works out the length of the string starting at str | ||
496 | by counting characters until it reaches a null character. | ||
497 | strlen returns the character count. | ||
498 | |||
499 | char *strrchr(const char *string, int c); | ||
500 | |||
501 | This function finds the last occurence of c (converted to a char) in the | ||
502 | string pointed to by string (including the terminating null character). | ||
503 | Returns a pointer to the located character, or a null pointer if c | ||
504 | does not occur in string. | ||
505 | |||
506 | int strcasecmp(const char *s1, const char *s2); | ||
507 | |||
508 | The strcasecmp() function compares the two strings s1 and s2, ignoring | ||
509 | the case of the characters. It returns an integer less than, equal to, | ||
510 | or greater than zero if s1 is found, respectively, to be less than, to | ||
511 | match, or be greater than s2. | ||
512 | |||
513 | int strncasecmp(const char *s1, const char *s2, size_t n); | ||
514 | |||
515 | Like strncasecmp() but only on the first n characters. | ||
516 | {new in plugin API version 26} | ||
517 | |||
518 | const char *_ctype_; | ||
519 | |||
520 | ??? (see firmware/common/ctype.c) | ||
521 | [Not for simulator] | ||
522 | |||
523 | int atoi(const char *str); | ||
524 | |||
525 | The atoi() function converts the initial portion of a string pointed | ||
526 | to by str to int. | ||
527 | |||
528 | |||
529 | Sound | ||
530 | ===== | ||
531 | |||
532 | void mpeg_sound_set(int setting, int value); | ||
533 | |||
534 | The function mpeg_sound_set() is used to set sound output characteristics. | ||
535 | This characterisitic is chosen with the setting argument. Possible | ||
536 | settings (and the effective values) are : | ||
537 | SOUND_VOLUME | ||
538 | 0 <= value <= 100 | ||
539 | SOUND_BALANCE (only effective with MAS3587F) | ||
540 | -100 <= value <= 100 | ||
541 | SOUND_BASS | ||
542 | -32 <= value <= 32 | ||
543 | SOUND_TREBLE | ||
544 | -32 <= value <= 32 | ||
545 | SOUND_CHANNEL | ||
546 | value : MPEG_SOUND_STEREO | ||
547 | MPEG_SOUND_MONO | ||
548 | MPEG_SOUND_MONO_LEFT | ||
549 | MPEG_SOUND_MONO_RIGHT | ||
550 | MPEG_SOUND_STEREO_NARROW | ||
551 | MPEG_SOUND_STEREO_WIDE | ||
552 | MPEG_SOUND_KARAOKE | ||
553 | |||
554 | only available with MAS3587F : | ||
555 | SOUND_LOUDNESS | ||
556 | 0 <= value <= 17 | ||
557 | SOUND_AVC | ||
558 | value : 1 : 20ms | ||
559 | 2 : 2s | ||
560 | 3 : 4s | ||
561 | 4 : 8s | ||
562 | -1 : off then on | ||
563 | other : off | ||
564 | SOUND_MDB_STRENGTH | ||
565 | 0 <= value <= 127 | ||
566 | SOUND_MDB_HARMONICS | ||
567 | 0 <= value <= 100 | ||
568 | SOUND_MDB_CENTER | ||
569 | value : ??? | ||
570 | SOUND_MDB_SHAPE | ||
571 | value : ??? | ||
572 | SOUND_MDB_ENABLE | ||
573 | value == 0 : off | ||
574 | other : on | ||
575 | SOUND_SUPERBASS | ||
576 | value == 0 : off | ||
577 | other : on | ||
578 | |||
579 | |||
580 | void mp3_play_data(unsigned char* start, int size, | ||
581 | void (*get_more)(unsigned char** start, int* size)); | ||
582 | |||
583 | Plays a chunk of an mp3 file. | ||
584 | start points to the begining of the file to play. | ||
585 | size is the size to play. | ||
586 | getmore is a callback function. | ||
587 | ??? (see firmware/mp3_playback.c:1062) | ||
588 | [Not for simulator] | ||
589 | |||
590 | void mp3_play_pause(bool play); | ||
591 | |||
592 | If playback was paused and play is TRUE, resume playback. | ||
593 | If playback isn't paused and play is FALSE, pause playback. | ||
594 | [Not for simulator] | ||
595 | |||
596 | void mp3_play_stop(void); | ||
597 | |||
598 | Stop playback. | ||
599 | [Not for simulator] | ||
600 | |||
601 | bool mp3_is_playing(void); | ||
602 | |||
603 | Return true if an mp3 is playing, else return false. Note : a paused | ||
604 | mp3 is considered as a playing mp3. | ||
605 | [Not for simulator] | ||
606 | |||
607 | void bitswap(unsigned char *data, int length); | ||
608 | |||
609 | Swap the bits for each element of array data of size length. | ||
610 | [Not for simulator] | ||
611 | |||
612 | |||
613 | Playback Control | ||
614 | ================ | ||
615 | |||
616 | void mpeg_play(int offset); | ||
617 | |||
618 | Start playback. | ||
619 | ??? what does offset do (see firmware/mpeg.c:2459) | ||
620 | |||
621 | void mpeg_stop(void); | ||
622 | |||
623 | Stop playback. | ||
624 | |||
625 | void mpeg_pause(void); | ||
626 | |||
627 | Pause playback. | ||
628 | |||
629 | void mpeg_resume(void); | ||
630 | |||
631 | Resume playback. | ||
632 | |||
633 | void mpeg_next(void); | ||
634 | |||
635 | Play the next item in playlist. | ||
636 | |||
637 | void mpeg_prev(void); | ||
638 | |||
639 | Play the previous item in playlist. | ||
640 | |||
641 | void mpeg_ff_rewind(int newtime); | ||
642 | |||
643 | Change playback time. | ||
644 | Has no effect in simulator. | ||
645 | |||
646 | struct mp3entry *mpeg_next_track(void); | ||
647 | |||
648 | Return info about the next track. | ||
649 | struct mp3entry is defined in file firmware/export/id3.h | ||
650 | |||
651 | int playlist_amount(void); | ||
652 | |||
653 | Returns the number of tracks in current playlist. | ||
654 | |||
655 | int mpeg_status(void); | ||
656 | |||
657 | Returns a bitmask about current mpeg stream status. | ||
658 | Possibilities are : | ||
659 | MPEG_STATUS_PLAY | ||
660 | MPEG_STATUS_PAUSE | ||
661 | MPEG_STATUS_RECORD [MAS3587F only] | ||
662 | MPEG_STATUS_PRERECORD [MAS3587F only] | ||
663 | MPEG_STATUS_ERROR | ||
664 | |||
665 | bool mpeg_has_changed_track(void); | ||
666 | |||
667 | Returns true if track has changed since last call of this function. | ||
668 | Else returns false. | ||
669 | |||
670 | struct mp3entry *mpeg_current_track(void); | ||
671 | |||
672 | Return info about current track | ||
673 | struct mp3entry is defined in file firmware/export/id3.h | ||
674 | |||
675 | |||
676 | MAS communication | ||
677 | ================= | ||
678 | |||
679 | [Not for simulator] | ||
680 | |||
681 | int mas_readmem(int bank, int addr, unsigned long* dest, int len); | ||
682 | |||
683 | ??? | ||
684 | |||
685 | int mas_writemem(int bank, int addr, unsigned long* src, int len); | ||
686 | |||
687 | ??? | ||
688 | |||
689 | int mas_readreg(int reg); | ||
690 | |||
691 | ??? | ||
692 | |||
693 | int mas_writereg(int reg, unsigned int val); | ||
694 | |||
695 | ??? | ||
696 | |||
697 | int mas_codec_writereg(int reg, unsigned int val); | ||
698 | |||
699 | ??? | ||
700 | [MAS3587F only] | ||
701 | |||
702 | int mas_codec_readreg(int reg); | ||
703 | |||
704 | ??? | ||
705 | [MAS3587F only] | ||
706 | |||
707 | |||
708 | Misc | ||
709 | ==== | ||
710 | |||
711 | void srand(unsigned int seed); | ||
712 | |||
713 | Seed the random number generator. | ||
714 | |||
715 | int rand(void); | ||
716 | |||
717 | Return a pseudo random number between 0 and 0x7fffffff. | ||
718 | |||
719 | void qsort(void *base, size_t nmemb, size_t size, | ||
720 | int(*compar)(const void *, const void *)); | ||
721 | |||
722 | qsort sorts an array (begining at base) of nmemb objects, size | ||
723 | describes the size of each element of the array. | ||
724 | |||
725 | You must supply a pointer to a comparison function, using the | ||
726 | argument shown as compar. (This permits the sorting objects of | ||
727 | unknown properties.) Define the comparison function to accept | ||
728 | two arguments, each a pointer to an element of the array starting | ||
729 | at base. The result of (*compar) must be negative if the first | ||
730 | argument is less than the second, zero if the two arguments match, | ||
731 | and positive if the first argument is greater than the second | ||
732 | (chere ``less than'' and ``greter than'' refer to whatever | ||
733 | arbitrary ordering is appropriate). | ||
734 | |||
735 | The arra is sorted in place; that is, when qsort returns, the array | ||
736 | elements begining at base have been reordered. | ||
737 | |||
738 | int kbd_input(char *buffer, int buflen); | ||
739 | |||
740 | Prompt for a string to be stored in buffer which is of length buflen. | ||
741 | Return FALSE upon success. | ||
742 | |||
743 | struct tm *get_time(void); | ||
744 | |||
745 | Return current time. | ||
746 | struct tm | ||
747 | { | ||
748 | int tm_sec; | ||
749 | int tm_min; | ||
750 | int tm_hour; | ||
751 | int tm_mday; | ||
752 | int tm_mon; | ||
753 | int tm_year; | ||
754 | int tm_wday; | ||
755 | int tm_yday; | ||
756 | int tm_isdst; | ||
757 | }; | ||
758 | |||
759 | int set_time(struct tm *tm); | ||
760 | |||
761 | Set current time. | ||
762 | Return FALSE upon success. | ||
763 | (see get_time() for a description of struct tm) | ||
764 | |||
765 | void *plugin_get_buffer(int *buffer_size); | ||
766 | |||
767 | Returns a pointer to the portion of the plugin buffer that is not | ||
768 | already being used. If no plugin is loaded, returns the entire | ||
769 | plugin buffer. | ||
770 | Upon return, *buffer_size is the memory size left in plugin buffer. | ||
771 | |||
772 | void *plugin_get_mp3_buffer(int *buffer_size); | ||
773 | |||
774 | Returns a pointer to the mp3 buffer. | ||
775 | Playback gets stopped to avoid conflicts. | ||
776 | |||
777 | int plugin_register_timer(int cycles, int prio, | ||
778 | void (*timer_callback)(void)); | ||
779 | |||
780 | Register a periodic time callbeck, called every 'cycles' CPU clocks. | ||
781 | Note that this function will be called in interrupt context! | ||
782 | [Not for simulator] | ||
783 | |||
784 | void plugin_unregister_timer(void); | ||
785 | |||
786 | Disable the user timer. | ||
787 | [Not for simulator] | ||
788 | |||
789 | void plugin_tsr(void (*exit_callback)(void)); | ||
790 | |||
791 | The plugin wants to stay resdent after leaving its main function, e.g. | ||
792 | runs from timer or own thread. The callback is registered to later | ||
793 | instruct it to free its resources before a new plugin gets loaded. | ||
794 | |||
795 | void debugf(char *fmt, ...); | ||
796 | |||
797 | Debug output in formated string format. | ||
798 | [Simulator or debug only] | ||
799 | |||
800 | struct user_settings *global_settings; | ||
801 | |||
802 | Access to rockbox's settings. | ||
803 | struct user_settings is defined in apps/settings.h | ||
804 | |||
805 | void backlight_set_timeout(int index); | ||
806 | |||
807 | Set the backlight timeout. | ||
808 | index possible values : | ||
809 | 0 : backlight always off | ||
810 | 1 : no time out | ||
811 | 2 : 1s | ||
812 | 3 : 2s | ||
813 | 4 : 3s | ||
814 | 5 : 4s | ||
815 | 6 : 5s | ||
816 | 7 : 6s | ||
817 | 8 : 7s | ||
818 | 9 : 8s | ||
819 | 10 : 9s | ||
820 | 11 : 10s | ||
821 | 12 : 15s | ||
822 | 13 : 20s | ||
823 | 14 : 25s | ||
824 | 15 : 30s | ||
825 | 16 : 45s | ||
826 | 17 : 60s | ||
827 | 18 : 90s | ||
828 | other : backlight always off | ||
829 | |||
830 | bool mp3info(mp3entry *entry, char *filename); | ||
831 | |||
832 | Return FALSE if successful. The given mp3entry is then filled in with | ||
833 | whatever id3 info it could find about the given file. | ||
834 | struct mp3entry is defined in file firmware/export/id3.h | ||
835 | |||
836 | int count_mp3_frames(int fd, int startpos, int filesize, | ||
837 | void (*progressfunc)(int)); | ||
838 | |||
839 | ??? (see firmware/mp3data.c:531) | ||
840 | something related to VBR files | ||
841 | |||
842 | int create_xing_header(int fd, int startpos, int filesize, | ||
843 | unsigned char *buf, int num_frames, | ||
844 | unsigned long header_template, | ||
845 | void (*progressfunc)(int), bool generate_toc); | ||
846 | |||
847 | ??? (see firmware/mp3data.c:593) | ||
848 | |||
849 | int battery_level(void); | ||
850 | |||
851 | Returns battery level in percent. | ||
852 | On the simulator, battery_level always returns 75. | ||
853 | |||
854 | void mpeg_set_pitch(int pitch); | ||
855 | |||
856 | Change the pitch of audio playback. pitch is given in tenths of | ||
857 | percent. | ||
858 | [MAS3587F only] | ||
859 | {new in plugin API version 26} | ||
860 | |||
861 | unsigned short peak_meter_scale_value(unsigned short val, int meterwidth); | ||
862 | |||
863 | Scales a peak value as read from the MAS to the range of meterwidth. | ||
864 | The scaling is performed according to the scaling method (dBfs / linear) | ||
865 | and the range (peak_meter_range_min .. peak_meter_range_max). | ||
866 | unsigned short val is the volume value. Range: 0 <= val < MAX_PEAK | ||
867 | int meterwidht is the widht of the meter in pixel | ||
868 | Returns an a value between 0 and meterwidth | ||
869 | [MAS3587F only] | ||
870 | {new in plugin API version 26} | ||
871 | |||
872 | void peak_meter_set_use_dbfs(int use); | ||
873 | |||
874 | Specifies wether the values displayed are scaled as dBfs or as | ||
875 | linear percent values. If use is 0 use linear percent scale, else | ||
876 | use dBfs. | ||
877 | [MAS3587F only] | ||
878 | {new in plugin API version 26} | ||
879 | |||
880 | int peak_meter_get_use_dbfs(void); | ||
881 | |||
882 | Returns 1 if the meter currently is displaying dBfs values, 0 | ||
883 | if the meter is displaying percent values. | ||
884 | [MAS3587F only] | ||
885 | {new in plugin API version 26} | ||
886 | |||
887 | void mpeg_flush_and_reload_tracks(void); | ||
888 | |||
889 | ??? Flush the mpeg buffer and reload data ??? | ||
890 | (see firmware/mpeg.c:2597) | ||
891 | (has no effect on simulator) | ||
892 | {new in plugin API version 26} | ||
893 | |||
894 | int mpeg_get_file_pos(void); | ||
895 | |||
896 | ??? Returns the current cursor position in mpeg file ??? | ||
897 | (see firmware/mpeg.c:260) | ||
898 | {new in plugin API version 26} | ||
899 | |||
900 | unsigned long find_next_frame(int fd, int *offset, int max_offset, | ||
901 | unsigned long last_header); | ||
902 | |||
903 | ??? | ||
904 | (see firmware/mp3data.c:262) | ||
905 | {new in plugin API version 26} | ||
906 | |||
907 | unsigned long mpeg_get_last_header(void); | ||
908 | |||
909 | ??? | ||
910 | (see firmware/mpeg.c:320) | ||
911 | {new in plugin API version 26} | ||