Update some readmes

pull/73/head
Andre Richter 4 years ago
parent 224ac8d944
commit dfbcd444dd
No known key found for this signature in database
GPG Key ID: 2116C1AB102F615E

@ -275,7 +275,7 @@ diff -uNr 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_gpio.rs 06_drivers_g
diff -uNr 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
--- 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
+++ 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
@@ -0,0 +1,307 @@
@@ -0,0 +1,311 @@
+// SPDX-License-Identifier: MIT OR Apache-2.0
+//
+// Copyright (c) 2018-2020 Andre Richter <andre.o.richter@gmail.com>
@ -452,8 +452,12 @@ diff -uNr 05_safe_globals/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 06_dri
+
+ /// Set up baud rate and characteristics.
+ ///
+ /// Results in 8N1 and 230400 baud (if the clk has been previously set to 48 MHz by the
+ /// firmware).
+ /// The calculation for the BRD given a target rate of 2300400 and a clock set to 48 MHz is:
+ /// `(48_000_000/16)/230400 = 13,02083`. `13` goes to the `IBRD` (integer field). The `FBRD`
+ /// (fractional field) is only 6 bits so `0,0208*64 = 1,3312 rounded to 1` will give the best
+ /// approximation we can get. A 5 modulo error margin is acceptable for UART and we're now at 0,01 modulo.
+ ///
+ /// This results in 8N1 and 230400 baud (we set the clock to 48 MHz in config.txt).
+ pub fn init(&mut self) {
+ // Turn it off temporarily.
+ self.registers.CR.set(0);

@ -197,7 +197,7 @@ diff -uNr 06_drivers_gpio_uart/src/_arch/aarch64/cpu.rs 07_uart_chainloader/src/
diff -uNr 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
--- 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
+++ 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
@@ -267,6 +267,16 @@
@@ -271,6 +271,16 @@
let mut r = &self.inner;
r.lock(|inner| fmt::Write::write_fmt(inner, args))
}
@ -214,7 +214,7 @@ diff -uNr 06_drivers_gpio_uart/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 0
}
impl console::interface::Read for PL011Uart {
@@ -278,18 +288,21 @@
@@ -282,18 +292,21 @@
cpu::nop();
}

@ -227,7 +227,7 @@ diff -uNr 07_uart_chainloader/src/_arch/aarch64/time.rs 08_timestamps/src/_arch/
diff -uNr 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs 08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
--- 07_uart_chainloader/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
+++ 08_timestamps/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
@@ -288,11 +288,18 @@
@@ -292,11 +292,18 @@
cpu::nop();
}

@ -1893,7 +1893,7 @@ diff -uNr 13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
}
//--------------------------------------------------------------------------------------------------
@@ -186,6 +238,10 @@
@@ -190,6 +242,10 @@
self.registers
.LCRH
.write(LCRH::WLEN::EightBit + LCRH::FEN::FifosEnabled); // 8N1 + Fifo on
@ -1904,7 +1904,7 @@ diff -uNr 13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
self.registers
.CR
.write(CR::UARTEN::Enabled + CR::TXE::Enabled + CR::RXE::Enabled);
@@ -203,6 +259,35 @@
@@ -207,6 +263,35 @@
self.chars_written += 1;
}
@ -1940,7 +1940,7 @@ diff -uNr 13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
}
/// Implementing `core::fmt::Write` enables usage of the `format_args!` macros, which in turn are
@@ -228,9 +313,10 @@
@@ -232,9 +317,10 @@
/// # Safety
///
/// - The user must ensure to provide the correct `base_addr`.
@ -1953,7 +1953,7 @@ diff -uNr 13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
}
}
}
@@ -251,6 +337,21 @@
@@ -255,6 +341,21 @@
Ok(())
}
@ -1975,7 +1975,7 @@ diff -uNr 13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
}
impl console::interface::Write for PL011Uart {
@@ -282,25 +383,7 @@
@@ -286,25 +387,7 @@
impl console::interface::Read for PL011Uart {
fn read_char(&self) -> char {
let mut r = &self.inner;
@ -2002,7 +2002,7 @@ diff -uNr 13_integrated_testing/src/bsp/device_driver/bcm/bcm2xxx_pl011_uart.rs
}
fn clear(&self) {
@@ -325,3 +408,25 @@
@@ -329,3 +412,25 @@
r.lock(|inner| inner.chars_read)
}
}

Loading…
Cancel
Save