struct PL011UartInner {
registers: MMIODerefWrapper<RegisterBlock>,
chars_written: usize,
chars_read: usize,
}Fields§
§registers: MMIODerefWrapper<RegisterBlock>§chars_written: usize§chars_read: usizeImplementations§
Source§impl PL011UartInner
Create an instance.
impl PL011UartInner
Create an instance.
§Safety
- The user must ensure to provide a correct MMIO start address.
pub const unsafe fn new(mmio_start_addr: usize) -> Self
Sourcepub fn init(&mut self)
pub fn init(&mut self)
Set up baud rate and characteristics.
This result in 8N1 and 921_600 baud.
The calculation for the BRD is (we set the clock to 48 MHz in config.txt):
(48_000_000 / 16) / 921_600 = 3.2552083.
This means the integer part is 3 and goes into the IBRD.
The fractional part is 0.2552083.
FBRD calculation according to the PL011 Technical Reference Manual:
INTEGER((0.2552083 * 64) + 0.5) = 16.
Therefore, the generated baud rate divdier is: 3 + 16/64 = 3.25. Which results in a
generated baud rate of 48_000_000 / (16 * 3.25) = 923_077.
Error = ((923_077 - 921_600) / 921_600) * 100 = 0.16%.
Sourcefn write_char(&mut self, c: char)
fn write_char(&mut self, c: char)
Send a character.
Sourcefn flush(&self)
fn flush(&self)
Block execution until the last bufferred character has been physically put on the TX wire.
Sourcefn read_char_converting(&mut self, blocking_mode: BlockingMode) -> Option<char>
fn read_char_converting(&mut self, blocking_mode: BlockingMode) -> Option<char>
Retrieve a character.
Trait Implementations§
Source§impl Write for PL011UartInner
Implementing core::fmt::Write enables usage of the format_args! macros, which in turn are
used to implement the kernel’s print! and println! macros. By implementing write_str(),
we get write_fmt() automatically.
impl Write for PL011UartInner
Implementing core::fmt::Write enables usage of the format_args! macros, which in turn are
used to implement the kernel’s print! and println! macros. By implementing write_str(),
we get write_fmt() automatically.
The function takes an &mut self, so it must be implemented for the inner struct.
See src/print.rs.