Commit graph

1394 commits

Author SHA1 Message Date
bunnie
5b8e53aacb remove "log" feature from NTP crate, trims off some executable size 2022-04-05 13:32:23 +08:00
bunnie
dacc38808e fix blocking message detection clause in two places 2022-04-05 13:31:50 +08:00
bunnie
532c4a4f1f add NTP to time setting via SNTP library 2022-04-05 04:19:53 +08:00
bunnie
dbce305f11 Merge branch 'bunnie-dev' into main 2022-04-05 01:11:23 +08:00
bunnie
cbb1e3f944 fix various bugs related to UDP; prep for transition to libstd-only UDP 2022-04-05 00:39:56 +08:00
bunnie
067c603e03 strip out old UDP libraries, harmonize on just libstd UDP 2022-04-04 23:15:51 +08:00
bunnie
57339dfe2f udp libstd passing inital tests 2022-04-04 22:37:01 +08:00
bunnie
cfcea2e094 shift the status bar a bit more
as uptime goes up, the width gets larger...
2022-04-04 04:54:37 +08:00
bunnie
b5a6c436c2 first draft at some basic libstd UDP mechanics 2022-04-04 04:49:17 +08:00
bunnie
b936414d11 emit a warning if apps don't recognize focus changes, instead of a panic 2022-04-03 17:49:12 +08:00
Aaron Bieber
f9ca65be11 Pass register_name two args 2022-04-02 16:07:22 -06:00
bunnie
9dc75071ad split up the main.rs file
it's going to get unwieldy if we stick all of std::net into just main.rs
2022-04-02 17:57:50 +08:00
bunnie
d026102d41 Limit scope of Foreground/Background messages to just app changes
Don't send FocusState::Foreground / FocusState::Background messages
to Layouts that are non-App type. This allows this to be used more
reliably as a signal of if the background is the running app or not,
rather than if it is merely the drawable canvas.
2022-04-01 22:54:33 +08:00
bunnie
fa10cfc040 minor typo fix 2022-03-31 02:38:08 +08:00
bunnie
ec4515579c stashing a bit of code so i can remember how to conjure a delay in susres 2022-03-31 01:44:48 +08:00
bunnie
8b5ad2657b an aborted attempt at doing a clean-shutdown for hosted mode
This doesn't work because the shutdown call destroys all the servers then terminates
the processes. But, the problem is that the processes are still
running, but servers are disappearing. So what you end up with is a
panic when the first message gets delivered to a server that no longer
exists, and then you end up with the program hanging on that panic
because some servers haven't been destroyed/exited yet and are now
just spinning waiting to be scheduled. so the call works in the tidy
kernel test cases but to get it to work on a full OS you'd need to
have a way to put every server into an eternal blocking state before
making the shutdown call (to prevent new messages from being issued
while servers are going away), which is more work than i'm willing to
put into the problem right now.
2022-03-31 01:10:58 +08:00
bunnie
ba18f3cbe2 don't try to reset the RTC alarm in hosted mode
there isn't an RTC in hosted mode!
2022-03-30 23:33:00 +08:00
bunnie
29dab322ed add some comments on the modals tests. 2022-03-30 03:40:11 +08:00
bunnie
d61622bcde add a 1-second delay on resume before telling connection manager to reconnect
now that the suspender is in its own thread, we can do this safely.
It's nice to have a bit of a delay because we want other system recovery
things to take precedence and settle out before we try pinging the COM
to see how the wifi changed while we were asleep.
2022-03-30 02:34:22 +08:00
bunnie
c503316c3d refactor suspend/resume ordering
Add a "Later" stage, and have exactly one "Last" stage.

"Last" to suspend is the ticktimer -- this is crucial for
basically everything else to work. The other really
low level stuff that needs to work to the last minute is
now in the "Later" bin.
2022-03-30 02:30:39 +08:00
bunnie
6a6c2aef0f add a thread to respond to suspend requests on the connection manager
the connection manager actually wants a ping on resume,
and when we suspend we suspend -- "it is what it is". However,
the connection manager is a hairball that can block for a while,
so, to prevent failures to suspend, we put the suspend listener
in its own thread, and on resume the suspend listener will
automagically kick out an event to tell the connection manager
to deal with stuff.
2022-03-30 02:29:09 +08:00
bunnie
d8065b76df turn off RTC wakeup alarms
This call was originally part of the RTC driver, but when we
refactored things out, this was forgotten.

So, what would happen is, if you did a coldboot or reboot,
an alarm would get set and...well, the way the RTC blocks
is it'll keep asserting the alarm until you clear it.

This prevents the system from sleeping, and also keeps
the CPU pegged at 100% for some reason. The prevention
from sleeping makes sense to me. The CPU at 100% probably
indicates there's a problem in the event router, but
this path isn't used for anything at the moment so
we'll just open an issue and leave it as technical debt.
2022-03-30 02:27:14 +08:00
bunnie
04d074de1b fix hosted mode build 2022-03-29 22:55:27 +08:00
bunnie
1455ea6d8b clean up the suspend/resume path for the screen and enforce redraw 2022-03-29 22:50:25 +08:00
bunnie
c8382a671a move the CPU status bar slightly to address text overflow issues 2022-03-29 16:54:27 +08:00
bunnie
d736d54cee make pddbtest not part of the hw build but part of hosted mode by default 2022-03-29 16:49:18 +08:00
bunnie
e4eed87a55 Merge remote-tracking branch 'origin/main' into bunnie-dev 2022-03-29 16:45:56 +08:00
bunnie
4f1f4a3907 optimize journal resolution code
We have the journals tracked in a HashSet, so, use the hashing
properties instead of an O(N) search.
2022-03-29 16:39:54 +08:00
bunnie
0bdf21b3ac retire debugging infos 2022-03-29 16:33:40 +08:00
bunnie
c542807958 fix PDDB bug where journal numbers on pages were incorrectly restored
An edge case was missed where a page which was allocated out of
the FSCB and then later written to disk was having its journal
number set to 0.

The root cause of the logic issue is that the page table itself
does not store a journal number. It's assumed that the page table
is ground truth, and is unjournaled.

As long as the pages don't exist in the FSCB, that's not a problem,
the journal number doesn't matter.

But, let's say this sequence happens:

1. FSCB allocates some free space
2. process takes that free space allocation and commits it to its own page table
3. FSCB update log gets a note that free space is now allocated
4. system reboots
5. process reads its page table from disk. There are no journals associated
with the page table on disk, so, it assigns a journal number of 0 by default.
6. we now have a conflict between the Process' view of the journal age
of that page table entry, and the FSCB's view.

The fix to this is during the page table scan, to check and see if
any candidate pages happen to already exist inside the FSCB. If it does,
then you adopt the latest journal number for that page in the FSCB.
This keeps the two views consistent.

A second bug was also identified while fixing this where the "Random"
order we were hoping for in visiting the free space cache as an
iterator is less random than we had hoped. So, there is a patch to
extract the free pages and pull one random one from the pool, using
entropy coming from the TRNG. This is less computationally efficient,
but at least it is correct and has more transparent properties
than relying on the indeterminism of the HashSet implementation.
2022-03-29 16:26:55 +08:00
bunnie
bdd194ea7b retire rust issue 90195 work-around in PDDB 2022-03-29 16:25:33 +08:00
bunnie
da89a61a28 retire work around for rust issue 90195 in I2C 2022-03-29 16:24:14 +08:00
Alex Tibbles
f6030fe213
build fix for 5452fae33c 2022-03-28 17:01:25 -04:00
bunnie
b32cde6870 mute a debug message 2022-03-29 04:54:57 +08:00
bunnie
d074de34d6 add seek tests 2022-03-29 04:40:51 +08:00
bunnie
4eec54620c fix warnings and debug messages 2022-03-29 04:39:33 +08:00
bunnie
9a41b18400 fix bug where dictionaries with 1 entry fail to sync
also ensure that at least 1 byte is reserved for any key
that is allocated; this helps avoid edge cases dealing with
zero-length key entries later on.
2022-03-29 04:38:15 +08:00
bunnie
5f6a21bff1 add some manual test cases that run in hosted mode for pddb
these are helpful for debugging "real" use cases, instead of
the synthetic CI benches that don't fully exercise the file-like
API.
2022-03-29 01:49:47 +08:00
bunnie
55b05cfd80 add debugging routines; fix zero-length key creation case
- add a "dangerous debug" command that only exists when the feature
"pddbtest" is enabled. The feature can't work on real hardware, but
still, it enables things like dumping of the database and storing
the keys for inspection, so it's isolated in a feature that prevents
the code from being compiled in the first place when it's not selected.

- fix a bug where keys that have zero length aren't being created
correctly. this is a common use case for reserving some space for
data that isn't yet available.
2022-03-29 01:47:28 +08:00
bunnie
b1966a2274 Merge branch 'main' into bunnie-dev 2022-03-28 23:30:17 +08:00
bunnie
5452fae33c harmonize blitstr2 and graphics-server to an i16 pixel representation
previously blitstr2 is using usize for x/y coords, which means that
for layout purposes points could not go to the top or left boundary
without causing arithmetic overflow. Of course, you want to render
everything on-screen, but, as we have multi-line text with overflow
possibility, it's reasonable to be able to use negative coordinates
to locate text boxes that flow into the visible region.

This of course means that occassionally you can come out with
things like "negative widths", but even then, there can be reasonable
uses for this as an intermediate in calculations that ultimately
arrive at a positive result.
2022-03-28 23:17:18 +08:00
bunnie
18c202dcee start of testing code for the PDDB 2022-03-28 22:56:32 +08:00
bunnie
287aea90b6 bump to latest version of minifb 2022-03-28 17:49:03 +08:00
bunnie
874a5ac20e bump to latest version of minifb 2022-03-28 17:48:38 +08:00
bunnie
2da52a1d5c fix millis vs seconds bug in hosted mode 2022-03-28 15:39:42 +08:00
bunnie
bd78ba94f1 refactor time setting modals into a separate thread
modals don't work when triggered in the status thread in hosted
mode (but they do, somehow, on real hardware). I think this
is an actual locking problem that would exhibit itself if
we had a true multiprocessor system, but since real hardware
is a single processor it doesn't show.
2022-03-28 15:25:43 +08:00
bunnie
1130bda4a8 add a UX delay to help ensure redraw order when switching apps 2022-03-28 15:25:08 +08:00
bunnie
83da511dc5 fix double redraw issue on menu close 2022-03-28 14:38:26 +08:00
bunnie
6fefd6cdf5 small tweak that makes hosted mode run a little more smoothly 2022-03-28 04:31:37 +08:00
bunnie
c69b9e451d unbreak hosted mode 2022-03-28 04:04:38 +08:00