Commit graph

48 commits

Author SHA1 Message Date
Michael Sevakis
184459fa54 Deal with a complication when transferring recording method from PP5024: since the FIFO POP is always read until empty, keep track of sample parity instead of always saving the first one in the FIFO upon entering the ISR or else the first of a duplicate that is also the last in the FIFO would get duplicated. Also, give top priority to audio interrupts in all cases.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31218 a1c6a512-1295-4272-9138-f99709370657
2011-12-12 20:12:22 +00:00
Frank Gevaerts
85ad768b6e Don't use NUM_VOLUMES as array size in sd card drivers. NUM_DRIVES is also wrong (the total number of drives in the system is not really related to the number of sd devices), but at least it's less wrong than NUM_VOLUMES and it matches the (wrong) assumptions the rest of the drivers make
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30569 a1c6a512-1295-4272-9138-f99709370657
2011-09-18 12:51:54 +00:00
Bertrik Sikken
8d1d2f8982 AMS: consistently use bitclr32/bitset32/bitmod32 for register CCU_IO (instead of using |= or &= )
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29748 a1c6a512-1295-4272-9138-f99709370657
2011-04-18 21:13:40 +00:00
Bertrik Sikken
c2ca4bec9d AMSv1 sd: work-around for detection problem with some sd cards (delay after switching to high-speed)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29746 a1c6a512-1295-4272-9138-f99709370657
2011-04-18 20:08:47 +00:00
Bertrik Sikken
59e37cbccb AMS sd: use defines instead of direct values for drive number
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29696 a1c6a512-1295-4272-9138-f99709370657
2011-04-09 07:57:53 +00:00
Michael Sevakis
12375d1d3a Merge functionality of wakeups and semaphores-- fewer APIs and object types. semaphore_wait takes a timeout now so codecs and plugins have to be made incompatible. Don't make semaphores for targets not using them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29492 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 08:49:38 +00:00
Michael Sevakis
453550a687 Try to get some control over #ifdef hell in usb.c by refactoring and inline function use. SYS_USB_DISCONNECTED_ACK hasn't been doing anything useful for the USB thread; remove it. USB thread simply ignores that value. Observe only valid usb_state transitions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29084 a1c6a512-1295-4272-9138-f99709370657
2011-01-18 14:10:06 +00:00
Fred Bauer
e541c98a7e revert r28834 because it causes problems with uSD
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28925 a1c6a512-1295-4272-9138-f99709370657
2010-12-29 16:07:15 +00:00
Fred Bauer
279dff1c21 FS#11765: Improve AMSv1 Battery Life by Lowering CPU and Peripheral clocks. Unboosted CPU and peripheral clock is now 31MHz. Boosted CPU and pclk are 186MHz and 62MHz, respectively.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28834 a1c6a512-1295-4272-9138-f99709370657
2010-12-14 22:08:43 +00:00
Thomas Martitz
f09499f70f Change sd-as3525*.c to the new cache coherency function names.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28046 a1c6a512-1295-4272-9138-f99709370657
2010-09-08 17:16:52 +00:00
Rafaël Carré
8de2af7b9c sd-as3525*: use AS3525_PHYSICAL_ADDR
fix DMA buffers when the src/dst is in IRAM
It worked fine because all the buffers are in DRAM, and the virtual
address happens to be the physical address

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27876 a1c6a512-1295-4272-9138-f99709370657
2010-08-25 11:10:40 +00:00
Thomas Martitz
0e2286f226 Introduce NORETURN_ATTR wrapper for __attribute__((noreturn)), using this and a bit further cleanup in main gets rid of a warning when compiling for android.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27788 a1c6a512-1295-4272-9138-f99709370657
2010-08-12 13:38:25 +00:00
Rafaël Carré
08c600ca07 sd-as3525.c: disable widebus again, it causes read corruptions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27495 a1c6a512-1295-4272-9138-f99709370657
2010-07-19 16:08:57 +00:00
Rafaël Carré
b221d6d4d4 as3525*: use atomic bit manipulation for CCU_IO
fuzev2 button_read_device() runs in interrupt context so writes are atomic

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27494 a1c6a512-1295-4272-9138-f99709370657
2010-07-19 15:56:15 +00:00
Michael Sevakis
0f47ffe0e4 AMS SoC's: Some register bit changes need interrupt protection: timer API and CGU_PERI.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27236 a1c6a512-1295-4272-9138-f99709370657
2010-07-02 06:00:00 +00:00
Tobias Diedrich
f4a00174b5 sd-as3525.c: handle acmd retries correctly
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27187 a1c6a512-1295-4272-9138-f99709370657
2010-06-29 21:49:20 +00:00
Tobias Diedrich
23cf76c2af mutex_lock/unlock must be moved up a level to make the verify code in sd-as3525.c safe
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27180 a1c6a512-1295-4272-9138-f99709370657
2010-06-29 19:12:57 +00:00
Tobias Diedrich
a035ed4cb0 Fix sd-as3525.c build for non-multidrive targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27114 a1c6a512-1295-4272-9138-f99709370657
2010-06-24 19:12:14 +00:00
Tobias Diedrich
90602ae076 Fix the pesky write corruption bug in 4bit mode.
On tx underruns, a write is aborted early, leaving the dma channel active.
We didn't explicitly disable it, so there were still 4 words in the dma
controller fifo, corrupting the retried write.

To chase this bug I added verify after write, if no one sees write errors in
the next week or so this can be removed.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27113 a1c6a512-1295-4272-9138-f99709370657
2010-06-24 18:57:11 +00:00
Rafaël Carré
cf9bba7102 sd-as3525.c: get rid of MCI_ARG
We always need to write MCI_ARGUMENT register so if the command expects
no argument just set the function argument to 0
Code is now similar to as3525v2

hint: merging the 2 and/or all the SD drivers would be nice

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27088 a1c6a512-1295-4272-9138-f99709370657
2010-06-23 13:40:25 +00:00
Rafaël Carré
b4ce43f5cc sd-as3525.c: disable wide bus, it corrupts writes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27087 a1c6a512-1295-4272-9138-f99709370657
2010-06-23 13:33:07 +00:00
Rafaël Carré
28bcc17dde revert r27044 (which was a revert of r26953 & r26954)
The bug was in playback.c and was fixed in previous commit

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27074 a1c6a512-1295-4272-9138-f99709370657
2010-06-23 04:34:23 +00:00
Tobias Diedrich
1396c335ac The mci_delay()s should be unnecessary if we properly tell the controller to wait for the response these commands send back to the host.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27066 a1c6a512-1295-4272-9138-f99709370657
2010-06-22 21:49:33 +00:00
Tobias Diedrich
6e45f87e0f Give 4-bit mode another chance on AMSv1 since other bugs were fixed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27065 a1c6a512-1295-4272-9138-f99709370657
2010-06-22 21:44:42 +00:00
Rafaël Carré
5a44e43870 revert r26953 + r26954
test_disk says everything is alright but playback is buggy, especially
when playing lossless files

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27044 a1c6a512-1295-4272-9138-f99709370657
2010-06-22 09:02:56 +00:00
Rafaël Carré
4329512017 fix r26953: use physical address for DMA buffer, also for IRAM
AMSv2 and AMSv1 lowmem put the codec buffer in IRAM so we need to adjust
the address : AS3525_PHYSICAL_ADDRESS macro will do just that

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26954 a1c6a512-1295-4272-9138-f99709370657
2010-06-19 05:55:18 +00:00
Rafaël Carré
ffc7323ec3 sd-as3525*: handle aligned transfers without memcpy()
test_disk shows 1MB transfers are up to 3 times faster
not much difference for 1 or 8 sectors at a time
define STORAGE_WANTS_ALIGN to use the fast path when possible

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26953 a1c6a512-1295-4272-9138-f99709370657
2010-06-19 04:55:10 +00:00
Rafaël Carré
fd715fa95c as3525*: enable MMU in bootloader
Reserve 1MB of DRAM for loading rockbox and use the rest as BSS
Write sdram setup in assembler and move it to a separate file, together
with MMU init code

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26926 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 17:33:51 +00:00
Rafaël Carré
6470a9ffd1 sd-as3525: enable writing, sd_enable() and card_get_info_target() in bootloader
They will be needed for USB

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26904 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 01:47:34 +00:00
Tobias Diedrich
69028d5d31 sd-as3525 was calling dma_release() without calling dma_retain() first, if
no card is in the sd slot.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26896 a1c6a512-1295-4272-9138-f99709370657
2010-06-17 19:14:42 +00:00
Frank Gevaerts
9c43b2ce17 Remove card_enable_monitoring() and use a mutex instead. The card_enable_monitoring() method actually didn't eliminate the possible race conditions it was meant to fix.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26627 a1c6a512-1295-4272-9138-f99709370657
2010-06-06 13:20:47 +00:00
Frank Gevaerts
a0557b23f0 remane hotswap.* to sdmmc.*. The contents have nothing at all to do with hotswapping things
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26598 a1c6a512-1295-4272-9138-f99709370657
2010-06-05 21:12:16 +00:00
Rafaël Carré
bf3e50b89b sd-as3525v1: do not disable peripheral clocks in sd_enable()
(forward port of r26481 + cosmetics)
This lead to freezes under various conditons (bug report: FS#11267)

Battery life is almost not (if at all) affected:
- between 4 and 8 minutes less runtime for fuzev1
- 9 minutes less runtime for c200v2 (2 minutes difference on a 2 hours run)

Additional verifications of the runtime (including on other models) wouldn't hurt

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26512 a1c6a512-1295-4272-9138-f99709370657
2010-06-03 13:55:42 +00:00
Rafaël Carré
acb524e51a sd-as3525v1: set up bank selection data outside of the loop
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26441 a1c6a512-1295-4272-9138-f99709370657
2010-06-01 03:50:52 +00:00
Jack Halpin
8b6356d08a sd-as3525.c: Do not wait for TRAN state after transfer is over.
Waiting for TRAN state after the end of the transfer caused writing problems for some uSD cards.  Removing this wait returns write functionality to those cards.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26365 a1c6a512-1295-4272-9138-f99709370657
2010-05-28 21:47:36 +00:00
Rafaël Carré
ff9474e558 as3525v1: relax a bit requirements in the SD driver
- retry failed commands up to 6 times
- wait at most 5 seconds for the card to go to TRAN state

- wait for the card to be in TRAN state (i.e. not programming) before
  disabling SD clocks (remove the workaround in sd_enable() )

should fix lockups reported on fuzev1 under heavy internal storage + µSD use
(playback + database/pictureflow updating)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26291 a1c6a512-1295-4272-9138-f99709370657
2010-05-25 21:55:09 +00:00
Rafaël Carré
13f159df57 as3525*: sd_wait_for_state() is only used for waiting to SD_TRAN state
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26251 a1c6a512-1295-4272-9138-f99709370657
2010-05-24 15:07:15 +00:00
Rafaël Carré
6b46cc08ed as3525: hide our UNCACHED_ADDR from usb_storage.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26178 a1c6a512-1295-4272-9138-f99709370657
2010-05-19 18:13:06 +00:00
Rafaël Carré
627baea953 sd-as3525: wait 100µs before disabling SD clocks
test_disk doesn't freeze anymore when closing the file between writing & reading

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26164 a1c6a512-1295-4272-9138-f99709370657
2010-05-19 14:06:13 +00:00
Rafaël Carré
b3a8170afe sd-as3525: avoid division when calculating current bank, we only deal with 1 or 2 banks
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26161 a1c6a512-1295-4272-9138-f99709370657
2010-05-19 12:11:57 +00:00
Rafaël Carré
a53785911a sd-as3525: give timeout in HZ units, not in ticks
remove a TODO fixed in r26029

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26159 a1c6a512-1295-4272-9138-f99709370657
2010-05-19 12:11:50 +00:00
Rafaël Carré
c785722fec as3525: make sure we don't use a negative number of sectors
Better be safe than sorry, don't try to read/write outside our storage,
because we might overwrite the OF on the internal storage

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26077 a1c6a512-1295-4272-9138-f99709370657
2010-05-16 10:24:31 +00:00
Rafaël Carré
0f77db7346 as3525: fix capacity sanity check
adjust logical starting sector to physical starting sector after the check
number of blocks is already adjusted from physical to logical
don't panic anymore when accessing the last part of storage

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26050 a1c6a512-1295-4272-9138-f99709370657
2010-05-15 12:01:53 +00:00
Rafaël Carré
84b7747069 as3525v1: detect correctly internal storage capacity
check if SD transfers fit with the card capacity

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26029 a1c6a512-1295-4272-9138-f99709370657
2010-05-14 21:41:29 +00:00
Thomas Martitz
249aae587a FS#11172 - Fuzev2: Read the scrollwheel scrollwheel via IRQ
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25736 a1c6a512-1295-4272-9138-f99709370657
2010-04-27 10:11:52 +00:00
Thomas Martitz
845af676f8 as3525(v2): Add a somewhat inaccurate udelay (-0.5/+1.0µs). It should work good for some huge delays.
Use it in fuzev2 to improve some big delays (correct the biggest one to actually wait for the fifo to empty), and use it in the sd drivers.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25734 a1c6a512-1295-4272-9138-f99709370657
2010-04-27 09:34:29 +00:00
Rafaël Carré
c3c7306098 sd-as3525: do not reverse 2 times long responses, read them directly in the needed order
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25185 a1c6a512-1295-4272-9138-f99709370657
2010-03-14 21:46:25 +00:00
Rafaël Carré
6c93570b90 Sansa AMS: remove "ata" from SD drivers filenames
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24237 a1c6a512-1295-4272-9138-f99709370657
2010-01-15 14:03:41 +00:00
Renamed from firmware/target/arm/as3525/ata_sd_as3525.c (Browse further)