2003-06-29 16:33:04 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
2020-10-06 18:34:04 +00:00
|
|
|
|
* Copyright (C) 2002 Bj<EFBFBD>rn Stenberg
|
2003-06-29 16:33:04 +00:00
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
2003-06-29 16:33:04 +00:00
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
|
2007-04-10 14:18:30 +00:00
|
|
|
|
#include <stdbool.h>
|
2010-05-06 21:04:40 +00:00
|
|
|
|
#include <inttypes.h>
|
2006-11-11 05:11:05 +00:00
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
#include <stdarg.h>
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdlib.h>
|
2008-08-12 20:11:18 +00:00
|
|
|
|
#include <string.h>
|
2012-05-07 16:27:46 +00:00
|
|
|
|
#include <ctype.h>
|
2010-05-06 21:04:40 +00:00
|
|
|
|
#include "string-extra.h"
|
2010-07-25 14:44:29 +00:00
|
|
|
|
#include "gcc_extensions.h"
|
2008-05-19 14:37:16 +00:00
|
|
|
|
|
2012-01-22 19:33:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* on some platforms strcmp() seems to be a tricky define which
|
|
|
|
|
* breaks if we write down strcmp's prototype */
|
|
|
|
|
#undef strcmp
|
|
|
|
|
#undef strncmp
|
|
|
|
|
#undef strchr
|
2014-02-13 11:24:29 +00:00
|
|
|
|
#undef strtok_r
|
2012-01-22 19:33:37 +00:00
|
|
|
|
|
2009-07-14 13:57:45 +00:00
|
|
|
|
char* strncpy(char *, const char *, size_t);
|
2008-05-19 14:37:16 +00:00
|
|
|
|
void* plugin_get_buffer(size_t *buffer_size);
|
2020-08-01 02:45:10 +00:00
|
|
|
|
int plugin_open(char *plugin, char *parameter);
|
2008-05-19 14:37:16 +00:00
|
|
|
|
|
|
|
|
|
#ifndef __PCTOOL__
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include "config.h"
|
2006-11-11 05:11:05 +00:00
|
|
|
|
#include "system.h"
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include "dir.h"
|
2007-11-08 05:17:20 +00:00
|
|
|
|
#include "general.h"
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include "kernel.h"
|
2006-11-11 05:11:05 +00:00
|
|
|
|
#include "thread.h"
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include "button.h"
|
2006-08-15 12:27:07 +00:00
|
|
|
|
#include "action.h"
|
2010-09-09 16:17:21 +00:00
|
|
|
|
#include "load_code.h"
|
2006-01-25 18:29:56 +00:00
|
|
|
|
#include "usb.h"
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#include "font.h"
|
|
|
|
|
#include "lcd.h"
|
2013-04-03 14:33:23 +00:00
|
|
|
|
#include "scroll_engine.h"
|
2008-10-15 06:38:51 +00:00
|
|
|
|
#include "metadata.h"
|
2006-11-11 05:11:05 +00:00
|
|
|
|
#include "sound.h"
|
2005-04-04 12:06:29 +00:00
|
|
|
|
#include "audio.h"
|
2020-07-17 04:01:32 +00:00
|
|
|
|
#include "voice_thread.h"
|
2014-02-13 11:01:13 +00:00
|
|
|
|
#include "root_menu.h"
|
2006-11-11 05:11:05 +00:00
|
|
|
|
#include "talk.h"
|
2019-02-04 01:12:50 +00:00
|
|
|
|
#include "lang_enum.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"
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
|
#include "pathfuncs.h"
|
2011-06-29 06:37:04 +00:00
|
|
|
|
#include "pcm_mixer.h"
|
2011-12-04 18:19:39 +00:00
|
|
|
|
#include "dsp-util.h"
|
2012-04-29 21:31:30 +00:00
|
|
|
|
#include "dsp_core.h"
|
|
|
|
|
#include "dsp_proc_settings.h"
|
2007-05-07 17:23:31 +00:00
|
|
|
|
#include "codecs.h"
|
|
|
|
|
#include "playback.h"
|
2009-10-31 19:17:36 +00:00
|
|
|
|
#include "codec_thread.h"
|
2006-11-11 05:11:05 +00:00
|
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
|
#include "recording.h"
|
|
|
|
|
#endif
|
2004-01-30 22:30:40 +00:00
|
|
|
|
#include "settings.h"
|
2005-07-26 20:01:11 +00:00
|
|
|
|
#include "timer.h"
|
2004-06-19 09:36:03 +00:00
|
|
|
|
#include "playlist.h"
|
2009-02-10 23:43:37 +00:00
|
|
|
|
#include "screendump.h"
|
2006-11-19 14:11:42 +00:00
|
|
|
|
#include "scrollbar.h"
|
2009-05-01 23:24:23 +00:00
|
|
|
|
#include "jpeg_load.h"
|
2008-12-26 07:03:22 +00:00
|
|
|
|
#include "../recorder/bmp.h"
|
2007-05-08 11:55:43 +00:00
|
|
|
|
#include "statusbar.h"
|
2005-09-22 08:54:48 +00:00
|
|
|
|
#include "menu.h"
|
2005-12-06 13:27:15 +00:00
|
|
|
|
#include "rbunicode.h"
|
2006-04-03 08:51:08 +00:00
|
|
|
|
#include "list.h"
|
2006-11-11 05:11:05 +00:00
|
|
|
|
#include "tree.h"
|
2007-06-18 13:37:57 +00:00
|
|
|
|
#include "color_picker.h"
|
2011-08-30 16:48:36 +00:00
|
|
|
|
#include "buflib.h"
|
2007-12-09 18:48:02 +00:00
|
|
|
|
#include "buffering.h"
|
|
|
|
|
#include "tagcache.h"
|
2008-03-26 03:35:24 +00:00
|
|
|
|
#include "viewport.h"
|
2008-08-14 22:35:00 +00:00
|
|
|
|
#include "ata_idle_notify.h"
|
2008-10-26 11:44:21 +00:00
|
|
|
|
#include "settings_list.h"
|
2009-03-08 20:28:15 +00:00
|
|
|
|
#include "timefuncs.h"
|
2009-11-22 18:48:07 +00:00
|
|
|
|
#include "crc32.h"
|
2011-12-25 21:04:40 +00:00
|
|
|
|
#include "rbpaths.h"
|
2013-05-30 09:24:16 +00:00
|
|
|
|
#include "core_alloc.h"
|
2013-12-20 22:34:28 +00:00
|
|
|
|
#include "screen_access.h"
|
2007-12-09 19:14:31 +00:00
|
|
|
|
|
|
|
|
|
#ifdef HAVE_ALBUMART
|
2007-12-09 18:48:02 +00:00
|
|
|
|
#include "albumart.h"
|
2007-12-09 19:14:31 +00:00
|
|
|
|
#endif
|
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
|
|
|
|
|
|
2008-07-07 14:04:18 +00:00
|
|
|
|
#include "yesno.h"
|
|
|
|
|
|
2010-12-28 14:18:37 +00:00
|
|
|
|
#include "filetypes.h"
|
|
|
|
|
|
2009-09-30 10:06:04 +00:00
|
|
|
|
#ifdef USB_ENABLE_HID
|
2009-07-18 12:58:29 +00:00
|
|
|
|
#include "usbstack/usb_hid_usage_tables.h"
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-05-06 21:04:40 +00:00
|
|
|
|
|
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
|
2010-05-18 18:45:10 +00:00
|
|
|
|
#undef DEBUGF
|
|
|
|
|
#define DEBUGF(...) do { } while(0)
|
|
|
|
|
#undef LDEBUGF
|
|
|
|
|
#define LDEBUGF(...) do { } while(0)
|
2004-06-10 13:29:52 +00:00
|
|
|
|
#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
|
|
|
|
|
|
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 */
|
2020-11-12 04:20:19 +00:00
|
|
|
|
#define PLUGIN_API_VERSION 244
|
2003-07-25 23:04:59 +00:00
|
|
|
|
|
|
|
|
|
/* update this to latest version if a change to the api struct breaks
|
2006-05-01 05:45:18 +00:00
|
|
|
|
backwards compatibility (and please take the opportunity to sort in any
|
2004-02-03 23:56:25 +00:00
|
|
|
|
new function which are "waiting" at the end of the function table) */
|
2020-11-12 04:20:19 +00:00
|
|
|
|
#define PLUGIN_MIN_API_VERSION 244
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2020-07-23 13:49:34 +00:00
|
|
|
|
/* 239 Marks the removal of ARCHOS HWCODEC and CHARCELL */
|
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
/* plugin return codes */
|
2010-08-24 14:30:46 +00:00
|
|
|
|
/* internal returns start at 0x100 to make exit(1..255) work */
|
|
|
|
|
#define INTERNAL_PLUGIN_RETVAL_START 0x100
|
2003-06-29 16:33:04 +00:00
|
|
|
|
enum plugin_status {
|
2010-08-24 14:30:46 +00:00
|
|
|
|
PLUGIN_OK = 0, /* PLUGIN_OK == EXIT_SUCCESS */
|
|
|
|
|
/* 1...255 reserved for exit() */
|
|
|
|
|
PLUGIN_USB_CONNECTED = INTERNAL_PLUGIN_RETVAL_START,
|
|
|
|
|
PLUGIN_POWEROFF,
|
2009-07-05 22:12:42 +00:00
|
|
|
|
PLUGIN_GOTO_WPS,
|
2020-08-01 02:45:10 +00:00
|
|
|
|
PLUGIN_GOTO_PLUGIN,
|
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 {
|
2019-02-04 01:12:50 +00:00
|
|
|
|
const char *rbversion;
|
|
|
|
|
struct user_settings* global_settings;
|
|
|
|
|
struct system_status *global_status;
|
|
|
|
|
unsigned char **language_strings;
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* lcd */
|
2019-07-20 09:46:14 +00:00
|
|
|
|
void (*splash)(int ticks, const char *str);
|
|
|
|
|
void (*splashf)(int ticks, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
|
2009-03-30 16:06:02 +00:00
|
|
|
|
#ifdef HAVE_LCD_CONTRAST
|
2005-06-24 22:33:21 +00:00
|
|
|
|
void (*lcd_set_contrast)(int x);
|
2009-03-30 16:06:02 +00:00
|
|
|
|
#endif
|
2007-03-31 09:58:49 +00:00
|
|
|
|
void (*lcd_update)(void);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
void (*lcd_clear_display)(void);
|
2007-03-26 07:52:13 +00:00
|
|
|
|
int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
|
|
|
|
|
void (*lcd_putsxy)(int x, int y, const unsigned char *string);
|
2010-08-30 20:47:53 +00:00
|
|
|
|
void (*lcd_putsxyf)(int x, int y, const unsigned char *fmt, ...);
|
2004-08-01 21:50:57 +00:00
|
|
|
|
void (*lcd_puts)(int x, int y, const unsigned char *string);
|
2010-08-30 20:47:53 +00:00
|
|
|
|
void (*lcd_putsf)(int x, int y, const unsigned char *fmt, ...);
|
2014-01-12 00:30:26 +00:00
|
|
|
|
bool (*lcd_puts_scroll)(int x, int y, const unsigned char* string);
|
2013-04-03 14:33:23 +00:00
|
|
|
|
void (*lcd_scroll_stop)(void);
|
2020-10-07 06:01:35 +00:00
|
|
|
|
struct viewport* (*lcd_set_viewport)(struct viewport* vp);
|
2012-12-09 20:04:17 +00:00
|
|
|
|
void (*lcd_bmp_part)(const struct bitmap *bm, int src_x, int src_y,
|
|
|
|
|
int x, int y, int width, int height);
|
2008-03-24 00:45:03 +00:00
|
|
|
|
void (*lcd_update_rect)(int x, int y, int width, int height);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
void (*lcd_set_drawmode)(int mode);
|
|
|
|
|
int (*lcd_get_drawmode)(void);
|
|
|
|
|
void (*lcd_setfont)(int font);
|
|
|
|
|
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);
|
2007-06-22 09:34:57 +00:00
|
|
|
|
fb_data* (*lcd_get_backdrop)(void);
|
2006-11-19 14:11:42 +00:00
|
|
|
|
void (*lcd_set_backdrop)(fb_data* backdrop);
|
2006-02-07 20:38:55 +00:00
|
|
|
|
#endif
|
2014-06-18 05:15:00 +00:00
|
|
|
|
#if LCD_DEPTH >= 16
|
2006-02-07 20:38:55 +00:00
|
|
|
|
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);
|
2009-06-21 14:09:48 +00:00
|
|
|
|
#if MEMORYSIZE > 2
|
2008-03-24 00:35:53 +00:00
|
|
|
|
void (*lcd_blit_yuv)(unsigned char * const src[3],
|
|
|
|
|
int src_x, int src_y, int stride,
|
|
|
|
|
int x, int y, int width, int height);
|
|
|
|
|
#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \
|
2009-07-15 22:02:42 +00:00
|
|
|
|
|| defined(IRIVER_H10) || defined(COWON_D2) || defined(PHILIPS_HDD1630) \
|
2010-03-28 02:41:29 +00:00
|
|
|
|
|| defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) \
|
2011-01-11 01:21:31 +00:00
|
|
|
|
|| defined(TOSHIBA_GIGABEAT_S) || defined(PHILIPS_SA9200)
|
2008-03-24 00:35:53 +00:00
|
|
|
|
void (*lcd_yuv_set_options)(unsigned options);
|
2005-07-26 20:01:11 +00:00
|
|
|
|
#endif
|
2009-06-21 14:09:48 +00:00
|
|
|
|
#endif /* MEMORYSIZE > 2 */
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#elif (LCD_DEPTH < 4) && (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2008-03-24 00:35:53 +00:00
|
|
|
|
void (*lcd_blit_mono)(const unsigned char *data, int x, int by, int width,
|
|
|
|
|
int bheight, int stride);
|
|
|
|
|
void (*lcd_blit_grey_phase)(unsigned char *values, unsigned char *phases,
|
|
|
|
|
int bx, int by, int bwidth, int bheight,
|
|
|
|
|
int stride);
|
|
|
|
|
#endif /* LCD_DEPTH */
|
2009-05-06 04:53:56 +00:00
|
|
|
|
#if defined(HAVE_LCD_MODES) && (HAVE_LCD_MODES & LCD_MODE_PAL256)
|
|
|
|
|
void (*lcd_blit_pal256)(unsigned char *src, int src_x, int src_y, int x, int y,
|
|
|
|
|
int width, int height);
|
|
|
|
|
void (*lcd_pal256_update_pal)(fb_data *palette);
|
|
|
|
|
#endif
|
2008-05-15 06:58:36 +00:00
|
|
|
|
#ifdef HAVE_LCD_INVERT
|
|
|
|
|
void (*lcd_set_invert_display)(bool yesno);
|
|
|
|
|
#endif /* HAVE_LCD_INVERT */
|
2009-05-06 04:53:56 +00:00
|
|
|
|
#if defined(HAVE_LCD_MODES)
|
|
|
|
|
void (*lcd_set_mode)(int mode);
|
|
|
|
|
#endif
|
2008-12-25 04:24:47 +00:00
|
|
|
|
|
2009-03-17 02:43:47 +00:00
|
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
2008-06-23 13:20:35 +00:00
|
|
|
|
struct event_queue *button_queue;
|
|
|
|
|
#endif
|
2008-03-24 00:35:53 +00:00
|
|
|
|
unsigned short *(*bidi_l2v)( const unsigned char *str, int orientation );
|
2010-05-24 16:42:32 +00:00
|
|
|
|
bool (*is_diacritic)(const unsigned short char_code, bool *is_rtl);
|
2008-03-24 00:35:53 +00:00
|
|
|
|
const unsigned char *(*font_get_bits)( struct font *pf, unsigned short char_code );
|
2011-09-24 13:19:34 +00:00
|
|
|
|
int (*font_load)(const char *path);
|
|
|
|
|
void (*font_unload)(int font_id);
|
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);
|
2007-08-06 13:42:52 +00:00
|
|
|
|
void (*screen_clear_area)(struct screen * display, int xstart, int ystart,
|
|
|
|
|
int width, int height);
|
2008-03-24 00:35:53 +00:00
|
|
|
|
void (*gui_scrollbar_draw)(struct screen * screen, int x, int y,
|
|
|
|
|
int width, int height, int items,
|
|
|
|
|
int min_shown, int max_shown,
|
|
|
|
|
unsigned flags);
|
2019-07-20 20:06:30 +00:00
|
|
|
|
const char* (*get_codepage_name)(int cp);
|
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);
|
2014-01-12 00:50:21 +00:00
|
|
|
|
bool (*lcd_remote_puts_scroll)(int x, int y, const unsigned char* string);
|
2013-04-03 14:33:23 +00:00
|
|
|
|
void (*lcd_remote_scroll_stop)(void);
|
2005-06-29 01:39:50 +00:00
|
|
|
|
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_update)(void);
|
|
|
|
|
void (*lcd_remote_update_rect)(int x, int y, int width, int height);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
#if (LCD_REMOTE_DEPTH > 1)
|
2006-09-16 16:18:11 +00:00
|
|
|
|
void (*lcd_remote_set_foreground)(unsigned foreground);
|
|
|
|
|
unsigned (*lcd_remote_get_foreground)(void);
|
2006-10-14 01:32:58 +00:00
|
|
|
|
void (*lcd_remote_set_background)(unsigned background);
|
2006-09-16 16:18:11 +00:00
|
|
|
|
unsigned (*lcd_remote_get_background)(void);
|
2009-12-20 12:59:25 +00:00
|
|
|
|
void (*lcd_remote_bitmap_part)(const fb_remote_data *src,
|
|
|
|
|
int src_x, int src_y, int stride,
|
|
|
|
|
int x, int y, int width, int height);
|
|
|
|
|
void (*lcd_remote_bitmap)(const fb_remote_data *src, int x, int y,
|
|
|
|
|
int width, int height);
|
2006-09-16 16:18:11 +00:00
|
|
|
|
#endif
|
2019-07-20 09:46:14 +00:00
|
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
|
|
|
|
struct screen* screens[NB_SCREENS];
|
|
|
|
|
|
2009-12-20 12:59:25 +00:00
|
|
|
|
void (*viewport_set_defaults)(struct viewport *vp,
|
2019-02-04 01:12:50 +00:00
|
|
|
|
const enum screen_type screen);
|
2010-02-14 06:26:16 +00:00
|
|
|
|
void (*viewportmanager_theme_enable)(enum screen_type screen, bool enable,
|
|
|
|
|
struct viewport *viewport);
|
|
|
|
|
void (*viewportmanager_theme_undo)(enum screen_type screen, bool force_redraw);
|
2012-12-09 20:04:17 +00:00
|
|
|
|
void (*viewport_set_fullscreen)(struct viewport *vp,
|
|
|
|
|
const enum screen_type screen);
|
2020-10-07 06:01:35 +00:00
|
|
|
|
void (*viewport_set_buffer)(struct viewport *vp, struct frame_buffer_t *buffer,
|
|
|
|
|
const enum screen_type screen);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
|
2020-07-15 23:40:55 +00:00
|
|
|
|
#ifdef HAVE_BACKLIGHT
|
2019-07-20 09:46:14 +00:00
|
|
|
|
/* lcd backlight */
|
2020-07-15 23:40:55 +00:00
|
|
|
|
/* For OLED targets like the Sansa Clip, the backlight_* functions control
|
2019-07-20 09:46:14 +00:00
|
|
|
|
* the display enable, which has essentially the same effect. */
|
|
|
|
|
bool (*is_backlight_on)(bool ignore_always_off);
|
|
|
|
|
void (*backlight_on)(void);
|
|
|
|
|
void (*backlight_off)(void);
|
|
|
|
|
void (*backlight_set_timeout)(int index);
|
|
|
|
|
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
|
|
|
|
void (*backlight_set_brightness)(int val);
|
|
|
|
|
#endif /* HAVE_BACKLIGHT_BRIGHTNESS */
|
|
|
|
|
|
|
|
|
|
#if CONFIG_CHARGING
|
|
|
|
|
void (*backlight_set_timeout_plugged)(int index);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
|
void (*remote_backlight_on)(void);
|
|
|
|
|
void (*remote_backlight_off)(void);
|
|
|
|
|
void (*remote_backlight_set_timeout)(int index);
|
|
|
|
|
#if CONFIG_CHARGING
|
|
|
|
|
void (*remote_backlight_set_timeout_plugged)(int index);
|
|
|
|
|
#endif
|
|
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2020-07-15 23:40:55 +00:00
|
|
|
|
#endif /* HAVE_BACKLIGHT */
|
2019-07-20 09:46:14 +00:00
|
|
|
|
|
2006-09-16 16:18:11 +00:00
|
|
|
|
/* list */
|
|
|
|
|
void (*gui_synclist_init)(struct gui_synclist * lists,
|
2008-05-13 09:57:56 +00:00
|
|
|
|
list_get_name callback_get_item_name, void * data,
|
2008-03-26 03:35:24 +00:00
|
|
|
|
bool scroll_all,int selected_size,
|
|
|
|
|
struct viewport parent[NB_SCREENS]);
|
2006-09-16 16:18:11 +00:00
|
|
|
|
void (*gui_synclist_set_nb_items)(struct gui_synclist * lists, int nb_items);
|
2019-02-04 01:12:50 +00:00
|
|
|
|
void (*gui_synclist_set_voice_callback)(struct gui_synclist * lists, list_speak_item voice_callback);
|
2009-12-20 12:59:25 +00:00
|
|
|
|
void (*gui_synclist_set_icon_callback)(struct gui_synclist * lists,
|
|
|
|
|
list_get_icon icon_callback);
|
2006-09-16 16:18:11 +00:00
|
|
|
|
int (*gui_synclist_get_nb_items)(struct gui_synclist * lists);
|
|
|
|
|
int (*gui_synclist_get_sel_pos)(struct gui_synclist * lists);
|
|
|
|
|
void (*gui_synclist_draw)(struct gui_synclist * lists);
|
2019-02-04 01:12:50 +00:00
|
|
|
|
void (*gui_synclist_speak_item)(struct gui_synclist * lists);
|
2006-09-16 16:18:11 +00:00
|
|
|
|
void (*gui_synclist_select_item)(struct gui_synclist * lists,
|
2009-12-20 12:59:25 +00:00
|
|
|
|
int item_number);
|
2006-09-16 16:18:11 +00:00
|
|
|
|
void (*gui_synclist_add_item)(struct gui_synclist * lists);
|
|
|
|
|
void (*gui_synclist_del_item)(struct gui_synclist * lists);
|
|
|
|
|
void (*gui_synclist_limit_scroll)(struct gui_synclist * lists, bool scroll);
|
2007-09-17 10:08:50 +00:00
|
|
|
|
bool (*gui_synclist_do_button)(struct gui_synclist * lists,
|
2008-12-31 05:59:26 +00:00
|
|
|
|
int *action, enum list_wrap wrap);
|
2009-10-11 09:40:47 +00:00
|
|
|
|
void (*gui_synclist_set_title)(struct gui_synclist *lists, char* title,
|
2009-07-11 00:22:26 +00:00
|
|
|
|
enum themable_icons icon);
|
2008-08-14 22:35:00 +00:00
|
|
|
|
enum yesno_res (*gui_syncyesno_run)(const struct text_message * main_message,
|
|
|
|
|
const struct text_message * yes_message,
|
|
|
|
|
const struct text_message * no_message);
|
2008-06-23 13:20:35 +00:00
|
|
|
|
void (*simplelist_info_init)(struct simplelist_info *info, char* title,
|
2009-12-20 12:59:25 +00:00
|
|
|
|
int count, void* data);
|
2008-06-23 13:20:35 +00:00
|
|
|
|
bool (*simplelist_show_list)(struct simplelist_info *info);
|
2006-10-14 01:32:58 +00:00
|
|
|
|
|
2019-07-20 09:46:14 +00:00
|
|
|
|
/* action handling */
|
|
|
|
|
int (*get_custom_action)(int context,int timeout,
|
|
|
|
|
const struct button_mapping* (*get_context_map)(int));
|
|
|
|
|
int (*get_action)(int context, int timeout);
|
|
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
|
int (*action_get_touchscreen_press)(short *x, short *y);
|
|
|
|
|
#endif
|
|
|
|
|
bool (*action_userabort)(int timeout);
|
|
|
|
|
|
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);
|
2008-05-15 07:13:03 +00:00
|
|
|
|
int (*button_status)(void);
|
2008-05-15 06:58:36 +00:00
|
|
|
|
#ifdef HAVE_BUTTON_DATA
|
|
|
|
|
intptr_t (*button_get_data)(void);
|
2009-10-20 21:54:59 +00:00
|
|
|
|
int (*button_status_wdata)(int *pdata);
|
2008-05-15 06:58:36 +00:00
|
|
|
|
#endif
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*button_clear_queue)(void);
|
2008-12-25 04:24:47 +00:00
|
|
|
|
int (*button_queue_count)(void);
|
2006-05-01 05:45:18 +00:00
|
|
|
|
#ifdef HAS_BUTTON_HOLD
|
2005-06-18 01:25:47 +00:00
|
|
|
|
bool (*button_hold)(void);
|
|
|
|
|
#endif
|
2020-06-27 00:53:15 +00:00
|
|
|
|
#ifdef HAVE_SW_POWEROFF
|
|
|
|
|
void (*button_set_sw_poweroff_state)(bool enable);
|
|
|
|
|
bool (*button_get_sw_poweroff_state)(void);
|
|
|
|
|
#endif
|
2008-08-23 09:46:38 +00:00
|
|
|
|
#ifdef HAVE_TOUCHSCREEN
|
|
|
|
|
void (*touchscreen_set_mode)(enum touchscreen_mode);
|
2012-01-26 22:37:27 +00:00
|
|
|
|
enum touchscreen_mode (*touchscreen_get_mode)(void);
|
2008-05-15 07:13:03 +00:00
|
|
|
|
#endif
|
2008-05-15 06:58:36 +00:00
|
|
|
|
#ifdef HAVE_BUTTON_LIGHT
|
|
|
|
|
void (*buttonlight_set_timeout)(int value);
|
|
|
|
|
void (*buttonlight_off)(void);
|
|
|
|
|
void (*buttonlight_on)(void);
|
|
|
|
|
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
|
|
|
|
|
void (*buttonlight_set_brightness)(int val);
|
|
|
|
|
#endif /* HAVE_BUTTONLIGHT_BRIGHTNESS */
|
|
|
|
|
#endif /* HAVE_BUTTON_LIGHT */
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* file */
|
2010-02-14 06:26:16 +00:00
|
|
|
|
int (*open_utf8)(const char* pathname, int flags);
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
|
int (*open)(const char *path, int oflag, ...);
|
|
|
|
|
int (*creat)(const char *path, mode_t mode);
|
|
|
|
|
int (*close)(int fildes);
|
|
|
|
|
ssize_t (*read)(int fildes, void *buf, size_t nbyte);
|
|
|
|
|
off_t (*lseek)(int fildes, off_t offset, int whence);
|
|
|
|
|
ssize_t (*write)(int fildes, const void *buf, size_t nbyte);
|
|
|
|
|
int (*remove)(const char *path);
|
|
|
|
|
int (*rename)(const char *old, const char *new);
|
|
|
|
|
int (*ftruncate)(int fildes, off_t length);
|
|
|
|
|
off_t (*filesize)(int fildes);
|
|
|
|
|
int (*fdprintf)(int fildes, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
|
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);
|
2008-11-01 16:14:28 +00:00
|
|
|
|
void (*storage_sleep)(void);
|
|
|
|
|
void (*storage_spin)(void);
|
|
|
|
|
void (*storage_spindown)(int seconds);
|
|
|
|
|
#if USING_STORAGE_CALLBACK
|
2014-03-14 22:15:16 +00:00
|
|
|
|
void (*register_storage_idle_func)(void (*function)(void));
|
|
|
|
|
void (*unregister_storage_idle_func)(void (*function)(void), bool run);
|
2008-11-01 16:14:28 +00:00
|
|
|
|
#endif /* USING_STORAGE_CALLBACK */
|
2006-09-16 16:18:11 +00:00
|
|
|
|
void (*reload_directory)(void);
|
2007-06-22 09:34:57 +00:00
|
|
|
|
char *(*create_numbered_filename)(char *buffer, const char *path,
|
|
|
|
|
const char *prefix, const char *suffix,
|
|
|
|
|
int numberlen IF_CNFN_NUM_(, int *num));
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
|
bool (*file_exists)(const char *path);
|
2009-02-11 16:37:12 +00:00
|
|
|
|
char* (*strip_extension)(char* buffer, int buffer_size, const char *filename);
|
2014-01-09 20:37:07 +00:00
|
|
|
|
uint32_t (*crc_32)(const void *src, uint32_t len, uint32_t crc32);
|
2008-03-24 00:35:53 +00:00
|
|
|
|
|
2011-01-20 17:11:23 +00:00
|
|
|
|
int (*filetype_get_attr)(const char* file);
|
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
/* dir */
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
|
DIR * (*opendir)(const char *dirname);
|
|
|
|
|
int (*closedir)(DIR *dirp);
|
|
|
|
|
struct dirent * (*readdir)(DIR *dirp);
|
|
|
|
|
int (*mkdir)(const char *path);
|
|
|
|
|
int (*rmdir)(const char *path);
|
|
|
|
|
bool (*dir_exists)(const char *dirname);
|
|
|
|
|
struct dirinfo (*dir_get_info)(DIR *dirp, struct dirent *entry);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2011-01-20 17:11:23 +00:00
|
|
|
|
/* browsing */
|
|
|
|
|
void (*browse_context_init)(struct browse_context *browse,
|
|
|
|
|
int dirfilter, unsigned flags,
|
|
|
|
|
char *title, enum themable_icons icon,
|
|
|
|
|
const char *root, const char *selected);
|
|
|
|
|
int (*rockbox_browse)(struct browse_context *browse);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
struct tree_context* (*tree_get_context)(void);
|
|
|
|
|
struct entry* (*tree_get_entries)(struct tree_context* t);
|
|
|
|
|
struct entry* (*tree_get_entry_at)(struct tree_context* t, int index);
|
|
|
|
|
|
|
|
|
|
void (*set_current_file)(const char* path);
|
|
|
|
|
void (*set_dirfilter)(int l_dirfilter);
|
2011-01-20 17:11:23 +00:00
|
|
|
|
|
2019-02-04 01:12:50 +00:00
|
|
|
|
/* talking */
|
|
|
|
|
int (*talk_id)(int32_t id, bool enqueue);
|
|
|
|
|
int (*talk_file)(const char *root, const char *dir, const char *file,
|
|
|
|
|
const char *ext, const long *prefix_ids, bool enqueue);
|
|
|
|
|
int (*talk_file_or_spell)(const char *dirname, const char* filename,
|
|
|
|
|
const long *prefix_ids, bool enqueue);
|
|
|
|
|
int (*talk_dir_or_spell)(const char* filename,
|
|
|
|
|
const long *prefix_ids, bool enqueue);
|
|
|
|
|
int (*talk_number)(long n, bool enqueue);
|
|
|
|
|
int (*talk_value)(long n, int unit, bool enqueue);
|
|
|
|
|
int (*talk_spell)(const char* spell, bool enqueue);
|
|
|
|
|
void (*talk_time)(const struct tm *tm, bool enqueue);
|
|
|
|
|
void (*talk_date)(const struct tm *tm, bool enqueue);
|
|
|
|
|
void (*talk_disable)(bool disable);
|
|
|
|
|
void (*talk_shutup)(void);
|
|
|
|
|
void (*talk_force_shutup)(void);
|
|
|
|
|
void (*talk_force_enqueue_next)(void);
|
|
|
|
|
|
2004-10-23 09:59:53 +00:00
|
|
|
|
/* kernel/ system */
|
2010-08-03 19:00:29 +00:00
|
|
|
|
#if defined(CPU_ARM) && CONFIG_PLATFORM & PLATFORM_NATIVE
|
2009-02-11 16:37:12 +00:00
|
|
|
|
void (*__div0)(void);
|
|
|
|
|
#endif
|
2010-09-01 21:29:34 +00:00
|
|
|
|
unsigned (*sleep)(unsigned ticks);
|
2004-07-27 14:10:48 +00:00
|
|
|
|
void (*yield)(void);
|
2007-06-25 20:46:54 +00:00
|
|
|
|
volatile long* current_tick;
|
2005-02-07 22:56:37 +00:00
|
|
|
|
long (*default_event_handler)(long event);
|
2009-12-20 12:59:25 +00:00
|
|
|
|
long (*default_event_handler_ex)(long event,
|
|
|
|
|
void (*callback)(void *), void *parameter);
|
2008-12-10 08:57:10 +00:00
|
|
|
|
unsigned int (*create_thread)(void (*function)(void), void* stack,
|
|
|
|
|
size_t stack_size, unsigned flags,
|
|
|
|
|
const char *name
|
|
|
|
|
IF_PRIO(, int priority)
|
|
|
|
|
IF_COP(, unsigned int core));
|
2011-03-16 05:38:37 +00:00
|
|
|
|
unsigned int (*thread_self)(void);
|
2008-03-25 02:34:12 +00:00
|
|
|
|
void (*thread_exit)(void);
|
2008-12-10 08:57:10 +00:00
|
|
|
|
void (*thread_wait)(unsigned int thread_id);
|
2009-01-05 10:31:19 +00:00
|
|
|
|
void (*thread_thaw)(unsigned int thread_id);
|
|
|
|
|
#ifdef HAVE_PRIORITY_SCHEDULING
|
|
|
|
|
int (*thread_set_priority)(unsigned int thread_id, int priority);
|
|
|
|
|
#endif
|
2008-03-24 00:35:53 +00:00
|
|
|
|
void (*mutex_init)(struct mutex *m);
|
|
|
|
|
void (*mutex_lock)(struct mutex *m);
|
|
|
|
|
void (*mutex_unlock)(struct mutex *m);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
#ifdef HAVE_SEMAPHORE_OBJECTS
|
|
|
|
|
void (*semaphore_init)(struct semaphore *s, int max, int start);
|
|
|
|
|
int (*semaphore_wait)(struct semaphore *s, int timeout);
|
|
|
|
|
void (*semaphore_release)(struct semaphore *s);
|
|
|
|
|
#endif
|
2004-07-27 19:16:58 +00:00
|
|
|
|
void (*reset_poweroff_timer)(void);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
void (*set_sleeptimer_duration)(int minutes);
|
|
|
|
|
int (*get_sleep_timer)(void);
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2004-10-23 09:59:53 +00:00
|
|
|
|
int (*system_memory_guard)(int newmode);
|
2005-06-18 01:25:47 +00:00
|
|
|
|
long *cpu_frequency;
|
|
|
|
|
#ifdef HAVE_ADJUSTABLE_CPU_FREQ
|
2007-01-22 10:41:25 +00:00
|
|
|
|
#ifdef CPU_BOOST_LOGGING
|
|
|
|
|
void (*cpu_boost_)(bool on_off,char*location,int line);
|
|
|
|
|
#else
|
2005-06-18 01:25:47 +00:00
|
|
|
|
void (*cpu_boost)(bool on_off);
|
2007-01-22 10:41:25 +00:00
|
|
|
|
#endif
|
2008-03-24 00:35:53 +00:00
|
|
|
|
#endif /* HAVE_ADJUSTABLE_CPU_FREQ */
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#endif /* PLATFORM_NATIVE */
|
2008-03-24 00:35:53 +00:00
|
|
|
|
#ifdef HAVE_SCHEDULER_BOOSTCTRL
|
|
|
|
|
void (*trigger_cpu_boost)(void);
|
|
|
|
|
void (*cancel_cpu_boost)(void);
|
2007-07-29 03:43:37 +00:00
|
|
|
|
#endif
|
2010-10-16 12:30:06 +00:00
|
|
|
|
|
2011-12-17 07:27:24 +00:00
|
|
|
|
void (*commit_dcache)(void);
|
|
|
|
|
void (*commit_discard_dcache)(void);
|
2012-01-27 08:31:34 +00:00
|
|
|
|
void (*commit_discard_idcache)(void);
|
2010-10-16 12:30:06 +00:00
|
|
|
|
|
|
|
|
|
/* load code api for overlay */
|
|
|
|
|
void* (*lc_open)(const char *filename, unsigned char *buf, size_t buf_size);
|
|
|
|
|
void* (*lc_open_from_mem)(void* addr, size_t blob_size);
|
|
|
|
|
void* (*lc_get_header)(void *handle);
|
|
|
|
|
void (*lc_close)(void *handle);
|
|
|
|
|
|
2005-07-26 20:01:11 +00:00
|
|
|
|
bool (*timer_register)(int reg_prio, void (*unregister_callback)(void),
|
2009-06-29 14:29:46 +00:00
|
|
|
|
long cycles, void (*timer_callback)(void)
|
|
|
|
|
IF_COP(, int core));
|
2005-07-26 20:01:11 +00:00
|
|
|
|
void (*timer_unregister)(void);
|
|
|
|
|
bool (*timer_set_period)(long count);
|
2007-07-29 03:43:37 +00:00
|
|
|
|
|
2006-09-16 16:18:11 +00:00
|
|
|
|
void (*queue_init)(struct event_queue *q, bool register_queue);
|
2006-02-07 20:38:55 +00:00
|
|
|
|
void (*queue_delete)(struct event_queue *q);
|
2006-12-19 16:50:07 +00:00
|
|
|
|
void (*queue_post)(struct event_queue *q, long id, intptr_t data);
|
2007-10-16 01:25:17 +00:00
|
|
|
|
void (*queue_wait_w_tmo)(struct event_queue *q, struct queue_event *ev,
|
2006-02-07 20:38:55 +00:00
|
|
|
|
int ticks);
|
2008-03-24 00:35:53 +00:00
|
|
|
|
void (*queue_enable_queue_send)(struct event_queue *q,
|
2008-03-25 02:34:12 +00:00
|
|
|
|
struct queue_sender_list *send,
|
2008-12-10 08:57:10 +00:00
|
|
|
|
unsigned int thread_id);
|
2008-03-24 00:35:53 +00:00
|
|
|
|
bool (*queue_empty)(const struct event_queue *q);
|
|
|
|
|
void (*queue_wait)(struct event_queue *q, struct queue_event *ev);
|
|
|
|
|
intptr_t (*queue_send)(struct event_queue *q, long id,
|
|
|
|
|
intptr_t data);
|
|
|
|
|
void (*queue_reply)(struct event_queue *q, intptr_t retval);
|
|
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
|
#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
|
2009-10-20 21:54:59 +00:00
|
|
|
|
/* event api */
|
2014-03-14 22:15:16 +00:00
|
|
|
|
bool (*add_event)(unsigned short id, void (*handler)(unsigned short id, void *data));
|
|
|
|
|
void (*remove_event)(unsigned short id, void (*handler)(unsigned short id, void *data));
|
2009-10-20 21:54:59 +00:00
|
|
|
|
void (*send_event)(unsigned short id, void *data);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
2006-03-11 09:28:49 +00:00
|
|
|
|
/* special simulator hooks */
|
2020-07-17 14:31:31 +00:00
|
|
|
|
#if LCD_DEPTH < 8
|
2009-02-09 00:32:59 +00:00
|
|
|
|
void (*sim_lcd_ex_init)(unsigned long (*getpixel)(int, int));
|
2006-03-11 09:28:49 +00:00
|
|
|
|
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 */
|
2007-03-17 09:02:53 +00:00
|
|
|
|
int (*snprintf)(char *buf, size_t size, const char *fmt, ...)
|
|
|
|
|
ATTRIBUTE_PRINTF(3, 4);
|
2010-05-06 21:04:40 +00:00
|
|
|
|
int (*vsnprintf)(char *buf, size_t size, const char *fmt, va_list ap);
|
2004-10-23 09:59:53 +00:00
|
|
|
|
char* (*strcpy)(char *dst, const char *src);
|
2009-07-14 13:57:45 +00:00
|
|
|
|
size_t (*strlcpy)(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);
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2009-05-21 19:01:41 +00:00
|
|
|
|
const unsigned char *_rbctype_;
|
2010-05-14 12:37:05 +00:00
|
|
|
|
#endif
|
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);
|
2010-02-14 06:26:16 +00:00
|
|
|
|
size_t (*strlcat)(char *dst, const char *src, size_t length);
|
2006-09-16 16:18:11 +00:00
|
|
|
|
void *(*memchr)(const void *s1, int c, size_t n);
|
2005-02-22 12:19:12 +00:00
|
|
|
|
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-10-31 11:17:00 +00:00
|
|
|
|
char* (*strtok_r)(char *ptr, const char *sep, char **end);
|
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);
|
2006-07-25 18:12:57 +00:00
|
|
|
|
unsigned char* (*utf16LEdecode)(const unsigned char *utf16, unsigned char *utf8, int count);
|
|
|
|
|
unsigned char* (*utf16BEdecode)(const unsigned char *utf16, unsigned char *utf8, int count);
|
2006-01-15 18:20:18 +00:00
|
|
|
|
unsigned char* (*utf8encode)(unsigned long ucs, unsigned char *utf8);
|
|
|
|
|
unsigned long (*utf8length)(const unsigned char *utf8);
|
2006-09-16 16:18:11 +00:00
|
|
|
|
int (*utf8seek)(const unsigned char* utf8, int offset);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2011-10-17 18:28:35 +00:00
|
|
|
|
/* the buflib memory management library */
|
|
|
|
|
void (*buflib_init)(struct buflib_context* ctx, void* buf, size_t size);
|
|
|
|
|
size_t (*buflib_available)(struct buflib_context* ctx);
|
|
|
|
|
int (*buflib_alloc)(struct buflib_context* ctx, size_t size);
|
|
|
|
|
int (*buflib_alloc_ex)(struct buflib_context* ctx, size_t size,
|
|
|
|
|
const char* name, struct buflib_callbacks *ops);
|
|
|
|
|
int (*buflib_alloc_maximum)(struct buflib_context* ctx, const char* name,
|
|
|
|
|
size_t* size, struct buflib_callbacks *ops);
|
|
|
|
|
void (*buflib_buffer_in)(struct buflib_context* ctx, int size);
|
|
|
|
|
void* (*buflib_buffer_out)(struct buflib_context* ctx, size_t* size);
|
|
|
|
|
int (*buflib_free)(struct buflib_context* ctx, int handle);
|
|
|
|
|
bool (*buflib_shrink)(struct buflib_context* ctx, int handle,
|
|
|
|
|
void* new_start, size_t new_size);
|
|
|
|
|
void* (*buflib_get_data)(struct buflib_context* ctx, int handle);
|
|
|
|
|
const char* (*buflib_get_name)(struct buflib_context* ctx, int handle);
|
|
|
|
|
|
2003-06-29 16:33:04 +00:00
|
|
|
|
/* sound */
|
2005-04-01 13:41:03 +00:00
|
|
|
|
void (*sound_set)(int setting, int value);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
int (*sound_current)(int setting); /*stub*/
|
2008-03-24 00:35:53 +00:00
|
|
|
|
int (*sound_default)(int setting);
|
2006-01-15 18:20:18 +00:00
|
|
|
|
int (*sound_min)(int setting);
|
|
|
|
|
int (*sound_max)(int setting);
|
2008-03-24 00:35:53 +00:00
|
|
|
|
const char * (*sound_unit)(int setting);
|
|
|
|
|
int (*sound_val2phys)(int setting, int value);
|
2010-05-24 16:42:32 +00:00
|
|
|
|
#ifdef AUDIOHW_HAVE_EQ
|
|
|
|
|
int (*sound_enum_hw_eq_band_setting)(unsigned int band,
|
|
|
|
|
unsigned int band_setting);
|
|
|
|
|
#endif /* AUDIOHW_HAVE_EQ */
|
2020-07-17 04:01:32 +00:00
|
|
|
|
#if defined (HAVE_PITCHCONTROL)
|
2019-07-20 09:46:14 +00:00
|
|
|
|
void (*sound_set_pitch)(int32_t pitch);
|
|
|
|
|
#endif
|
2007-04-10 14:18:30 +00:00
|
|
|
|
const unsigned long *audio_master_sampr_list;
|
|
|
|
|
const unsigned long *hw_freq_sampr;
|
|
|
|
|
void (*pcm_apply_settings)(void);
|
2010-05-24 16:42:32 +00:00
|
|
|
|
void (*pcm_play_data)(pcm_play_callback_type get_more,
|
2012-02-23 13:14:46 +00:00
|
|
|
|
pcm_status_callback_type status_cb,
|
|
|
|
|
const void *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);
|
2008-03-24 00:35:53 +00:00
|
|
|
|
void (*pcm_play_lock)(void);
|
|
|
|
|
void (*pcm_play_unlock)(void);
|
2011-06-29 06:37:04 +00:00
|
|
|
|
void (*beep_play)(unsigned int frequency, unsigned int duration,
|
|
|
|
|
unsigned int amplitude);
|
2007-04-10 14:18:30 +00:00
|
|
|
|
#ifdef HAVE_RECORDING
|
|
|
|
|
const unsigned long *rec_freq_sampr;
|
|
|
|
|
void (*pcm_init_recording)(void);
|
|
|
|
|
void (*pcm_close_recording)(void);
|
2010-05-24 16:42:32 +00:00
|
|
|
|
void (*pcm_record_data)(pcm_rec_callback_type more_ready,
|
2012-02-23 13:14:46 +00:00
|
|
|
|
pcm_status_callback_type status_cb,
|
2007-04-10 14:18:30 +00:00
|
|
|
|
void *start, size_t size);
|
|
|
|
|
void (*pcm_stop_recording)(void);
|
|
|
|
|
void (*pcm_calculate_rec_peaks)(int *left, int *right);
|
|
|
|
|
void (*audio_set_recording_gain)(int left, int right, int type);
|
|
|
|
|
#endif /* HAVE_RECORDING */
|
2007-06-08 23:42:04 +00:00
|
|
|
|
#if INPUT_SRC_CAPS != 0
|
|
|
|
|
void (*audio_set_output_source)(int monitor);
|
|
|
|
|
void (*audio_set_input_source)(int source, unsigned flags);
|
2006-03-11 09:38:12 +00:00
|
|
|
|
#endif
|
2012-05-01 07:58:27 +00:00
|
|
|
|
void (*dsp_set_crossfeed_type)(int type);
|
2012-03-27 23:52:15 +00:00
|
|
|
|
void (*dsp_eq_enable)(bool enable);
|
2008-03-24 00:35:53 +00:00
|
|
|
|
void (*dsp_dither_enable)(bool enable);
|
2012-05-08 14:34:26 +00:00
|
|
|
|
#ifdef HAVE_PITCHCONTROL
|
2012-03-27 23:52:15 +00:00
|
|
|
|
void (*dsp_set_timestretch)(int32_t percent);
|
|
|
|
|
#endif
|
|
|
|
|
intptr_t (*dsp_configure)(struct dsp_config *dsp,
|
|
|
|
|
unsigned int setting, intptr_t value);
|
|
|
|
|
struct dsp_config * (*dsp_get_config)(enum dsp_ids id);
|
|
|
|
|
void (*dsp_process)(struct dsp_config *dsp, struct dsp_buffer *src,
|
|
|
|
|
struct dsp_buffer *dst);
|
2011-08-03 09:52:23 +00:00
|
|
|
|
|
|
|
|
|
enum channel_status (*mixer_channel_status)(enum pcm_mixer_channel channel);
|
2012-02-23 13:14:46 +00:00
|
|
|
|
const void * (*mixer_channel_get_buffer)(enum pcm_mixer_channel channel,
|
|
|
|
|
int *count);
|
2011-08-03 09:52:23 +00:00
|
|
|
|
void (*mixer_channel_calculate_peaks)(enum pcm_mixer_channel channel,
|
2012-05-03 00:53:07 +00:00
|
|
|
|
struct pcm_peaks *peaks);
|
2011-08-03 09:52:23 +00:00
|
|
|
|
void (*mixer_channel_play_data)(enum pcm_mixer_channel channel,
|
|
|
|
|
pcm_play_callback_type get_more,
|
2012-02-23 13:14:46 +00:00
|
|
|
|
const void *start, size_t size);
|
2011-08-03 09:52:23 +00:00
|
|
|
|
void (*mixer_channel_play_pause)(enum pcm_mixer_channel channel, bool play);
|
|
|
|
|
void (*mixer_channel_stop)(enum pcm_mixer_channel channel);
|
|
|
|
|
void (*mixer_channel_set_amplitude)(enum pcm_mixer_channel channel,
|
|
|
|
|
unsigned int amplitude);
|
|
|
|
|
size_t (*mixer_channel_get_bytes_waiting)(enum pcm_mixer_channel channel);
|
2012-12-09 20:04:17 +00:00
|
|
|
|
void (*mixer_channel_set_buffer_hook)(enum pcm_mixer_channel channel,
|
|
|
|
|
chan_buffer_hook_fn_type fn);
|
2013-12-14 22:15:45 +00:00
|
|
|
|
void (*mixer_set_frequency)(unsigned int samplerate);
|
|
|
|
|
unsigned int (*mixer_get_frequency)(void);
|
2019-02-04 01:12:50 +00:00
|
|
|
|
void (*pcmbuf_fade)(bool fade, bool in);
|
2011-08-03 09:52:23 +00:00
|
|
|
|
void (*system_sound_play)(enum system_sound sound);
|
2012-03-03 12:52:13 +00:00
|
|
|
|
void (*keyclick_click)(bool rawbutton, int action);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
|
|
|
|
|
/* metadata */
|
|
|
|
|
bool (*get_metadata)(struct mp3entry* id3, int fd, const char* trackname);
|
|
|
|
|
bool (*mp3info)(struct mp3entry *entry, const char *filename);
|
|
|
|
|
int (*count_mp3_frames)(int fd, int startpos, int filesize,
|
|
|
|
|
void (*progressfunc)(int),
|
|
|
|
|
unsigned char* buf, size_t buflen);
|
|
|
|
|
int (*create_xing_header)(int fd, long startpos, long filesize,
|
|
|
|
|
unsigned char *buf, unsigned long num_frames,
|
|
|
|
|
unsigned long rec_time, unsigned long header_template,
|
|
|
|
|
void (*progressfunc)(int), bool generate_toc,
|
|
|
|
|
unsigned char* tempbuf, size_t tempbuf_len);
|
|
|
|
|
#ifdef HAVE_TAGCACHE
|
|
|
|
|
bool (*tagcache_search)(struct tagcache_search *tcs, int tag);
|
|
|
|
|
void (*tagcache_search_set_uniqbuf)(struct tagcache_search *tcs,
|
|
|
|
|
void *buffer, long length);
|
|
|
|
|
bool (*tagcache_search_add_filter)(struct tagcache_search *tcs,
|
|
|
|
|
int tag, int seek);
|
|
|
|
|
bool (*tagcache_get_next)(struct tagcache_search *tcs);
|
|
|
|
|
bool (*tagcache_retrieve)(struct tagcache_search *tcs, int idxid,
|
|
|
|
|
int tag, char *buf, long size);
|
|
|
|
|
void (*tagcache_search_finish)(struct tagcache_search *tcs);
|
|
|
|
|
long (*tagcache_get_numeric)(const struct tagcache_search *tcs, int tag);
|
|
|
|
|
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
|
|
|
|
bool (*tagcache_fill_tags)(struct mp3entry *id3, const char *filename);
|
|
|
|
|
#endif
|
2020-09-20 14:36:25 +00:00
|
|
|
|
struct tagcache_stat* (*tagcache_get_stat)(void);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
#endif /* HAVE_TAGCACHE */
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_ALBUMART
|
|
|
|
|
bool (*search_albumart_files)(const struct mp3entry *id3, const char *size_string,
|
|
|
|
|
char *buf, int buflen);
|
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2004-07-27 14:10:48 +00:00
|
|
|
|
/* playback control */
|
2020-07-23 13:49:34 +00:00
|
|
|
|
struct playlist_info* (*playlist_get_current)(void);
|
2007-04-10 14:18:30 +00:00
|
|
|
|
int (*playlist_amount)(void);
|
|
|
|
|
int (*playlist_resume)(void);
|
2013-07-14 11:59:39 +00:00
|
|
|
|
void (*playlist_resume_track)(int start_index, unsigned int crc,
|
|
|
|
|
unsigned long elapsed, unsigned long offset);
|
|
|
|
|
void (*playlist_start)(int start_index, unsigned long elapsed,
|
|
|
|
|
unsigned long offset);
|
2009-06-01 21:08:49 +00:00
|
|
|
|
int (*playlist_add)(const char *filename);
|
|
|
|
|
void (*playlist_sync)(struct playlist_info* playlist);
|
|
|
|
|
int (*playlist_remove_all_tracks)(struct playlist_info *playlist);
|
|
|
|
|
int (*playlist_create)(const char *dir, const char *file);
|
|
|
|
|
int (*playlist_insert_track)(struct playlist_info* playlist,
|
|
|
|
|
const char *filename, int position, bool queue, bool sync);
|
2009-07-05 18:07:58 +00:00
|
|
|
|
int (*playlist_insert_directory)(struct playlist_info* playlist,
|
|
|
|
|
const char *dirname, int position, bool queue,
|
|
|
|
|
bool recurse);
|
2009-06-01 21:08:49 +00:00
|
|
|
|
int (*playlist_shuffle)(int random_seed, int start_index);
|
2013-07-14 11:59:39 +00:00
|
|
|
|
void (*audio_play)(unsigned long elapsed, unsigned 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);
|
2008-03-28 12:51:33 +00:00
|
|
|
|
void (*audio_ff_rewind)(long newtime);
|
2005-04-04 12:06:29 +00:00
|
|
|
|
struct mp3entry* (*audio_next_track)(void);
|
|
|
|
|
int (*audio_status)(void);
|
|
|
|
|
struct mp3entry* (*audio_current_track)(void);
|
|
|
|
|
void (*audio_flush_and_reload_tracks)(void);
|
|
|
|
|
int (*audio_get_file_pos)(void);
|
2004-07-27 19:16:58 +00:00
|
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
/* menu */
|
2019-02-04 01:12:50 +00:00
|
|
|
|
struct menu_table *(*root_menu_get_options)(int *nb_options);
|
2008-03-26 03:35:24 +00:00
|
|
|
|
int (*do_menu)(const struct menu_item_ex *menu, int *start_selected,
|
2010-01-26 20:14:42 +00:00
|
|
|
|
struct viewport parent[NB_SCREENS], bool hide_theme);
|
2019-02-04 01:12:50 +00:00
|
|
|
|
void (*root_menu_set_default)(void* setting, void* defaultval);
|
|
|
|
|
char* (*root_menu_write_to_cfg)(void* setting, char*buf, int buf_len);
|
|
|
|
|
void (*root_menu_load_from_cfg)(void* setting, char *value);
|
2006-01-15 18:20:18 +00:00
|
|
|
|
|
2007-05-08 11:55:43 +00:00
|
|
|
|
/* options */
|
2008-12-10 08:57:10 +00:00
|
|
|
|
const struct settings_list* (*get_settings_list)(int*count);
|
2008-03-25 15:24:03 +00:00
|
|
|
|
const struct settings_list* (*find_setting)(const void* variable, int *id);
|
2019-02-04 01:12:50 +00:00
|
|
|
|
int (*settings_save)(void);
|
2008-05-15 06:58:36 +00:00
|
|
|
|
bool (*option_screen)(const struct settings_list *setting,
|
2008-04-23 11:07:40 +00:00
|
|
|
|
struct viewport parent[NB_SCREENS],
|
2007-07-23 05:40:45 +00:00
|
|
|
|
bool use_temp_var, unsigned char* option_title);
|
2008-03-25 15:24:03 +00:00
|
|
|
|
bool (*set_option)(const char* string, const void* variable,
|
2008-03-28 12:51:33 +00:00
|
|
|
|
enum optiontype type, const struct opt_items* options,
|
|
|
|
|
int numoptions, void (*function)(int));
|
2008-03-25 15:24:03 +00:00
|
|
|
|
bool (*set_bool_options)(const char* string, const bool* variable,
|
2008-03-28 12:51:33 +00:00
|
|
|
|
const char* yes_str, int yes_voice,
|
|
|
|
|
const char* no_str, int no_voice,
|
2007-06-22 09:34:57 +00:00
|
|
|
|
void (*function)(bool));
|
2008-03-28 12:51:33 +00:00
|
|
|
|
bool (*set_int)(const unsigned char* string, const char* unit, int voice_unit,
|
2008-12-25 04:24:47 +00:00
|
|
|
|
const int* variable, void (*function)(int), int step,
|
|
|
|
|
int min, int max,
|
2009-08-20 16:47:44 +00:00
|
|
|
|
const char* (*formatter)(char*, size_t, int, const char*) );
|
2019-02-04 01:12:50 +00:00
|
|
|
|
bool (*set_int_ex)(const unsigned char* string, const char* unit, int voice_unit,
|
|
|
|
|
const int* variable, void (*function)(int), int step,
|
|
|
|
|
int min, int max,
|
|
|
|
|
const char* (*formatter)(char*, size_t, int, const char*) ,
|
|
|
|
|
int32_t (*get_talk_id)(int, int));
|
2008-03-25 15:24:03 +00:00
|
|
|
|
bool (*set_bool)(const char* string, const bool* variable );
|
2006-03-21 09:36:13 +00:00
|
|
|
|
|
2007-06-22 09:34:57 +00:00
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
2010-02-11 14:18:31 +00:00
|
|
|
|
bool (*set_color)(struct screen *display, char *title,
|
|
|
|
|
unsigned *color, unsigned banned_color);
|
2007-06-22 09:34:57 +00:00
|
|
|
|
#endif
|
2006-03-21 09:36:13 +00:00
|
|
|
|
|
2006-02-07 20:38:55 +00:00
|
|
|
|
/* power */
|
|
|
|
|
int (*battery_level)(void);
|
|
|
|
|
bool (*battery_level_safe)(void);
|
|
|
|
|
int (*battery_time)(void);
|
2012-01-03 23:44:38 +00:00
|
|
|
|
int (*battery_voltage)(void);
|
2007-02-18 05:32:06 +00:00
|
|
|
|
#if CONFIG_CHARGING
|
2006-02-07 20:38:55 +00:00
|
|
|
|
bool (*charger_inserted)(void);
|
2009-03-24 21:59:44 +00:00
|
|
|
|
# if CONFIG_CHARGING >= CHARGING_MONITOR
|
2006-02-07 20:38:55 +00:00
|
|
|
|
bool (*charging_state)(void);
|
2006-03-05 19:34:54 +00:00
|
|
|
|
# endif
|
2006-02-07 20:38:55 +00:00
|
|
|
|
#endif
|
2015-01-02 21:15:31 +00:00
|
|
|
|
/* usb */
|
|
|
|
|
bool (*usb_inserted)(void);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
void (*usb_acknowledge)(long id);
|
|
|
|
|
#ifdef USB_ENABLE_HID
|
|
|
|
|
void (*usb_hid_send)(usage_page_t usage_page, int id);
|
|
|
|
|
#endif
|
2003-06-29 16:33:04 +00:00
|
|
|
|
/* misc */
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2014-04-28 13:15:06 +00:00
|
|
|
|
int * (*__errno)(void);
|
2010-02-14 06:26:16 +00:00
|
|
|
|
#endif
|
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 *));
|
2020-07-21 06:33:53 +00:00
|
|
|
|
int (*kbd_input)(char* buffer, int buflen, unsigned short *kbd);
|
2003-07-24 10:02:45 +00:00
|
|
|
|
struct tm* (*get_time)(void);
|
Rewrite filesystem code (WIP)
This patch redoes the filesystem code from the FAT driver up to the
clipboard code in onplay.c.
Not every aspect of this is finished therefore it is still "WIP". I
don't wish to do too much at once (haha!). What is left to do is get
dircache back in the sim and find an implementation for the dircache
indicies in the tagcache and playlist code or do something else that
has the same benefit. Leaving these out for now does not make anything
unusable. All the basics are done.
Phone app code should probably get vetted (and app path handling
just plain rewritten as environment expansions); the SDL app and
Android run well.
Main things addressed:
1) Thread safety: There is none right now in the trunk code. Most of
what currently works is luck when multiple threads are involved or
multiple descriptors to the same file are open.
2) POSIX compliance: Many of the functions behave nothing like their
counterparts on a host system. This leads to inconsistent code or very
different behavior from native to hosted. One huge offender was
rename(). Going point by point would fill a book.
3) Actual running RAM usage: Many targets will use less RAM and less
stack space (some more RAM because I upped the number of cache buffers
for large memory). There's very little memory lying fallow in rarely-used
areas (see 'Key core changes' below). Also, all targets may open the same
number of directory streams whereas before those with less than 8MB RAM
were limited to 8, not 12 implying those targets will save slightly
less.
4) Performance: The test_disk plugin shows markedly improved performance,
particularly in the area of (uncached) directory scanning, due partly to
more optimal directory reading and to a better sector cache algorithm.
Uncached times tend to be better while there is a bit of a slowdown in
dircache due to it being a bit heavier of an implementation. It's not
noticeable by a human as far as I can say.
Key core changes:
1) Files and directories share core code and data structures.
2) The filesystem code knows which descriptors refer to same file.
This ensures that changes from one stream are appropriately reflected
in every open descriptor for that file (fileobj_mgr.c).
3) File and directory cache buffers are borrowed from the main sector
cache. This means that when they are not in use by a file, they are not
wasted, but used for the cache. Most of the time, only a few of them
are needed. It also means that adding more file and directory handles
is less expensive. All one must do in ensure a large enough cache to
borrow from.
4) Relative path components are supported and the namespace is unified.
It does not support full relative paths to an implied current directory;
what is does support is use of "." and "..". Adding the former would
not be very difficult. The namespace is unified in the sense that
volumes may be specified several times along with relative parts, e.g.:
"/<0>/foo/../../<1>/bar" :<=> "/<1>/bar".
5) Stack usage is down due to sharing of data, static allocation and
less duplication of strings on the stack. This requires more
serialization than I would like but since the number of threads is
limited to a low number, the tradoff in favor of the stack seems
reasonable.
6) Separates and heirarchicalizes (sic) the SIM and APP filesystem
code. SIM path and volume handling is just like the target. Some
aspects of the APP file code get more straightforward (e.g. no path
hashing is needed).
Dircache:
Deserves its own section. Dircache is new but pays homage to the old.
The old one was not compatible and so it, since it got redone, does
all the stuff it always should have done such as:
1) It may be update and used at any time during the build process.
No longer has one to wait for it to finish building to do basic file
management (create, remove, rename, etc.).
2) It does not need to be either fully scanned or completely disabled;
it can be incomplete (i.e. overfilled, missing paths), still be
of benefit and be correct.
3) Handles mounting and dismounting of individual volumes which means
a full rebuild is not needed just because you pop a new SD card in the
slot. Now, because it reuses its freed entry data, may rebuild only
that volume.
4) Much more fundamental to the file code. When it is built, it is
the keeper of the master file list whether enabled or not ("disabled"
is just a state of the cache). Its must always to ready to be started
and bind all streams opened prior to being enabled.
5) Maintains any short filenames in OEM format which means that it does
not need to be rebuilt when changing the default codepage.
Miscellaneous Compatibility:
1) Update any other code that would otherwise not work such as the
hotswap mounting code in various card drivers.
2) File management: Clipboard needed updating because of the behavioral
changes. Still needs a little more work on some finer points.
3) Remove now-obsolete functionality such as the mutex's "no preempt"
flag (which was only for the prior FAT driver).
4) struct dirinfo uses time_t rather than raw FAT directory entry
time fields. I plan to follow up on genericizing everything there
(i.e. no FAT attributes).
5) unicode.c needed some redoing so that the file code does not try
try to load codepages during a scan, which is actually a problem with
the current code. The default codepage, if any is required, is now
kept in RAM separarately (bufalloced) from codepages specified to
iso_decode() (which must not be bufalloced because the conversion
may be done by playback threads).
Brings with it some additional reusable core code:
1) Revised file functions: Reusable code that does things such as
safe path concatenation and parsing without buffer limitations or
data duplication. Variants that copy or alter the input path may be
based off these.
To do:
1) Put dircache functionality back in the sim. Treating it internally
as a different kind of file system seems the best approach at this
time.
2) Restore use of dircache indexes in the playlist and database or
something effectively the same. Since the cache doesn't have to be
complete in order to be used, not getting a hit on the cache doesn't
unambiguously say if the path exists or not.
Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8
Reviewed-on: http://gerrit.rockbox.org/566
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested: Michael Sevakis <jethead71@rockbox.org>
2013-08-06 02:02:45 +00:00
|
|
|
|
struct tm * (*gmtime_r)(const time_t *timep, struct tm *tm);
|
2007-07-30 05:19:05 +00:00
|
|
|
|
#if CONFIG_RTC
|
|
|
|
|
time_t (*mktime)(struct tm *t);
|
|
|
|
|
#endif
|
2019-07-20 09:46:14 +00:00
|
|
|
|
|
2004-06-10 13:29:52 +00:00
|
|
|
|
#if defined(DEBUG) || defined(SIMULATOR)
|
2007-03-17 09:02:53 +00:00
|
|
|
|
void (*debugf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
|
2005-07-26 20:01:11 +00:00
|
|
|
|
#endif
|
|
|
|
|
#ifdef ROCKBOX_HAS_LOGF
|
2007-03-17 09:02:53 +00:00
|
|
|
|
void (*logf)(const char *fmt, ...) ATTRIBUTE_PRINTF(1, 2);
|
2004-06-10 13:48:53 +00:00
|
|
|
|
#endif
|
2009-01-05 10:31:19 +00:00
|
|
|
|
void (*codec_thread_do_callback)(void (*fn)(void),
|
|
|
|
|
unsigned int *audio_thread_id);
|
2011-04-27 03:08:23 +00:00
|
|
|
|
int (*codec_load_file)(const char* codec, struct codec_api *api);
|
|
|
|
|
int (*codec_run_proc)(void);
|
|
|
|
|
int (*codec_close)(void);
|
2007-10-16 01:25:17 +00:00
|
|
|
|
const char *(*get_codec_filename)(int cod_spec);
|
2010-05-24 16:42:32 +00:00
|
|
|
|
void ** (*find_array_ptr)(void **arr, void *ptr);
|
|
|
|
|
int (*remove_array_ptr)(void **arr, void *ptr);
|
2010-07-01 00:26:01 +00:00
|
|
|
|
int (*round_value_to_list32)(unsigned long value,
|
|
|
|
|
const unsigned long list[],
|
|
|
|
|
int count,
|
|
|
|
|
bool signd);
|
2006-02-07 20:38:55 +00:00
|
|
|
|
|
2007-11-10 13:26:11 +00:00
|
|
|
|
int (*read_bmp_file)(const char* filename, struct bitmap *bm, int maxsize,
|
2008-12-26 07:05:13 +00:00
|
|
|
|
int format, const struct custom_format *cformat);
|
2009-05-06 04:53:56 +00:00
|
|
|
|
int (*read_bmp_fd)(int fd, struct bitmap *bm, int maxsize,
|
|
|
|
|
int format, const struct custom_format *cformat);
|
|
|
|
|
#ifdef HAVE_JPEG
|
|
|
|
|
int (*read_jpeg_file)(const char* filename, struct bitmap *bm, int maxsize,
|
|
|
|
|
int format, const struct custom_format *cformat);
|
|
|
|
|
int (*read_jpeg_fd)(int fd, struct bitmap *bm, int maxsize,
|
|
|
|
|
int format, const struct custom_format *cformat);
|
|
|
|
|
#endif
|
2006-01-15 18:20:18 +00:00
|
|
|
|
void (*screen_dump_set_hook)(void (*hook)(int fh));
|
2005-09-02 05:39:09 +00:00
|
|
|
|
int (*show_logo)(void);
|
2006-03-05 19:34:54 +00:00
|
|
|
|
|
2006-09-26 19:25:52 +00:00
|
|
|
|
#ifdef HAVE_WHEEL_POSITION
|
|
|
|
|
int (*wheel_status)(void);
|
|
|
|
|
void (*wheel_send_events)(bool send);
|
|
|
|
|
#endif
|
2006-10-31 11:17:00 +00:00
|
|
|
|
|
2020-10-25 23:34:45 +00:00
|
|
|
|
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
|
2007-01-12 18:34:00 +00:00
|
|
|
|
/* Routines for the iriver_flash -plugin. */
|
|
|
|
|
bool (*detect_original_firmware)(void);
|
|
|
|
|
bool (*detect_flashed_ramimage)(void);
|
|
|
|
|
bool (*detect_flashed_romimage)(void);
|
2007-03-22 09:40:26 +00:00
|
|
|
|
#endif
|
2007-05-07 17:23:31 +00:00
|
|
|
|
|
2007-07-29 03:43:37 +00:00
|
|
|
|
void (*led)(bool on);
|
2007-09-25 02:59:42 +00:00
|
|
|
|
|
2019-07-20 09:46:14 +00:00
|
|
|
|
/*plugin*/
|
2020-09-20 14:36:25 +00:00
|
|
|
|
int (*plugin_open)(char *path, char *parameter);
|
2019-07-20 09:46:14 +00:00
|
|
|
|
void* (*plugin_get_buffer)(size_t *buffer_size);
|
|
|
|
|
void* (*plugin_get_audio_buffer)(size_t *buffer_size);
|
|
|
|
|
void (*plugin_release_audio_buffer)(void);
|
|
|
|
|
void (*plugin_tsr)(bool (*exit_callback)(bool reenter));
|
|
|
|
|
char* (*plugin_get_current_filename)(void);
|
|
|
|
|
#ifdef PLUGIN_USE_IRAM
|
|
|
|
|
void (*audio_hard_stop)(void);
|
2007-12-09 18:48:02 +00:00
|
|
|
|
#endif
|
2021-06-21 03:37:17 +00:00
|
|
|
|
uint32_t (*crc_32r)(const void *src, uint32_t len, uint32_t crc32);
|
2007-12-29 19:46:35 +00:00
|
|
|
|
|
2008-03-24 00:35:53 +00:00
|
|
|
|
/* new stuff at the end, sort into place next time
|
|
|
|
|
the API gets incompatible */
|
2020-07-28 14:58:34 +00:00
|
|
|
|
|
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 {
|
2010-09-09 16:17:21 +00:00
|
|
|
|
struct lc_header lc_hdr; /* must be the first */
|
2009-01-16 10:34:40 +00:00
|
|
|
|
enum plugin_status(*entry_point)(const void*);
|
|
|
|
|
const struct plugin_api **api;
|
2003-06-29 16:33:04 +00:00
|
|
|
|
};
|
2006-11-18 02:18:29 +00:00
|
|
|
|
|
2006-01-15 18:20:18 +00:00
|
|
|
|
#ifdef PLUGIN
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
|
2006-01-15 18:20:18 +00:00
|
|
|
|
extern unsigned char plugin_start_addr[];
|
|
|
|
|
extern unsigned char plugin_end_addr[];
|
|
|
|
|
#define PLUGIN_HEADER \
|
2012-10-24 12:05:39 +00:00
|
|
|
|
const struct plugin_api *rb DATA_ATTR; \
|
2006-01-15 18:20:18 +00:00
|
|
|
|
const struct plugin_header __header \
|
2012-10-24 12:05:39 +00:00
|
|
|
|
__attribute__ ((section (".header")))= { \
|
2010-09-09 16:17:21 +00:00
|
|
|
|
{ PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, \
|
|
|
|
|
plugin_start_addr, plugin_end_addr }, plugin__start, &rb };
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#else /* PLATFORM_HOSTED */
|
2006-01-16 23:20:58 +00:00
|
|
|
|
#define PLUGIN_HEADER \
|
2009-02-27 07:30:41 +00:00
|
|
|
|
const struct plugin_api *rb DATA_ATTR; \
|
2007-10-02 09:08:08 +00:00
|
|
|
|
const struct plugin_header __header \
|
|
|
|
|
__attribute__((visibility("default"))) = { \
|
2010-09-09 16:29:21 +00:00
|
|
|
|
{ PLUGIN_MAGIC, TARGET_ID, PLUGIN_API_VERSION, NULL, NULL }, \
|
2010-09-09 16:17:21 +00:00
|
|
|
|
plugin__start, &rb };
|
2010-06-21 16:53:00 +00:00
|
|
|
|
#endif /* CONFIG_PLATFORM */
|
2006-11-18 02:18:29 +00:00
|
|
|
|
#endif /* PLUGIN */
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2019-02-04 01:12:50 +00:00
|
|
|
|
/*
|
|
|
|
|
* The str() macro/functions is how to access strings that might be
|
|
|
|
|
* translated. Use it like str(MACRO) and expect a string to be
|
|
|
|
|
* returned!
|
|
|
|
|
*/
|
|
|
|
|
#define str(x) language_strings[x]
|
|
|
|
|
|
2008-05-13 09:57:56 +00:00
|
|
|
|
int plugin_load(const char* plugin, const void* parameter);
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
|
|
|
|
/* defined by the plugin */
|
2009-01-16 10:34:40 +00:00
|
|
|
|
extern const struct plugin_api *rb;
|
2011-09-18 16:16:50 +00:00
|
|
|
|
enum plugin_status plugin_start(const void* parameter);
|
2010-08-24 14:30:46 +00:00
|
|
|
|
enum plugin_status plugin__start(const void* parameter)
|
2006-03-16 17:06:20 +00:00
|
|
|
|
NO_PROF_ATTR;
|
2003-06-29 16:33:04 +00:00
|
|
|
|
|
2008-05-19 14:37:16 +00:00
|
|
|
|
#endif /* __PCTOOL__ */
|
2003-06-29 16:33:04 +00:00
|
|
|
|
#endif
|