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

serial: implement receive FIFO flush via FCR #103

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Oct 7, 2024

  1. serial: implement receive FIFO flush via FCR

    The FIFO Control Register (FCR) controls the behavior of the receive
    and transmit FIFO buffers of the device. The current implementation
    does not emulate this register, as FIFO buffers are always enabled.
    However, there are two bits in this register that control flushing of
    said FIFOS. The transmission FIFO is already flushed by the current
    implementation on every write, but the receive FIFO is not. This is
    problematic, as some driver implementations (e.g. FreeBSD's) rely on
    being able to clear this buffer via the corresponding bit.
    
    Implement the correct behavior when a driver sets this bit by clearing
    `in_buffer`. Since there is no more data in the receive FIFO, the
    data-ready bit in the Line Status Register (LSR) must be cleared as
    well, in case it was set.
    
    Fixes: rust-vmm#83
    Signed-off-by: Carlos López <[email protected]>
    00xc committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    6dfc67c View commit details
    Browse the repository at this point in the history
  2. serial: add a test for receive FIFO flushing

    Add a test that checks that flushing the receive FIFO results in the
    correct behavior, i.e. `in_buffer` is cleared.
    
    Signed-off-by: Carlos López <[email protected]>
    00xc committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    b1750d5 View commit details
    Browse the repository at this point in the history