Commit graph

671 commits

Author SHA1 Message Date
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
e09829a71d debug: Log if SMART is supported in the debug menu
This is the first step towards enabling this feature for all ATA
devices.

Only the ipod6g supports it out of the box with its stock storage device
but with the prevalence of flash/ssd mods of one sort or another, this
really should be determined at runtime.

Change-Id: Ie35d97fd857bec8213cd0a2ad80695e8bb04a2d6
2025-09-15 19:35:51 -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
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
Vencislav Atanasov
a20fe4a3ff Add debug menu option that dumps the boot flash of iPod 6G to a file
Change-Id: I7d7c3294cb45500297b903c40a3ec93c8a8ea33c
2025-07-06 23:17:26 +03:00
William Wilgus
856da7f366 Debug - OS stacks - show current stack usage too
Change-Id: I41f895786e409c3f4ea500f99eb74cbd6cdbe5b6
2025-03-20 16:50:08 -04:00
William Wilgus
10f8312db4 FS#13538 export and import battery level tables
when battery_bench is run
exports a file in the rockbox directory called 'battery_levels.default'

if the user wants their own levels they can rename the file battery_levels.cfg
and it will be loaded at boot

some minimal error checking is performed prior to using the values

added manual entry

Change-Id: Ia0126faced0c7229fcf8385a1bcb584b5a9dc378
2025-03-06 11:54:21 -05:00
Solomon Peachy
f3ce792af8 sysfont: Fix buffering debug screen, cube plugin, and vu_meter plugin
Instead of being hardcoded to expect 8px sysfont, make them scale properly

Change-Id: I02cc6cb53eebbd8241a142964bff305a1c5e535a
2025-03-04 13:40:17 -05:00
William Wilgus
4930fac05c [bugfix] run_debug_screen case-insensitive matching
Change-Id: If7ed57b34a7a13d7332742c117fdf67fc7e189d3
2025-01-27 10:27:25 -05:00
Vencislav Atanasov
cf4bf5439e S5L8702: Introduce syscfg_read() and use it in the debug menu
This makes it possible to reuse the SysCfg reading logic in other places.

Tested on ipod6g (normal + bootloader).

Change-Id: Iae6de2ee671bce4edb0153d26c57579ad47d0335
2024-12-17 23:08:10 -05:00
Solomon Peachy
b752f3f964 ipod6g: fix sim build
Change-Id: Idb1401e34a5f98222b7813ebdbe17a999691cef2
2024-12-10 23:04:09 -05:00
Solomon Peachy
a76ecf1725 erosqnative: Fix operation in a simulator environment
Real hardware needs 24-bit PCM data supplied, but simulator
is still 16bit only.

Change-Id: I20b88a7cb27105829fe5c9e9c434f559a6dbbb60
2024-12-07 14:05:23 -05:00
Vencislav Atanasov
a29b570ac4 S5L8702: Rename nor-* to norboot-*
Since the SPI NOR flash is only used for the bootloader, rename the files accordingly, This is a preparation for the nandboot driver will be introduced, since S5L8720+ don't have an SPI NOR flash anymore.

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

Credit: Cástor Muñoz <cmvidal@gmail.com>
Change-Id: Iea835fd2029470bfe9f813631ad4f3db711facc3
2024-12-07 00:56:06 +02: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
William Wilgus
00906647b4 Simplelist remove simplelist_set_line_count(n)
replace with simplelist_reset_lines(void)
there was one user saving one short string
remove the feature to simplify list code

fix scrolling in dircache debug item

Change-Id: I71f933f224c2de5f7a68feab904a2fe0b81e1362
2024-11-21 12:14:17 -05:00
William Wilgus
35a913473e list.c small cleanup, add simplelist_setline()
add simplelist_setline() to allow literal strings or owner buffer
to be shown in the simplelist

this makes simplelist more versatile by allowing static strings
to be added directly instead of copying into the simplelist buffer
(ie not consuming the simplelist text buffer)

add bounds checking to simplelist_setline/addline
No one has more than SIMPLELIST_MAX_LINES..  right?
-- there are actually a few places this isn't checked..

use new setline function in debug menu

share the simplelist buffer with the list_draw fn for gui_synclist
since they shouldn't be in-use simultaneously we can save some stack

Change-Id: I4a1e64d3a621d326ff094241da55452c0ff746ba
2024-11-21 08:49:18 -05:00
Vencislav Atanasov
f040c4c9ec Rename CPU_S5L870X to CPU_S5L87XX
This is a preparation to introduce support for the following SoC models: S5L8720 (iPod Nano 4G, iPod Touch 2G), S5L8730 (iPod Nano 5G), S5L8723 (iPod Nano 6G) and S5L8740 (iPod Nano 7G)

The whole family consists of SoCs which are similar, running ARMv6 and Thumb2 instructions, but some peripherals are located at a different address.

No functional change is to be expected so far.

Change-Id: If1f7669c49cf110ccc52c5234cc42ffd6f2b4e80
2024-11-20 10:58:32 -05:00
Solomon Peachy
15a4eb0422 debug: Correct most of the sector_t printf()s
The 'll' printf modifier is currently broken.  Fortunately all but
one of the uses is printing MB instead of bytes, which means we can
cast the value to a 'unsigned long' without risk of overflow/wraps.

...There's one remaining use ('%llx') which still needs to be sorted
out.

Change-Id: I89f406f6c085be153531d1ec1f2a314ae172b129
2024-11-15 07:28:55 -05:00
Solomon Peachy
bc6c189dcb storage: rename MAX_LOG_SECTOR_SIZE to MAX_VIRT_SECTOR_SIZE
Change-Id: I34f00748c1b0935d65af5f0fc6bdd13356ff31e1
2024-11-09 16:32:40 -05:00
Solomon Peachy
3664d382e0 ata: if drive doesn't advertise a nonstandard sector size, default to 512
...Instead of SECTOR_SIZE, which might be different.  This way
we can properly validate the value.

Change-Id: I8e6ae5882792f301ac580a144556af94772f4cfe
2024-11-07 18:15:26 -05:00
Solomon Peachy
0a11b06d93 ata: Correct parsing of the logical sector size in the IDENTIFY DEVICE
....It's specified in 16-bit words, not bytes.  So multiply it by 2.

(This hasn't been a problem in practice as everything uses 512B logical
 sectors so far..)

Change-Id: I0b1abd0f6184330f0b7f5c000c5ad547038f7c95
2024-10-31 21:51:42 -04:00
Solomon Peachy
e829ea9a5e ata: Rework how flushing, sleeping, and power off interacts
* FLUSH_EXT is used if featureflag is set and we are using LBA48
   (unconditionally used for CE-ATA on ipod6g)
 * FLUSH is used if featureflag is set (ATA6+) or if device claims to be ATA5+

 * Rename ata_disk_can_power_off() to ata_disk_can_sleep() as that is
   what it actually tests for.  Only use it to gate issuing the
   STANDBY IMMEDIATE command.
 * Restore behavior of ata_disk_is_active() to return 1 if drive is
   "spinning" or powered up.
 * Allow poweroff if drive claims PM support OR we are able to issue
   FLUSH/FLUSH_EXT commands.

 * Added ata_flush() to explicitly trigger a flush operation, and hook it
   up to storage_flush() in the device shutdown path. (Flushes were
   only previously used in the storage device power management path)

 * After issuing all settings, re-issue IDENTIFY_DEVICE to make sure
   it reflects everything we've enabled.

 * Update manual section on Flash/SSD mods.

Change-Id: I6770a54ef3a87f4c47120bcb96c944a6652f1bf4
2024-10-31 12:51:54 -04:00
Solomon Peachy
bd02af3413 SD: Fix typo in debug menu
Change-Id: I55530ca7b3e735fef0ac6d4151e66ca11e571aa0
2024-10-28 13:53:30 -04:00
Solomon Peachy
3951fbf9d2 ATA: Restrict to UDMA2 if we don't detect an "80-pin" cable
Change-Id: I55861065741f3365491445f1f3f5b0041f33e1c6
2024-10-26 15:09:10 -04:00
Solomon Peachy
563da70139 ipod6g: Reworking the bespoke ATA driver
ipod6g was configured with SECTOR_SIZE of 4096, but this ATA driver
unconditionally translated these to 512B operations on the actual
storage device.

Rockbox's storage layer already has robust support for "logical sectors
larger than physical storage sectors" through use of
MAX_LOG_SECTOR_SIZE.  So switch to that mechanism, allowing the ipod6g
ATA driver to be simplified.

If we want to support drives with physical sector sizes > 512B, then
we need to port the MAX_PHYS_SECTOR_SIZE logic from the primary ATA driver.

Additional changes:

 * Simplify MWDMA/UDMA selection logic
 * Report CE-ATA mode in debug menu
 * Use LBA48 commands only if drive is over 128GiB.
 * Drop default sleep/poweroff time from 20s to 7s (matching main ATA driver)

Finally, the bulk of the changes are the first phase of a badly needed
style cleanup that made reading this driver a lot harder than it should
be. I intend to split this into a separate patch.

Change-Id: I2feca9fd319c8d6cfb3c2610208970428d2fa947
2024-10-17 20:30:37 -04:00
Solomon Peachy
9b1a92fe36 Fix up a pile of bad format strings passed into simplelist_addline()
Change-Id: Ic45ea8633a1752b2e01cba2aace55309bcb7480d
2024-10-15 19:13:17 -04:00
Solomon Peachy
a2efbf0589 list: Flag simplelist_addline() as accepting format specifiers
And fix up all the problems I've found so far.

...This will undoubtedly introduce a pile of new warnings.

Change-Id: I868de507a0e9790f289676c198e2977c26755f22
2024-10-15 18:50:35 -04:00
Solomon Peachy
d3b7eba405 debug: Correct formatting when displaying drive size.
Change-Id: I95e9a257dcad548ec4378d01c0f9b4370ebf5318
2024-10-15 18:25:28 -04:00
Solomon Peachy
1ece63d054 debug: Log our logical sector multiplier, if enabled.
Change-Id: I077c0a88d8a51d909ff1df1ca79d95c884ba324a
2024-10-15 11:59:35 -04:00
William Wilgus
a2cc7546d8 Add DeviceData to bootloaders
same vein as bootdata but for devices that need to pass info back to a
running firmware

Change-Id: I0cdcdc0475804dfbbee415ab487104ae8fc8ac69
2024-09-02 13:29:43 -04:00
Solomon Peachy
05354e1bef Hopefully fix the remaining red from 15e52374
(imx233, ipodnano2g, !multidrive hosted/sims)

Change-Id: I9c89887078f9f50d3aac73f468ac323699e1fd1f
2024-08-12 15:20:13 -04:00
Solomon Peachy
15e5237469 storage: 64-bit sector offsets
* Create new 'sector_t' type alias:
    * uint64_t for all targets with HAVE_LBA48 or HAVE_SDUC
    * unsigned long for the everything else
 * Alter all storage APIs to use sector_t instead of 'unsigned long'
 * Alter Volume/Partition/storage info structures to use sector_t
 * Disk cache converted to sector_t
 * ATA Core:
    * convert to using sector_t for sector addresses and drive sizes
    * Always fill out upper 16 bits of LBA48 addresses
    * IDENTIFY INFO is fixed at 512 bytes, not SECTOR_SIZE
 * USB mass storage:
    * convert to using sector_t for sector addesses and drive sizes
    * Implement READ_16/WRITE_16 for LBA48 addresses
 * Convert FAT code to use sector_t for all sector references
 * output_dyn_value() now accepts int64_t instead of 'int'
 * Corrected "rockbox info" to work for (MULTIVOLUME & !MULTIDRIVE)
 * Better reporting of disk and (logical+physical) sector sizes in debug info
 * Detect SDUC cards and report on storage debug_info screen

To-do: SDUC

 * Refactor SD core to remove duplicate code in every driver
   * Card probe and init state machine
 * Implement core SDUC support
   * SD2.0 needs to be 2.0+ (fixed for jz47xx and x1000)
   * Host and Card ID (ACMD41)
   * 32-bit addressing for all read/write/erase operations (CMD22)
 * ADD SDUC to target device drivers, defining HAVE_SDUC as appropriate

Change-Id: Ib0138781a0081664d11511037685503df1b93608
2024-08-12 14:23:44 -04:00
Vencislav Atanasov
ca332b5473 Fixes for the SysCfg viewer
- decrease max entries to the required minimum
- merge two info lines
- fix value in too many entries error message

Change-Id: I72eeca5dd9c7c2fbb4978d0972d4db532dfa901e
2024-07-21 18:12:46 -04:00
Solomon Peachy
3611266d0f simulator: fix ipod6g simulator build.
This wasn't caught because the ipod6gsim target was inadvertantly left
out of the buildfarm.

Change-Id: Id0c250f29a999f8722f8911e061166f0e9c35502
2024-06-26 07:50:19 -04:00
Vencislav Atanasov
4691152f92 Add SysCfg viewer for iPod 6G in the debug menu
Change-Id: I4e142f40777c7f8ae58f2b46fc6a3ec4f12aa530
2024-06-24 21:00:25 -04:00
Vencislav Atanasov
4ea3732bd7 Add ATA serial number to Disk info debug menu
Change-Id: I73cc3d85ac28c7bd090859b6c19a5b67a41cfa04
2024-06-23 07:29:15 -04:00
Solomon Peachy
b6053c4d54 voice: Fix a handful of non-voiced splash messages
Change-Id: I561c756c542fa24824a881b5632c955a920b8471
2024-05-13 12:02:17 -04:00
Solomon Peachy
886060475e ata: Heavily rework sleep and poweroff logic
* Use of ata_disk_can_poweroff() was inverted, resulting in SATA SSDs
   getting powered off but leaving _everything_ else on, including spinning
   rust!
 * Replace the can_poweroff() heuristic with a test for the mandatory
   ATA power mgmt feature flag. Notably, the CF->SD adapters don't claim
   to support this!
 * Eliminate duplicated tests in sleep code
 * Wrap all poweroff-related code with HAVE_ATA_POWER_OFF
 * Don't ever use SLEEP command, only STANDBY_IMMEDIATE
 * Gate call to STANDBY_IMMEDIATE behind a can_poweroff() test
 * Prefer FLUSH_CACHE_EXT to FLUSH_CACHE where available.
 * Improve SSD detection heuristics to any of these:
   * Explicltly identifies as SSD (covers newer CF and SATA)
   * TRIM support
   * CFA compliant AND (CF level 0 OR high speed support)
 * Report SSD detection in debug menu

Change-Id: I7fcb83b6d6eabddc11c64326a573b08ab85412b5
2024-04-22 15:46:30 -04:00
William Wilgus
3714288f7a add bootpath to bootdata debug menu
show the full path to the currently booted firmware

Change-Id: I9c0b4335ef410a0a5132f1097a29368306497206
2024-04-03 15:57:06 -04:00
Aidan MacDonald
f026cc4e17 tagcache: Add menu entry for customizing the DB path
Allow the database path to be set from the file browser's
"Set As" context menu, so it can be changed without editing
the .cfg file by hand.

Change-Id: Ie1a84bcb2084ee3b1a0a18cc51f564238515f164
2024-04-01 17:23:06 +01:00
Aidan MacDonald
dc9d354ed2 multiboot: Add v1 boot protocol
v1 passes the drive and partition number of the boot volume
instead of using the volume number. The volume number isn't
reliable because the same filesystem might get a different
volume number once the firmware is loaded, which will cause
the firmware to use the wrong root volume and fail to locate
the correct .rockbox directory.

Using drive and partition numbers avoids this issue because
drive numbering is fixed and determined by the target.

Change-Id: I7e68b892d9424a1f686197a6122e139b438e5f7e
2024-03-31 16:57:19 +01:00
Aidan MacDonald
6ffd42548b multiboot: Refactor boot data validation, add version numbers
Instead of verifying the CRC before every access of the boot data,
verify the CRC once at startup and set a flag to indicate the boot
data is valid.

Also add a framework to support multiple boot protocol versions.
Firmware declares the maximum supported protocol version using a
version byte in the boot data header. The bootloader chooses the
highest version supported by it and the firmware when deciding
what boot protocol to use.

Change-Id: I810194625dc0833f026d2a23b8d64ed467fa6aca
2024-03-31 16:57:19 +01:00
William Wilgus
d78be6716b [BUGFIX] block SYS_EVENTS from some action switches
fixes some of the places where SYS EVENTS cause issues with action switches
that don't have handling for system events

more exist..

Change-Id: Ie6f4b05ed7ef1119d43e65ee49be8f754af83f52
2023-10-30 19:03:18 -04:00
Aidan MacDonald
825ec0b601 Remove structec API from debug_menu.c
Change-Id: I6b35bcdc4e676e81faf5353ca01ba4bd728ffb14
2023-10-01 12:10:41 +01:00
Solomon Peachy
8cc3266b2a Settings: Rename INT/BOOL setting type enum to RB_INT/RB_BOOL
....Because INT and BOOL are already defined in mingw32.

Change-Id: I28ab8189c00002c8f68bc9d0c23d2ae78d9e33d0
2023-09-22 10:00:46 -04:00
William Wilgus
00e5c81ecb debug_menu database delay redraw
only redraw every 100 entries

Change-Id: Ie0bb54812c1b8341aa4d8303341904d17baa2890
2023-01-27 00:10:47 -05:00
William Wilgus
d521020d21 [Feature] Add total entries to database info
show total database entries in debug>Database Info

Change-Id: Ic22b6a032ae0ee23e0f38c0da6a9cf1433ba29e2
2023-01-15 22:57:00 -05:00
Aidan MacDonald
719d48afc4 buflib: Refactor various debugging features
Gate buflib_get_data() checking, debug printing, and buflib
integrity checks behind individual defines in buflib.h, and
turn them all off by default. If needed, they can be turned
on manually when compiling.

The buflib debug menu is only available if debug printing is
enabled, so after this commit it will no longer be included
in normal builds -- it isn't very useful to end users.

Change-Id: Iab25b7852bc7c5592ce04c9c45762046a87d5bc3
2023-01-13 10:32:57 +00:00
Aidan MacDonald
1e9ad3ca0d Remove buflib allocation names, part two
Remove allocation names from the buflib API and fix up all callers.

Change-Id: I3df922e258d5f0d711d70e72b56b4ed634fb0f5a
2023-01-13 10:32:54 +00:00
William Wilgus
3745c813f9 misc.c open_pathfmt caller supplied buffer
Amachronic raised concern about open() blocking causing a static buf
to get overwritten in multiple calls its prudent to just have the caller
supply the buffer to minimize stack issues later

Change-Id: Iae27c7d063adb1a65688f920f6aa5c395fa5694a
2022-11-23 22:09:46 -05:00