1
0
Fork 0
forked from len0rd/rockbox
Commit graph

11911 commits

Author SHA1 Message Date
Solomon Peachy
5a4030cb35 usb: Partial revert of previous commit
...A rebase gone wrong led to a bunch of extra crap in the commit.

Change-Id: Id8f0e33b9fba0949594701fbc574da58e74fa776
2025-10-05 15:56:00 -04:00
Solomon Peachy
43ec77f84c usb: Strip ALL spaces from passthrough ATA serial number
Leading spaces in particular were resulting in Linux warnings/panics, but
to be safe strip out all spaces, including those in the middle.

This was noticed on an ipod6g with the stock hard drive; it reported
a serial number of '            xxxxxxxx', which is technically legal
per ATA specs, but needs to be properly trimmed.

Change-Id: I34309fe64b341caefd5b18f6d0cf539cb97d4a38
2025-10-05 15:48:12 -04:00
Aidan MacDonald
e24deccd00 sound: fix volume change being reported to %mv tag on boot
Setting the last_volume_change time was moved here in
commit 2e08b0f82e ("sound: update global volume state
in sound_set_volume()"); however this also triggers the
%mv tag on boot, as if the user was actively changing
the volume.

Move the last_volume_change update back to the original
call sites to fix this.

Change-Id: I895112cea4315f194f67c27839f1082d67c1ffa9
2025-10-03 10:01:02 +01:00
Aidan MacDonald
b19b95c00f sound: update global volume state in sound_set_volume()
Instead of calling sound_set_volume() and then manually
setting global_status.volume to match, update the global
volume state directly in sound_set_volume(). This makes
things a bit simpler and less error-prone.

Change-Id: I4db4d60ae1a72bd051ef49c90b1ae7f5ba59e535
2025-10-02 14:32:54 -04:00
Sebastian Leonhardt
a7cf86e5c1 Creative ZEN: enable multiboot
defines redirect file name as "rockbox_main.zen"

Change-Id: Ieb0f10492ccf6edfa5652882ec031a7b4e862b04
2025-10-02 08:52:33 -04:00
Sebastian Leonhardt
58ad4ecf54 IMX233: make use of register define for bootdata
(the #define is already there, just unused)

Change-Id: I96d5cfe3ffc87a918eb6cd3e1eca8d9f4c91e13f
2025-10-02 13:06:11 +02:00
Solomon Peachy
1ab63c3d92 ipod: Small cleanup of piezo code on PP502x-based iPods
Basically use proper register names instead of magic values.

PP5002-based ipods (ie ipod1g-3g) use UART1 to drive the piezo vs
PWM of the newer models.

Change-Id: Ia333717a825ac6a0ebf43850fc31fca34178dd88
2025-10-01 20:46:43 -04:00
Aidan MacDonald
b09ce21023 echoplayer: fix incorrect button reporting
Must've been a copy paste error...

Change-Id: I751c529c748037f9afe5d2e4543d3630693d2d21
2025-10-01 18:28:12 +01:00
Solomon Peachy
aef5cec1ad disk: Minor cleanups with respect to virtual<->logical sector mapping
Change-Id: Ib20c73c8afe6cf71165600ace1b2ca4b10de2ae8
2025-09-22 22:12:59 -04:00
Solomon Peachy
d7d80a0c3a misc: Fix up more gcc9 warnings
Change-Id: Ia2f763ca7494c6a93b48bdd347a91f3d1a967f29
2025-09-21 09:03:00 -04:00
Solomon Peachy
b71fb1f12a misc: Fix some build warnings with gcc9
ata-creativezen looks like a legit memory-trashing bug, the rtc fixes
are bitwise inversion of a bool, and the remaining are just unused
static variables.

Change-Id: I1a818d4839cd3a54ca6e85f26feb743a4a9d29dc
2025-09-21 00:18:28 -04:00
Solomon Peachy
6340e79cda ipod6g: Improve power management with CE-ATA devices
* IDENTIFY_INFO flags that signify power management are _optional_
 * CE-ATA always supports STANDBY IMMEDIATE and FLUSH CACHE EXT

Change-Id: I7d575437d91f02267021fe680b9b49914e79291e
2025-09-17 08:23:41 -04:00
Solomon Peachy
44ce302348 janitorial: move FAT code from firmware/drivers to firmware/common
It's not a "driver" that interacts with hardware.

Change-Id: I7d688e1086aa118569ebc1440e20b48d0ae4881e
2025-09-17 08:23:41 -04:00
Solomon Peachy
6150e556fe unicode: Turn on 32-bit unicode for targets with >2MB RAM
Change-Id: I199dc928fc9a88fa4bff7bdb3dc03bb212612f6f
2025-09-16 20:56:16 -04:00
Solomon Peachy
5c38669476 fat: Fix warning with fat_file_sector_size with (MAX_VARIABLE_LOG_SECTOR && HAVE_MULTIVOLUME)
Change-Id: I9bc7206b8121645688f5901ab448eba4077cba92
2025-09-16 16:50:32 -04:00
Solomon Peachy
9644bb5d9d ipod6g: CE-ATA uses a 4K block size at minimum
Therefore, turn on MAX_VARIABLE_LOG_SECTOR so we can support 512B and 4K
sector sizes.  Additionally, correct the interpretation of identify info
word 106 in CE-ATA mode.

Change-Id: I24dc7dd4a8617fcb60ed87c0c1be98d00dbdfa30
2025-09-16 15:12:16 -04:00
Solomon Peachy
4960a3b753 ipod: Turn on SMART support for all PP502x-based iPods
Unless you've modded the device with modern CF or mSATA storage, it's
not likely to achieve anything.  the original hard drives (supposedly)
lack SMART support, and none of the SD adapters bother to emulate it.

Change-Id: Id3cbe717c64947faf4b23d8c84a04b822cfb35da
2025-09-16 10:59:57 -04:00
Solomon Peachy
c307fd5525 ata: Parameterize the SMART query, add support to primary ATA driver
There are numerous sub-commands, this makes it possible to call the others.

Also in this patch is the ability for the "default" ATA driver to
query smart data too

Change-Id: Ie3aaf9e0b2d7a5d25d09dea34e4f10ee29047e1b
2025-09-16 09:52:05 -04:00
Solomon Peachy
bb605c91a4 usb_storage: Support 12/16-byte ATA passthrough
This is an unofficial command that many USB<->ATA chipsets support,
allowing direct passthrough of ATA commands to the device.

We don't pass things through as-is; instead we only intercept and handle
requests for IDENFITY INFO and SMART.  Everything else will return an
error.

Change-Id: I3bbb76990e5f6f0512f6eb42825fa505475b2ecd
2025-09-15 18:04:11 -04:00
Solomon Peachy
14157860b9 rgnano: Shrink CODEC and PLUGIN buffer sizes to reasonable sizes
(From 4MB->2MB and 8MB->2MB, respectively)

This is a hosted platform with a decent amount of free RAM; however
plugins and codecs are dlopen() which doesn't count against those
buffers.  Furthermore, the rgnano uses musl libc which does NOT
implement dlclose() so plugins, codecs, etc stick around in RAM
indefinitely even if they are never used again.

By shrinking these buffers we free up a bit more headroom for dlopen()
to leak, and for the host OS to provide disk caches and whatnot.

Change-Id: Ie657bd3b9fc8bd2a1f4bbc07debe3b10538c41c3
2025-09-13 08:44:38 -04:00
Solomon Peachy
19ee9363d1 ibasso: Rejigger RAM and buffer sizes a little
Shrink audio buffer from ~256MB to ~192MB.  Increase plugin buffer size
to 2MB, not that it should matter given how much extra RAM this platform has.

This leaves plenty of room for the base OS to do what it needs to do.

Change-Id: I59ca235b9cf80cf86d406e4a144fee7d7784ed5d
2025-09-13 08:44:38 -04:00
Solomon Peachy
b497e71708 hibylinux: Shrink PLUGIN_BUFFER to 512K
Hosted platforms use dlopen() for plugin loading, and hibylinux is
relatively RAM constrained, so shrink this will free up more memory to
the OS for plugins to use.

Change-Id: I6b7cb17b964eaf5afc4958db242dfe4b82178e2e
2025-09-13 08:44:38 -04:00
Solomon Peachy
32d52e0415 hosted: Shrink audiobuffer to (MEMORY_SIZE-1) megabytes
This represents a 256K increase from the former (MEMORYSIZE-0.75), and
is necessary due to the growth in our binary sizes over the past decade
or so.

It is debatable if this is enough given that our actual memory
usage is approximately (MEMORYSIZE+3) megabytes (plus runtime OS
overhead) for the typical hosted build, but giving the host OS a bit
more breathing room is warranted.

Change-Id: I53e044585a32efd50a85e68d64fd21921eda01a3
2025-09-12 23:15:11 -04:00
Solomon Peachy
a2c10f6189 unicode: Support characters beyond the first unicode plane
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * font manipulation, caching, rendering, and generation
 * on-screen keyboard
 * FAT filesystem (parsing and generating utf16 LFNs)
 * WIN32 simulator platform code

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Appears to work on:

  * hosted linux, native, linux simulator in both 16/32-bit modes.

Needs testing on:

  * windows and macos simulator (16bit+32bit)

Change-Id: Iba111b27d2433019b6bff937cf1ebd2c4353a0e8
2025-09-12 09:24:30 -04:00
Solomon Peachy
c6db7114f8 as3525: Fix build warning with newer toolchains
Change-Id: I3dad32caf0dc087b717ed76b900f414aa1608bc2
2025-09-09 10:03:22 -04:00
Solomon Peachy
3f71709152 s5l77xx: Correct definitions of VICADDRESS(n) and AESINADDR
By switching them from (const void* volatile*) to (void* volatile*)

The 'const' bit was causing GCC>4 to optimize away writes to those
addresses when compiled with -Os, badly breaking the interrupt handler.

Change-Id: Ia4b0ca37e082bddf78e084b80a5e550894645f1a
2025-09-07 10:02:40 -04:00
Solomon Peachy
da02b5921f s5l8702: Clean up the IRQ handler code slightly
* move all state into IRAM
 * eliminate dummy variables
 * get rid of 'naked' attribute and (slightly wasteful) hand-written asm
   in favor of auto-created 'interrupt' code

Change-Id: Ie6a2e12a4c1a0faa6ae89504cf931657044bd457
2025-09-07 09:59:45 -04:00
Solomon Peachy
fb8b52eaf1 s5l8702: CONSTify the clocking setup
Change-Id: I88f7a2e176606b718d778a5a4a5756c4c4b58c03
2025-09-07 09:11:11 -04:00
Solomon Peachy
34f34bb7f1 misc: Fix a small pile of warnings found with diagnostics turned way up
* possible null pointer dereferences
 * non-annotated fallthroughs in case statements

Change-Id: I2332e0e0a4203ceca0999291ead112b8ab94c613
2025-09-06 21:31:58 -04:00
Solomon Peachy
4de25f7020 font: glpyh_cache_load() is now NO_INLINE
It is particularly stack-heavy (>1.25K, >2.25K with 32-bit unicode)

Its only caller was font_load_ex() but that can be called recursively
which _really_ blew up the stack.

Change-Id: I211cd33ca3478b2bd01d3ddcf6c890399af2fb9c
2025-09-05 20:02:46 -04:00
Solomon Peachy
16c9ef64b0 misc: Ensure stacks are always aligned with the native pointer size.
Change-Id: Ie7efae914dcb43be98bbb71bae9b765b2d87d817
2025-09-05 19:43:11 -04:00
Amaury Pouly
ac6822debb zen/zenxfi: fix incorrect dotclk polarity
By default STMP3700 launches from negative edge for capture on positive edge.
If we leave DPL (bit 13 of reg 0x13) to 0, it will be captured on falling edge,
resulting in a potentially undefined behavior. Some make sure LCD captures on
rising edge. Alternatively we could change the dotclk polarity in VDCTRL0.

Change-Id: I4ceb2f5a9be88e07f0af9bf493b7881883320fda
2025-08-31 20:50:22 -04:00
Solomon Peachy
4ad041e17a disk: Always try to mount the first partition on a disk.
We've received multiple reports from users of 6th gen iPods where we
fail to find any mountable partition.  A user was able to supply an MBR
dump, which showed that the "type" listed for parition 0 was set to 0x00
(ie "unused"), leading us to (correctly) completely ignore that entry.
However, it looks like the stock firmware ignores the type and
unconditionally uses the first entry even if it's nominally "invalid"

So, to deal with this, always try to mount partition 0 if it is not one
of the two "extended partition table" types.  If that speculative mount
succeeds, we now treat it as type 0x0c (Fat32 w/LBA) internally.

Note that this will not allow the partition to be mountable over USB, as
the MBR is still incorrect, leading the host OS to ignore the partition.
Further complicating things, the stock Apple firmware always constructs
a fake MBR to hand to the host!

To prevent user confusion with these devices, we may consider faking the
MBR too; alternatively we could correct the MBR and write it back to
disk, perhaps via a debug menu option.

Change-Id: I1e9392d20401eb94ecc6d70263fb0e45392a9bd4
2025-08-31 19:31:20 -04:00
Hairo R. Carela
268a282da6 rgnano: Proper keylock support
Can use the advanced keylock menu options now.

Change-Id: If59b16ef5649c328558a74dd0601bc2f272c37b7
2025-08-30 17:20:31 -04:00
Solomon Peachy
7de9d8dae5 limits: define PATH_MAX in only one place.
(This is the first step towards making it larger)

Change-Id: I4cea522074c455e04c8d228cf6463fb6500c41a0
2025-08-25 10:10:38 -04:00
Hairo R. Carela
6f107430f4 rgnano: Voltage and current measure support
Battery time estimation works now.

This commit also changes the mksquashfs path to FUNKEY_SDK_PATH.

Change-Id: Ic0aa4c40011b0716f1c36c014377eaccb486e841
2025-08-23 13:44:25 -04:00
Solomon Peachy
97ebba1fbd SD: Move sd_parse_csd() into common sdmmc code
This leaves firmware/driver/sd.c only containing storage API wrappers

Change-Id: I94f3f38c180f3802f479cdc54723fcd1b7782421
2025-08-22 14:48:28 -04:00
Solomon Peachy
84504c7471 Revert "internals: Support characters beyond the first unicode plane (WIP)"
This reverts commit d05c59f35b.
2025-08-20 16:09:49 -04:00
Solomon Peachy
d05c59f35b internals: Support characters beyond the first unicode plane (WIP)
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * on-screen keyboard
 * font manipulation, caching, rendering, and generation
 * VFAT code parses and generates utf16 dirents
 * WIN32 simulator reads and writes utf16 filenames

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Known bugs:

  * Native players in 32-bit unicode mode generate mangled filename
    entries if they include UTF16 surrogate codepoints.  Root cause
    is unclear, and may reside in core dircache code.

Needs testing on:

 * windows simulator (16bit+32bit)

Change-Id: I193a00fe2a11a4181ddc82df2d71be52bf00b6e6
2025-08-20 16:08:43 -04:00
Solomon Peachy
0456ec5630 IAP: First steps towards true multiport state
iap_reset_state() and iap_getc() are now passed the logical IAP port
(0 is dock/only connector, 1 is headphone connector)

Change-Id: I97421146a8cab032b90c9b4eb55b50aa00d73312
2025-08-20 07:56:43 -04:00
Hairo R. Carela
69f27d4c66 rgnano: Use proper lcd depth and pixelformat
According to screen driver this device screen is actually 16 bit RGB565 (https://github.com/DrUm78/linux/blob/FunKey_S/drivers/staging/fbtft/fb_st7789v.c#L137).

This also fixes the color banding issues we had before and boomshine doesn't segfault anymore. Also building rockpaint now that's possible.

Change-Id: Icee49c347fbfabc79e0040314ec148cb77ca6325
2025-08-18 21:43:13 -04:00
Hairo R. Carela
c9e16e4888 rgnano: Sleep timer and idle poweroff support
Actually power off the handheld with the sleep timer and idle poweroff functions instead of closing rockbox.

This commit also moves setting system volume to max from the launch script to system-sdl.c so it works when running rockbox via instant play.

Change-Id: I174b67c6abef451faa05f4a8f52b8d9eeed98a22
2025-08-15 09:44:35 -04:00
Solomon Peachy
5ecb5832e1 as3525: Silence portability warning with GCC10+
Change-Id: I66ca05bd7b6029b7699d5534f82efe0c14da1291
2025-08-15 08:39:05 -04:00
Solomon Peachy
472a6a69c6 IAP: Reset IAP state upon headphone or dock unplug
Provides a semi-automatic way of recovering from desynchronization

Change-Id: I527b0bacc22ef38c1e7213653e522ea1b0ac155d
2025-08-14 20:41:14 -04:00
Solomon Peachy
6265bbbd97 sdl: Explicitly disable the cursor for non-touchscreen devices
...Except for simulators, those always need the cursor

In practice this only affects the RG Nano as it is currently our
only SDL target that lacks a touchscreen.

Change-Id: I292f923848528c233da518b062d9ccd8a03515dd
2025-08-07 09:36:51 -04:00
Solomon Peachy
209f833c7a rgnano: Fix simulator build
Change-Id: I2e6dfae25a2dae18e672c5584e8bd52c7bbd279a
2025-08-06 21:25:57 -04:00
Hairo R. Carela
46d10dda33 rgnano: Instant play support and proper system brightness/volume handling
Instant play is a Funkey OS feature that allows it to relaunch at boot the last program it was running before shutting down, which means that if the handheld is powered off (holding the power button) while rockbox is running the next time it's powered on rockbox will launch at boot.

This commit also handles system brightness/volume in rockbox itself instead of the launch script, so the values are properly reset when powering off the handheld while rockbox is running.

Change-Id: Ie1adbf71069aeed5fbf6670971718a2f718716a3
2025-08-06 20:21:02 -04:00
Solomon Peachy
16a6ad032f pp502x: Restructure UART code
* Move to a structure instead of pointers to registers
 * Autobaud operates per-uart
 * When explitily setting uart speed, it applies to all uarts

This allows both UARTs to be enabled and serviced simultaneously,
allowing either accessory port to be used.  Note that the last
port to receive something is where subsequent transmits are directed,
and only one set of IAP state is maintained.

To change this, we will need to revamp IAP to support more than
one state machine, and then extend the serial API to allow for both
UARTs to be used independently.  Probably not worth the effort.

Change-Id: I0142f0906706fc0c4ee6d6d7aa6b0515e1a749dd
2025-08-06 08:27:58 -04:00
Hairo R. Carela
7b0f408c71 rgnano: UI simulator support
Change-Id: Id488d16e01ef49a9d1b57641bc1c22ed2fef4931
2025-08-05 08:30:30 -04:00
Solomon Peachy
b52bf1bf65 gigabeats: Fix compilation with -fno-common
Change-Id: I02974bffd6def6bdfa6b15c593ac2eb82953ea73
2025-08-05 07:25:23 -04:00