Commit graph

5332 commits

Author SHA1 Message Date
Mauricio Garrido
752467dee4 3ds: Various fixes, optimizations.
This commit does the following changes:

- Fix mkdir implementation not reporting EEXIST error.
- Fix database build feature.
- Small speed-up when parsing directories and files.
- Fix buffering thread hogging cpu and preventing other threads to run.
- Fix sdl plugins not compiling by re-adding ctru specific cflags in sdl.make.

Change-Id: I507c0dcc85cdbcc607ab9c9c6d0b42e6a80caa5a
2026-01-09 20:54:44 -05:00
Sebastian Leonhardt
873163c671 iMX233 RTC init: make clock source (32kHz/24MHz) explicit for targets
Change-Id: Ib4fa56ad8ee28f3799b6c6c3c058d156353dd15c
2026-01-08 13:48:44 -05:00
Vencislav Atanasov
e3372f495e Add a dummy nand_get_info for ipodnano3g and ipodnano4g
All non-simulator and non-hostfs targets are required to implement storage_get_info() since 04dc052a

Change-Id: I87febd12e101797d9cbbffc0e2e46efc2dace9da
2026-01-08 10:12:51 -05:00
Aidan MacDonald
6a8989f347 echoplayer: enable SD card using sdmmc_host
Enable pullups on SDMMC CMD/DATx lines and set output
speed to medium. Using HIGH and VERYHIGH speeds seems
to cause data corruption, with frequent CRC failures.

Change-Id: I732d19e03a2a857453755b68b6749497eafaef70
2026-01-04 10:27:15 -05:00
Aidan MacDonald
141b4a223f stm32h7: implement sdmmc_host-based SDMMC controller driver
Change-Id: I26c47c630ea364de043a224b549d7867fb1e5794
2026-01-04 09:31:05 -05:00
Solomon Peachy
ef47ffe250 Fix the last of the issues introduced in 350a2250b
Change-Id: I4b58f5d9d1c4649080826a9cf1b438e13ed7ce81
2026-01-03 14:42:54 -05:00
Solomon Peachy
5bbd4d63f0 Fix build errors+warnings introduced in 350a2250b1
Change-Id: Ia5f2079ccc99da30e0058b0d9ce5bb8369201804
2026-01-03 13:59:53 -05:00
mojyack
350a2250b1 usb: implement endpoint allocation
this commit has following changes:
- introduce `usb_drv_ep_spec` table to udc drivers, which represents
  endpoint characteristics.
- introduce 'ep_allocs' table to class drivers, which represents what
  endpoint type does the class driver want.
- implement endpoint matching logic to usb core.

this is a required step to implement usb config switching, because we
need to create config descriptors without actually initializing endpoints.

Change-Id: I11c324cd35189ab636744488f6259d0cdb2179f0
2026-01-03 13:23:53 -05:00
Aidan MacDonald
4ceb9e22d6 echoplayer: drive LCD parallel bus using STM32 LTDC
This is much, much faster than using SPI and is able to
offload the CPU completely.

Change-Id: Ia4c0289775296fe41d594ba849bd057e8482306e
2026-01-01 11:16:23 -05:00
Aidan MacDonald
ddb2dfa267 stm32h7: simplify bootloader linker scripts
Remove ifdefs for load to RAM, it won't be usable once
the bootloader is able to load Rockbox.

Change-Id: Ia0c9261d2073261f4089ce1804d7a3483c959d6e
2026-01-01 11:15:14 -05:00
Aidan MacDonald
5137ef49e3 stm32h7: support setting bus frequency in SPI driver
Change-Id: I71edf28fdc24d8a00d27aa727815f99e788b675a
2026-01-01 09:17:17 -05:00
Aidan MacDonald
a4b0af2a44 stm32h7: add function to get frequency of a clock
Change-Id: Ice60bc0e443a134ebb8ec03015fef98991ef9b05
2026-01-01 09:17:17 -05:00
Aidan MacDonald
a9b75fc4c4 stm32h7: support clock enable/disable in SPI driver
Change-Id: Id4baa340e1b67fb265628add9191acb08e3a0615
2026-01-01 09:17:17 -05:00
Aidan MacDonald
ddb3bb354c stm32h7: add clock enable/disable callbacks
Change-Id: I4c135ba9cbed2c8e607c5f191bb9d82638f9b6b3
2026-01-01 09:15:56 -05:00
Aidan MacDonald
23448a13d1 stm32h7: refactor clock init to target-specific callback
Given the myriad of clocking options the STM32H7 family
provides, it is easiest to let targets simply implement
what they need.

Change-Id: I9cceed40a2d638998e8b583651f73557d2ffbd46
2026-01-01 09:15:56 -05:00
Aidan MacDonald
37b90baa5f stm32h7: handle SPI transfers via interrupts
Change-Id: I6e60f4222f4d99019e72377de7c3b689a77ac548
2025-12-31 22:03:51 -05:00
Aidan MacDonald
7eed19dbaa stm32h743: add NVIC IRQ numbers
Change-Id: If50655268180f38ed4114c35779d32f25a3631b5
2025-12-31 22:03:51 -05:00
Aidan MacDonald
b0b4c6bf2f stm32h743: split SPI IRQ handlers
No sense in pessimizing this; each SPI instance has a dedicated
interrupt line.

Change-Id: I2243626c960873738e5d9cf4e60d2f9e635514e7
2025-12-31 22:03:51 -05:00
Aidan MacDonald
8d279aa48d stm32h7: simplify generic SPI driver
Supporting large transfers (>64k) isn't really needed;
the main use case right now is interfacing with an LCD
controller.

Change-Id: I901e5ddb1b4efa9aa650b3e5074537ba785c6d41
2025-12-31 21:15:43 -05:00
Aidan MacDonald
025f3def04 stm32h743: make debugger attach more reliable
Add an optional sequence in the startup code to disable clock
gating when the CPU goes to sleep. Normally the D1 and D3 domain
clocks can be automatically gated when the CPU is asleep, and
because the debug infrastructure is clocked from these domains,
the debugger cannot attach when those clocks are stopped.

Setting some bits in DBGMCU_CR prevents this problem, but will
increase power consumption, hence it isn't enabled by default.

Change-Id: Iba87750371a493adf72655aab86a908ef2702cef
2025-12-31 08:10:20 -05:00
Aidan MacDonald
8514c1c9a8 echoplayer: convert STM32H7 register access to RegGen
Change-Id: Ie16d7340a9f047e44cf510bc776030570edb3966
2025-12-31 07:30:00 -05:00
Aidan MacDonald
d8b0bc5797 firmware: convert ARM Cortex-M register access to RegGen
Change-Id: I225fb53da84946876d6c4af08af5f80197e71e95
2025-12-31 07:30:00 -05:00
Mauricio Garrido
0b3e0d1432 3ds: Small changes to port sources.
This commit does the following changes:

- Replace buffered io implementation with a simpler, lighter, slightly faster version.
- Turn off both screens when backlight goes off.
- Small change to enable plugins in the folling commit (s).

Change-Id: I45df30be037c3a1686bd85c16c87bcd248db456f
2025-12-30 16:30:34 -05:00
Sebastian Leonhardt
6552554939 Creative ZEN: split ZEN V keymaps off from other ZEN targets
The ZEN V target is the only one which has volume buttons,
but lacks the menu and shortcut buttons.
IMO an independant keymap will make maintenance easier.

Change-Id: Ide79fab629b13eae94946561d99052e570c0e4f2
2025-12-29 23:20:06 +01:00
Marc Aarts
1183b1ab1b Rockbox for the HiBy R3 Pro II/R1
Original author Melissa Autumn (https://codeberg.org/oopsallnaps/rockbox-hibyos) with contributions from Marc Aarts.

Adaptation to Rockbox standards by Marc Aarts

Change-Id: I09e5af7ba0a75c648e4b9fd424badc2d3665c943
2025-12-27 15:44:54 -05:00
Dana Conrad
75df18f2c1 FS#13712: ErosQ: move all of sound hw init to audiohw_init()
Fixes voice not working after booting but before starting music playback
while line-out is plugged in. Doesn't seem to break anything on hw1 or
hw4.

Change-Id: I7b830adeeceae621177c94353e4814aa6ad0e1ec
2025-12-12 22:44:22 -05:00
Aidan MacDonald
fe11a04579 mips: show version info on exception panic screen
Change-Id: Iff315869e9190ce7d68c672c6cc78cb1fc301264
2025-12-11 15:48:50 +00:00
Solomon Peachy
bbcf210c94 Nuke maemo (nokian800/nokian900) and [open]pandora targets
They haven't seen any work since 2013, and likely hasn't compiled in at
least a couple of releases -- not that we ever "released" anything for
these targets.

Futhermore, upstream for both has been effectively dead for about as
long, and there's been no user reports of these being used since 2017
(and even then only in passing).

It isn't worth the effort to triage their current state, much less
uplift into something supportable, while the maintenance burden of
keeping these things in-tree can be demonstrated by the diffstat.

Change-Id: Id93bd450679d1b75e2c74295b3ae1548cd241b24
2025-12-03 20:42:02 -05:00
Solomon Peachy
6bdd3de554 Move hosted codec header files back under firmware/export
This is a partial revert of a79bdaf46

It caused all sorts of build breakages for misc stuff like the dbtool,
which doesn't include any per-target build directories

Change-Id: I493a33c1859706679972e47c96196223415985d9
2025-12-02 20:35:18 -05:00
Solomon Peachy
c2952136c6 audio: Fix up more red from a79bdaf462
Change-Id: Ie6a68f2a14489bc84ddc57b73b37ddb94b7dc0ac
2025-12-02 20:35:18 -05:00
Solomon Peachy
fd6d6c48b4 audio: Fix up most of the red from a79bdaf462
The rest involves some wrangling.

Change-Id: I5459c255677cbacf8cc8b0c28492d27c58971cb1
2025-12-02 20:09:47 -05:00
Solomon Peachy
a79bdaf462 audio: Move hosted audio "codec" drivers into their respective target dirs
They are nearly entirely generic wrappers around ALSA controls, unique
per target, and are ripe for further consolidation.

Change-Id: I05e4a450e3e89e03616906601c4f8fa46200dff5
2025-12-02 18:59:50 -05:00
Aidan MacDonald
806b71b2ed hosted: consolidate sysfs-based battery measurement code
Several hosted targets read their battery state from a fixed
sysfs path. Get rid of the duplicated code by handling this
common case in power-linux.c.

Some targets use non-standard units in sysfs instead of the
typical microvolts / microamps, so allow the scale factors
to be overridden by the target.

Change-Id: I31dc4ffc7a2d2c066d00a74070f9f9849c1663d0
2025-12-01 13:39:04 +00:00
Solomon Peachy
7ffdf50ba5 ibasso: Use generic hosted sysfs accessors
This keeps the enumerated list of sysfs parameters.

Change-Id: Ia63549809490eba02b3f75b3d2f95745636e01a9
2025-11-30 19:21:06 -05:00
Solomon Peachy
9020360f66 hosted: Pull tinyalsa out of ibasso tree so other targets can use it
Change-Id: I85e31a0d0993d3494568abbc05ff9b114d493d75
2025-11-28 19:33:48 -05:00
Solomon Peachy
6314eae268 Fix build regression for Creative ZEN V
Introduced in 297af3a483

Change-Id: I9cf37e27ecdf84b6f0a8b6c8d15b1eae987cedbe
2025-11-28 07:38:40 -05:00
Solomon Peachy
a6538abd16 rk27xx: Use slower memory timings at startup
Our decade+old defaults are reported to trigger a failure on
one user's IHIFI770c and IHIFI960, but work on their HM-603.
Backing CAS latency off from 2 to 3 appears to be sufficient.

What's interesting is that on paper, CL=2 should be easily attainable
due to our max RAM clock of 100MHz, well within the worst-case timings
of the EM639165 SDRAM.

So as an experiment, this code can go back to CL=2 when we change the
CPU+RAM clock speeds.  IF this still proves problematic, it will be
removed.

Change-Id: I4a8cfa0563c076e7f25d9599a19b454f590861cd
2025-11-28 07:18:22 -05:00
Sebastian Leonhardt
297af3a483 Creative ZEN: fix RTC regression
Creative ZEN lost it's time when shutting down.
The bug was introduced with commit 7f282b9280 (g#2601),
followed by e3f6e9d9f6 (g#2616).

I guarded all persistent register writes with wait loops,
as described in the datasheet.

TODO:
test SONY_NWZE360 and SONY_NWZE370 targets

Change-Id: Ib38ab8691fd1c6e8d0771c1e2eca20dfeb6fc87f
2025-11-27 15:04:14 -05:00
Sebastian Leonhardt
69bc230e7d imx233: add HW_RTC_CTRL and HW_RTC_STAT registers to debug screen
Change-Id: Id52f86b26ee039781f44fde639fb8f184c7dc438
2025-11-27 12:36:28 +01:00
Solomon Peachy
7511d7e514 ipod6g: Correct inverted sector shift for CE-ATA operations.
(sector needs to be scaled UP, not DOWN)

Change-Id: I350c6c371b29c5e152d8d35852e55e3eda0d1090
2025-11-24 21:08:01 -05:00
Solomon Peachy
0551c4a780 ipod6g: Scale CE-ATA READ/WRITE sector/counts correctly
Despite the fact that CE-ATA specifies a minimum logical sector size of
4096 bytes, the low-level tranfer command arguments are specified in
units of 512 bytes. So scale the sector count up and the LBA down.

On CE-ATA devies, the partition table and filesytem is formatted with 4K
logical sectors, so this will be safe.

Change-Id: I959f21f9c72a68ac28aa611d06f8517ca77f0a8c
2025-11-23 20:21:06 -05:00
Solomon Peachy
e04ed753e1 ipod6g: Correct double-shift in ata_rw_chunk_internal()
Forgot to do a commit --amend with this fix before pushing

Change-Id: I7f2e4bead7c85b9edbf13992f15c3b93c2b18197
2025-11-20 20:03:22 -05:00
Solomon Peachy
2c53f6122a ipod6g: ceata_rw_multiple_block()'s COUNT is MMC blocks, not sectors
Default MMC block size is 512B, and the DMA block size must equal
the MMC block size.  As we do not negotiate a larger block size,
scale the transfer count up to match the drive's logical sector size.

(CE-ATA mandates a *minimum* sector size of 4K)

Change-Id: I701cbac5c0fa320e8d38ea3333d99257b9b1f560
2025-11-20 19:53:56 -05:00
Solomon Peachy
25b985c319 ipod6g: Correct the DMA transfer size/count for CE-ATA devices
The DMA xfr size was fixed at 512 bytes, but the count was specified
in terms of the logical sector size (ie 4096 bytes).

Make the DMA size line up with the sector size.

Change-Id: Id9d0088b12775223f8d888f21b19e17c97927570
2025-11-20 19:33:15 -05:00
Solomon Peachy
44b5220f22 ata: Unify more of the ATA drivers into the common code
The goal of this was to have the ipod6g's ata driver report
proper vendor/model information from storage_info()

Change-Id: I64c1aee87c817cac23c90e062333a4ba3545dfaf
2025-11-17 08:29:56 -05:00
Dana Conrad
9ce66e088e Add USB Audio 1.0 support
Original commit credit to Amaury Pouly, Moshe Piekarski
Pushed across the finish line by Dana Conrad

To enable, see setting under General Settings --> System --> USB-DAC.
On devices with few endpoints, this may not work while HID and/or
mass storage is enabled.

Adds new dedicated mixer channel.

setting usb-dac can have values:
- never (0)
- always (1)
- while_charge_only (2)
- while_mass_storage (3)

Relevant devices are DWC2 and ARC usb controller devices. That being:
x1000 Native targets (m3k, erosqnative, q1, others...?),
sansac200, creativezenxfi2, vibe500, ipodmini2g,
ipod4g, creativezenxfi, creativezenxfi3, sansaview, ipodcolor,
creativezenxfistyle, samsungypz5, sansafuzeplus, iriverh10_5gb,
tatungtpj1022, gigabeats, faketarget, samsungyh820, gogearhdd1630, samsungyh925, ipodmini1g, ipodvideo, creativezenmozaic, sonynwze370, creativezen, gogearsa9200, gogearhdd6330, sonynwze360, sansae200, mrobe100, iriverh10, creativezenv, ipodnano1g, samsungyh920

USB Driver-wise, it should be noted that this patch requires some
slight changes:
- proper blocking on control OUT transfers, to make sure the data is
  received *before* using it, the usb_core should probably use that too
- drivers can now support interface alternate settings
- drivers can be notified of completion by a new fast handler, which
  is called directly from the driver; this is is necessary for
  isochronous transfers because going through the usb queue is way too
  slow

Designware changes:

- enable for USBOTG_DESIGNWARE
- set maxpacketsize to 1023 for ISO endpoints

Change-Id: I570871884a4e4820b4312b203b07701f06ecacc6
2025-11-15 07:30:15 -05:00
Sebastian Leonhardt
9aafbf9ca9 STMP37xx/iMX233: reduce popping noise on power on/off (Version 1)
Version 1: this patch prolongs startup time by 2 seconds, because the
sleep happens early before other threads have started.

The patch is tested on CreativeZEN and Fuze+.

The datasheet was not very helpfull, so some experimentation was needed.
I came to the following conclusions:
* setting HP to ground:
  to prevent popping noises, the headphone output can be set to ground.
  This however must be done before any part of the audioout module is
  powered up (setting HP to ground itself will lead to a pop otherwise).
  This consequently means that HP must NOT be set to ground for powerdown
  sequence!
  Further study showed that setting HP out to ground has no audible benefit,
  controversly not setting/resetting allows for noiseless RoLo-ing.
* headphone amp class A/AB mode:
  initially the HP amp is in class A mode, and should be set to
  class AB before playing audio, as the datasheet mentions.
  If the HP output is set to ground, it must be released BEFORE
  setting class AB! Releasing from ground while in AB mode leads
  to a very loud pop!
* release HP from ground:
  as said before: never release the HP from ground if the HP amp is
  set to class AB mode. Therefore the correct order is to power up the
  headphone amp, wait some time, release HP from ground, and then
  set the amp to class AB mode.
  To prevent pop, some time is needed before releasing the HP from gnd.
  On CreativeZEN 2 sec seems to be ideal; 1 sec have no audible effect,
  1.5 sec softenes the pop to some degree.
* shutting player off
  The popping noise when shutting off is much quieter that on power up,
  so depopping measures are not absolutely necessary.
  However the power off pop can be silenced by inserting a wait time
  after the audioout block is closed and before the rest of the chip
  is powered down. The longer the better, a time of 5 sec practically
  eliminates the pop.

Note that RoLo-ing can still produce noise, because the audio device
is not properly shut down.

Change-Id: Ib20e1d613b346433d2a711c442e303ededc26e78
2025-11-12 16:07:23 -05:00
Mauricio Garrido
3b7dafb117 3ds: 3ds port sources. Second set of two.
This commit adds new files written exclusively for the 3ds port.

Additional comments:

1. Plugins works, but will be enabled in future commits.
2. The port has only been tested on the New 3DS.
3. Not all features of rockbox have been tested so there may be bugs or non-functional features.
4. There is a known issue where a random crash can occur when exiting the app.

Change-Id: I122d0bea9aa604e04fca45ba8287cf79e6110769
2025-10-23 20:09:12 -04:00
Mauricio Garrido
a4de1195cd 3ds: 3ds port sources. First set of two
This commit adds changes to the original rockbox sources.

Note: the port files, functions, folders, etc., will be referred
to as 'ctru' to avoid using the Nintendo name elsewhere.

Change-Id: I0e2d3d4d2a75bd45ea67dc3452eb8d5487cf1f5a
2025-10-23 20:09:09 -04:00
nift4
df3712e708 nwze370: fix bootloader regression I caused
Change-Id: Ia14a9f46b4a6cc393043f59b586457e982472dc0
2025-10-21 23:33:36 +02:00