Skip to content
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

OpenTitan: Add support for receiving data over the UART #1828

Merged
merged 1 commit into from May 14, 2020

Conversation

alistair23
Copy link
Contributor

Pull Request Overview

This PR adds support to the LowRISC UART driver to read data from the UART.

Testing Strategy

Tested by running the console_recv_short libtock-c example on the OpenTitan QEMU model and OpenTitan FPGA.

TODO or Help Wanted

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make formatall.

@alistair23 alistair23 added the WG-OpenTitan In the purview of the OpenTitan working group. label May 5, 2020
@bradjc
Copy link
Contributor

bradjc commented May 5, 2020

It appears to be OK per the HIL to not wait until all the requested bytes are received, but the callback should return ESIZE in that case:

tock/kernel/src/hil/uart.rs

Lines 266 to 278 in 903b90c

/// The `rx_len` argument specifies how many words were transmitted.
/// An `rval` of SUCCESS indicates that every requested word was
/// received: `rx_len` in the callback should be the same as
/// `rx_len` in the initiating call.
///
/// `rval` is SUCCESS if the full buffer was successfully received, or
/// - ECANCEL if the call to `received_buffer` was cancelled and
/// the buffer was not fully received. `rx_len` contains
/// how many words were received.
/// - ESIZE if the buffer could only be partially received. `rx_len`
/// contains how many words were transmitted.
/// - FAIL if reception failed in some way: `error` may contain further
/// information.

@alistair23
Copy link
Contributor Author

Updated

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Copy link
Contributor

@bradjc bradjc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't test, looks reasonable.

Copy link
Member

@ppannuto ppannuto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors d+

Deferring to OT-WG members to merge

@bors
Copy link
Contributor

bors bot commented May 14, 2020

✌️ alistair23 can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@alistair23
Copy link
Contributor Author

bors r+

@bors bors bot merged commit cd0d123 into tock:master May 14, 2020
@alistair23 alistair23 deleted the alistair/opentitan-recv branch May 14, 2020 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WG-OpenTitan In the purview of the OpenTitan working group.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants