Commit Graph

459 Commits

Author SHA1 Message Date
Thomas Martitz
c1bd9b0361 Rework powermgmt to enable code re-use on appliation and sims.
* 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-03 23:44:38 +00:00
Thomas Martitz
05f12e0877 ypr0: Enable battery voltage read-out, charging monitoring and charger detection.
Voltage can be read using as3543 adc (i.e. ascodec api, on this target implemented
via ioctl()). TODO: Look into possibly controlling charging more by re-using
powermgmt-ascodec.c. However, charging seems to be controlled by the kernel,
so may not be needed.

Charger state can be read using /dev/minivet. It allows to differentiate between
wall charger and usb charging, but that's not implemented (is it even worthwhile?)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31470 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 13:34:56 +00:00
Michael Sevakis
6a67707b5e Commit to certain names for cache coherency APIs and discard the aliases.
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-12-17 07:27:24 +00:00
Boris Gjenero
a23dd7fd52 FS#12414 : Fix directory functions in plugins on targets which HAVE_DIRCACHE. In rockbox_api, PREFIX( ) is removed around directory functions because that's now handled in directory header files. Thanks to Fred Bauer for reporting this.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31089 a1c6a512-1295-4272-9138-f99709370657
2011-11-29 04:56:42 +00:00
Boris Gjenero
d51e598335 FS#12412 : Delete old buffer allocation code which has been replaced by core_alloc, and move buffer setup code to core_alloc.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31088 a1c6a512-1295-4272-9138-f99709370657
2011-11-29 00:42:27 +00:00
Thomas Martitz
a13e9644b5 - Fix some reds by implementing lcd_get_dpi().
- Use the list item centering capabilities in the plugin lib
- Bump plugin ABI for the changed viewport struct (sort the API too).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30775 a1c6a512-1295-4272-9138-f99709370657
2011-10-17 18:28:35 +00:00
Björn Stenberg
0942e2a0f7 Changed the FOR_NB_SCREENS macro to always be a for loop that declares its own loop variable. This removes the need to declare this variable in the outer scope.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30756 a1c6a512-1295-4272-9138-f99709370657
2011-10-15 19:35:02 +00:00
Jonathan Gordon
aa0f4a4bbe FS#12273 - use buflib for font storage. thanks to the testers :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30589 a1c6a512-1295-4272-9138-f99709370657
2011-09-24 13:19:34 +00:00
Jonathan Gordon
08d285b414 Remove some old code which tries to clear/set the backdrop when starting plugins which is broken and potentially can cause backdrop corruption if the backdrop buffers move during the plugin lifetime
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30545 a1c6a512-1295-4272-9138-f99709370657
2011-09-14 12:47:26 +00:00
Thomas Martitz
42f10e04df Remove buflib from the pluginlib and use the core one.
buflib_get_data() isn't inlined for plugins anymore, but can be if really needed.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30387 a1c6a512-1295-4272-9138-f99709370657
2011-08-30 16:48:36 +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
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
Jonathan Gordon
32dfc0cdc1 Add a plugin activity which to the %cs screen option list
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30253 a1c6a512-1295-4272-9138-f99709370657
2011-08-04 13:40:24 +00:00
Thomas Martitz
589879bb3d Plugin API/ABI got incompatible r30242. Bump and sort.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30243 a1c6a512-1295-4272-9138-f99709370657
2011-08-03 09:52:23 +00:00
Michael Sevakis
5663e1cd0a Have mpegplayer use the mixer (the playback channel, since it's mutually exclusive to audio playback) so the clicks and skip beep can be used according to user settings. Introduce some system sound functions to make easier playing event sounds from various places and convert files calling 'beep_play' to use 'system_sound_play' and 'keyclick_click'. Event sound could be become themeable.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30130 a1c6a512-1295-4272-9138-f99709370657
2011-07-08 22:31:15 +00:00
Michael Sevakis
22b6def065 Use playback channel directly for peakmeters and plugins using peak calculation. Also, for now, don't allow mixer playback to overlap recording, even if full duplex works.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30119 a1c6a512-1295-4272-9138-f99709370657
2011-07-02 11:55:38 +00:00
Michael Sevakis
7996d6d3f9 Knock out at least some red/yellow from r30097.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30098 a1c6a512-1295-4272-9138-f99709370657
2011-06-29 07:06:10 +00:00
Michael Sevakis
a2b6703a36 Commit FS#12150 - Fully-functional audio mixer - and finally whip old limitations about playback of voice and other sounds when paused. Channels are independent in state and amplitude. Fade on stop/pause is handled by the channel's volume control rather than global volume which means it now works from anywhere. Opens up the possibility of plugin sounds during music playback by merely adding an additional channel enum. If any PCM drivers were not properly modified, see one of the last comments in the task for a description of the simple change that is expected. Some params are tunable in firmware/export/pcm-mixer.h as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30097 a1c6a512-1295-4272-9138-f99709370657
2011-06-29 06:37:04 +00:00
Michael Sevakis
5a8f5b8330 Provide a reasonable fix for FS#12093 - Playback hanging after codec/playback rework. Also, get rid of an impossible buffering case (BUF_USED is always less than buffer_len) and remove a buffering API that is not used anywhere and shouldn't be needed (plugin API has to be incompatible).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29849 a1c6a512-1295-4272-9138-f99709370657
2011-05-09 21:19:11 +00:00
Michael Sevakis
c537d5958e Commit FS#12069 - Playback rework - first stages. Gives as thorough as possible a treatment of codec management, track change and metadata logic as possible while maintaining fairly narrow focus and not rewriting everything all at once. Please see the rockbox-dev mail archive on 2011-04-25 (Playback engine rework) for a more thorough manifest of what was addressed. Plugins and codecs become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29785 a1c6a512-1295-4272-9138-f99709370657
2011-04-27 03:08:23 +00:00
Michael Sevakis
56dd75d204 Purge buffer and codec APIs existing exclusively in support of mpa.codec and fix that to not require them: buf_get_offset and ci.advance_buffer_loc. Sort APIs; everything must become incompatible. :(
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29595 a1c6a512-1295-4272-9138-f99709370657
2011-03-16 05:38:37 +00:00
Thomas Martitz
cc889e9d60 Change the thread api a bit.
* Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler.
* thread_self_entry() shortcut for kernel.c.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29521 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 17:48:06 +00:00
Michael Sevakis
6510973223 Give playback engine better control over the codec. Codec simply follows commands and doesn't concern itself with audio state. Get track change notification in on the actual last buffer insert of the track because now audio simply waits for a track change notify from PCM on the last track and it must be sent reliably. This is still at an intermediate stage but works. Codecs and plugins become incompatible.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29387 a1c6a512-1295-4272-9138-f99709370657
2011-02-23 14:31:13 +00:00
Michael Sevakis
2da0f9bcfd Fuze v2: Do button reading more efficiently by mapping button codes directly to the GPIO pin states where possible (all but 'home' and hold). This makes plugins incompatible; up the min version and sort things.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29097 a1c6a512-1295-4272-9138-f99709370657
2011-01-20 17:11:23 +00:00
Teruaki Kawashima
1c14d29370 FS#11822: use rockbox_browse() in plugins to select file.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29069 a1c6a512-1295-4272-9138-f99709370657
2011-01-17 12:40:21 +00:00
Michael Sevakis
0dd74ca722 SA9200: Add YUV blitting, do full-screen updates more efficiently and properly clip partial updates. Plugin struct becomes incompatible for this target but leave version alone since it's still dev-only.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29028 a1c6a512-1295-4272-9138-f99709370657
2011-01-11 01:21:31 +00:00
Frank Gevaerts
42ad21ab53 Add some app_*() wrappers for file IO functions to make app_ work the same as sim_, thereby fixing application builds
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28993 a1c6a512-1295-4272-9138-f99709370657
2011-01-07 18:45:35 +00:00
Frank Gevaerts
1980fc3a61 Also PREFIX() other filesystem functions. I hope I got them all now...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28929 a1c6a512-1295-4272-9138-f99709370657
2010-12-29 20:10:11 +00:00
Frank Gevaerts
6406e61e5c Properly prefix the creat function for sim builds, otherwise the system creat() is called, which doesn't do proper root-mangling to make the file end up in the right place. Fixes FS#11844
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28927 a1c6a512-1295-4272-9138-f99709370657
2010-12-29 19:40:02 +00:00
Mustapha Senhaji
39b3c9a612 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28917 a1c6a512-1295-4272-9138-f99709370657 2010-12-28 14:18:37 +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
Nils Wallménius
8123dffaea Remove some inconsistent guarding around cpucache_* functions to fix a test_codec crash on coldfire, breaks plugin api compatibility so sorted and bumped version numbers.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28287 a1c6a512-1295-4272-9138-f99709370657
2010-10-16 12:30:06 +00:00
Bertrik Sikken
8ad85ba291 Fix for FS #10097 - Sometimes keys do work after exiting plugins.
This removes the call to button_clear_queue which interfered with the mechanism in action.c to wait for a key
release event when the button context is changed.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28232 a1c6a512-1295-4272-9138-f99709370657
2010-10-10 14:07:56 +00:00
Teruaki Kawashima
55a63609ef use correct condition for #if for tagcache_fill_tags().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28188 a1c6a512-1295-4272-9138-f99709370657
2010-09-30 13:09:50 +00:00
Frank Gevaerts
f366090562 Make disabling HAVE_PITCHSCREEN actually work without breaking the build
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28102 a1c6a512-1295-4272-9138-f99709370657
2010-09-17 20:28:47 +00:00
Thomas Martitz
0d4585b28f Extend lc_open() to also being able to load overlay plugins.
For this it needs to look at the plugin header. Since lc_open() doesn't know
it's a plugin, the header needs to be changed slightly to include the new lc_header (which needs to be the first element in plugin_header so it can be casted savely).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28054 a1c6a512-1295-4272-9138-f99709370657
2010-09-09 16:17:21 +00:00
Thomas Martitz
6eaab4d004 Ged rid of uisimulator/common/io.c for android builds.
Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants.
Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know).
For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one,
the values can be retrieved via the new dir_get_info().

Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep().

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657
2010-09-01 21:29:34 +00:00
Rafaël Carré
da16248e47 Plugins: modify IRAM copying code
Move to plugin_crt0.c, plugins don't need PLUGIN_IRAM_* macros anymore
IRAM is no longered zeroed before copying (as it is at the same address
than BSS) -> Fix FS#11581
Use cpucache_invalidate() (and not cpucache_flush), needed for self-modifying code on cached IRAM

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27948 a1c6a512-1295-4272-9138-f99709370657
2010-08-30 20:47:53 +00:00
Rafaël Carré
0f063b7d72 Implement lcd(_remote)_putsxyf() and export to plugins
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27921 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 21:46:18 +00:00
Rafaël Carré
e09ebc4213 pitch_detector: cleanup
- cosmetics: remove trailing white space
- mark all functions and variables as static
- merge struct definition and declaration when possible
- rename tuner_settings -> settings (because it's shorter)
- remove unused enums
- don't give pointer to settings struct as argument since there is only
  one struct, same for the settings filename
- fix error cases in settings load:
    reset settings when loading failed
    close file when it hasn't the right size
- inline small load/save functions only used once
- remove unused print_char_xy
- inline print_str and print_int_xy, and use lcd_putsf (added to the
  plugin API)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27918 a1c6a512-1295-4272-9138-f99709370657
2010-08-28 17:52:31 +00:00
Thomas Martitz
194174a371 2nd try: Introduce a small api for loading code (codecs,plugins) from disk/memory.
It's a used by codec/plugin loading and vastly reduces code duplication. It's also a step forward in getting rid of libuisimulator in the application ports.

Apparently sh needs linker symbols prefixed with _ even if they're referenced without from C code.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27902 a1c6a512-1295-4272-9138-f99709370657
2010-08-27 00:29:50 +00:00
Thomas Martitz
97d2a6ec5c Revert "Introduce a small api for loading code (codecs,plugins) from disk/memory."
I don't understand the build error at all, plugin_bss_start is clearly defined in plugin.lds

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27901 a1c6a512-1295-4272-9138-f99709370657
2010-08-27 00:16:26 +00:00
Thomas Martitz
73f057be6f Introduce a small api for loading code (codecs,plugins) from disk/memory.
It's a used by codec/plugin loading and vastly reduces code duplication. It's also a step forward in getting rid of libuisimulator in the application ports.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27900 a1c6a512-1295-4272-9138-f99709370657
2010-08-26 23:20:02 +00:00
Rafaël Carré
851be21f67 system-arm.c/__div0 are for ARM native builds only
Android can now be built with CPU_ARM defined
Needs investigation (and test_codec) to see if/how this helps

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27684 a1c6a512-1295-4272-9138-f99709370657
2010-08-03 19:00:29 +00:00
Thomas Martitz
9c0b2479f7 Rockbox as an application: add get_user_file_path().
For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox).
This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local.

On the DAPs it's a no-op, returing /.rockbox directly.

Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657
2010-08-01 16:15:27 +00:00
Nils Wallménius
296ac7f716 Missed one.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27540 a1c6a512-1295-4272-9138-f99709370657
2010-07-24 10:53:58 +00:00
Teruaki Kawashima
a874f77e18 text_viewer: remove unneeded code.
viewportmanager_theme_enable() sets values to passed viewport by viewport_set_defaults(), so no need to call sb_skin_get_info_vp() or viewport_set_defaults().

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27399 a1c6a512-1295-4272-9138-f99709370657
2010-07-12 13:38:40 +00:00
Yoshihisa Uchida
bc46541bcd plugin api: delete sb_skin_update().
text viewer: use send_event() instead of sb_skin_update(). thanks to teru.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27348 a1c6a512-1295-4272-9138-f99709370657
2010-07-08 13:54:28 +00:00
Yoshihisa Uchida
3691435c25 plugin api: new functions set the end of the structure. thanks to Frank Gevaerts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27335 a1c6a512-1295-4272-9138-f99709370657
2010-07-07 12:42:15 +00:00
Yoshihisa Uchida
e5a257607d plugin api: add the following functions.
- get the viewport of the current skin.
- update the current skin statusbar.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27333 a1c6a512-1295-4272-9138-f99709370657
2010-07-07 11:35:30 +00:00