xous-core/services/usb-bao1x/Cargo.toml

84 lines
2.9 KiB
TOML
Raw Permalink Normal View History

[package]
2025-09-08 09:21:32 +00:00
name = "usb-bao1x"
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" }
log = "0.4.14"
num-derive = { version = "0.4.2", default-features = false }
num-traits = { version = "0.2.14", default-features = false }
bao1x-hal = { path = "../../libs/bao1x-hal", features = [
"std",
# "debug-print-usb",
# "verbose-debug",
2024-12-27 12:01:51 +00:00
"axp2101",
], optional = true }
bao1x-api = { path = "../../libs/bao1x-api" }
bao1x-hal-service = { path = "../bao1x-hal-service", optional = true }
bao1x-emu = { path = "../bao1x-emu", optional = true }
xous-usb-hid = { git = "https://github.com/betrusted-io/xous-usb-hid.git", branch = "main" }
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"
# for debugging interrupts
riscv = { version = "0.5.6", package = "xous-riscv" }
usb-device = { git = "https://github.com/betrusted-io/usb-device.git", branch = "main", features = [
"log",
"control-buffer-256",
] }
# usb-device = { path = "../../../usb-device", features = [
# "log",
# "control-buffer-256",
# ] }
# Serial support
usbd-serial = { git = "https://github.com/betrusted-io/usbd-serial.git", branch = "v0.1.1-betrusted", features = [
"max-packet-size-512",
] }
# usbd-serial = { path = "../../../usbd-serial", features = [
# "max-packet-size-512",
# ] }
[features]
bao1x = []
board-baosec = [
"utralib/bao1x",
"utralib/std",
"bao1x-hal",
"bao1x-hal-service",
]
oem-baosec-lite = ["bao1x-hal/oem-baosec-lite"]
board-dabao = ["utralib/bao1x", "utralib/std", "bao1x-hal", "bao1x-hal-service"]
hosted-baosec = ["utralib/hosted", "utralib/std", "bao1x-emu"]
# 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 = []
debug-print-usb = [
"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
verbose-debug = ["bao1x-hal/verbose-debug"]
# 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.
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
default = []