mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
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
This commit is contained in:
parent
f6e17e86fe
commit
cd8e11b463
6 changed files with 22 additions and 24 deletions
|
|
@ -43,9 +43,9 @@
|
||||||
static volatile int locked = 0;
|
static volatile int locked = 0;
|
||||||
static const int zerosample = 0;
|
static const int zerosample = 0;
|
||||||
static unsigned char dblbuf[1024] IBSS_ATTR;
|
static unsigned char dblbuf[1024] IBSS_ATTR;
|
||||||
static const unsigned char* queuedbuf;
|
static const void* queuedbuf;
|
||||||
static size_t queuedsize;
|
static size_t queuedsize;
|
||||||
static const unsigned char* nextbuf;
|
static const void* nextbuf;
|
||||||
static size_t nextsize;
|
static size_t nextsize;
|
||||||
|
|
||||||
static const struct div_entry {
|
static const struct div_entry {
|
||||||
|
|
@ -116,8 +116,8 @@ void INT_DMA(void)
|
||||||
{
|
{
|
||||||
if (!nextsize)
|
if (!nextsize)
|
||||||
{
|
{
|
||||||
new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK,
|
new_buffer = pcm_play_dma_complete_callback(
|
||||||
(const void**)&nextbuf, &nextsize);
|
PCM_DMAST_OK, &nextbuf, &nextsize);
|
||||||
if (!new_buffer)
|
if (!new_buffer)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +144,7 @@ void INT_DMA(void)
|
||||||
void pcm_play_dma_start(const void* addr, size_t size)
|
void pcm_play_dma_start(const void* addr, size_t size)
|
||||||
{
|
{
|
||||||
/* DMA channel on */
|
/* DMA channel on */
|
||||||
nextbuf = (const unsigned char*)addr;
|
nextbuf = addr;
|
||||||
nextsize = size;
|
nextsize = size;
|
||||||
queuedsize = 0;
|
queuedsize = 0;
|
||||||
DMABASE0 = (unsigned int)(&zerosample);
|
DMABASE0 = (unsigned int)(&zerosample);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ static unsigned char dblbuf[2][PCM_WATERMARK * 4];
|
||||||
static int active_dblbuf;
|
static int active_dblbuf;
|
||||||
struct dma_lli pcm_lli[PCM_LLICOUNT] __attribute__((aligned(16)));
|
struct dma_lli pcm_lli[PCM_LLICOUNT] __attribute__((aligned(16)));
|
||||||
static struct dma_lli* lastlli;
|
static struct dma_lli* lastlli;
|
||||||
static const unsigned char* dataptr;
|
static const void* dataptr;
|
||||||
size_t pcm_remaining;
|
size_t pcm_remaining;
|
||||||
size_t pcm_chunksize;
|
size_t pcm_chunksize;
|
||||||
|
|
||||||
|
|
@ -65,8 +65,7 @@ void INT_DMAC0C0(void)
|
||||||
DMAC0INTTCCLR = 1;
|
DMAC0INTTCCLR = 1;
|
||||||
if (!pcm_remaining)
|
if (!pcm_remaining)
|
||||||
{
|
{
|
||||||
pcm_play_dma_complete_callback(PCM_DMAST_OK, (const void**)&dataptr,
|
pcm_play_dma_complete_callback(PCM_DMAST_OK, &dataptr, &pcm_remaining);
|
||||||
&pcm_remaining);
|
|
||||||
pcm_chunksize = pcm_remaining;
|
pcm_chunksize = pcm_remaining;
|
||||||
}
|
}
|
||||||
if (!pcm_remaining)
|
if (!pcm_remaining)
|
||||||
|
|
@ -121,7 +120,7 @@ void INT_DMAC0C0(void)
|
||||||
|
|
||||||
void pcm_play_dma_start(const void* addr, size_t size)
|
void pcm_play_dma_start(const void* addr, size_t size)
|
||||||
{
|
{
|
||||||
dataptr = (const unsigned char*)addr;
|
dataptr = addr;
|
||||||
pcm_remaining = size;
|
pcm_remaining = size;
|
||||||
I2STXCOM = 0xe;
|
I2STXCOM = 0xe;
|
||||||
INT_DMAC0C0();
|
INT_DMAC0C0();
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@
|
||||||
extern JNIEnv *env_ptr;
|
extern JNIEnv *env_ptr;
|
||||||
|
|
||||||
/* infos about our pcm chunks */
|
/* infos about our pcm chunks */
|
||||||
|
static const void *pcm_data_start;
|
||||||
static size_t pcm_data_size;
|
static size_t pcm_data_size;
|
||||||
static char *pcm_data_start;
|
|
||||||
static int audio_locked = 0;
|
static int audio_locked = 0;
|
||||||
static pthread_mutex_t audio_lock_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t audio_lock_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ Java_org_rockbox_RockboxPCM_nativeWrite(JNIEnv *env, jobject this,
|
||||||
if (!pcm_data_size) /* get some initial data */
|
if (!pcm_data_size) /* get some initial data */
|
||||||
{
|
{
|
||||||
new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK,
|
new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK,
|
||||||
(const void**)&pcm_data_start, &pcm_data_size);
|
&pcm_data_start, &pcm_data_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(left > 0 && pcm_data_size)
|
while(left > 0 && pcm_data_size)
|
||||||
|
|
@ -115,7 +115,7 @@ Java_org_rockbox_RockboxPCM_nativeWrite(JNIEnv *env, jobject this,
|
||||||
if (pcm_data_size == 0) /* need new data */
|
if (pcm_data_size == 0) /* need new data */
|
||||||
{
|
{
|
||||||
new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK,
|
new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK,
|
||||||
(const void**)&pcm_data_start, &pcm_data_size);
|
&pcm_data_start, &pcm_data_size);
|
||||||
}
|
}
|
||||||
else /* increment data pointer and feed more */
|
else /* increment data pointer and feed more */
|
||||||
pcm_data_start += transfer_size;
|
pcm_data_start += transfer_size;
|
||||||
|
|
@ -146,7 +146,7 @@ void pcm_dma_apply_settings(void)
|
||||||
|
|
||||||
void pcm_play_dma_start(const void *addr, size_t size)
|
void pcm_play_dma_start(const void *addr, size_t size)
|
||||||
{
|
{
|
||||||
pcm_data_start = (char*)addr;
|
pcm_data_start = addr;
|
||||||
pcm_data_size = size;
|
pcm_data_size = size;
|
||||||
|
|
||||||
pcm_play_dma_pause(false);
|
pcm_play_dma_pause(false);
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ GstBus *gst_bus = NULL;
|
||||||
static int bus_watch_id = 0;
|
static int bus_watch_id = 0;
|
||||||
GMainLoop *pcm_loop = NULL;
|
GMainLoop *pcm_loop = NULL;
|
||||||
|
|
||||||
static __u8* pcm_data = NULL;
|
static const void* pcm_data = NULL;
|
||||||
static size_t pcm_data_size = 0;
|
static size_t pcm_data_size = 0;
|
||||||
|
|
||||||
static int audio_locked = 0;
|
static int audio_locked = 0;
|
||||||
|
|
@ -128,7 +128,7 @@ void pcm_dma_apply_settings(void)
|
||||||
|
|
||||||
void pcm_play_dma_start(const void *addr, size_t size)
|
void pcm_play_dma_start(const void *addr, size_t size)
|
||||||
{
|
{
|
||||||
pcm_data = (__u8 *) addr;
|
pcm_data = addr;
|
||||||
pcm_data_size = size;
|
pcm_data_size = size;
|
||||||
|
|
||||||
if (playback_granted)
|
if (playback_granted)
|
||||||
|
|
@ -189,13 +189,12 @@ static void feed_data(GstElement * appsrc, guint size_hint, void *unused)
|
||||||
from inside gstreamer's stream thread as it will deadlock */
|
from inside gstreamer's stream thread as it will deadlock */
|
||||||
inside_feed_data = 1;
|
inside_feed_data = 1;
|
||||||
|
|
||||||
if (pcm_play_dma_complete_callback(PCM_DMAST_OK, (const void **)&pcm_data,
|
if (pcm_play_dma_complete_callback(PCM_DMAST_OK, &pcm_data, &pcm_data_size))
|
||||||
&pcm_data_size))
|
|
||||||
{
|
{
|
||||||
GstBuffer *buffer = gst_buffer_new ();
|
GstBuffer *buffer = gst_buffer_new ();
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
GST_BUFFER_DATA (buffer) = pcm_data;
|
GST_BUFFER_DATA (buffer) = (__u8 *)pcm_data;
|
||||||
GST_BUFFER_SIZE (buffer) = pcm_data_size;
|
GST_BUFFER_SIZE (buffer) = pcm_data_size;
|
||||||
|
|
||||||
g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);
|
g_signal_emit_by_name (appsrc, "push-buffer", buffer, &ret);
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ static snd_pcm_sframes_t buffer_size = MIX_FRAME_SAMPLES * 32; /* ~16k */
|
||||||
static snd_pcm_sframes_t period_size = MIX_FRAME_SAMPLES * 4; /* ~4k */
|
static snd_pcm_sframes_t period_size = MIX_FRAME_SAMPLES * 4; /* ~4k */
|
||||||
static short *frames;
|
static short *frames;
|
||||||
|
|
||||||
static const char *pcm_data = 0;
|
static const void *pcm_data = 0;
|
||||||
static size_t pcm_size = 0;
|
static size_t pcm_size = 0;
|
||||||
|
|
||||||
#ifdef USE_ASYNC_CALLBACK
|
#ifdef USE_ASYNC_CALLBACK
|
||||||
|
|
@ -223,8 +223,8 @@ static bool fill_frames(void)
|
||||||
if (!pcm_size)
|
if (!pcm_size)
|
||||||
{
|
{
|
||||||
new_buffer = true;
|
new_buffer = true;
|
||||||
if (!pcm_play_dma_complete_callback(PCM_DMAST_OK,
|
if (!pcm_play_dma_complete_callback(PCM_DMAST_OK, &pcm_data,
|
||||||
(const void **)&pcm_data, &pcm_size))
|
&pcm_size))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ static int sim_volume = 0;
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
static int cvt_status = -1;
|
static int cvt_status = -1;
|
||||||
|
|
||||||
static const Uint8* pcm_data;
|
static const void *pcm_data;
|
||||||
static size_t pcm_data_size;
|
static size_t pcm_data_size;
|
||||||
static size_t pcm_sample_bytes;
|
static size_t pcm_sample_bytes;
|
||||||
static size_t pcm_channel_bytes;
|
static size_t pcm_channel_bytes;
|
||||||
|
|
@ -245,8 +245,8 @@ static void sdl_audio_callback(struct pcm_udata *udata, Uint8 *stream, int len)
|
||||||
|
|
||||||
/* Audio card wants more? Get some more then. */
|
/* Audio card wants more? Get some more then. */
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK,
|
new_buffer = pcm_play_dma_complete_callback(PCM_DMAST_OK, &pcm_data,
|
||||||
(const void **)&pcm_data, &pcm_data_size);
|
&pcm_data_size);
|
||||||
|
|
||||||
if (!new_buffer) {
|
if (!new_buffer) {
|
||||||
DEBUGF("sdl_audio_callback: No Data.\n");
|
DEBUGF("sdl_audio_callback: No Data.\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue