Commit graph

28 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
Michael Sevakis
6db80020b4 Do some housekeeping with fat.h and SECTOR_SIZE
Many includes of fat.h are pointless. Some includes are just for
SECTOR_SIZE. Add a file 'firmware/include/fs_defines.h' for that
and to define tuneable values that were scattered amongst various
headers.

Remove some local definitions of SECTOR_SIZE since they have to be
in agreement with the rest of the fs code anyway.

(We'll see what's in fact pointless in a moment ;)

Change-Id: I9ba183bf58bd87f5c45eba7bd675c7e2c1c18ed5
2017-03-12 22:05:44 -04:00
Thomas Martitz
22a28f9caa Add missing kernel.h includes (hopefully all of them).
Change-Id: I9c1825296a788587b8d494d8514b3314847b0ff0
2014-01-05 20:32:09 +01:00
Michael Sevakis
a56f1ca1ed Cleanup MV/MD macros a little.
When using variadic macros there's no need for IF_MD2/IF_MV2 to deal
with function parameters. IF_MD/IF_MV are enough.

Throw in IF_MD_DRV/ID_MV_VOL that return the parameter if MD/MV, or 0
if not.

Change-Id: I7605e6039f3be19cb47110c84dcb3c5516f2c3eb
2013-08-17 12:18:22 -04:00
Thomas Martitz
d0b72e2590 GSoC/Buflib: Add buflib memory alocator to the core.
The buflib memory allocator is handle based and can free and
compact, move or resize memory on demand. This allows to effeciently
allocate memory dynamically without an MMU, by avoiding fragmentation
through memory compaction.

This patch adds the buflib library to the core, along with
convinience wrappers to omit the context parameter. Compaction is
not yet enabled, but will be in a later patch. Therefore, this acts as a
replacement for buffer_alloc/buffer_get_buffer() with the benifit of a debug
menu.

See buflib.h for some API documentation.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30380 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 14:01:33 +00:00
Michael Sparmann
f0a96580ae Core changes to allow storage drivers to do cleanup on shutdown, and iPod Nano 2G shutdown code rework (FS#10668)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23057 a1c6a512-1295-4272-9138-f99709370657
2009-10-09 20:36:09 +00:00
Bertrik Sikken
69b40e704d Clean up duplicate #includes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22845 a1c6a512-1295-4272-9138-f99709370657
2009-09-27 14:46:44 +00:00
Vitja Makarov
d9490178ff ata-nand-telechips: tcc77x have now USEC_TIMER
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22763 a1c6a512-1295-4272-9138-f99709370657
2009-09-21 08:53:24 +00:00
Vitja Makarov
36e8fc0872 tcc77x: add tcc77x_cscfg_bw() helper for external memory bus width setup
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22729 a1c6a512-1295-4272-9138-f99709370657
2009-09-18 05:48:37 +00:00
Rob Purchase
e783d0c82a TCC: Implement ECC error correction for sectors read from NAND. Tested on D2 (78x, MLC) and M200 (77x, SLC).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22284 a1c6a512-1295-4272-9138-f99709370657
2009-08-12 19:26:04 +00:00
Frank Gevaerts
c0a5a67387 Commit FS#9545, storage cleanup and multi-driver support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21933 a1c6a512-1295-4272-9138-f99709370657
2009-07-17 22:28:49 +00:00
Rafaël Carré
bdb5974c0e Revert r21912 : "Storage API : remove undeeded target-specific functions"
After a discussion mixed on mailing list and irc, it was agreed that
more abstraction for plugins is better (so developers don't have to add
a check to HAVE_DISK_STORAGE when writing disk-specific code)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21923 a1c6a512-1295-4272-9138-f99709370657
2009-07-17 16:34:34 +00:00
Rafaël Carré
8eba69f91b Storage API : remove undeeded target-specific functions
storage_sleep, storage_spin, storage_spindown are only defined if #defiend (HAVE_DISK_STORAGE), not for MMC/ATA/SD
remove already unneeded nand_disk_is_active, nand_soft_reset

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21912 a1c6a512-1295-4272-9138-f99709370657
2009-07-17 00:09:14 +00:00
Rob Purchase
9cb62038e3 Make the TCC NAND driver use the (virtual) disk activity LED.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21748 a1c6a512-1295-4272-9138-f99709370657
2009-07-10 16:55:18 +00:00
Rob Purchase
5e24a2c98c Fix an error in the TCC NAND driver which caused a panic on startup for certain users.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21485 a1c6a512-1295-4272-9138-f99709370657
2009-06-24 07:36:56 +00:00
Rob Purchase
67c86a76d9 TCC78x: Make the NAND driver yield during reads (thanks to bertrik for spotting the obvious error that caused this to crash until now). Fixes the D2 'delay before playback starts' bug.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21465 a1c6a512-1295-4272-9138-f99709370657
2009-06-22 18:06:08 +00:00
Bertrik Sikken
c99ab564b0 Fix more missing mutex_init calls.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21463 a1c6a512-1295-4272-9138-f99709370657
2009-06-21 22:06:22 +00:00
Rob Purchase
9f6e117e82 TCC NAND: The BLOCKS_PER_SEGMENT define was actually the number of planes mentioned in the Samsung NAND datasheet. Add this to the nand_id struct, so that it can be runtime detected (required for some D2s to boot). Use the struct directly instead of making a local copy, and format the nand_info table to 80 columns.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20186 a1c6a512-1295-4272-9138-f99709370657
2009-03-02 23:36:12 +00:00
Rob Purchase
93f3367f42 Telechips NAND: much improved read reliability on D2/iAudio7. More work is required for M200/DAX, but an improvement is evident nonetheless. LPT buffers are now buffer_alloc'd after determining the required size, so most targets should also see a healthy reduction in RAM usage.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19118 a1c6a512-1295-4272-9138-f99709370657
2008-11-16 15:44:49 +00:00
Frank Gevaerts
430343bca7 implement single-driver storage layer with macros instead of inlines
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18975 a1c6a512-1295-4272-9138-f99709370657
2008-11-02 01:14:46 +00:00
Frank Gevaerts
19eb800f75 conditionalise *_get_info() to get some binsize back
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18965 a1c6a512-1295-4272-9138-f99709370657
2008-11-01 17:33:21 +00:00
Frank Gevaerts
2f8a0081c6 Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do that, it also introduces sd_*, nand_*, and mmc_*.
This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD).


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657
2008-11-01 16:14:28 +00:00
Vitja Makarov
c4fdd2e788 Fill some ata_identify fields, e.g model name, firmware, block count
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18725 a1c6a512-1295-4272-9138-f99709370657
2008-10-07 05:04:11 +00:00
Rob Purchase
e682143af5 Telechips NAND: split out a couple of small functions to help readability, and add a note about LPT blocks. No functional changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18440 a1c6a512-1295-4272-9138-f99709370657
2008-09-07 19:44:23 +00:00
Dave Chapman
d462a64a91 Initial commit of iaudio 7 port by Vitja Makarov (FS#9245). Port is at quite an advanced stage, but is troubled by the lack of a reliable NAND driver (similar to the Cowon D2 port) and is not yet suitable for non-developers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18435 a1c6a512-1295-4272-9138-f99709370657
2008-09-06 17:50:59 +00:00
Rob Purchase
635ad63539 Fix yellow
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18064 a1c6a512-1295-4272-9138-f99709370657
2008-07-15 21:46:46 +00:00
Rob Purchase
3352b265e6 Update the Telechips NAND driver to use the nand_identify() function introduced in r18052.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18063 a1c6a512-1295-4272-9138-f99709370657
2008-07-15 21:32:20 +00:00
Rob Purchase
ee72b3bbc6 Make the TCC780x NAND driver also build for 77x targets. This is work-in-progress stuff and does not yet work fully on 77x, but it's a step in the right direction. Also replace some magic numbers with #defines.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18019 a1c6a512-1295-4272-9138-f99709370657
2008-07-12 23:01:49 +00:00
Renamed from firmware/target/arm/tcc780x/ata-nand-tcc780x.c (Browse further)