summaryrefslogtreecommitdiffstats
path: root/firmware
AgeCommit message (Collapse)AuthorFilesLines
10 days[BugFix] chunk_alloc pass NULL to buflib_shrinkWilliam Wilgus1-1/+1
old_chunk has already been unpinned therefore the address could be incorrect NULL will ensure buflib_shrink uses the same start address Change-Id: I9371e4f8263c6e5bf769108a8558dc938d4c8b87
2023-02-16[BUGFIX] chunk_alloc pinned bufferWilliam Wilgus1-1/+3
if there weren't previous chunks new buffer was pinned without being unpinned Change-Id: Ia45bc0eb67673e8df5154447d9116fcd4c147f6b
2023-02-15font.c cleanupWilliam Wilgus2-30/+23
find_font_index can use font_filename_matches_loaded_id() font_path_to_glyph_path doesn't need strcat Change-Id: I8d1d36a68abbc700078d651eed930035641b6240
2023-02-15font.c return false if id is out of range instead of NULLWilliam Wilgus1-8/+8
forgot to change this to match the bool return Change-Id: I2cc6dc985b07f2bc0ae493b060aff6105f329097
2023-02-15[BugFix] font.c filename was movableWilliam Wilgus2-26/+22
stupid bug on my part font_filename was pointing to a movable alloc therefore that data could be moved out from under the returned pointer instead pin the internal calls to core_get_data and remove font_filename in favor of a function that checks if a filename matches the loaded font as this was all it was used for anyway Change-Id: Iebb47ffe3f81aa9d5e3968975f26d64283633ffc
2023-01-30font.c dynamic path nameWilliam Wilgus1-8/+25
only alloc enough space for the path instead of a fixed buffer round up the path buffer size to slightly more thna the longest common path length to reduce reallocations Change-Id: I51b8b17584d6a905ea3a66a7c38b7b1b9da2e786
2023-01-23usb: Fix iPod video connection issuesAidan MacDonald1-2/+7
Apparently a response is coming out of nowhere and tripping this check. I can't be bothered to look into it; it would be better to just update the ARC USB driver to the new control request API... Change-Id: Ic5062443e060534f170d3afe17c00d3c25d1d3bd
2023-01-22Add perceptual volume adjustmentAidan MacDonald1-0/+4
The perceived loudness change of a change in volume depends on the listening volume: at high volumes a 1 dB increment is noticeable, but at low volumes a larger increment is needed to get a comparable change in loudness. Perceptual volume adjustment accounts for this fact, and divides the hardware volume range into a number of steps. Each step changes the dB volume by a variable amount, with most of the steps concentrated at higher volumes. This makes it possible to sweep over the entire hardware volume range quickly, without losing the ability to finely adjust the volume at normal listening levels. Use "Volume Adjustment Mode" in the system settings menu to select perceptual volume mode. The number of steps used is controlled by "Number of Volume Steps". (Number of steps has no effect in direct adjustment mode.) It's still possible to set a specific dB volume level from the sound settings menu when perceptual volume is enabled, and perceptual volume does not affect the volume displayed by themes. Change-Id: I6f91fd3f7c5e2d323a914e47b5653033e92b4b3b
2023-01-22ErosQNative: Enable Line Out capabilities on new revision playersDana Conrad5-46/+47
The newer players have some changed hardware, but most importantly the line out now appears to be routed through the stereo switch instead of being hardwired directly off the DAC. Disable muting the headphone amp, enable switching the stereo switch, and rename some of the GPIOs to be more generic since the DAC, headphone amp, and stereo switch all appear to have changed. Change-Id: I220fe5e37bcbcd959b544183e1fcf70673a83c13
2023-01-19chunk alloc add buflib_get_pinned and chunk cachingWilliam Wilgus2-58/+80
Change-Id: Ia581656793b8ce9b80545705cfbba0fb225bb616
2023-01-18usb: Attempt to handle overlapped control requests in legacy driversAidan MacDonald1-5/+38
It seems connecting an iPod Video to a Mac triggers the null request check, resulting in a panic. Ignoring the error with a bare return "fixes" it and allows the iPod to connect. This isn't ideal though, because it could silently introduce bugs on other targets. The likely cause of this is the host sending control requests too fast, or a driver problem (the Video uses the ARC driver, which is still on the legacy interface), with multiple requests getting queued at once. Since the USB core expects to deal with only one request at a time, the second response trips the check. Try to handle this situation a bit more gracefully by detecting overlapped requests and returning a STALL to the host when it occurs. At this point the USB stack is able to safely handle a new request. Link: https://forums.rockbox.org/index.php/topic,54414.0.html Change-Id: I9a2b7e35620ff540ebdb39f81671377062a4917d
2023-01-16buflib_malloc: fixed signed/unsigned comparisonAidan MacDonald1-1/+1
Change-Id: Ie346759a0dda96debd8448fd44ca3e86d40ef348
2023-01-15Add core_get_data_pinned(), use it where possibleAidan MacDonald1-0/+12
Change-Id: I1b2f62f27780f99423085d2fffc972ea2701f998
2023-01-15buflib: Add pinned get/put data functionsAidan MacDonald5-35/+109
These are more efficient than separate pin/unpin calls because pin count increment and decrement can be done cheaply when the data pointer is known. Secondly, pinned access can be made safe against preemption by hardware interrupts or other CPU cores; buflib_get_data() can't. This makes it more useful under different threading models and for SMP targets; both of which are not particularly relevant to Rockbox now, but might be in the future. Change-Id: I09284251b83bbbc59ef88a494c8fda26a7f7ef26
2023-01-15buflib: Add malloc-backed buflibAidan MacDonald5-0/+309
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-15buflib: Move the API back into buflib.hAidan MacDonald2-323/+361
To minimize code duplication between buflib backends move the public part of the API to buflib.h. Also rewrote documentation for the whole API. Change-Id: I4d7ed6d02084d7130cb41511e63c25ec45b51703
2023-01-15buflib: Add CONFIG_BUFLIB_BACKEND for selecting a buflib backendAidan MacDonald8-4/+47
Defaults to the normal "mempool" backend, which is currently the only implementation. Change-Id: I56d034a6e0f5edc90c39526d1551945eec6ca336
2023-01-15buflib: Prep for multiple backend support, rename to buflib_mempoolAidan MacDonald6-8/+8
Rename the current buflib implementation to buflib_mempool. Change-Id: Iefdf74be1f7d8fcd19e6ce2289c3d1459b54d013
2023-01-14si4700: remove unneeded ';' directly after a 'case'Wolfram Sang1-1/+1
Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Change-Id: I3527308cc2495ef5c09b63a071a2c3bdc8ad0e5e
2023-01-13fix red from #641e91aa2fSolomon Peachy2-2/+3
Change-Id: I7e648a7bdf1d706258afd49c1edd63655b2d2830
2023-01-13jz47xx: Add support for INIT regionSolomon Peachy5-8/+41
Change-Id: I100cd661e9b1225167463542800c6aafbc3c17b3
2023-01-13buflib_shrink use NULL to signal start isn't changingWilliam Wilgus3-5/+3
Change-Id: Id3e86d3860b8ed860dc6dcbc394b1b8f9f3274b5
2023-01-13buflib: Refactor various debugging featuresAidan MacDonald6-43/+71
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-13buflib: Remove block start / end distinctionAidan MacDonald1-107/+42
Removing the variable-length name in the middle of buflib metadata makes it a lot easier to deal with. Change-Id: I6eaf236c2285cae40fb6ff0fa5acf827972cdd8b
2023-01-13buflib: Remove CRC checksAidan MacDonald2-96/+4
The CRC is a fairly useless safety check because we already have specific checks to validate the metadata, and CRCs are only verified before calling the move callback. Removing the check should not significantly reduce buflib's robustness. Change-Id: Ica99bd92fc514819b4fd9f359b4272e581020f75
2023-01-13buflib: Optimize away the BSIZE metadata fieldAidan MacDonald1-7/+4
Now that allocations are unnamed, BSIZE is a constant. Change-Id: Iab52cbebe426ea0d12f428582347e20ed243367f
2023-01-13Remove buflib allocation names, part twoAidan MacDonald14-64/+32
Remove allocation names from the buflib API and fix up all callers. Change-Id: I3df922e258d5f0d711d70e72b56b4ed634fb0f5a
2023-01-13Remove buflib allocation names, part oneAidan MacDonald1-35/+15
Remove the name handling code, but leave the allocation structure otherwise untouched; it's as if all callers provided a NULL name. The public API still accepts names but names are no longer stored or returned. Change-Id: I6c4defcdfd255774f02030949a0fd731477e6a54
2023-01-13Avoid using buflib names for storing font pathsAidan MacDonald1-5/+22
Naming your allocations is more of a debugging feature; it's a bad idea to abuse this feature for storing some random string. The font code does exactly that to remember the path used to load a font, and it's the only code that uses buflib names in this way. Store the path inside the font allocation instead as a regular char array. For simplicity it's MAX_PATH sized, so this'll use a bit more memory than the buflib name method, maybe 1-2 KiB if a few fonts are loaded. Change-Id: Ie286a1a273d6477af9e5d3f76e0534b62f72e8f7
2023-01-12Fix red in 7e5fc4076aAidan MacDonald1-0/+2
Change-Id: I1704ea0de243bff05262556723daea5b3531558b
2023-01-12Add INIT_ATTR to i2c_init()Aidan MacDonald10-10/+10
It's usually only called from init() in main.c, so this is safe. There is one more call in system-dm320.c from system_init(), but that's also "safe". I don't know if it's okay to call i2c_init() twice, but presumably it works... Change-Id: I9c1cd918d162d9955f7cf03209e836cbd5e30c57
2023-01-12Add INIT_ATTR to system_init()Aidan MacDonald2-1/+7
On single-core targets, system_init() is only called from init() in main.c, which is also INIT_ATTR, so this is safe. Multi-core targets additionally call system_init() from cop_main(), which isn't marked INIT_ATTR. I'm fairly certain that it would be safe to add INIT_ATTR to cop_main() with a bit of refactoring, but I don't have a way of testing it. So for now, leave INIT_ATTR off for multi-core targets. Change-Id: I8fe4358f975880ca317d46bda01d7d9db529d3e3
2023-01-10chunk_allocWilliam Wilgus4-0/+377
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-08lcd: Fix 4bpp optimized 16-bit alpha blitAidan MacDonald1-2/+3
Fixes a bug introduced by commit 5d0c382a59 that caused graphical corruption on anti-aliased fonts. Change-Id: I6052ca758382bd9a1154d2e2208dee633dd17715
2023-01-06lcd: Rewrite 16bit alpha bitmap blitAidan MacDonald1-225/+220
Avoids a harmless out of bounds reads in ASAN that occurs with malloc buflib. Code size and performance is similar. Change-Id: I1c674d046b069e64ad8cb6941356f7c568a81e88
2023-01-04[BugFix] Fix some Shif related UB -- ASANWilliam Wilgus1-3/+3
these are the low hanging fruit identified by ASAN cast the byte values before shift Change-Id: Ifc5645354a10c15ccd09d1343e1705857a51e011
2023-01-02Add locked actions to all soft lock targetsWilliam Wilgus3-3/+0
fiio m3k native is currently the only player with defined buttons different from the standard mapping. This allows the user to use the keyremap plugin to specify differing keymaps for their device in the locked state Change-Id: Ie0b447bba0d5978e8d23fed423df30c794afc6f9
2023-01-02clean up button.c optimize !filter_first_keypressWilliam Wilgus3-106/+119
do a bit of cleanup in button_tick move filter_first_keypress to a function pointer Change-Id: Iefb05c1a182c1e15cfb5bca8e2ef31a710d15eba
2022-12-31[FixRed] ClipV2 has a hold button -- news to meWilliam Wilgus1-1/+0
HAVE_LOCKED_ACTIIONS requires !defined(HAVE_HOLD_BUTTON) Change-Id: I1e98c282f17d11f08ea80cd5963b331a3ae19387
2022-12-31[Feature/Bugfix] keyremap add Context flagsWilliam Wilgus3-0/+3
Add context flags to keyremap CONTEXT_LOCKED CONTEXT_REMOTE CONTEXT_REMOTE_LOCKED --CONTEXT_PLUGIN-- Removed -- Plugins need a custom action list supplied and a method of supplying them Change-Id: I5201d275ad0ab6130c2d05d5afb0c450f5c1746c
2022-12-31x1000: Add INIT_ATTR to various target specific functionsAidan MacDonald6-20/+19
Add INIT_ATTR to some low-hanging fruit in the X1000 code: GPIO init, GPIO initial state tables, clock init, and DMA init. Change-Id: Ia02b20945da1bbed103e2e01eaf60553eb5f72d4
2022-12-31x1000: Enable support for INIT_ATTRAidan MacDonald4-1/+33
Enable INIT_ATTR support in config.h. Load init code to the codec buffer, following the convention used by other targets that support INIT_ATTR. Change-Id: I8935fbaa100f0013bb328d71c4a49ec2ffafd003
2022-12-30events.c clean-upWilliam Wilgus1-42/+41
check for invalid userdata by assigning the address of 'invalid_userdata' this cleans up the functions a bit and removes some extra conditionals Change-Id: Ic5e13147796e629010a1436eb60042f6550a959c
2022-12-23Revert "buflib.c strip path from alloc name"Aidan MacDonald1-4/+0
The font code expects the full path to be stored in the buflib alloc so this breaks eg. saving the glyph cache. This reverts commit 2b4a4070c99439898e22c9c9da2c21877d18a367. Change-Id: I53844c39b34b14f7c8e5999825c1d012fa3f74dc
2022-12-20ata: Prevent powering-off ATA hardwre if it reports as mSATA or m.2Solomon Peachy2-3/+20
As those form factors are typically not runtime removable and as such expect to always being powered up. This is an experimental change, and we might revert it if it doens't help Change-Id: I61187f297866f64589a546352828a0ff8169fa30
2022-12-20buflib.c strip path from alloc nameWilliam Wilgus1-0/+4
Change-Id: I6a0f1cc9037fcbe0245d94b4c77ba4ec08378434
2022-12-19jx47xx: Rename crt0 'init' sections to 'startup'Solomon Peachy2-3/+7
Mirrors the change made to the x1000 target Change-Id: I69663245b1d05c001500240af33164f222e70e90
2022-12-18[BugFix] root redirect failed to match the peoper drive when internal drive ↵William Wilgus1-0/+6
is missing HAVE_MULTIVOLUME is a subset of HAVE_MULTIDRIVE in normal circumstances they are interchangable but when the internal drive is not found the assumption falls apart at the moment most of the bootloader are less selective about what drives/volumes they will mount therefore the volume might not match between what the bootloader returns for multiboot and what the firmware sees updating bootloaders will fix this but it should probably be made more robust at the same time Change-Id: I93acd4a539894f093211b74b030df3b2c6a0aa11
2022-12-18kernel: Fix unsafe cross-section reference in init_tick()Aidan MacDonald1-1/+1
This is a small wrapper function which calls other init code and is only called from init code; mark it INIT_ATTR to fix the unsafe reference. Change-Id: I5525461e9fd63955c6396d3151d209c457b3d798
2022-12-18x1000: Rename crt0 .init sections to .startupAidan MacDonald4-5/+9
Avoid startup code clashing with the .init section, which is by convention used for INIT_ATTR code that can be discarded after app initialization. Change-Id: Id59b7618ef41e65c33fc0f133644e07555a913eb