summaryrefslogtreecommitdiffstats
path: root/bootloader/gigabeat-s.c
AgeCommit message (Collapse)AuthorFilesLines
2014-08-30Rewrite filesystem code (WIP)Michael Sevakis1-7/+9
This patch redoes the filesystem code from the FAT driver up to the clipboard code in onplay.c. Not every aspect of this is finished therefore it is still "WIP". I don't wish to do too much at once (haha!). What is left to do is get dircache back in the sim and find an implementation for the dircache indicies in the tagcache and playlist code or do something else that has the same benefit. Leaving these out for now does not make anything unusable. All the basics are done. Phone app code should probably get vetted (and app path handling just plain rewritten as environment expansions); the SDL app and Android run well. Main things addressed: 1) Thread safety: There is none right now in the trunk code. Most of what currently works is luck when multiple threads are involved or multiple descriptors to the same file are open. 2) POSIX compliance: Many of the functions behave nothing like their counterparts on a host system. This leads to inconsistent code or very different behavior from native to hosted. One huge offender was rename(). Going point by point would fill a book. 3) Actual running RAM usage: Many targets will use less RAM and less stack space (some more RAM because I upped the number of cache buffers for large memory). There's very little memory lying fallow in rarely-used areas (see 'Key core changes' below). Also, all targets may open the same number of directory streams whereas before those with less than 8MB RAM were limited to 8, not 12 implying those targets will save slightly less. 4) Performance: The test_disk plugin shows markedly improved performance, particularly in the area of (uncached) directory scanning, due partly to more optimal directory reading and to a better sector cache algorithm. Uncached times tend to be better while there is a bit of a slowdown in dircache due to it being a bit heavier of an implementation. It's not noticeable by a human as far as I can say. Key core changes: 1) Files and directories share core code and data structures. 2) The filesystem code knows which descriptors refer to same file. This ensures that changes from one stream are appropriately reflected in every open descriptor for that file (fileobj_mgr.c). 3) File and directory cache buffers are borrowed from the main sector cache. This means that when they are not in use by a file, they are not wasted, but used for the cache. Most of the time, only a few of them are needed. It also means that adding more file and directory handles is less expensive. All one must do in ensure a large enough cache to borrow from. 4) Relative path components are supported and the namespace is unified. It does not support full relative paths to an implied current directory; what is does support is use of "." and "..". Adding the former would not be very difficult. The namespace is unified in the sense that volumes may be specified several times along with relative parts, e.g.: "/<0>/foo/../../<1>/bar" :<=> "/<1>/bar". 5) Stack usage is down due to sharing of data, static allocation and less duplication of strings on the stack. This requires more serialization than I would like but since the number of threads is limited to a low number, the tradoff in favor of the stack seems reasonable. 6) Separates and heirarchicalizes (sic) the SIM and APP filesystem code. SIM path and volume handling is just like the target. Some aspects of the APP file code get more straightforward (e.g. no path hashing is needed). Dircache: Deserves its own section. Dircache is new but pays homage to the old. The old one was not compatible and so it, since it got redone, does all the stuff it always should have done such as: 1) It may be update and used at any time during the build process. No longer has one to wait for it to finish building to do basic file management (create, remove, rename, etc.). 2) It does not need to be either fully scanned or completely disabled; it can be incomplete (i.e. overfilled, missing paths), still be of benefit and be correct. 3) Handles mounting and dismounting of individual volumes which means a full rebuild is not needed just because you pop a new SD card in the slot. Now, because it reuses its freed entry data, may rebuild only that volume. 4) Much more fundamental to the file code. When it is built, it is the keeper of the master file list whether enabled or not ("disabled" is just a state of the cache). Its must always to ready to be started and bind all streams opened prior to being enabled. 5) Maintains any short filenames in OEM format which means that it does not need to be rebuilt when changing the default codepage. Miscellaneous Compatibility: 1) Update any other code that would otherwise not work such as the hotswap mounting code in various card drivers. 2) File management: Clipboard needed updating because of the behavioral changes. Still needs a little more work on some finer points. 3) Remove now-obsolete functionality such as the mutex's "no preempt" flag (which was only for the prior FAT driver). 4) struct dirinfo uses time_t rather than raw FAT directory entry time fields. I plan to follow up on genericizing everything there (i.e. no FAT attributes). 5) unicode.c needed some redoing so that the file code does not try try to load codepages during a scan, which is actually a problem with the current code. The default codepage, if any is required, is now kept in RAM separarately (bufalloced) from codepages specified to iso_decode() (which must not be bufalloced because the conversion may be done by playback threads). Brings with it some additional reusable core code: 1) Revised file functions: Reusable code that does things such as safe path concatenation and parsing without buffer limitations or data duplication. Variants that copy or alter the input path may be based off these. To do: 1) Put dircache functionality back in the sim. Treating it internally as a different kind of file system seems the best approach at this time. 2) Restore use of dircache indexes in the playlist and database or something effectively the same. Since the cache doesn't have to be complete in order to be used, not getting a hit on the cache doesn't unambiguously say if the path exists or not. Change-Id: Ia30f3082a136253e3a0eae0784e3091d138915c8 Reviewed-on: http://gerrit.rockbox.org/566 Reviewed-by: Michael Sevakis <jethead71@rockbox.org> Tested: Michael Sevakis <jethead71@rockbox.org>
2014-08-28Fix up the bootloadersMichael Sevakis1-1/+1
They can't access the raw RBVERSION define any longer. Change-Id: I698062b36306399945c01de54cdccaa1a1a8434e
2014-08-08Bootloaders need the reacharound to get at the internal goodsMichael Sevakis1-1/+1
They need to include kernel-internal.h in order to perform inits. Change-Id: I5b0f155e4ff49a065c6cb97691ecd4396a199979
2013-06-27Move load_firmware() to separate fileMarcin Bukat1-6/+5
The idea is to share loading code between bootloaders and rolo(). Change-Id: I1656ed91946d7a05cb7c9fa7a16793c3c862a5cd Reviewed-on: http://gerrit.rockbox.org/190 Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
2012-01-03Rework powermgmt to enable code re-use on appliation and sims.Thomas Martitz1-1/+1
* Introduce CONFIG_BATTERY_MEASURE define, to allow targets (application) to break powermgmt.c's assumption about the ability to read battery voltage. There's now additionally percentage (android) and remaining time measure (maemo). No measure at all also works (sdl app). If voltage can't be measured, then battery_level() is king and it'll be used for power_history and runtime estimation. * Implement target's API in the simulator, i.e. _battery_voltage(), so it doesn't need to implement it's own powermgmt.c and other stubs. Now the sim behaves much more like a native target, although it still changes the simulated battery voltage quickly, * Other changes include include renaming battery_adc_voltage() to _battery_voltage(), for consistency with the new target functions and making some of the apps code aware that voltage and runtime estimation is not always available. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31548 a1c6a512-1295-4272-9138-f99709370657
2012-01-01Gigabeat S: Revert removal of usb_plugged in r31489Michael Sevakis1-2/+2
Synchronous cable read is still required because the timing of the receipt of the cable event cannot be known for sure-- basically it introduced a thread race between main and pmic. If a keypress is desired instead to enter BL USB mode a la AS3525, then it's possible to remove that. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31510 a1c6a512-1295-4272-9138-f99709370657
2011-12-31usb-target.h: removeRafaël Carré1-1/+0
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31498 a1c6a512-1295-4272-9138-f99709370657
2011-12-31usb_plugged() is PP onlyRafaël Carré1-2/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31489 a1c6a512-1295-4272-9138-f99709370657
2011-12-17Commit to certain names for cache coherency APIs and discard the aliases.Michael Sevakis1-1/+1
Wouldn't surprise me a bit to get some non-green. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31339 a1c6a512-1295-4272-9138-f99709370657
2011-09-08Remove return value from show_logo() in bootloader/Bertrik Sikken1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30485 a1c6a512-1295-4272-9138-f99709370657
2011-01-23i.MX31: Now that it matters because there's a debug screeen that allows ↵Michael Sevakis1-2/+0
changing things while running, some DVFS/DPTC stuff has to be done more carefully. Trim out some stuff and group functions better as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29122 a1c6a512-1295-4272-9138-f99709370657
2011-01-21Gigabeat S: Renovate bootloader a bit to show splash, implement verbose, ↵Michael Sevakis1-75/+80
shutdown on low battery, handle hold-switch-on and wait only so long for USB if a USB charger is inserted at boot instead of being connected to a host. 'Bootloader USB mode' display is just part of normal printf stream now. Move interrupt stacks into .bss area so they aren't loaded (for firmware too). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29099 a1c6a512-1295-4272-9138-f99709370657
2011-01-18Try to get some control over #ifdef hell in usb.c by refactoring and inline ↵Michael Sevakis1-3/+0
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-05Gigabeat S: Make it a removable mass-storage device. Windows will assign a ↵Michael Sevakis1-3/+7
drive to only the main data partition by default. To access the bootloader partition instead, press 'Vol -' while it connects (in bootloader and firmware). Hopefully doesn't break anything for anyone. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28972 a1c6a512-1295-4272-9138-f99709370657
2010-08-12Introduce NORETURN_ATTR wrapper for __attribute__((noreturn)), using this ↵Thomas Martitz1-1/+2
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-06-23Sansa AMS bootloader: enter USB mode only when neededRafaël Carré1-3/+3
- If an error happens when reading partitions / rockbox.sansa - If the select button was pressed add an argument to error() to not power off, when we're going to enter USB mode to try to fix the problem, but display the error message anyway for debugging purpose git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27075 a1c6a512-1295-4272-9138-f99709370657
2010-05-27Generate C file / header for svn version stringRafaël Carré1-2/+2
It's now easier to force rebuild of files depending on the svn revision version.c/version.h are generated once with new tools/genversion.sh Changes in the VCS are still not auto detected, so you'll have to remove builddir/version.* if you want to change the string in your binaries APPSVERSION is now called RBVERSION and is defined in the generated header instead of being defined by the Makefiles appsversion is now called rbversion (the plugin api number didn't change since old modules are still binary compatible) Change some bootloaders to use knwon-at-buildtime RBVERSION instead of "%s" + rbversion You'll need to run make clean to regenerate dependencies after the removal of apps/version.h To build binaries with a different version string, hand-edit tools/version.sh or tools/genversion.sh (which calls the former) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26320 a1c6a512-1295-4272-9138-f99709370657
2010-05-06Fix gigabeat S includes so it builds againFrank Gevaerts1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25855 a1c6a512-1295-4272-9138-f99709370657
2010-05-06Make creat() posix compliant API-wise. Shouldn't affect the core as it's ↵Thomas Martitz1-1/+1
wrapped via a static inline. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25843 a1c6a512-1295-4272-9138-f99709370657
2010-05-06Gigabeat S bootloader: Fix archaic call placement in dptc_stop which hangs ↵Michael Sevakis1-0/+3
the bootloader before jumping to FW. Let the backlight LED ramp up after unplugging USB which just looks better. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25840 a1c6a512-1295-4272-9138-f99709370657
2009-02-11Make basic cache functions into calls, and get rid of ↵Michael Sevakis1-2/+2
CACHE_FUNCTION_WRAPPERS and CACHE_FUNCTIONS_AS_CALL macros. Rename flush/invalidate_icache to cpucache_flush/invalidate. They're inlined only if an implementation isn't provided by defining HAVE_CPUCACHE_FLUSH/INVALIDATE. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19971 a1c6a512-1295-4272-9138-f99709370657
2009-02-07Gigabeat S: Move the LCD framebuffer address so that DRAM can be mapped flat ↵Michael Sevakis1-3/+6
between physical and virtual addresses. NO BOOTLOADER UPDATE SHOULD BE NEEDED. The firmware image now handles low-level system setup as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19935 a1c6a512-1295-4272-9138-f99709370657
2009-01-19Fix up ZVM builds. It appeared to share common definitions with PP502x ↵Michael Sevakis1-3/+0
targets so use those. Remove one stale comment left behind in last commit. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19798 a1c6a512-1295-4272-9138-f99709370657
2009-01-19USB detection changes. c200/e200: Consider USB to be powered when charger is ↵Michael Sevakis1-1/+0
plugged but detect USB connection by bus reset. When received, disconnect and restart the driver fully enabled. imx31: Fix hack used to make initial connect succeeded-- set PHY type before initial reset. General: Move some target code out of usb-drv-arc.c and implement it in respective usb sources and CPU headers so things stay clean. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19797 a1c6a512-1295-4272-9138-f99709370657
2008-11-23Use BOOTDIR and BOOTFILE defines instead of hardcoded path and file. FS#9559Björn Stenberg1-3/+3
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19190 a1c6a512-1295-4272-9138-f99709370657
2008-11-01Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do ↵Frank Gevaerts1-4/+4
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-06-28Updated our source code header to explicitly mention that we are GPL v2 orDaniel Stenberg1-2/+4
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-05-10Bring Gigabeat S bootloader one step close to a release version.Michael Sevakis1-120/+209
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17442 a1c6a512-1295-4272-9138-f99709370657
2008-05-07Do some gigabeat S bootloader cleanup (includes, const, static-ing, number ↵Michael Sevakis1-33/+22
of variables, etc.). Make sure a tar file isn't too big before loading it however unlikely that is. No overall functional change but bump to v.00000013 for tracking purposes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17403 a1c6a512-1295-4272-9138-f99709370657
2008-05-05Gigabeat S bootloader: 1) Switch order of .vectors to be contiguous with ↵Michael Sevakis1-1/+4
initialized sections. 2) Clean all caches in main before doing anything else because vector copying counts as self-modifying code. Up to v.00000012. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17381 a1c6a512-1295-4272-9138-f99709370657
2008-05-04Fix firmware load error display and handling in Gigabeat S bootloader. ↵Michael Sevakis1-3/+2
Remove "Hello World". v.00000011 now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17347 a1c6a512-1295-4272-9138-f99709370657
2008-04-29Make sure the linker considers crt0*.o before all files specified on the ↵Jens Arnold1-7/+0
command line by using STARTUP() instead of INPUT() in the .lds. Using INPUT() makes the linker process crt0*.o after all files specified on the command line, making linking fail if there are librockbox.a members which are only referenced by crt0*.o. Remove the hackaround that was needed for building the gigabeat S bootloader before (aka UIE() problem). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17289 a1c6a512-1295-4272-9138-f99709370657
2008-04-21Enable program flow prediction in the system control coprocessor setup in ↵Michael Sevakis1-1/+1
the bootloader. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17211 a1c6a512-1295-4272-9138-f99709370657
2008-04-21Unreverse Gigabeat S bootloader. Boot Rockbox with hold switch off.Michael Sevakis1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17203 a1c6a512-1295-4272-9138-f99709370657
2008-04-20Make the inital connect problem go away on Gigabeat S. Would be nice if a ↵Michael Sevakis1-1/+6
better way were found but it works for me. Update the bootloader to have it work. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17181 a1c6a512-1295-4272-9138-f99709370657
2008-04-18UMS for the Gigabeat S. Bootloader USB mode. Has a couple quirks 1) First ↵Michael Sevakis1-2/+56
plug has problems if cold. Replug if it doesn't connect or not at high speed 2) Linux doesn't like the odd bootable flag value used in the partitions so it won't mount but Windows works. Fix minor OTG driver bugs and clean up device memory handling. Generic name for ARC controller driver. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17154 a1c6a512-1295-4272-9138-f99709370657
2008-04-16Gigabeat S bootloader: Improve untarring by reading the whole file to memory ↵Nicolas Pennequin1-21/+21
before starting to write the output files. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17136 a1c6a512-1295-4272-9138-f99709370657
2008-04-15Gigabeat S bootloader: make it move a rockbox binary back to /.rockbox/ when ↵Nicolas Pennequin1-1/+21
it finds one in the MTP directory. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17133 a1c6a512-1295-4272-9138-f99709370657
2008-03-31That was stupid. Should be enable_interrupt.Michael Sevakis1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16898 a1c6a512-1295-4272-9138-f99709370657
2008-03-31Change the remaining set_interrupt_status usage to the more parsimonious ↵Michael Sevakis1-1/+1
disable/enable/restore. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16897 a1c6a512-1295-4272-9138-f99709370657
2008-02-17Give the Gigabeat S bootloader the ability to untar a tarball.Nicolas Pennequin1-14/+98
To test a build, use 'make tar' and send the tar to the unit. The bootloader will unarchive it and delete it before loading the main binary. This is a temporary hack to make testing possible until we have a better way of sending a complete build. Also enable writing to the disk by disabling the optimised write stubs. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16338 a1c6a512-1295-4272-9138-f99709370657
2008-02-08Gigabeat S: Interrupt enabled bootloader. Miscellaneous integration changes.Michael Sevakis1-3/+16
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16243 a1c6a512-1295-4272-9138-f99709370657
2008-02-05Gigabeat S mixer: Make some progress. Get the tick and core sleep working ↵Michael Sevakis1-1/+2
using the AVIC. Redo the startup code to remap from IRAM and not include the lcd driver frambuffer in the remapping (until it can be moved). Clean up LCD driver. For other misc. changes, see the diffs. Now it progresses to ATA init and fails with -11 but without crashing or hanging. Replace all bootloaders. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16216 a1c6a512-1295-4272-9138-f99709370657
2007-12-23Gigabeat S memory management stuff. Will Robertson1-1/+1
* Moved crt0.S to imx31 subdirectory, as it was the last target using the unified file. * DRAM is now remapped to 0x0, facilitating interrupts (which aren't done yet) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15965 a1c6a512-1295-4272-9138-f99709370657
2007-11-27* Make the Gigabeat S bootloader a bit more interesting: it looks for the ↵Nicolas Pennequin1-9/+41
first firmware file it finds on the second partition and attempts to load it. Loading fails to get past the splash screen though. * Make the main binary compile. To send a firmware file, use mtp-sendfile. To update you'll need to delete the previous firmware file, as files are named sequentially and the first one is loaded. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15836 a1c6a512-1295-4272-9138-f99709370657
2007-09-21Merge the Gigabeat S branch back into trunk. Fingers crossed nothing breaks.Will Robertson1-0/+94
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14805 a1c6a512-1295-4272-9138-f99709370657