Commit graph

32 commits

Author SHA1 Message Date
bunnie
4f6f595b2f format services/usb-test 2024-01-14 22:56:32 +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
3508dc44d9 apply deferred-init idiom to usb-test 2023-07-16 17:36:12 +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
67fc21fbdd harmonize hosted mode selection, but retain an explicit hosted flag
In general, hosted mode is assumed "by default" if the target
is not Xous. This allows packages to be built cleanly on command
lines that don't know to pass a --feature flag to specify a target.

However, an explicit "hosted" flag is still retained so that we
can confirm the build system intent. This saves us from the failure
mode that we thought we were building for target A, but accidentally
ommitted the flag, and instead we've been silently building for
"hosted" mode without any warning. The main consumer of the "hosted"
flag is now just the build.rs script inside of the utralib.
2022-10-25 17:21:02 +08:00
bunnie
b1c3a70f35 cleanup bitrot in usb-test 2022-10-02 14:51:02 +08:00
bunnie
4e40ae6c5d move from target selectors to feature selectors for back-ends
This will allow for e.g. xous on riscv32-imac but not a precursor
target, for example: by using feature selectors we get to have
a bigger range of targets that we support, such as for implementations
that haven't been upstreamed or have official target-triples.

The downsides are:

- patch override libraries don't absorb feature flags. so, for
example, the AES crate that is used to patch other crates won't
be aware of the target features without modifying the referencing
crates.

- features are normally meant to be additive, but target features
are mutually exclusive. The mutex is enforced by a check in
utralib that throws a panic on build if two targets are accidentally
selected at the same time.
2022-10-02 02:56:44 +08:00
bunnie
ed51bbc23e update USB PID, resolving issue #182 2022-06-15 01:56:27 +08:00
Sean Cross
3ae9d8abf0 apps/services: remove xous::xous_main macro usage
This macro will be removed, since it is no longer necessary. Remove this
macro across the project and replace it with a standard `main()`
function.

Signed-off-by: Sean Cross <sean@xobs.io>
2022-05-31 13:33:30 +08:00
bunnie
3f779d5def tweak delays for more consistent key down reporting 2022-05-16 21:43:24 +08:00
bunnie
71f5183766 working USB development demo (HID keyboard emulation) 2022-05-16 21:26:37 +08:00
bunnie
ffbfa1dc3f wooooo i spy with my little eye an emulated HID keyboard 2022-05-16 13:15:21 +08:00
bunnie
874c4d41ff well, it's enumerating. now what? 2022-05-16 02:49:23 +08:00
bunnie
77038737b2 just before attempting to use IN to linked list trick 2022-05-16 00:34:14 +08:00
bunnie
26739472af this requires an adjustment to the SoC, but now we're seeing half the setup
a small bug was found in the device core that is now fixed. the
device core was not computing the target for the SETUP transaction
correctly if the HEAD of the OUT descriptor was set in advance of
the SETUP transaction. we now see much more consistent SETUP
transactions, and even the first IN response.

the next challenge is figuring out why the second IN response doesn't
seem to be issued.
2022-05-15 14:11:14 +08:00
bunnie
8c39b64126 getting closer...
we're now two packets into the setup.

i think i see one fundamental mismatch between how the driver
behaves and how the hardware runs. it has to do with where the
ep0 data gets deposited for a SETUP or OUT transaction --
the HEAD of the list can't be allocated the transaction is
completely ready to go.

will bang on this more tomorrow, but this is progress at least.
2022-05-15 02:16:24 +08:00
bunnie
bd1cc10678 refactor code base after a slightly better understanding of the USB core
still one mystery remaining, howcome setup packets don't "stick"
the first time around...
2022-05-14 23:53:10 +08:00
bunnie
0dadc32716 fix interrupts, direction
interrupts seem to behave much more like i think they should.
i think the interrupt unit on the spinalHDL block is not made to
have the whole set enabled/disabled frequently, it just wants
to have the bits banged to clear the interrupts. enabling and
disabling interrupts as a whole causes some erratic operations.
NB: the reference linux driver only enables them once and never
turns them off.

also, realized just now that OUT is from the direction of the host.
so OUT on the device is incoming data. oops.

things are moving in the right direction, i'm seeing the next
IN packet being issued by the USB driver on the precursor
side, but it's not being sent by the hardware. yet.
2022-05-13 23:44:15 +08:00
bunnie
adf8eb6519 some progress .. seeing setup packets now 2022-05-10 13:24:08 +08:00
bunnie
6b04f0e73c fix missing pullup bit, required for core to operate correctly
even though it's not hooked up externally, it affects the internal
logic somehow?
2022-05-09 21:10:34 +08:00
bunnie
047b9e539d refactor of usb hardware drivers
- write only u32s to registers
- make everything volatile
2022-05-09 10:04:59 +08:00
bunnie
8310d64de9 layer in the HID keyboard drivers 2022-05-07 13:21:23 +08:00
bunnie
bee8334b3b flesh out usb driver 2022-05-06 13:40:12 +08:00
bunnie
fd2aa438c0 still struggling a bit to get basic USB connectivity test to pass 2022-05-05 20:51:48 +08:00
bunnie
3133d386c4 cleanup type problems incurred while fixing +Send trait on core types 2022-05-03 01:13:24 +08:00
bunnie
322de782d7 ensure all allocs meet the 16-byte alignment criteria 2022-05-02 23:15:52 +08:00
bunnie
c12d9cbe8f working through the usb endpoint descriptor allocator 2022-05-02 22:59:33 +08:00
bunnie
467254fa81 lay down some initial data structures to talk to the UDC 2022-04-27 02:41:07 +08:00
bunnie
a7684343f2 add first commands to toggle core connectivity 2022-04-27 01:22:53 +08:00
bunnie
5f2eef3afd initial toy repl for usb debugging 2022-04-27 00:53:58 +08:00
bunnie
a09d773269 re-add the usb test directory 2022-03-31 04:37:54 +08:00