Commit graph

12257 commits

Author SHA1 Message Date
Solomon Peachy
a097c23db2 usb: Fix warning introduced in f11c89aae2
'usb_power_only' only should exist for USB_FULL_INIT

Change-Id: I23d14477ba55e81048ab29dada8d7d2ee44532b0
2026-07-03 14:45:21 -04:00
Solomon Peachy
f11c89aae2 usb: Fix usb mode not initialized/restored on the DX50/DX90
* Devices with ADB now have HAVE_USB_ADB
 * DX50/DX90 no longer set USB_NONE
   * stub out necessary functions
 * usb_set_mode() and global_settings.usb_mode are now:
   * called for all devices with (HAVE_USB_ADB | HAVE_USB_POWER)
   * wrapped with consistent #ifdefs

Fixes regression in ce88de54b8

Change-Id: Ib0c16082fe237e8159cd42847355186ea5c74589
2026-07-03 12:26:34 -04:00
William Wilgus
8a1a3d745d [Bugfix] FS#13947 - Sansa Clip+: High FM background noise when unboosted
Boost the CVDD1 voltage a bit to get rid of static when FM is playing

Change-Id: Id059882ffb5f10bb104b848ee0b646e36fdbe274
2026-07-02 02:57:22 -04:00
elishay
5c02cf3b3c bidi: do not pass non-ASCII codepoints to ispunct()
bidi_l2v() classified each character with ispunct((int)c), but c is
a decoded Unicode codepoint. ispunct() is only defined for values
that fit in an unsigned char (or EOF); a larger value is undefined
behaviour, and glibc then reads past the ctype table and reports
some codepoints as punctuation.

Hebrew final kaf (U+05DA) and gimel (U+05D2) land on such entries,
so a string ending in one had that letter trimmed off its RTL block
as if it were trailing punctuation and moved to the wrong end of
the line. Limit the punctuation test to ASCII so the result is
well-defined.

Change-Id: Ie6c3d8413f35ec3652e9228e3d5af05ef5bb811a
2026-07-01 21:03:38 -04:00
William Wilgus
d87755c535 FS#13944 - FONT_UI loads the last loaded font not global_status.font_id
FONT_UI scans from MAXFONTS-1 to 0 to maximize the chances of getting a loaded
font but this may result in global_status.font_id being ignored even
if set through setuifont

this should take care of all the plugin woes dues to this
by setting the lcd font to the ui font before loading the plugin
and also making FONT_UI map to this font when font_get(FONT_UI) is called
if the desired font is not loaded then fallback to the previous behavior

Change-Id: I101d6f91910c17b08fca2b988a0a99c9e6899bee
2026-06-30 13:29:23 -04:00
William Wilgus
3e08b86e4b FixRed a824085 skin: add %pX tag checkwps, ATA builds
ata_disk_isssd() return 0 for SIMULATOR

Change-Id: If281b5ce7a98f338dfd81635c8936dd90c41b9bb
2026-06-27 13:27:35 -04:00
Solomon Peachy
5462f203d3 bidi: Expand+Correct the list of RTL codepoints in is_rtl_char()
Was missing:

 * Arabic Supplement
 * Arabic Extended B
 * Arabic Extended A
 * Rumi Numerals
 * Arabic Extended C
 * Indic Isqaq Numerals
 * Ottoman Siyaq Numerals
 * Arabic Mathematical Alphabet Symbols

Worth noting that most of these are vanishingly unlikely to ever show up
in the context of Rockbox.  (The exceptions are "Arabic Supplement" and
possibly the Mathematical Symbols)

Also corrected "Arabic Presentation" into two distint blocks, as
the characters between them (fe00-fe6f) are NOT indicative of RTL.

Change-Id: I0c5c547921c789d32425682c8c75edb21428f549
2026-06-27 10:20:03 -04:00
elishay
0e3355de50 keyboard: fix RTL (Hebrew/Arabic) on-screen keyboard
Commit d1be73c ("keyboard.c Use viewports, move text box pos")
moved the picker and edit line into dedicated viewports. Under an
RTL UI language these viewports get VP_FLAG_ALIGN_RIGHT, so
lcd_putsxy mirrors every call; with the per-character cell drawing
this reversed the picker grid and the edit line (Hebrew shown
reversed, Latin filenames backwards, wrong caret).

- Clear the alignment flag on the keyboard own viewports so the
  picker grid and cell layout are no longer mirrored.
- Draw the edit line as a single string so the bidi engine reorders
  mixed Hebrew/Latin correctly, and use the full line width.
- Compute the caret from the bidi (LTR-base) visual layout so it
  lands at the insertion point, including mixed Hebrew+Latin text.
- Pick the edit-line direction and invert the left/right cursor
  keys based on the text first strong character.

Change-Id: I79f1c444bc9121fd5018ad5f6f4148afe2c1a3e1
2026-06-27 07:45:12 -04:00
mojyack
7154fcd9a8 usb: iap: workaround cur/set freq mismatch
Change-Id: I75a36c9dfd33e7f9192101220633137e5ad98411
2026-06-17 11:01:34 -04:00
William Wilgus
c3ad489738 [BugFix] Sandisk ClipZip Display Type 0 has no partial X updates
Type 0 displays had to update the whole x line due to anything other
than a full line causing corruption and tearing

I figured out that flipping x and x_end
(LCD_W - x and LCD_W - x_end)
makes it work properly

Lowered the refresh rate to 95 Hz
Removed Fade in on screen enable

Change-Id: I0b8f76ad01ce7e48bd0a56aa321c30c30f91ce8d
2026-06-16 00:38:43 -04:00
William Wilgus
32b8af9840 [BugFix] ClipZip Type1 Display init gamma correction
Now that we have a datasheet for the type 1 display controller
it turns out the gamma correction was not being applied
the screen looks much better with it actually applied

also lowers display refresh from 120 HZ to 90 Hz and applied a mentioned
sleep mode (0x14) to save some power

Adds comments for the LCD commands ala type 0

Change-Id: I2d72df4d24b8bf9f3627bdb96ec9ce43ddd8b10a
2026-06-15 00:12:26 -04:00
Adam N. Burke
383e227671 Sansa Clip Zip: Implement LCD flip (180 degree rotation)
Enable HAVE_LCD_FLIP for the Clip Zip and implement lcd_set_flip()
in the LCD driver, making the Display -> Flip Display setting work.
This lets the player be used upside down, e.g. clipped to clothing
with the control buttons pointing up and screen on the bottom.

Defining HAVE_LCD_FLIP also activates the existing button remap in
button_flip() (firmware/drivers/button.c) for this target: while the
display is flipped, LEFT/RIGHT, UP/DOWN and the volume keys are all
swapped to match the new orientation, so the whole device is usable
upside down, not just readable.

The flip is done in hardware by reversing the controller's GRAM write
direction and mirroring the write window in lcd_setup_rect, so partial
updates keep working and there is no per-frame cost. Both panel
variants are handled: the type 0 WiseChip/SEPS114A via MEMORY_WRITE/READ
(1Dh, 0x02), and the type 1 Visionox/LD7134 via the Graphic RAM Writing
Direction register (05h, 0x03). The direction register is written in
lcd_enable(), so it is set while the panel is powered and is re-applied
after display standby; lcd_set_flip() cycles the panel off and on so a
change to the setting takes effect immediately.

For the simulator, which has no real LCD controller, lcd_set_flip() is
implemented in the SDL LCD driver (lcd-bitmap.c) as a software mirror of
the framebuffer, so the flip is visible in theme previews; the generic
uisimulator stub is guarded out when HAVE_LCD_FLIP is defined.

Tested on real type 1 / LD7134 hardware in both orientations: display
content, button remapping and album art are all correct, and test_fps
shows partial updates run at full speed when flipped (1/4 frame 325 fps,
matching the non-flipped rate). The type 0 / SEPS114A path uses the same
approach; the 0x02 direction value was confirmed to flip a type 0 panel
by William Wilgus during review.

Change-Id: I99ef13949102b344826e72d1d90c71e2271448a6
2026-06-14 23:16:17 -04:00
William Wilgus
f07e977d7c Sansa ClipZip add Display type to debug update comment on LCD controller
display display type 0 / 1 in debug menu

update the comment on type 1 lcd I believe it to be a LDT LD7134 controller
the commands match up down to the gamma correction tables

Change-Id: Ic5d1d8db994a022a61db4a83a9f476cfafbcf51b
2026-06-13 12:56:55 -04:00
Solomon Peachy
f1bdf1e3c2 fix yellow from 59a42fbf61
Change-Id: Id696c20639cdcc987c228c9faec5a1ff8744797d
2026-06-10 11:28:04 -04:00
Solomon Peachy
59a42fbf61 pcm: Pull pcm_is_ready back out of the sink structure
It is referenced by multiple threads, and as such needs to be both
volatile and SHAREDBSS to keep everyone happy.

...should address hangs on startup observed on nano2g and mini2g when
voiced menus are enabled

Regression introduced in dfa33c2 and made far worse by 759ef27

Change-Id: I202ec6c0d5825ff3a319b7d95d600b4ce06dd685
2026-06-10 09:21:21 -04:00
William Wilgus
fee00f1f3c [BugFix] pcm-s5l8700 ipod nano 2g audio init hang
pcm_dma_set_freq expects the frequency index not the actual frequency

bug introduced in Commit dfa33c2 pcm: introduce pcm_sink

Change-Id: Idc521cfe1da22b112a16f81611dac720837eeea9
2026-06-10 00:47:56 -04:00
Roman Artiukhin
c5c39a3fdb pcm_mixer: fix auto frequency switch stopping playback on some targets
Regression from cb04b816. Restores sound by re‑adding
pcm_play_stop, previously invoked in mixer_reset.

Known affected targets: x1600 hosted hiby port (Hiby R1, Hiby R3 Pro II)
Discussion: https://forums.rockbox.org/index.php/topic,55125.msg258435.html#msg258435

Change-Id: I5fadac0b47f609e38baad5c7151354ee8f7e9871
2026-06-09 12:51:53 +03:00
William Wilgus
dfe965d81e font.c glyph_cache_load() reduce stack
open the glyph cache in a separate function so we can
get the MAX_PATH alloc off the stack quickly and
deal with the fd instead

Change-Id: I0e991a1286b29c781e3f03b6a49e100c70809920
2026-06-08 22:31:20 -04:00
Aidan MacDonald
722e4f10ad Cleanup some unnecessary HAVE_HOTSWAP uses
Always define storage_removable() and storage_present() so
that ifdefs are unnecessary. They were already defined as
constant for the CONFIG_STORAGE_MULTI case, but not in the
case of a single storage type.

Change-Id: I13073b3a72b201b5b11167deb050e6f27139c61c
2026-06-08 10:32:49 -04:00
Solomon Peachy
d54b9e6f8d chore: Get rid of *all* vestigal CVS '$Id:$' tags
Change-Id: I35c13a9768c582e4851aa252dd3ea5c89f760c8c
2026-06-01 16:01:18 -04:00
Solomon Peachy
d1f1d1da5e button: Fix a set-but-unused variable without HAVE_SW_POWEROFF
So wrap the definition and setting of repeat_count with the
same #ifdef

Change-Id: I8c06ea68eca7e5db960e4fa08a866761e856293e
2026-05-28 22:35:51 -04:00
Solomon Peachy
6e64cb8043 gigabeat-s: fix red in 216b576c9
Change-Id: I388ac7bbc60d06beede5461f99e0612086d1bfc3
2026-05-27 09:00:39 -04:00
mojyack
6e31703289 fix incompatible pointer errors with clang
clang uses "unsigned int" for "uint32_t", which does not match gcc's
"unsigned long".
fix errors caused by this.

Change-Id: I05aaf23934167a56a6e400f49fcaf8b70bfaca13
2026-05-27 08:43:49 -04:00
mojyack
d75a5d5769 target: mips: mark .startup.spl section as "ax"
this fixes "has non-ABS relocation R_MIPS_26 against symbol 'spl_main'"
error when linked with lld.

Change-Id: I6b584d8fdcae3f509f322b8557249bc2870904a3
2026-05-26 11:42:25 -04:00
Skye
0c8365a286 x1000: add basic UART implementation
Change-Id: Ic5a6d66b7280b924e6a106f07849a057c72d5c4c
2026-05-26 07:14:22 -04:00
Solomon Peachy
ff3155be9a lcd: Fix possible unset-before-use variable in 4bit alpha blending
Change-Id: I39e779e9452239b00731f31f55225cd979afe911
2026-05-25 13:05:49 -04:00
mojyack
2291aa24f2 usb: refactor control request handling
this commit is a combination of the following changes, which
significantly refactors usb core and class drivers.

1. unify usb buffers of each class driver to reduce iram usage
currently, many class drivers allocate their own buffer to receive
control out data, which is a waste of iram.
share one common buffer for that usage to address the issue.

2. simplify control request handling by implicitly receiving write
   request data packets
change 1 above fixed the data destination. therefore, having the core
receive the data allows us to reduce the class driver's work and
simplifies the api.

3. enhance usb core's control request handling and unify the legacy
   driver api
in order to implement change 2, both the legacy and new driver apis
should be supported. so that, using the designware driver as a
reference, the new driver api functionality is move into usb core.
this simplifies the usb device drivers by requiring them to implement
only the functionalities equivalent to the legacy api.

tested with ipodvideo(arc) and erosqnative(designware)

Change-Id: I3627daa90278751f599e2108ec150ec3f8f6c524
2026-05-25 12:42:36 +01:00
mojyack
64b1f09e06 usb: designware: cleanup irq handler
Change-Id: Ic1926a8277d32721e3c736472dfc41a57ba0d433
2026-05-25 07:38:37 -04:00
Christian Soffke
727cb798e1 usb: disable status event debouncing
commit 3307b04 didn't fully get rid of the PANICs observed on the
Fiio M3K after adding a debounce interval for USB status by event
in e75a3fb, so this reverts to the previous behavior

Change-Id: I42b45a545eb1e26fa3ae3150504712079678f96e
2026-05-25 07:01:49 -04:00
Skye
557694a07f libc: add sscanf to core
Change-Id: Ia4162132a500e4d06305eab724250b7714091b9e
2026-05-23 08:03:09 -04:00
Skye
b5597a1c38 erosqnative: add HW4 BT pins
Change-Id: I2569f4db70261b454a1e1444ec529f8e714adc80
2026-05-20 10:24:12 -04:00
William Wilgus
58f75311d8 merge font_getstringnsize and font_measurestring
measure string just needed a bit more to be a replacement

Change-Id: I25c760df5edd7224b50c0522b4e44b1f9b574c51
2026-05-18 01:36:50 -04:00
mojyack
b350d6e066 target: arm: s5l8702: crt0.S: use APSR_nzcv instead of r15 in mrc operand
Change-Id: I7e0cf0325407cade9d95d73af6f8dceb92bf3155
2026-05-16 12:02:32 -04:00
mojyack
c4abbdd718 target: arm: mmu-arm.S: use APSR_nzcv instead of r15 in mrc operand
Change-Id: Ie27d323ac497fe8d63cee89d2c0722caa293cd25
2026-05-16 12:02:11 -04:00
mojyack
6fc41c7cdf target: arm: s5l8700: fix mcr/mrc usage in crt0.S for lld
Change-Id: I6d25e4759e1d86f8de3047d10f5fcac8030afc6e
2026-05-16 12:00:45 -04:00
Solomon Peachy
6ee85ce61a imx233: Increase the memory region reserved for loading firmware
The imx233 bootloader reserves the first 1MB of DRAM for loading the
main firmware, but the recent utf8proc changes means we now exceed that
size on most imx233 targets.  Bump this up to 1.5MB to give us more headroom

Change-Id: I1b8bede85d06d40338ea6e3d9abb4e5da34423be
2026-05-15 11:41:23 -04:00
Solomon Peachy
a977c19338 fix broken bootloader builds, regression from 5951f6e5e9
Change-Id: I0daf76c362c9e50bf6593e3c8f40847a121dd3ea
2026-05-15 10:25:25 -04:00
Skye
5951f6e5e9 libc: move strncpy to core
Change-Id: If005a0305cedbab85905536238d0f799f19213e1
2026-05-15 10:04:06 -04:00
Solomon Peachy
4c60fe95fc Revert "pp5020: ata: do not yield in ata_wait_intrq()"
This reverts commit e13befb925.

Reason for revert:  Significant performance regressions, especially with respect to UI interactivity when the database is in use; see https://forums.rockbox.org/index.php/topic,55703.0.html

Change-Id: I0428711871480b74f7faeecb0536f7ed63f631cc
2026-05-14 14:42:53 -04:00
Skye
7d3f738b3f libc: fix firmware assert.h
Change-Id: Id7cc3e4656519fee908083d3b551c5228d220ef7
2026-05-14 11:54:52 -04:00
William Wilgus
db32a7f07e [bugfix] font_getstringnsize() incorrect count, add font_measurestring()
maxbytes counted final characters not actual bytes

font_measurestring() returns the number of bytes of a string that will
fit in a given width

Change-Id: Id73b763267e399bd558f87872b5e715076f9b7f7
2026-05-14 09:51:58 -04:00
Skye
7ab521cba6 libc: add actual sprintf to sprintf.c
Change-Id: Iba19b587781da3191c7674a6a141c0c4fbf8b344
2026-05-12 10:19:51 -04:00
Skye
25551180ba libc: add basic maximum field width support to sscanf
Change-Id: Iba6d8af32435beccf9a77d801b0eaac91549bc89
2026-05-12 10:16:45 -04:00
Aidan MacDonald
075d1deac3 pcm_mixer: remove some unused preprocessor symbols
Change-Id: I0c9c96f082cd4bb8313ade9a8d8da7fa2ba087e4
2026-05-11 07:19:50 -04:00
mojyack
142e1864ef usb: fix get_max_packet_size is called before endpoints are allocated
retrive the requirements like others rather than callback

Change-Id: I20efce76a418ebd7aa6943f02e53b3f7a8fd2797
2026-05-04 16:46:57 -04:00
mojyack
8873cbb57e usb: designware: support max packet size override
Change-Id: I75d3aca1599ce064c604c96f2b5ed4c041f975b8
2026-05-04 16:45:57 -04:00
Solomon Peachy
d92b42c70f Fix Yellow & Red in 41caf678fe
Change-Id: If111595271289878097c2a8b30bec3f18390a49c
2026-05-04 14:04:26 -04:00
mojyack
41caf678fe usb: allow more flexible endpoint allocation
the capabilities of endpoint of several devices such as dwc2 change during
runtime, so they cannot be determined during driver initialization.
therefore, allocation using ep_specs is inappropriate.

to support these devices, add functions to the driver that determine whether
endpoints are available and make allocation more flexible.

tested with ipodvideo(arc) and erosqnative(designware)

Change-Id: I8005c17f3d763cd17306bf49918e1cd8084bdeff
2026-05-04 13:31:21 -04:00
Vencislav Atanasov
02638c1cb8 s5l87xx: (Re)name the SHA-1 registers
Synced with the s5l8702-sha1 Linux driver in the freemyipod fork

Change-Id: I5243346205f7883f4271d4b272936dd125adb496
2026-05-04 07:16:29 -04:00
mojyack
bbdada7690 usb: enable cpu boost for specific class drivers
add needs_cpu_boost field to usb_class_driver and manage boost state in
usb_core, similar to needs_exclusive_storage.

Change-Id: Ieb0cd7bedda5b24bb0d209d5ce907db30f4815db
2026-05-04 18:15:52 +09:00