Commit graph

12 commits

Author SHA1 Message Date
Michael Sevakis
1654efc313 Unify storage threads into one
* Editing a bunch of drivers' thread routines in order to
implement a new feature is tedious.

* No matter the number of storage drivers, they share one thread.
No extra threads needed for CONFIG_STORAGE_MULTI.

* Each has an event callback called by the storage thread.

* A default callback is provided to fake sleeping in order to
trigger idle callbacks. It could also do other default processing.
Changes to it will be part of driver code without editing each
one.

* Drivers may sleep and wake as they please as long as they give
a low pulse on their storage bit to ask to go into sleep mode.
Idle callback is called on its behalf and driver immediately put
into sleep mode.

* Drivers may indicate they are to continue receiving events in
USB mode, otherwise they receve nothing until disconnect (they
do receive SYS_USB_DISCONNECTED no matter what).

* Rework a few things to keep the callback implementation sane
and maintainable. ata.c was dreadful with all those bools; make
it a state machine and easier to follow. Remove last_user_activity;
it has no purpose that isn't served by keeping the disk active
through last_disk_activity instead.

* Even-out stack sizes partly because of a lack of a decent place
to define them by driver or SoC or whatever; it doesn't seem too
critical to do that anyway. Many are simply too large while at
least one isn't really adequate. They may be individually
overridden if necessary (figure out where). The thread uses the
greatest size demanded. Newer file code is much more frugal with
stack space. I barely see use crack 50% after idle callbacks
(usually mid-40s). Card insert/eject doesn't demand much.

* No forcing of idle callbacks. If it isn't necessary for one or
more non-disk storage types, it really isn't any more necessary for
disk storage. Besides, it makes the whole thing easier to implement.

Change-Id: Id30c284d82a8af66e47f2cfe104c52cbd8aa7215
2017-10-26 14:35:41 -04:00
Rafaël Carré
e0e24cbf0a Merge tCardInfo struct (MMC) and tSDCardInfo struct (SD)
Put specific members under #ifdef (CONFIG_STORAGE & STORAGE_xx) (2 members for SD and 1 for MMC)
Fix a typo: tsac doesn't exist and must be read taac
Move card_get_info functions declaration inside hotswap.h to remove mutual inclusion of ata_mmc.h and hotswap.h
Move static const data structures from SD drivers into sd.h (sd_exponent and sd_mantissa)
Fix sd_command prototypes in SD drivers (card registers are unsigned long)
Fix speed calculation in Sansa AMS driver (PP SD driver needs to be checked)
Move ata-sd-target.h to sd-pp-target.h to reflect the PP specifity. Now it only contains declaration of microsd_int()
Remove unused ata-sd-target.h for injenic

TODO:
- check if CSD register bits are extracted correctly in PP driver
- correctly define read_timeout and write_timeout unit for MMC & SD, and use timeouts in Sansa AMS driver

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21586 a1c6a512-1295-4272-9138-f99709370657
2009-07-01 10:07:22 +00:00
Daniel Stenberg
2acc0ac542 Updated our source code header to explicitly mention that we are GPL v2 or
later. We still need to hunt down snippets used that are not. 1324 modified
files...
http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-06-28 18:10:04 +00:00
Michael Sevakis
1167e3c72f Accept FS#7134 - Sansa: external sd card support by Antonius Hellmann with some tweaks. All testers have given the green light. (Now for the RED ?? ;).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13741 a1c6a512-1295-4272-9138-f99709370657
2007-06-30 02:08:27 +00:00
Jens Arnold
8f1ace7525 Ondio: Fix multivolume and hotswap for the old MMC clock circuit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6502 a1c6a512-1295-4272-9138-f99709370657
2005-05-22 00:42:00 +00:00
Jens Arnold
27abc2a641 (1) Early USB detection on boot, before trying to mount the partitions. Cleaner & quicker; removes the need for the extra USB check at the top of ask_resume() which caused a deadlock in screenshot mode (see patch #1110332). On Ondio, this allows to leave an MMC in the slot when booting with USB connected for instant access. (2) Ondio: Track MMC status, only ask to remove the card if required. Probe MMC status if unknown.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6488 a1c6a512-1295-4272-9138-f99709370657
2005-05-17 22:10:51 +00:00
Jens Arnold
15d7077c3a Hotswap: Avoid mount race at startup and after returning from USB mode.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6479 a1c6a512-1295-4272-9138-f99709370657
2005-05-16 13:25:02 +00:00
Jens Arnold
a7f7781dca MMC driver does now handle block sizes != 512 bytes, which is necessary to support cards > 1 GB. Changed error handling to use the same method as other parts of rockbox, allowing to trace the call chain. Long policy, code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6366 a1c6a512-1295-4272-9138-f99709370657
2005-04-28 01:11:21 +00:00
Jörg Hohensohn
7e1d36f35b Ondio: disk activity indication in USB mode, too
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6020 a1c6a512-1295-4272-9138-f99709370657
2005-02-19 14:45:34 +00:00
Jens Arnold
404fd12aae MMC driver now panics on out-of-bound accesses.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5768 a1c6a512-1295-4272-9138-f99709370657
2005-02-04 00:58:47 +00:00
Jens Arnold
5789ee9928 MMC hotswap handling in USB mode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5247 a1c6a512-1295-4272-9138-f99709370657
2004-10-10 19:51:11 +00:00
Jens Arnold
6f9a7eb2c7 Enhanced MMC handling: Driver cleanup, timeout calculation fixed, allowed voltage check, maintain disk activity info (fixes immediate shutdown at end of playback). MMC debug menu item populated.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5193 a1c6a512-1295-4272-9138-f99709370657
2004-10-06 20:43:12 +00:00