Commit graph

474 commits

Author SHA1 Message Date
Fred Bauer
a71e87f132 Update some missed pointers when moving the dircache allocation
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31028 a1c6a512-1295-4272-9138-f99709370657
2011-11-19 14:57:56 +00:00
Thomas Martitz
1645c148e3 Simulate usb plugging on the sim better using sim_tasks.
Now all threads need to ack the connection like on real target, dircache is unloaded and playback stops accordingly.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31009 a1c6a512-1295-4272-9138-f99709370657
2011-11-17 18:40:00 +00:00
Thomas Martitz
9886126858 Fix FS#12325 - screen corruption on early usb.
When booting with USB inserted, the dircache build can get interrupted by the usb connection, in which case the dircache buffer is freed.
Due to a bug the re-creation of dircache used the old freed buffer and overwrite new allocs (causing screen corruption).

Set allocated_size to 0 to make it not take the code path that assumes an existing buffer,
and bring that and freeing together in the code.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30845 a1c6a512-1295-4272-9138-f99709370657
2011-10-28 16:38:52 +00:00
Fred Bauer
8e18dc85cf fix sign error
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30812 a1c6a512-1295-4272-9138-f99709370657
2011-10-21 06:45:26 +00:00
Robert Kukla
d25341a032 revert r30566 and r30567 to fix FS#12294 (superfloppy not mounting)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30632 a1c6a512-1295-4272-9138-f99709370657
2011-10-02 11:39:31 +00:00
Torne Wuff
e12a832758 Also remove the fat_partition_types array.
If we aren't going to check for the partition type, we don't need the array of
known FAT partition types.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30567 a1c6a512-1295-4272-9138-f99709370657
2011-09-17 22:49:30 +00:00
Torne Wuff
36d04ac76e Allow any partition type, not just known FAT types.
Instead of only mounting partitions with a FAT partition type, try any
partition that isn't type 0 (unallocated) or 5 (extended). This makes it easier
to reformat SDXC cards which have the exFAT partition type, and also brings us
in line with pretty much every other OS at this point. Anything with a
valid-looking FAT superblock will get mounted.



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30566 a1c6a512-1295-4272-9138-f99709370657
2011-09-17 22:45:59 +00:00
Thomas Martitz
7e14b935df Dircache: Allow dircache to be enabled without reboot.
Also add two dircache function, one of which does what dircache_disable()
did previously as this now also frees the dircache buffer.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30393 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 21:07:46 +00:00
Thomas Martitz
baa070cca6 GSoC/Buflib: Enable compaction in buflib.
This enables the ability to allocate (and free) memory dynamically
without fragmentation, through compaction. This means allocations can move
and fragmentation be reduced. Most changes are preparing Rockbox for this,
which many times means adding a move callback which can temporarily disable
movement when the corresponding code is in a critical section.

For now, the audio buffer allocation has a central role, because it's the one
having allocated most. This buffer is able to shrink itself, for which it
needs to stop playback for a very short moment. For this,
audio_buffer_available() returns the size of the audio buffer which can
possibly be used by other allocations because the audio buffer can shrink.

lastfm scrobbling and timestretch can now be toggled at runtime without
requiring a reboot.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30381 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 14:01:45 +00: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
Thomas Martitz
c08299cedd Dircache: Fix memory leak (and recently panic).
If the dircache was interrupted during generation (e.g. through USB
insertion), then the allocated buffer was leaked and a new one
was allocated for the second cache generation. This causes a
panic since r30308 since playback holds the control over the
audiobuffer at that time.

The fix is to simply check allocated_size instead of
dircache_size which is reset to 0 upon cancellation.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30321 a1c6a512-1295-4272-9138-f99709370657
2011-08-16 13:01:03 +00:00
Thomas Martitz
4087875f1c Dircache: Fix bug introduced in r30308.
dircache_root wasn't initialized at all and the giving allocated_size
passed to buffer_release_buffer() didn't account for alignment padding.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30318 a1c6a512-1295-4272-9138-f99709370657
2011-08-15 15:13:17 +00:00
Thomas Martitz
d1322b7159 GSoC/Buflib: Replace all direct accesses to audiobuf with buffer API functions.
Namely, introduce buffer_get_buffer() and buffer_release_buffer().
buffer_get_buffer() aquires all available and grabs a lock, attempting to
call buffer_alloc() or buffer_get_buffer() while this lock is locked will cause
a panicf() (doesn't actually happen, but is for debugging purpose).
buffer_release_buffer() unlocks that lock and can additionally increment the
audiobuf buffer to make an allocation. Pass 0 to only unlock if buffer was
used temporarily only.
buffer_available() is a replacement function to query audiobuflen, i.e. what's
left in the buffer.
Buffer init is moved up in the init chain and handles ipodvideo64mb internally.

Further changes happened to mp3data.c and talk.c as to not call the above API
functions, but get the buffer from callers. The caller is the audio system
which has the buffer lock while mp3data.c and talk mess with the buffer.
mpeg.c now implements some buffer related functions of playback.h, especially
audio_get_buffer(), allowing to reduce #ifdef hell a tiny bit.

audiobuf and audiobufend are local to buffer.c now.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30308 a1c6a512-1295-4272-9138-f99709370657
2011-08-14 15:13:00 +00:00
Thomas Martitz
44ffa3ef93 format/*printf: Add simple support for %p format specifier.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30249 a1c6a512-1295-4272-9138-f99709370657
2011-08-04 10:44:41 +00:00
Thomas Martitz
32b54164d8 Dircache: Fix 2 nasty bugs introduced with the reworks starting with r30032.
The first is an off-by-one that leads to miscalculation of the dircache size.
The format string size was used but dircache size was incremented by the snprintf() result which is smaller.
The other forgot to update the location of the "." and ".." strings upon compaction,
so that new folders got assigned orphaned pointers for those directory entires.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30224 a1c6a512-1295-4272-9138-f99709370657
2011-07-30 23:21:58 +00:00
Thomas Martitz
1b7ff725c6 Revert "Introduce bsearch() and use it in tagtree.c."
It was committed by accident (it's on FS still).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30157 a1c6a512-1295-4272-9138-f99709370657
2011-07-18 18:57:50 +00:00
Thomas Martitz
74ab227b58 Introduce bsearch() and use it in tagtree.c.
bsearch() is a general purpose binary search function for arrays.
It's supposedly faster than looping over arrays.
The array needs to be sorted in ascending order under the provided
comparison function. If the key and array element are of the same kind,
then the same compare function can be used for qsort() and bsearch().

Code taken from glibc.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30155 a1c6a512-1295-4272-9138-f99709370657
2011-07-18 18:55:20 +00:00
Miika Pekkarinen
e06bb54d12 Initialize the d_names_start pointer correctly in dircache. This should
prevent d_names data from being overwritten (likely causing garbage in
file browser and other strange symptoms).


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30122 a1c6a512-1295-4272-9138-f99709370657
2011-07-04 17:13:48 +00:00
Miika Pekkarinen
563a185ff4 Fixed incorrect dircache reallocation during tagcache commit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30108 a1c6a512-1295-4272-9138-f99709370657
2011-07-01 13:38:20 +00:00
Thomas Martitz
88234fa921 Fix loading dircache stat on h100. Relocating the data was broken due to struct alignment problems.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30051 a1c6a512-1295-4272-9138-f99709370657
2011-06-22 14:18:22 +00:00
Thomas Martitz
2b61f7ce64 Use ALIGN_UP() macro for alignment, in a more correct way also.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30041 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:58 +00:00
Thomas Martitz
287d69d7c4 Dircache: A bit of follow-up code cleanup suggested by Amaury Pouly.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30040 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:52 +00:00
Thomas Martitz
3b29aa49d3 Optimize new dircache_copy_path so that the helper (strlcat) doesn't need to walk through the entire string repeatedly.
Also fix a off-by-one.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30039 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:47 +00:00
Thomas Martitz
af7aaae478 Dircache: Don't expose struct dircache_entry and pointers into the cache, use IDs instead.
Only integer IDs are exposed from dircache with this. This way the cache is isolated from other modules.
This is needed for my buflib gsoc project.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30038 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:42 +00:00
Thomas Martitz
0b9c57d33e Dircache: Move struct maindata declaration to dircache.c and actually check for DIRCACHE_MAGIC when loading from disk.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30037 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:35 +00:00
Thomas Martitz
52abbb186d Dircache: Change internal cache layout.
The dircache_entry structs are now allocated subsequently from the front, allowing to treat them as an array.  The d_names are allocated from the back (in reverse order, growing downwards).
This allows the cache to be moved around (needed for my buflib gsoc project). It is utilized when loading the cache from disk (on the h100), now the pointer to the cache begin doesn't need to be the same across reboots anymore.

This should save a bit memory usage, since there's no need for aligning padding bytes after d_names anymore.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30036 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:30 +00:00
Thomas Martitz
b67f4a1824 Fix dircache_size calculation bug introcuced 3 revisions ago.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30035 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:26 +00:00
Thomas Martitz
e063725534 Dircache: Return the size of the result string in dircache_copy_path() so that callers don't need to call strlen on it.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30034 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:15 +00:00
Thomas Martitz
38da400e58 Dircache: Rework and simplify dircache_copy_path().
Use a recursive helper function with strlcat to build up the path backwards. This way the tree doesn't need to be walked twice and no extraneous size calculation is needed.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30033 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:12:10 +00:00
Thomas Martitz
60e4f20c38 Dircache: Remove dircache_entry::name_len.
It's reduntant, and enlarges the dircache unnecessarily. Saves 4 byte per file in the whole filesystem.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30032 a1c6a512-1295-4272-9138-f99709370657
2011-06-20 20:07:35 +00:00
Andree Buschmann
67f215032d Fix a bunch of 'variable set but not used' warnings reported from GCC 4.6.0.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29841 a1c6a512-1295-4272-9138-f99709370657
2011-05-08 21:06:38 +00:00
Thomas Martitz
294d058034 Return -1 for not implemented RTC functions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29546 a1c6a512-1295-4272-9138-f99709370657
2011-03-08 21:36:47 +00:00
Thomas Jarosch
f9f89cf5cb RaaA: Fix write locations of plugins
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29506 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 23:43:54 +00:00
Thomas Jarosch
6e9e6a7571 RaaA: Add initial Pandora support
More information: www.openpandora.org

Possible things to implement:
- Special button mappings
- Battery monitoring
- ALSA audio backend
- Automate creation of "pnd" (=binary) file

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29451 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 23:42:37 +00:00
Michael Sparmann
a5034bd244 Fix yellow
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29449 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 23:22:09 +00:00
Michael Sparmann
59c5e791a1 iPod Classic CE-ATA Support (Part 3 of 4: Introduce STORAGE_NEEDS_ALIGN, which ensures that no unaligned storage accesses are performed through file.c)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29447 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 22:47:33 +00:00
Michael Sparmann
1b5e31ed43 iPod Classic CE-ATA Support (Part 2 of 4: Remove on-stack sector buffers, and replace them with a single statically allocated sector buffer that's arbitrated amongst users)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29445 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 22:44:54 +00:00
Michael Sparmann
751303c2ac iPod Classic CE-ATA Support (Part 1 of 4: Cacheline align some statically allocated sector buffers)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29444 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 22:44:30 +00:00
Thomas Jarosch
70e48bf66d RaaA: Create full config directory tree during initialization
Also robustify against unset HOME environment var.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29397 a1c6a512-1295-4272-9138-f99709370657
2011-02-25 14:31:26 +00:00
Thomas Jarosch
351c851d08 RaaA: app_rename() must also do ROCKBOX_DIR translation for the target path
Fixes the "recent bookmarks" feature

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29316 a1c6a512-1295-4272-9138-f99709370657
2011-02-15 22:46:36 +00:00
Michael Sevakis
b15aa47c56 All kernel objects in code shared amongs targets (core, plugins, codecs) should be declared SHAREDBSS_ATTR as any core could potentially touch them even though they seem only to involve threads on one core. The exception is target code for particular CPUs where proper allocation is fixed. playlist.c was a little odd too-- use one mutex for the current playlist and a separate one for created playlists (still pondering the necessity of more than one).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29305 a1c6a512-1295-4272-9138-f99709370657
2011-02-14 11:27:45 +00:00
Thomas Jarosch
5f037ac015 Initial maemo platform support
Adds Nokia N900, N810 and N800 support.

Features:
- Introduce maemo specific platform defines
- Play audio in silent mode
- Stop playback on incoming calls
- Battery level readout
- Bluetooth headset support
- Save CPU by disabling screen updates if the display
  is off or the app doesn't have input focus
- N900: GStreamer audio backend

Kudos to kugel for the code review.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29248 a1c6a512-1295-4272-9138-f99709370657
2011-02-08 20:05:25 +00:00
Andree Buschmann
5d849a963e Clean up multiple definitions of RAM size. Remove -DMEM (make) and MEM (code), use the already defined MEMORYSIZE instead.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29189 a1c6a512-1295-4272-9138-f99709370657
2011-02-02 17:43:32 +00:00
Thomas Martitz
771011a6fc RaaA: Fix database duplication issue on every start
The code in tagcache.c:commit() was unable to delete
the to-be-commited database file as it read from
$(HOME)/.config/rockbox.org and tried to delete
the file later on in /.rockbox/.

As we didn't specify any flags like IS_FILE or NEED_WRITE
in _get_user_file_path() (which is called by f.e. app_remove()),
it searched for the file in two places.

In case of app_rename() IS_FILE would be wrong, so we just
add a NEED_WRITE to any write operation.

Author: Thomas Jarosch

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29148 a1c6a512-1295-4272-9138-f99709370657
2011-01-27 21:09:25 +00:00
Michael Sparmann
7fea136903 Autodetect sector size on superfloppy volumes based on the FAT32 BPB (kudos to Frank Gevaerts)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28946 a1c6a512-1295-4272-9138-f99709370657
2011-01-02 22:28:22 +00:00
Teruaki Kawashima
b1a888a023 correct argument of open.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28756 a1c6a512-1295-4272-9138-f99709370657
2010-12-07 12:20:27 +00:00
Thomas Martitz
2c2416094f Get rid of get_user_file_path and do the path handling in wrappers for open() and friends.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28752 a1c6a512-1295-4272-9138-f99709370657
2010-12-06 22:26:31 +00:00
Frank Gevaerts
1db3dfdd75 Accept FS#11774 by Michael Hohmuth (with some own modifications to #ifdef conditions)
Unmount all filesystems before connecting USB. This ensures that all filehandles are closed, which avoids possible filesystem corruption



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28693 a1c6a512-1295-4272-9138-f99709370657
2010-11-28 15:22:51 +00:00
Michael Sparmann
79d26ed7f9 Reduce the amount of stack space needed by fat_rename and mkdir_uncached.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28576 a1c6a512-1295-4272-9138-f99709370657
2010-11-13 15:41:18 +00:00
Michael Sparmann
01cdb6a21f Fix screendump on iPod Nano 2G by increasing the usb thread stack size and reducing the stack usage of FAT and storage functions
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28356 a1c6a512-1295-4272-9138-f99709370657
2010-10-25 12:36:57 +00:00