Commit graph

8007 commits

Author SHA1 Message Date
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
c3f5b8192b
Merge pull request #607 from betrusted-io/usb-breaking-change
Usb breaking change
2024-12-24 00:58:41 +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
5aac426b0b more deep API cleanup
realizing a bunch of stuff like the stack expects you to enqueue
the OUT receiver with calls to read() that happen to block, fixing
max packet size that can be different for in and out end points,
and handling quirks of the core when sending setup packets longer than
64 bytes.
2024-12-23 01:18:03 +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
f2886d38f4 add usb to the console API 2024-12-23 01:16:30 +08:00
bunnie
8c0cfd9eab clean up unused args in API 2024-12-23 01:15:49 +08:00
bunnie
4fc359dd76 add dependency for accessing system registers
used for debugging some IRQ issues
2024-12-22 00:37:56 +08:00
bunnie
c044b3481d beginning of breaking change to the cramium usb hal implementation
the UsbBus implementation is being totally rewritten for the
inside-out IRQ protected scheme.

we can now get past some preliminaries in the link protocol
(i.e., address setting and the first config descriptor), but
a long way to go still in debugging.
2024-12-22 00:36:57 +08:00
bunnie
9a1a6271c5 add debugging configuration features 2024-12-22 00:36:33 +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
e8fd388ae9 add support for paged mode debugging
we have to allocate the virtual page in our process space before
we can use the debug UART.
2024-12-22 00:34:16 +08:00
bunnie
6625e45dd2 remove a debug print that causes the uart to be claimed prematurely
the uart in the shared library is claimed by the first process
that touches it, so prints in the shared library at early boot have
to be carefully configured
2024-12-22 00:33:16 +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
6dcb23a53b add flags for configuring uart 2024-12-22 00:32:14 +08:00
bunnie
44f50a992a add irq disabling routine 2024-12-22 00:31:54 +08:00
bunnie
c66a7c47fb another spot where the irq enable has to be moved 2024-12-22 00:31:32 +08:00
bunnie
e07ab36984 fixup IRQ handling
- disable IRQs on departure
- put EV enable outside of the HAL function
this is necessary because we need all HAL calls to be finished
before an interrupt happens to avoid locking problems
2024-12-22 00:30:27 +08:00
bunnie
b66b60497b make the app uart configurable
so processes other than swap can use it
2024-12-22 00:29:50 +08:00
bunnie
d1835f8e4b add PID reporting to console boot 2024-12-22 00:28:33 +08:00
bunnie
f7b95dc942 configure baosec for usb dev 2024-12-22 00:28:13 +08:00
bunnie
c204e4b4a3 update timestamp on imported file 2024-12-22 00:27:54 +08:00
bunnie
5ea6a349ee
Merge pull request #605 from betrusted-io/update-ipc
Update ipc
2024-12-16 19:04:54 +08:00
bunnie
3b21dc77c2 update verifier 2024-12-16 18:55:36 +08:00
bunnie
bd7d2d767a update lock file 2024-12-16 18:55:29 +08:00
bunnie
83dad63fa2 re-add the kernel publish argument
i forgot this was commented out
2024-12-16 18:55:08 +08:00
bunnie
45a8eb2227 stage tomls for version bump: try_send added to xous-ipc 2024-12-16 18:50:11 +08:00
bunnie
cb3f792f46
Merge pull request #604 from betrusted-io/cram-dev
Rewrite of USB stack
2024-12-16 18:49:00 +08:00
bunnie
370eb75ac1
Merge branch 'main' into cram-dev 2024-12-16 18:48:00 +08:00
bunnie
11ce81c6ea add frunk to the cargo lock for cramium usb 2024-12-16 18:47:17 +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
f5cae8b975 add visibility for third-party IRQ implementation
Had to promote the visibility of a bunch of event handler
structures so we can put an IRQ handler outside of the core
USB crate.
2024-12-16 18:02:01 +08:00
bunnie
186534187e add a try_send() routine to buffers
this allows us to send memory messages from an IRQ context
2024-12-16 18:00:51 +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
bd3e99c606
Merge pull request #603 from betrusted-io/cram-dev
Merge cram-dev WIP to avoid branch divergence & check CI status
2024-12-12 15:09:47 +08:00
bunnie
5d35dee4f6 final i2c changes based on sim results 2024-12-11 04:05:24 +08:00
bunnie
946c0f7c4f
Merge pull request #602 from rowr111/small-updates-to-the-locales-readme
small updates to the locales readme
2024-12-10 23:53:39 +08:00
Jeanie
3f6778450b small revision 2024-12-10 23:23:45 +09:00
Jeanie
4f5f4e2a90 small updates to the locales readme 2024-12-10 23:18:42 +09:00
bunnie
4d148c9a55 check only the busy status bit for i2c to confirm command initiation 2024-12-10 18:18:15 +08:00
bunnie
90317b0adb wait for i2c commands to propagate before moving on 2024-12-10 18:06:24 +08:00
bunnie
a3ef478688 more mpw vs nto differences 2024-12-10 17:10:24 +08:00
bunnie
6e1023e5ea update comments 2024-12-10 17:05:59 +08:00