From 27cf67733936abd75fcb1f8da765977cd75906ee Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Tue, 25 Mar 2008 02:34:12 +0000 Subject: Add a complete priority inheritance implementation to the scheduler (all mutex ownership and queue_send calls are inheritable). Priorities are differential so that dispatch depends on the runnable range of priorities. Codec priority can therefore be raised in small steps (pcmbuf updated to enable). Simplify the kernel functions to ease implementation and use the same kernel.c for both sim and target (I'm tired of maintaining two ;_). 1) Not sure if a minor audio break at first buffering issue will exist on large-sector disks (the main mutex speed issue was genuinely resolved earlier). At this point it's best dealt with at the buffering level. It seems a larger filechunk could be used again. 2) Perhaps 64-bit sims will have some minor issues (finicky) but a backroll of the code of concern there is a 5-minute job. All kernel objects become incompatible so a full rebuild and update is needed. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16791 a1c6a512-1295-4272-9138-f99709370657 --- apps/codecs.h | 52 +++++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 25 deletions(-) (limited to 'apps/codecs.h') diff --git a/apps/codecs.h b/apps/codecs.h index ad6b831..fb5675f 100644 --- a/apps/codecs.h +++ b/apps/codecs.h @@ -80,12 +80,12 @@ #define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ /* increase this every time the api struct changes */ -#define CODEC_API_VERSION 22 +#define CODEC_API_VERSION 23 /* update this to latest version if a change to the api struct breaks backwards compatibility (and please take the opportunity to sort in any new function which are "waiting" at the end of the function table) */ -#define CODEC_MIN_API_VERSION 22 +#define CODEC_MIN_API_VERSION 23 /* codec return codes */ enum codec_status { @@ -118,6 +118,9 @@ struct codec_api { /* If seek_time != 0, codec should seek to that song position (in ms) if codec supports seeking. */ long seek_time; + + /* The dsp instance to be used for audio output */ + struct dsp_config *dsp; /* Returns buffer to malloc array. Only codeclib should need this. */ void* (*get_codec_memory)(size_t *size); @@ -160,6 +163,28 @@ struct codec_api { void (*PREFIX(sleep))(int ticks); void (*yield)(void); +#if NUM_CORES > 1 + struct thread_entry * + (*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)); + + void (*thread_thaw)(struct thread_entry *thread); + void (*thread_wait)(struct thread_entry *thread); + void (*semaphore_init)(struct semaphore *s, int max, int start); + void (*semaphore_wait)(struct semaphore *s); + void (*semaphore_release)(struct semaphore *s); + void (*event_init)(struct event *e, unsigned int flags); + void (*event_wait)(struct event *e, unsigned int for_state); + void (*event_set_state)(struct event *e, unsigned int state); +#endif /* NUM_CORES */ + +#ifdef CACHE_FUNCTIONS_AS_CALL + void (*flush_icache)(void); + void (*invalidate_icache)(void); +#endif + /* strings and memory */ char* (*strcpy)(char *dst, const char *src); char* (*strncpy)(char *dst, const char *src, size_t length); @@ -218,29 +243,6 @@ struct codec_api { /* new stuff at the end, sort into place next time the API gets incompatible */ -#ifdef CACHE_FUNCTIONS_AS_CALL - void (*flush_icache)(void); - void (*invalidate_icache)(void); -#endif - - struct dsp_config *dsp; - -#if NUM_CORES > 1 - struct thread_entry * - (*create_thread)(void (*function)(void), void* stack, - int stack_size, unsigned flags, const char *name - IF_PRIO(, int priority) - IF_COP(, unsigned int core)); - - void (*thread_thaw)(struct thread_entry *thread); - void (*thread_wait)(struct thread_entry *thread); - void (*semaphore_init)(struct semaphore *s, int max, int start); - void (*semaphore_wait)(struct semaphore *s); - void (*semaphore_release)(struct semaphore *s); - void (*event_init)(struct event *e, unsigned int flags); - void (*event_wait)(struct event *e, unsigned int for_state); - void (*event_set_state)(struct event *e, unsigned int state); -#endif /* NUM_CORES */ }; /* codec header */ -- cgit v1.1