-
Notifications
You must be signed in to change notification settings - Fork 11
ot_uart
: Add break interrupt and add opt-in mocking of break oversampling
#212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+102
−22
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# OpenTitan UART Support | ||
|
||
## Connecting to the UART | ||
|
||
* `-serial mon:stdio`, used as the first `-serial` option, redirects the virtual UART0 to the | ||
current console/shell. | ||
|
||
* `-chardev socket,id=serial1,host=localhost,port=8001,server=on,wait=off` and | ||
`-serial chardev:serial1` can be used to redirect UART1 (in this example) to a TCP socket. These | ||
options are not specific to OpenTitan emulation, but are useful to communicate over a UART. | ||
Note that QEMU offers many `chardev` backends, please check QEMU documentation for details. | ||
|
||
## Sending Break Conditions | ||
|
||
Break conditions can be sent to the UART on select supported CharDev backends (telnet, mux) | ||
or by sending the `chardev-send-break` command with the CharDev ID via the QEMU Monitor. | ||
Break conditions are treated as transient events and the length of time of a break condition | ||
is not considered. | ||
|
||
## Oversampling | ||
|
||
OpenTitan's UART has a `VAL` register which oversamples the RX pin 16 times per bit. | ||
This cannot be emulated by QEMU which uses a CharDev backend and does not have a notion of | ||
accurate sampling times. | ||
|
||
If software wishes to poll the `VAL` register to determine break conditions, there are | ||
some properties available to help with emulating this use case: | ||
|
||
* `-global ot-uart.oversample-break=true` is used to enable UART break oversampling. | ||
This will attempt to display 16 samples of the last bit received in the `VAL` register, | ||
which will be 16 high bits after any UART frame is transmitted (as these end with a stop | ||
bit, which is high), or 16 low bits if the UART previously received a break condition | ||
and has not received any frames since. That is, enabling this property assumes that | ||
transmitted break conditions are "held" until the next UART transfer in terms of what | ||
is being shown in the oversampled `VAL` register. | ||
|
||
* `-global ot-uart.toggle-break=true` is used to provide more control over "holding" | ||
the UART RX break condition like a GPIO strap, and changes the behavior of a UART | ||
such that received break condition events now *toggle* the break condition state | ||
rather than keeping it asserted until the next transfer. This allows any device talking | ||
to OpenTitan via UART to have more precise control over when the UART VAL register | ||
displays idle and when it displays a break condition, as it can precisely toggle the | ||
break condition on or off like a GPIO strapping being held down. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.