summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-03-11 06:21:43 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-03-11 06:21:43 +0000
commitc2d2106fd76ae553a9f7b2418265209468cbb9e6 (patch)
treec6cb223091ed8dfeb943ede41a5d3e59efeeeade
parentc5cd27f5d1d601e109d6884fe689ec876fc28561 (diff)
downloadrockbox-c2d2106fd76ae553a9f7b2418265209468cbb9e6.tar.gz
rockbox-c2d2106fd76ae553a9f7b2418265209468cbb9e6.zip
Audio Init: Just can't stand that heirarchy. Add one level of abstraction. Might come in handy anyhow. Use sound.h instead of the conditional includes for audio hardware headers. If someone doesn't like that, yell at my evil twin. :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12718 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c2
-rw-r--r--firmware/export/pcm_playback.h1
-rw-r--r--firmware/pcm_playback.c15
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c7
-rw-r--r--firmware/target/arm/pcm-pp.c17
-rw-r--r--firmware/target/coldfire/pcm-coldfire.c11
-rw-r--r--uisimulator/common/stubs.c6
-rw-r--r--uisimulator/sdl/sound.c4
8 files changed, 31 insertions, 32 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 739d3fa850..0f69398600 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -3444,7 +3444,7 @@ static void audio_thread(void)
3444{ 3444{
3445 struct event ev; 3445 struct event ev;
3446 3446
3447 audiohw_postinit(); 3447 pcm_postinit();
3448 3448
3449#ifdef PLAYBACK_VOICE 3449#ifdef PLAYBACK_VOICE
3450 /* Unlock mutex that init stage locks before creating this thread */ 3450 /* Unlock mutex that init stage locks before creating this thread */
diff --git a/firmware/export/pcm_playback.h b/firmware/export/pcm_playback.h
index 28409c01d9..351b1fa23f 100644
--- a/firmware/export/pcm_playback.h
+++ b/firmware/export/pcm_playback.h
@@ -27,6 +27,7 @@ typedef void (*pcm_more_callback_type)(unsigned char **start,
27typedef int (*pcm_more_callback_type2)(int status); 27typedef int (*pcm_more_callback_type2)(int status);
28 28
29void pcm_init(void); 29void pcm_init(void);
30void pcm_postinit(void);
30 31
31/* set the pcm frequency - use values in hw_sampr_list 32/* set the pcm frequency - use values in hw_sampr_list
32 * use -1 for the default frequency 33 * use -1 for the default frequency
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index eb5404c1a8..66a6fdc957 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -20,15 +20,9 @@
20#include "kernel.h" 20#include "kernel.h"
21#include "logf.h" 21#include "logf.h"
22#include "audio.h" 22#include "audio.h"
23#if defined(HAVE_WM8975) 23#include "sound.h"
24#include "wm8975.h" 24#if CONFIG_CPU == PNX0101
25#elif defined(HAVE_WM8758)
26#include "wm8758.h"
27#elif defined(HAVE_WM8731) || defined(HAVE_WM8721)
28#include "wm8731l.h"
29#elif CONFIG_CPU == PNX0101
30#include "string.h" 25#include "string.h"
31#include "pnx0101.h"
32#endif 26#endif
33 27
34/** 28/**
@@ -224,6 +218,11 @@ void pcm_init(void)
224 DMAR10(1) |= 1; 218 DMAR10(1) |= 1;
225} 219}
226 220
221void pcm_postinit(void)
222{
223 audiohw_postinit();
224}
225
227void pcm_set_frequency(unsigned int frequency) 226void pcm_set_frequency(unsigned int frequency)
228{ 227{
229 (void)frequency; 228 (void)frequency;
diff --git a/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c
index 7e1cebc555..0f22aa5c5c 100644
--- a/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c
+++ b/firmware/target/arm/gigabeat/meg-fx/pcm-meg-fx.c
@@ -20,7 +20,7 @@
20#include "kernel.h" 20#include "kernel.h"
21#include "logf.h" 21#include "logf.h"
22#include "audio.h" 22#include "audio.h"
23#include "wm8975.h" 23#include "sound.h"
24#include "file.h" 24#include "file.h"
25#include "mmu-meg-fx.h" 25#include "mmu-meg-fx.h"
26 26
@@ -120,7 +120,10 @@ void pcm_init(void)
120 120
121} 121}
122 122
123 123void pcm_postinit(void)
124{
125 audiohw_postinit();
126}
124 127
125void pcm_play_dma_start(const void *addr, size_t size) 128void pcm_play_dma_start(const void *addr, size_t size)
126{ 129{
diff --git a/firmware/target/arm/pcm-pp.c b/firmware/target/arm/pcm-pp.c
index 0cb029eccb..efe6c9b4e6 100644
--- a/firmware/target/arm/pcm-pp.c
+++ b/firmware/target/arm/pcm-pp.c
@@ -21,15 +21,7 @@
21#include "kernel.h" 21#include "kernel.h"
22#include "logf.h" 22#include "logf.h"
23#include "audio.h" 23#include "audio.h"
24#if defined(HAVE_WM8975) 24#include "sound.h"
25#include "wm8975.h"
26#elif defined(HAVE_WM8758)
27#include "wm8758.h"
28#elif defined(HAVE_WM8731) || defined(HAVE_WM8721)
29#include "wm8731l.h"
30#endif
31
32
33 25
34/* peaks */ 26/* peaks */
35#ifdef HAVE_RECORDING 27#ifdef HAVE_RECORDING
@@ -334,7 +326,7 @@ size_t pcm_get_bytes_waiting(void)
334void pcm_init(void) 326void pcm_init(void)
335{ 327{
336} 328}
337void audiohw_postinit(void) 329void pcm_postinit(void)
338{ 330{
339} 331}
340#else 332#else
@@ -356,6 +348,11 @@ void pcm_init(void)
356 /* Call pcm_play_dma_stop to initialize everything. */ 348 /* Call pcm_play_dma_stop to initialize everything. */
357 pcm_play_dma_stop(); 349 pcm_play_dma_stop();
358} 350}
351
352void pcm_postinit(void)
353{
354 audiohw_postinit();
355}
359#endif /* HAVE_PP5024_CODEC */ 356#endif /* HAVE_PP5024_CODEC */
360 357
361 358
diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c
index 720c77e434..0662e289a0 100644
--- a/firmware/target/coldfire/pcm-coldfire.c
+++ b/firmware/target/coldfire/pcm-coldfire.c
@@ -21,11 +21,7 @@
21#include "kernel.h" 21#include "kernel.h"
22#include "logf.h" 22#include "logf.h"
23#include "audio.h" 23#include "audio.h"
24#if defined(HAVE_UDA1380) 24#include "sound.h"
25#include "uda1380.h"
26#elif defined(HAVE_TLV320)
27#include "tlv320.h"
28#endif
29#if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT) 25#if defined(HAVE_SPDIF_IN) || defined(HAVE_SPDIF_OUT)
30#include "spdif.h" 26#include "spdif.h"
31#endif 27#endif
@@ -273,6 +269,11 @@ void pcm_init(void)
273 and_l(~(1 << 14), &IMR); /* bit 14 is DMA0 */ 269 and_l(~(1 << 14), &IMR); /* bit 14 is DMA0 */
274} /* pcm_init */ 270} /* pcm_init */
275 271
272void pcm_postinit(void)
273{
274 audiohw_postinit();
275}
276
276size_t pcm_get_bytes_waiting(void) 277size_t pcm_get_bytes_waiting(void)
277{ 278{
278 return BCR0 & 0xffffff; 279 return BCR0 & 0xffffff;
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c
index 3680183e22..8ea46824ce 100644
--- a/uisimulator/common/stubs.c
+++ b/uisimulator/common/stubs.c
@@ -262,9 +262,3 @@ void remove_thread(int threadnum)
262#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */ 262#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
263unsigned char vp_dummy[VIRT_SIZE]; 263unsigned char vp_dummy[VIRT_SIZE];
264 264
265
266void audiohw_postinit(void)
267{
268}
269
270
diff --git a/uisimulator/sdl/sound.c b/uisimulator/sdl/sound.c
index d7e3cbd89d..96cb9874f5 100644
--- a/uisimulator/sdl/sound.c
+++ b/uisimulator/sdl/sound.c
@@ -316,5 +316,9 @@ int pcm_init(void)
316 return 0; 316 return 0;
317} 317}
318 318
319void pcm_postinit(void)
320{
321}
322
319#endif /* ROCKBOX_HAS_SIMSOUND */ 323#endif /* ROCKBOX_HAS_SIMSOUND */
320 324