1
0
Fork 0
forked from len0rd/rockbox
Commit graph

2515 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Hairo R. Carela
48392bab94 New port: Anbernic RG Nano
A bit of context, this device is a clone of the FunKey-S with a different form factor, hardware is mostly identical, the relevant difference is it has audio out (via usb-c, adapter to 3.5mm is included), this is the reason why the FunKey-SDK is needed for bulding.

This port is based on the old SDL 1.2 code because the device doesn't have SDL2 support. Alongside what was supported in the SDL 1.2 builds this port supports battery level, charging status and backlight control.

Change-Id: I7fcb85be62748644b667c0efebabf59d6e9c5ade
2025-07-29 21:01:53 -04:00
William Wilgus
92b786a0fd Don't turn off backlight while buttons are pressed FS#13391
while scrolling lists or seeking in a song with several second
backlight timeouts the screen turns off even though you are currently
pressing a button

Try #2 moves the logic to button_tick()

Change-Id: I32455eb578cc578b4cbd4b4dc16325970cf9dc29
2025-05-09 11:18:38 -04:00
Solomon Peachy
95f970076e surfansf28: Major improvements:
* Add a crude keymap
 * Use native "hardware mute" for audiohw_mute()
 * Properly handle touchscreen inputs
 * Can now play back music, with some warts..

Broken:

 * rotary wheel still doesn't work
 * audio garbled/distorted a bit
 * no volume control

Change-Id: I040217035a7bf3983b0e269fca3408eedd972cd0
2025-05-05 20:38:18 -04:00
Solomon Peachy
82f3d0c18f WIP hosted port to the Surfans F28
* Only bootloader builds
 * Plugins disabled
 * No keymaps to anything else
 * No simulator
 * Touchscreen not wired up yet
 * Audio still untested

Bugs:

 * rotary encoder does nothing in bootloader
   (might be bootloader bug, might be something else)

Other stuff pulled in:

 * Unify all of the (identical!) hibyos makefiles
 * Rename the "bootloader" to more generic name

Change-Id: I6d8a3b58de726db8e89cf193c90960a070a575c2
2025-05-04 18:34:22 -04:00
Aidan MacDonald
83950bf233 New WIP port: Echo R1
The Echo R1 is a new open-hardware music player design, based
on the STM32H743 microcontroller. Schematics and hardware
documentation for it can be found here:

- https://github.com/amachronic/echoplayer

This is an incomplete port. The bootloader can be loaded using
OpenOCD and it can draw to the LCD using SPI. SDRAM is working
but hasn't been extensively tested.

Change-Id: Ifd2bee15c49868fbc989683d3ca14dce48bf3e18
2025-04-22 20:08:08 -04:00
Solomon Peachy
9d4632b0c3 misc: Clean up a pile of -Wunused-const-variable warnings
And re-enable the warning (applies to GCC 6+)

Change-Id: I7aa679ec65707db12de83c0433966b3821d07087
2025-04-21 21:13:59 -04:00
Vencislav Atanasov
545506c923 New port: iPod Nano 4G
Currently, only the development bootloader can be built successfully.

This is a part of the large iPod Nano 3G and iPod Nano 4G support patch.

Credit: Cástor Muñoz <cmvidal@gmail.com>
Change-Id: I74ea0da999ddb1d8ce5d0f5434141b3f0b5f7448
2025-04-18 20:40:49 -04:00
Aidan MacDonald
a0bfcd77c8 arm: enable unified assembly syntax in more files
This makes these files compileable, or in some cases less
broken, on Cortex-M targets.

In lcd-16bit.c, newer versions of GAS complain about the
infix condition codes so we use the suffix form instead,
which requires unified syntax to compile on GCC 4.9.

Change-Id: If45166d3fc83d64c692cbb331096a966397aa9e9
2025-04-18 10:26:02 -04:00
William Wilgus
69664cc4e9 Asan fix warning for 1-bit vert #2
try #2 at this
if there isn't enough data remaining to fill the columns
then don't read any more data

looking at the blame for this driver it had similar logic originally

But really on native this is just extra overhead so..
Ifdef out for native

Change-Id: I105dea1f7adc0448f345b268fcfa8574333132a9
2025-03-11 01:21:05 -04:00
William Wilgus
42a9582cc1 Asan fix warning for 1-bit vert
1-bit vertical displays overread the buffer due to the way the
packing works, this isn't the hottest path anyway but
we can check if height <= 8 and make stride 0 so the dummy data
gets the beginning of the data instead

Change-Id: I88ab4dc37bfd2d680d125f964beafe0ddfb00645
2025-03-10 13:13:20 -04:00
William Wilgus
fffae07833 [Bugfix] Scroll engine, backwards scrolling causes display corruption
When a line is over a selected length bi-directional scrolling
is disabled.

In non bidir scrolling the string is copied to a buffer twice with
a space between "scroll text" + "   " + "scroll text"

this is to allow scrolling the line in the forward direction
with minimal extra logic

Note: that is the ONLY direction it is equiped to handle

In the USB screen I observed while switching through the different modes
that sometimes the text was corrupted

turns out you can still have scroll->backwards set to true
which causes offset to go negatve but we never check if offset < 0
in non bidir scrolling mode and happily continue with ever more negative offsets

Change-Id: I210f7880be953d3cc42469828a7ca5fc2b2ab96f
2025-03-09 09:16:07 -04:00
Solomon Peachy
0a2a90c182 FS#13560: ATA: Don't check for 80 pin cables on SATA devices.
On PATA, we'd cap our transers at UDMA2 if the device reported that an
80 pin cable wasn't detected, but SATA devices do not perform this test.

So alter the check to only apply on PATA devices, so that SATA devices
can run at full UDMA speeds.

Change-Id: Id7aa25f2a702c0af73d707395439d69da1e04719
2025-02-10 09:23:11 -05:00
William Wilgus
f501dd00eb short circuit is_diacritic for 5-15% text drawing speed-up
characters less than the first diacritic in the symbol table (0x300)
return false after checking the MRU table

we gain some performance by eliding the function call all together if less than first diacritic

Change-Id: I02c14e350eb168eca808523affad443cd43888b4
2025-01-31 21:48:44 -05:00
William Wilgus
7100090f99 Remove NVRAM infavor of a separate cfg file
remove nvram and use the existing settings framework for it

add a crc check to the user_settings data to see if we need to save
the user setting file or if we can just save the status file (resume.cfg)

move volume to the system_status struct so we don't write the whole settings file
over volume changes

allow user to still export volume with save sound settings

allow the user to also export pitch and speed

name the file .resume.cfg

Rename all the SYSTEM_STATUS save file variables to TLAs to save space and
discourage tinkering

Cleanup DEBUG_AVAIL_SETTINGS output

when saving user_settings it calls status_save as well this cause the resume
file to be written twice. instead remove the callback for status_save
when setting_save is called

remove header text when saving .resume.cfg

convert status_save() to status_save(bool force)
add SYSTEM_STATUS_UPDATE_TICKS

for ATA device set this to 5 minutes
since we arlready wait for the disk to be up before saving
we don't want to miss our window

for all other every 15 minutes

that way if the battery is too low by the time shutdown comes around you
don't lose much progress

Change-Id: I27214ffd6e5d5494ee5ca83b14f04a41ba426ad7
2025-01-21 00:04:32 -05:00
Vencislav Atanasov
8e293b4948 serial: Add serial_tx_raw() function for sending raw bytes to the serial port
serial_tx() can only be used for NULL-terminated strings, and also adds CR before every LF.

Change-Id: I8c3eafa5bc152bb54abf4629ee76396dc1cb9b8c
2025-01-20 08:17:48 -05:00
Dana Conrad
96463d855f erosqnative: hw4 units prefer egauge battery percentage
Use AXP2101's egauge battery percent level if available (hw4 units).
If not available (_battery_level() will return -1 on hw1-hw3 units),
fall back to voltage battery level.

Also fix logic in axp2101_battery_status()

Change-Id: Ic300418532dae6f7772fff8bf5e2b32516f3b973
2025-01-19 17:30:21 -05:00
William Wilgus
54333536fe [BugFix] YesNo screen wait for button release on exit
if you run yesno screens back to back or another screen with
wait_for_release you may never see the release

instead clear anything in the queue but release events

Change-Id: I1b1e42cbb44f2fdfed441ab1f217b6ea4fe07492
2025-01-17 00:42:25 -05:00
Solomon Peachy
14b8820231 ata: we shouldn't ry to do FLUSH_CACHE_EXT if HAVE_LBA48 is not defined
Change-Id: Ic3da25a144bfd7ae41ee2e012a90e38aacac4df9
2025-01-07 19:53:20 -05:00
Dana Conrad
f2dd489120 FS#13535: AXP2101: ADC / reporting improvements
Improve ADC behavior, add correct conversion
for die temperature, add readout of EGauge to debug screen.

Add delay to give ADC time to get a good reading. Initial reading
may still be 1-3% optimistic, which is probably ok.

EGauge appears to be pretty good, but no great need to convert
to using it either.

Change-Id: Iab9d50e2427f656ad0875f9a623b03545fc69881
2025-01-01 20:49:07 -05:00
Christian Soffke
9ba59477a1 sdl: improve window resizing on macOS
This enables smooth resizing of the window using a
fixed aspect ratio, instead of snapping into the
correct aspect ratio only when the resize operation
has finished, by using an SDL event filter that gets
events delivered during the resize operation
(whereas SDL_PollEvent blocks until done on macOS).

Change-Id: Ie6614e4b6f49a24469c5ee6a69721c9fbd440dae
2024-12-30 01:08:12 +01:00
Christian Soffke
8bd62e35cc button_queue: fix cpu never unboosted
regression introduced in da9d67a

Change-Id: Id1496873f1ab72fecc225dcfc78e633eea441089
2024-12-27 17:41:34 +01:00
Christian Soffke
400452180d sdl: Keep texture around, upload LCD-parts only
No need to create a new texture for every
rendered frame, unless the scaling method
has been adjusted.

We also don't need to upload the (unchanged)
player interface to GPU memory repeatedly.

+ Remove unused lcd_display_redraw &
having_new_lcd variables

Change-Id: I5bff6aa2d54347a3f2c3afba8d8d7eb9e39f77f7
2024-12-25 08:34:40 -05:00
Christian Soffke
60f3283f48 sdl: make window resizable, enable high DPI
Tested on Linux, MacOS, and Windows.

On MacOS and Windows, we constrain the window's aspect
ratio by adjusting the size when responding to resize
events.

On Linux, I've not found a way to do so, that doesn't
result in fairly stuttery behavior and weird jumpy
behavior of the resize handle, possibly depending
on your window manager. So, black bars are displayed
around the content.
Maybe someone, at some point, finds a way.
(SDL3 seems to have SDL_SetWindowAspectRatio)

When the window is in fullscreen, black bars are
display necessarily, of course, on all systems,
unless the player GUI has exactly the same aspect
ratio as the screen...

Change-Id: I535e6617497611ea57a4c19e08e552f990859cfe
2024-12-25 08:34:40 -05:00
William Wilgus
632e72273d small cleanup putsxyofs()
store the vp local rather than using current_viewport
use the flags directly rather storing them

Change-Id: I93391acff4745aae3d5d7e695c0eabd6dbeabb11
2024-12-21 19:11:02 -05:00
William Wilgus
8091477f8d Optimize 16 bit lcd_fillrect()
move switch outside loop

adds ~10000 ops/s in test_gfx

Change-Id: I2204d637282aae4bbc0dde31395c6cc0568f3247
2024-12-21 18:19:38 -05:00
William Wilgus
d6e99178aa lcd-16bit-common optimize bitmap_part
in testing this slightly speeds up any of the draw routines using fg or bg
and slightly slows down the ones that don't
being that these are already faster it serves to bring them closer in
ops per second

.. and slightly speeds up the most general case DRMODE_SOLID

Change-Id: I4ea4898354e8bc9dfa7e96f188108ca77ea0aca9
2024-12-21 16:37:35 -05:00
Dana Conrad
48811ed4a8 ErosQ Hosted: Fix maximum volume upon plugging in headphones
Ref. FS#13533

Change-Id: I343df8cd351bb2578dd11894114903eba527f2c7
2024-12-20 12:09:35 -05:00
William Wilgus
660fa3ffdc scroll engine calculate stringsize only when scroll line updated
we calculate the size of the scrolling line every scroll update
the line data doesn't ever change without a call to update
instead calculate the string size when the line is updated
re-use this value while scrolling the line

in theory the current font could change but in practice
I can't find a case when the string size needs to be updated
that the scroll engine isn't already updating the line

if this is later an issue we can recalculate the stringsize each time
the line is finished scrolling which still saves quite a few calculations

Other:
I don't think we have any targets with pixel counts exceeding 65535 pixels
where unsigned short stringsize will be an issue

Change-Id: I83d6374377ed648d9a320d4fd69f9d6a17095b0c
2024-12-20 10:31:46 -05:00
William Wilgus
33c0c9efae [Bugfix] Simulator doesn't scroll lists in plugins
unless lcd_update() is called the sim doesn't update scrolling
you CANNOT call it from the scroll thread its simply ignored

I suspect this has something to do with where the call to render
originates as thi is the only thing I can think of besides
a call to disable the render

see demos/rb_info > paths -- observe the lack of scrolling
see any menu in a plugin that exceeds screen width

Change-Id: Ic14dee4a34de29479d739e6a280d6cf1cc283719
2024-12-16 11:37:56 -05:00
Dana Conrad
5ed0db6e90 erosqnative: Repurpose stereosw_select setting for output select
Turns out they did not swap the stereo switch lines on us,
so this setting isn't really useful. Repurpose it to allow
the user to force the device into headphone or line output mode.

Note that settings other than "Automatic" will cause jack detection
to not work.

Default Automatic.

Change-Id: If94499fbb8f0d92111811fe51f6107ce213b66ad
2024-12-07 09:20:40 -05:00
Dana Conrad
adbd0125fd erosqnative hw1/hw2: Check for DAC in bootloader
Check for the ES9018K2M dac in the bootloader for
hw1/hw2 devices. Assume that all devices newer than
hw2 have ES9018K2M DAC unconditionally.

All devices will now report the correct hw revision
in the debug menu under Device Data.

Add devicedata.version field, current version 0.

Rename device_data.lcd_version to device_data.hw_rev.

hw2 devices with older bootloaders which ID as hw1 are special-
cased to keep using hwvol on them. They should still upgrade though.

Change-Id: If0fd5ce3bc6e85e511047721ec18e42fb89312e7
2024-12-06 11:39:24 -05:00
Christian Soffke
f1010005b0 Fix simulator crashing on MacOS
Event handling must happen on the main
thread for MacOS.

Not sure if button_queue_wait is the
best place for doing the SDL event
polling, but seems to work ok.

Change-Id: If928282df84bdd74e24a48afd7dbc4c4bfcc49e2
2024-12-01 20:18:11 -05:00
William Wilgus
da9d67a0fe Button queue handling is split from main button driver
First half of
https://gerrit.rockbox.org/r/c/rockbox/+/570

Change-Id: Icc64dfd8194c18f69564ed5f8bf7dd70a4330eb9
2024-11-27 20:16:53 -05:00
Solomon Peachy
6231407df7 fat: MAX_VIRT_SETOR_SIZE -> MAX_VIRT_SECTOR_SIZE
Change-Id: I18d7998e0f23cbe9b95f5e8c90214975ae03a10e
2024-11-26 09:00:58 -05:00
Solomon Peachy
dfbbfb12d4 storage: Misc corrections and cleanups
* Make the partial sector logic a little clearer (no functional change)
 * Corrections for debugging messages
 * Also use MAX_VIRT_SECTOR_SIZE in BOUNCE_BUFFER calculations

Change-Id: I89363824b092b2e3bddd5e0f75bf81200c9bc513
2024-11-26 08:37:55 -05:00
Solomon Peachy
b8d2ba3fc4 fat: Ensure bounce buffer is a multiple of MAX_PHYS_SECTOR_SIZE
* if MAX_VARIABLE_LOG_SECTOR is defined, use that
 * if MAX_PHYS_SECTOR_SIZE is defined, use that
 * use SECTOR_SIZE

Change-Id: Ia314f590fdb300e99df2c60587657c9563b9ce80
2024-11-26 08:20:02 -05:00
Solomon Peachy
87e55baaad ata: Use a better default for SET_MULTIPLE_MODE
* If the device returns a valid upper limit (word 47) use that.
 * If the current limit (word 59) is valid, use that.
 * Fall back to 1 as a default, not 16!

Note this is only used for PIO transfers!

Change-Id: I269b751466242bbcce91ee991d9ade449cc84b6b
2024-11-24 23:26:09 -05:00
Dana Conrad
253eb79db3 erosqnative: hw4 support
Support hw4 units with AXP2101 PMU

Bootloader successfully compiles and loads onto device.
The LCD appears to be identical to hw3 units.
Scroll wheel and buttons work
Audio output works, including volume.
HP/LO detect works
Rockbox build is generic
GPIO gating logic seems to be working as intended now.

 - Added new GPIO definitions - some significant overlaps with pins
    from previous hardware revisions...
 - Added some GPIO definitions for older players we didn't know about
 - Add register definitions for AXP2101 from datasheet
    (these are very different from AXP192!)
 - Add AXP2101 regulator definitions, need to support multiple step
    sizes per regulator.
 - Verify AXP2101 voltage set multi-range logic
 - Verify AXP2101 voltage get multi-range logic
 - Make AXP2101 its own driver
 - AXP2101 driver should be "minimally viable", though I think
    there is some extra functionality that could be implemented.
 - Disabling the coulomb counter stuff - we could maybe make
   the E-Gauge work for the same purpose, but it only appears to
   be used on the debug screen at the moment so it doesn't seem
   like it's worth the effort.
 - Found new button GPIOs
 - Found error in my GPIO setting logic, blue light works now!
 - Set LDO/DCDC output voltages to OF's settings, as far as
   I can tell.
 - Determined we probably want TCS1421_CFG1:0 to be 0x00,
   for UFP behavior
 - Tested this rb build with both old and new bootloaders on hw1.5,
   hw2, hw4 in as many configurations as I can think of, works across
   the board.
 - Bootloader can install itself on hw4, so nand chip isn't novel
 - Uninstallation file can be made by patcher script, works on hw4
 - Installation file can be made by patcher script, works on hw4
 - Added HW4 to rbutil, manual

Change-Id: I5b75782273e81c2c6f2b9c79501c8b7cbf88391f
2024-11-22 17:01:39 -05:00