Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Minimal support for uart_16550 serial output.

License

NotificationsYou must be signed in to change notification settings

rust-osdev/uart_16550

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusDocs.rs Badge

Minimal support forserial communication throughUART devices, which are compatible to the16550 UART. This crate supports I/O port-mapped (x86 only) and memory-mapped UARTS.

Usage

Depending on the system architecture, the UART can be either accessed throughport-mapped I/O ormemory-mapped I/O.

With port-mappd I/O

The UART is accessed through port-mapped I/O on architectures such asx86_64. On these architectures, theSerialPort type can be used:

use uart_16550::SerialPort;constSERIAL_IO_PORT:u16 =0x3F8;letmut 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();

With memory mapped serial port

Most other architectures, such asRISC-V, use memory-mapped I/O for accessing the UARTs. On these architectures, theMmioSerialPort type can be used:

use uart_16550::MmioSerialPort;constSERIAL_PORT_BASE_ADDRESS:usize =0x1000_0000;letmut serial_port =unsafe{MmioSerialPort::new(SERIAL_PORT_BASE_ADDRESS)};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();

Building with stable rust

This needs to have thecompile-time requirements of thecc crate installed on your system.It was currently only tested on Linux and MacOS.

License

Licensed under the MIT license (LICENSE orhttp://opensource.org/licenses/MIT).

About

Minimal support for uart_16550 serial output.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp