1
0
Fork 0
forked from len0rd/rockbox
Commit graph

3466 commits

Author SHA1 Message Date
Solomon Peachy
8c86fb6da0 arm: Use -masm-syntax-unified when compiling with gcc8 or newer
Annoyingly, this makes all of the '.S' files we compile get treated as
divided syntax, so we need to make the syntax in them explicit.

Change-Id: I56a3916b7b24c84a1214a5d6bc4ed4d651f002cf
2024-05-08 21:45:42 -04:00
Solomon Peachy
886060475e ata: Heavily rework sleep and poweroff logic
* Use of ata_disk_can_poweroff() was inverted, resulting in SATA SSDs
   getting powered off but leaving _everything_ else on, including spinning
   rust!
 * Replace the can_poweroff() heuristic with a test for the mandatory
   ATA power mgmt feature flag. Notably, the CF->SD adapters don't claim
   to support this!
 * Eliminate duplicated tests in sleep code
 * Wrap all poweroff-related code with HAVE_ATA_POWER_OFF
 * Don't ever use SLEEP command, only STANDBY_IMMEDIATE
 * Gate call to STANDBY_IMMEDIATE behind a can_poweroff() test
 * Prefer FLUSH_CACHE_EXT to FLUSH_CACHE where available.
 * Improve SSD detection heuristics to any of these:
   * Explicltly identifies as SSD (covers newer CF and SATA)
   * TRIM support
   * CFA compliant AND (CF level 0 OR high speed support)
 * Report SSD detection in debug menu

Change-Id: I7fcb83b6d6eabddc11c64326a573b08ab85412b5
2024-04-22 15:46:30 -04:00
Roman Artiukhin
f5a852304b Sansa e200v2: bootloader: enable SD boot
Use rockbox_main.e200v2 for boot redirect

Max allowed size: 120860
Thumb build: 119579

Change-Id: I4683b1bdd247d41eaf4393b999db4ef5cd7a4010
2024-04-01 11:44:22 -04:00
Aidan MacDonald
cc210a7161 Fix red in c36d7768c5
Change-Id: Iadcfd322b32cf8523579c9e21a59928a621f15e1
2024-04-01 16:30:41 +01:00
Roman Artiukhin
c36d7768c5 Sansa e200v2: bootloader: fit size
Max allowed size: 120860
Old thumb build: 128494
New thumb build: 118514 (fits!)

Disabled:
Logo;
alpha blending capabilities for bitmaps;
Arm stack unwinder (backtrace);

Related forum discussion: https://forums.rockbox.org/index.php/topic,54768.0.html

Fixes FS#12380

Change-Id: I978720d795cb0ef5169103e467cf8386c21d8e93
2024-04-01 11:02:04 -04:00
Aidan MacDonald
dc9d354ed2 multiboot: Add v1 boot protocol
v1 passes the drive and partition number of the boot volume
instead of using the volume number. The volume number isn't
reliable because the same filesystem might get a different
volume number once the firmware is loaded, which will cause
the firmware to use the wrong root volume and fail to locate
the correct .rockbox directory.

Using drive and partition numbers avoids this issue because
drive numbering is fixed and determined by the target.

Change-Id: I7e68b892d9424a1f686197a6122e139b438e5f7e
2024-03-31 16:57:19 +01:00
Aidan MacDonald
6ffd42548b multiboot: Refactor boot data validation, add version numbers
Instead of verifying the CRC before every access of the boot data,
verify the CRC once at startup and set a flag to indicate the boot
data is valid.

Also add a framework to support multiple boot protocol versions.
Firmware declares the maximum supported protocol version using a
version byte in the boot data header. The bootloader chooses the
highest version supported by it and the firmware when deciding
what boot protocol to use.

Change-Id: I810194625dc0833f026d2a23b8d64ed467fa6aca
2024-03-31 16:57:19 +01:00
Aidan MacDonald
af644e02a1 Fix red in 5fd5f56cac
Change-Id: Icbc6e234a2fcdd7c8e0cdd0562f49fcbdf52480b
2024-03-31 16:57:19 +01:00
Aidan MacDonald
5fd5f56cac Disable unused LCD scroll functions in bootloaders
These functions just reset some state related to the scroll engine,
which is already disabled for bootloaders. They get called from the
LCD code and compiled into the binary, but have no real effect when
the rest of the scroll engine is not present. Replacing the calls
with inline stubs gets rid of this dead code from bootloaders.

Change-Id: I12a6d8926e19477ae3a5913e7fc8aff41cecd970
2024-03-31 11:36:16 -04:00
Aidan MacDonald
b0a8cacd1d rolo: simplify parsing scramble header in load_firmware()
The standard load_firmware() function is used on targets which
use the "scramble -add" method for generating Rockbox binaries.

While it tries to be a bit more generic and allows the CRC/data
offsets to be placed anywhere in the file, there are no targets
which actually need this flexibility, because they are all using
plain old "scramble -add".

So we can actually simplify load_firmware() and remove defines
from the target headers. All the targets used CRC offset = 0 and
data offset = 8, except for a few which I assume never supported
ROLO or were never tested -- eg. samsungyh820: the CRC and data
offsets cannot both be 0.

The actual motivation for this is removing the calls to lseek(),
which can help make bootloaders a tiny bit smaller, as lseek is
typically not used anywhere else in bootloaders.

Change-Id: Ic2d01e5b75a32e88363f085e3e839146a0710bf4
2024-03-31 11:24:07 -04:00
Aidan MacDonald
7dc8d754a2 Disable legacy codepage handling in bootloaders
Turn off legacy codepage handling in the filesystem code for
bootloaders, and support ISO-8859-1 (Latin-1) only.

This only affects DOS 8.3 filename parsing when FAT32 long
names are unavailable; long names are Unicode and can always
be decoded properly regardless of this setting.

In reality, bootloaders never supported codepages other than
Latin-1 in the first place. They did contain the code to load
codepages from disk, but had no way to actually change the
codepage away from Latin-1.

Compiling out this useless codepage handling code frees up
precious space for very size-constrained bootloaders like the
Sansa e200v2.

Change-Id: I26b049dd648fed4a0cc61fa938faa84e9816ab7d
2024-03-31 11:07:08 -04:00
William Wilgus
fe00906abb pathfuncs.c add path_strip_leading_separators()
added to path_append as well

Change-Id: Ieb6ec4f4c475ca5e60c8246c7f044bcc7651f6bf
2024-03-30 11:01:53 -04:00
Roman Artiukhin
6e058fe77f platform: hiby: Increase CODEC_SIZE to 1 Mb
Unifies codec size with most targets.

Apart from other things increased size improves seek accuracy in long m4b audiobooks.

Tested on Agptek Rocker and XDuoo X3II

Related discussion: https://www.rockbox.org/tracker/task/13049#comment44591

Change-Id: Id246969e78386b71ac66aace128cfba72a3f209e
2024-03-26 02:31:48 -05:00
roman.artiukhin
ed27dac432 Fix CODEC_AAC_SBR_DEC check with undefined CONFIG_CPU
Define CONFIG_CPU if not defined

This fix makes sure that  AAC-LC decoding is used both on device and simulator.
It's important for testing purposes as proper AAC-LC decoding requires changes both in decoder and in metadata handling.

Fixup for 4cd65b9d9.

Change-Id: Idef88825458761fffa3f5c5f4f221b555c509d89
2024-01-02 10:05:17 -05:00
Dana Conrad
8cc7476735 ErosQ Native ES9018K2M: Add digital filters capability
Setting not yet hidden for older hardware revision.

Change-Id: Iaaa5727e63c38de578a6bbc73498ae1073180e65
2024-01-02 08:19:23 -05:00
Dana Conrad
a3fe07ff12 ErosQ New Revision HW volume
Add HW volume control via ES9018K2M, and reorganize
eros_qn_codec.c/.h, audiohw-erosqnative.c.

This automatically detects the presence of the new DAC and
uses its hardware volume scaling. If not present, use same
SWVOL we have been using so far.

Add debug menu readout of SWVOL/I2C result.

Break out es9018k2m stuff into its own file so that
maybe it can be useful to other ports.

Note that we may need to get smarter about detecting the DAC
type if/when another model emerges.

Change-Id: I586a1cf7f150dd6b4e221157859825952840af56
2024-01-02 06:51:07 -05:00
Solomon Peachy
161c861153 Fix red in 4cd65b9d9
Change-Id: Ic3f136f5c88c46da68b78bc21ddefdf9fdbf2745
2023-12-31 21:30:18 -05:00
roman.artiukhin
4cd65b9d97 Codecs: mp4: Disable SBR decoding for PP5002 - PP5022 platforms
Includes ipod video (5G) and earlier models, sansa c200 and others players not capable to decode AAC-HE.

Allows to play backward compatible files as AAC-LC.

Change-Id: Ic9f5c0f255d9a4308c3414d402f8f27f4328ca94
2023-12-31 20:44:15 -05:00
William Wilgus
cb3b5397b3 Revert "Extend path_append_ex to truncate compname, remove some strmemdupa"
This reverts commit dbe20d453d.

Reason for revert: Crashes ipod Classic

Change-Id: I9ea329ce73383535353832d17c7c5e494e5ad516
2023-11-23 21:26:13 -05:00
William Wilgus
dbe20d453d Extend path_append_ex to truncate compname, remove some strmemdupa
remove some duplicated strings previously allocd off the stack

just removing string duplications that are easily handled with truncation
now available with path_append_ex()

this also has an advantage of less stack used in worst case scenarios

Change-Id: I3a43e33ef8a8c36599e4c6c036a0ccdd8ed0c883
2023-11-19 12:00:02 -05:00
William Wilgus
7ac4d34dd6 Playlist slight optimizations for playlist_resume
Change-Id: I766ce032a9b6b36d750a9231ff9f5d5a0167e5a5
2023-11-09 21:03:25 -05:00
Uwe Kleine-König
1ee152b5a4 sansaclipplus: enable usb-hid mouse support
Change-Id: Ifbebf9ff8474882a29378515e010e9c9d39df5c3
2023-10-27 19:31:41 +02:00
Aidan MacDonald
781f955aa2 Remove structec API
In my opinion this API is just not very useful - design is kind
of questionable. There are hidden limits on the struct size and
bugs on 64-bit platforms due to assuming sizeof(long) == 4.

At the end of the day, the only major user was the tagcache and
it's actually less code size to do endian swapping manually.

Change-Id: I451c7f1a10cf3e28744c32c0f1f39a710d5cc100
2023-10-01 12:10:41 +01:00
Aidan MacDonald
a6eaffe40d powermgmt: Remove CURRENT_USB
CURRENT_USB overrides CURRENT_NORMAL when USB is plugged.
It defaults to 2 mA and wasn't defined on any target, but
this doesn't make sense to me. After all, the current
drawn by the CPU or other components won't change just
because USB was plugged in.

As far as I can tell, the only side effect of removing
this is reducing the estimated USB charging current.
This might mean CURRENT_MAX_CHG should be increased by
CURRENT_NORMAL on some (all?) targets to compensate,
but I'm not sure which targets would be affected.

Change-Id: I5aa5c3893ae1e4ce6b8803ab4e8c897d534eb08f
2023-09-30 03:21:52 -04:00
Aidan MacDonald
fee5013514 disk: Remember the partition number for each volume
Change-Id: Ied6b0a558eec57435f9299f3e3326714f5e3cdca
2023-09-28 18:07:26 -04:00
Aidan MacDonald
028f283ee5 disk: Add "struct volumeinfo" to store volume related info
Change-Id: Ifd338d38db127d7896c43d1d25e70d0fae29fa1c
2023-09-28 18:07:26 -04:00
roman.artiukhin
7bbaf74c5c Ability to control backlight for soft lock action
See Settings -> General Settings -> Display -> LCD Settings -> Backlight on Lock

Change-Id: I201cb1c2907bb6842bf5d0b7a657e9db27aa905a
2023-09-09 22:00:14 -04:00
Christian Soffke
03d326fc90 Remove obsolete alias for audio_record function
Rockbox doesn't support HW codec anymore

Change-Id: Ia20d3f02f0d9db88b23cf9074e4d76aa21fd53b0
2023-08-17 13:40:09 +02:00
Solomon Peachy
5dc0e4e0bc disk: Support GUID Partition Tables (GPT)
Notes:

 * Currently limited to 32-bit sector addresses due to internal Rockbox
   APIs. So this means a practical limit of 2TiB per drive.
 * Only 'General Data' GPT partition type is recognised, as that's
   what SD cards seem to use for exFAT/FAT32.

Note that _booting_ off GPT-partitioned drive will require rebuilding
the various rockbox bootloaders, and even then there may be platform
limitations that preclude this.

Change-Id: Ibfaae1960adcb1e81976d4b60dd596c6d16318e4
2023-05-21 20:34:03 -04:00
William Wilgus
78c92c5ca8 [Feature] Supress voice during sleep timer shutdown
if show_shutdown_message == false and sleep timer is active
talk will be disabled on shutdown

Change-Id: Ia660e753700f3e283691f41797ef7a77a2d9a8d9
2023-04-08 17:13:07 -04:00
Aidan MacDonald
58b2e45782 Fix unified syntax in ARM inline assembly
GCC 4.9 always emits assembly with divided syntax. Setting unified
syntax in inline assembly causes the assembler to complain about
GCC's generated code, because the directive extends past the scope
of the inline asm. Fix this by setting divided mode at the end of
the inline assembly block.

The assembler directives are hidden behind macros because later
versions of GCC won't need this workaround: they can be told to
use the unified syntax with -masm-syntax-unified.

Change-Id: Ic09e729e5bbb6fd44d08dac348daf6f55c75d7d8
2023-03-23 18:16:33 +00:00
Chris Chua
86429dbf1e Using ARM Unified Assembler Language
Change-Id: Iae32a8ba8eff6087330e458fafc912a12fee4509
2023-03-23 13:28:22 -04:00
William Wilgus
a749a95840 font.c cleanup
find_font_index can use font_filename_matches_loaded_id()

font_path_to_glyph_path doesn't need strcat

Change-Id: I8d1d36a68abbc700078d651eed930035641b6240
2023-02-15 23:02:36 -05:00
William Wilgus
91c8633e8c [BugFix] font.c filename was movable
stupid bug on my part font_filename was pointing to a movable
alloc therefore that data could be moved out from under the returned pointer

instead pin the internal calls to core_get_data and
remove font_filename in favor of a function that checks if a
filename matches the loaded font as this was all it was used for anyway

Change-Id: Iebb47ffe3f81aa9d5e3968975f26d64283633ffc
2023-02-15 01:15:59 -05:00
Aidan MacDonald
5b27e2255a Add perceptual volume adjustment
The perceived loudness change of a change in volume depends
on the listening volume: at high volumes a 1 dB increment is
noticeable, but at low volumes a larger increment is needed
to get a comparable change in loudness.

Perceptual volume adjustment accounts for this fact, and
divides the hardware volume range into a number of steps.
Each step changes the dB volume by a variable amount, with
most of the steps concentrated at higher volumes. This
makes it possible to sweep over the entire hardware volume
range quickly, without losing the ability to finely adjust
the volume at normal listening levels.

Use "Volume Adjustment Mode" in the system settings menu
to select perceptual volume mode. The number of steps used
is controlled by "Number of Volume Steps". (Number of steps
has no effect in direct adjustment mode.)

It's still possible to set a specific dB volume level from
the sound settings menu when perceptual volume is enabled,
and perceptual volume does not affect the volume displayed
by themes.

Change-Id: I6f91fd3f7c5e2d323a914e47b5653033e92b4b3b
2023-01-22 21:19:57 +00:00
Dana Conrad
66519000f4 ErosQNative: Enable Line Out capabilities on new revision players
The newer players have some changed hardware, but most importantly
the line out now appears to be routed through the stereo switch
instead of being hardwired directly off the DAC.

Disable muting the headphone amp, enable switching the stereo switch,
and rename some of the GPIOs to be more generic since the DAC,
headphone amp, and stereo switch all appear to have changed.

Change-Id: I220fe5e37bcbcd959b544183e1fcf70673a83c13
2023-01-22 15:11:35 -05:00
Aidan MacDonald
92565e9246 buflib: Add malloc-backed buflib
This is intended for improving the effectiveness of tools like
ASAN when debugging memory errors in the sim. It's not meant to
be a serious allocator for hosted targets.

Enable it by changing the buflib backend in config.h.

Change-Id: I0cf23cefa47ee35dede7b49e0e5b72dac60e8d3e
2023-01-15 10:04:13 +00:00
Aidan MacDonald
f995c26de9 buflib: Add CONFIG_BUFLIB_BACKEND for selecting a buflib backend
Defaults to the normal "mempool" backend, which is currently the
only implementation.

Change-Id: I56d034a6e0f5edc90c39526d1551945eec6ca336
2023-01-15 10:04:13 +00:00
Solomon Peachy
255a34c685 fix red from #641e91aa2f
Change-Id: I7e648a7bdf1d706258afd49c1edd63655b2d2830
2023-01-13 17:02:23 -05:00
Solomon Peachy
641e91aa2f jz47xx: Add support for INIT region
Change-Id: I100cd661e9b1225167463542800c6aafbc3c17b3
2023-01-13 16:14:42 -05:00
Aidan MacDonald
16a32c576c Fix red in 7e5fc4076a
Change-Id: I1704ea0de243bff05262556723daea5b3531558b
2023-01-12 11:56:47 +00:00
Aidan MacDonald
7e5fc4076a Add INIT_ATTR to i2c_init()
It's usually only called from init() in main.c, so this is safe.

There is one more call in system-dm320.c from system_init(), but
that's also "safe". I don't know if it's okay to call i2c_init()
twice, but presumably it works...

Change-Id: I9c1cd918d162d9955f7cf03209e836cbd5e30c57
2023-01-12 06:33:50 -05:00
Aidan MacDonald
39439f6909 Add INIT_ATTR to system_init()
On single-core targets, system_init() is only called from init()
in main.c, which is also INIT_ATTR, so this is safe.

Multi-core targets additionally call system_init() from cop_main(),
which isn't marked INIT_ATTR. I'm fairly certain that it would be
safe to add INIT_ATTR to cop_main() with a bit of refactoring, but
I don't have a way of testing it. So for now, leave INIT_ATTR off
for multi-core targets.

Change-Id: I8fe4358f975880ca317d46bda01d7d9db529d3e3
2023-01-12 06:05:55 -05:00
William Wilgus
9367ef1ed6 [BugFix] Fix some Shif related UB -- ASAN
these are the low hanging fruit identified by ASAN

cast the byte values before shift

Change-Id: Ifc5645354a10c15ccd09d1343e1705857a51e011
2023-01-04 22:00:25 -05:00
William Wilgus
84fe501f53 Add locked actions to all soft lock targets
fiio m3k native is currently the only player with
defined buttons different from the standard
mapping.

This allows the user to use the keyremap plugin
to specify differing keymaps for their device in the locked state

Change-Id: Ie0b447bba0d5978e8d23fed423df30c794afc6f9
2023-01-02 13:19:43 -05:00
William Wilgus
a00bd421ac clean up button.c optimize !filter_first_keypress
do a bit of cleanup in button_tick move filter_first_keypress to a function pointer

Change-Id: Iefb05c1a182c1e15cfb5bca8e2ef31a710d15eba
2023-01-02 11:04:47 -05:00
William Wilgus
3def8fee8c [FixRed] ClipV2 has a hold button -- news to me
HAVE_LOCKED_ACTIIONS requires !defined(HAVE_HOLD_BUTTON)

Change-Id: I1e98c282f17d11f08ea80cd5963b331a3ae19387
2022-12-31 17:12:36 -05:00
William Wilgus
6ebec601f9 [Feature/Bugfix] keyremap add Context flags
Add context flags to keyremap
CONTEXT_LOCKED
CONTEXT_REMOTE
CONTEXT_REMOTE_LOCKED

--CONTEXT_PLUGIN-- Removed -- Plugins need a custom action list
supplied and a method of supplying them

Change-Id: I5201d275ad0ab6130c2d05d5afb0c450f5c1746c
2022-12-31 16:12:18 -05:00
Aidan MacDonald
a980d5f869 x1000: Enable support for INIT_ATTR
Enable INIT_ATTR support in config.h. Load init code to the
codec buffer, following the convention used by other targets
that support INIT_ATTR.

Change-Id: I8935fbaa100f0013bb328d71c4a49ec2ffafd003
2022-12-31 08:10:41 -05:00
Solomon Peachy
646d5f92ef ata: Prevent powering-off ATA hardwre if it reports as mSATA or m.2
As those form factors are typically not runtime removable and as such
expect to always being powered up.

This is an experimental change, and we might revert it if it doens't help

Change-Id: I61187f297866f64589a546352828a0ff8169fa30
2022-12-20 20:38:43 -05:00