Skip to content

Releases: rust-osdev/uart_16550

v0.6.0

28 Mar 20:01

Choose a tag to compare

What's Changed

  • Rename byte transfer functions and update IO trait implementations by @phip1611 in #49
  • Enhance MmioAddress safety and fix AArch64 instruction emission by @phip1611 in #50
  • Improve documentation examples and streamline architecture support by @phip1611 in #53
  • Add API test and improve memory safety in MMIO constructors by @phip1611 in #54

Full Changelog: v0.5.0...v0.6.0

v0.5.0 (rewrite of the crate!)

20 Mar 19:49

Choose a tag to compare

  • Complete rewrite of the crate
  • The crate is by no means "minimalist" anymore. Now, uart_16550, is a simple
    yet highly configurable low-level driver for 16550 UART devices, typically
    known and used as serial ports or COM ports. Easy integration into Rust while
    providing fine-grained control where needed (e.g., for kernel drivers).
  • Changes were made to use this on real hardware
  • Common API for x86 port I/O and MMIO
  • 100% typed spec

We thank all past contributors. We've decided to completely rewrite the crate
to clean up technical debt from the past, maintain the highest possible coding
and API standards, and to make this crate ready for usage on real hardware,
while keeping it easy to use in virtual machines.

Special Thanks

Special Thanks to Philipp Oppermann (@phil-opp) and Martin Kröning (@mkroening)
for their very valuable review on the new crate!

Migration to v0.5.0

Old

use uart_16550::SerialPort;

const SERIAL_IO_PORT: u16 = 0x3F8;

let mut serial_port = unsafe { SerialPort::new(SERIAL_IO_PORT) };
serial_port.init();

// Now the serial port is ready to be used. To send a byte:
serial_port.send(42);

// To receive a byte:
let data = serial_port.receive();

New (Minimalistic)

use uart_16550::{Config, Uart16550Tty};
use core::fmt::Write;

fn main() {
  // SAFETY: The address is valid and we have exclusive access.
  let mut uart = unsafe { Uart16550Tty::new_mmio(0x1000 as *mut _, 4, Config::default()).expect("should initialize device") };
  //                                    ^ or `new_port(0x3f8, Config::default())`
  uart.write_str("hello world\nhow's it going?");
}

New (More low-level control)

use uart_16550::{Config, Uart16550};

fn main() {
  // SAFETY: The address is valid and we have exclusive access.
  let mut uart = unsafe { Uart16550::new_mmio(0x1000 as *mut _, 4).expect("should be valid port") };
  //                                 ^ or `new_port(0x3f8)`
  uart.init(Config::default()).expect("should init device successfully");
  uart.test_loopback().expect("should have working loopback mode");
  uart.check_connected().expect("should have physically connected receiver");
  uart.send_bytes_exact(b"hello world!");
}

What's Changed

New Contributors

Full Changelog: v0.4.0...v0.5.0