From e532714d1f76ccdbd1dcfeb3b4579d324cb519c1 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sun, 25 Jul 2021 14:03:44 +0100 Subject: [PATCH] pcm: Remove unused function pcm_play_dma_get_peak_buffer() Change-Id: Ifd20fb14a22489cdb99154c01f69809a1e70d0c5 --- firmware/export/pcm-internal.h | 2 -- firmware/pcm_sw_volume.c | 17 ----------- firmware/target/arm/as3525/pcm-as3525.c | 12 -------- firmware/target/arm/imx233/pcm-imx233.c | 11 -------- .../arm/imx31/gigabeat-s/pcm-gigabeat-s.c | 28 ------------------- firmware/target/arm/pcm-telechips.c | 8 ------ firmware/target/arm/pp/pcm-pp.c | 13 --------- firmware/target/arm/rk27xx/pcm-rk27xx.c | 12 -------- .../arm/s3c2440/gigabeat-fx/pcm-meg-fx.c | 8 ------ .../arm/s3c2440/mini2440/pcm-mini2440.c | 8 ------ firmware/target/arm/s5l8700/pcm-s5l8700.c | 6 ---- firmware/target/arm/s5l8702/pcm-s5l8702.c | 7 ----- .../creative-zvm/pcm-creativezvm.c | 6 ---- .../arm/tms320dm320/mrobe-500/pcm-mr500.c | 16 ----------- .../sansa-connect/pcm-sansaconnect.c | 16 ----------- firmware/target/coldfire/pcm-coldfire.c | 15 ---------- firmware/target/hosted/android/pcm-android.c | 7 ----- firmware/target/hosted/ibasso/pcm-ibasso.c | 11 -------- firmware/target/hosted/maemo/pcm-gstreamer.c | 8 ------ firmware/target/hosted/pcm-alsa.c | 7 ----- firmware/target/hosted/sdl/pcm-sdl.c | 7 ----- .../target/mips/ingenic_jz47xx/pcm-jz4740.c | 22 --------------- .../target/mips/ingenic_jz47xx/pcm-jz4760.c | 22 --------------- 23 files changed, 269 deletions(-) diff --git a/firmware/export/pcm-internal.h b/firmware/export/pcm-internal.h index d5d46c33e1..e6400004a0 100644 --- a/firmware/export/pcm-internal.h +++ b/firmware/export/pcm-internal.h @@ -121,7 +121,6 @@ pcm_play_dma_status_callback(enum pcm_dma_status status) void pcm_play_dma_start_int(const void *addr, size_t size); void pcm_play_dma_stop_int(void); void pcm_play_stop_int(void); -const void *pcm_play_dma_get_peak_buffer_int(int *count); #endif /* HAVE_SW_VOLUME_CONTROL && !PCM_SW_VOLUME_UNBUFFERED */ /* Called by the bottom layer ISR when more data is needed. Returns true @@ -145,7 +144,6 @@ void pcm_play_dma_init(void) INIT_ATTR; void pcm_play_dma_postinit(void); void pcm_play_dma_start(const void *addr, size_t size); void pcm_play_dma_stop(void); -const void * pcm_play_dma_get_peak_buffer(int *count); void pcm_dma_apply_settings(void); diff --git a/firmware/pcm_sw_volume.c b/firmware/pcm_sw_volume.c index e972896321..29049059e6 100644 --- a/firmware/pcm_sw_volume.c +++ b/firmware/pcm_sw_volume.c @@ -285,23 +285,6 @@ void pcm_play_dma_stop_int(void) src_buf_rem = 0; } -/* Return playing buffer from the source buffer */ -const void * pcm_play_dma_get_peak_buffer_int(int *count) -{ - const void *addr = src_buf_addr; - size_t size = src_buf_rem; - const void *addr2 = src_buf_addr; - - if (addr == addr2 && size) - { - *count = size / PCM_SAMPLE_SIZE; - return addr; - } - - *count = 0; - return NULL; -} - #endif /* PCM_SW_VOLUME_UNBUFFERED */ diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c index dfbda388be..e480140497 100644 --- a/firmware/target/arm/as3525/pcm-as3525.c +++ b/firmware/target/arm/as3525/pcm-as3525.c @@ -200,18 +200,6 @@ void pcm_dma_apply_settings(void) 0x01ffffff); } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - int oldstatus = disable_irq_save(); - size_t addr = DMAC_CH_SRC_ADDR(0); - size_t start_addr = (size_t)dma_start_addr; - size_t start_size = dma_start_size; - restore_interrupt(oldstatus); - - *count = (start_size - addr + start_addr) >> 2; - return (void*)AS3525_UNCACHED_ADDR(addr); -} - #ifdef HAVE_PCM_DMA_ADDRESS void * pcm_dma_addr(void *addr) { diff --git a/firmware/target/arm/imx233/pcm-imx233.c b/firmware/target/arm/imx233/pcm-imx233.c index c06120e4aa..4738485b3d 100644 --- a/firmware/target/arm/imx233/pcm-imx233.c +++ b/firmware/target/arm/imx233/pcm-imx233.c @@ -175,17 +175,6 @@ void pcm_dma_apply_settings(void) pcm_play_unlock(); } -const void *pcm_play_dma_get_peak_buffer(int *count) -{ - if(!dac_freezed) - imx233_dma_freeze_channel(APB_AUDIO_DAC, true); - struct imx233_dma_info_t info = imx233_dma_get_info(APB_AUDIO_DAC, DMA_INFO_AHB_BYTES | DMA_INFO_BAR); - if(!dac_freezed) - imx233_dma_freeze_channel(APB_AUDIO_DAC, false); - *count = info.ahb_bytes; - return (void *)info.bar; -} - /* * Recording */ diff --git a/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c b/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c index 13dff6ecb5..955301b4da 100644 --- a/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c +++ b/firmware/target/arm/imx31/gigabeat-s/pcm-gigabeat-s.c @@ -224,34 +224,6 @@ void pcm_play_dma_stop(void) play_stop_pcm(); } -/* Return a pointer to the samples and the number of them in *count */ -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - static unsigned long dsa NOCACHEBSS_ATTR; - unsigned long addr; - long offs, size; - int oldstatus; - - /* read burst dma source address register in channel context */ - sdma_read_words(&dsa, CHANNEL_CONTEXT_ADDR(DMA_PLAY_CH_NUM)+0x0b, 1); - - oldstatus = disable_irq_save(); - addr = dsa; - offs = addr - (unsigned long)dma_play_bd.buf_addr; - size = dma_play_bd.mode.count; - restore_irq(oldstatus); - - /* Be addresses are coherent (no buffer change during read) */ - if (offs >= 0 && offs < size) - { - *count = (size - offs) >> 2; - return (void *)((addr + 2) & ~3); - } - - *count = 0; - return NULL; -} - void * pcm_dma_addr(void *addr) { return (void *)addr_virt_to_phys((unsigned long)addr); diff --git a/firmware/target/arm/pcm-telechips.c b/firmware/target/arm/pcm-telechips.c index ff550b14d6..336b5626ca 100644 --- a/firmware/target/arm/pcm-telechips.c +++ b/firmware/target/arm/pcm-telechips.c @@ -62,14 +62,6 @@ struct dma_data dma_play_data SHAREDBSS_ATTR = .state = 0 }; -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - unsigned long addr = (unsigned long)dma_play_data.p; - size_t cnt = dma_play_data.size; - *count = cnt >> 2; - return (void *)((addr + 2) & ~3); -} - void pcm_play_dma_init(void) { DAVC = 0x0; /* Digital Volume = max */ diff --git a/firmware/target/arm/pp/pcm-pp.c b/firmware/target/arm/pp/pcm-pp.c index 8434123a92..0d61eb44ff 100644 --- a/firmware/target/arm/pp/pcm-pp.c +++ b/firmware/target/arm/pp/pcm-pp.c @@ -512,19 +512,6 @@ void pcm_play_dma_postinit(void) audiohw_postinit(); } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - unsigned long addr, size; - - int status = disable_fiq_save(); - addr = dma_play_data.addr; - size = dma_play_data.size; - restore_fiq(status); - - *count = size >> 2; - return (void *)((addr + 2) & ~3); -} - /**************************************************************************** ** Recording DMA transfer **/ diff --git a/firmware/target/arm/rk27xx/pcm-rk27xx.c b/firmware/target/arm/rk27xx/pcm-rk27xx.c index c0b4c45805..26e3ad87ba 100644 --- a/firmware/target/arm/rk27xx/pcm-rk27xx.c +++ b/firmware/target/arm/rk27xx/pcm-rk27xx.c @@ -263,18 +263,6 @@ void INT_HDMA(void) } } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - uint32_t addr; - - int old = disable_irq_save(); - addr = HDMA_CSRC0; - *count = ((HDMA_CCNT0 & 0xffff)<<2); - restore_interrupt(old); - - return (void*)addr; -} - /**************************************************************************** ** Recording DMA transfer **/ diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c index d784180e77..e75c3fe7c6 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/pcm-meg-fx.c @@ -219,11 +219,3 @@ void fiq_handler(void) pcm_play_dma_status_callback(PCM_DMAST_STARTED); } - -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - unsigned long addr = DCSRC2; - int cnt = DSTAT2; - *count = (cnt & 0xFFFFF) >> 1; - return (void *)((addr + 2) & ~3); -} diff --git a/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c b/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c index 9574522586..999a53e3f9 100644 --- a/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c +++ b/firmware/target/arm/s3c2440/mini2440/pcm-mini2440.c @@ -259,11 +259,3 @@ void fiq_handler(void) pcm_play_dma_status_callback(PCM_DMAST_STARTED); } - -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - unsigned long addr = DCSRC2; - int cnt = DSTAT2; - *count = (cnt & 0xFFFFF) >> 1; - return (void *)((addr + 2) & ~3); -} diff --git a/firmware/target/arm/s5l8700/pcm-s5l8700.c b/firmware/target/arm/s5l8700/pcm-s5l8700.c index 050e14451d..c7b6ed9a03 100644 --- a/firmware/target/arm/s5l8700/pcm-s5l8700.c +++ b/firmware/target/arm/s5l8700/pcm-s5l8700.c @@ -262,12 +262,6 @@ void pcm_dma_apply_settings(void) pcm_dma_set_freq(pcm_fsel); } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - *count = DMACTCNT0 >> 1; - return (void *)(((DMACADDR0 + 2) & ~3) | 0x40000000); -} - #ifdef HAVE_PCM_DMA_ADDRESS void * pcm_dma_addr(void *addr) { diff --git a/firmware/target/arm/s5l8702/pcm-s5l8702.c b/firmware/target/arm/s5l8702/pcm-s5l8702.c index 33fe637770..d4570f3a7f 100644 --- a/firmware/target/arm/s5l8702/pcm-s5l8702.c +++ b/firmware/target/arm/s5l8702/pcm-s5l8702.c @@ -216,13 +216,6 @@ void pcm_play_dma_postinit(void) audiohw_postinit(); } -const void* pcm_play_dma_get_peak_buffer(int *count) -{ - void *addr = dmac_ch_get_info(&dma_play_ch, count, NULL); - *count >>= 2; /* bytes to samples */ - return addr; /* aligned to dest burst */ -} - #ifdef HAVE_PCM_DMA_ADDRESS void * pcm_dma_addr(void *addr) { diff --git a/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c index d5e30ad73b..fa1eb2481f 100644 --- a/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c +++ b/firmware/target/arm/tms320dm320/creative-zvm/pcm-creativezvm.c @@ -52,12 +52,6 @@ void pcm_play_dma_postinit(void) // dsp_wake(); } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - (void) count; - return 0; -} - void pcm_dma_apply_settings(void) { audiohw_set_frequency(pcm_fsel); diff --git a/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c index 5ce5a8f399..fda8615e5a 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/pcm-mr500.c @@ -46,22 +46,6 @@ void pcm_play_dma_postinit(void) audiohw_postinit(); } -/* Return the current location in the SDRAM to SARAM transfer along with the - * number of bytes read in the current buffer (count). There is latency with - * this method equivalent to ~ the size of the SARAM buffer since there is - * another buffer between your ears and this calculation, but this works for - * key clicks and an approximate peak meter. - */ -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - int cnt = DSP_(_sdem_level); - - unsigned long addr = (unsigned long) start + cnt; - - *count = (cnt & 0xFFFFF) >> 1; - return (void *)((addr + 2) & ~3); -} - void pcm_play_dma_init(void) { IO_INTC_IRQ0 = INTR_IRQ0_IMGBUF; diff --git a/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c index f9f19a8045..bda000e68f 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/pcm-sansaconnect.c @@ -42,22 +42,6 @@ void pcm_play_dma_postinit(void) audiohw_postinit(); } -/* Return the current location in the SDRAM to SARAM transfer along with the - * number of bytes read in the current buffer (count). There is latency with - * this method equivalent to ~ the size of the SARAM buffer since there is - * another buffer between your ears and this calculation, but this works for - * key clicks and an approximate peak meter. - */ -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - int cnt = DSP_(_sdem_level); - - unsigned long addr = (unsigned long) start + cnt; - - *count = (cnt & 0xFFFFF) >> 1; - return (void *)((addr + 2) & ~3); -} - void pcm_play_dma_init(void) { /* GIO16 is DSP/AIC3X CLK */ diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c index c45219297c..36eb00c31b 100644 --- a/firmware/target/coldfire/pcm-coldfire.c +++ b/firmware/target/coldfire/pcm-coldfire.c @@ -301,21 +301,6 @@ void DMA0(void) /* else inished playing */ } /* DMA0 */ -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - unsigned long addr, cnt; - - /* Make sure interrupt doesn't change the second value after we read the - * first value. */ - int level = set_irq_level(DMA_IRQ_LEVEL); - addr = SAR0; - cnt = BCR0; - restore_irq(level); - - *count = (cnt & 0xffffff) >> 2; - return (void *)((addr + 2) & ~3); -} /* pcm_play_dma_get_peak_buffer */ - #ifdef HAVE_RECORDING /**************************************************************************** ** Recording DMA transfer diff --git a/firmware/target/hosted/android/pcm-android.c b/firmware/target/hosted/android/pcm-android.c index b078f92698..c23b802b2d 100644 --- a/firmware/target/hosted/android/pcm-android.c +++ b/firmware/target/hosted/android/pcm-android.c @@ -171,13 +171,6 @@ void pcm_play_dma_stop(void) stop_method); } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - uintptr_t addr = (uintptr_t)pcm_data_start; - *count = pcm_data_size / 4; - return (void *)((addr + 3) & ~3); -} - void pcm_play_dma_init(void) { /* in order to have background music playing after leaving the activity, diff --git a/firmware/target/hosted/ibasso/pcm-ibasso.c b/firmware/target/hosted/ibasso/pcm-ibasso.c index e31732431b..5c68ded3e1 100644 --- a/firmware/target/hosted/ibasso/pcm-ibasso.c +++ b/firmware/target/hosted/ibasso/pcm-ibasso.c @@ -439,17 +439,6 @@ void pcm_dma_apply_settings(void) } } -/* TODO: WTF */ -const void* pcm_play_dma_get_peak_buffer(int* count) -{ - TRACE; - - uintptr_t addr = (uintptr_t) _pcm_buffer; - *count = _pcm_buffer_size / 4; - return (void*) ((addr + 3) & ~3); -} - - void pcm_close_device(void) { TRACE; diff --git a/firmware/target/hosted/maemo/pcm-gstreamer.c b/firmware/target/hosted/maemo/pcm-gstreamer.c index e2d57f9fab..33fa6d343f 100644 --- a/firmware/target/hosted/maemo/pcm-gstreamer.c +++ b/firmware/target/hosted/maemo/pcm-gstreamer.c @@ -191,14 +191,6 @@ static void feed_data(GstElement * appsrc, guint size_hint, void *unused) unlock_audio(); } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - uintptr_t addr = (uintptr_t)pcm_data; - *count = pcm_data_size / 4; - return (void *)((addr + 2) & ~3); -} - - static gboolean gst_bus_message (GstBus * bus, GstMessage * message, void *unused) { diff --git a/firmware/target/hosted/pcm-alsa.c b/firmware/target/hosted/pcm-alsa.c index 81c0a19a45..13ebbbcbeb 100644 --- a/firmware/target/hosted/pcm-alsa.c +++ b/firmware/target/hosted/pcm-alsa.c @@ -775,13 +775,6 @@ void pcm_play_dma_start(const void *addr, size_t size) } } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - uintptr_t addr = (uintptr_t)pcm_data; - *count = pcm_size / 4; - return (void *)((addr + 3) & ~3); -} - void pcm_play_dma_postinit(void) { audiohw_postinit(); diff --git a/firmware/target/hosted/sdl/pcm-sdl.c b/firmware/target/hosted/sdl/pcm-sdl.c index 7297e94340..940403002f 100644 --- a/firmware/target/hosted/sdl/pcm-sdl.c +++ b/firmware/target/hosted/sdl/pcm-sdl.c @@ -276,13 +276,6 @@ static void sdl_audio_callback(struct pcm_udata *udata, Uint8 *stream, int len) SDL_UnlockMutex(audio_lock); } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - uintptr_t addr = (uintptr_t)pcm_data; - *count = pcm_data_size / 4; - return (void *)((addr + 2) & ~3); -} - #ifdef HAVE_RECORDING void pcm_rec_lock(void) { diff --git a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c index 83325e09ef..a56214f84b 100644 --- a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c +++ b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c @@ -203,28 +203,6 @@ static int get_dma_count(void) return count; } -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - int flags = disable_irq_save(); - - const void* addr; - if(REG_DMAC_DCCSR(DMA_AIC_TX_CHANNEL) & DMAC_DCCSR_EN) - { - int bytes = get_dma_count(); - *count = bytes >> 2; - addr = (const void*)((int)(playback_address + bytes + 2) & ~3); - } - else - { - *count = 0; - addr = NULL; - } - - restore_irq(flags); - - return addr; -} - void audiohw_close(void) { /* TODO: prevent pop */ diff --git a/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c b/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c index 401d568a97..8c70e68b64 100644 --- a/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c +++ b/firmware/target/mips/ingenic_jz47xx/pcm-jz4760.c @@ -191,25 +191,3 @@ static int get_dma_count(void) return count; } - -const void * pcm_play_dma_get_peak_buffer(int *count) -{ - int flags = disable_irq_save(); - - const void* addr; - if(REG_DMAC_DCCSR(DMA_AIC_TX_CHANNEL) & DMAC_DCCSR_EN) - { - int bytes = get_dma_count(); - *count = bytes >> 2; - addr = (const void*)((int)(playback_address + bytes + 2) & ~3); - } - else - { - *count = 0; - addr = NULL; - } - - restore_irq(flags); - - return addr; -}