Commit graph

11427 commits

Author SHA1 Message Date
Aidan MacDonald
484a79fcc0 x1000: Add INIT_ATTR to various target specific functions
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-31 08:10:41 -05:00
Aidan MacDonald
a980d5f869 x1000: Enable support for INIT_ATTR
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-31 08:10:41 -05:00
William Wilgus
e180e45e01 events.c clean-up
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-30 07:23:29 -05:00
Aidan MacDonald
5f2ca6718d Revert "buflib.c strip path from alloc name"
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 2b4a4070c9.

Change-Id: I53844c39b34b14f7c8e5999825c1d012fa3f74dc
2022-12-23 19:59:06 +00:00
Solomon Peachy
646d5f92ef ata: Prevent powering-off ATA hardwre if it reports as mSATA or m.2
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-20 20:38:43 -05:00
William Wilgus
2b4a4070c9 buflib.c strip path from alloc name
Change-Id: I6a0f1cc9037fcbe0245d94b4c77ba4ec08378434
2022-12-20 18:10:44 -05:00
Solomon Peachy
83bb89d0b8 jx47xx: Rename crt0 'init' sections to 'startup'
Mirrors the change made to the x1000 target

Change-Id: I69663245b1d05c001500240af33164f222e70e90
2022-12-19 23:09:54 -05:00
William Wilgus
f37ebe5ed2 [BugFix] root redirect failed to match the peoper drive when internal drive 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-18 23:32:13 -05:00
Aidan MacDonald
b650e774a1 kernel: Fix unsafe cross-section reference in init_tick()
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-18 22:23:52 +00:00
Aidan MacDonald
e8ad52be94 x1000: Rename crt0 .init sections to .startup
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
2022-12-18 22:14:22 +00:00
Aidan MacDonald
68af18a56f x1000: Simplify app linker script
Get the linker to automatically assign load addresses for
the .iram and .tcsm sections. Taken from the i.MX31 linker
script.

Change-Id: Ic03d577d8690c777726daf373a3289316639bfb9
2022-12-18 22:14:22 +00:00
Aidan MacDonald
d6744c92b1 x1000: Add missing LCD activation event on LCD enable
This event is needed to trigger a GUI redraw when the backlight
turns on.

Change-Id: Ib2300dfd1aaeacd84c6df8151072292409357212
2022-12-18 21:01:04 +00:00
William Wilgus
f6f12db062 events.c do_add_event() only traverse event array once
we already go through the whole array might as well save the free slot as well

Change-Id: I6e1164b57a5510f5de5555d2cb91379afc58ae08
2022-12-08 05:19:40 -05:00
William Wilgus
a1e4385acb backlight.c move some conditionals out to functions
de clutter bavklight_thread a bit

no functional changes

Change-Id: Iee3901a0abcea9bcf4fe364839af177e3791d980
2022-12-07 09:07:27 -05:00
Richard Goedeken
f3b522cac6 bugfix: for Eros Q / Surfans F20, when the scroll wheel is moved, in addition to resetting the power-off timer, we also need to reset the backlight timer and turn it on in case it's currently off.
Change-Id: I73b463e74727a2d00b0d4ce599f0cc611fb98685
2022-12-07 08:16:13 -05:00
Richard Goedeken
d06cf3ac2d bugfix: for ErosQ/SurfansF20, reset poweroff timer when scroll wheel is moved so that we dont blank the screen while the user is scrolling through a list
Change-Id: Ifdce301e2d75e3f6f54fba5b3eef15b2141cb954
2022-12-04 10:16:14 -05:00
Aidan MacDonald
7819a06d74 Add rectangle utility functions
Change-Id: Iebcddfc36733aab5131d2fcb9fd8c8a32eff84b8
2022-12-01 12:36:28 -05:00
Aidan MacDonald
52ca658069 x1000: Add support for DS35x1GAxxx flash chips
This flash chip is found on some Surfans F20 units. For our purposes
it's the same as the GD5F1GA4xExx so just #define an alias instead of
adding a whole new chip struct.

Change-Id: I2f4c4fbf1faf3a0c7a1503534430afacbddc426e
2022-12-01 12:11:46 -05:00
Solomon Peachy
0c7394e39a ata: Improve heuristics for detecting SSDs
mSATA devices should be new enough to report their form factor proprerly

Change-Id: I2605c8ee0c97432e6e03bd78719e12bb14837f8d
2022-11-27 09:15:29 -05:00
Solomon Peachy
65db4acabe pcf56065: Fix a compile warning uncovered by GCC8
Basically, use '!' instead of '~' on bools.

Change-Id: If0d94b294e69a939101e16808d4adc50a9fe1c81
2022-11-27 01:20:03 -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
016090b2a4 Bug fix multiboot.c get_redirect_dir didn't reach index 0
add_path[0] was never reached

Change-Id: If375a70832b0666d87f7d87b136cc377484b9ec1
2022-11-17 05:36:55 -05:00
William Wilgus
00f915d92e strnatcmp.c use a fn pointer to call strcmp/strcasecmp
Change-Id: I2bfaeec4cf2af4bed8f0781bcfa24b0b104fb22a
2022-11-17 04:15:38 -05:00
William Wilgus
972810f6cf strlcpy finish cleanup
remove strlcpy & strlcat from string.h

document suspicious strlcpy call

convert strlcat.h users to string-extra

Change-Id: I313e75db86385c0e6d1aee75d252093be4935f60
2022-11-17 01:54:46 -05:00
William Wilgus
7733abce29 strlcat use strlcpy for the copy part
Change-Id: I729b292a58d9f6542e58ac01d1dc90d36175886d
2022-11-16 00:36:47 -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
034b6d5bfb Remove some shadowed variables identified by -Wshadow
there are plenty more but these are the low hanging fruit

Change-Id: I86d9f4f56e8cd9b381d1bf6a6679cd58c6a4004d
2022-11-14 09:01:43 -05:00
William Wilgus
f94a14b859 increase the number of file & directory handles for devices with more ram
Change-Id: I06f517b3b1388aa43fe1aa9edae53c92d0b137e8
2022-11-14 08:21:29 -05: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
d09fb6bb6b x1000: Pass CPM scratch register to the bootloader
Change-Id: Iaef4606dc6f3cb9904d87ee92db69fb9ef48bcb0
2022-10-28 20:58:26 +01:00
Aidan MacDonald
744ea2ff43 x1000: Allow SPL and bootloader to pass arguments to next stage
Change-Id: I61591d704c14acf06cd192a6e9355f0a9c25d0d8
2022-10-28 20:32:38 +01:00
Aidan MacDonald
9e258652c4 x1000: Add a basic sanity check for bootloader backups
The bootloader backup is intentionally simple, but it's a little
*too* simple. Add a sanity check to make sure what we're backing
up or restoring contains the first 8 bytes of the SPL header.
This isn't going to catch all possible problems, but it'll stop
obviously non-functional backups from being restored.

Change-Id: I6e80351aeb96c467f0514bd0ecd77d94ff72a8f8
2022-10-28 20:32:38 +01: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
Aidan MacDonald
5e864ecde9 linked list: add lld_insert_prev/next()
Change-Id: I55ff061ccc0e6e2dad3125a8150c082c163db329
2022-10-16 16:10:24 +01:00
Aidan MacDonald
ee9679993b linked list: inline list init functions
These functions are so trivial it's always cheaper to inline them.

Change-Id: Ie0c77c8b6e7a716312105445a22e62ff57a76d90
2022-10-16 16:10:24 +01:00
Aidan MacDonald
8bf8036021 lcd: Fix clear_viewport on grayscale displays
The original drawmode change was "x = (~x & INVERSEVID) | SOLID"
which is essentially XOR'ing the INVERSEVID bit, but I changed it
to mask out INVERSEVID by mistake.

Fixes 44b9785465.

Change-Id: I87b059b89aea9c31a8ff408016264285e67ca80c
2022-10-16 15:41:50 +01:00
Aidan MacDonald
1718cf5f8a Convert a number of allocations to use buflib pinning
Several places in the codebase implemented an ad-hoc form of pinning;
they can be converted to use buflib pinning instead.

Change-Id: I4450be007e80f6c9cc9f56c2929fa4b9b85ebff3
2022-10-16 14:50:39 +01:00
Aidan MacDonald
5e7c34f5b3 lcd: Fix off by one error in clipping check
When I converted all the clipping checks in 4b8fe8acd1 I messed
up the hline and vline checks. This produced some weird panics on
the Shanling Q1, probably memory corruption -- but somehow it got
past AddressSanitizer. Go figure.

Change-Id: I84820c23a491d422218c72d2d5e199e2fc7def0f
2022-10-15 20:56:11 +01:00
William Wilgus
12ef045fdf move buflib_free invalid handle check to the function
allow buflib_free to check for invalid or already freed handles
within the function -- remove all the invalid handle guards thru core_free

Change-Id: Ibdcbc82760fc93b674c42283fca420d94907df8e
2022-10-15 09:26:58 -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
c607bfac6f lcd: Fix update_viewport() for non-default stride viewports
Simplify update_viewport() by calling update_viewport_rect().
The resulting LCD driver calls are the same either way and
for some reason, update_viewport() didn't handle non-default
stride viewports correctly.

Change-Id: Ic34d3d40e4f758db897cb3944d9d7475bbdb4d2c
2022-10-12 08:06:12 -04:00
Aidan MacDonald
9549ddabba lcd: Fix bug in grayscale clear_display() implementation
clear_display() on grayscale LCDs sets the number of scrolling
lines to 0 but that's wrong, the scollers need to be shut down
first. Call scroll_stop() for that, as is done on color LCDs.

Change-Id: I75fb6839ed04f6fe1eb8e2855c8db820fcedddb8
2022-10-12 07:58:57 -04:00
Aidan MacDonald
44b9785465 lcd: Move grayscale clear_viewport() to lcd-bitmap-common.c
All grayscale LCDs have the same clear_viewport() implementation.

Change-Id: I087ac3be824c97a1f42857b4e2fedb0675d453fa
2022-10-12 07:58:57 -04:00
Aidan MacDonald
f737e5025d lcd: Refactor viewport clipping functions
There's no need to generate separate copies of these functions
for main and remote LCDs; we can just pass the viewport directly.

Change-Id: I20aa04a58d327b479a942708e161068bd6a3357b
2022-10-12 07:34:15 -04:00
Aidan MacDonald
6acc8a81a7 lcd: Cosmetic variable renaming
Assign lcd_current_viewport to a local variable for easier typing.

Change-Id: Ib5d4283fd1c5a21c94d3bd3c2c28ce206383fb96
2022-10-12 07:34:15 -04:00
Solomon Peachy
2928b71a69 mips: Work around an issue with GCC 8.
Change-Id: I9867674978ab6d4c99f5fa67c93e5b830531aefd
2022-10-10 08:24:33 -04:00
Solomon Peachy
af75619585 usb dwc2: Fix a potential garbage string print in an error path.
Change-Id: I56f8ee9bc883baac8707f136be396bb2669f911b
2022-10-10 08:24:33 -04:00
Aidan MacDonald
f8e968991d lcd: Move parameter handling calls to lcd-bitmap-common.c
No need to reimplement the same drawmode, getwidth, etc, calls
for each pixel format.

Change-Id: Ibbe32814f72e1492c190ba578cec303c1cf29b12
2022-10-09 22:07:49 +01:00