Commit graph

12246 commits

Author SHA1 Message Date
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
mojyack
732f7bcfd9 usb: allow class drivers to return error from init_connection()
Change-Id: Idcd48dd00d9d2f06c49a347e02a41a5de7252431
2026-05-04 18:15:49 +09:00
mojyack
3c10b21c10 usb: hold class_driver instance in each driver
Change-Id: Ia2f857bffcc6c3cca4dee59791c48c628082595b
2026-05-03 15:18:51 -04:00
Solomon Peachy
82a0921399 build: Fix yellow in 6d387e2e7f when panic is not supported
Change-Id: I8b896ef05ca27b3abc05d5d6910d5f6b9741047c
2026-05-03 15:10:03 -04:00
mojyack
6d387e2e7f usb: allow class drivers to override max packet size
this is required to make hid endpoint of iap class driver work,
especially on ipodvideo(arc).
at least for arc, it is required to set mps as 64 instead of 512 on
highspeed, or some accessories ignore incoming hid reports.

Change-Id: I242060faced28a66204146a9c36ef10626d6d265
2026-05-03 14:59:15 -04:00
mojyack
fad99773e3 send iap status change notifications
install iap event notification callbacks in various locations

Change-Id: I637a3ad18cb07ca056ad9b678400ba11d2f8faad
2026-05-03 14:20:29 -04:00
mojyack
e50ad40814 usb: increase usb thread stack size
Change-Id: I07283a68056e095efba8019dac2aa37d65c0ef6c
2026-05-03 14:15:56 -04:00
mojyack
757e683506 usb: core: handle apple vendor usb request
Change-Id: Iab5135774353630e7bce4939f40ca35940e214f3
2026-05-03 13:03:42 -04:00
mojyack
3bb656625b usb: add usb iAP driver
add class driver source files.
also register iap audio sink.
usbstack/iap/libiap directory is imported from libiap.

Change-Id: I776c5caec33fe9efadc448e2e3b37d500bf19c9f
2026-05-03 12:40:54 -04:00
mojyack
2b9e4a8d70 config: define USB_ENABLE_IAP
iap is only enabled for idevices.
it will not work without apple vendor id anyway.

Change-Id: I1696dbc8a2304fc5eecc5432b4c52e25801c468e
2026-05-03 12:40:54 -04:00
Solomon Peachy
81fcb10f8f metadata: Normalize all metadata to Unicode NFC form
* Standalone database tool
 * Simulator builds
 * Target firmware (Hosted and Native, for all >2MB targets)

Change-Id: Ia7361affc2fc6a08e73c31ecc9ef3a4008c2415d
2026-05-03 07:07:07 -04:00
Aidan MacDonald
bafc796ce7 Fix errors from stdint.h removal (cf6fb81346)
Change-Id: Ie9457121448f47db14300e035dc5b5eccd086884
2026-05-02 23:22:03 +01:00