pl011-uart

Crates.iopl011-uart
lib.rspl011-uart
version0.1.0
sourcesrc
created_at2024-11-19 04:25:00.490458
updated_at2024-11-19 04:25:00.490458
descriptionA driver for the Arm PL011 UART.
homepage
repositoryhttps://github.com/google/pl011-uart
max_upload_size
id1452899
size39,695
TrustedFirmware-Rust (github:trustedfirmware:trustedfirmware-rust)

documentation

README

pl011-uart

crates.io page docs.rs page

A Rust driver for the Arm PL011 UART.

This is not an officially supported Google product.

Usage

Basic usage of the pl011-uart crate

use pl011_uart::Uart;
use core::fmt::Write;

fn main() {
    // constants required for initializing the UART.
    const PL011_BASE_ADDRESS: *mut u32 = 0x0900_0000 as _;
    const PL011_BAUD_RATE: u32 = 115200;
    const PL011_CLK_IN_HZ: u32 = 50000000;

    // initialize PL011 UART.
    let mut uart = unsafe { Uart::new(PL011_BASE_ADDRESS) };
    uart.init(PL011_CLK_IN_HZ, PL011_BAUD_RATE);

    // write to PL011 UART.
    writeln!(uart, "Hello, World!").unwrap();
}

License

Licensed under either of

at your option.

Contributing

If you want to contribute to the project, see details of how we accept contributions.

Commit count: 41

cargo fmt