Commit graph

2412 commits

Author SHA1 Message Date
Solomon Peachy
56a1e87501 ata: Make ata_disk_is_active() only special-case powermgmt-less devices.
SSDs that respect powermgmt commands should be treated the same, as the
powermgmt commands are an important part of ensuring it's safe to shut
down.

And greatly expand the comment explaining things.

Change-Id: Ia52b99fca802f495422b5ee097390a72dbc28f61
2021-03-04 17:37:51 -05:00
Christian Soffke
be99033cbb Always indicate inactive ata disk if device is solid state or doesn't support power management
Commit 5462907 made sure that SLEEP commands weren't issued on devices that don't support ATA power management commands (e.g. certain CF->SD converters including several iFlash models).

Since Rockbox waits for the disk to become inactive in shutdown_hw(), which won't happen in this case, the OS would previously stall during the shutdown process until a timeout was reached.

Change-Id: I03bb05f6f6401bb8f0da5d0b76bd3f07681fdc06
2021-03-04 16:50:50 -05:00
Aidan MacDonald
aacb0811d9 Rename symbols of FiiO M3K Linux-based port
Mainly a straight replacement of FIIO_M3K -> FIIO_M3K_LINUX.

Change-Id: Id07c84f8150991d1b6851540c2c3f8f67e3f12c2
2021-02-27 23:53:28 +00:00
Franklin Wei
792f05f82a lcd: Wrap anonymous union initializer in braces
GCC 4.9.4 is apparently smart enough to compile this, but 4.4.4 is not.

Change-Id: I186f969cbad4c701936ab738f585efea07421d2e
2020-12-08 14:12:12 -05:00
Torne Wuff
5db83c155a pp5020: use ipod firmware timings for ATA PIO.
Some mSATA adapters seem to have trouble working with Rockbox using our
normal PIO timings; the timing value we use is probably out of spec and
is different to the OF. Switch to using the OF's timings according to
which PIO mode we select. This may not completely resolve problems with
these adapters but allows Rockbox to boot and play audio.

Change-Id: If73210700eb4af01864b373709ee1d15c775fb11
2020-11-04 03:03:19 +00:00
Solomon Peachy
066d471ae6 ATA: Check to see if the ATA device is solid-state (WIP)
Not all devices advertise this flag, unfortunately.

Change-Id: I6d666febdfcba7598e4d29df7d05c0a288e15158
2020-11-03 19:29:26 +00:00
Solomon Peachy
daefd5686f Rocker: Fix a boneheaded bug introduced in dd82f13fa1
Change-Id: Ia743cba6ccd50b38b052f26cce23ac9fe7aac31b
2020-10-31 20:26:37 +00:00
Amaury Pouly
dd82f13fa1 nwz/alsa: various improvements
Also audiohw driver to specific device name, rewrite alsa controls code to
cache more data, thus making the code easier and use less stack. Avoid using
short/long in pcm alsa code since it's the wrong size on 64-bit (simulator
for example)

Change-Id: Ibc1ec44396e37b6cbdedbcf37300878638e5d2d3
2020-10-31 14:16:31 +00:00
William Wilgus
60f642ba4f lcd_framebuffer bugfixes, sanity checks
several issues I saw that could pontentially cause problems
scroll engine doesn't take text height into account when checking bounds

NBELEMS was one whole row too large hopefully I got them right this time

Change-Id: If303da8320429c3964fc675351cb088d46303745
2020-10-31 01:11:30 -04:00
Solomon Peachy
fe2d52cc7d pcm: Get rid of pcm_play_pause() and associated APIs
Nothing in the core has used it for some time.  It's exported to the
plugin API but the last plugins to use it were switched to the mixer API
back in 2011.

This allows us to get rid of pcm_play_dma_pause() from all audio drivers

Change-Id: Ic3fa02592316f84963e41d792d1cabb436d1ff6b
2020-10-31 01:18:27 +00:00
William Wilgus
ada919fc11 FIX RED framebuffer viewport rewrite
Change-Id: I4cb8f580e15440d06f8d5fabb2fbf5147c67b49c
2020-10-26 14:35:30 -04:00
William Wilgus
9b295ce135 FIX RED/YELLOW framebuffer viewport rewrite
Change-Id: Icfd3b00b646c593991f73550d8a316a80e5930a1
2020-10-26 14:02:49 -04:00
William Wilgus
40e98a2e49 Whitespace cleanup on fb_viewport Rewrite
Change-Id: I24aac41c8abecf7b78a44d7f59e842b791be4563
2020-10-26 12:38:22 -04:00
William Wilgus
3237ae4a4f LCD core move buf ptr and address look up function viewport struct
I'm currently running up against the limitations of the lcd_draw functions
I want these functions to be able to be used on any size buffer not
just buffers with a stride matching the underlying device

[DONE] allow the framebuffer to be decoupled from the device framebuffer
[DONE need examples] allow for some simple blit like transformations
[DONE] remove the device framebuffer from the plugin api
[DONE}ditto remote framebuffer
[DONE] remove _viewport_get_framebuffer you can call struct *vp = lcd_set_viewport(NULL) and vp->buffer->fb_ptr

while remote lcds may compile (and work in the sim) its not been tested on targets

[FIXED] backdrops need work to be screen agnostic

[FIXED] screen statusbar is not being combined into the main viewport correctly yet

[FIXED] screen elements are displayed incorrectly  after switch to void*

[FIXED] core didn't restore proper viewport on splash etc.

[NEEDS TESTING] remote lcd garbled data

[FIXED] osd lib garbled screen on bmp_part

[FIXED] grey_set_vp needs to return old viewport like lcd_set_viewport

[FIXED] Viewport update now handles viewports with differing buffers/strides by copying to the main buffer

[FIXED] splash on top of WPS leaves old framebuffer data (doesn't redraw)
[UPDATE] refined this a bit more to have clear_viewport set the clean bit and have skin_render do its own screen clear
scrolling viewports no longer trigger wps refresh
also fixed a bug where guisyncyesno was displaying and then disappearing

[ADDED!] New LCD macros that allow you to create properly size frame buffers in you desired size without wasting bytes
(LCD_ and LCD_REMOTE_)
LCD_STRIDE(w, h) same as STRIDE_MAIN
LCD_FBSTRIDE(w, h) returns target specific stride for a buffer W x H
LCD_NBELEMS(w, h) returns the number of fb_data sized elemenst needed for a buffer W x H
LCD_NATIVE_STRIDE(s) conversion between rockbox native vertical and lcd native stride (2bitH)
test_viewports.c has an example of usage

[FIXED!!] 2bit targets don't respect non-native strides
[FIXED] Few define snags

Change-Id: I0d04c3834e464eca84a5a715743a297a0cefd0af
2020-10-26 12:28:48 -04:00
Solomon Peachy
28b9c8bfeb rocker: Disable mute-on-pause, due to a platform kernel bug.
In short, the display fading back in after a pause resuming interferes
with the audio codec, causing BadThings(tm) that cannot be recovered from

This really is just avoiding a known trigger; there's no guarantee this
condition won't occur under random circumstances during normal use,
and there's no good way to work around this from within rockbox.

I suspect the underlying problem is that both the display control and
codec control share an i2c bus, but the kernel drivers implementing them
isn't using proper linux bus access/locking.

Change-Id: Id4f56f9cb269ed74aac2f041146b3630cef09030
2020-10-26 01:07:59 +00:00
Solomon Peachy
4afd1f9aa6 hosted: Document HW capabilities of audio drivers
One surprise:  X3ii is capable of 384KHz playback

Change-Id: I0cc88637c81a21d54979e82b2941fe14de933d4d
2020-10-25 00:42:41 -04:00
William Wilgus
d78a37676e ClipPlus BOOTLOADER DONT FIT!
REMOVED FROM ALL NATIVE BOOTLOADERS:
finish removing the text scrolling
pare down printf to a minimal subset (%c %s %l %d %u and %x(%p))
remove diacritic and rtl language support

GOAL 134000

START 135305

CURRENT 133700

SUCCESS! (ASSUMING IT WORKS -- UNESTED)

Change-Id: Ic3f6ac1dc260578f581ee53458b3e5bb47d313ec
2020-10-23 20:38:59 -04:00
Solomon Peachy
02c5dd3641 fiio: Another bugfix in the mute code.
Change-Id: I165f4871fa79fb5759d2f0833c543edd5f1ce779
2020-10-22 13:16:20 -04:00
Solomon Peachy
97b8692b65 fiio: add in a missing audiohw_mute() call.
Change-Id: I837dcb81b8814573fe947d6c7cfa10ff651689d0
2020-10-22 16:14:16 +00:00
Solomon Peachy
6834d1a02f xduoox20: Start unmuted, as the least-worst option
Change-Id: Ie85d9df0f861315dfc9d767218d86115420aa9d7
2020-10-20 17:07:48 -04:00
Solomon Peachy
ce40ef42ff hosted: Make sure we don't call mixer/etc controls when we're not ready
(Might fix the rocker crash-on-shutdown bug)

Change-Id: Id375fc5053adef18d7ec812bdba36ee002e706ef
2020-10-16 20:34:18 -04:00
Solomon Peachy
82787709bd update the hibi patcher script to handle initial m3k stuff
Change-Id: I63ed8443952888da3dafb23ff6e7daf9c7aca574
2020-10-15 13:31:28 -04:00
Solomon Peachy
4873a1ac61 fiiom3k: Temporarily disable filter rolloff programming
(Hardware control isn't wired into ALSA properly)

Change-Id: Iac537d2d90a6119b8c002cd38a558a4ebb3321eb
2020-10-15 07:43:14 -04:00
Solomon Peachy
26bebd77ab Fix more red.
Change-Id: Id1a45b420f8eb70a25010b058822b78f80db33d8
2020-10-13 19:45:03 -04:00
Solomon Peachy
09785a8499 fix more yellow
Change-Id: I74bad58707d05ea167169d4315c05eb0cd1c8b7b
2020-10-13 17:23:56 -04:00
Solomon Peachy
b94db707fb Fix more warnings.
Change-Id: Ib3a9fc622a46b1fc72e94dcbc6d29d2e430cd81b
2020-10-13 15:48:31 -04:00
Solomon Peachy
4a3d046545 Fix a pile of yellow in the bootloader
Change-Id: Ia89a33bbb13683566e421ac2a002baa20cdb07de
2020-10-13 13:37:21 -04:00
Solomon Peachy
688575368c rocker: Fix red introduced in 01dc81c
Change-Id: I08169395702b74f8ea6cd939520c69745ae8b876
2020-10-12 11:48:07 -04:00
Solomon Peachy
17244177ee hosted: Fix a corner case in umuting the x3ii and erosq
Change-Id: I3ffc3b82c6137bab3f27cd87ccc57c2f03a1d401
2020-10-12 11:46:05 -04:00
Solomon Peachy
078c34e951 hosted: More PCM muting work
* Track mute state, only call hw if actual change is needed
 * Don't unmute in audiohw_postinit()
 * sample rate tracking fixes
 * erosq:  Don't start up muted

Change-Id: I004f787a4b7ea73c16b6ec9818ec29a12c89f46b
2020-10-12 15:33:32 +00:00
Solomon Peachy
141e91ef1f Hosted PCM: Rework auto-muting code a bit
* If AUDIOHW_MUTE_ON_PAUSE, no meaningful change
     * Unconditionally unmute on playback start
     * xduoox3ii:  Mute on sample rate change
     * rocker/xduoo:  Stay muted after startup

    This avoids the nasty "pop" on startup, without doing
    the full mute-on-pause stuff that causes unacceptable
    dropouts on the X3ii.

Change-Id: I2e3ee0bb8094e288f37a0acada86a80016ce5cac
2020-10-12 13:40:37 +00:00
Solomon Peachy
2a471e288c New port: AIGO EROS Q / EROS K
The Q and K have a slightly different case, but the hardware under the
shell is completely identical.

These models are rebadged versions:

 * Hifiwalker H2   (== Q)
 * AGPTek H3       (== K)
 * Surfans F20     (== K)

Other notes:

  * Significant improvements in the shared Hiby-platform launcher/loader
    * SD card can theoretically be hot-swapped now
    * Support external USB mass storage!
  * Some consolidation of Hiby-platform targets
  * Some consolidation of plugin keymaps

Todo/known issues:

 * Keymaps need to be gone over properly
 * Convert to HAVE_SCROLLWHEEL?

Change-Id: I5a8a4f22c38a5b69392ca7c0a8ad8c4e07d9523c
2020-10-11 16:37:17 -04:00
Solomon Peachy
4b10aacbc2 xduoox3ii/x20: headphones take precedence over line out
so if both are plugged in, assume headphones (and respect volume)

Change-Id: Ia77ae6d484ac61f6a2b4cd51a991f59de239cfa6
2020-10-09 20:52:43 -04:00
Solomon Peachy
aabc8aca47 New port: FiiO M3K
Most credit goes to:  Roman Skylarov
Additional integration and refactoring by myself.

 *** COMPLETELY UNTESTED ***

Change-Id: Ia64c36d92e0214c6b15f7a868df286f8113ea27b
2020-10-09 12:41:18 -04:00
Solomon Peachy
7a1bf01541 Undo the hacks that allowed targets without LEFT/RIGHT (UP/DN) to build.
Replaced them with warnings until they are fixed *PROPERLY*

Change-Id: I4425200e60f8b5224262a54f105b974cec471d22
2020-10-08 20:30:08 -04:00
Moshe Piekarski
2e2e899869
more DEBUG build fixes
Change-Id: I4ae2b79f53ce59c37ccc9ef06f5ebd145e988763
2020-10-07 00:01:07 -05:00
Solomon Peachy
d5167b1221 coldfire: Allow building when 88KHz audio is disabled
Change-Id: Ieeacf591ad4233428dca99c347043e61abae1d1f
2020-10-03 15:57:38 -04:00
Solomon Peachy
d4a620e85a alsa: introduce AUDIOHW_MUTE_ON_PAUSE, and have rocker use it.
Change-Id: I1edbb8e71a9c73baaeecb01b66cbee6c3f7b5f8f
2020-10-03 14:41:40 +00:00
Solomon Peachy
d18157608d xduoo codec cleanups
Change-Id: I6c3437bde2d9f781a02ffc6b3a83148b9a7af872
2020-10-03 14:41:21 +00:00
Solomon Peachy
1824f8b103 xduoox3ii/x20: Rework the mute control to actually function properly.
(By switching the output away from the audio jacks)

Change-Id: Ib8511c9d45029bba038dc4d1d187174d56cb3043
2020-10-03 04:13:13 +00:00
Solomon Peachy
db22dae2f9 fix more red.
Change-Id: If5fee31d633e5f75272ba85f5293ad01b1ce573a
2020-10-01 16:39:37 -04:00
Solomon Peachy
a96eb1a7f7 Fix warnings and errors introduced in b030bf5
Change-Id: I23966b6a79c0d2cbab2e01c649c1b991f460d8ad
2020-10-01 16:08:20 -04:00
Solomon Peachy
b030bf5885 xduoox3ii/x20: Proper lineout detection and volume mangling.
hotplugging hp and lineout works, without blowing out eardrums.

Change-Id: I2df5c7a618bb2d1d77d416548d45dff9cfc619db
2020-10-01 15:41:30 -04:00
Solomon Peachy
6d47dc9a88 fix some of the red introduced in e43726d
Change-Id: Id1abb0dd11f8a8e79a80fc54e58a5a22706a03ad
2020-10-01 12:55:52 -04:00
Solomon Peachy
e43726df2c hosted pcm-alsa improvements
* xduoo x3ii/x20:  Better line out support
 * less granular volume settings (too many steps before)
 * Better handling of swiching sample rates
 * Log actual sample rate in debug menu

Most credit goes to Roman Stolyarov
Additional integration [re]work by myself

Change-Id: I63af3740678cf2ed3170f61534e1029c81826bb6
2020-10-01 11:56:57 -04:00
William Wilgus
2df3a5b04c Headphone / lineout pause/resume #FS13237
Allow Lineout to behave like headphone port in regards to
plug/unplug pause/resume

Change-Id: I9cb2c9c40e0bdf3bf7e1e272164acd343f6b3850
2020-09-18 00:22:52 +00:00
Solomon Peachy
658026e626 [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note:  I left behind lcd_bitmap in features.txt, because removing it
would require considerable work in the manual and the translations.

Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24 21:20:13 +00:00
Solomon Peachy
8cb555460f [3/4] Completely remove HWCODEC support
'swcodec' is now always set (and recording_swcodec for recording-capable
units) in feature.txt so the manual and language strings don't need to
all be fixed up.

Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
2020-07-24 21:20:13 +00:00
Solomon Peachy
0c4f89370d [2/4] get rid of HAVE_LCD_CHARCELLS
HAVE_LCD_BITMAP is now redundant.

lcd_bitmap is always-on in features.txt so manual and lang strings
don't have to change

Change-Id: I08eeb20de48099ffc2dc23782711af368c2ec794
2020-07-24 21:20:13 +00:00
Solomon Peachy
092c340a20 [1/4] Remove SH support and all archos targets
This removes all code specific to SH targets

Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2020-07-24 21:20:13 +00:00
Solomon Peachy
54629073ae ATA: Make sure "hard disk" supports power management
The FC-1307 CF->SD converter that is the basis of a lot of ATA->CF
devices (including several iflash iFlash models) claims to not support
ATA power management commands.

Rockbox unconditionally issues those commands as support is mandated by
the ATA spec.  This patch checks the capability bit, and if it's not
supported, does not attempt to put the ATA subsystem to sleep.

It is not clear if the problems lie with the SLEEP commands or the wakeup
process, but who knows where else the FC1307 violates the ATA specs, and
reliability is much more important than power savings.

Change-Id: I8b539c579d0449a8a3cfa63cdd1387db990fe820
2020-07-11 22:17:13 -04:00
Solomon Peachy
7249fabe63 fat: Validate FS Info Sector signature when attempting to mount volume
The "try to mount as superfloppy" fails with some partitioning layouts
because sector 0 can have a mostly-valid FAT32 signature.  However, in
all dumps I've looked at, sector 0's fsinfo offset value points at a place
which lacks the fsinfo signature.

Resolves FS#13213, no known regressions.

Change-Id: Ib323d35cca6ca54e11aca6ba77041bf33a05a277
2020-07-11 18:23:46 -04:00
LiveboxAndy
77f8c9c9f1 Update to allow the Apple Radio Remote to function on iPod Video 5G.
This was broken when the major update to iap was comitted.
ia-lingo7.c created and various iap related files modified.
On 4G, 6G and Nano 1/2Gen iPods the remote will function
even though the radio won't.
Tested on 4G Greyscale, 4G Color, 4G Photo, 4G Mini 1st Gen,
4G Mini 2Gen, Nano 1G, Nano 2G, Video 5G, Video 5.5G

Change-Id: Ia74e3d07d9ab5edc6da8eafa96801ede722be331
2020-07-09 18:02:07 +00:00
Solomon Peachy
c79f658125 ATA: In picking PIO modes, word 64 is only valid if word 53 bit 1 is set.
Change-Id: I0a7681be7d703c1baa7f8bd7b5e31f04f20f299d
2020-07-08 17:08:08 +00:00
Franklin Wei
a65a341a00 button: allow disabling software poweroff
On some devices, the button driver allows a "software poweroff" by long-
pressing a certain key. This behavior is inconvnient when that button needs
to be held down for other purposes, such as moving the cursor in rockpaint
or sgt-untangle.

This patch allows selectively disabling the software poweroff (enabled by
default) from both core and plugin code.

Change-Id: I7580752888ae5c7c7c5eb1be5966e3d67f17d4b4
2020-06-27 13:27:40 -04:00
Solomon Peachy
f0ac5d123f m66591: Fix out-of-bounds array access
Loop terminator needed a preincrement rather than postincrement, and
also used a proper #define instead of a magic number.

Change-Id: Iafd6a0dce0304cb94e4f1d04cce46d2ca603507a
2020-05-12 21:52:40 +02:00
Stefan Ott
63bf8e4acd Consider sector size when checking cluster size
On file systems with 2048 bytes per cluster, the bpb_secperclus value
gets multiplied by 4 when the meta data is loaded. This patch changes
the sanity check to consider (and reverse) that multiplication before
checking the cluster size.

Signed-off-by: Stefan Ott <stefan@ott.net>
2020-04-07 00:20:13 +02:00
Marcin Bukat
180cef835b xDuoo X3II and X20 port
Provided by Roman Stolyarov
Integration, Refactoring, and Upstreaming by Solomon Peachy

X3II confirmed working by forum tester, X20 is nearly identical.

This includes bootloader, main firmware, and the flash image patcher.

Eventual Todo:

 * Further refactor AGPTek Rocker & xduoo hiby bootloaders
 * Further refactor AGPTek Rocker & xduoo hosted platform code

Change-Id: I34a674051d368efcc75d1d18c725971fe46c3eee
2020-04-06 18:15:41 +02:00
Sebastian Leonhardt
053c4d0593 transflective LCDs: fix "first buttonpress enables backlight only"
This should be done even if the backlight is set to "always off",
i.e. if the LCD is sleeping, a button press should be "eaten"
and just wake up the LCD.

Change-Id: I3946bdbbdc81f23eae3f47423123cefa275e0afc
2019-02-07 22:56:39 +01:00
Solomon Peachy
d24edc605b Add HAVE_LINEOUT_DETECTION and associated logic
This allows targets to automatically switch audio settings when the
line out is plugged/unplugged.

Only hooked up on the xDuoo X3, but there are other potential users.

Change-Id: Ic46a329bc955cca2e2ad0335ca16295eab24ad59
2019-01-04 23:52:42 +01:00
Solomon Peachy
d4942cc74c Add Xuelin iHIFI 770/770C/800 support
Taken from the xvortex fork (Roman Stolyarov)
Ported, rebased, and cleaned up by myself.

Change-Id: I7b2bca2d29502f2e4544e42f3d122786dd4b7978
2019-01-02 08:10:01 -05:00
Solomon Peachy
9b3f22ac3a FS#7814 - Enable RTC Alarms on H300, X5, and M5
Original patch by Alexander Spyridakis
Modified by Steve Bavin and Igor Poretsky
Keymap fixes by Marianne Arnold

Change-Id: I5a252d97d2b05c533e048931f7354f4261f76499
2018-12-25 08:51:33 -05:00
Solomon Peachy
eee3f0ce79 FS#12610 - Clip+ Ticking Noise Fixed in Radio
Patch taken from Igor Poretsky's tree.

Original clip-radio-tick.patch modified to acts only when screen is
deemed, or when recording, in order to preserve indicators
functionality.

Change-Id: I62afb24a0dad7ad2ecc9272c24810b37f032408d
2018-12-22 20:12:10 -05:00
Solomon Peachy
0662793ca0 Add cleaned-up xDuoo X3 support
Cleaned up, rebased, and forward-ported from the xvortex fork.

(original credit to vsoftster@gmail.com)

Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d
Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
2018-07-28 10:56:31 -04:00
William Wilgus
1054b5748c Revert "Ignore truncation in lcd-scroll.c"
This reverts commit 540637ed33.

Change-Id: I88e71ef47a11818a5acb407ff9c0723d3c197243
2018-07-25 20:41:48 +02:00
William Wilgus
540637ed33 Ignore truncation in lcd-scroll.c
Change-Id: Id1008300e58cf12ab920c1023354a74a6d32daae
2018-07-25 19:56:53 +02:00
Marcin Bukat
32e8028a04 Cleanup comment
Change-Id: If39a5d2f64a9453a9b9b0cf0a2e3ad36027978ff
2018-06-12 13:02:47 +02:00
Marcin Bukat
d55680993d Agptek Rocker: Initial commit
Change-Id: I26b51106c7b1c36a603fba6d521e917d79b5a95b
2018-06-12 10:31:14 +02:00
William Wilgus
038a10220e Fix Remove lcd_scroll_worker from bootloader except remote displays/charcell
This patch was supposed to only remove scroll worker from devices without
remote displays, the build system said otherwise

Change-Id: I240db89ee6b55818dbd2567338515b53ebe09300
fixed: conditional define
2018-05-25 19:16:45 +02:00
William Wilgus
0999a22ef8 Remove lcd_scroll_worker from bootloader except remote displays and charcell
Removes unneeded scrolling fuctionality from bootloaders

Change-Id: Iebe308144cc11c9139399702e3dcd1a548cb9831
2018-05-23 00:37:27 +01:00
Michael Sevakis
f4c4221306 Convert i.MX31 and AMS target to use RTC interrupt
Instead of checking ticks, set a sticky dirty flag that indicates
that the RTC needs to be read. This gives a timely update and more
accurate readout without actually reading the RTC until it changes.
The implementation should atomically read the flag and clear it.
Setting the flag would typically happen in an RTC tick ISR.

Change-Id: I6fd325f22845029a485c502c884812d3676026ea
2017-11-21 07:52:02 -05:00
Amaury Pouly
0fe7b8becf nwzlinux: add support for radio
None of the Sony up to A15 seem to support RDS (they use either Si4702 or Si4708),
thus I did not add any code to support RDS.

Change-Id: I64838993b9705b36b94665f8470c7a89c772c961
2017-11-06 21:37:06 +01:00
Michael Sevakis
1654efc313 Unify storage threads into one
* 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
2017-10-26 14:35:41 -04:00
Amaury Pouly
afbae177a1 sonynwz: add api and debug entries for "acoustic" and "cue/rev" mode
We don't really know what those are supposed to do. They seem to change the
volume curve but it is not very clear what is the intended purpose.

Change-Id: I65f5d18aba139844c23df092277ba17ee8518f96
2017-10-07 22:01:00 +02:00
Amaury Pouly
a82ebac53a sonynwza10/a20: enable pcm frequency selection
Change-Id: I335fcdbb652253e777d0d7406545d0d44d98f4f0
2017-10-01 17:23:43 +02:00
Amaury Pouly
1d121e8c08 Initial commit for the Sony NWZ linux port
SUPPORTED SERIES:
- NWZ-E450
- NWZ-E460
- NWZ-E470
- NWZ-E580
- NWZ-A10

NOTES:
- bootloader makefile convert an extra font to be installed alongside the bootloader
  since sysfont is way too small
- the toolsicon bitmap comes from the Oxygen iconset
- touchscreen driver is untested

TODO:
- implement audio routing driver (pcm is handled by pcm-alsa)
- fix playback: it crashes on illegal instruction in DEBUG builds
- find out why the browser starts at / instead of /contents
- implement radio support
- implement return to OF for usb handling
- calibrate battery curve (NB: of can report a battery level on a 0-5 scale but
  probabl don't want to use that ?)
- implement simulator build (we need a nice image of the player)
- figure out if we can detect jack removal

POTENTIAL TODOS:
- try to build a usb serial gadget and gdbserver

Change-Id: Ic77d71e0651355d47cc4e423a40fb64a60c69a80
2017-09-05 21:42:12 +02:00
Michael Sevakis
0ca6650389 RDS: Fix a few goofs in the unicode table
Change-Id: I54c681a9eb3d5e90ee4aeedc3ec5dbd6243cb208
2017-04-21 19:47:25 -04:00
Michael Sevakis
6db80020b4 Do some housekeeping with fat.h and SECTOR_SIZE
Many includes of fat.h are pointless. Some includes are just for
SECTOR_SIZE. Add a file 'firmware/include/fs_defines.h' for that
and to define tuneable values that were scattered amongst various
headers.

Remove some local definitions of SECTOR_SIZE since they have to be
in agreement with the rest of the fs code anyway.

(We'll see what's in fact pointless in a moment ;)

Change-Id: I9ba183bf58bd87f5c45eba7bd675c7e2c1c18ed5
2017-03-12 22:05:44 -04:00
Michael Sevakis
eaf6aad690 Forgot to remove unused RDS buffers from the ipod remote tuner.
Also, use rds_reset() now to clear data on station change since
the rds driver internal buffers are used.

Change-Id: I043b09d661eeec21617381015347f0bcead4f7d4
2017-02-12 00:21:09 -05:00
Michael Sevakis
523ef4edbd Fix warnings and errors from fc9695e
* fmradio.c needs an implementation of tuner_get_rds_info() for the
sim (kill all the sims).

* Some macro bitflags shouldn't be seen unless HAVE_RDS_CAP is
defined.

Change-Id: Idd00c94ca2fc43cf32f9223aa4530d5a02fb3454
2017-02-11 23:16:39 -05:00
Michael Sevakis
fc9695eb47 Improve radio RDS driver and framework
* Remove unused bits like the radio event and simplify basic
radio interface. It can be more self-contained with rds.h only
required by radio and tuner code.

* Add post-processing to text a-la Silicon Labs AN243. The chip's
error correction can only do so much; additional checks are highly
recommended. Simply testing for two identical messages in a row
is extremely effective and I've never seen corrupted text since
doing that, even with mediocre reception.

Groups segments must arrive in order, not randomly; logic change
only accepts them in order, starting at 0.

Time readout was made a bit better but really we'd need to use
verbose mode and ensure that no errors were seen during receiving
of time and more checks would be need to have a stable PI. The
text is the important bit anyway.

* Time out of stale text.

* Text is no longer updated until a complete group has been
received, as is specified in the standard. Perhaps go back to
scrolling text lines in the radio screen?

* Add proper character conversion to UTF-8. Only the default G0
table for the moment. The other two could be added in.

* Add variants "RDS_CFG_PROCESS" and "RDS_CFG_PUSH" to allow
the option for processed RDS data to be pushed to the driver and
still do proper post-processing (only text conversion for now for
the latter).

Change-Id: I4d83f8b2e89a209a5096d15ec266477318c66925
2017-02-11 22:19:32 -05:00
Amaury Pouly
d7871914ac Fix dangerous casts
On Windows 64-bit, the size of long is 32-bit, thus any pointer to long cast is
not valid. In any case, one should use intptr_t and ptrdiff_t when casting
to integers. This commit attempts to fix all instances reported by GCC.
When relevant, I replaced code by the macros PTR_ADD, ALIGN_UP from system.h

Change-Id: I2273b0e8465d3c4689824717ed5afa5ed238a2dc
2017-02-04 17:24:47 +01:00
Michael Sevakis
58b849c451 Move intrinsic RTC implmentation differences to driver files
Some drivers set tm_wday just fine and do not need it coerced to
be correct. Others set tm_yday, so don't overwrite what the driver
sets; just zero it inside if it can't fill the field. Move calls
to set_day_of_week() to the sorts of drivers that presumably
required the hammer (FS#11814) in get_time() where the weekday
isn't locked to the date.

Change-Id: Idd0ded6bfc9d9f48fcc1a6074068164c42fcf24a
2017-01-26 23:07:49 -05:00
Michael Sevakis
783c77531c AMS: Return ascodec to interrupt-based I2C2 driver
1. Slightly revised and regularized internal interface. Callback is used
for read and write to provide completion signal instead of having two
mechanisms.

2. Lower overhead for asynchronous or alterate completion callbacks. We
now only init what is required by the transfer. A couple unneeded
structure members were also nixed.

3. Fixes a bug that would neglect a semaphore wait if pumping the I2C
interrupts in a loop when not in thread state or interrupts are masked.

4. Corrects broken initialization order by defining KDEV_INIT, which
makes kernel_init() call kernel_device_init() to initialize additional
devices _after_ the kernel, threading and synchronization objects are
safe to use.

5. Locking set_cpu_frequency has to be done at the highest level in
system.c to ensure the boost counter and the frequency are both set in
agreement. Reconcile the locking inteface between PP and AMS (the only
two currently using locking there) to keep it clean.

Now works fine with voltages in GIT HEAD on my Fuze v2, type 0.
Previously, everything crashed and died instantly. action.c calling
set_cpu_frequency from a tick was part of it. The rest may have been
related to 3. and 4. Honestly, I'm not certain!

Testing by Mihail Zenkov indicates it solves our problems. This will
get the developer builds running again after the kernel assert code
push.

Change-Id: Ie245994fb3e318dd5ef48e383ce61fdd977224d4
2017-01-25 00:05:13 +01:00
Michael Sevakis
da46457231 Fix dumb typo in button.c.
Forgot to check a non-freq-scaling target. :)

Change-Id: Ib19b1b6ebdb3e4ad595aca37a687f32156290a65
2017-01-21 12:16:27 -05:00
Michael Sevakis
c6299b268d action.c must desist in calling set_cpu_frequency from a tick
The function is neither reentrant nor ISR callable. Instead of
using a ticked-based timeout, have the button driver provide the
unboost after a delay when waiting for a button.

HAVE_GUI_BOOST gets immediate boost after dequeuing any message,
otherwise the queue has to have at least three messages waiting
for it to trigger a boost-- essentially the behavior that existed
but now combined in one place.

Change-Id: I1d924702840f56a1a65abe41fa92b4e753c4e75a
2017-01-21 12:03:23 -05:00
Michael Sevakis
a931c76b3a Do some debug and preparatory work for ramcache and playlist
The file system rework introduced incompatibility between dircache
and the tagcache ramcache and playlist dircache path caching. This
update makes changes to filesystem code to reintegrate all that.

It also fixes a couple bugs that were found when vetting all the
code. The filestream cache was being reset without regard to
the stream even if it was shared in write mode (made work of
.playlist_control). Better handling of unmounting gives files a
better go at force-closing them without risk to disk integrity.

Did some miscellaneous pedantic changes. Improved efficiency of
testing a file's existence (a little) since the path parser will
be shared between file code and parsing for the sake of finding
dircache references, not duplicated as before.

This commit doesn't reenable said items just for the sake of
keeping changes separate and related.

Plan for the next is to enable dircache again for the playlists
(easy peasy) and reenable tagcache ramcache but *without* the
dircache path caching because it's rather substantial to change
in itself. The ramcache will still function without dircache.

Change-Id: I7e2a9910b866251fa8333e1275f72fcfc8425d2d
2017-01-17 14:35:36 -05:00
Amaury Pouly
4d526df7ac wm8975: document audiohw settings
Change-Id: I0456f85e4ebc821c23e25026fbee3d8cf7526ee7
2016-12-12 13:13:13 +01:00
Amaury Pouly
69ea311398 wm8758: document and fix audiohw settings
It looks like a copy and paste error to me, those were completely wrong.

Change-Id: Id6ae025f4216ffccb1a8b8b790916d8b6c4694bd
2016-12-12 13:12:47 +01:00
Amaury Pouly
90a32ccad6 wm8751: document and fix audiohw settings
Document 3D depth range. Fix mismatch in recording volume: the displayed volume
is completely off the chart

Change-Id: I4c363f369e5d72f332391a6f96457b4e450404f9
2016-12-12 13:12:15 +01:00
Amaury Pouly
cc031d41ab wm8731: document audiohw settings
Change-Id: I78ec26a00a3e14a95c591ac81d96e1b480b9138e
2016-12-12 13:11:25 +01:00
Amaury Pouly
af81cc4a93 imx233: slightly rework 3D audio setting
The old code made the setting appear as 0dB, 1.5dB, 3dB and 4.5dB when
in fact it is 0dB, 3dB, 4.5dB and 6dB. This commit clarifies the code and
also fix this at the same time. This imx233 3D enhancement is complete crap anyway
but now you can satisfy yourself with 6 dB of pure crap, clearly an enhancement.

Change-Id: Ia3e088987c1ff0cdde228905ff70f46476a499a2
2016-12-12 12:15:24 +01:00
Amaury Pouly
9dc4b00df1 imx233: fix recording gain
For some reason, there was a mismatch between the setting (decibel) and the
audiohw code (centicel). This resulted in a gain divided by 10. This may
explain why some people experienced low volume with the mic on the fuze+.

Change-Id: I138ac18dd93c36f43a7dfce735efc826405c598c
2016-09-21 00:29:14 +01:00
Amaury Pouly
afe7f1b915 as3543: fix audio gap when switching from dac to line-in/recording
Also clarity parts of the code. The old code suffered from two defects:
- it was very unclear because it made changes to whole registers
  (using as3514_write) instead of fields (using as3514_set/clear/write_masked).
  Also the routing code was spread accross several functions which made it hard to
  follow.
- it did not properly reroute audio on monitor changes. In particular, the following
  could happen: when switching from DAC to radio, the code would fail to clear
  SUM_off, resulting in a weird situation where the main mixer was off
  (SUM_off) but the headphone where using the main mixer as input. Incredibly this
  worked anyway (at least on AMSv2 and YP-R0) but resulted in strange volume gaps
  between DAC and radio mode.

Change-Id: I7826835fdb59c21f6483b223883ca9289e85caca
2016-08-29 08:16:27 +02:00
Amaury Pouly
d42a4a4eb4 zenxfi3: rewrite mpr121 driver
The new driver uses an asynchronous architecture for touch status reading.

Change-Id: Ic75a8b91bc47ee16c3af873afde178cd70186376
2016-06-01 23:09:27 +02:00
Amaury Pouly
b2afd931e2 fuze+: rewrite touchpad driver
The old driver was bad in many respect, it had some race conditions, it was
using a thread to serialize transfers because of the legacy i2c interface.
It also had huge latency (typically 50ms but delays up to 300ms can happen),
thus some presses were missed.
The new driver takes advantage of the new i2c driver to do everything
asynchronously. It also does not need a thread anymore because queueing
ensures proper serialization. It provides much better and reliable latency
(typically ~2ms).
Also fix the debug screen which was horribly broken. The new screen also
displays the deadzones.

Change-Id: I69b7f99b75053e6b1d3d56beb4453c004fd2076e
2016-06-01 23:08:17 +02:00
Amaury Pouly
eac1ca22bd imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.

The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
  BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
  BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
  its equivalent for BF_WR(reg_SET, ...)

I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".

Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml

Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-28 16:49:22 +02:00
Mihail Zenkov
c537e05784 Fix (D)EBUG compilation
Change-Id: I5cb6d9ec3d14389b03ae43edb15b9c6199df322b
2016-04-07 10:28:15 +00:00
Mihail Zenkov
c7daef36c5 as3525: reverting I2C2 to non-interrupts version
Interrupts version is cause of freeze on USB extraction.
Also non-interrupts version much simpler and faster.

Change-Id: I30a2993cdcaa85abfba77ca06bfacd5b6b4353e2
2016-04-05 01:55:38 +00:00
Amaury Pouly
6f54a86360 as3514: fix bug in volume management on AS3543 targets which are not AS3525v2
Some old code made the assumption that CONFIG_CPU == AS3525v2 if and only if
HAVE_AS3543, which is not true on targets like the Samsung YP-R0. This fixes
several issues on such targets like a huge volume gap between -39dB and -40dB
and a volume artificially capped at -72dB instead of -82dB.

Change-Id: Ib1c883ac593c0c3ce5e2bf4eb408924ce5f5ad93
2016-02-12 23:04:33 +00:00
Mihail Zenkov
840dacc718 AS3543: Fix increasing noise and power consumption if booted through rolo
Change-Id: I99fe6d09b15689e5dd0179714bbe363aed922d10
2016-02-01 03:20:06 +00:00
Cástor Muñoz
c7fc5ca6eb Fix (D)EBUG compilation errors on targets using FAT
Change-Id: I9517f9b470076a6febeafae76d735c2436812e7c
2015-10-09 20:45:01 +02:00
Cástor Muñoz
42abc6a496 iPod Classic: capture support for CS42L55 codec
There are a couple of power saving options that can be selected using
defines, they configure the CODEC in a different way than OF does:

 MONO_MIC: jack microphone is connected to left channel, disabling
 right channel saves ~1 mW, there is no reason to not to do it.

 BYPASS_PGA: this option only applies to the line-in, OF does not
 bypass the PGA and configures it to 0 dB gain. At the beginning,
 this patch was written based on CODEC datasheet, bypassing PGA
 because it saves power and incrementes dinamic range ~1dB, i have
 used this setup for a while without problems. Finally this option
 was disabled at the last minute, i decided to do it after reviewing
 the OF and realizing that CS42L55 datasheet recommends to bypass the
 PGA only if the HW includes a couple of capacitors (see Typical
 Connection Diagram, Note 4), at this moment i don't know if Classic
 includes these capacitors (probably not). Anyway, i am not able to
 tell the difference listening to voice recodings.

TODO:
- Use variable PGA gain for jack microphone (it is fixed to +12 dB.
  as OF does).
- I am not a fan of having lots of unused #define options, these could
  be useful for a generic driver but actually this driver is Classic
  oriented, i am not sure if it could be considered disirable to
  eliminate them in the final version.

Change-Id: I3dadf2341f44d5e13f3847e6c9de4a76cd6f0918
2015-10-07 06:15:03 +02:00
Sebastian Leonhardt
399904a916 Samsung YHxxx: reduce pop noise on power down
Change-Id: Ifc82ac1051ed05527393838d8aa93bde65287b5d
2015-09-24 23:06:18 +02:00
Mihail Zenkov
3e5e9cf7d7 AS3543: Fix recording volume setting and voice
Fix regressions introduced by 42219b6e7

Change-Id: I1f3edb5f269f60e9431b45a43c4370836ecac733
2015-06-02 02:04:34 +02:00
Udo Schläpfer
dbabd0d9c3 iBasso DX50/DX90: Major code cleanup and reorganization.
Reorganization

- Separated iBasso devices from PLATFORM_ANDROID. These are now standlone
  hosted targets. Most device specific code is in the
  firmware/target/hosted/ibasso directory.
- No dependency on Android SDK, only the Android NDK is needed.
  32 bit Android NDK and Android API Level 16.
- Separate implementation for each device where feasible.

Code cleanup

- Rewrite of existing code, from simple reformat to complete reimplementation.
- New backlight interface, seperating backlight from touchscreen.
- Rewrite of device button handler, removing unneeded code and fixing memory
  leaks.
- New Debug messages interface logging to Android adb logcat (DEBUGF, panicf,
  logf).
- Rewrite of lcd device handler, removing unneeded code and fixing memory leaks.
- Rewrite of audiohw device handler/pcm interface, removing unneeded code and
  fixing memory leaks, enabling 44.1/48kHz pthreaded playback.
- Rewrite of power and powermng, proper shutdown, using batterylog results
  (see http://gerrit.rockbox.org/r/#/c/1047/).
- Rewrite of configure (Android NDK) and device specific config.
- Rewrite of the Android NDK specific Makefile.

Misc

- All plugins/games/demos activated.
- Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa.

Includes

- http://gerrit.rockbox.org/r/#/c/993/
- http://gerrit.rockbox.org/r/#/c/1010/
- http://gerrit.rockbox.org/r/#/c/1035/

Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight
interface and new option for hold switch, touchscreen, physical button
interaction.

Rockbox needs the iBasso DX50/DX90 loader for startup, see
http://gerrit.rockbox.org/r/#/c/1099/

The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If
/mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit
gracefully and the loader will restart Rockbox on USB disconnect.

Tested on iBasso DX50.
Compiled (not tested) for iBasso DX90.
Compiled (not tested) for PLATFORM_ANDROID.

Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
2015-02-02 21:57:55 +01:00
Mihail Zenkov
42219b6e79 Bypass the AS3543 audio mixer at higher volumes.
This change reduces noise and distortion very slightly at higher volumes.

Change-Id: I1a2eb160c2956de90764c0bb11677fdac8d96dec
2015-01-19 22:38:51 +01:00
Thomas Jarosch
1212edd352 Don't return pointer to array allocated on the stack
It will be out of scope once the function is left.

cppcheck reported:
[firmware/drivers/rtc/rtc_zenvisionm.c:31]: (error) Pointer to local array variable returned.
[firmware/drivers/rtc/rtc_zenvisionm.c:38]: (error) Pointer to local array variable returned.

Change-Id: Ibf28ba9b3d20cadcaff22398e143488c86746660
2015-01-13 21:40:19 +01:00
Thomas Jarosch
2a3e1628a5 Limit more variables to file scope
Change-Id: I30219d626316776eb73b4205d63376fa3dbc6361
2015-01-11 21:40:51 +01:00
Thomas Jarosch
cfbd9cb22f Make a few local variables static
Change-Id: Ieb77a7f2cdf765afa3121320d03c0478cd97eb0f
2015-01-11 18:02:43 +01:00
Amaury Pouly
66690ca987 Get rid of USE_ROCKBOX_USB
Except for unfinished or experimental ports, it isthe case that
USE_ROCKBOX_USB and HAVE_USBSTACK are both defined or both undefined.
Furthermore, it is a leftover of some early developments on the USB stack and
doesn't make sense anymore.

Change-Id: Ic87a865b6bb4c7c9a8d45d1f0bb0f2fb536b8cad
Reviewed-on: http://gerrit.rockbox.org/1091
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:07:12 +01:00
Thomas Jarosch
fdd4aef340 Make thirty functions static to reduce binary size
If any of those functions should be (unused) API functions,
they can easily be turned back once really needed.

Detected using a new cppcheck check that
uses the internal symbol database to catch
functions that are only used in the current file.

Change-Id: Ic2b1e5b8020b76397f11cefc4e205f3b7ac1f184
2015-01-05 18:44:36 +01:00
Thomas Jarosch
eb9c845db5 Fix up some DEBUGF statements
The last big filesystem code refactoring
broke a lot of debug statements.

firmware/test/fat/ doesn't build anymore,
but that's more or less unrelated.

Change-Id: I4c9e1289eeabe1b59d436b176f1d35a02176614f
2015-01-03 16:01:39 +01:00
Simon Rothen
0b5ad60c26 Introducing Targets iBasso DX50 & iBasso DX90
The port to for this two targets has been entirely developped by Ilia Sergachev (alias Il or xzcc). His source
can be found at https://bitbucket.org/isergachev/rockbox . The few necesary modifications for the DX90 port
was done by headwhacker form head-fi.org. Unfortunately i could not try out the final state of the DX90 port.
The port is hosted on android (without java) as standalone app. The official Firmware is required to run this port.
Ilia did modify the source files for the "android" target in the rockbox source to make the DX port work. The work I did
was to separate the code for DX50 (&DX90) from the android target.
On this Target Ilia used source from tinyalsa from AOSP. I did not touch that part of the code because I do not understand it.
What else I changed from Ilias sources besides the separation from the target "android":
* removed a dirty hack to keep backlight off
* changed value battery meter to voltage battery meter
* made all plugins compile (named target as "standalone") and added keymaps
* i added the graphics for the manual but did not do anything else for the manual yet
* minor optimizations

known bugs:
* timers are slowed donw when playback is active (tinyalsa related?)
* some minor bugs

Things to do:
* The main prolem will be how to install the app correctly. A guy called DOC2008 added a CWM (by androtab.info) to the
  official firmware and Ilia made a CWM installation script and a dualboot selector (rbutils/ibassoboot, build with
  ndk-build). We will have to find a way to install rockbox in a proper way without breaking any copyrights.
  Maybe ADB is an option but it is not enable with OF by default. Patching the OF is probably the way to go.
* All the wiki and manual

to build:
needed: android ndk installed, android sdk installed with additional build-tools 19.1.0 installed

./tools/configure
select iBasso DX50 or iBasso DX90
make -j apk

the content of rockbox.zip/.rockbox needs to be copied to /system/rockbox/app_rockbox/rockbox/ (rockbox app not needed)
the content of libs/armeabi to /system/rockbox/lib/ (rockbox app needed)

The boot selector is needed as /system/bin/MangoPlayer and the iBasso app as /system/bin/MangoPlayer_original. There
is also the "vold" file. The one from OF does not work with DX50 rockbox (DX90 works!?), the one from Ilia is necessary.

Until we have found a proper way to install it, it can only be installed following the instructions of Ilia on his
bitbucket page, using the CWM-OF and his installation script package.

Change-Id: Ic4faaf84824c162aabcc08e492cee6e0068719d0
Reviewed-on: http://gerrit.rockbox.org/941
Tested: Chiwen Chang <rock1104.tw@yahoo.com.tw>
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
2014-09-18 18:19:01 +02:00
Dmitry Gamza
50778c82f1 optimize WSPLL work for iriver h100 and h300 series
For Iriver h100 & h300 series we don't need always use WSPLL,
because in most cases WSPLL clock and SYSCLK has the same value,
and we have additional WSPLL errors to the output clock. Now that is fixed.

Change-Id: I04aebee659c57c45dc8603e409b9db42bdde534a
Reviewed-on: http://gerrit.rockbox.org/434
Reviewed-by: Marcin Bukat <marcin.bukat@gmail.com>
2014-09-05 09:14:53 +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
9a3400a4a6 Fix some more straggling stuff
* HWCODEC bootloaders

* Remove references to thread structures outside the kernel. They are
private and should not be used elsewhere. The mrobe-100 is an offender
that gets squashed.

* The ata.c hack stuff for large sector disks on iPod Video gets squashed
for the same reason. I will no longer maintain it, period; please find
the real reason for its difficulties.

Change-Id: Iae1a675beac887754eb3cc59b560c941077523f5
2014-08-08 03:23:29 -04:00
Szymon Dziok
fb373e1f50 Ak4537: Optimization of the code.
Change-Id: I98e25d7177b24b277a79d8bf8d494dac26553c2c
2014-07-26 15:36:12 +00:00
Szymon Dziok
f734eedc1f Disable detection of fm radio for the YH920, it's pointless.
Change-Id: Ibabda73046dc523c2bd0b1dfd0644f8882fbb74c
2014-07-26 15:36:12 +00:00
Thomas Martitz
8f6c779ff6 Fix some build errors and warnings.
Change-Id: I149c00fc6ba47d5134ad4f74c364bffd24079824
2014-06-21 00:49:05 +02:00
Thomas Martitz
a1842c04f9 lcd-24bit: Introduce a 24-bit mid-level LCD driver
With LCD driver all calculation will be performed on RGB888 and the hardware/OS
can display from our 24bit framebuffer.

It is not yet as performance optimized as the existing drivers but should be
good enough.The vast number of small changes is due to the fact that
fb_data can be a struct type now, while most of the code expected a scalar type.

lcd-as-memframe ASM code does not work with 24bit currently so the with 24bit
it enforces the generic C code.

All plugins are ported over. Except for rockpaint. It uses so much memory that
it wouldnt fit into the 512k plugin buffer anymore (patches welcome).

Change-Id: Ibb1964545028ce0d8ff9833ccc3ab66be3ee0754
2014-06-21 00:15:53 +02:00
Thomas Martitz
0250be1d67 lcd-16bit: Split out some functions to lcd-color-common.c
An upcoming lcd-24bit.c driver will re-use a lot of code from the 16bit
drivers, so prepare for that.

Change-Id: I7bc7f6b992e5e3f4e0a0aa54dc08103ebb05315f
2014-06-21 00:13:58 +02:00
Szymon Dziok
eacd76cb80 Radio and radio recording for Samsung YH-920.
There is no simple method to detect radio through the 3-wire interface, so it's
not implemented for the YH-925 for now. YH-920 always has a radio.

Change-Id: Iea484d752915fcd40dbbbd7dbbf13e81aaf548db
2014-06-18 18:06:17 +00:00
Szymon Dziok
0c3dca1f33 Samsung YH820/YH92X: Improve recording.
Because of architecture of the codec it's always necessary to route the input
signal from ADC to DAC, in order to have a control over the monitoring volume
and in order to hear anything while recording.

Change-Id: I1089894c949ab7371857d74aedb6bdf5a7d39c41
2014-06-18 18:06:17 +00:00
Szymon Dziok
81db2f5eb0 YH92x: Use the led near the lcd as the ATA led, instead of shine all the time.
Change-Id: I139d0a8dc00e4d5fd964c3667e598aec923cc1cd
2014-06-18 18:06:17 +00:00
Sebastian Leonhardt
53efa59e12 recording on Samsung YH-820/YH-92x
Change-Id: I6eac4cf6c16a322910ad17bfbf3105e330cd0e36
Reviewed-on: http://gerrit.rockbox.org/815
Reviewed-by: Szymon Dziok <b0hoon@o2.pl>
Tested: Szymon Dziok <b0hoon@o2.pl>
2014-06-01 23:25:12 +02:00
Dmitry Gamza
7e85fe5be1 some optimization for iriver h100 and h300 series
Turn on 4x oversampling inside UDA1380 codec.

This allow will move the quantization noise to the higher frequencies,
that slightly improve the final sound quality.

Change-Id: Idf79cd877c526d8937a47c34e9c180d837a15db1
Reviewed-on: http://gerrit.rockbox.org/435
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
Reviewed-by: Björn Stenberg <bjorn@haxx.se>
2014-03-18 14:12:06 +01:00
Sebastian Leonhardt
1cf17436b7 Fix (unintentional) linkage of HAVE_BUTTON_DATA with HAVE_TOUCHSCREEN
Defining HAVE_BUTTON_DATA without simultaneously defining HAVE_TOUCHSCREEN
caused compile errors. (I need them separated for a scrollstrip driver.)

Change-Id: I945d3437d840035ccc0c147f8155029b403c6ec2
Reviewed-on: http://gerrit.rockbox.org/771
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
2014-03-18 10:56:19 +01:00
Thomas Martitz
157562bdbd Fix ipod6g build.
Change-Id: I218e1721b8ddbb067581f4bc686a20f4c88694ae
2014-03-09 18:18:45 +01:00
Thomas Martitz
68768260e8 Fix more reds.
Change-Id: I4b58dda0953b7f9799238c32b78037b0a5403c04
2014-03-03 20:26:08 +01:00
Thomas Martitz
c245de029d Fix various reds. Some includes needed fixup.
Change-Id: I4327740bae17054131feb917abdd58846c451988
2014-03-03 19:10:48 +01:00
Thomas Martitz
382d1861af kernel: Break out kernel primitives into separate files and move to separate dir.
No code changed, just shuffling stuff around. This should make it easier to
build only select parts kernel and use different implementations.

Change-Id: Ie1f00f93008833ce38419d760afd70062c5e22b5
2014-03-03 18:11:57 +01:00
Amaury Pouly
812c3e7c48 imx233: add support for speaker on stmp3780
Change-Id: I990ca2bd43e12047e257f85ff06f046dfa3f94b3
2014-02-16 20:53:08 +01:00
Lorenzo Miori
e876f4df6d Samsung YP-R1 target port
This is the basic port to the new target Samsung
YP-R1, which runs on a similar platform as YP-R0.
Port is usable, although there are still
some optimizations that have to be done.

Change-Id: If83a8e386369e413581753780c159026d9e41f04
2014-02-05 09:56:21 +01:00
Thomas Martitz
9892b39567 charcell: Fix lockup after some scrolling lines.
Change-Id: I5cabbd396e2a6d4e9fd8e92090624643797af34a
2014-01-26 17:56:55 +01:00
Thomas Martitz
0a0d61e777 Fix remote warnings and charcell reds, and remove minor left-over tuff.
Change-Id: I10987ea9fcad94d502afd4ae4a80ab9022c75d2e
2014-01-12 01:50:21 +01:00
Thomas Martitz
488a1b983e put_line/scrolling: Make the scroll engine inform custom scrollers about start/stop of scrolling.
With the new lcd_putsxy_scroll_func() code can register custom scroll functions
(put_line() makes use of that). In order for the custom scroller to be able
to properly manage its userdata pointer (set via struct scrollinfo::userdata)
the scroll engine must inform the scroller about start and stop of scrolling.

To inform about start the lcd_scroll_* functions now return true when
the line will scroll. To inform about stop the scroll engine calls into the
scroller one last time, with the text set to NULL.

put_line() can use this to release the userdata registered per scrolling line
so that it can be recycled.

This fixes that some scrolling lines became glitchy after some time because
the userdata was recycled too early.

Change-Id: Iff0a6ce2a4f9ae2bada1b8e62f4f5950224942a9
2014-01-12 01:34:06 +01:00
Thomas Martitz
26b317e094 scroll engine: Factor out renderer function so it can be called by lcd code.
This is used by lcd_puts_scroll_worker() to render the line immediately
instead of waiting for the next scroll tick when only the text was updated.
Previously lcd_puts_scroll_worker() did not render anything in this case
which could lead to visible blinking.

This fixes blinking scrolling lines with dynamic text in the skin engine.

Change-Id: I475bde8c8eb7c92f505e3c5ecf4d32bb90690536
2014-01-11 19:17:58 +01:00
Thomas Martitz
fde92de224 lcd_nine_segment_bmp: Fixes for non-ideal image dimensions.
1) The 9-segment images need not be multiple of 3 pixels anymore. If it
isn't the inner segments will be smaller than the corners.

2) If the desired actual images is not a multiple of the segment sizes the
function drawed more than the desired rectangle. This is fixed by
drawing the last segment only partially.

Change-Id: Ic918facd8734fa4a4aa72536f0b67de82d81651e
2014-01-09 00:43:46 +01:00
Thomas Martitz
e1c7b3b8f7 lcd-16bit: Remove {lss,lse,lst}_pattern fields from struct viewport.
These where used for line styling during scrolling, which is now done in apps/,
The  viewport struct doesn't need to record these anymore.

Change-Id: I810d9dcb2644b00a798c6e75acab69c74a78e77f
2014-01-07 14:13:48 +01:00
Thomas Martitz
deb6ac3693 lcd-16bit: Move lcd_gradient_fillrect/_part() to lcd-16bit-common.c.
Change-Id: I6b2d2ba73464610556cfd9ecec52fc62adb007c7
2014-01-07 14:13:48 +01:00
Thomas Martitz
36e469db8b lcd-common: Remove direct style (line decorations) from lcd-puts* functions.
This logic is moved into apps (put_line()) which can better handle line
decorations with respect to scrolling, mulitline and other complications.

Firmware doesn't need this. The remaining drawing function know only one style,
that is foreground on background/backdrop (changing drawmode is still supported).

Change-Id: I707060edc388a7d723a7d09b0cf5cbda6ec56708
2014-01-07 14:13:48 +01:00
Thomas Martitz
ad0985ea1c lcd-common: Remove support for specifying y_offset from lcd_puts* functions.
This main (and only) purpose for it was to adjust the pixel position of the text
in otherwise linebased (scrolling) functions. With pixel-based scrolling
this isnt necessary anymore.

Change-Id: I2a45b8ca6a3f8f50aa2f6630201b30ce9ddfe043
2014-01-07 14:13:48 +01:00
Thomas Martitz
4978094480 lcd-common: Remove support for custom line heights from viewport.
Since scrolling is now pixel-based this is not necessary anymore. custom line
height is handled by put_line() but can also possible to implement with
lcd_puts_scroll_func().

Change-Id: Iee9b12bf99afac93d95d2a1a6f5d5b4db237b21c
2014-01-07 14:13:48 +01:00
Thomas Martitz
9a4686b563 lcd-common/scroll_engine: Remove unused functions lcd_puts_style_xyoffset() and lcd_puts_scroll_style_xyoffset().
With this functions removed there is no exported function in firmware left
that draws line decorations. Also no function supports specifying an y-offset
anymore (was used for pixel accurate positioning of otherwise strictly line-based
API calls).

Both should be handled in apps/ now.

Change-Id: Iba4b28ccc6e686c7db63e34b51ad4badae983fce
2014-01-07 14:13:48 +01:00
Thomas Martitz
775ebe4ff6 lcd-common/scroll_engine: Remove unused functions lcd_puts_scroll_style().
Change-Id: Ia4f943b3738ab6e66b0e3f1507c629b36d7eba94
2014-01-07 14:13:48 +01:00
Thomas Martitz
7cd07290e6 lcd-common: Remove unused function lcd_puts_style_offset().
Change-Id: I24da23d132f933fe647416dc58e8f50879715423
2014-01-07 14:13:48 +01:00
Thomas Martitz
1e324aac36 lcd-common: Remove unused function lcd_puts_style().
Change-Id: Id2c64c116f79b8e61a7af49b9072b3e884ffb455
2014-01-07 14:13:48 +01:00
Thomas Martitz
8f64625888 lcd-common: Remove unused function lcd_puts_offset().
Change-Id: I39749bf3db915e5a8ddb6e6f25eb201ea0aaf981
2014-01-07 14:13:48 +01:00
Thomas Martitz
a422604435 lcd-common/scroll_engine: Remove unused functions lcd_puts_scroll_offset() and lcd_puts_scroll_style_offset().
Change-Id: Ia84ae88020d06a1cb634942ab5e635fd5d10ac66
2014-01-07 14:13:48 +01:00