Commit graph

249 commits

Author SHA1 Message Date
bunnie
a5e45a2078 beginnings of cramium hardware target integration
the hardware driver is compile-clean, but everything is just
a stub. But at least we have the API thunks laid bare which
gives us a roadmap for the next steps.
2024-06-06 17:58:11 +08:00
bunnie
35e7cf3a5b bump xous dep revs 2024-05-29 02:07:06 +08:00
bunnie
9e66c1bee2 commit the version bump 2024-05-07 01:03:05 +08:00
bunnie
d6b33159a5 stage version pin bump 2024-04-01 15:46:26 +08:00
bunnie
585f21c9aa check keymap on every call to "type" over USB
this allows us to type into hosts that have different keymappings
from each other without requiring a reboot.
2024-03-31 08:42:41 +08:00
bunnie
699004e7b0 bump xous pins 2024-02-06 14:49:10 +08:00
bunnie
053c55c254 CHORE reformat PR
I...could swear there was no merge warning when I clicked merge.

why is this failing to check now?
2024-02-01 13:47:13 +08:00
bunnie
3ed7736fa6 chore: fix trailing whitespaces
i'm not sure how this merged, the merge checks were all clean
on the previous PR...???
2024-02-01 13:16:18 +08:00
Gianguido Sora
73d3563cb6 services/usb-device-xous: format code 2024-01-30 19:12:19 +01:00
Gianguido Sora
a64edbdf2f services/usb-device-xous: use main branch for xous-usb-hid 2024-01-30 19:05:17 +01:00
Gianguido Sora
270c471577 services/usb-device-xous: cleanup 2024-01-30 19:04:58 +01:00
Gianguido Sora
79db9702e3 Merge branch 'main' into gsora/app-hid 2024-01-30 18:49:09 +01:00
bunnie
b2208850b2 add a U2F USB event observer hook to the USB stack
the intent of this is to send a message to listeners that
want to be aware of the fact that a U2F packet has arrived.
2024-01-29 23:14:44 +08:00
bunnie
0267a56989 format Cargo.tomls
because apparently cargo fmt doesn't format Cargo.toml files???
2024-01-15 00:14:39 +08:00
bunnie
425e48ed45 format service/usb-device-xous
avoided formatting of any keymapping lookup tables...
2024-01-14 22:52:52 +08:00
Gianguido Sora
96088ecffd services/usb-device-xous: increase HID max stored report to 100
About 6.4kb
2024-01-09 12:23:57 +01:00
Gianguido Sora
8fa259e35a services/usb-device-xous: align HIDReport to C repr 2024-01-09 12:21:53 +01:00
bunnie
8ec08c9c76 fix rust v1.75.0 warnings that are probably benign
a lot of re-import warnings have cropped up. While I appreciate
their studiousness on this, the problem is that removing some
of these exports in the API crate could mean that future users
who want access to some API features that aren't used in this
configuration are now unaccessible.

I think it's not a huge problem at the moment, just spam-cleaning
the warnings because there are too many to deal with carefully
at the moment.
2024-01-04 19:15:28 +08:00
Gianguido Sora
5d9cedaf1a services/usb-device-xous: refactor inner function scopes to be actually correct 2023-12-30 16:47:41 +01:00
Gianguido Sora
cb9a279537 services/usb-device-xous: add documentation, and use Option in read_report 2023-12-29 18:38:35 +01:00
Gianguido Sora
acc1871ab0 services/usb-device-xous: initialize UsbClass before UsbDevice 2023-12-29 18:38:12 +01:00
Gianguido Sora
fe7678cff3 services/usb-device-xous: use an Option rather than bool+slice when returning a report message 2023-12-29 18:37:45 +01:00
Gianguido Sora
81772377e5 services/usb-device-xous: abstract AppHID state in a struct
Simpler API, easier to understand and audit.

The UsbDevice and UsbHidClass are stored in AppHID directly, so that callers have less things to worry about: just provide an UsbBusAllocator.

This way we streamline the control flow within main_hw.rs, which is already pretty intricated.

I still have to manage errors from usb-device-xous server to lib.rs, but that will come later.
2023-12-28 18:40:23 +01:00
Gianguido Sora
26740a44f6 services/usb-device-xous: implement HIDv2 device
Allows apps to expose HID devices from userspace.

Documentation coming soon.
2023-12-26 18:37:41 +01:00
bunnie
fda782663a bump version pins for xous change 2023-12-26 00:13:10 +08:00
bunnie
fa3f349a0a bump pins as xous-rs has changed 2023-12-01 21:20:01 +08:00
bunnie
367ede62b1 convert usbd-human-interface-device to xous-usb-hid 2023-11-16 17:27:00 +08:00
bunnie
419e547641 bump usbd-hid-device crate to latest
API changes to see if we want to absorb this prior to forking.
2023-11-12 00:02:07 +08:00
bunnie
6ab88117f6 bump xous-api-log version & fix version pins 2023-10-31 20:07:28 +08:00
bunnie
d63b5912b1 absorb new xous-rs version 2023-10-10 16:50:00 +08:00
bunnie
83256257e1 bump xous-rs crate to absorb Send derives on Messages
this is necessary for the smoltcp port
2023-10-03 20:54:14 +08:00
bunnie
478a612c02 commit version bump 2023-09-12 16:25:10 +08:00
bunnie
53469a68d0 publish package updates, sync to release tag 2023-08-08 14:35:49 +08:00
bunnie
b127cd093f bump version pins for change to xous-rs 2023-08-03 13:29:39 +08:00
bunnie
51278451a0 update version pins to pull in cramium target 2023-07-19 21:07:56 +08:00
bunnie
501f7a4d5f appy deferred-init idiom to usb-device. NOTE: box not applied
Box can't be applied to this crate because of interoperability
issues with the USB driver crate when it is applied.

Still, it seems to "work" because deferred-init pins down the
address of the hardware management structure (for now).
2023-07-16 17:35:24 +08:00
bunnie
4ac979f0ab update pins, again 2023-07-04 11:20:12 +08:00
bunnie
c9f8f2681b update version pins 2023-07-04 11:09:13 +08:00
bunnie
952ba18fba commit vesrion pin bumps 2023-06-16 01:30:18 +08:00
bunnie
fbe3cb2a3d bump package numbers to absorb PR #388 2023-05-28 15:58:11 +08:00
bunnie
5a2df4432c technical debt: cleanup UTRA package
- make the "base" field no longer public. It is accessible, but only
through an `unsafe` method, because, it is unsafe.
- add accessors to offest/mask fields. Because, it's not at all
unsafe to access these, and it can be useful for bit-ops that are
not part of the generic set of UTRA.
- add Arc to AtomicCSR, and require `std` for AtomicCSR types.
This should not break anything, I checked inside @foundation-devices
keyOS and they don't seem to be using AtomicCSR anywhere.

The Arc makes it a bit safer to clone the AtomicCSR base pointer
and share it between threads, but it will have an impact on performance.
The USB stack (which requires AtomicCSR) was regression testing and the
impact seems minimal.

Recall that the main purpose of AtomicCSR is to provide a CSR accessor
that does not require a mutable reference to the base object. This
can make certain Rust idioms a bit cleaner. We wrap the base accessor
in Arc+Atomic to try and improve the safety of throwing the borrow
checker under the bus, but it's still not perfect because hardware
mutable state can have side-effects within hardware itself that cannot
be modeled or checked by Rust's borrow checker.
2023-05-23 18:11:24 +08:00
bunnie
3b5a78a908 add configurable keyup/down delay to USB typing methods 2023-05-22 17:21:50 +08:00
bunnie
697d44de3d bump version pins to absorb changes to svd2utra etc. 2023-05-03 23:11:12 +08:00
Jean-Pierre De Jesus DIAZ
e757b4e686
services/usb-device-xous: update rand to 0.8
Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
2023-05-02 12:55:23 +02:00
bunnie
8a574f937f bump for xous-rs version pin update 2023-04-27 22:18:30 +08:00
bunnie
9b7dbcee2a fix manifest feature issue 2023-04-21 13:43:27 +08:00
bunnie
fa8ace0771 reduce debug noise 2023-04-17 03:59:47 +08:00
bunnie
f15e3920cb add "eager" USB serial sending of data; enables use as HW TRNG serial dongle 2023-04-17 03:47:15 +08:00
bunnie
a6c85fb527 fix hosted mode 2023-04-16 02:37:21 +08:00
bunnie
1392fdcf33 bump pins for updated log API 2023-04-16 02:27:37 +08:00
bunnie
dde6addc18 add input-side key injection over usb serial 2023-04-16 02:23:10 +08:00
bunnie
ce05053536 improve serial support; add stubs to allow for console i/o 2023-04-16 01:43:09 +08:00
bunnie
210c501bb7 initial USB-serial mode working 2023-04-14 13:01:06 +08:00
bunnie
849c136b90 bump versions because API crate changed 2023-04-12 23:02:30 +08:00
bunnie
8357ab31a5 bump all pins because utralib got updated 2023-04-09 00:48:35 +08:00
bunnie
9c94d6b4c0 bump versions because xous-rs API changed for gdb-stub 2023-04-08 23:49:24 +08:00
bunnie
e469eba167 bump version for utralib patch 2023-04-04 02:13:02 +08:00
bunnie
704aaf98af bump versions for kernel interface changes 2023-03-22 02:48:55 +08:00
bunnie
303f595d6f bump versions to cleanup renode.rs sync issue 2023-03-14 16:34:53 +08:00
bunnie
82e3aa322f bump toml files in prep for publish 2023-03-08 03:54:37 +08:00
bunnie
9256e7cc09 bump versions to absorb xous-names fix 2023-01-31 15:07:32 +08:00
bunnie
ca2a47e67f fix hosted mode again 2023-01-31 03:27:28 +08:00
bunnie
215f15f138 add missing feature flags to usb device crate 2023-01-31 03:19:17 +08:00
bunnie
84368c3f3a bump versions for publication 2023-01-31 02:18:12 +08:00
bunnie
c48f88ab93
Merge pull request #302 from gsora/feat/apps-block-device
feat: user-space USB block devices
2023-01-31 01:34:08 +08:00
Gianguido Sorà
2ff7d0a1fb
usb-device-xous: ignore block-device related messages in hosted mode 2023-01-26 19:29:53 +01:00
Gianguido Sorà
12a7271732
usb-device-xous: implement way to reset current block device app 2023-01-26 19:29:20 +01:00
Gianguido Sorà
9e5cc25a50
usb-device-xous: remove in-crate block device demo implementation
Now in apps/transientdisk
2023-01-26 19:28:43 +01:00
Gianguido Sorà
76bfa0b37a
usb-block-device: fix compilation warnings 2023-01-26 18:27:53 +01:00
bunnie
9e86b6d3fd add timeout variant for USB Rx -- note: not tested!
turns out we didn't need this variant for things to work
with the new OpenSK stack.
2023-01-26 02:42:17 +08:00
Gianguido Sorà
7eef972065 usb-device-xous: implement primitive for apps-based block devices 2023-01-24 17:30:35 +01:00
bunnie
232a4b6c6c bump xous version 2023-01-18 00:02:46 +08:00
bunnie
8b5dfca749 chore: trim some unused comment-code that I forgot to clean before 2023-01-15 14:24:23 +08:00
Gianguido Sorà
b2494e92fc
usb-device-xous: don't set device-wide class on mass-storage
Setting it to zero (default if not set) makes mass-storage work under
macOS.
2023-01-14 18:53:48 +01:00
bunnie
c0d442f275 refactor reset() routine to be more comprehensive
The original implementation didn't keep around some key data,
so we had to read the old version of the record and update parameters
assuming that the USB descriptors didn't change too much.

Unfortunately with the mass storage option, the description can
change quite a bit, so we have to reconsitute it from scratch.
Basically, we re-do the `alloc()` call in the reset routine,
playing it reverse so that we setup all the higher-number
endpoints before doing ep0 last.

This hopefully fixes a stability issue for usb hid mode when
mass storage is enabled as a build option.
2023-01-15 01:00:53 +08:00
bunnie
af4b394e7d minor edit - make mass storage explicit in match option 2023-01-15 01:00:41 +08:00
bunnie
ee81c70018 refactor multi-view support
- use new SpinalUsbDevice::new() interface instead of cloning
- put the blank "key-up" event on keyboard events after the
core is switched to, instead of at boot.
- add some more appropriate debug statements to help track
view switching in debug logs
2023-01-14 19:10:21 +08:00
bunnie
df1b9d9f8d refactor SpinalUsbDevice new method
Instead of making it once and then cloning it (which is a bit
unclear what's going on), make it so that the shared memory
ranges are allocated in the caller's scope, and then create
the structure "clean".

Also add a static AtomicBool to track interrupt init state,
since that can be only called once.
2023-01-14 19:08:51 +08:00
bunnie
b13671b3bb add some debug output on asserts 2023-01-14 19:08:32 +08:00
bunnie
f5a45bc017 cleanup some edge cases in handling poll events, suspend/resume
also fixes allocation ordering for EPs
2023-01-14 02:33:16 +08:00
bunnie
26a3adcc01 integrate "chain" fully; use "chain" feature only for bulk endpoints
bulk endpoints have a different behavior now than interrupt
endpoints; bulk endpoints have chained descriptors so that the
hardware automatically responds to multiple USB packets quickly.

interrupt endpoints also have subtly different way of handling
data readiness, which is incompatible with the block device layer
as implemented.
2023-01-14 00:09:16 +08:00
bunnie
26f12990f1 change default disk size to 256kiB, mostly to economize on RAM
since we don't have a clear use case for this yet and it's just
for testing on bleeding-edge, make a very small disk just so it's
easier for people to do testing, but not so big that it's a burden
on the system.

later on we can make this dynamically sizeable/allocateable only
e.g., only when the disk is required
2023-01-14 00:07:11 +08:00
bunnie
c631963a4b Merge branch 'feat/usb-mass-storage' of github.com:gsora/xous-core into gsora-feat/usb-mass-storage 2023-01-13 02:59:17 +08:00
bunnie
bebf323798 some touch-up/cleanup; add a timeout on a blocking read 2023-01-12 01:45:51 +08:00
bunnie
cd62caadcd fix paths and README 2023-01-12 01:13:21 +08:00
bunnie
ed23cdcc17 move crates to the libs/mass-storage directory 2023-01-12 01:12:56 +08:00
bunnie
88cdde4b9a remove unused files 2023-01-12 01:04:12 +08:00
bunnie
54467a75fc gate mass-storage behind a feature that is currently default off 2023-01-12 00:58:48 +08:00
bunnie
55b940fe74 tiny bit of cleanup & docs 2023-01-11 04:09:13 +08:00
bunnie
1f3c16aea8 add ReadFormatCapacities
this is required by Windows for the driver to work.
2023-01-11 03:55:04 +08:00
bunnie
93e3bc29b3 usb disk now working well without debugging messages 2023-01-11 02:00:32 +08:00
bunnie
d592bab121 head pointer offset is the most reliable way to determine transaction in progress
before we were looking at the amount of data transferred and
seeing if it matches the expected amount

I just realized that we can just look at the descriptor pointer in
the status region; if it is non-zero, then the descriptor set
is "live" and needs to be filled.

if it's zero, then a packet came in.

use this to fix the wait conditions for accepting new commands.
2023-01-11 01:59:13 +08:00
bunnie
f0d1c65c2a repair the minimal config for faster USB debugging 2023-01-11 01:58:15 +08:00
bunnie
921199b429 a cleaner version that works 2023-01-10 14:44:52 +08:00
bunnie
3355f3b5f4 writes now working, barely. 2023-01-10 05:21:11 +08:00
bunnie
5c1518cee6 block reads work. 2023-01-09 19:04:47 +08:00
bunnie
3d826ffbbe add bulk response chaining
IN descriptors now chain up to 512 bytes long

OUT descriptors still need to be worked up

However, there is an issue where the system is injecting the
ZLP/CSW immediately after the bulk response is queued up, and this
is getting sent before the bulk data is issued. Need to figure out
this race condition.
2023-01-09 04:14:59 +08:00
bunnie
10e605569f reduce InquiryResponse record 2023-01-07 00:22:26 +08:00
bunnie
41d4837551 bump versions to absorb WDT change 2023-01-06 17:48:12 +08:00
bunnie
cf5b181b03 convert extra EP to interrupt 2023-01-06 17:44:04 +08:00