summaryrefslogtreecommitdiffstats
path: root/firmware/export/sd.h
AgeCommit message (Collapse)AuthorFilesLines
2017-10-26Unify storage threads into oneMichael Sevakis1-1/+1
* 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
2013-12-06storage: fix MD vs MV confusionAmaury Pouly1-2/+2
Change-Id: If0e4b0ac8b24413b77f1d67293c652c6a0e01bbd
2013-08-17Cleanup MV/MD macros a little.Michael Sevakis1-3/+3
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
2011-12-19Add more INIT_ATTR and add config.h includes to header files with INIT_ATTR.Boris Gjenero1-0/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31370 a1c6a512-1295-4272-9138-f99709370657
2011-11-20Add INIT_ATTR to storage_init() when possibleRafaël Carré1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31036 a1c6a512-1295-4272-9138-f99709370657
2011-01-15Bootloader USB mode for PP502x. Enable only on GoGear SA9200 for the time ↵Michael Sevakis1-0/+4
being. Add HAVE_BOOTLOADER_USB_MODE to config if BOOTLOADER is defined to enable it. Clean up some kernel stuff a little to support it. Mess up a bunch of other stuff (hopefully not too badly). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29053 a1c6a512-1295-4272-9138-f99709370657
2010-06-06Remove card_enable_monitoring() and use a mutex instead. The ↵Frank Gevaerts1-1/+0
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
2009-11-26Remove unused card_detect(), and make card_detect_target() static inline in ↵Thomas Martitz1-2/+0
each sd driver. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23757 a1c6a512-1295-4272-9138-f99709370657
2009-11-07sd.h: No functional changes to present code. Added some additional SD ↵Jack Halpin1-28/+50
CMD's and a #define for card errors flagged in an R1 response. Add SD_SD_STATUS(ACMD13), SD_SET_WR_BLK_ERASE_COUNT(ACMD23), SD_PROGRAM_CSD(CMD27). Add #define SD_R1_CARD_ERROR to make card error checking easier. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23560 a1c6a512-1295-4272-9138-f99709370657
2009-10-25Add define for SD_SET_CLR_CARD_DETECT 42 /* acmd42 */ to sd.h for use with ↵Jack Halpin1-0/+1
4 bit WIDEBUS. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23340 a1c6a512-1295-4272-9138-f99709370657
2009-10-22Working Bootloader for mini2440. Dominik Wenger1-0/+43
Flyspray: FS#10701 Author: Bob Cousins git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23316 a1c6a512-1295-4272-9138-f99709370657
2009-07-17Commit FS#9545, storage cleanup and multi-driver supportFrank Gevaerts1-8/+15
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21933 a1c6a512-1295-4272-9138-f99709370657
2009-07-17Revert r21912 : "Storage API : remove undeeded target-specific functions"Rafaël Carré1-0/+3
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-17Storage API : remove undeeded target-specific functionsRafaël Carré1-3/+0
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-01Ingenic jz4740 SD driver: remove custom list of SD commandsRafaël Carré1-4/+4
Replace most references to MMC/mmc with SD/sd Remove MMC failover code since MMC cards aren't supported git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21604 a1c6a512-1295-4272-9138-f99709370657
2009-07-01add firmware/driver/sd.c which contains common code between SD driversRafaël Carré1-5/+2
ingenic SD driver needs more cleanup so it still doesn't use the common code correct a comment in hotswap.c: card_extract_bits assume most significant word of register first (so, use this order) fix debug menu which used MMC specific commands / bits positions in csd/cid move the default block size of 512 into sd.h move the mantissa & exponent table into a single file (sd.c) to reduce binsize. we don't need to export it anymore anyway TODO : ingenic cleanup (will happen soon so building sd.c is not conditional) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21601 a1c6a512-1295-4272-9138-f99709370657
2009-07-01Merge tCardInfo struct (MMC) and tSDCardInfo struct (SD)Rafaël Carré1-0/+8
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
2008-11-09sd.h : avoid namespace collision by prefixing defines with SD_Rafaël Carré1-34/+34
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19055 a1c6a512-1295-4272-9138-f99709370657
2008-11-09SD PP: move non specific defines to sd.h, to be reused by other SD driversRafaël Carré1-0/+40
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19043 a1c6a512-1295-4272-9138-f99709370657
2008-11-04Since *set_led_enabled() is actually an ata-specific feature, move it back ↵Frank Gevaerts1-4/+0
to ata_* only git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19006 a1c6a512-1295-4272-9138-f99709370657
2008-11-04*_hard_reset() is only used inside ata.c, so there's no need to export it to ↵Frank Gevaerts1-1/+0
the world git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19004 a1c6a512-1295-4272-9138-f99709370657
2008-11-01conditionalise *_get_info() to get some binsize backFrank Gevaerts1-0/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18965 a1c6a512-1295-4272-9138-f99709370657
2008-11-01Now also commit added filesFrank Gevaerts1-0/+54
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18961 a1c6a512-1295-4272-9138-f99709370657