Commit graph

4007 commits

Author SHA1 Message Date
bunnie
890c311102 make the logger serial path more robust to failures
the logger should not fail under any circumstances, so
any errors in the USB stack should be ignored.
2025-09-13 15:36:36 +08:00
bunnie
7f5a288090 add some commands for testing the serial console & port setup 2025-09-13 15:36:16 +08:00
bunnie
5dae83d404 improve panic screen formatting 2025-09-13 15:35:34 +08:00
bunnie
c47334704a PoC USB serial on top of the HID modes.
this now works with windows, after much testing and patching.
2025-09-13 01:12:12 +08:00
bunnie
b99da45c38 fixup dependencies to point to local fork versions
the local forks are needed to layer in high speed support,
debug, and a couple of other minor improvements.
2025-09-12 02:51:19 +08:00
bunnie
1b9c0c7143 gate off duart mapping when not debugging deep in the usb stack 2025-09-12 02:50:45 +08:00
bunnie
d20a1e4ed9 gate of unused functions without mass-storage 2025-09-12 02:50:24 +08:00
bunnie
e79f907bb7 add basic usb-serial support
some test code to echo characters back, needs to be improved
fix some reset edge cases, needs more work as stack still
does not enumerate on second plugin
2025-09-12 02:49:21 +08:00
bunnie
08aa40e557 add ctap protocol testing routines 2025-09-09 23:11:30 +08:00
bunnie
0df2cb73f7 fixup bao-video deps 2025-09-09 22:24:55 +08:00
bunnie
5ff4b6c317 turn off debug-print by default in usb 2025-09-09 22:20:02 +08:00
bunnie
1cd6a3c4d0 clean up warning 2025-09-09 18:41:25 +08:00
bunnie
16b3c43e31 get OUT packets working; in particular, HID/U2F seems good to go 2025-09-09 17:53:47 +08:00
bunnie
51adf0e76c clean up interrupt handler & remove page allocation from handler
handler works in an interrupt context, so it can't allocate
a page to return data. this cleans up that problem, and also
removes some redundant brute-forced checks that were copypasta
from previous merging of several routines.
2025-09-09 17:52:12 +08:00
bunnie
5978de6a22 cleanup warning 2025-09-09 17:51:48 +08:00
bunnie
9931daf131 fix broken links from rename 2025-09-08 17:21:49 +08:00
bunnie
6cf4757323 rename usb-cramium to usb-bao1x 2025-09-08 17:21:32 +08:00
bunnie
7fa4bb0cc5
Merge branch 'main' into vault2 2025-09-07 11:54:17 +08:00
bunnie
75a9373fea fix AES dependencies so that the correct acceleration is enabled
This relies on a trick I was not aware of previously, which is
that transitive dependencies absorb the additive set of features
enabled within a crate.

see

https://doc.rust-lang.org/cargo/reference/features.html#feature-unification

for the full description. but basically by referring to the feature
required in "aes" despite not being used in the crate but pulled
in by aes-gcm-siv, i can ensure that the transitive dependency
is in fact used.

I think this was always there but previously I just didn't understand
it correctly or didn't use it right when I tried to deploy it, but
this time I think I got it right.
2025-09-07 11:50:12 +08:00
bunnie
1c8a3a3ee9 migrate to using the latest rqrr with perfromance enhancements 2025-09-06 22:47:48 +08:00
bunnie
ac458c4b07 reduce pixel math (do mirroring in camera module)
also add some more analytics output
2025-08-20 03:07:12 +08:00
bunnie
a403f0c5f9 fix rust warinings 2025-08-20 03:06:24 +08:00
bunnie
1d950033af add base64 dumping of captured images for off-line optimization 2025-08-19 22:44:15 +08:00
bunnie
ffc226b9a8
Merge branch 'main' into nto-bringup 2025-08-19 19:51:16 +08:00
bunnie
ecbac27e76 fix rustc-1.89 warnings 2025-08-19 19:45:29 +08:00
bunnie
f2c61e44cc add aes test options to command environment 2025-08-10 22:28:32 +08:00
bunnie
55d0a6c947 add aes testing feature to console 2025-08-10 22:28:14 +08:00
bunnie
4eacde470f add commands for AES testing and for calibrating delay loop 2025-08-10 22:27:30 +08:00
bunnie
781c74ba79 make ticktimer scale with system clock setting in loader 2025-08-10 17:54:45 +08:00
bunnie
857e54c5af move the console to its final location 2025-08-10 01:56:07 +08:00
bunnie
381b7ec90e remove gpio frame-sync 2025-08-10 01:55:25 +08:00
bunnie
e3664738bc remove AES bodges due to broken AES unit in MPW 2025-08-10 01:43:03 +08:00
bunnie
508c38cfdd refer cache flush to hal version 2025-08-05 23:01:03 +08:00
bunnie
345e8868cf make bao-console work with hosted mode 2025-08-02 00:49:55 +08:00
bunnie
d91b7843cc cleanup bit-rot in I2C API in this branch 2025-08-02 00:49:38 +08:00
bunnie
0e1018797e implement HW acceleration for AES128. 2025-07-27 03:17:40 +08:00
bunnie
098d326b55 note performance improvements 2025-07-27 03:17:15 +08:00
bunnie
6fd1757a04 optimize AES routines
- change ordering of aes instructions to remove pipeline bubbles
- port the aes-256 encryption routine from assembly
2025-07-27 02:15:05 +08:00
bunnie
bd45919944 add aes test option into the mbox1 test 2025-07-25 18:59:33 +08:00
bunnie
2e8e2e0364 introduce a message passing test before mbox test 2025-07-24 00:30:04 +08:00
bunnie
1f55dd8ab1 add the messaging test into the mbox environment 2025-07-23 01:23:45 +08:00
bunnie
c0735374f0 fix hosted mode 2025-07-22 01:43:58 +08:00
bunnie
815c082153 add breadcrumb for improving the cbo.flush instruction
whenever rust stabilizes "zicbom" in RV we can remove the ugly
.word hard-coding of the flush instruction.
2025-07-21 19:12:37 +08:00
bunnie
6eaf3501bd add cbo.flush support for vexii targets
Spinor is the one location where memory changes out "from underneath
the CPU" in a cacheable region. This happens when we update a block
of FLASH.

Vex-ii has a physically tagged d-cache, but the cbo.flush instruction
needs the *virtual* address to be passed (it then goes through a page
walk or TLB lookup to resolve the tag). The virtual address only
exists and can be correctly resolved to a physical address in the
process space of the owner of the region that maps to the SPINOR
FLASH. Thus, we introduce a flush routine in the lib.rs side that
calls the cbo.flush instruction on every line that has been potentially
modified by the flash write routine.

Note that cbo.flush is not yet natively supported by Rust stable,
so it's coded as a series of hex words fixed to a given register (a0)
to avoid introducing a nightly dependency. Once the cbo.flush
assembly instructions stabilize we can make the assembly read more
nicely, but functionally it should compile to exactly the same code.
2025-07-21 19:09:05 +08:00
bunnie
75556b2321 add feature flags for vexii-test in rootkeys and shellchat 2025-07-21 19:02:21 +08:00
bunnie
a3d350b86f note aes performance on vex-ii; fix typo on aes256soft_test
aes256 soft test was running on hw before by accident.
2025-07-21 17:19:22 +08:00
bunnie
cb7f6d50b1 add vexii-test feature to pddb 2025-07-21 17:14:02 +08:00
bunnie
7dc09bbc73 updated AES library with Vex-II drivers
This will also be the version we'll use for the daric chip once
it's available; the prior software-only version hack for MPW will
be retired soon.

Note that only AES-256 is implemented in this commit, AES-128
isn't used on the system and so is provided as a software-only
fallback path.
2025-07-21 16:34:05 +08:00
bunnie
a858c09e53 add vexii-test feature to aes lib 2025-07-21 03:10:04 +08:00
Sam Chin
04bf756b8e theoretically clean version which has been tested with and without the feature 2025-06-11 15:05:59 +08:00
Sam Chin
0412a401d8 no more deadcode 2025-06-10 21:51:55 +08:00
Sam Chin
2659fc0894 wip'
'
2025-06-10 21:51:55 +08:00
Sam Chin
c9116cffd9 adding line back in 2025-06-10 16:00:16 +08:00
bunnie
59db16aa99
remove debug message 2025-06-09 18:49:28 +08:00
Sam Chin
a25f20d045 making console flags happy 2025-06-09 17:47:00 +08:00
Sam Chin
90d88820dd dropped a ; 2025-06-09 17:37:12 +08:00
Sam Chin
d1b5a41e82 fixing help text 2025-06-09 17:37:12 +08:00
Sam Chin
c291b6a11f now passing the linter 2025-06-09 17:37:12 +08:00
Sam Chin
e5cdeaf2ca adding some cute command line arguments 2025-06-09 17:37:12 +08:00
Sam Chin
1b8554b8f2 removing the BMP180 code 2025-06-09 17:37:12 +08:00
Sam Chin
916c93e276 now with SI units 2025-06-09 17:37:12 +08:00
Sam Chin
b35f9cad33 working read 2025-06-09 17:37:12 +08:00
Sam Chin
b0b29f7d78 reestablishing devenv 2025-06-09 17:37:12 +08:00
bunnie
0d0267f0ea scaffolding the i2cdetect command 2025-06-09 17:37:12 +08:00
Sam Chin
526d8353fd hello world exercise 2025-06-09 17:37:12 +08:00
bunnie
ea3b032fbe add build flags to bao-console
two flags are added:

with-pddb - puts the PDDB commands into the console
battery-readout - turns on the periodic battery readout
2025-06-09 17:20:46 +08:00
bunnie
d17f9881b2 modify user mode i2c lib calls to return nacks
Note that a NACK is returned as an Ok(I2cResult::Nack) - this is
because the Err() path is still reserved for "OS failure" errors.
A Nack isn't a terminal failure, it is a recoverable fault, and
so it's handled in the Ok() path.
2025-06-07 22:56:51 +08:00
bunnie
63c1d975b4 modify result interpretation to allow i2c nacks 2025-06-07 22:56:29 +08:00
bunnie
76a45ff47d add code to the server
this is the actual handler inside the Xous service which, when
receiving the opcode, dereferences its exclusive pointer to the
IRQ bank and then returns the result to the caller.
2025-06-07 02:48:58 +08:00
bunnie
f3e7eec6cf add 'lib' side code for sending the API call to cramium_hal_service
this is the code that exists on the caller's side. It creates
a message with the correct opcode and decodes the result.
2025-06-07 02:48:10 +08:00
bunnie
cfe9b3c845 modify base API for GlobalConfig to auto-infer the API address
the switch based on target is now absorbed into the new() function.
This paves the way for us to add more CSR ranges into the global
configuration object, i.e. IRQ csrs for I2C.
2025-06-07 01:52:25 +08:00
bunnie
6741cba3bd fix hosted mode config issue 2025-05-23 13:18:04 +08:00
bunnie
eb379e22ba figured out my "mystery problem"
I had a feature override in the shell script I was using to wrap
the build. :-/ oops
2025-05-23 13:04:31 +08:00
bunnie
dbdc157ccf cleanup unrelated warning that crept in due to Rust version change 2025-05-23 10:56:43 +08:00
bunnie
d12bdf1494 fix the case of trying to retrieve shell history when none exists
fortunately rust handles this with a panic because it has strict
bounds checking, so this cleans up that panic.
2025-05-23 10:55:38 +08:00
bunnie
73fba43d04 fix emulation mode for baochip target after bringing up metal 2025-05-22 23:48:28 +08:00
bunnie
942a64ea3b fix saturation bug in index computation code 2025-05-21 18:22:30 +08:00
bunnie
f6aa07c20f add domain separator for gen2 keys 2025-05-21 18:22:12 +08:00
bunnie
4526e04abc cleanup some debug output in xous-swapper 2025-05-21 18:21:41 +08:00
bunnie
938f808a8a revert debug flag 2025-05-21 18:05:57 +08:00
bunnie
3004c4ab7f work around a weird feature flag not behaving as we expect 2025-05-21 18:04:02 +08:00
bunnie
8c7edaf107 add a "fake" implementation for the keystore
allows us to test pddb crate before final hardware arrives
2025-05-21 18:03:08 +08:00
bunnie
183916b548 first attempt at layering in a real SPI HAL into PDDB for gen2 targets 2025-05-21 10:23:51 +08:00
bunnie
fe190ea4f1 cleanup warning 2025-05-21 10:23:37 +08:00
bunnie
b63371a56f turn off autotest for now 2025-05-21 10:23:15 +08:00
bunnie
dd5e19878c update flash test routine to remove write flag request 2025-05-21 10:22:27 +08:00
bunnie
1810825744 add block erase routine 2025-05-21 10:20:23 +08:00
bunnie
6c9edc26a3 cleanup some of the HAL dependencies in PDDB
still have some...mysterious...problems around feature
flags that aren't being invoked when i think they should be.

but let's commit this checkpoint because I suspect I may need to
roll back to here several times and I try to figure out the
root cause of the issues.
2025-05-20 14:39:47 +08:00
bunnie
821c6ce47c cleanup dependency tree going down to the cramium-hal layer
remove features that we don't need so as to make the tree as
simple as possible to descend

in particular if we're just pinging the HAL layer for some simple
constants we don't have to pull in the hairball of std targets
2025-05-20 14:38:03 +08:00
bunnie
5d288ec9a8 cleanup dependencies to allow for hosted builds 2025-05-18 09:25:33 +08:00
bunnie
4251686c1f make the flash test optional based on the configuration
allow the console to be built for hosted targets
2025-05-18 09:25:01 +08:00
bunnie
9b13f46741 cleanup notes in toml file so i don't forget to toggle a loader flag 2025-05-18 04:41:21 +08:00
bunnie
de06522499 cleanup debug statement 2025-05-18 04:40:38 +08:00
bunnie
1a34847b19 implement the writepage mechanism
1 - lock the CPU
2 - go into userspace to do the write
3 - on exit from userspace, mark the page as swapped in the original
process so that if it tries to read the data it fetches a new clean
copy
4 - free the page from the RPT so the data can be grabbed later
5 - unlock the CPU
2025-05-18 04:30:52 +08:00
bunnie
24a70b0eb5 implement writepage mechanism, deprecate sync/dirty
writepage uses a *direct* memory message (no rkyv) for efficiency
this saves us an extra page spent on the sideband data shuffling
by loading those args directly into the cpu registers that
get shuttled along with a memory message (the now increasingly
misnamed "advisory" fields of length/valid).
2025-05-18 04:29:06 +08:00
bunnie
4c69961448 rework the test program
this uses the new writepage mechanism, and also tests a couple
of cases. not hard edge cases, but enough that we're not just
testing the 0 case.
2025-05-18 04:28:15 +08:00
bunnie
0bf3366911 attempted cleanup on the sync api to improve the race condition
unfortunately this doesn't get us all the way there. There
is always a chance that the call that marks a page as dirty
is not coupled closely enough to the actual update of the page
data. Without actual hardware support for this we can't use this
approach.
2025-05-17 16:28:57 +08:00
bunnie
7cad369a82 test cases for flash writing on real hardware
reading works fine

writing is still a work in progress.
2025-05-17 16:28:24 +08:00
bunnie
5db2b3449e remove unused "spinor" implementation now that access is delegated to swapper
the explicity "spinor" interface is no longer needed (or even
compatible!) because we now have the swap-mapped spinor layer

the main concern I have at this point is there is a potential race
condition between marking a page as dirty and when the data is actually
updated on the page. Some locking might be necessary to fix this,
but possibly it might be sufficient just to mark a page as dirty
immediately before it's written?

another option might be to handle the writes in an interrupt context
so that the write data + dirty mark are atomic. Need to think about
this a bit.
2025-05-16 19:16:20 +08:00
bunnie
432c2a528e implement dealloc dirty and write to flash
These routines provide for two types of behaviors:

1. deallocating dirty pages. Here, pages are unmapped from RAM
after they are committed to FLASH.

2. write dirty pages to flash. Here, pages are kept mapped in RAM
for future use, but the dirty bit is cleared. This allows the
pages to be quickly released in case of memory pressure.
2025-05-16 19:07:07 +08:00
bunnie
5e2472fa7f add dummy routines so code compiles for precursor target 2025-05-16 19:06:40 +08:00
bunnie
c68d8b1a77 prelim take at a HAL for cramium targets for flash read/write 2025-05-16 19:06:17 +08:00
bunnie
22a72125bd add precursor-hal to dependencies for xous-swapper 2025-05-16 19:05:52 +08:00
bunnie
7533e09f70 move swap abi into lib section; add syscall wrappers for dirty/sync 2025-05-16 19:05:09 +08:00
bunnie
3f96f876c7 more renode tests for flash access 2025-05-16 19:04:30 +08:00
bunnie
e47ed41726 add some prelim test routines for flash access 2025-05-16 19:04:12 +08:00
bunnie
230c577af0 update progress 2025-05-15 11:58:44 +08:00
bunnie
e34dbb4e6f implement a demonstration of successful map decoding of the spi flash request
this just puts dummy data in, next set of commits will do "live"
ROM access.
2025-05-15 11:58:03 +08:00
bunnie
148679af42 more constants location cleanup 2025-05-15 11:56:51 +08:00
bunnie
409e381c2d fix some bit-rotted constants in xous-swapper debug 2025-05-15 11:56:28 +08:00
bunnie
b962bfe26d add some test code for spi flash mapping
this is just to facilitate renode-based testing
2025-05-15 11:55:25 +08:00
bunnie
e2379821e6 republish xous-rs to fix cargo test 2025-05-11 15:36:17 +08:00
bunnie
8a4959056b bump version for xous crate update - commit so we can publish crates 2025-05-11 14:45:24 +08:00
bunnie
ed345ba4d7 cleanup dependency hacks from debbuging pddb issue 2025-05-11 14:42:26 +08:00
bunnie
f76dd23067 fix weird PDDB dependency issue
more of a work-around than anything else. the observation is
the PDDB_A* series of constants aren't used outide of the crate
for gen2-targets and so we just remove it as a dependency in
the lib.rs side of things.

This clears up the cargo error we're getting. still don't know
why the dependency tree is not working for that particular target,
but someone is pulling a pddb dependency and it's not obvious who.
2025-05-11 14:40:19 +08:00
bunnie
fbcb59c69e migrations applied to pddb
still broken, there is a weird dependency problem on
board-baosec target that is still to be debugged, but
wanted to get everything committed so i can try bigger
experiments without losing state
2025-05-11 12:59:00 +08:00
bunnie
52ee66e1a5 migrate kernel-to-board platform constants for swapper 2025-05-11 12:46:01 +08:00
bunnie
805ebd22a3 revert a couple things that were not meant to be committed 2025-05-11 12:45:29 +08:00
bunnie
4ef4b22cfc incorporate hal migration into bao-console 2025-05-11 12:41:39 +08:00
bunnie
ca04a3ea82 incorporate arch migrations into early-settings 2025-05-11 12:37:51 +08:00
bunnie
ee6fb3ef4f arch migrations make PDDB_LEN harder to reach in modals
this constant was just used to create a "realistic" test case
instead of trying to add the dependency we just hard-code the
constant into the test case, because in the end what we wanted
was that specific constant to test a specific edge case of
a progress bar.
2025-05-11 12:36:46 +08:00
bunnie
42c6417e46 incorporate rach mirgations into net 2025-05-11 12:36:33 +08:00
bunnie
6de085657a incorporate arch migrations into dns 2025-05-11 12:36:20 +08:00
bunnie
a71873cb7a incorporate migrations into root-keys 2025-05-11 12:34:17 +08:00
bunnie
b6ab55c6b8 incorporate arch migration into shellchat 2025-05-11 12:33:50 +08:00
bunnie
8a74ed6078 incorporate arch migrations into spinor 2025-05-11 12:32:29 +08:00
bunnie
ee22ff783c incorporate arch migrations to status 2025-05-11 12:32:05 +08:00
bunnie
a0c1b1e75a incorporate arch migrations to usb-device-xous 2025-05-11 12:31:46 +08:00
bunnie
ae2d137e12 incorporate arch migrations to xous-susres 2025-05-11 12:29:55 +08:00
bunnie
58f20057b4 update strategy 2025-05-10 08:22:38 +08:00
bunnie
c7225d227d migrate pddb size to board:: and fix boot init
the policy is to format the PDDB automatically on boot if
it can't be mounted.

Need to think about whether this is the right thing to do
or not for the product: if there is any sort of error, it will
just wipe the PDDB entirely, making it unrecoverable.

That being said, why would there be an error? if that happens,
something bad probably happened to the hardware. I feel like
if the SPI interface is reliable this shouldn't be a problem.
So the solution is to make sure the hardware is reliable...
on the other hand, fundamentally, SPI flash can wear out, so
this could aggravate problems at EOL for the device (i.e.
it will take small problems and "amplify them up" into a huge
problem).

The trade-off is...the auto-format makes the token "just work"
on boot. Maybe the right thing to do is to add some code that
checks to see if we're in a true blank state, and if so,
autoformat; and if it looks like something was there before,
prompt for a format?

tbd.
2025-05-08 16:06:42 +08:00
bunnie
f92839602e feature flag fixes for moving sizes to board:: 2025-05-08 16:04:36 +08:00
bunnie
fe599c2fe0 migrate lengths to board:: for gen2; fix opcode numbering bug
opcode numbering bug only affects test mode, fortunately. just
bit-rot from tests long not run...
2025-05-08 16:03:48 +08:00
bunnie
2ea777e04f fix key encoding bug; set DNA to "0" in emulation mode
this matches what's done in hosted mode, allowing the analysis
scripts to work on the images generated by this version
2025-05-08 16:02:52 +08:00
bunnie
34a1a33165 fix off-by-one arg error on Dna routine
this is a common api problem because yes, while arg1 is strictly
the second item, previously arg0 was hidden and in the argument
list arg1 took the first place not the second. so i make this
mistake a lot...
2025-05-08 16:01:46 +08:00
bunnie
0cb80c2afb remove sizes from the emu lib, so it can live in board:: 2025-05-08 16:01:11 +08:00
bunnie
5417c2bd87 add more test features to the console; absorb board:: api for sizes 2025-05-08 16:00:28 +08:00
bunnie
399742a3d4 feature-out some battery testing code in hosted mode 2025-05-07 23:10:04 +08:00
bunnie
231aff1f80
Merge pull request #641 from betrusted-io/axp-batt
Battery settings to confirm/test prior to fusing out TG28
2025-05-06 19:14:43 +08:00
bunnie
a2d9699bee fix argument change in api 2025-05-06 19:06:23 +08:00
bunnie
c5d2689e12 add periodic updates from the charger 2025-05-06 19:06:04 +08:00
bunnie
1a3b9131d1 reduce debug out put as this makes it hard to see what's going on in CI 2025-05-06 12:54:34 +08:00
bunnie
ef97e33ae4 fix pddb in doc-deps target 2025-05-06 03:15:51 +08:00
bunnie
4640213410 fix hosted mode 2025-05-06 03:06:21 +08:00
bunnie
89d6b0e81f debug checkpoint
left off at trying to debug the PDDB mount process.
2025-05-06 02:07:31 +08:00
bunnie
15dd0a7f17 cleanup warnings 2025-05-06 02:07:16 +08:00
bunnie
feeaa6341c improve bao-console interaction and add pddb mount call 2025-05-06 02:06:41 +08:00
bunnie
8e161d7e9d we're at least booting now and talking to the pddb service 2025-05-06 01:51:29 +08:00
bunnie
a4e86eead5 cleanup some gen1/gen2 differences 2025-05-06 01:49:42 +08:00
bunnie
095939ee53 allow multiple listeners in gen2 targets
this simplifies a bunch of stuff when we can trust the internal
code base
2025-05-06 01:48:37 +08:00
bunnie
30fcc3016f use bao-video to route the acquire/release of the modals focus
it has to route through here anyways, so this is the sensible
place to also forward on the keyboard release/acquire messages
2025-05-06 01:47:55 +08:00
bunnie
8a2651e9cb add no-gam coordination of keyboard hits based on focus of keys
modals has to be able to acquire/release focus without the
assistance of the GAM in a no-gam model.
2025-05-06 01:46:56 +08:00
bunnie
8d896b4dba add pddb command to bao-console 2025-05-06 01:46:34 +08:00
bunnie
b2f32b7b6f add an emulated keystore for hosted mode
this is a dummy keystore so we can test other UX operations.
the full keystore will be a lot harder to write.
2025-05-06 01:45:53 +08:00
bunnie
1ee1239494 fix hosted mode lifetime issue 2025-05-05 01:52:43 +08:00
bunnie
34e9a1f1ce gen2 apis now compiling clean
system doesn't work yet because none of the keystore is there, but
at least we don't have conflicting/missing APIs
2025-05-05 01:49:39 +08:00
bunnie
86b079f2f4 add spinor defs to cramium-emu
this is a shim that reps both boards and "chips" for hosted mode
so it's OK to mash them together as a synthetic target
2025-05-05 01:49:05 +08:00
bunnie
e3cb5e495c remove spinor defs from the swapper
should be defined in the board, not in the swapper
2025-05-05 01:48:46 +08:00
bunnie
71f444ff3d API framework for the keystore 2025-05-05 01:48:28 +08:00
bunnie
87140a2024 cleanup the api a bit more
realized it was dumb to have separate file paths for the
orthogonal implementations
2025-05-04 19:12:51 +08:00
bunnie
c8db01c563 re-org rootkeys-api into common and generation-specific libraries 2025-05-04 19:05:58 +08:00
bunnie
9d6223d0b2 pddb migrations for keystore-api 2025-05-04 18:34:33 +08:00
bunnie
2c47db081d other crates affected by api migration 2025-05-04 18:34:17 +08:00
bunnie
7c6ecf308e migrate rootkeys api to keystore-api 2025-05-04 18:34:01 +08:00
bunnie
22433fa25c reconfigure toml files for pddb target testing
OK, i think this gets us to the starting point of shaving down
the PDDB crate from the restored baseline
2025-05-04 17:03:00 +08:00
bunnie
8e52d4ca5d minor cleanup on swapper crate
still a lot of warnings but the code is all stubs so that's normal
2025-05-04 17:02:15 +08:00
bunnie
48c6ce7232 cleanup non-spinor config for xous-swapper
this allows us to build configs that aren't in the dev path
without errors
2025-05-04 17:00:08 +08:00
bunnie
f9c42f6176 rollback pddb to previous known good state
restart the refactor process now that the modals arc is finished.
2025-05-04 16:40:13 +08:00
bunnie
142d55a2b7 this was meant to be committed with the previous commit 2025-05-04 16:34:12 +08:00
bunnie
ae23121d6a checkin work state before we rollback the pddb area
i have decided that the current approach sucks, and i'm going
to abort the work in the pddb area. however, the stuff in
the rest of the branch is pretty useful, so we'll just revert
the stuff inside the pddb directory.
2025-05-04 16:33:12 +08:00
bunnie
abbffaaf20 more restructuring of pddb codebase
in particular, spinor driver stub does not belong in this crate
2025-05-04 03:34:01 +08:00
bunnie
0b4ff70798 remove modal testing as it's not needed in this branch 2025-05-04 03:33:09 +08:00
bunnie
b2098916c7 start to add a spinor driver into xous-swapper
the hardware interface for SPIM is shared between both
RAM and FLASH, therefore, the drivers need to be co-located
in the same crate.
2025-05-04 03:31:15 +08:00
bunnie
c6123f1aec add a placeholder for keystore 2025-05-04 03:29:53 +08:00
bunnie
2699146d62 integrate gc2145 into userspace
couple of notes:

- bw threshold is now dynamic, based on the average of the previous frame
- performance is a bit slower than ideal, because of the SPI back pressure
bug preventing us from reading out the video at full speed. This should
be better on NTO.
- rotation introduced so that the preview image should align up
with what we'll have in the final camera v. display orientation in
the baosec product
- tested against the TOTP test suite (edent.codeberg.page/TOTP_Test_Suite/)
and it can quickly capture all of the basic valid tests.
2025-05-01 16:41:03 +08:00
bunnie
535153e0cb switch cameras and move YUV setting into driver 2025-05-01 04:09:52 +08:00
bunnie
19e9bcb104 add emulation stub for gc2145 2025-05-01 04:08:06 +08:00
bunnie
e7a2c97ca3 some progress on compatibility 2025-04-29 22:32:59 +08:00
bunnie
86fb450ab4 improve compatibility of signatures 2025-04-29 22:28:20 +08:00
bunnie
2cca6ac13f
Merge branch 'main' into pddb-feat-down 2025-04-29 03:27:33 +08:00
bunnie
ed797e6a82 scrolling tests 2025-04-29 03:03:54 +08:00
bunnie
735a93756f add modes and flags for testing 2025-04-29 03:03:36 +08:00
bunnie
94969feb3c modify the entry validator test to work the numeric OSK selection 2025-04-29 03:03:13 +08:00
bunnie
0d2ecc1db3 add missing modals release calls 2025-04-28 19:03:06 +08:00
bunnie
74b427e1c4 shorten description string
this allows the test to run more nicely on small screen devices
2025-04-28 18:56:33 +08:00
bunnie
5021afcbda quiet down debug 2025-04-28 01:18:43 +08:00
bunnie
f204fd4c54 add breadcrumb note 2025-04-21 00:38:38 +08:00
bunnie
d1860fee56
Merge branch 'main' into pddb-feat-down 2025-03-05 20:57:35 +08:00
bunnie
5a36ebbb58 setup modals testing feature in the console runner 2025-03-05 20:50:09 +08:00
bunnie
77d18530f7 match dependencies on modals tests to platform 2025-03-05 20:47:51 +08:00
bunnie
7f860e058c add handler for object list drawing 2025-03-04 19:07:10 +08:00
bunnie
1a2d6bf772 intercept and warn on more v2 calls in v1 implementation 2025-03-04 19:02:15 +08:00
bunnie
938e8388e0 add modals acquire/release logic to the graphics layer 2025-03-04 02:05:21 +08:00
bunnie
0790a2dc16 more feature wrangling 2025-03-04 02:04:50 +08:00
bunnie
aafec72e64 add keyboard listener to modals in cramium targets 2025-03-04 02:04:22 +08:00
bunnie
a013720b6f more dependency fixup 2025-03-04 01:29:13 +08:00
bunnie
3be69cf8d1 cleanup dependencies and inter-dependent features 2025-03-04 01:28:38 +08:00
bunnie
4c16d42d45 fixup features 2025-03-04 01:27:37 +08:00
bunnie
56890c35c9
Merge branch 'main' into pddb-feat-down 2025-03-03 02:17:36 +08:00
bunnie
9297879f76 select trng based on emulation mode 2025-03-03 02:15:46 +08:00
bunnie
d1ec6e021a add feature adapters for bao-console so it can work in hosted mode 2025-03-03 02:15:16 +08:00
bunnie
531f5ee4f9 add modals testing mode 2025-03-03 02:14:58 +08:00
bunnie
3dec223d9d allow modals testing in more modes 2025-03-03 02:14:43 +08:00
bunnie
85a216ff0f add a warning if v2 api is sent into graphics-server which is v1 only 2025-03-03 02:14:05 +08:00
bunnie
558b96cfd5 add missing api for emulation 2025-03-03 02:13:52 +08:00
bunnie
af043c3a18 make usb-cramium suitable as a dependency for hosted emulation 2025-03-03 02:09:30 +08:00
bunnie
286bfb8135 fix hosted mode build 2025-02-28 17:52:20 +08:00
bunnie
26a147d1b8
Merge branch 'main' into pddb-feat-down 2025-02-28 17:45:06 +08:00
bunnie
e84daa0179 fixup more emulation issues 2025-02-28 17:42:30 +08:00
bunnie
cb0cfb3f2c cleanup dependencies 2025-02-28 17:31:14 +08:00
bunnie
5dcf0e33aa customize graphics testing routine for small screen 2025-02-28 17:30:51 +08:00
bunnie
db4d21c54c fix emulation bugs 2025-02-28 17:29:43 +08:00
bunnie
e829b4b4fb cleanup debug info in main 2025-02-28 16:37:28 +08:00
bunnie
bda9340045 cleanup pass-by ref change it blitstr api 2025-02-28 16:36:51 +08:00
bunnie
4710b416be cleanup trait implementation to match modifications
remove mutability from get_pixel
2025-02-28 16:36:24 +08:00
bunnie
ebd9b6e823 cleanup emulation layer to match hardware exactly 2025-02-28 16:36:06 +08:00
bunnie
002bc74d3f fix text rotation 2025-02-27 21:38:03 +08:00
bunnie
3e11c37400 fix missing path expansion in precursor target 2025-02-26 14:59:23 +08:00
bunnie
3ed1b2d707
Merge branch 'main' into pddb-feat-down 2025-02-26 14:58:05 +08:00
bunnie
4f067dc090 add gfx-testing option to bao-video 2025-02-26 14:46:47 +08:00
bunnie
cd34d0179e harmonize the apis in bao-video 2025-02-26 14:46:01 +08:00
bunnie
f3ff84cd05 fix off by one in bounds check for display size 2025-02-26 14:45:31 +08:00
bunnie
d0793b0aef fix dependencies on testing routine 2025-02-26 14:36:26 +08:00
bunnie
111d8f8d3d refactor graphics server to use reply_and_receive_next()
This new api allows for scalar-5 returns as well as more
efficient use of the scheduler's quantum by not simply yielding
time when a message is returned; it will fetch the next message
and process it until its time is up.
2025-02-26 14:35:33 +08:00
bunnie
f2d59e1ec6 fixup emulation to read the raw bitmaps identically to hardware 2025-02-24 02:41:57 +08:00
bunnie
a66a541488 pass the cramium-soc flag to blitstr2 when compiling for hardware 2025-02-24 02:30:07 +08:00
bunnie
275ae9b96c fix warnings 2025-02-24 00:59:20 +08:00
bunnie
8baaf201e6 fix back buffer swapping 2025-02-24 00:58:57 +08:00
bunnie
f922274070 fix configuration 2025-02-24 00:58:38 +08:00
bunnie
0eef3cd0e4 cleanup warnings 2025-02-23 18:20:29 +08:00
bunnie
1e007035cb modify bao-video to use shared handlers 2025-02-23 18:08:50 +08:00
bunnie
e0462f1603 modify graphics-server to use shared handlers 2025-02-23 18:07:16 +08:00
bunnie
172333c078 accommodate panic handler 2025-02-23 16:52:49 +08:00
bunnie
ef6ce40117 implement panic handler - first draft, untested 2025-02-23 16:52:32 +08:00
bunnie
8bd01bd65d
Merge branch 'main' into pddb-feat-down 2025-02-23 12:15:49 +08:00
bunnie
8c9abf6c5b add implemnetation for most graphics primitives
this is mostly a copy of what's in graphics-server. Perhaps
we can find a way to share the code between the two, but I
am going to leave it duplicated for now because it's unclear
if I can use this implementation as-is, or if it needs lots
of modifications.

If it turns out to basically work without mods, then, we can
wrap a bunch of the opcode dispatch into mega-function perhaps
that takes a display and opcode as parameters and wraps a lot
of the boilerplate into a re-usable routine.
2025-02-23 12:05:00 +08:00
bunnie
460b1543f0 add missing drawing primitives to hosted mode abstraction 2025-02-23 12:03:55 +08:00
bunnie
ef79ececb7 modify graphics-server to ignore unimplemented opcodes
the opcode list is shared between multiple implementations, so
an invalid opcode might not necessarily be a severe bug.
2025-02-23 12:03:09 +08:00
bunnie
e157d6e242 add placeholder panic server 2025-02-23 12:01:01 +08:00
bunnie
fabb3174c7 specify the doc-deps feature in ux-api so that cargo doc builds correctly 2025-02-22 01:07:31 +08:00
bunnie
9d76eda111 modify graphics-server to use the framebuffer trait 2025-02-21 23:43:26 +08:00
bunnie
10b7246bcc modify graphics-server backends to use the framebuffer traits 2025-02-21 23:43:05 +08:00
bunnie
d3278fccf4 add missing trait implementations
these aren't currently used, and probably won't be used in
the future? so just some stand-in code is used that isn't
too carefully thought-out.
2025-02-21 23:42:17 +08:00
bunnie
7c4a97da97 formatting fixes 2025-02-21 18:02:20 +08:00
bunnie
629d5c632d cleanup redundant files
this code has now all been migrated to ux-api
2025-02-21 17:58:29 +08:00
bunnie
69c2b84e42 bao-video: fix dependencies and minor API tweaks due to ux-api refactor 2025-02-21 17:52:41 +08:00
bunnie
2172046424 cleanup api changes related to opcode call renaming 2025-02-21 17:51:25 +08:00
bunnie
21a2592398 conten-plugin-api: use platform-neutral ux-api instead of graphics-server 2025-02-21 17:49:37 +08:00
bunnie
0f935a9a75 cram-console: use platform-neutral ux-api instead of graphics-server 2025-02-21 17:49:29 +08:00
bunnie
c8d00e890b ime-frontend: use platform-neutral ux-api instead of graphics-server 2025-02-21 17:49:13 +08:00
bunnie
5864d0fbeb ime-plugin-api: use platform-neutral ux-api instead of graphics-server 2025-02-21 17:48:59 +08:00
bunnie
ac673425da root-keys: use platform-neutral ux-api instead of graphics-server 2025-02-21 17:48:48 +08:00
bunnie
9cbe4a9721 shellchat: use platform-neutral ux-api instead of graphics-server 2025-02-21 17:48:38 +08:00
bunnie
931cf8f945 status: use platform-neutral ux-api instead of graphics-server 2025-02-21 17:47:53 +08:00
bunnie
8cdce12efc refactor gam to point to ux-api for graphics primitives 2025-02-21 17:47:32 +08:00
bunnie
813b72c863 refactor graphics-server to use ux-api for the "lib" layer
graphics-server now becomes just one possible implementation
of the API layer
2025-02-21 17:47:02 +08:00
bunnie
8cd43cab20 update to use new api opcode name 2025-02-21 02:03:33 +08:00
bunnie
83cc5e5a6a fix drawing inversion & color mapping 2025-02-21 02:03:07 +08:00
bunnie
7bb50974ce cleanup warnings 2025-02-20 20:51:04 +08:00
bunnie
8859f3eff5 cleanup warnings 2025-02-20 20:50:43 +08:00
bunnie
b5a10fe0db fix emulation bugs 2025-02-20 20:40:39 +08:00
bunnie
10be900e11 migrate opcodes to neutral api crate 2025-02-20 20:39:50 +08:00
bunnie
f798f5cf3d fix doc-deps configuration 2025-02-20 18:37:58 +08:00
bunnie
547aac5056 fix lifetime issue on irq handler binding
using scoping for feature flags is tricky. also this
is like, all totally unsafe code.
2025-02-20 15:49:05 +08:00
bunnie
a2b0a28ee1
Merge branch 'main' into pddb-feat-down 2025-02-20 15:11:01 +08:00
bunnie
5e825aa38c move cramium-emu path as it migrated location 2025-02-20 15:07:27 +08:00
bunnie
2e060e7bc3 bring xous-swapper up to api spec 2025-02-20 15:07:11 +08:00
bunnie
5ffacf63f3 cleanup bao-video to use the new API
also condense main into a single routine again, now that
we have gone through the trouble of creating interoperable
APIs.
2025-02-20 15:06:15 +08:00
bunnie
87c0e5ed12 re-org cramium-hal-service to reflect new API organization 2025-02-20 15:05:55 +08:00
bunnie
1cb2b1f7ca bring bao-console up to API spec 2025-02-20 15:05:34 +08:00
bunnie
5809afebe0 add a crate dedicated to hosted-mode emulation of baosec-target items 2025-02-20 13:26:33 +08:00
bunnie
14bfa42aec fixup feature specifiers 2025-02-18 23:21:41 +08:00
bunnie
e4292c38e7 cleanup path specifiers to methods to improve portability 2025-02-18 23:21:14 +08:00
bunnie
f731fadf89 add emulation mode to log server 2025-02-18 23:19:41 +08:00
bunnie
4033a3a4d2 add emulation mode to names server 2025-02-18 23:19:29 +08:00
bunnie
4e59c0f07c add emulation mode to ticktimer 2025-02-18 23:19:16 +08:00
bunnie
49f14d32c9 add doc-deps target to modals 2025-02-18 10:16:06 +08:00
bunnie
23c96f2d96 add a default graphics library for cargo doc runs
'gam' in the case of modals.
2025-02-17 22:55:29 +08:00
bunnie
13590c302a fix warning in doc comment 2025-02-17 22:54:27 +08:00
bunnie
416cf34aa0
Merge branch 'main' into pddb-feat-down 2025-02-17 18:35:57 +08:00
bunnie
b67e8ac798 update gam to refer to blitstr2 crate 2025-02-17 18:27:36 +08:00
bunnie
b474560fc3 status to use blitstr2 2025-02-17 18:26:02 +08:00
bunnie
0e6c344f7a shellchat to use blitstr2 2025-02-17 18:25:52 +08:00
bunnie
812becb9a5 root-keys to use blitstr2 2025-02-17 18:25:40 +08:00
bunnie
10a1c72f35 refactor graphics-server to use new blitstr2 crate 2025-02-17 18:25:18 +08:00
bunnie
b788ed6633 move blitstr2 to its own library
this allows us to share font data between platforms without
replicating the code base
2025-02-17 18:24:39 +08:00
bunnie
e1bc6eac56 remove copy of blitstr2 from ux-api; move blitstr2 to lib location 2025-02-13 17:41:07 +08:00
bunnie
b76f02bb11 get past some configuration issues 2025-02-13 17:38:14 +08:00
bunnie
edab1ddcf2 refactor bao-video structure to facilitate hw and hosted modes 2025-02-13 17:30:04 +08:00
bunnie
0bfb864873 add boasec to font feature selection; prepare for moving blitstr crate 2025-02-13 17:26:54 +08:00
bunnie
79e95742b9 light-fingered changes to the modals layer to accommodate ux-api
trying to keep this layer as cross-compatible as possible while
compressing the stack underneath it
2025-02-11 16:26:13 +08:00
buncram
60c28c10b4 patch modals to handle multiple platform targets 2025-02-11 08:36:58 +08:00
bunnie
c0822a6109 refactor bao-video to use ux-api 2025-02-02 07:02:53 +08:00
bunnie
54ba8c9cf7
Merge branch 'main' into pddb-feat-down 2025-02-01 22:29:55 +08:00
bunnie
4f14a67504 formatting changes due to changes in nightly rust
needed to get a clean check on gh
2025-02-01 22:26:40 +08:00
bunnie
858d7a739f part way through the main module, we have more clarity on the task
i think it's becoming clearer at this point that other elements
need to be implemented before we can attack this. leaving notes
and bread crumbs so I can come back to this branch later
2025-02-01 02:37:33 +08:00
bunnie
ecaab9041f add the hw module 2025-02-01 02:37:09 +08:00
bunnie
deb2b6ac53 add an interim shim for the spinor implementation
The Spinor struct will be pulled into the PDDB for the cramium
version. This is done in part to reduce the number of servers
(keep the memory footprint light) and also because the physical
spinor hardware is owned by the swapper crate (because the ROM
shares a bus with the swap RAM). So, all that is needed in
this case is a thin shim that can adapt the two APIs to be
compatible with each other.

THe currently checked in code is just a copy of the existing
spinor code tho - it has no bearing on reality, it's just there
as a placeholder that contains all the APIs.
2025-02-01 02:35:26 +08:00
bunnie
aea415cca8 figure out changes necessary at the external API level 2025-02-01 02:35:09 +08:00
bunnie
73458dbd4c make a wish list of the dependencies we want to isolate
gate the dependencies behind a "gen1" and "gen2" feature
flag.
2025-02-01 02:31:59 +08:00
bunnie
5f11dadde7 update todo 2025-01-03 04:12:41 +08:00
bunnie
80f0dd2ba7 add reminder for where the verbose debug feature lives 2025-01-03 04:09:57 +08:00
bunnie
e5fdd5da77 add bitfield crate depedency 2025-01-03 04:09:32 +08:00
bunnie
96073cc12e add Iox IRQ registration and event forwarding
the Iox block can register up to 8 interrupts on any of the
GPIO pins on the device. All the interrupts get OR'd together
to generate a single interrupt to the CPU, which has to be
disambiguated and forwarded on to the registering server as an
event.

Due to the protection model of Xous, the configuration of
the IRQ has to be centralized, and the handling is done with
a message. This means that the actual time from the interrupt
to the handling can be a bit variable, up to several ms, so
this method isn't suitable for hard real time.

For hard real time stuff, see the implementation in the USB
stack for Cramium, which has a very timing sensitive IRQ
handler requirement.
2025-01-03 04:07:20 +08:00
bunnie
af6289b8e4 add USB unplug/replug handling & stack resetting 2025-01-03 04:06:48 +08:00
bunnie
e66303e044 add fix discovered during sim testing 2025-01-02 01:02:08 +08:00
bunnie
6d3c50144e
Merge branch 'main' into usb-irq 2025-01-01 17:03:32 +02:00
bunnie
72968701b9 cleanup feature bitrot and use loopback for testing 2025-01-01 22:53:04 +08:00
bunnie
fd7e2f8281 remove writes to non-existent test register; flush FIFO on overrun
The overrun test needs to flush the fifo when it's done (it's a
deliberate error test).

Also remove access references to a peripheral that no longer exists
2025-01-01 22:52:09 +08:00
bunnie
99088936bb have the -fpga variant use the debug UART for console output
we only can watch one uart in the simulation environment (for now)
2025-01-01 22:46:38 +08:00
bunnie
2090288009 add a test loop to check the IRQ pin configuration
this all seems to work as expected now, next up: hooking the
interrupt handler for the IOX.

Probably should put the actual IRQ router in the HAL so that multiple
services can configure it, but have the handler actually invoke
a function in our address space.
2024-12-27 20:02:08 +08:00
bunnie
19780161bb add PMIC feature to the HAL 2024-12-27 20:01:51 +08:00
Jeanie
e1ff04b1fc fix set_devboot docs 2024-12-24 00:59:09 +08:00
Jeanie
f8bce54bd0 fix circle docs typo 2024-12-24 00:59:09 +08:00
Jeanie
9e888252c1 note for stash method, a few other updates 2024-12-24 00:59:09 +08:00
Jeanie
e8f165000c a few more drawings 2024-12-24 00:59:09 +08:00
Jeanie
16782f1f25 first half of images 2024-12-24 00:59:09 +08:00
Jeanie
5850794fa0 rearranging docs image location for better organization 2024-12-24 00:59:09 +08:00
Jeanie
6257fb4640 placeholders for example images, small docs update 2024-12-24 00:59:09 +08:00
Jeanie
52869a21f2 take out some repetitive wording 2024-12-24 00:59:09 +08:00
Jeanie
61f1ffdc9d all examples are now tested/fixed 2024-12-24 00:59:09 +08:00
Jeanie
5043a7bd39 some basic documentation 2024-12-24 00:59:09 +08:00
bunnie
6b51ad1c4f strip out cramium-soc code from usb-device-xous
programs should now use the usb-cramium crate for a USB
stack. It preserves the `lib` API, so you /should/ be able to
integrate it seamlessly by just renaming crates between
the two.
2024-12-24 00:54:58 +08:00
bunnie
d9f8b5bcfc add local panic handler for the USB stack
also clean up some debug statements and add a TODO list
2024-12-24 00:37:09 +08:00
bunnie
e0b6d96fbd cleanup USB integration at the service level 2024-12-23 01:21:44 +08:00
bunnie
568a15dc4f minor cleanup in this crate, although, a much larger cleanup is coming
we're going to strip out the USB cramium support from this crate
eventually because it has migrated to a stand-alone crate

the hardware model is just too different to keep the two branches
in sync: one allows interrupts to be delegated to userspace, the other
requires the interrupts to happen all in the locked handler context
due to timing assumptions of the core.

the problem with the interrupt handler context is that panics
are really hard to debug - you can't actually send a panic message
from an interrupt context, because there is no IPC when the
handler is running. Normally we try to keep the handlers as
minimal as possible, but in this case we can't due to hardware
assumptions.
2024-12-23 01:19:21 +08:00
bunnie
99ab382d99 add a usb test routine to the console api
this one just sends a string as if typed on a keyboard.
2024-12-23 01:16:42 +08:00
bunnie
a92c23bce6 massive commit-ball for big breaking USB refactor
This commit turns the USB stack inside out and puts
the handler in a protected IRQ section so that it can't be
interrupted during event processing.
2024-12-22 00:35:45 +08:00
bunnie
831f279a8b add pid reporting to hal services startup 2024-12-22 00:35:12 +08:00
bunnie
fa067f1137 retrofit swapper so that its print function can be selected out
so that we can share app uart with other processes that need it for debug
2024-12-22 00:32:40 +08:00
bunnie
d1835f8e4b add PID reporting to console boot 2024-12-22 00:28:33 +08:00
bunnie
45a8eb2227 stage tomls for version bump: try_send added to xous-ipc 2024-12-16 18:50:11 +08:00
bunnie
e90bd02cae note that debug-print needs to be mutually exclusive
...with other crates that might want to use the application
console, e.g., the USB crate.
2024-12-16 18:03:11 +08:00
bunnie
eb7973f939 make the keyboard API more public
this allows us to access the mappings function in other crates
2024-12-16 18:02:42 +08:00
bunnie
9a0bbbd2fb initial stab at a usb-cramium implementation
The approach here turns the usb-device crate "inside out". The
working hypothesis for the unreliability of the previous implementation
is that we try to do all the IRQ-handling in userspace, where
the operation can be pre-empted. Unfortunately, this doesn't set well
with the corigine USB hardware driver, as it assumes that it has
the full CPU attention while its state is being manipulated (and
some things must be responded to in basically real time otherwise
you get protocol inconsistencies).

In this implementation, we use the Xous subsystem to do the
API-level exchanges of information to a USB handler that, for the
most part, runs directly inside an IRQ context.

There's some trickiness in terms of sharing the hardware state
across the boundary between IRQ and userland, but most of it
got handled I think fairly cleanly in this implemnetation by
using the xous-native server queuing mechanism to shuttle data
in between the two domains. The main spot where I think panics
can creep in is in data transmission, where the Tx data is
shoved into a RefCell and then the IRQ is invoked to pull the
data from a RefCell. As long as we don't invoke the IRQ to
pull data from the RefCell while it's borrowed mutably, we should
be OK.

Wrapping the structure in a Mutex actually doesn't help here
because the IRQ context can't do a "wait" to get a lock - it
would never get it, because it's in an uninterruptable context.
Thus we skip the complexity of a Mutex and let Rust panic if
we mesesd up the data hand-off.
2024-12-16 17:56:05 +08:00
bunnie
a5ebcf5d0f refactor reset api for UDMA
there's now unfortunately branch divergence in the NTO/MPW
code base

The methodology is to code like we're running on NTO, and
if the "mpw" feature is selected, we put hacks in to run
on MPW hardware.

Under the theory that MPW should be totally deprecated
once NTO comes out, and therefore the hacks should accumulate
in the MPW code base (and ideally be somewhat easy to cull when
the time comes).
2024-12-06 03:28:13 +08:00
bunnie
a57f3f1977 rework camera main loop to be interrupt driven
this will free up some time for concurrent processing instead of
spin-waiting on new frames
2024-12-04 16:15:58 +08:00
bunnie
93b9ec00bf bump version numbers on all the packages so we can absorb num-derive changes 2024-12-02 19:14:11 +08:00
bunnie
2ace34abee cleanup static mut warning in hosted mode 2024-12-02 18:54:44 +08:00
bunnie
e4e6db8bc9 fix implicit lifetime warning 2024-12-02 18:54:26 +08:00
bunnie
83e26ff4c7 update num-derive dependency
this became mandatory in 1.83 to remove warnings. I think it
should have no impact on functionality.
2024-12-02 18:52:59 +08:00
bunnie
41078a71fe feature-out the quantum time 2024-12-02 01:22:18 +08:00
bunnie
147cfb8c97 remove xous-pio references in cargo files 2024-12-02 01:21:57 +08:00
bunnie
2d322d852c cleanup warnin 2024-11-20 20:36:57 +08:00
bunnie
dfe5d50f41 start to lay in the APIs for the USB interface in userspace 2024-11-20 01:46:34 +08:00
bunnie
e42b7195b0 add notes about performance improvement for the future 2024-11-19 22:21:48 +08:00
bunnie
d78899ca74 implement retry on SPIM failure
somehow, the retry still *fails* - to be looked into in the future
2024-11-19 22:17:19 +08:00
bunnie
265805ac94 cleanup warnings 2024-11-19 22:17:07 +08:00
bunnie
4a99341269 cleanup warnings 2024-11-14 22:19:40 +08:00
bunnie
fac7adca35 improve UX a little bit 2024-11-14 00:36:24 +08:00