Wishbone Bridge
This crate enables writing code in Rust to manipulate a device via a Wishbone bridge. Various bridges may be specified, depending on the bridge type you need.
Supported bridges include:
- SPI
- Ethernet
- USB
- UART (Serial)
- PCI Express
Example Usage
As an example, there is a kind of device that has a USB bridge with a small random number generator at address 0xf001_7000. This device has a simple API:
- Write
1
to 0xf001_7000 to enable the device - When
0xf001_7008
is1
there is data available - Read the data from
0xf001_7004
- Goto 2
We can turn this into a command that reads from this RNG and prints to stdout:
use ;
use ;
It is then possible to run this with cargo run | hexdump -C
to
produce an endless stream of random numbers.
Feature Support
Support for all bridges is enabled by default, however you may enable only certain bridges using cargo features.
For example, to enable only the "usb" bridge, add the following to your Cargo.toml
:
[]
= { = "1", = false, = ["usb"] }
This will result in a faster build, but you will only have access to the UsbBridge
.