2024-11-07 08:17:08 +00:00
|
|
|
[package]
|
2025-09-08 09:21:32 +00:00
|
|
|
name = "usb-bao1x"
|
2024-11-07 08:17:08 +00:00
|
|
|
version = "0.1.0"
|
|
|
|
|
edition = "2021"
|
|
|
|
|
|
|
|
|
|
[dependencies]
|
2026-01-29 11:12:00 +00:00
|
|
|
utralib = { version = "0.1.27", optional = true, default-features = false }
|
|
|
|
|
xous-names = { package = "xous-api-names", version = "0.9.71" }
|
|
|
|
|
ticktimer = { package = "xous-api-ticktimer", version = "0.9.70" }
|
|
|
|
|
xous = "0.9.70"
|
|
|
|
|
xous-ipc = "0.10.10"
|
|
|
|
|
log-server = { package = "xous-api-log", version = "0.1.69" }
|
2024-11-07 08:17:08 +00:00
|
|
|
log = "0.4.14"
|
2024-12-02 10:52:59 +00:00
|
|
|
num-derive = { version = "0.4.2", default-features = false }
|
2024-11-07 08:17:08 +00:00
|
|
|
num-traits = { version = "0.2.14", default-features = false }
|
2025-09-18 13:25:51 +00:00
|
|
|
bao1x-hal = { path = "../../libs/bao1x-hal", features = [
|
2024-12-21 16:35:45 +00:00
|
|
|
"std",
|
2025-10-01 15:34:53 +00:00
|
|
|
# "debug-print-usb",
|
2025-01-02 20:09:57 +00:00
|
|
|
# "verbose-debug",
|
2024-12-27 12:01:51 +00:00
|
|
|
"axp2101",
|
2025-03-02 18:09:30 +00:00
|
|
|
], optional = true }
|
2025-09-18 13:25:51 +00:00
|
|
|
bao1x-api = { path = "../../libs/bao1x-api" }
|
|
|
|
|
bao1x-hal-service = { path = "../bao1x-hal-service", optional = true }
|
|
|
|
|
bao1x-emu = { path = "../bao1x-emu", optional = true }
|
2024-11-07 08:17:08 +00:00
|
|
|
xous-usb-hid = { git = "https://github.com/betrusted-io/xous-usb-hid.git", branch = "main" }
|
2024-11-19 17:46:34 +00:00
|
|
|
rkyv = { version = "0.8.8", default-features = false, features = [
|
|
|
|
|
"std",
|
|
|
|
|
"alloc",
|
|
|
|
|
] }
|
|
|
|
|
packed_struct = { version = "0.10", default-features = false } # used by the xous-usb-hid crate
|
2024-11-20 12:36:57 +00:00
|
|
|
locales = { path = "../../locales" }
|
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 09:56:05 +00:00
|
|
|
frunk_core = "0.4.2"
|
2024-12-21 16:35:45 +00:00
|
|
|
# for debugging interrupts
|
|
|
|
|
riscv = { version = "0.5.6", package = "xous-riscv" }
|
2024-11-19 17:46:34 +00:00
|
|
|
|
2025-09-11 18:51:19 +00:00
|
|
|
usb-device = { git = "https://github.com/betrusted-io/usb-device.git", branch = "main", features = [
|
|
|
|
|
"log",
|
|
|
|
|
"control-buffer-256",
|
|
|
|
|
] }
|
2025-09-12 17:12:12 +00:00
|
|
|
# usb-device = { path = "../../../usb-device", features = [
|
|
|
|
|
# "log",
|
|
|
|
|
# "control-buffer-256",
|
|
|
|
|
# ] }
|
2025-09-11 18:51:19 +00:00
|
|
|
|
|
|
|
|
# Serial support
|
|
|
|
|
usbd-serial = { git = "https://github.com/betrusted-io/usbd-serial.git", branch = "v0.1.1-betrusted", features = [
|
|
|
|
|
"max-packet-size-512",
|
|
|
|
|
] }
|
2025-09-12 17:12:12 +00:00
|
|
|
# usbd-serial = { path = "../../../usbd-serial", features = [
|
|
|
|
|
# "max-packet-size-512",
|
|
|
|
|
# ] }
|
2024-11-07 08:17:08 +00:00
|
|
|
|
|
|
|
|
[features]
|
2025-09-18 13:25:51 +00:00
|
|
|
bao1x = []
|
2025-03-02 18:09:30 +00:00
|
|
|
board-baosec = [
|
2025-09-18 13:25:51 +00:00
|
|
|
"utralib/bao1x",
|
2025-03-02 18:09:30 +00:00
|
|
|
"utralib/std",
|
2025-09-18 13:25:51 +00:00
|
|
|
"bao1x-hal",
|
|
|
|
|
"bao1x-hal-service",
|
2025-03-02 18:09:30 +00:00
|
|
|
]
|
2026-01-24 15:54:21 +00:00
|
|
|
oem-baosec-lite = ["bao1x-hal/oem-baosec-lite"]
|
2025-10-05 09:17:31 +00:00
|
|
|
board-dabao = ["utralib/bao1x", "utralib/std", "bao1x-hal", "bao1x-hal-service"]
|
2025-09-18 13:25:51 +00:00
|
|
|
hosted-baosec = ["utralib/hosted", "utralib/std", "bao1x-emu"]
|
2024-11-19 17:46:34 +00:00
|
|
|
# none of these other modes are actually supported, but are listed here
|
|
|
|
|
# to allow direct re-use of API code
|
|
|
|
|
precursor = ["utralib/precursor", "utralib/std"]
|
|
|
|
|
hosted = ["utralib/hosted", "utralib/std"]
|
|
|
|
|
renode = ["utralib/renode", "utralib/std"]
|
|
|
|
|
mass-storage = []
|
2024-12-21 16:35:45 +00:00
|
|
|
debug-print-usb = [
|
2025-10-18 17:19:30 +00:00
|
|
|
"bao1x-hal/debug-print-duart",
|
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 09:56:05 +00:00
|
|
|
] # mutually exclusive feature with other crates that use the app UART
|
2025-09-18 13:25:51 +00:00
|
|
|
verbose-debug = ["bao1x-hal/verbose-debug"]
|
2025-09-11 18:51:19 +00:00
|
|
|
|
|
|
|
|
# mutually exclusive with kernel "print-panics"; will get a DUART allocation error on boot if kernel panics are on
|
|
|
|
|
# sticks the DUART into the deep stack; necessary because we can't have external dependencies in usbd-device
|
|
|
|
|
# and the DUART can be banged with simple hard-coded memory offsets.
|
2025-11-03 00:02:21 +00:00
|
|
|
usbd-debug = ["usb-device/baochip-debug", "debug-print-usb"]
|
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 09:56:05 +00:00
|
|
|
|
|
|
|
|
prototyping = [
|
|
|
|
|
] # temporary feature-out for figuring out the code; remove this if you don't recognize it anymore
|
|
|
|
|
|
2025-10-01 15:34:53 +00:00
|
|
|
default = []
|