Commit graph

291 commits

Author SHA1 Message Date
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
b5a6c436c2 first draft at some basic libstd UDP mechanics 2022-04-04 04:49:17 +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
d074de34d6 add seek tests 2022-03-29 04:40:51 +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
18c202dcee start of testing code for the PDDB 2022-03-28 22:56:32 +08:00
bunnie
91ed8193a7 fix delete commands to sync and also make keyword ordering parallel 2022-03-28 03:37:04 +08:00
bunnie
18b7cf78df add some pddb delete routines 2022-03-28 01:55:39 +08:00
bunnie
2340686e80 rate limit error messages 2022-03-27 16:45:00 +08:00
bunnie
107c63f7c2 update RTC functions to use libstd 2022-03-27 04:06:26 +08:00
bunnie
1617200cb6 remove the RTC "reach-around" cheat inside shellchat's test routine
The test routine for shellchat "cheats" and accesses the I2C block
to test the RTC during factory operations. This is not aesthetic
and is also potentially a security hole since we don't want less
trusted stuff willy-nilly playing with i2c.

Rewrite to

1) remove i2c references from shellchat
2) replace RTC calls with the newer non-dangerous llio calls that are
limited to read out the initialized time variables.
2022-03-27 02:56:41 +08:00
bunnie
df96ca1429 test for libstd Instant 2022-03-26 02:35:59 +08:00
bunnie
bfb8a17cd5 strip out legacy RTC calls in preparation for refactor 2022-03-24 02:19:26 +08:00
bunnie
140f07ddc8 latest revised test 2022-03-18 20:28:36 +08:00
bunnie
4463b909a1 initial cut at using libstd TcpStream for comms 2022-03-18 19:55:16 +08:00
bunnie
b246a369d4 lay in another layer of tts functionality
now shellchat can talk, and password entries are a thing.

next up: debug oom issues in STT when we start doing really big
strings.
2022-03-11 02:37:48 +08:00
bunnie
9116cb02b1 back-propagate pause->abort changes.
in many of the test routines what we really wanted was an
abort, not a pause.
2022-03-08 19:03:02 +08:00
bunnie
1d6fbbe5bb add the basic text to speech infrastructure.
also creates a method for isolating incompatibly licensed repos
2022-03-08 03:08:12 +08:00
bunnie
985fcdf9da a feature slipped in that i didn't mean to commit 2022-03-07 13:31:16 +08:00
bunnie
dd511432b4 fix dangling reference in AES ctr mode soft implementation 2022-03-07 13:28:10 +08:00
bunnie
271fd4d559 make the UDP socket specifiable on command line
this makes the bindings work on things other than localhost
2022-02-21 01:26:04 +08:00
bunnie
760957154e add a crappy but slightly more accurate approximation of UDP to hosted mode
It's crappy because it uses a busy wait loop to poll the udp
rx socket in order to accurately emulate the Xous async callback
feature (which is _not_ emulated for Tcp, for example).

It's more accurate because this emulation happens. But it's a lot
more complicated to implement it because zero-cost async UDP callbacks
aren't really a host-native feature (but they are a Xous-native feature!),
and I didn't want to .. pull in tokio or mio code surface into
the Xous hosted mode, seemed a bit like crushing a fly by dropping
a house on it. Maybe that's a fine solution in Oz, but Xous doesn't live in Oz.
2022-02-21 00:54:46 +08:00
bunnie
0dbf1661cb add TCP to hosted mode emulation
Total bodge -- we lop off the TCP stack at the Xous API level, and
substitute it with a native host TCP stack.

Caveat hacker: this means that a lot of OS-specific net properties
will carry through to the hosted mode emulation. This is adequate
for "smoke testing" a build but do not be shocked, *shocked* if
there are more bugs to be found because of some weird host integration
issue.
2022-02-20 21:31:32 +08:00
bunnie
960745ca61 eliminate static mut unsafe pattern in callback function storage
since xous 0.9.5, we've had a Box and we've had threads, so now we
can put the callback in a Box and pass it to a thread, instead
of relying on an `unsafe` work-around to get the callback function
pointer into the thread's environment.
2022-02-19 01:38:20 +08:00
bunnie
e4db83e59e add a "public" RTC get command to the LLIO
This implemnetation takes advantage of the fact that the LLIO
owns the RTC device, and bypasses a layer of indirection in the
call chain.
2022-02-19 01:16:20 +08:00
bunnie
95b857feea refactor i2c interface to eliminate static mut unsafes
also remove async write callbacks: in practice, these aren't used

Downside of this refactor is that threads for handling the
callbacks are not spawned on demand, they are spawned at boot,
leading to about an extra 68k of RAM used (most of it being
consumed in the codec block, actually). Some of this is also
probably extra object code because we're using more of the stdlib
primitives, which carry some weight.
2022-02-19 00:31:25 +08:00
bunnie
36bf400d46 fix a delay in factory test to match a revised delay
waiting a bit longer for the EC to boot requires the confirmation
time threshold for the EC boot to also be stretched out
2022-02-06 03:13:33 +08:00
bunnie
fd5c6568d1 trim out some excess redraw calls that are slowing down boot 2022-02-05 18:55:46 +08:00
bunnie
63ee19fc8a improve RSSI reporting during test 2022-02-04 17:46:22 +08:00
bunnie
06b9f88926 improve test oqc interface with new API 2022-02-04 17:11:42 +08:00
bunnie
8fa4499c14 fix some cosmetic issues 2022-02-03 20:45:46 +08:00
bunnie
9921377148 make sure the connection manager doesn't race with user settings
If the connection manager isn't paused while a user sets up a network,
it could decide that the currently partially configured status is
crap and then overwrite it with a saved configuration.

Pause the connection manager and make the user aware of this situation.
2022-02-03 18:46:51 +08:00
bunnie
ffa6884fe4 improve list formatting 2022-02-03 18:42:50 +08:00
bunnie
955d0182d6 some very minor ergonomic improvements around network connection UX 2022-02-03 18:38:43 +08:00
bunnie
de81cf62c3 fix typo in formatting field 2022-02-02 03:30:17 +08:00
bunnie
ef0e6606ed make the "web page" a little easier to read. hah! 2022-02-02 02:41:25 +08:00
bunnie
562a930ce0 add APIs to pause the connection manager, and pause the CM while doing EC updates
It's not a good time to bug the EC to do network stuff when it's updating
itself.

...might even want to send the network into a disconnected state,
but, let's start with just turning off the connection manager
for now.
2022-02-02 02:38:19 +08:00
bunnie
13de52fa8d TcpListener debugging, just a little bit
Spent a couple hours chasing down a "bug" which is acutally just
something about how http works that I don't understand. TCP was
working just fine but there is ... idk some sort of keep alive
thing that occupies a socket so the "web server" blocks waiting
for a read. Anyways, I guess the "right" way to solve that would
be to make a multi-threaded web server

OH GOD STOP

right. it's just a demo to prove that TCP works. done.

Open an issue if you find a problem with TCP kthx!
2022-02-02 00:23:14 +08:00
bunnie
925d53f646 TCP listener is "working"
Good enough so that if you type `net server` and you hit the IP
address of the device, it'll respond with something like

Hello from Precursor!
I have been up for 86087 ms.

There's still all kinds of bugs, I'm sure. But ... I'm also not
sure /why/ you would want a web server on Precursor. This is more
just to make sure that the TCP stack isn't totally broken.

The "web server" as it may be is quite broken and doesn't parse
any headers and probably sends a bogus amount of data because
I can't figure out if the content length includes some new lines
or not. But really, this just isn't in scope. Works with Chrome,
Firefox shows the status page and then says "connection reset" and hides
all the information. Whatever, browser compatibility is well beyond
my pay grade!
2022-02-01 18:54:07 +08:00
bunnie
faa51908d7 maybe, just maybe...we finally have version info baked into the kernel correctly. 2022-01-31 23:02:32 +08:00
bunnie
0910f7e373 tcpstream passing a simple demo test
not sure what other tests to run, not an expert in this stuff.
2022-01-31 14:35:55 +08:00
bunnie
2153c25be3 it is so damn hard to get Rust to inject a relevant build time into a build
Still not there....to get it reporting in a user-visible fashion
I'm realizing I'm going to have to build a dedicated facility in
Xous to track this because otherwise I have to trigger the
automatic rebuild of a "heavy" program that would naturally
encapsulate such information.

Maybe for now, though, at least over the serial port I can
get a somewhat relevant string???
2022-01-31 13:16:09 +08:00
bunnie
7999ea04d1 add a simple tcpget test stub to the shellchat 2022-01-31 05:02:18 +08:00
bunnie
4690075c40 clean build, but...much testing to do. 2022-01-31 04:03:31 +08:00
bunnie
177ad38db2 derive SSID scan on shellchat from the connection manager
The connection manager keeps track of all our SSIDs, not the COM.
2022-01-30 16:53:15 +08:00
bunnie
25bccd9446 THE BALDEST YAK: keyboard injection now working
I wrote in a commit yesterday how there was no ROI on doing this
yet somehow I kept on doing it. I blame poor impulse control.

Turns out there was a series of race conditions and bugs that
caused this thing to "mostly work" on the first go at it but
really hard to debug and get very right.

1. Litex UART has a weird undocumented API. You advance the Rx
FIFO by writing `1` to the PENDING bit, and no other way. However,
you determine if there are any more characters to receive by
reading the EMPTY bit and seeing if it is 1. The previous method
wrote `1` to the PENDING bit and then used the PENDING bit to
see if a character was available, under the theory that the
PENDING bit would be set again if there was still a character.
This is somewhat true, except that the PENDING bit is set only
some amount of time later which is about comparable to a few
CPU instructions, so if you had a fast loop path the PENDING
bit would show as cleared and you'd exit, which would cause
no further interrupts to fire because the interrupt was
effecitvely not acknowledged.

This isn't written up anywhere but I figured this out by
just reading the source code for Litex UART and BIOS:
e8be391504/litex/soc/cores/uart.py (L264-L279)
ccd3ab17be/litex/soc/software/libbase/uart.c (L38-L44)

2. I had the Key Injector IP block in the `sys` domain, which
would have its clock cut when the CPU went to sleep, which would
cause input characters to disappear when the CPU went into power
saving. moving this to "always on" domain fixes that.

3. I had the UART PHY in the always on block (so you could
send or receive exactly one character), but not the
separate UART block (which contained the FIFOs).
The UART block would also go into power
savings, and this would cause FIFO entries to go missing.

4. Escape sequences get sent as a burst of characters. The Key Injector
originally did not have a FIFO of its own, so it would only
remember the *last* key of the sequence that was written, causing
some keys to be dropped occassionally. Adding a 16-deep FIFO
to the injector fixes this.

5. The code I had to read out the injector's results was designed with
the "strobe" bit (to indicate that the FIFO had characters) in the
same regsiter as the character itself. Thus the loop that 1. checked
if the fifo was empty then 2. read and forwarded the character
would actually perform two reads from the FIFO. However, this "mostly worked"
I think because the FIFO retains the last value that was written
even when it was empty, so if only one character was read at a time
everything was fine. It only didn't work when you stuffed two characters
in there, as you'd drop the first one. Reading the FIFO once and
then interpreting the code with a bitmask fixes this.

6. The escape sequences, in their full glory with no dropped characters,
required a refactored parsing routine, which I have now added.

7. backspace->delete mappings, the bane of computer engineers since 1960.

OK. very bald yak. Here I lay down the shears next to several
mooshi pillows stuffed with the finest Yak hair.
2022-01-28 15:17:47 +08:00
bunnie
71c017641a fix up some debug messages and other minor nits 2022-01-27 04:07:22 +08:00
bunnie
4c4ca1577f fix connection manager state machine
seems to work a lot better, but needs a lot more testing
2022-01-27 03:56:39 +08:00
bunnie
1d27265d02 fix comma formatting in pddb lists to not put a trailing comma 2022-01-25 16:58:22 +08:00