|
| 1 | +# OpenTitan USBDEV |
| 2 | + |
| 3 | +**Warning:** the USBDEV driver is still in development and not expected to work at the moment! |
| 4 | + |
| 5 | +## `usb` Chardev |
| 6 | + |
| 7 | +The USBDEV driver exposes a chardev with ID `usbdev` which can used to control some aspects of the |
| 8 | +emulation. |
| 9 | +Once connected, the driver accepts textual commands. |
| 10 | +Each command must end with a newline. |
| 11 | +The following commands are recognized: |
| 12 | +- `vbus_on`: turn on VBUS, see [#VBUS-handling](VBUS handling) for more details. |
| 13 | +- `vbus_off`: turn off VBUS, see [#VBUS-handling](VBUS handling) for more details. |
| 14 | + |
| 15 | +## VBUS handling |
| 16 | + |
| 17 | +On a real machine, the VBUS sense pin is usually connected to the VBUS connector so |
| 18 | +that the chip can detect when a cable is plugged. For the purpose of emulation, a different |
| 19 | +approach needs to be taken. The driver supports two modes of operations which are controlled |
| 20 | +by the `vbus-override` property which can be set on the command-line by |
| 21 | +`-global ot-usbdev.vbus-override=<mode>`. The following modes are supported: |
| 22 | + |
| 23 | +- `vbus-override=on`: in this mode, the VBUS sense pin is entirely managed over the `usbdev` |
| 24 | + chardev. |
| 25 | + By default, the sense pin will be set to level low. The `vbus_on` and `vbus_off` commands |
| 26 | + can be used to change the value of the sense pin. Note that in this mode, the VBUS sense signal |
| 27 | + will be completely independent of the presence of a USB host. |
| 28 | +- `vbus-override=off`: in this mode, the `vbus_on` and `vbus_off` commands control a virtual ``VBUS |
| 29 | + enable'' gate. The VBUS sense pin will be reported as level high if and only if the VBUS enable |
| 30 | + gate is enable **and** a USB host is connected to the driver. |
| 31 | + By default, the VBUS gate is disabled. |
0 commit comments