Commit graph

859 commits

Author SHA1 Message Date
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
Solomon Peachy
08a6f804ce ibasso: Use correct API to query power input and charging state
Instead of using the generic hosted sysfs code, which expects
a full path, the ibasso code's sysfs code uses an enumeration.
Unfortunatley the generic power input/charging code used the former
API but linked with the latter.  oops.

Correct this by placing a private copy of these functions in
the ibasso-specific port, and removing the generic version from
that build.

(A "proper" fix would be to rework all 17 of the ibasso sysfs calls
 to use the generic sysfs API)

Change-Id: Ic13adc9782d85560f0c74d77f60a629619d38668
2025-05-22 07:15:15 -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
Aidan MacDonald
d14ddcafd5 arm: implement cache maintenance ops for ARMv7-M
To keep the code size small, this hardcodes the D-Cache line
size and set/way information (which is defined by the target
and should be fixed for a given CPU) and assumes there is only
one level of cache.

Change-Id: Ia6d0e6a87b5dbfc6c39bda83b58461ed8767edf6
2025-04-21 13:07:38 -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
Vencislav Atanasov
d6cd237f80 New port: iPod Nano 3G
Currently, only a bootloader can be built successfully. The development bootloader is functional, it enables further progress on the port.

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: Idf85e42334b0e0ae36f9ed273e2940d5d7736e34
2025-04-18 20:10:29 -04:00
Aidan MacDonald
3ed9fb3115 arm: add initial ARM Cortex-M support
M-profile cores manage interrupts differently from classic cores
and lack the FIQ. Split the interrupt management parts out into
separate headers but keep the endian swapping routines (which are
not profile-dependent) in the common system-arm header.

The initial part of the vector table is common to all Cortex-M
CPUs and is intended to be included by the target linker script,
with the vendor-specific part of the vector table appended to it.

Change-Id: Ib2ad5b9dc41db27940e39033cfef4308923db66d
2025-04-18 13:19:42 -04:00
William Wilgus
50da856992 [BugFix] itoa conflicts with mingw rename to itoa_buf
Change-Id: Ife361f2fd8c8946db5bb2e0e58c0981b2ed3c5f3
2025-02-18 10:41:18 -05:00
William Wilgus
f55fe21f66 add itoa(), replace snprintf("%d") calls
we can save some space and still end up with a 20% faster function

Change-Id: Ia58900122944b8527ef01a673afe18ea794acb41
2025-02-03 01:23:49 -05: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
Vencislav Atanasov
843157e227 S5L8702: Abstract LCD driver
This driver decouples the LCD interface from the target-specific LCD parameters. It makes it possible to reuse most of the ipod6g driver code on ipodnano3g and ipodnano4g.

No difference in the produced binaries for ipodnano2g (normal and bootloader).

Tested on ipod6g (normal and bootloader).

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

Change-Id: I7ce198ed3d5a8b58759951e2d67788cbf9781dc8
2024-12-15 14:52:36 -05:00
Solomon Peachy
3b78daed14 simulator: Fix "ErosQ Native" (247) simulator build.
Change-Id: I74d1bafd9c6dbab976aabd6a44d683fb9eb3edaf
2024-12-07 13:43:36 -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
Vencislav Atanasov
b240f01059 S5L8720: Add support for TTB and MMU
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: Ica1e2b8e82ea162ebab01cf119f5da2f8877bc05
2024-12-06 22:00:04 +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
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
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
Vencislav Atanasov
fb134c9533 Rename UC870x to UC87xx
This is a driver for the UART controller on the S5L87xx series of SoCs, which is named after the SoC family.
Since S5L8720 is confirmed to have the same interface and the newer models probably also have it, the driver is renamed to reflect this.

Change-Id: I974c002924372e860db0e49235d108dab87f8831
2024-11-21 20:07:50 -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
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
e2fb4ecd5c xduoox3: Completely strip USB support out of the bootloader.
Change-Id: I7167e051a56a3be3c285c209b1c8fca7de251b09
2024-07-03 16:51:58 -04:00
Solomon Peachy
dca5fb9514 simulator: Fix Samsung YP-R0 windows simulator build
Change-Id: I2940cd9fed7e24c17d221402928737606d4d0ab6
2024-06-26 20:45:59 -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
Szymon Dziok
f7a3b4dfa3 Radio support and detection for Samsung YH92X [FOR TESTING].
Status:

- tested on:

  Samsung YH920 - it uses this detection too, it always should have
                the radio.
  Samsung YH925 with the radio.

- untested on:

  Samsung YH925 without the radio.

Change-Id: I68b39c09d6b7e26a4c373fbd8bf9401a97e86123
2024-06-23 20:11:59 -04: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
Solomon Peachy
c00dff157c ....Fix the fix, properly.
Change-Id: I3349f0c039834e40ddbaebd13da664fa5c5b1bd9
2024-03-23 21:46:51 -04:00
Solomon Peachy
57f76784c5 Fix build for hosted targets.
Basically the namespace code _never_ actually linked properly on hosted
targets, but nobody noticed as there were no users, causing the symbols
to be dropped with no fuss.

The tagcache namespace awareness stuff pulled in the namespace code,
which made things go kaboom due to it relying on native FAT parsing
code.

Change-Id: Idef5f44b026c875022436809ca1f5015eece714a
2024-03-23 19:59:31 -04:00
Dana Conrad
a3fe07ff12 ErosQ New Revision HW volume
Add HW volume control via ES9018K2M, and reorganize
eros_qn_codec.c/.h, audiohw-erosqnative.c.

This automatically detects the presence of the new DAC and
uses its hardware volume scaling. If not present, use same
SWVOL we have been using so far.

Add debug menu readout of SWVOL/I2C result.

Break out es9018k2m stuff into its own file so that
maybe it can be useful to other ports.

Note that we may need to get smarter about detecting the DAC
type if/when another model emerges.

Change-Id: I586a1cf7f150dd6b4e221157859825952840af56
2024-01-02 06:51:07 -05:00
Aidan MacDonald
781f955aa2 Remove structec API
In my opinion this API is just not very useful - design is kind
of questionable. There are hidden limits on the struct size and
bugs on 64-bit platforms due to assuming sizeof(long) == 4.

At the end of the day, the only major user was the tagcache and
it's actually less code size to do endian swapping manually.

Change-Id: I451c7f1a10cf3e28744c32c0f1f39a710d5cc100
2023-10-01 12:10:41 +01:00
Aidan MacDonald
92565e9246 buflib: Add malloc-backed buflib
This is intended for improving the effectiveness of tools like
ASAN when debugging memory errors in the sim. It's not meant to
be a serious allocator for hosted targets.

Enable it by changing the buflib backend in config.h.

Change-Id: I0cf23cefa47ee35dede7b49e0e5b72dac60e8d3e
2023-01-15 10:04:13 +00:00
Aidan MacDonald
f995c26de9 buflib: Add CONFIG_BUFLIB_BACKEND for selecting a buflib backend
Defaults to the normal "mempool" backend, which is currently the
only implementation.

Change-Id: I56d034a6e0f5edc90c39526d1551945eec6ca336
2023-01-15 10:04:13 +00:00
Aidan MacDonald
680261fbb7 buflib: Prep for multiple backend support, rename to buflib_mempool
Rename the current buflib implementation to buflib_mempool.

Change-Id: Iefdf74be1f7d8fcd19e6ce2289c3d1459b54d013
2023-01-15 10:04:13 +00:00
William Wilgus
7faf6be35f chunk_alloc
chunk_alloc allows arrays (or any data) to be allocated in smaller chunks

you have to save the indices..
 variable data will have variable indices you need to
 store these as [chunk_alloc] doesn't keep track
 if you have a fixed size for each
 alloc you can do indice / sizeof(data)
 or index * sizeof(data) to convert

Lots of debug stuff still in and it needs optimization

User provides chunk_size and max_chunks
max_chunks * struct chunk will be allocated at start
with (1) chunk_size allocation initially

alloc_chunk() with size = 0 shrinks the last allocation to the size of the data used

add OOM checks on buflib_alloc -- oops

move bytes available to the header -- less memory per chunk & better alignment
keep track of the current in use chunk index -- should speed things up a bit

Now allows:
realloc chunk header
larger allocations than chunk size

reallocs smaller than existing will shrink the current array
rather than alloc a new and copy data

Comments welcome :)

Change-Id: I8ed170eef73da95da19430a80b32e5debf0c8276
2023-01-10 23:59:19 -05:00
Aidan MacDonald
7819a06d74 Add rectangle utility functions
Change-Id: Iebcddfc36733aab5131d2fcb9fd8c8a32eff84b8
2022-12-01 12:36:28 -05:00
William Wilgus
eb9b3513fa Remove strtok_r.c
strtokspn emulates the original libc function

Change-Id: Ie6cd033ebf5d4f78ce4462f19bfb8ffb16d04ae1
2022-11-20 23:37:20 -05:00
William Wilgus
f6c719d7ec replace strlcpy with strmemccpy
replace applicable calls to strlcpy with calls to strmemccpy
which null terminates on truncation

in theory the strmemccpy calls should be slightly faster since they
don't traverse the rest of the source string on truncation
but I seriously doubt there is too much of that going on in the code base

Change-Id: Ia0251514e36a6242bbf3f03c5e0df123aba60ed2
2022-11-14 23:56:16 -05:00
William Wilgus
b25a9d8f99 add memccpy.c
Not sure if this is worth the added bin size yet but I will
see where I can use it to try and make it worth it

Change-Id: Icc299d3986172ff224a14be48da3bf065d728a66
2022-11-15 00:56:01 -04:00
William Wilgus
a634557a88 fix strptokspn, add strcspn, fix splash.c
fix off by 1 error in strptokspn, add strcspn, fix fallout in splash.c

Change-Id: I61475d9633fc35db5a8ae30cbe588f69f2f7fabc
2022-11-13 01:14:49 -05:00
William Wilgus
c756a8a89d make splash split on control characters
splits on spaces also considers \r\n\f\v\t as mandatory breaks

I'm still working on the strptokspn function
my goal is to use it directly rather than storing the matched char
and modifying the source string with \0 in order to tokenize the output
--Done

Change-Id: I7f378b5b9c4df8f10899b9a55a98950afb3931dc
2022-11-12 06:22:16 -05:00
Aidan MacDonald
4bd97c6535 mips: consolidate exception handling, add exception backtraces
Merge the x1000 and jz47xx exception handling code since they use
the same exception vectors and handlers. The interrupt handler is
now called from the common exception vector, but remains separate
for each board since they have different IRQ layouts.

The new exception handler can provide a stack traceback from the
interrupted code, rather than the (uninteresting) caller traceback
displayed by panicf. This allows you to see what led up to a null
pointer deref or division by zero, which makes it _much_ easier to
track down errors that occur in common leaf functions like strcmp.

Change-Id: I59a0ebb5e40fcb36505c3bfdb47f8cac2f9936b1
2022-10-17 09:04:18 -04:00
Solomon Peachy
418169aff8 Revert "Remove YUV blitting functions and LCD modes"
This reverts commit fe6aa21e9e.

Change-Id: I8bb1e5d6c52ed1478002d2140ef494ec5d62b8e3
2022-10-13 11:08:06 -04:00
Aidan MacDonald
fe6aa21e9e Remove YUV blitting functions and LCD modes
None of this is needed now that mpegplayer is gone.

Change-Id: I360366db8513e4d988021e8d7b7d8eb09930efb8
2022-10-03 13:30:01 +01:00
Aidan MacDonald
f373c97c90 Define LCD_STRIDEFORMAT unconditionally
Instead of putting "#ifdef LCD_STRIDEFORMAT" at every usage of the
macro it's simpler to have config.h define LCD_STRIDEFORMAT to the
default of horizontal stride when the target leaves it unspecified.

Change-Id: Ib187012aad65ac678dbd837b1464a83bad722411
2022-09-30 10:42:49 +01:00
Aidan MacDonald
3ae4a98e3b x1000: spl: remove selectable boot option support
Now the SPL boots the Rockbox bootloader unconditionally, which
allows for some simplification.

Change-Id: Id75c82db25a87e0e9043bb0771f622b1fc9482fb
2022-03-25 21:36:51 +00:00
Aidan MacDonald
7cb49cfb33 x1000: spl: split off NAND storage to separate file
Just tidying. No functional changes.

Change-Id: I8aa85c789d1a6bd357797c6c95e38a7325eba809
2022-03-25 21:36:51 +00:00
Aidan MacDonald
9bde653410 firmware: allow screendump in bootloader
Enabled if target defines HAVE_BOOTLOADER_SCREENDUMP

Change-Id: Idc135ef81e55d0f3eb8e7d2763d455c6455cf8fd
2022-03-24 18:59:50 -04:00
Aidan MacDonald
428491df69 x1000: support new binary header in rolo
Change-Id: I192c3d69616c39534ff329174c4d8d4a357d014d
2022-03-11 11:15:56 -05:00
Aidan MacDonald
7fa48faeb5 multiboot: Refactor duplicated functions to a separate file
The implementation of write_bootdata() and get_redirect_dir() was
copied verbatim in two different places, obviously a bad thing for
maintainability. This moves them to a new file multiboot.c as they
are only used for multiboot.

Change-Id: Id0279216e4dd019f8bf612a81d3835eff010e506
2022-03-11 10:58:20 -05:00
Aidan MacDonald
ee87bfb933 Add support code for dealing with U-Boot uImages
Adds a loader for the legacy uImage format that is commonly used on
embedded Linux systems. It verifies checksums and supports uncompressed
and gzipped images. Supports arbitrary reader functions to allow the
images to be streamed off any storage device, for optimal RAM use.

Change-Id: I93c35f9a6f323999a22a07300e05627fabfcbd2c
2022-03-04 09:02:56 -05:00