Commit graph

41 commits

Author SHA1 Message Date
Mihail Zenkov
7cb1e5ae8b Fix AMSv2 variant 1 detection if rockbox loaded from SD card
Change-Id: Ie7c9c06170601e109f8d3de9686773c38a6e224a
2016-04-22 20:43:45 +00:00
Mihail Zenkov
2ec6fbc827 AMS: fix usb initialization in bootloader
Regression after 8b8b85433f

Change-Id: I86389be0b85c5c2ad8a32d7089a6a79a6b7c8708
2015-06-02 02:02:51 +02:00
Amaury Pouly
761e7987c8 usb: finally get rid of USE_ROCKBOX_USB in Sansa bootloader, use bootloader usb
For some reason, the bootloader and config files didn't define
HAVE_BOOTLOADER_USB_MODE, also remove the special cases in usb.c which they
implied.

Change-Id: I68c29be7d03627e64cac4ff7678e0c211e087a8c
2015-01-08 22:30:22 +01:00
Mihail Zenkov
8b8b85433f Fix USB speed detection
Change-Id: I615d2d5366ffa1e2e9c6b0837bf5a62a7e471fca
Reviewed-on: http://gerrit.rockbox.org/994
Reviewed-by: Frank Gevaerts <frank@gevaerts.be>
Tested: Mihail Zenkov <mihail.zenkov@gmail.com>
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
2014-10-04 11:57:09 +02:00
Michael Sevakis
7d1a47cf13 Rewrite filesystem code (WIP)
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-30 03:48:23 +02:00
Michael Sevakis
4ea4cdfc11 Bootloaders need the reacharound to get at the internal goods
They need to include kernel-internal.h in order to perform inits.

Change-Id: I5b0f155e4ff49a065c6cb97691ecd4396a199979
2014-08-08 02:28:11 -04:00
Marcin Bukat
0b29691324 Move load_firmware() to separate file
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>
2013-06-27 13:50:11 +02:00
Michael Sevakis
09769827fe Swap red and yellow for green on r31339's cranky builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31340 a1c6a512-1295-4272-9138-f99709370657
2011-12-17 07:54:00 +00:00
Michael Sevakis
bfd69f2aa1 Fix the real issue with AMS bootloader USB mode. A call to usb_enable was missing in usb.c when using the USB stack and USB_DETECT_BY_CORE was not enabled. Try to do it in a clean-ish way.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31245 a1c6a512-1295-4272-9138-f99709370657
2011-12-14 09:19:50 +00:00
Rafaël Carré
845cd59e3f Sansa AMS: fix usb in bootloader
No need to define HAVE_BOOTLOADER_USB_MODE
That define might need some cleaning up
Fix FS#12384

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31241 a1c6a512-1295-4272-9138-f99709370657
2011-12-14 05:07:11 +00:00
Bertrik Sikken
7e3a3f491d Remove return value from show_logo() in bootloader/
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30485 a1c6a512-1295-4272-9138-f99709370657
2011-09-08 18:31:15 +00:00
Bertrik Sikken
463b3ed8b2 Initial framework for the Sandisk Sansa Clip Zip
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30365 a1c6a512-1295-4272-9138-f99709370657
2011-08-27 16:21:19 +00:00
Rafaël Carré
8c954e28b7 sansa AMS bootloader: make strings static
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30118 a1c6a512-1295-4272-9138-f99709370657
2011-07-02 02:49:20 +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é
64d3a22ec0 sansa AMS bootloader: build if USE_ROCKBOX_USB isn't defined
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27076 a1c6a512-1295-4272-9138-f99709370657
2010-06-23 05:16:24 +00:00
Rafaël Carré
1ec821244a Sansa AMS bootloader: enter USB mode only when needed
- 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-06-23 05:08:36 +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é
f9b0f81d63 Sansa AMS: fix bootloader USB mode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26914 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 13:30:25 +00:00
Rafaël Carré
b812465bff as3525: bootloader USB mode
not working yet : an empty drive is detected
won't link on fuzev1: drivers allocated in usb_storage.c are too large

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26905 a1c6a512-1295-4272-9138-f99709370657
2010-06-18 01:47:39 +00:00
Rafaël Carré
12af2926e5 Make Clip+ bootloader build
Now making the Fuzev2 bootloader build should be pretty easy

TODO:
    - write button driver (FlynDice found all buttons already)
    - find button light
    - decide if lcd-ssd1303.c must be modified for Clip+ using SSP or forked
    - check if backlight code works (I copied Clipv2 code)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24520 a1c6a512-1295-4272-9138-f99709370657
2010-02-05 12:40:25 +00:00
Rafaël Carré
2392bb4199 FS#10047 : Clipv2
Reuse some code from Clip (LCD) and a lot of code from AS3525
Add a new CPU type : AS3525v2, identical to AS3525 except it's an ARMv5 (arm926-ejs)
SD code still not working
For an unknown reason LCD doesn't work anymore (to be investigated)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24131 a1c6a512-1295-4272-9138-f99709370657
2009-12-31 19:15:20 +00:00
Rafaël Carré
3520d8e90e Sansa c200v2 : lcd & backlight support, using the c200v1 lcd driver
The LCD driver is unified and lcd_send_command now takes 2 arguments : the command and its argument.
    If there is no argument, it's set to 0 and a NOP command is issued
    If there is more than one argument (set X/Y address), the 2nd argument is sent as a 2nd command, and a NOP command is issued after it.
    Benefit : c200v2 transfers the command and the argument in one 16 bits transfer
    Performance should not be affected since commands without argument are only used in lcd_init() and lcd_enable()

lcd_send_data() now transfers whole lines (or columns) instead of single pixels
yuv is disabled for c200v2 for now

Some buttons can be read, including left button (bit 6 of DBOP_DIN), but for some reason they have no effect in rockbox: to be investigated

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21321 a1c6a512-1295-4272-9138-f99709370657
2009-06-17 19:55:27 +00:00
Rafaël Carré
f504153857 FS#10048 : enable MMU and data cache on Sansa AMS to give a major speed up
- cache IRAM and DRAM
- map IRAM just next to DRAM to remove the need for -mlong-calls and reduce binsize
- tweak delays in Fuze button code
- tweak delays in Clip button code (down button sometimes doesn't respond anyway : an alternate driver is being worked on)

Before reporting any problem, please check your filesystem or format your player from the OF

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21228 a1c6a512-1295-4272-9138-f99709370657
2009-06-08 23:05:33 +00:00
Thomas Martitz
4633446517 Sansa AMS: Centralise mapping of RAM and IRAM in as3525.h via #defines. This will hopefully make ongoing mmu work easier as less places need to be changed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21000 a1c6a512-1295-4272-9138-f99709370657
2009-05-20 21:09:53 +00:00
Mustapha Senhaji
aeddacbd14 FS#10066 by Michael Chicoine: Sansa AMS bootloader "Hold" switch detection.
(Not for the Fuze nor the Clip, because it seems pointless for them)
 


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20681 a1c6a512-1295-4272-9138-f99709370657
2009-04-10 22:18:02 +00:00
Dominik Wenger
f5c5983c73 commit FS#10092 (cleanup AMS system init) by Rafaël Carré.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20640 a1c6a512-1295-4272-9138-f99709370657
2009-04-07 16:14:01 +00:00
Michael Giacomelli
c97f640060 Commit FS#9679 by Thomas Martitz. Adds c200v2 to the target tree. Has some buttons defined, a bootloader, and stubs for most drivers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19574 a1c6a512-1295-4272-9138-f99709370657
2008-12-24 04:10:18 +00:00
Rafaël Carré
2b39cb4b77 Sansa AMS bootloader: consider the bootloader finished
Be verbose only if a keypress has been detected.
Use enable/disable_irq() instead of inline assembly

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19213 a1c6a512-1295-4272-9138-f99709370657
2008-11-25 15:43:38 +00:00
Jonathan Gordon
ce505b8a01 the delay in the as3525 bootloader was driving me mad so remove it and get the bootloader closer to where a "finished" one should be (only show info if sometrhing needs to be shown, which is always for now.)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19085 a1c6a512-1295-4272-9138-f99709370657
2008-11-11 11:01:55 +00:00
Rafaël Carré
f7b1d806e6 Sansa AMS bootloader: use the correct (renamed) header file
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19075 a1c6a512-1295-4272-9138-f99709370657
2008-11-10 20:36:02 +00:00
Bertrik Sikken
4ca4e523fe Rename functions as3525_codec_* to ascodec_* to prepare re-use of as3514 code for sansa v2 players
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19047 a1c6a512-1295-4272-9138-f99709370657
2008-11-09 09:25:53 +00:00
Rafaël Carré
aef27e1f0c Sansav2 Bootloader
Adds read-only SD driver, largely copied from ata-sd-pp.c
Only tested on the embedded SD, on the Clip
First steps to build a Normal firmware

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19045 a1c6a512-1295-4272-9138-f99709370657
2008-11-09 06:17:21 +00:00
Rafaël Carré
6e645cc4eb AS3525: we won't use threads in the bootloader
Disable tick_start()
Call kernel_init() _after_ system_init()

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19028 a1c6a512-1295-4272-9138-f99709370657
2008-11-06 15:24:19 +00:00
Rafaël Carré
baecdb632c AS3525: use kernel_init() in bootloader
This way creation of scrolling thread doesn't risk crashing the system

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19026 a1c6a512-1295-4272-9138-f99709370657
2008-11-06 02:31:40 +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
Rafaël Carré
e1b4838481 Embryo of a SD driver for Sansav2
Debug code included, needed until the bootloader is ready

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18926 a1c6a512-1295-4272-9138-f99709370657
2008-10-29 20:21:59 +00:00
Dave Chapman
8df1a7e29a e200v2: implement the backlight handling (copy/paste from the c200v1/e200v1 code - this should probably be unified, along with other upcoming v2 code), plus clean up the lcd init by calling lcd_init() directly in the bootloader, instead of lcd_init_device().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18910 a1c6a512-1295-4272-9138-f99709370657
2008-10-29 01:42:03 +00:00
Rafaël Carré
b3ee07c22e Sansav2 : initializes SDRAM
The AS3525 SoC ships with an ARM PL172 MPMC controller
Also correct the memory sizes in tools/configure

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18899 a1c6a512-1295-4272-9138-f99709370657
2008-10-28 11:24:29 +00:00
Bertrik Sikken
95726a5c23 FS#9503 - Sansa v2 audio/PMU communication driver (for the AS3525 SoC)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18886 a1c6a512-1295-4272-9138-f99709370657
2008-10-26 13:28:52 +00:00
Dave Chapman
08c41d42bb Add e200v2 and m200v2 targets. Move the telechips lcd-ssd1815.c (currently used by Logik DAX and m200v1 ports) driver up in the target tree and share with the m200v2 - as2525 parts contributed by Rafael Carre. Includes the start (but is still very incomplete) of an LCD driver for the e200v2. m200v2 is not yet fully supported by mkamsboot - that will come soon. Also some minor cleanups for the Clip.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18836 a1c6a512-1295-4272-9138-f99709370657
2008-10-19 14:11:01 +00:00
Dave Chapman
da8bff107e Commit FS#9467 - initial work on port to Sansa Clip by Rafaël Carré and François Dinel. A few cosmetic changes were made by me prior to committing: 1) TAB policing in button-clip.c; 2) Add François Dinel to CREDITS; 3) Add François Dinel as (C) holder in button-target.h (it was previously blank); 4) Add Rockbox header to bootloader/sansa_as3525.c with Rafaël Carré as (C) holder; 5) Change target_id to 50 (next available number) in tools/configure and fixed indentation; 6) Change MODEL_NUMBER in config-clip.h to 50 (next available number); 7) Remove unused in/out macros from system-target.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18782 a1c6a512-1295-4272-9138-f99709370657
2008-10-12 16:46:01 +00:00