diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2012-03-04 08:52:50 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2012-03-04 08:52:50 -0500 |
commit | cd8e11b463bf57f832bf44d350238057db3e2d6d (patch) | |
tree | 91b7511ec5a6fa47c99d84518608cd3b90f4d680 | |
parent | f6e17e86fed65cb503199691d69973e83c45ddbf (diff) | |
download | rockbox-cd8e11b463bf57f832bf44d350238057db3e2d6d.tar.gz rockbox-cd8e11b463bf57f832bf44d350238057db3e2d6d.zip |
Tweak some PCM drivers for less typecasting with the data pointer.
Yeah, sizeof (void) here with GCC is 1. If something has a problem
with that, we'll set it straight.
Change-Id: I9ad3eee75dd440f6404a04a501d1533c8bc18ba9
-rw-r--r-- | firmware/target/arm/s5l8700/pcm-s5l8700.c | 10 | ||||
-rw-r--r-- | firmware/target/arm/s5l8702/pcm-s5l8702.c | 7 | ||||
-rw-r--r-- | firmware/target/hosted/android/pcm-android.c | 8 | ||||
-rw-r--r-- | firmware/target/hosted/maemo/pcm-gstreamer.c | 9 | ||||
-rw-r--r-- | firmware/target/hosted/pcm-alsa.c | 6 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/pcm-sdl.c | 6 |
6 files changed, 22 insertions, 24 deletions
diff --git a/firmware/target/arm/s5l8700/pcm-s5l8700.c b/firmware/target/arm/s5l8700/pcm-s5l8700.c index c5a5bcf74f..d8387c2aa5 100644 --- a/firmware/target/arm/s5l8700/pcm-s5l8700.c +++ b/firmware/target/arm/s5l8700/pcm-s5l8700.c | |||
@@ -43,9 +43,9 @@ | |||
43 | static volatile int locked = 0; | 43 | static volatile int locked = 0; |
44 | static const int zerosample = 0; | 44 | static const int zerosample = 0; |
45 | static unsigned char dblbuf[1024] IBSS_ATTR; | 45 | static unsigned char dblbuf[1024] IBSS_ATTR; |
46 | static const unsigned char* queuedbuf; | 46 | static const void* queuedbuf; |
47 | static size_t queuedsize; | 47 | static size_t queuedsize; |
48 | static const unsigned char* nextbuf; | 48 | static const void* nextbuf; |
49 | static size_t nextsize; | 49 | static size_t nextsize; |
50 | 50 | ||
51 | static const struct div_entry { | 51 | static const struct div_entry { |
@@ -116,8 +116,8 @@ void INT_DMA(void) | |||
116 | { | 116 | { |
117 | if (!nextsize) | 117 | if (!nextsize) |
118 | { | 118 | { |
119 | new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, | 119 | new_buffer = pcm_play_dma_complete_callback( |
120 | (const void**)&nextbuf, &nextsize); | 120 | PCM_DMAST_OK, &nextbuf, &nextsize); |
121 | if (!new_buffer) | 121 | if (!new_buffer) |
122 | break; | 122 | break; |
123 | } | 123 | } |
@@ -144,7 +144,7 @@ void INT_DMA(void) | |||
144 | void pcm_play_dma_start(const void* addr, size_t size) | 144 | void pcm_play_dma_start(const void* addr, size_t size) |
145 | { | 145 | { |
146 | /* DMA channel on */ | 146 | /* DMA channel on */ |
147 | nextbuf = (const unsigned char*)addr; | 147 | nextbuf = addr; |
148 | nextsize = size; | 148 | nextsize = size; |
149 | queuedsize = 0; | 149 | queuedsize = 0; |
150 | DMABASE0 = (unsigned int)(&zerosample); | 150 | DMABASE0 = (unsigned int)(&zerosample); |
diff --git a/firmware/target/arm/s5l8702/pcm-s5l8702.c b/firmware/target/arm/s5l8702/pcm-s5l8702.c index ef404ddd9c..1974c47d51 100644 --- a/firmware/target/arm/s5l8702/pcm-s5l8702.c +++ b/firmware/target/arm/s5l8702/pcm-s5l8702.c | |||
@@ -38,7 +38,7 @@ static unsigned char dblbuf[2][PCM_WATERMARK * 4]; | |||
38 | static int active_dblbuf; | 38 | static int active_dblbuf; |
39 | struct dma_lli pcm_lli[PCM_LLICOUNT] __attribute__((aligned(16))); | 39 | struct dma_lli pcm_lli[PCM_LLICOUNT] __attribute__((aligned(16))); |
40 | static struct dma_lli* lastlli; | 40 | static struct dma_lli* lastlli; |
41 | static const unsigned char* dataptr; | 41 | static const void* dataptr; |
42 | size_t pcm_remaining; | 42 | size_t pcm_remaining; |
43 | size_t pcm_chunksize; | 43 | size_t pcm_chunksize; |
44 | 44 | ||
@@ -65,8 +65,7 @@ void INT_DMAC0C0(void) | |||
65 | DMAC0INTTCCLR = 1; | 65 | DMAC0INTTCCLR = 1; |
66 | if (!pcm_remaining) | 66 | if (!pcm_remaining) |
67 | { | 67 | { |
68 | pcm_play_dma_complete_callback(PCM_DMAST_OK, (const void**)&dataptr, | 68 | pcm_play_dma_complete_callback(PCM_DMAST_OK, &dataptr, &pcm_remaining); |
69 | &pcm_remaining); | ||
70 | pcm_chunksize = pcm_remaining; | 69 | pcm_chunksize = pcm_remaining; |
71 | } | 70 | } |
72 | if (!pcm_remaining) | 71 | if (!pcm_remaining) |
@@ -121,7 +120,7 @@ void INT_DMAC0C0(void) | |||
121 | 120 | ||
122 | void pcm_play_dma_start(const void* addr, size_t size) | 121 | void pcm_play_dma_start(const void* addr, size_t size) |
123 | { | 122 | { |
124 | dataptr = (const unsigned char*)addr; | 123 | dataptr = addr; |
125 | pcm_remaining = size; | 124 | pcm_remaining = size; |
126 | I2STXCOM = 0xe; | 125 | I2STXCOM = 0xe; |
127 | INT_DMAC0C0(); | 126 | INT_DMAC0C0(); |
diff --git a/firmware/target/hosted/android/pcm-android.c b/firmware/target/hosted/android/pcm-android.c index 7a0f28634e..0428e5f541 100644 --- a/firmware/target/hosted/android/pcm-android.c +++ b/firmware/target/hosted/android/pcm-android.c | |||
@@ -31,8 +31,8 @@ | |||
31 | extern JNIEnv *env_ptr; | 31 | extern JNIEnv *env_ptr; |
32 | 32 | ||
33 | /* infos about our pcm chunks */ | 33 | /* infos about our pcm chunks */ |
34 | static const void *pcm_data_start; | ||
34 | static size_t pcm_data_size; | 35 | static size_t pcm_data_size; |
35 | static char *pcm_data_start; | ||
36 | static int audio_locked = 0; | 36 | static int audio_locked = 0; |
37 | static pthread_mutex_t audio_lock_mutex = PTHREAD_MUTEX_INITIALIZER; | 37 | static pthread_mutex_t audio_lock_mutex = PTHREAD_MUTEX_INITIALIZER; |
38 | 38 | ||
@@ -81,7 +81,7 @@ Java_org_rockbox_RockboxPCM_nativeWrite(JNIEnv *env, jobject this, | |||
81 | if (!pcm_data_size) /* get some initial data */ | 81 | if (!pcm_data_size) /* get some initial data */ |
82 | { | 82 | { |
83 | new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, | 83 | new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, |
84 | (const void**)&pcm_data_start, &pcm_data_size); | 84 | &pcm_data_start, &pcm_data_size); |
85 | } | 85 | } |
86 | 86 | ||
87 | while(left > 0 && pcm_data_size) | 87 | while(left > 0 && pcm_data_size) |
@@ -115,7 +115,7 @@ Java_org_rockbox_RockboxPCM_nativeWrite(JNIEnv *env, jobject this, | |||
115 | if (pcm_data_size == 0) /* need new data */ | 115 | if (pcm_data_size == 0) /* need new data */ |
116 | { | 116 | { |
117 | new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, | 117 | new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, |
118 | (const void**)&pcm_data_start, &pcm_data_size); | 118 | &pcm_data_start, &pcm_data_size); |
119 | } | 119 | } |
120 | else /* increment data pointer and feed more */ | 120 | else /* increment data pointer and feed more */ |
121 | pcm_data_start += transfer_size; | 121 | pcm_data_start += transfer_size; |
@@ -146,7 +146,7 @@ void pcm_dma_apply_settings(void) | |||
146 | 146 | ||
147 | void pcm_play_dma_start(const void *addr, size_t size) | 147 | void pcm_play_dma_start(const void *addr, size_t size) |
148 | { | 148 | { |
149 | pcm_data_start = (char*)addr; | 149 | pcm_data_start = addr; |
150 | pcm_data_size = size; | 150 | pcm_data_size = size; |
151 | 151 | ||
152 | pcm_play_dma_pause(false); | 152 | pcm_play_dma_pause(false); |
diff --git a/firmware/target/hosted/maemo/pcm-gstreamer.c b/firmware/target/hosted/maemo/pcm-gstreamer.c index 61f33cbadd..10a9d77880 100644 --- a/firmware/target/hosted/maemo/pcm-gstreamer.c +++ b/firmware/target/hosted/maemo/pcm-gstreamer.c | |||
@@ -90,7 +90,7 @@ GstBus *gst_bus = NULL; | |||
90 | static int bus_watch_id = 0; | 90 | static int bus_watch_id = 0; |
91 | GMainLoop *pcm_loop = NULL; | 91 | GMainLoop *pcm_loop = NULL; |
92 | 92 | ||
93 | static __u8* pcm_data = NULL; | 93 | static const void* pcm_data = NULL; |
94 | static size_t pcm_data_size = 0; | 94 | static size_t pcm_data_size = 0; |
95 | 95 | ||
96 | static int audio_locked = 0; | 96 | static int audio_locked = 0; |
@@ -128,7 +128,7 @@ void pcm_dma_apply_settings(void) | |||
128 | 128 | ||
129 | void pcm_play_dma_start(const void *addr, size_t size) | 129 | void pcm_play_dma_start(const void *addr, size_t size) |
130 | { | 130 | { |
131 | pcm_data = (__u8 *) addr; | 131 | pcm_data = addr; |
132 | pcm_data_size = size; | 132 | pcm_data_size = size; |
133 | 133 | ||
134 | if (playback_granted) | 134 | if (playback_granted) |
@@ -189,13 +189,12 @@ static void feed_data(GstElement * appsrc, guint size_hint, void *unused) | |||
189 | from inside gstreamer's stream thread as it will deadlock */ | 189 | from inside gstreamer's stream thread as it will deadlock */ |
190 | inside_feed_data = 1; | 190 | inside_feed_data = 1; |
191 | 191 | ||
192 | if (pcm_play_dma_complete_callback(PCM_DMAST_OK, (const void **)&pcm_data, | 192 | if (pcm_play_dma_complete_callback(PCM_DMAST_OK, &pcm_data, &pcm_data_size)) |
193 | &pcm_data_size)) | ||
194 | { | 193 | { |
195 | GstBuffer *buffer = gst_buffer_new (); | 194 | GstBuffer *buffer = gst_buffer_new (); |
196 | GstFlowReturn ret; | 195 | GstFlowReturn ret; |
197 | 196 | ||
198 | GST_BUFFER_DATA (buffer) = pcm_data; | 197 | GST_BUFFER_DATA (buffer) = (__u8 *)pcm_data; |
199 | GST_BUFFER_SIZE (buffer) = pcm_data_size; | 198 | GST_BUFFER_SIZE (buffer) = pcm_data_size; |
200 | 199 | ||
201 | g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret); | 200 | g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret); |
diff --git a/firmware/target/hosted/pcm-alsa.c b/firmware/target/hosted/pcm-alsa.c index 1385f75b34..715af58fd9 100644 --- a/firmware/target/hosted/pcm-alsa.c +++ b/firmware/target/hosted/pcm-alsa.c | |||
@@ -75,7 +75,7 @@ static snd_pcm_sframes_t buffer_size = MIX_FRAME_SAMPLES * 32; /* ~16k */ | |||
75 | static snd_pcm_sframes_t period_size = MIX_FRAME_SAMPLES * 4; /* ~4k */ | 75 | static snd_pcm_sframes_t period_size = MIX_FRAME_SAMPLES * 4; /* ~4k */ |
76 | static short *frames; | 76 | static short *frames; |
77 | 77 | ||
78 | static const char *pcm_data = 0; | 78 | static const void *pcm_data = 0; |
79 | static size_t pcm_size = 0; | 79 | static size_t pcm_size = 0; |
80 | 80 | ||
81 | #ifdef USE_ASYNC_CALLBACK | 81 | #ifdef USE_ASYNC_CALLBACK |
@@ -223,8 +223,8 @@ static bool fill_frames(void) | |||
223 | if (!pcm_size) | 223 | if (!pcm_size) |
224 | { | 224 | { |
225 | new_buffer = true; | 225 | new_buffer = true; |
226 | if (!pcm_play_dma_complete_callback(PCM_DMAST_OK, | 226 | if (!pcm_play_dma_complete_callback(PCM_DMAST_OK, &pcm_data, |
227 | (const void **)&pcm_data, &pcm_size)) | 227 | &pcm_size)) |
228 | { | 228 | { |
229 | return false; | 229 | return false; |
230 | } | 230 | } |
diff --git a/firmware/target/hosted/sdl/pcm-sdl.c b/firmware/target/hosted/sdl/pcm-sdl.c index 2c535b2dc5..bd56189f02 100644 --- a/firmware/target/hosted/sdl/pcm-sdl.c +++ b/firmware/target/hosted/sdl/pcm-sdl.c | |||
@@ -56,7 +56,7 @@ static int sim_volume = 0; | |||
56 | #if CONFIG_CODEC == SWCODEC | 56 | #if CONFIG_CODEC == SWCODEC |
57 | static int cvt_status = -1; | 57 | static int cvt_status = -1; |
58 | 58 | ||
59 | static const Uint8* pcm_data; | 59 | static const void *pcm_data; |
60 | static size_t pcm_data_size; | 60 | static size_t pcm_data_size; |
61 | static size_t pcm_sample_bytes; | 61 | static size_t pcm_sample_bytes; |
62 | static size_t pcm_channel_bytes; | 62 | static size_t pcm_channel_bytes; |
@@ -245,8 +245,8 @@ static void sdl_audio_callback(struct pcm_udata *udata, Uint8 *stream, int len) | |||
245 | 245 | ||
246 | /* Audio card wants more? Get some more then. */ | 246 | /* Audio card wants more? Get some more then. */ |
247 | while (len > 0) { | 247 | while (len > 0) { |
248 | new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, | 248 | new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, &pcm_data, |
249 | (const void **)&pcm_data, &pcm_data_size); | 249 | &pcm_data_size); |
250 | 250 | ||
251 | if (!new_buffer) { | 251 | if (!new_buffer) { |
252 | DEBUGF("sdl_audio_callback: No Data.\n"); | 252 | DEBUGF("sdl_audio_callback: No Data.\n"); |