summaryrefslogtreecommitdiff
path: root/apps/main.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-08-14 15:13:00 +0000
committerThomas Martitz <kugel@rockbox.org>2011-08-14 15:13:00 +0000
commitd1322b71595336740eb5e18e5deed056ddb71c7a (patch)
tree812db6a9c2e9d78405ec0ed38465fd88dc5be748 /apps/main.c
parent9b9bd73dfb212d4192fccc5fc5e269fc6499139c (diff)
downloadrockbox-d1322b71595336740eb5e18e5deed056ddb71c7a.tar.gz
rockbox-d1322b71595336740eb5e18e5deed056ddb71c7a.zip
GSoC/Buflib: Replace all direct accesses to audiobuf with buffer API functions.
Namely, introduce buffer_get_buffer() and buffer_release_buffer(). buffer_get_buffer() aquires all available and grabs a lock, attempting to call buffer_alloc() or buffer_get_buffer() while this lock is locked will cause a panicf() (doesn't actually happen, but is for debugging purpose). buffer_release_buffer() unlocks that lock and can additionally increment the audiobuf buffer to make an allocation. Pass 0 to only unlock if buffer was used temporarily only. buffer_available() is a replacement function to query audiobuflen, i.e. what's left in the buffer. Buffer init is moved up in the init chain and handles ipodvideo64mb internally. Further changes happened to mp3data.c and talk.c as to not call the above API functions, but get the buffer from callers. The caller is the audio system which has the buffer lock while mp3data.c and talk mess with the buffer. mpeg.c now implements some buffer related functions of playback.h, especially audio_get_buffer(), allowing to reduce #ifdef hell a tiny bit. audiobuf and audiobufend are local to buffer.c now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30308 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/main.c')
-rw-r--r--apps/main.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/apps/main.c b/apps/main.c
index 0b566b5c01..9cb724562c 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -337,11 +337,11 @@ static void init_tagcache(void)
337static void init(void) 337static void init(void)
338{ 338{
339 system_init(); 339 system_init();
340 buffer_init();
340 kernel_init(); 341 kernel_init();
341#ifdef APPLICATION 342#ifdef APPLICATION
342 paths_init(); 343 paths_init();
343#endif 344#endif
344 buffer_init();
345 enable_irq(); 345 enable_irq();
346 lcd_init(); 346 lcd_init();
347#ifdef HAVE_REMOTE_LCD 347#ifdef HAVE_REMOTE_LCD
@@ -428,13 +428,7 @@ static void init(void)
428#endif 428#endif
429 429
430 system_init(); 430 system_init();
431#if defined(IPOD_VIDEO) 431 buffer_init();
432 audiobufend=(unsigned char *)audiobufend_lds;
433 if(MEMORYSIZE==64 && probed_ramsize!=64)
434 {
435 audiobufend -= (32<<20);
436 }
437#endif
438 kernel_init(); 432 kernel_init();
439 433
440#ifdef HAVE_ADJUSTABLE_CPU_FREQ 434#ifdef HAVE_ADJUSTABLE_CPU_FREQ
@@ -445,7 +439,6 @@ static void init(void)
445 cpu_boost(true); 439 cpu_boost(true);
446#endif 440#endif
447 441
448 buffer_init();
449 442
450 settings_reset(); 443 settings_reset();
451 444