Commit graph

31607 commits

Author SHA1 Message Date
Michael Sevakis
5857c44017 Refactor audio thread to run both recording and playback.
Eliminates the pcmrec thread and keeps playback and recording engine
operation mutually-exclusive.

audio_thread.c contains the audio thread which branches to the
correct engine depending upon the request. It also handles the main
audio initialization.

Moves pcm_init into main.c just before dsp_init because I don't want
that one in audio_init in the new file.

(Also makes revision df6e1bc pointless ;)

Change-Id: Ifc1db24404e6d8dd9ac42d9f4dfbc207aa9a26e1
2013-05-31 03:20:35 -04:00
Michael Sevakis
df6e1bcce5 pcm_record: Track initialization state
It should not access audio hardware and change settings unless it has
been initialized first and given control of it.

Change-Id: I5004602d7caa604ded751f6838b792d1ff24b3fb
2013-05-30 18:42:59 -04:00
Michael Sevakis
5a1e697e2a PP Sansa: Use better I2S divider settings for 48kHz.
The previous ones produced some crackling.

Change-Id: I70de901172aba156f58d4b1088d0038b2ed53d49
2013-05-30 03:34:10 -04:00
Michael Sevakis
46688a60db Missed removing a couple unwanted includes in previous commit.
Get those too.

Change-Id: Id2a39afe7a61d6ec0cea38633b94fe1b7122204f
2013-05-27 03:40:02 -04:00
Michael Sevakis
b5a6517e9d Remove explicit config.h and system.h includes from DSP code.
Replace with rbcodecconfig.h and platform.h includes. Remove now-
unneeded ones as well.

Change-Id: I6111b71e90bf86d9fe272a7916f2d34a5c6dd724
2013-05-27 03:23:33 -04:00
Michael Sevakis
30fe6eb66c SPC Codec ARMv5: I didn't have fast gauss quite right.
Fix wrapping hazard which did eventually manifest on the right file.

Change-Id: I996a6efd3181b56fd172b5c3a526c7434f88bbbe
2013-05-26 00:33:30 -04:00
Andrew Ryabinin
00b8563654 df1704: Add filter roll-off selection.
Change-Id: I732ebd3446858b497105cf03fc81e934a749a57b
2013-05-24 11:32:20 +04:00
Andrew Ryabinin
0519f7e5ab Add DAC's oversampling filter roll-off selection to sound settings.
Change-Id: I1258ba50dd9308f49d97965562f3a423c9bfb785
2013-05-24 11:18:16 +04:00
Boris Gjenero
f6e179bd8e Remove data_abort_handler from ARM crt0 files.
This causes data_abort_handler from lib/unwarminder/safe_read.S to be
used instead. It allows unwarminder to avoid data aborts when
displaying the backtrace. A data_abort_handler remains in system-arm.c,
but it is not used because it is declared as a weak symbol.

Change-Id: I832066ed514347fe697e219872e90fbdd937f477
Reviewed-on: http://gerrit.rockbox.org/475
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
Tested-by: Boris Gjenero <boris.gjenero@gmail.com>
2013-05-24 02:02:04 +02:00
Boris Gjenero
4077eac839 Fix return address when data_abort_handler skips faulting instruction.
When writing a value to PC, execution continues at that location,
so subtracting 4 returns to the next instruction. Previously, two
instructions after the faulting instruction were being skipped, causing
safe_read functions to return true even if a data abort happened.

Change-Id: I3fd02d54646323ea2050d0504e38f6d22f09c749
2013-05-23 19:51:19 -04:00
Michael Sevakis
9b65f8e658 Fix 6e211ab errors and warnings.
If target has HW tone controls but no HW prescaler (non-implemented or
non-existent), audiohw_set_prescaler() should, for now, do nothing.

Change-Id: If1b1a36970dca82fda1c350fbaa4d6ce068a6d32
2013-05-23 14:58:57 -04:00
Michael Sevakis
6e211ab3ac Remove dsp_callback because DSP is now library code, not app code.
Yep, nope, not necessary anymore. Just call functions directly.

Change-Id: I21dc35f8d674c2a9c8379b7cebd5613c1f05b5eb
2013-05-23 14:25:37 -04:00
Michael Sevakis
b7e0e1a0a3 buflib: Remove compulsory IRQ disable during buffer move.
It can cause excessively long interrupt outages if moving a larger
buffer and disrupt audio where DMA is not at a higher interrupt priority
such as FIQ.

Some targets, like Gigabeat S, have very low audio interrupt latency
requirements and will even channel swap if they are missed. Pictureflow
will make the issue very obvious. Even then, moves could take
milliseconds or more depending on the buffer size which is far too long
for any target.

Change-Id: I8e7817213e901da67c36b7eb25d7cb1c1e3ba802
Reviewed-on: http://gerrit.rockbox.org/472
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-05-23 18:25:29 +02:00
Michael Sevakis
33f3af2b8d SPC Codec: Add ARMv5 optimized code. Easy peasy.
Why? Why not? Cuts a few MHz.

Change-Id: Ied5c70b1aedd255cbe5d42b7d3028bbe47aad01d
2013-05-23 03:15:12 -04:00
Michael Sevakis
7738660eff USB: Detect charging-only mode upon cable insert, not host detect.
Letting go of the button before the host is detected allows storage mode
to be entered even though a button was down when plugging. Sometimes the
host would try several times and the button would have to be held down
for several seconds to avoid a storage connection.

The adjustment wasn't made when switching to setup request host
detection.

Change-Id: Iab3bced5bfb1478d4d9a7baab2a2a1144afaf437
2013-05-22 02:28:31 -04:00
Michael Sevakis
39946a56d8 Fix CPU boosting in test_codec.
Boost only for tests and unboost immediately afterwards. It was leaving
the CPU boosted after exiting.

Change-Id: I010c4b975bd27e8990dc057ddd244dab233411ca
2013-05-21 22:19:57 -04:00
Michael Sevakis
9b43f14165 SPC Codec: Simplify configuration and assume nothing need be disabled.
Most SoCs are these days are fast enough for realtime BRR, gaussian
interpolation and echo processing.

Change-Id: I180ce8ad45242c67b5e573a406b9522098a3f12b
2013-05-21 20:39:22 -04:00
Michael Sevakis
ed24e62029 SPC Codec: Have metadata parser fill in frequency and bitrate.
Change-Id: I6c72f4d1c79b1a99a11fb28e7d46886c08a56a75
2013-05-21 20:01:17 -04:00
Michael Sevakis
1f76edabf9 SPC Codec: Need to restore a bit more data from cached waves.
'Nuff said. Last update wasn't quite right.

Change-Id: I082a79c4e0c82b968fe2375cb82ee5c3a64a208b
2013-05-21 16:59:58 -04:00
Nils Wallménius
de86b4a3c5 Opus: fix glitch caused by 2e9aa3d
Change-Id: I1519f3bf2cdf74f3d4741951973352b2678b7722
2013-05-21 22:38:18 +02:00
Michael Sevakis
71b9685dcd Fix FS#9577 - SNES player missing tracks on certain SPCs
Affected BRR cached waveforms but not realtime BRR decode as far as
I could ascertain. BRR cached waves required loop points to be inside
the initial waveform but this change removes that restriction.

Change-Id: I0ef4db720e5c28bd7b2fb9ae255d27c0a7213f79
2013-05-21 04:29:04 -04:00
Michael Sevakis
00e55d0451 Fix 87021f7 errors. There is no this->echo_pos when SPC_NOECHO != 0.
Anyway, that's true now.

Change-Id: I247ea9a10543a8b65f3e73495f0e2ea725ec533e
2013-05-21 00:20:06 -04:00
Michael Sevakis
87021f7c0a SPC Codec: Refactor for CPU and clean up some things.
CPU optimization gets its own files in which to fill-in optimizable
routines.

Some pointless #if 0's for profiling need removal. Those macros are
empty if not profiling.

Force some functions that are undesirable to be force-inlined by the
compiler to be not inlined.

Change-Id: Ia7b7e45380d7efb20c9b1a4d52e05db3ef6bbaab
2013-05-21 00:02:14 -04:00
Nils Wallménius
a17d6de5bc Opus: fix seeking to start of track
Change-Id: I8a8604d6726304d04281671b475b2f75f9bfc0e5
2013-05-19 14:20:31 +02:00
Nils Wallménius
2e9aa3d8b0 Opus: avoid allocating space for comment packets
Fixes playback of files with large embedded album art.

Change-Id: I94d336e3da968a93047dd00a5fa65e4c3423a7da
2013-05-19 14:19:09 +02:00
Nils Wallménius
c7124b5520 Fix opus craches with large embedded album art
Use the tlsf malloc and friends instead of the silly
codec_malloc to get actually working free and saner
realloc that doesn't leak memory.
Makes files with moderately sized embedded AA play
on targets with large enough codec buffers and files
with too large AA are now skipped rather than crashing.
Fixes crash when playing example file in FS#12842.

Change-Id: I06562955c4d9a95bd90f55738214fba462092b71
2013-05-18 23:38:23 +02:00
Andrew Ryabinin
fc0cf8d91b builds.pm: Add HiFi E.T MA9.
Change-Id: Ic8d31244c4ddc3924d889d0cb0d444844a1bb345
2013-05-18 18:57:16 +04:00
Boris Gjenero
01d0de9fc4 FS#12854 - ipod-time-sync sets wrong day
Change-Id: I8ac7561119e51774b9aee377e7373a7e830a5780
2013-05-17 21:12:56 +02:00
Michael Sevakis
a7dee7f447 Introduce new hermite polynomial resampler.
Uses the Catmull-Rom case of Hermite cubic splines.

Vastly improves the quality and accuracy of audio resampling with a
rather minor additional overhead compared to the previous linear
implementation.

ARM and Coldfire assembly implementations included.

Change-Id: Ic45d84bc66c5b312ef373198297a952167a4be26
Reviewed-on: http://gerrit.rockbox.org/304
Reviewed-by: Michael Sevakis <jethead71@rockbox.org>
Tested-by: Michael Sevakis <jethead71@rockbox.org>
2013-05-16 18:52:21 +02:00
Michael Sevakis
91b850ec42 Get rid of usb_drv_attach() from USB code.
'Twas an idiosyncrasy of detecting a host upon bus reset, which is
obsolete.

Change-Id: I0adb25e1805022544f52cd0cb766819a367dbde4
2013-05-14 22:13:38 -04:00
Michael Sevakis
8d21fc9229 usb-drv-arc: Kill trailing whitespace
Change-Id: I682a8b68fa8148e5db2e06e4f261b1ea01d140ad
2013-05-14 22:05:51 -04:00
Michael Sevakis
af4c55bd11 Set the right variable type for ucallback :)
Change-Id: I19eace9452d9d0b2a6c7770549930c83ece05c80
2013-05-11 21:20:49 -04:00
Michael Sevakis
0a7d941fb9 i.MX31: Remove long udelay from DVFS interrupt handler
Split the ISR into two parts and alllow quick return from first half.

Introduces a uevent() API to have a callback happen in a specified
number of microseconds. Right now only one event is supported.

Change-Id: Ib1666165be2f6082e5275d64961f083cab104f9f
2013-05-11 21:09:01 -04:00
Dominik Riebeling
4877f618d6 Rework rbspeex dependency generation to use single dependency files.
Similar as done in d2b8f91 change dependency generation to use one file per
source file. This removes the need to have external tools installed on Windows.
Previously Cygwin or msys tools needed to be in the system PATH which was
problematic at times.

This means that now building on Windows (using MinGW) doesn't require
additional tools anymore.

Change-Id: I4c0675e99c3cc3a729b91beefd58320db498ae0a
2013-05-11 20:34:12 +02:00
Dominik Riebeling
071ccc78a9 Update mkrk27boot Makefile for libtools.make changes.
Change-Id: Iebcb3be6024c2fa6ec94a38b8bb1cb0c7274eb85
2013-05-11 20:34:12 +02:00
Dominik Riebeling
e073bc9484 Implement dependency generation in libtools.make.
Automatically generate dependency files for all sources so changes in headers
are picked up automatically. Use one dependency file for each source file,
since that allows to create them without using external tools (except the
compiler of course).

Change-Id: I246c1ceb525692547af22a2e32c4bab0c11507e1
2013-05-11 20:34:12 +02:00
Dominik Riebeling
9a9efefdb2 ucl: Replace use of uname by checking the compiler output.
Similar as done for libtools.make ask the compiler for the binary it creates
instead of using uname to figure the target to avoid special handling when
cross compiling.

Change-Id: Icb4654616e4339bf9e6e3be5177b35e0bb313bcd
2013-05-11 20:34:12 +02:00
Dominik Riebeling
4f3fa9accb Change mkdir -p to work on Windows.
Windows mkdir doesn't know about the -p option and requires paths to use \ as
path separator. Try to detect when building on Windows and use the Windows
internal function instead of relying on a compatible mkdir in the path.

Change-Id: I47d47d45edeb38c672321f77d6e91268bf744dba
2013-05-11 20:34:12 +02:00
Dominik Riebeling
8a4075d454 Make libtools compile rule more generic.
Create the object - source dependency internally and use a more generic rule
for compiling. Removes the need for explicit rules for source files located in
a different folder.

This adds the limitation for SOURCES and LIBSOURCES to only hold C files.

Change-Id: I56f6a4b1e7df36347cd2f54051e072251f456092
2013-05-11 20:34:11 +02:00
Marcin Bukat
440872bb42 rk27xx: Use DMA for lcd_update_rect()
This speeds up partial updates quite a bit but what is more
important it opens up a way to efficiently implement
lcd_blit_yuv() using hw colorspace conversion.

Tested on rk27generic, hm60x v1 and v2 and on ma9.

Benchmark for hm60x v1 (by mortalis):
HEAD patched
1/1 141fps 138fps
1/4 315fps 395fps

Change-Id: I4cc115786c3139000fc14c49a7290e289cfd6c42
2013-05-11 12:55:23 +02:00
Marcin Bukat
ca8154741f rk27xx: Slightly refactor lcd_set_gram_area()
Change-Id: I1040164220dd87b19b58be560eb5b628857bc284
2013-05-11 12:30:38 +02:00
Marcin Bukat
3f4824b94f rk27xx: Decide lcd databus width at compile time
Change-Id: I013da0f3f862e733c5245a48dceb08219f43bf2d
2013-05-11 12:16:39 +02:00
Dominik Riebeling
8568a8de13 Set APPVERSION globally for extralibs Makefile.
Make sure its value quotes are properly escaped. Otherwise make on Windows
causes problems. Also, expand CPPDEFINES only once.

Change-Id: I52e91f17626b2596f389811b22abc12d94f721d1
2013-05-10 17:48:01 +02:00
Dominik Riebeling
7ab7f865dc Restructure options passed to libs Makefile.
Setup AR before checking for ccache to avoid adding ccache to ar. Setup CC and
CFLAGS in the beginning as well. Quote ar and system speex options to fix
building with ccache enabled.

Change-Id: I21714f0849e990abeac72dcda52c81474e090934
2013-05-10 12:02:18 +02:00
Michael Sevakis
b210a3a8cb Fix FS#12860 - iPod 5g line out silent
Conversion from centibels to register values was left out of
audiohw_set_lineout_volume().

Credit goes to Dave Marsh for providing the fix.

Just another little oversight from sound/audiohw rework.

Change-Id: I7f8b1c5fb575ac95b5d595c2f4824fbb5ebbd3c8
2013-05-09 15:37:56 -04:00
Dominik Riebeling
f7d8b2db93 Only pass AR to extralibs Makefile if the compiler is gcc.
We need this only for cross compiling. Trying to figure the compiler prefix
fails if the compiler isn't gcc (i.e. clang), and we only support gcc when
cross compiling.

Change-Id: I822e1b47ec7e9d7e9fdeae8ccf3b8d417a472ef9
2013-05-09 17:23:42 +02:00
Dominik Riebeling
9e9f692678 Fix Rockbox Utility building on OS X.
Fix a typo that broke building. Also extend the extralibs Makefile to allow
calling it directly.

Change-Id: I2d4dd1689a8654a6b092dfcc58d2753423831816
2013-05-09 16:11:00 +02:00
Andrew Ryabinin
d04bd89bbd hm60x: Implement lcd_enable() for v2 display.
Change-Id: I5ed0cba03711b3ba6db58405fe805d92aece974e
2013-05-09 16:08:17 +04:00
Andrew Ryabinin
83554cce8d hm60x: Implement lcd_update_rect for v2 display.
Change-Id: I9d6b14bcbd26cfd760516f1ef3bf421698507806
2013-05-08 18:30:32 +04:00
Michael Sevakis
fce81a8a74 Rename all the "lin_resample..." stuff to simply "resample_...".
Change-Id: I79f44f0dcc1b23b33a5040795220713660a1d18a
2013-05-07 00:35:46 -04:00