Commit Graph

11211 Commits

Author SHA1 Message Date
Aidan MacDonald f63edb52ef x1000: refactor AIC initialization
Have pcm-x1000 handle most work, so target's audiohw code touches
only the relevant settings.

Change-Id: Icf3d1b7ca428ac50a5a16ecec39ed8186ac5ae13
2021-05-30 19:17:50 +00:00
Aidan MacDonald c78ba1aa68 MIPS: add another mipsr2 endian function
Used by WAV and AIFF encoders for recording.

Change-Id: If1bf05583c6b5c123c91eb9c4dfe0e11efd3a0f7
2021-05-29 15:35:50 +00:00
Aidan MacDonald f64e8dc33c x1000: Complete the register definitions
I think this covers everything now, although some fields are missing
enum values. Those can be added in if and when they are needed.

Change-Id: Ib1a94ba9c9a5949b6a038f8c1a49786823fae58f
2021-05-29 16:34:32 +01:00
Aidan MacDonald 5cbeb88541 FiiO M3K: keymap improvements & fixes
- Add support for skip and seek while the player is locked.
  (Thanks to @bahus for the suggestion)
- Fix touch zones because the down button zone ended up being
  a lot smaller than expected due to the touchpad's wonkiness.
  Also added a visual display of the touchpad to its debug menu.
- Fixes the pictureflow keymap because it was mostly unusable.

Change-Id: Ic0da4f8df3613ff7828ce1cb940ed9e77ada3281
2021-05-22 12:20:44 +00:00
Tomasz Moń 00b4626790 Sansa Connect: Clear recoverzap parameter
Clearing recoverzap parameter exists the Recovery Mode. This makes it
possible to run Rockbox on Sansa Connect without relying on original
Linux firmware.

Enable write-through cache on flash memory as write-back complicates
handling without any real benefits. The flash memory accepts commands
as series of writes at predefined addresses, so it is important that
the cache does not interfere with the writes.

Change-Id: I219f962f20953d84df43012cf16bbb16d673add8
2021-05-21 18:55:14 +00:00
Solomon Peachy 0c62177575 FS12845: Fix uninitialized read
Change-Id: If0e5b65a70e10b624416e2a15e0b3df29c2b4591
2021-05-19 17:09:48 -04:00
Aidan MacDonald ad64293ae6 X1000: fix SD driver issues
- Added panic check for unaligned addresses
- Properly set 50 MHz high-speed mode timings

Change-Id: Ia0b3e5a6612c2053a28c2c3125de8ea92100912e
2021-05-14 10:30:58 +00:00
Aidan MacDonald eb0336eded FAT: align writes when bounce buffering is enabled
Motivation: turns out the DMA in the M3K's MSC controller is buggy,
and can't handle unaligned addresses properly despite the HW docs
claiming otherwise.

Extending the FAT driver bounce buffering code is the easiest way
to work around the problem (but probably not the most efficient).

Change-Id: I1b59b0eb4bbc881d317ff10c64ecadb1f9041236
2021-05-14 10:30:41 +00:00
Solomon Peachy ff28d238b8 ibasso: DX50/DX90 support 192KHz audio
Also bump max battery capacity to 7300mAh, to accomodate
oversized aftermarket units that require case mods.

Change-Id: I743e550b0c0843ab17529e70b5d592ea0e9a79d8
2021-05-13 21:40:22 -04:00
Dana Conrad 84a3cbe24d ErosQ: Small keymap changes
- Move WPS Stop to Power (Hold)
- Add WPS Hotkey to Wheel scroll Fwd/Back
- Add WPS Quickscreen to Play (Hold)
- Add Tree Hotkey to Play (Hold)

Change-Id: Id74622138353521f736c0de1009a354307b108eb
2021-05-12 11:01:27 +00:00
Moshe Piekarski b895fb6643 Add tm->yday to RTC ports missing it
Change-Id: I86882262bafb8d06f925aabb87ebd1b5dcb0cd53
2021-05-12 10:52:03 +00:00
Aidan MacDonald 3f26fcf340 FiiO M3K: New bootloader
SPL and UCL-compressed bootloader are now packed into one output,
bootloader.m3k, eliminating the separate SPL build phase.

The Rockbox bootloader now has a recovery menu, accessible by
holding VOL+ when booting, that lets you back up, restore, and
update the bootloader from the device.

Change-Id: I642c6e5fb83587a013ab2fbfd1adab439561ced2
2021-05-12 10:35:20 +00:00
Aidan MacDonald 3748117ee3 Add standalone UCL decompressor
Change-Id: Ibdb128ad66a7dcdd617dc83dfd294c0b24d4901d
2021-05-12 10:35:20 +00:00
Aidan MacDonald 15ad1c42db X1000: simplify NAND driver
- Removed unnecessary layers of generic code
- Software ECC is gone since we don't need it now (and maybe not ever)
- Removed bounce buffering, so callers must now align buffers

Change-Id: I33fbac9d9d12a4657980b8618c7d62bfa91e2ea0
2021-05-06 08:37:26 +01:00
William Wilgus 49edfc237b lcd_putsxyofs 16 bit lcd_mono_bitmap_part [AS]
'Bugfix' mono_bitmap_part reads ahead in the buffer,
if the height is <= char bit pixels other memory gets read
found with [Address Sanitizer]

also g#3332 since this is clearly a problem across the code
instead place the check for height < 8 in the lcd_mono_bitmap_part function

Change-Id: I917cbbd568fd5474b76a98c8919467e2538e0f0c
2021-04-30 21:26:06 -04:00
Aidan MacDonald 16a1993cad x1000: Remove some #ifdef SPL in the sfc/nand code
Change-Id: I554d590bfa700e521a74b5216e09f9673902d676
2021-04-28 20:04:10 +01:00
Aidan MacDonald 423fcf951a x1000: Rewrite clk_get code so it's more data driven
This is not pretty, but at least it should be usable by the SPL.

Change-Id: I1c0cdb910109c882160e3effd7c778e4d961842c
2021-04-28 20:04:10 +01:00
Aidan MacDonald 20fc928221 x1000: Centralize common definitions, memory layout
Change-Id: I8daad058ae55d4b750b1ae407153e4917de5d095
2021-04-28 20:04:10 +01:00
Aidan MacDonald ed8c977e2f x1000: Fix stupid bug in the SPL
This overwrote the first 2 instructions of crt0 in the bootloader!
I'm really not sure how this *didn't* cause a fatal exception.

This address isn't special as far as I know, so just move it to the
TCSM by making it a static variable.

Change-Id: I58e1486804aeb2b68325e8de2aa1874c97abef19
2021-04-28 20:04:10 +01:00
Aidan MacDonald d5695822a7 MIPS: remove .MIPS.abiflags section
The abiflags data is only used to communicate ABI information to a
program loader -- you can see what info is stored with readelf -A.
Dropping it shaves 24 bytes off of every binary (including plugins).

Change-Id: Iae78eeffe5c840ff67717707fb94821d24aac8ec
2021-04-26 12:41:06 +00:00
Solomon Peachy 7d0d32dbc6 Nuke the never-functional iriver ifp-7xx port
It never worked, and hasn't compiled in something like a decade, Given
the HW capabilities (limited onboard flash, no expandability) there's
really no point in trying to fix/complete it.

Change-Id: I7d175089840396f8891645bd10010d730dd5bfdc
2021-04-26 07:42:58 -04:00
Solomon Peachy 3ba2f6e5c7 Nuke all TCC77x targets: iAudio 7, Sansa C100, M200(v1-3), Logik DAX
They were never finished, never saw any release ever, and haven't
compiled for the better part of a decade.  Given their HW capabilities [1],
they are not worth trying to fix.

[1] 1-2MB RAM, ~256MB onboard flash, no expandability

Change-Id: I7b2a5806d687114c22156bb0458d4a10a9734190
2021-04-26 07:41:51 -04:00
Aidan MacDonald 77188e41f5 X1000: remove bogus GPIO Z mutex
There's absolutely no way for gpio_config() to get called from two
different threads due to the co-operative threading model, and it
is unsafe to call from IRQ context no matter what we do.

Change-Id: I58f7d1f68c7a414610bb020e26b774cb1015a3b0
2021-04-25 14:27:35 +00:00
Aidan MacDonald a2dfafb2b2 X1000: disable SFC DMA
Change-Id: Ia33896b4a19da6eaaf3e5c057891ab10d75f31e1
2021-04-25 14:16:12 +00:00
Aidan MacDonald d6220f618b MIPS: emulate -ffunction-sections with macros in mmu-mips
Using a macro to put each function in its own .icode-based section
allows us to put the functions in IRAM _and_ have linker GC. This
removes a troublesome #ifdef BOOTLOADER_SPL on the X1000 target.

Change-Id: Ia7b59778f5c36b7970dee4280547e434a1f4fc5a
2021-04-25 14:04:38 +00:00
Solomon Peachy aab72f969f ata: Rework power management behavior a bit
After continued reports of corruption using iFlash adapters, I went
digging for more clues, and this combination of changes seemed to
solve data corruption with the iFlash adapters on the ipod video:

 1) Instead of SLEEP, use STANDBY_IMMEDIATE when we detect drive
    as an SSD or CFA-compliant device.  The latter is technically higher
    power than the former, but what this means in practice is unclear.
 2) Don't check ATA powermanagement flag prior to issuing powermgmt
    commands. This reverts the previous "workaround" for the FC1307A --
    and PM is a mandatory part of the ATA spec for any CFA device.
 3) Prior to issuing SLEEP/STANDBY_IMMEDIATE, issue FLUSH CACHE.  The
    ATA spec says this is redundant for the latter, but says nothing
    about the former.  Either way it is always safe to call first.
 4) Delete all other FC1307A_WORKAROUND code related to powermgmt flags.

Change-Id: I492d06664c097d9bbd5cccfb9f5b516da165b1ee
2021-04-23 13:07:45 +00:00
Aidan MacDonald 79d1b68fe2 FiiO M3K: disable USB DMA
Although data transfer is reliable with DMA, it seems to cause hangs
and lockups during the early stages of connection and it's not clear
what the cause might be.

Change-Id: I9a83089c31d28309f0534dcdedf3c8c8348e6e3d
2021-04-23 00:30:52 +01:00
Aidan MacDonald 75cb8ba8a4 FiiO M3K/X1000: add USB support
This only required a minor patch to the usb-designware driver due
to DMA requiring physical addresses -- on the X1000, these differ
from virtual addresses so we have to do the usual conversion.

Both the mass storage and HID drivers work, but there are a few
issues so this can't be considered 100% stable yet.

- Mass storage might not be detected properly on insertion,
  and USB has to be replugged before it shows up
- HID driver may occasionally panic or hang the machine

Change-Id: Ia3ce7591d5928ec7cbca7953abfef01bdbd873ef
2021-04-21 18:31:55 +00:00
Aidan MacDonald 088ebb5fac Minor enhancements to axp173 driver
- Added register names to reduce usage of magic numbers
- Added function to control max charging current, needed for USB
- Corrected comment about axp173, since FiiO M3K has an axp192

Change-Id: I6604ce8d44e5a2ee84061cf042d17ccc4734ac57
2021-04-21 18:31:55 +00:00
Aidan MacDonald 9313274302 FiiO M3K: fix LCD weirdness when booting via RoLo
Change-Id: I2234a0d1b3095adbcca0bbd060fd5a7e13a895c1
2021-04-21 19:10:34 +01:00
Aidan MacDonald c71a47f649 Move usb-designware out of ARM target tree
Change-Id: Ic981737976655596ea622b7b4d15a2d841bd993d
2021-04-18 18:45:28 +01:00
Aidan MacDonald 92140752d7 FiiO M3K: disable CPU frequency switching
After conducting some simplistic tests, I found that the power usage
did not appear to be affected by the CPU frequency.

I tested by playing back a 44.1 KHz FLAC file on single track repeat,
and measured current with the AXP173's battery discharge current ADC.
The button and LCD backlights were set to always on. Headphones were
unplugged and the volume was muted to eliminate any influence from
the headphone amp.

On average the current usage was between 78-81 mA at 1008 MHz, 252 MHz,
and 112 MHz. If anything, 1008 MHz drew _less_ current than the lower
frequencies, by about 1-3 mA.

A possible explanation for this, assuming it's not just a bias of the
test, is that the CPU idle state saves so much power that it's better
to maximize the real time that the CPU spends idling. More systematic
testing is needed to confirm this.

Change-Id: I527473e8c4c12bc1e94f8d4e849fecc108022abe
2021-04-17 20:24:36 +00:00
Aidan MacDonald fceffb7d4a x1000: disable CPU idle stats by default
There's no point including this in normal builds: the stats are not
used for anything, they are not really of interest to anyone except
developers, and add a small overhead to the kernel tick.

Change-Id: I1b4f67cc62d11d634a8cec279dca513dd10eea96
2021-04-17 20:24:21 +00:00
Aidan MacDonald 01d1eb4258 FiiO M3K/X1000: Do system clock initialization in the SPL
Initializing the clocks in the SPL brings Rockbox in line with
how the FiiO M3K's original SPL works. It's likely other X1000
devices do this too.

There was a logic error in the previous setup: the code falsely
assumed that DDR memory would always be running from MPLL, but
it would be switched to APLL by the bootloader. Rockbox would
then try to re-init APLL, albeit with the same parameters. Maybe
this was the cause of the boot hang on some units.

Change-Id: I64064585e491bbdf1e95fe9428c91a9314f2a917
2021-04-17 20:24:07 +00:00
Aidan MacDonald e123c5d2f2 x1000: don't reset all GPIOs at boot
What we really want is to avoid any interrupts being generated
before the drivers which handle them are properly initialized.
Intead of trashing all GPIOs, search for the problem pins and
fix them, leaving the others alone.

This fixes the M3K's button light flickering on boot and should
stop the M3K from entering a potentially confusing "dead" state
where all the lights are off but the CPU is still on.

Change-Id: I13a6da0f0950190396bff5d6e8c343c668e8fea1
2021-04-17 20:23:47 +00:00
Aidan MacDonald 1b8542490d x1000: Redesign SPL, and allow it to flash the bootloader
SPL is now designed so core X1000 code is in control of the boot,
under the reasonable assumption that the device boots from flash.
It should not be too hard to adapt to other X1000 ports.

The biggest functional change is that the SPL can now read/write
the flash, under the control of a host computer. The SPL relies
on the boot ROM for USB communication, so the host has to execute
the SPL multiple times following a protocol.

Change-Id: I3ffaa00e4bf191e043c9df0e2e64d15193ff42c9
2021-04-17 20:22:49 +00:00
William Wilgus 85fbbd9c7f 16 bit lcd_mono_bitmap
'Bugfix' mono_bitmap_part reads ahead in the buffer,
if the height is <= char bit pixels other memory gets read

Change-Id: I6e0d7a9017e1f9c371ffbd56af149ac20cb82341
2021-04-17 15:33:58 +00:00
Dana Conrad 4dc602dd7f erosq: Tweak volume scale to be approximately correct
Tested on eros q, everything measured from line out,
open circuit.

- volume steps were approximately double the dB they
  were labelled as, so "-2 dB" would result in a change
  of about -4 dB from maximum (0, +6.2dBV)
- maximum volume defining the line out volume only
  changed every 10 values, and then was not close
  to correct- "-10 dB" resulted in -2.5 dB from maximum

This gets the volume dB approximately correct, and
maximum volume correctly sets the line out volume.
I was unable to get odd values in the max volume
to work, so set the step size to 2 instead of one.

For "consumer level" (-10dBV), set to -16.
For "Pro level" (+4dBu -> ~1.8dBV), set to -4.

Change-Id: I898b85d768153579a893b23551019af88f865d21
2021-04-17 12:09:19 +00:00
Solomon Peachy 42dba708e3 hosted: Don't open alsa control device directly
It was just being used as a proxy "yeah, we called hw_init()" so
just use a flag for that directly.

affects rocker, erosq, xduoo x3ii/x20, and fiiom3klinux

Change-Id: I14bd9f8d91f1d6cc8de0982a7426e2a103c6bfce
2021-04-14 01:39:57 +00:00
Solomon Peachy ec4b5c794e ibasso: Found a reliable way to determine if SD card is present at startup
Change-Id: If02788a50e141cc2e5b1a6cde2df2a5ef5713e30
2021-04-13 14:28:30 +00:00
Solomon Peachy c0a49d9bdf ibasso: Default to assuming the external SD card is inserted
Detection at startup is proving to be unreliable.  Even if card is not
present at startup, upon insertion it will sort itself out properly.

Change-Id: I9ee90b724c90c530a39264f698c200a48aa72b1d
2021-04-12 21:54:59 +00:00
Solomon Peachy b6fce99046 ibasso: Implement proper PIVOT_ROOT filesystem access
Including direct use of the external SD card mount

Known issue:  If SD card is inserted at startup, it must be
              ejected and reinserted to be registered.

Change-Id: I5f420160bda32135cbb088c1e8b04b6e3a73018e
2021-04-12 18:19:06 +00:00
Solomon Peachy bc416ff590 misc: Only include rbpaths.h and string-extra.h in places that need it
(Don't include rbpaths.h in settings.h, or string-extra.h in rbpaths.h)

Build-tested on rocker, erosq, mini2g, nano2g,
                xduoox3, clipzip, dx50, and uisim

Change-Id: If32e9c9910f5c8247a655cb64522b84d6d7ccbb5
2021-04-10 12:08:12 -04:00
Solomon Peachy 1303be3437 ibasso: Get rid of #include "settings.h" in the button code
(It mucks with paths causing the input device open to fail)

Change-Id: I1e8a63d09c229ed9bacbd599a7869e875df21fd2
2021-04-10 10:25:20 -04:00
James Buren 448f98d9c0 pp: fix adc mistake where base 10 was used instead of base 16
Change-Id: I8562af8a11a22cd9edec149b2519ac0205d2b2dc
2021-04-10 01:13:09 +00:00
Solomon Peachy 13dbcab6c0 erosq: When mucking with the clickwheel, ensure we keep the screen awake!
Change-Id: I49d39f301f4b44c2477a657e2af964b97d73cf6b
2021-04-09 19:21:02 -04:00
Solomon Peachy cd64aa2b10 xduoox3: Global volume_limit now applies to the line output as well
The X3's line out is a bit hot, at ~4.3Vpp, so allow it to be backed off.

(On my X3, backing it off to -6dB brings Vpp down to ~3.4V)

Change-Id: Iea38ef1c6a1b183d0f8fb4eaf2bf9ed6b350a532
2021-04-09 15:54:04 -04:00
Aidan MacDonald c0a823e2ab x1000: Trim unused cache functions from the SPL build
Change-Id: Ib645d8ff10cfc672de8ac2debaa17d7dd50dfafb
2021-04-09 10:53:36 +00:00
Aidan MacDonald 54b8e9131c Revert "sound: add sound_numdecimals() to round out the sound setting query API"
There is already a sound_numdecimals() function, according to Git
it's been around since 2005. No need to add another one :).

This reverts commit 92a0ab8789.

Change-Id: I533ebf1763dd7a27346842982493d4550f05ad7c
2021-04-09 10:52:02 +00:00
Solomon Peachy 1e2a9a651c erosq: Switch to 32-bit PCM output, and do volume scaling in driver
Should improve audio output quality, especially at lower volumes.

Change-Id: I31c38f05fe4b554b092511f0fe7aaad9f346f6c5
2021-04-08 23:58:49 -04:00
Solomon Peachy e86d90905b alsa: Fix an #ifdef typo in 54fcb907c1
HAE_ALSA_32BIT -> HAVE_ALSA_32BIT

Change-Id: Icf375d42f6b20e8393b6ffe6d23b3ac96abb571b
2021-04-08 23:10:41 -04:00
Solomon Peachy 54fcb907c1 alsa: instead of per-target tests, use HAVE_ALSA_32BIT
Affects all Sony NWZ (linux) and the fiio m3k linux targets.

Change-Id: I2fcf121bd026103d2b72332a5a52cc2b5e93949f
2021-04-08 23:02:15 -04:00
Solomon Peachy e17337c9aa ErosQ: fix panic on startup caused by ad55da5f
It turns out #include "settings.h" pulls in rbpaths.h which ends up
remapping open() to the path-mangling rockbox open().

By defining RB_FILESYSTEM_OS we prevent the remap.  My mistake for not
testing this before committing!

Change-Id: I2978eb7b413693c4cb887b7ac7b2457780db7d25
2021-04-08 21:58:08 -04:00
Dana Conrad ad55da5f87 ErosQ: Set Line Level Output volume
With a full-scale 440Hz tone, the line out voltage
measured approx. 5.8Vpp at the 0 setting. WAY too hot!
(9 dBV, in fact)

For 0.894Vpp (-10 dBV - consumer devices), -18 appears to be
about right for line level signals, but for "pro" equipment
a different level may be desired.

Therefore, the user to cap the line out level by re-using the global
volume limit setting.

Change-Id: I0d1d6482ea95537e9a2d00884eaee2713771c614
2021-04-08 14:37:14 -04:00
Aidan MacDonald 4b26372591 MIPS: make sure to fill 'jr' branch delay slot with 'nop'
Inline assembly in RoLO and the FiiO M3K bootloader used 'jr' to
jump to a newly loaded Rockbox binary, but incorrectly left the
branch delay slot open. That gives GCC an opening to place illegal
instrutions, etc, which might cause an unhandled exception.

Change-Id: Ia7a561fe530e94a41189d25f18a767c448177960
2021-04-07 19:59:57 +01:00
Solomon Peachy 213d372c92 FS#13272: Fix up volume_limit to respect decimilaztion.
Change-Id: Ib0e5ddcd660115f156ddb545e45bbe7da42f9709
2021-04-07 14:38:54 -04:00
amachronic 28c89386af x1000: Improve NAND driver API
- Proper error codes are now returned from all functions. These codes will
  be used by a host-side flash tool for error reporting.

- nand_erase_block() was replaced by nand_erase_bytes(). The caller can't
  know how big an eraseblock is with the current API, so next best thing
  is to verify the correct alignment inside the call and reject the erase
  if it isn't properly aligned.

- Fixed typo in nandcmd_block_erase() which would cause an SFC error to be
  interpreted as success. Yikes.

Change-Id: Id4ac9b44fa7fc2fcb81ff19ba730df78457c0383
2021-04-06 17:27:12 +01:00
amachronic b5558c1cf9 x1000: place SPL's NAND bounce buffers in DRAM
This frees up 2 KiB in the SPL's memory map, leaving more room for code.

Change-Id: I01bbe2ab2905b2773a8b76d8c53e9f3d55bd040f
2021-04-06 17:27:09 +01:00
amachronic 1b314502c8 Remove a duplicate const
Change-Id: I0e6f4d609eb03155de4cd16aa98cab25f54a6681
2021-04-06 17:27:08 +01:00
Solomon Peachy 74ae18cc8a fiiom3k_linux: Enable HAVE_TOUCHPAD and add in missing bits
Change-Id: I78fa5fdb3648adfaa40f6d5f3c255666a85e2761
2021-04-05 13:57:01 +00:00
James Buren 962d412917 hdd1630/hdd6330: update battery capacities
Ensure the default setting reflects what the service manual says the
official battery capacity is. Change the ranges to reflect what
replacement batteries are actually available.

This range is actually much shorter in reality due to these units
requiring the rarer 3 pin battery type that uses a thermistor. As such
there's only one real replacement battery for each.

So the HDD1630 caps out around 700 mah while the HDD6330 caps out around
680 mah.

Change-Id: I2dbbba83ad2cd6e1d84e3481c4af84a06c45e16b
2021-04-04 13:27:00 +00:00
Solomon Peachy afec380a0d gigabeats: Fix hang on startup caused by a stack overflow
headphone ADC thread stack was slightly too small.  Bump it up a bit.

(it was _perfectly_ sized for the prior older toolchain+optimization flags...)

Change-Id: I2ca67c2b85c54f879892a31e281d7696f893389c
2021-04-01 20:24:59 -04:00
Solomon Peachy 2f785c7797 PP: More cache invalidation fixes
Take into account the size of the pointer in the loop termination
condition.

Change-Id: Ib4f7625ef143149a0d691a2109bad67aece6241c
2021-04-01 10:57:29 -04:00
Solomon Peachy 9f7f1a841a PP: Use CURRENT_CORE instead of IF_COP_CORE(CPU)
Use of IF_COP_CORE was mistakenly introduced as part of 89acde6af2,
effectively short-circuiting multiple tests resulting in the code
paths always being executed, on both cores.

Use the correct macro, so per-CPU paths are handled properly.

Change-Id: Id346cf759fc1b06b7d56694d7af1f469caf785a4
2021-04-01 08:45:43 -04:00
Solomon Peachy 0b20038d87 FiiO M3K: Hopefully fix the sim build
Change-Id: If5a58a4b3913645068cee95d4553f285eb55d182
2021-04-01 10:54:36 +00:00
William Wilgus 89acde6af2 H10 PP Crash -- Fixed
This appears to finally fix the issue
turns out the status register we were writing was only for the CPU
COP cache flush wiped out the CPU cache
--

Added some defines to cut down on the magic numbers
Added some comments explaining such

Set the address to full 20 bit address
0x1FFFFF which is then left shifted 11 internally --  somewhere around 4GB?

Link explains the cache status bits
https://daniel.haxx.se/sansa/memory_controller.txt

Change-Id: I57b7187c2f71a5b54ce145bf3a21ed492a8993cb
2021-04-01 00:52:57 -04:00
Solomon Peachy 058a9ec945 Add M3K native to the simulator
Change-Id: If3e877d2df189e44076631fd571cf6aa70ce6ca8
2021-03-28 12:08:31 -04:00
Aidan MacDonald 3ec66893e3 New port: FiiO M3K on bare metal
Change-Id: I7517e7d5459e129dcfc9465c6fbd708619888fbe
2021-03-28 00:01:37 +00:00
Solomon Peachy 83fcbedc65 rk27xx: Take advantage of STORAGE_NEEDS_BOUNCE_BUFFER
(And get rid of its custom realignment code)

Change-Id: Iff27d717b870d3db239310421776744ea6863373
2021-03-27 17:18:21 -04:00
Solomon Peachy 961ffa61dd Use STORAGE_NEEDS_BOUNCE_BUFFER instead of STORAGE_NEEDS_ALIGN
Enable its use in the jz47xx MIPS targets.

(accidently committed g#3249 before making these changes)

Change-Id: I1791946f632901f0c7a94b04b009671aa0d71717
2021-03-27 15:02:18 -04:00
Solomon Peachy c96dc1c886 xduoox3ii: Wrap the remote key detection in USE_REMOTE
Makes it straightforward to disable for debugging or defective hardware

Change-Id: Ie72786f6e9eabf396a05ef8a02e422c34c97691a
2021-03-27 14:43:17 -04:00
Aidan MacDonald ea1aef9b82 Have FAT filesystem respect storage buffer alignment on reads
This is just a minor cleanup of Solomon Peachy's code, and using
per-filesystem buffers instead of a single static buffer.

Tested and working on the FiiO M3K.

Change-Id: I3c19e8cc24e2f8aa07668c9d1c6d63364815050a
2021-03-27 14:43:17 -04:00
James Buren 018372bf39 usb: implement macro for initializing USB strings
This uses the new unicode string literal feature that is available
now to greatly simplify the initialization of these special string
types. This makes them much more readable at a quick glance.

Change-Id: Iad8b49aa763486608e3bb7e83fb8abfb48ce0a7b
2021-03-25 13:26:03 -05:00
Solomon Peachy 7652e6f8df rk27xx: Get rid of duplicate STORAGE_WANTS_ALIGN
Change-Id: I278d42858cc33da3710c8ca8f42d14c6d57509ca
2021-03-25 12:23:06 -04:00
Solomon Peachy d5cc74ebd8 build: Get rid of suplerflous '-Os' references in linker calls
We should be using global optimization flags, and -Os is already our
default.

Change-Id: Iaba511b2b4fa2ee0f1eb1ad28024be954f4c5f03
2021-03-25 12:20:15 -04:00
William Wilgus 3d9d2de34d Revert "lcd framebuffer - Bugfix #2 ensure proper alignment"
This reverts commit 3a5c5edbf6.

Reason for revert:pulling in system.h breaks SDL

:(

Change-Id: Ied5e08de4770aa0da87c14b304480448db349423
2021-03-25 06:34:58 +00:00
William Wilgus 3a5c5edbf6 lcd framebuffer - Bugfix #2 ensure proper alignment
-- apparenty 0x4 aligned doesn't work properly

requires 0x8 alignment at least for the h10 20gb
but enabled for all processors that define MEM_ALIGN_ATTR

Change-Id: I11edaab183b91a6d158f1f439f173b9b699dc914
2021-03-25 00:32:26 -04:00
William Wilgus ed99b305a9 Revert "lcd framebuffer - Bugfix ensure proper alignment"
This reverts commit ffee661ab7.

Reason for revert: <INSERT REASONING HERE>
iAudio M5  `IRAM' overflowed by 48 bytes

Change-Id: Id808a72c6eacabc562d53eac8acd36b45f678a97
2021-03-24 18:44:35 +00:00
William Wilgus ffee661ab7 lcd framebuffer - Bugfix ensure proper alignment
-- apparenty 0x4 aligned doesn't work properly

requires 0x8 alignment at least for the h10 20gb
but enabled for all arm processors

assign the default framebuffer to the default_vp as well

Change-Id: I0b76c30f2ddb5d6d2f7c6a132e4081aee58da17b
2021-03-24 18:22:01 +00:00
Aidan MacDonald 94b40ed314 Add asynchronous I2C bus API
The driver core is based off of the i.MX233 I2C implementation and
should work on any platform.

Change-Id: I3b9c15e12a689ef02a51c285be08d29d35e323dc
2021-03-23 15:42:54 +00:00
Aidan MacDonald 4d83f7a192 Call powermgmt_init_target() before polling the battery
In the old position of the call, the first battery reading would
be made before initializing the target's power management code.

If the target needs to initialize before giving a battery reading,
then the first reading would be wrong and the power thread might
inappropriately shut down based on a false zero reading.

The new position avoids forcing special-case logic onto the target
power management code.

Change-Id: I483cfabe30c6881d80a1094fd526fa0065523d19
2021-03-23 03:03:57 +00:00
Aidan MacDonald 55805e13a4 Add new audiohw capability: POWER_MODE_CAP
This allows the user to make use of the DAC's power-saving abilities.
The two modes are "high performance" and "battery saver". This feature
is supported by the AK4376 DAC in the upcoming FiiO M3K port.

The setting is only a manual toggle right now, but in the future it
could be hooked up to the battery level (via another setting) so it
can be toggled automatically when the battery gets too low.

Change-Id: I482af6e2f969fcbdeb3411bd3ff91f866b12d027
2021-03-22 13:00:11 +00:00
Solomon Peachy 10b873c407 xduoox3: In ROLO, allow the ADC to be shut down.
The hang we were seeing was due to IRAM wonkiness. that's fixed.

Change-Id: Ie33a1110639fe51ad540e4e172e41f22f3bf875b
2021-03-17 18:09:40 -04:00
Solomon Peachy efe493de3d FS13274: Bump max battery capacity for iPod Videos to 3000mAh
3rd party batteries can go this high for users that have performed SSD mods.

Change-Id: Icb34ce08e5ea345bc0fdb555bd3fd8ea9cf9e0d9
2021-03-15 12:17:30 +00:00
Solomon Peachy 92a0ab8789 sound: add sound_numdecimals() to round out the sound setting query API
A necessary prerequisite for fixing FS#13272

Change-Id: Ice288af39a4f08bea376f920d855932bdac69a52
2021-03-14 12:33:49 -04:00
Solomon Peachy 2743bde09b ATA: Increase delay to power-off when device doesn't support ATA SLEEP
The storage subsystem aggressively issues SLEEPNOW events when idle
and power off happened a fixed 2s later.  This turns out to not be
enough time for FC1307A (eg iFlash) adapters to flush outstanding writes.

So, when we detect a lack of PM support, increase the poweroff delay to
5 seconds to compensate for not being able to issue the ATA SLEEP command.

Hopefully this is enough time.  If not, we will have to re-disable PM
entirely when we detect these popular adapters.  Thankfully that is now
just an #ifdef away.

Change-Id: I4112b9acb965973d81f70483bd9d595461c7301c
2021-03-12 10:04:52 -05:00
Caleb Connolly 04c29984ce
ipod6g: increase max battery capacity
It's possible to get up to 3000mAh batteries for this device, although
it requires that you use an iFlash adapter to make enough space.

Signed-off-by: Caleb Connolly <caleb@connolly.tech>
Change-Id: I0d0d02aa30caffcae4a7e8c805516a1266eef359
2021-03-12 14:39:03 +00:00
Solomon Peachy bd507fc7b4 ATA: When device doesn't support powermgmt, only gate ata sleep command.
The FC1307A ATA->SD chipset (used by the common iFlash adapters)
doesn't support mandatory ATA power management commands, leading to
massive data corruption if they were issued.

A workaround was identified (54629073ae) that basically disabled all of
rockbox's power management code for these adapters, which extends well
beyond the specific ATA commands issued.

This patch moves the gating test to the issuance of the actual SLEEP,
so that the rest of rockbox's PM code can function as intended.  This
allows the device to get powered down when idle, yielding potentially
significant improvements in battery life.

Change-Id: Ia13e2405243fe5efe6f68c3a549ab4933567790b
2021-03-11 19:28:52 +00:00
Solomon Peachy 87e37a4d48 xduoo_x3ii: Improvements in the meymappings!
* PREV/NEXT now swapped so they do what is expected in most contexts
 * List and setting context retains prior behavior
 * Enable the ADC that reads the headset remote and map the keys.
 * As ADC-based remote "events" arrive as press/release pairs,
   delay the button release.

Change-Id: I22d4eac3bfe1573b50eca795cf377bdafdeb5336
2021-03-10 21:35:44 -05:00
Solomon Peachy 7201c3a685 fiiom3klinux: Fix a build warning.
Change-Id: I1355c87d17376422d54b259db2078ea5f886bedb
2021-03-10 19:01:12 -05:00
Solomon Peachy 555299af9f hosted: Consolidate the code that polls the battery charging status
affects all hiby targets, fiiom3k, and ibasso dx50/dx90

As well as deduplicating a small pile of code, this also implements
hysteresis so we're not doing a sysfs read/lookup multiple times
back-to-back every time the power management tick fires.

Change-Id: I2f7672acbb36341becf67e07960c24c681270d09
2021-03-10 18:29:29 -05:00
James Buren 0ba174789b usb_hid: switch Battery Strength to use feature reports
This means we will no longer send them routinely and instead rely on
the HID driver to send them when the host requests it. This also
moves the reporting out of the power management code where it probably
did not belong in the first place.

Change-Id: I9c8420e81897f1f6caaa55ffacc7525589f1ef75
2021-03-10 04:09:46 -06:00
Aidan MacDonald 777f63d529 Move MIPS cache management functions to IRAM
Previously these were placed in DRAM, which is overwritten by RoLo
when it loads a new image, but RoLo must call commit_discard_idcache()
after loading the image.

Change-Id: I5dcc4ca711b774166f83c668695edbcabfab2604
2021-03-09 20:04:30 +00:00
James Buren f647cde3c7 usb_hid: add support for Battery Strength
This allows rockbox to report its battery status through the
HID Battery Strength method that is available through the
Device Controls usage page.

Change-Id: Ia7a7dd9b9d476dd9df5a5f5becabc5ae823e9a89
2021-03-06 04:15:02 +00:00
Solomon Peachy 56a1e87501 ata: Make ata_disk_is_active() only special-case powermgmt-less devices.
SSDs that respect powermgmt commands should be treated the same, as the
powermgmt commands are an important part of ensuring it's safe to shut
down.

And greatly expand the comment explaining things.

Change-Id: Ia52b99fca802f495422b5ee097390a72dbc28f61
2021-03-04 17:37:51 -05:00
Christian Soffke be99033cbb Always indicate inactive ata disk if device is solid state or doesn't support power management
Commit 5462907 made sure that SLEEP commands weren't issued on devices that don't support ATA power management commands (e.g. certain CF->SD converters including several iFlash models).

Since Rockbox waits for the disk to become inactive in shutdown_hw(), which won't happen in this case, the OS would previously stall during the shutdown process until a timeout was reached.

Change-Id: I03bb05f6f6401bb8f0da5d0b76bd3f07681fdc06
2021-03-04 16:50:50 -05:00
Aidan MacDonald fb99d890a8 Fix typo in MIPS cache discard
Change-Id: I6a06e5f3098324d985bd59322755cd68122ec0bf
2021-03-04 19:39:28 +00:00
Solomon Peachy cbace906c6 mips: Revert to commiting the cache when we're told to discard an unaligned block.
The filesystem API often passes in unaligned receive buffers, and some
code (eg BMP reader) processes data in-place, leading to data loss when
we dropped the cache.

(And document exactly what we're doing, so we don't go through this again
 at $future_date)

Change-Id: If47a7f2148a5a1a43777f0bd3be1bdfe8239e91e
2021-03-04 12:00:15 -05:00
Solomon Peachy bcee955169 rolo: use audio_hard_stop() instead of audio_stop()
This kills the audio thread entirely, including voice stuff.

Change-Id: Id6fd58a97d5a57285016351bbfd3e843b2f339f2
2021-03-04 09:49:38 -05:00
William Wilgus a4a5f5f33f Check core max allocations for valid handle
fix rolo warnings

Change-Id: Ia2c669a5517aec54e5b2c0dc5934c88a4f49f2a9
2021-03-04 14:25:58 +00:00
Solomon Peachy 2628155fc9 Clean up places that use #if defined(CPU_ARM | CPU_COLDFIRE | CPU_MIPS)
Since that encompasses _all_ of our native targets in a post-archos world,
either replace it with #if (CONFIG_PLATFORM & PLATFORM_NATIVE) or
delete it altogher as appropriate.

Change-Id: I9128a456e850d5c96a9e05806aad3acd923f90c5
2021-03-04 14:14:33 +00:00
William Wilgus 15b4d22913 ROLO check for OOM
Splqash failure and return on OOM

Change-Id: I97b8783ba42545e30a5639e8a751d1e6834aebc8
2021-03-04 08:58:34 -05:00
Aidan MacDonald de53965e3f Third try fixing MIPS cache code
Changing this to be a pure discard operation after discussion on IRC

Change-Id: I62955ae7975fdbbfd9eef376476042a36fe3d95a
2021-03-04 02:47:13 +00:00
Solomon Peachy b82298ae2c jz4740: Fix incorrect dcache flush in the USB RX DMA code.
Change-Id: I01eff581b16569bda97c55afc7adac897b29e0e3
2021-03-03 21:44:28 -05:00
Aidan MacDonald 8cb4c18310 Really fix the MIPS cache bug this time
In fixing the original bug I tried to optimize discard_dcache_range()
to minimize writeback and inadvertently introduced a second bug, which
typically ends in a TLB refill panic.

It occurs only if the range fits within one cache line, and when both
the start and end of the range are not aligned to a cache line. This
causes ptr to be incremented and end to be decremented, so ptr > end,
and the loop can't terminate.

Change-Id: Ibaac072f1369268d3327d534ad08ef9dcee3db65
2021-03-03 23:57:08 +00:00
Solomon Peachy 0f439bee99 ihifi: use STORAGE_WANTS_ALIGN rather than STORAGE_NEEDS_ALIGN
Change-Id: I39284194d19785e92ca641c85b03d31849b85ec9
2021-03-03 17:05:31 -05:00
Aidan MacDonald 74a3d1f5be Fix MIPS cache operations and enable HAVE_CPU_CACHE_ALIGN on MIPS
- The range-based cache operations on MIPS were broken and only worked
  properly when BOTH the address and size were multiples of the cache
  line size. If this was not the case, the last cache line of the range
  would not be touched!

  Fix is to align start/end pointers to cache lines before iterating.

- To my knowledge all MIPS processors have a cache, so I enabled
  HAVE_CPU_CACHE_ALIGN by default. This also allows mmu-mips.c to use
  the CACHEALIGN_UP/DOWN macros.

- Make jz4760/system-target.h define its cache line size properly.

Change-Id: I1fcd04a59791daa233b9699f04d5ac1cc6bacee7
2021-03-03 20:50:28 +00:00
Aidan MacDonald aacb0811d9 Rename symbols of FiiO M3K Linux-based port
Mainly a straight replacement of FIIO_M3K -> FIIO_M3K_LINUX.

Change-Id: Id07c84f8150991d1b6851540c2c3f8f67e3f12c2
2021-02-27 23:53:28 +00:00
Christian Soffke 7d7850368e Disable UDMA 2 on iPod4G target
ATA DMA was enabled for all PP502x targets in d118f47 after previously reported instabilities were thought to have been fixed. The iPod 4G target remains unstable when UDMA 2 is enabled. File system corruption will eventually occur even using stock hardware in normal usage, according to both my own experience and that of several other forum users. UDMA 1 appears to be stable.

Change-Id: I8526bad9e879f5dad5174cfe07cd8828d8b72406
2021-02-27 14:38:49 +00:00
Solomon Peachy b5e6c30a61 USB: Reset poweroff timer for all USB events
Without this, if a device is left plugged in and idle, unplugging it will
trigger an immediate shutdown.

Change-Id: I65caaa0c1473562ec5d0bb776b01d4d222d69965
2020-12-24 00:40:01 -05:00
Solomon Peachy 02119357dc erosq: Enable HAVE_SCROLLWHEEL for saner scroll wheel handling
Basically no longer treat SCROLL_FWD/BACK as "button" events, instead
relying on the scrollwheel hooks to handle things properly.

Change-Id: I9bf18595ab3ca68e912f6dfb1f2eac2544578e73
2020-12-16 14:54:11 -05:00
Franklin Wei 792f05f82a lcd: Wrap anonymous union initializer in braces
GCC 4.9.4 is apparently smart enough to compile this, but 4.4.4 is not.

Change-Id: I186f969cbad4c701936ab738f585efea07421d2e
2020-12-08 14:12:12 -05:00
Solomon Peachy a5961c944b FS#5320: Keypad hold doesn't let go until scrolling is used (ipod 4g/5g)
Patch by Boris Gjenero

Change-Id: I7df956fb63478bbbe891104faf5ab35096da7576
2020-11-29 08:51:37 -05:00
James Buren 6b3b4df6f6 rockbox: move firmware checksum algorithms into a common header
Before this was just implemented inline wherever it was needed. Now
it is provided as 2 inline functions in a header called checksum.h.
There should be no differences in actual behavior.

Change-Id: I5d756cc01dc6225f5cc8b6af90911a3fc7b57cd5
2020-11-22 05:12:04 +00:00
Solomon Peachy 3027cead01 hosted: Improve buffer underrun handling in the ALSA driver
* Bump internal mix buffer size by 4x, to 1K frames (matching ALSA period)
 * Handle an underrun that occurs when filling the audio buffer
 * Log underruns and make them available in the debug info

Change-Id: I28d56dd35d88851fa167ad92368a5882937a758f
2020-11-18 14:38:12 -05:00
Solomon Peachy 7c87467ba4 configure: Add prompt for USB Serial into the advanced mode
And explicitly disable USB_ENABLE_SERIAL when HAVE_USBSTACK is not define

Change-Id: Ieb4176b02a60eb1b9db81f0b8c69403898a76ca1
2020-11-18 08:50:05 -05:00
Solomon Peachy 0400a391d3 usb: increase the stack size.
It's not large enough on some targets.

(this will be revisited when the USB insertion prompt stuff is moved
 out of the USB helper and over to the main thread)

Change-Id: Iefed2cdf2fbb4ce92569fc5cacbdb479b7d24e61
2020-11-17 06:58:46 -05:00
Solomon Peachy 9c68c69cf0 FS13257: Fix inconsistent defaults in the USB mode selection
Change-Id: I44894d13f070313ad326ce68018556573e35aad9
2020-11-16 17:11:38 +00:00
James Buren c79ddb6bf4 iriver_flash: update valid bootloaders table
This removes all the pre-release bootloader of version 7 and
replaces them with production releases of version 8. The
pre-releases have their own problems and should be left
behind as they were never officially released.

Change-Id: If96531ba63cf4401d04133bda94735fe94ae4de1
2020-11-16 11:57:18 +00:00
Moshe Piekarski 3ef8455626
Remove some SWCODEC artifacts
Change-Id: I580522bc0ec3bc86c24400625d7d9cde2eea8fc8
2020-11-14 19:20:33 -05:00
James Buren d5a2aeb6c4 rockbox: revise charger_inserted and power_input_present functions
This makes it so the thread cached variable is only read if building
the regular firmware. For bootloaders the data is now read directly.

This fixes the functions for bootloaders so they do not have to import
the power management code just so these functions will work when in
the bootloader.

Change-Id: Ic425b02c08b48df7a11a6c19c022b0e1cb316a85
2020-11-14 11:57:32 +00:00
Solomon Peachy 03cd773051 ibasso: Hopefully hack usb into building again.
Change-Id: I6f369d60319704ab4d2c18b80ba6e78902630790
2020-11-13 20:04:04 -05:00
Solomon Peachy 610ad6f6e3 ibasso: Fix red introduced in 60f581e
Change-Id: I9095e9e9213dde252de836851b743001b9483a1b
2020-11-13 18:17:00 -05:00
Solomon Peachy 60f581e8f5 usb: Add ability to prompt user about what to do upon usb insertion
v3: Add in config option
 v4: Bugfixes
 v5: Force a redraw upon exiting
 v6: keypress-in-chargeonly mode enables mass storage (and vice versa)
 v7: Fix bootloader builds
 v8: Update manual, and have bootloader respect keypresses
 v9: Change default to mass storage (ie no change in behavior)

 todo:
  * test-build dx50/dx90
  * Switch from yes/no to proper menu?
  * prevent WPS progress bar from drawing over us

Change-Id: I82e0ccb08497b7a5aa756ce77f1332ee963703a7

...

Change-Id: I7946cf240b18a4fa8ace5e25e1eb6e97b8b12d7c
2020-11-13 16:44:01 -05:00
William Wilgus f65fb2a64a h300, Others Bugfix Bootloader backlight_init()
backlight_init needs to be called after lcd_init when using
lcd_enable()

Change-Id: Id034835c903801fea49e2b972c110c1ec5106976
2020-11-13 18:08:01 +00:00
James Buren 8ac46f844f h300: fix one long-standing bootloader bug
This was introduced in e13c600133 back
when the author was trying to optimize the LCD code with DMA. For
whatever reason this broke the bootloader for the last 10 years or so
and no one could figure out why. This is now fixed.

However the bootloader is still currently broken in HEAD due to recent
changes to the LCD code. A fix for that is not yet known.

Change-Id: I046d53f9f391f558c391f2fadb6b260fe3be4d92
2020-11-13 18:08:01 +00:00
Solomon Peachy 388adff3cc pcm: Further cleanup of unused bits of the PCM ACPI:
* pcm_get_bytes_remaining()
 * pcm_calculate_peaks()
 * pcm_get_peak_buffer()

Nothing in-tree uses these at all (except for the lua plugin wrapper)

Change-Id: I971b7beed6760250c8b1ce58f401a601e1e2d585
2020-11-12 15:59:09 +00:00
William Wilgus 1a68856f52 Rocker Add WPS and Tree Hotkey, button codes in debug menu
VolUp+VolDown becomes the wps and tree (file browser) hotkey

Change-Id: I0cba96927420c318506bc0c15dabcb809cd81647
2020-11-12 01:22:32 -05:00
James Buren 4aa749b59d iriver_flash: refactor code to be easier to understand
This overhauls most of the code to be easier to understand in terms
of the interactions with the flash. I found the original to be rather
confusing with how it kept switching between byte and word offsets.

My solution was to make all external access to the flash in terms of
sectors and bytes. Whatever the flash uses internally is now handled
by the subroutines for performing the erase, program, and verify
operations.

This helps make it far more consistent for the code that actually uses
these operations as they do not need to concern themselves with word
sizes and offsets anymore.

As a side effect of this change the flash operations are now done
entirely by subroutines; even the batch operations that used to use
custom loops.

Additionally some functions were merged with other functions in order
to reduce the amount of functions as well as consolidating common
code fragments.

Change-Id: I4698e920a226a3bbe8070004a14e5848abdd70ec
2020-11-11 13:30:09 +00:00
Moshe Piekarski c4254d10fc Fuze+: Fix misplaced rectangle when lcd_flip set
Change-Id: Ic5197d8dffd66cfefdb42242869b48b33aa4d042
2020-11-08 03:19:04 +00:00
Torne Wuff 5db83c155a pp5020: use ipod firmware timings for ATA PIO.
Some mSATA adapters seem to have trouble working with Rockbox using our
normal PIO timings; the timing value we use is probably out of spec and
is different to the OF. Switch to using the OF's timings according to
which PIO mode we select. This may not completely resolve problems with
these adapters but allows Rockbox to boot and play audio.

Change-Id: If73210700eb4af01864b373709ee1d15c775fb11
2020-11-04 03:03:19 +00:00
Solomon Peachy 090bd9592d Remove the firmware decompressor and a few more other SH-stragglers.
Change-Id: Ic568755afcccc6db1b6e791b1ed0d2588b90356f
2020-11-03 23:43:32 +00:00
Solomon Peachy 066d471ae6 ATA: Check to see if the ATA device is solid-state (WIP)
Not all devices advertise this flag, unfortunately.

Change-Id: I6d666febdfcba7598e4d29df7d05c0a288e15158
2020-11-03 19:29:26 +00:00
Solomon Peachy 8029c89808 erosq: Fix scrollwheel regression introduced in 125e97b0
Change-Id: Ie1a53d7140ffb09d8e3a19a41617fdc51344a619
2020-11-03 13:23:39 +00:00
William Wilgus 611c18704c FuzePlus USB+screen dump overflows usbstack
Bump USB stack by 128 bytes

adds USB_EXTRA_STACK

Change-Id: I12839edbe889c878482081cf59fc6540384673ac
2020-11-02 21:38:13 -05:00
Solomon Peachy daefd5686f Rocker: Fix a boneheaded bug introduced in dd82f13fa1
Change-Id: Ia743cba6ccd50b38b052f26cce23ac9fe7aac31b
2020-10-31 20:26:37 +00:00
Solomon Peachy 125e97b0bf hosted: Consolidate common /dev/input code shared by the hiby targets
* Enable dynamic number of input devices, needed for bluetooth support

Change-Id: Ic2425834eb9b0fff298899ab45f3115ce1d95e91
2020-10-31 14:17:22 +00:00
Amaury Pouly dd82f13fa1 nwz/alsa: various improvements
Also audiohw driver to specific device name, rewrite alsa controls code to
cache more data, thus making the code easier and use less stack. Avoid using
short/long in pcm alsa code since it's the wrong size on 64-bit (simulator
for example)

Change-Id: Ibc1ec44396e37b6cbdedbcf37300878638e5d2d3
2020-10-31 14:16:31 +00:00
Solomon Peachy ce9e7e7122 hosted: fix warning when LOGF is enabled
Change-Id: I67b4cbf8899860411869399143424a0e55d0d4ca
2020-10-31 14:10:46 +00:00
William Wilgus 60f642ba4f lcd_framebuffer bugfixes, sanity checks
several issues I saw that could pontentially cause problems
scroll engine doesn't take text height into account when checking bounds

NBELEMS was one whole row too large hopefully I got them right this time

Change-Id: If303da8320429c3964fc675351cb088d46303745
2020-10-31 01:11:30 -04:00
Solomon Peachy 7eee526e6a fix red introduced in the android pcm driver (rev fe2d52c)
Change-Id: I2fa160fd39842a5434cf11573b50061786e610ca
2020-10-31 01:44:48 +00:00
Solomon Peachy fe2d52cc7d pcm: Get rid of pcm_play_pause() and associated APIs
Nothing in the core has used it for some time.  It's exported to the
plugin API but the last plugins to use it were switched to the mixer API
back in 2011.

This allows us to get rid of pcm_play_dma_pause() from all audio drivers

Change-Id: Ic3fa02592316f84963e41d792d1cabb436d1ff6b
2020-10-31 01:18:27 +00:00
Solomon Peachy a5a19a3370 dircache: Fix a NULL pointer dereference
if idx == 0, get_idx_dcvolp() will return NULL.

Change-Id: I4eafa71bb1f77ef8c865570bf8f124cdd9326d3e
2020-10-27 21:57:40 -04:00
Solomon Peachy 7dbfda6c55 iaudiom5: Fix build.
Basically we're overflowing IRAM by 48 bytes.  Shrink the stack
by 48 bytes to compensate.

Fixing this properly will require careful decisions about what
(code and/or data) to eject from IRAM.

Change-Id: Ia3054280bcbd9813b9cce83f16ba4fbd15085110
2020-10-27 14:49:19 -04:00
Solomon Peachy 61f698715d coldfire: We need -fno-delete-null-pointer-checks in flash controller code
Change-Id: I9a3e4ced2c3d41f6a31a968af72659a1a14f702e
2020-10-27 10:29:59 -04:00
William Wilgus 299c237075 'Fix RED e200 Framebuffer_viewport_rewrite
Free malloc in checkwps too

Change-Id: I2b8fcbc94beb0644b643d3b7a9cb53bc26fc8a51
2020-10-26 15:50:42 -04:00
William Wilgus ada919fc11 FIX RED framebuffer viewport rewrite
Change-Id: I4cb8f580e15440d06f8d5fabb2fbf5147c67b49c
2020-10-26 14:35:30 -04:00
William Wilgus 9b295ce135 FIX RED/YELLOW framebuffer viewport rewrite
Change-Id: Icfd3b00b646c593991f73550d8a316a80e5930a1
2020-10-26 14:02:49 -04:00
William Wilgus 40e98a2e49 Whitespace cleanup on fb_viewport Rewrite
Change-Id: I24aac41c8abecf7b78a44d7f59e842b791be4563
2020-10-26 12:38:22 -04:00
William Wilgus 3237ae4a4f LCD core move buf ptr and address look up function viewport struct
I'm currently running up against the limitations of the lcd_draw functions
I want these functions to be able to be used on any size buffer not
just buffers with a stride matching the underlying device

[DONE] allow the framebuffer to be decoupled from the device framebuffer
[DONE need examples] allow for some simple blit like transformations
[DONE] remove the device framebuffer from the plugin api
[DONE}ditto remote framebuffer
[DONE] remove _viewport_get_framebuffer you can call struct *vp = lcd_set_viewport(NULL) and vp->buffer->fb_ptr

while remote lcds may compile (and work in the sim) its not been tested on targets

[FIXED] backdrops need work to be screen agnostic

[FIXED] screen statusbar is not being combined into the main viewport correctly yet

[FIXED] screen elements are displayed incorrectly  after switch to void*

[FIXED] core didn't restore proper viewport on splash etc.

[NEEDS TESTING] remote lcd garbled data

[FIXED] osd lib garbled screen on bmp_part

[FIXED] grey_set_vp needs to return old viewport like lcd_set_viewport

[FIXED] Viewport update now handles viewports with differing buffers/strides by copying to the main buffer

[FIXED] splash on top of WPS leaves old framebuffer data (doesn't redraw)
[UPDATE] refined this a bit more to have clear_viewport set the clean bit and have skin_render do its own screen clear
scrolling viewports no longer trigger wps refresh
also fixed a bug where guisyncyesno was displaying and then disappearing

[ADDED!] New LCD macros that allow you to create properly size frame buffers in you desired size without wasting bytes
(LCD_ and LCD_REMOTE_)
LCD_STRIDE(w, h) same as STRIDE_MAIN
LCD_FBSTRIDE(w, h) returns target specific stride for a buffer W x H
LCD_NBELEMS(w, h) returns the number of fb_data sized elemenst needed for a buffer W x H
LCD_NATIVE_STRIDE(s) conversion between rockbox native vertical and lcd native stride (2bitH)
test_viewports.c has an example of usage

[FIXED!!] 2bit targets don't respect non-native strides
[FIXED] Few define snags

Change-Id: I0d04c3834e464eca84a5a715743a297a0cefd0af
2020-10-26 12:28:48 -04:00
Moshe Piekarski 12f3ed1699 make the plugin API frambuffer agnostic
Change-Id: I5abdc231093054c517ff53b9a456997e440e3f6e
2020-10-26 12:28:48 -04:00
Solomon Peachy 845e5a4f03 sonynwz: A10 and A20 series support high bitrates
Change-Id: I6b33368ed5d7800b79dafbb736e6ed079accbd25
2020-10-26 07:42:48 -04:00
James Buren c5d7cd5f9f h300: add support for ROM image generation
Change-Id: I6e0985de370609bae98ba6eab487bf43eb4191b6
2020-10-26 01:37:42 +00:00
Solomon Peachy 28b9c8bfeb rocker: Disable mute-on-pause, due to a platform kernel bug.
In short, the display fading back in after a pause resuming interferes
with the audio codec, causing BadThings(tm) that cannot be recovered from

This really is just avoiding a known trigger; there's no guarantee this
condition won't occur under random circumstances during normal use,
and there's no good way to work around this from within rockbox.

I suspect the underlying problem is that both the display control and
codec control share an i2c bus, but the kernel drivers implementing them
isn't using proper linux bus access/locking.

Change-Id: Id4f56f9cb269ed74aac2f041146b3630cef09030
2020-10-26 01:07:59 +00:00
James Buren bde72efa30 coldfire: make the RAM and ROM image locations configurable by macros
Change-Id: Ie27e39c34947b0391be621dafb8711c44e863a1c
2020-10-26 01:07:14 +00:00
James Buren 129001909d h300: enable support for iriver_flash
This also modifies the configuration file to include macros
defined in the H100 / H120 implementation.

Change-Id: Iae845889c98661ec548c04fc57e733dcc346c0f1
2020-10-26 01:07:14 +00:00
Solomon Peachy 39a0d8bf86 x3ii/x20/rocker: Fix volume scaling.
Change-Id: Ie70d709b4c18f16cdd67aa05d9183b4ace2e66b4
2020-10-26 00:12:54 +00:00
Solomon Peachy 49c4577fa6 Get rid of another vestigal SH remnant in the rom linker script
Change-Id: Id7509ad4affc4d72fbfdd11b39a404ad54c76f1b
2020-10-26 00:12:54 +00:00
Solomon Peachy d4a80ce94b pcm-alsa: fix red.
Change-Id: Id8d5442b0b3eb4ce3c20d1c9d24f07b5378cc22f
2020-10-25 08:38:24 -04:00
Solomon Peachy 4afd1f9aa6 hosted: Document HW capabilities of audio drivers
One surprise:  X3ii is capable of 384KHz playback

Change-Id: I0cc88637c81a21d54979e82b2941fe14de933d4d
2020-10-25 00:42:41 -04:00
Solomon Peachy e7a492ef55 hosted: alsa: Fix two bugs when recording
Change-Id: Ib97857874676ea4aa8f04d44e048de8465a4da4f
2020-10-25 00:42:37 -04:00
Solomon Peachy ec2a34b321 pcm_mixer: Fix an idle frame calculation bug introduced in 2e708c48c5
Resulted in playback sometimes hanging after switching tracks

Change-Id: I3d7a3c131cf547206ec536d9818c5060113f2b11
2020-10-24 02:00:50 +00:00
William Wilgus d78a37676e ClipPlus BOOTLOADER DONT FIT!
REMOVED FROM ALL NATIVE BOOTLOADERS:
finish removing the text scrolling
pare down printf to a minimal subset (%c %s %l %d %u and %x(%p))
remove diacritic and rtl language support

GOAL 134000

START 135305

CURRENT 133700

SUCCESS! (ASSUMING IT WORKS -- UNESTED)

Change-Id: Ic3f6ac1dc260578f581ee53458b3e5bb47d313ec
2020-10-23 20:38:59 -04:00
Solomon Peachy a8aa8403ad samsungyp: Enable recording feature. No idea if it works. :D
Change-Id: I48952f0551aaf1023f084e0be18354970d2492ed
2020-10-23 17:49:07 -04:00
Solomon Peachy 46e357f1bb ALSA: Further rework:
* Get rid of non-async (ie tick task) mode due to inherent brokenness
 * Get rid of nonblock mode; we never write if buffers aren't sufficient
 * Move driver init into pcm_open() instead of pcm_init()
 * Much better underrun handling
 * Better error handling in some situations
 * Add in recording functionality
 * Use smaller audio buffers to avoid glitching
 * Don't start audio buffer with silence
 * Allow device name to be overridden by target

Recording portions based on work done by Lorenzo Miori in g#633

Change-Id: I0197bdc1749c28109eb79def1e6a3e1d62d8cef3
2020-10-23 17:48:51 -04:00
William Wilgus 3a7a46d1c0 Hosted targets Fix timer cycle calculation overflow
at 1 GHZ the intermediate calculation for cycles overflows 32 bits
this makes timer fail even with sensible values
solution divide both sides by 100

Change-Id: I18a4054c2d06fb72531d5496bba562f71b03984f
2020-10-23 15:35:11 +00:00
Solomon Peachy 02c5dd3641 fiio: Another bugfix in the mute code.
Change-Id: I165f4871fa79fb5759d2f0833c543edd5f1ce779
2020-10-22 13:16:20 -04:00
Solomon Peachy 97b8692b65 fiio: add in a missing audiohw_mute() call.
Change-Id: I837dcb81b8814573fe947d6c7cfa10ff651689d0
2020-10-22 16:14:16 +00:00
Solomon Peachy 884d8922e3 hosted: Allow ALSA driver to switch output device at runtime
* Allow output device name to be specified
 * Set hw/swparams prior to actual playback start, not at init
 * If told to open a new device, cleanly close down old one.

Change-Id: Ib97310ec23588136c031466ee9c22312ab0f9f5a
2020-10-21 13:24:47 +00:00
Solomon Peachy 6b13437aff Add UI Simulator for Eros Q / K series
Change-Id: I9ffc101bd904b3f0e2d6a86a43fb1ae3fda73a19
2020-10-21 13:24:01 +00:00
Solomon Peachy 6834d1a02f xduoox20: Start unmuted, as the least-worst option
Change-Id: Ie85d9df0f861315dfc9d767218d86115420aa9d7
2020-10-20 17:07:48 -04:00
Amaury Pouly 08513103c6 nwzstools: add NW-A820 nvp nodes
Change-Id: Iab79eb0c9b0bbf8fb7622f5630f385d56878507a
2020-10-18 22:34:16 +02:00
Solomon Peachy 6a94f1e995 sonynwz: Properly support multidrive, with hotswap of the SD card
Change-Id: I7eb8efb0986a395d5ffbcc06a54bb680e0b59e9d
2020-10-18 10:19:42 -04:00
Solomon Peachy 5f75c493e3 xduoox20: Remove a duplicate config option
Change-Id: Ieeacc8b42d2a4d1c647cfa3b0d00f90fe98af0ed
2020-10-17 22:52:48 -04:00
Solomon Peachy edbdefa09a hosted: Drop a bootloader version string in /etc, and report it in debug menu
Change-Id: I4d72d7800dbff56619898b6bc9d0f81a6c561598
2020-10-17 21:40:40 -04:00
Solomon Peachy b1e21bbd7a hosted: Consolidate common config of hiby-based units into a common header
* Enabled MULTIDRIVE and ROOTFS_HOTPLUG for full hotswap!
   (Requires updated bootloader/integration!)

Change-Id: I7dad1f8d375e087c36fce37bec3e9184602ede50
2020-10-17 20:45:41 -04:00
Solomon Peachy 6f9a157fca hosted: Fix USB mounting code to work with HAVE_MULTIDRIVE enabled
Change-Id: I48944c28903db117d3d883a5e777cafe5d055600
2020-10-17 18:38:49 -04:00
Solomon Peachy f3ec58c05b hosted: Support hot-swappable internal and external storage
Change-Id: I321e9da4d5087dbd91194e6faa35cd4a685a0495
2020-10-17 18:38:49 -04:00
Solomon Peachy d8d37ffdb8 Define a USB storage type, and hook it up for hosted targets
Change-Id: I56363c989139c7edf0b2c67b0aac9ef1adfacba2
2020-10-17 18:38:49 -04:00
Solomon Peachy 0a4a920029 hosted: ROLO: Fixes for PIVOT_ROOT targets
Change-Id: I4888bd5db6f8a419d312c6b017f676ba6c749d89
2020-10-17 18:38:46 -04:00
Solomon Peachy 012908e064 hosted: Fix HAVE_MULTIDRIVE to work properly with PIVOT_ROOT
Change-Id: Ibc97de5c345e88c19ad8ba8c05fefebbada08790
2020-10-17 17:10:52 -04:00
Solomon Peachy a68fc3b6c2 xduoox3ii/erosq: Fix CPU frequency declared in header
(108 MHz -> 1008 MHz)

Change-Id: I2baf416689e2afb68948609e226df8c5feeecc4a
2020-10-17 17:10:52 -04:00
Solomon Peachy 13f5e123f9 samsung yp-r0/r1: use os-native opendir() in the low-level driver code
Fixes blank LCD on both R0/R1 and the PMU on the R1

Change-Id: I356907676f7a0a009897fd4895bf78c1022b71d1
2020-10-17 14:37:15 -04:00
Solomon Peachy 0e667ff5b0 sonynwz: use os-native opendir() in the low-level input driver code
instead of the rockbox opendir() wrapper.

Change-Id: I06e8c2d7997c7cc3d507f06659d46cdfd6a02ce3
2020-10-17 14:22:02 -04:00
Solomon Peachy ce40ef42ff hosted: Make sure we don't call mixer/etc controls when we're not ready
(Might fix the rocker crash-on-shutdown bug)

Change-Id: Id375fc5053adef18d7ec812bdba36ee002e706ef
2020-10-16 20:34:18 -04:00
Solomon Peachy c6d2a0358f hosted: open input device as read-only.
Change-Id: I4dcd98f45f41fe06a0a75a2a0dd45c753c2cf365
2020-10-16 14:37:01 -04:00
Solomon Peachy 2e07223690 m3k: Fixes for the M3K.
* Cannot turn off the LCD directly (have to rely on backlight)
 * Only insmod/rmmod the usb gadget modules if state changes

Change-Id: I9ea90177d496cd035ada93e04a93a7c6f2e84706
2020-10-15 14:11:41 -04:00
Solomon Peachy 82787709bd update the hibi patcher script to handle initial m3k stuff
Change-Id: I63ed8443952888da3dafb23ff6e7daf9c7aca574
2020-10-15 13:31:28 -04:00
Solomon Peachy 0cde20fadb xduoox3: Disable the DAC's digital de-emphasis filter.
Whether or not this is correct depends on how the source material was
mastered, digitized, and/or encoded.  There is no setting appropriate
for everything.

Eventually I'd like to make this configurable, but I'd want to have it
shared with more than one target first.

Change-Id: I20a0eff4b3dc2517c33db49d4f72e85bf81d1ca6
2020-10-15 13:30:48 -04:00
Solomon Peachy d544ce46a7 hosted: Unify the USB code for the hiby-based players.
* Specify exported USB VID/PID in target config header
 * Don't fail if the sd filesystem has already been remounted
   (ie due to platform hotplug)

Change-Id: Ifd2dae0c4f15086bf2bf89eb093018b3c4d2b75d
2020-10-15 10:18:16 -04:00
Solomon Peachy 4873a1ac61 fiiom3k: Temporarily disable filter rolloff programming
(Hardware control isn't wired into ALSA properly)

Change-Id: Iac537d2d90a6119b8c002cd38a558a4ebb3321eb
2020-10-15 07:43:14 -04:00
Solomon Peachy 1b449abf39 erosq: Add battery discharge curve and initial runtime estimation.
(playing mp3 with headphones inserted lasted just over 13 hours)

Change-Id: Id610f911811eafd914db20000ae860c75e0d8a93
2020-10-14 08:37:00 -04:00
Solomon Peachy 19d45c9257 Work around wonky inline asm issue with creativezenvm build.
The right thing here probably to just not bother at all, as this
bootloader can't launch rockbox yet anyway.

Change-Id: I62bd22353b6adc9dbe35b94f3b60a6a67348356a
2020-10-13 21:48:23 -04:00
Solomon Peachy 26bebd77ab Fix more red.
Change-Id: Id1a45b420f8eb70a25010b058822b78f80db33d8
2020-10-13 19:45:03 -04:00
Solomon Peachy 09785a8499 fix more yellow
Change-Id: I74bad58707d05ea167169d4315c05eb0cd1c8b7b
2020-10-13 17:23:56 -04:00
Solomon Peachy b94db707fb Fix more warnings.
Change-Id: Ib3a9fc622a46b1fc72e94dcbc6d29d2e430cd81b
2020-10-13 15:48:31 -04:00
Solomon Peachy 431caa4311 imx31: Work around an apparently not-quite-kosher abuse of CPP
(we were trying to foward-declare functions from within static
 initializer context.  GCC no longer accepts this)

Change-Id: I58f316ecc84c8ab45fffc054955727a55714b0a3
2020-10-13 15:48:31 -04:00
Solomon Peachy f8bd54d575 iaudiox5: Fix red, due to slightly bogus asm
Change-Id: I6ebcda3452d4244b5e2d1a9bbeb9fff9a9456388
2020-10-13 14:18:35 -04:00
Solomon Peachy 4a3d046545 Fix a pile of yellow in the bootloader
Change-Id: Ia89a33bbb13683566e421ac2a002baa20cdb07de
2020-10-13 13:37:21 -04:00
Solomon Peachy e91f89a410 xduoox3ii: Update battery curve.
Change-Id: I2cc04d696631ba887fa8943d94360f902bf12e85
2020-10-13 16:01:55 +00:00