From c78568bba1022611f3dc8902c3491e70010af11b Mon Sep 17 00:00:00 2001 From: Andre Richter Date: Sun, 12 Jul 2020 15:06:46 +0200 Subject: [PATCH] Update some links --- 05_safe_globals/README.md | 11 ++++++----- 05_safe_globals/src/synchronization.rs | 9 +++++---- 06_drivers_gpio_uart/src/synchronization.rs | 9 +++++---- 07_uart_chainloader/src/synchronization.rs | 9 +++++---- 08_timestamps/src/synchronization.rs | 9 +++++---- 09_hw_debug_JTAG/src/synchronization.rs | 9 +++++---- 10_privilege_level/src/synchronization.rs | 9 +++++---- 11_virtual_memory/src/synchronization.rs | 9 +++++---- 12_exceptions_part1_groundwork/src/synchronization.rs | 9 +++++---- 13_integrated_testing/src/synchronization.rs | 9 +++++---- 14_exceptions_part2_peripheral_IRQs/README.md | 10 +++++----- .../src/synchronization.rs | 9 +++++---- 12 files changed, 61 insertions(+), 50 deletions(-) diff --git a/05_safe_globals/README.md b/05_safe_globals/README.md index cdf0366a..163bce95 100644 --- a/05_safe_globals/README.md +++ b/05_safe_globals/README.md @@ -251,7 +251,7 @@ diff -uNr 04_zero_overhead_abstraction/src/main.rs 05_safe_globals/src/main.rs diff -uNr 04_zero_overhead_abstraction/src/synchronization.rs 05_safe_globals/src/synchronization.rs --- 04_zero_overhead_abstraction/src/synchronization.rs +++ 05_safe_globals/src/synchronization.rs -@@ -0,0 +1,91 @@ +@@ -0,0 +1,92 @@ +// SPDX-License-Identifier: MIT OR Apache-2.0 +// +// Copyright (c) 2020 Andre Richter @@ -270,10 +270,8 @@ diff -uNr 04_zero_overhead_abstraction/src/synchronization.rs 05_safe_globals/sr + /// Any object implementing this trait guarantees exclusive access to the data contained within + /// the Mutex for the duration of the provided closure. + /// -+ /// The trait follows the [Rust embedded WG's -+ /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore -+ /// provides some goodness such as [deadlock -+ /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). ++ /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness ++ /// such as [deadlock prevention]. + /// + /// # Example + /// @@ -281,6 +279,9 @@ diff -uNr 04_zero_overhead_abstraction/src/synchronization.rs 05_safe_globals/sr + /// best implemented **for a reference to a container struct**, and has a usage pattern that + /// might feel strange at first: + /// ++ /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md ++ /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility ++ /// + /// ``` + /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); + /// diff --git a/05_safe_globals/src/synchronization.rs b/05_safe_globals/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/05_safe_globals/src/synchronization.rs +++ b/05_safe_globals/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/06_drivers_gpio_uart/src/synchronization.rs b/06_drivers_gpio_uart/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/06_drivers_gpio_uart/src/synchronization.rs +++ b/06_drivers_gpio_uart/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/07_uart_chainloader/src/synchronization.rs b/07_uart_chainloader/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/07_uart_chainloader/src/synchronization.rs +++ b/07_uart_chainloader/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/08_timestamps/src/synchronization.rs b/08_timestamps/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/08_timestamps/src/synchronization.rs +++ b/08_timestamps/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/09_hw_debug_JTAG/src/synchronization.rs b/09_hw_debug_JTAG/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/09_hw_debug_JTAG/src/synchronization.rs +++ b/09_hw_debug_JTAG/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/10_privilege_level/src/synchronization.rs b/10_privilege_level/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/10_privilege_level/src/synchronization.rs +++ b/10_privilege_level/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/11_virtual_memory/src/synchronization.rs b/11_virtual_memory/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/11_virtual_memory/src/synchronization.rs +++ b/11_virtual_memory/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/12_exceptions_part1_groundwork/src/synchronization.rs b/12_exceptions_part1_groundwork/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/12_exceptions_part1_groundwork/src/synchronization.rs +++ b/12_exceptions_part1_groundwork/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/13_integrated_testing/src/synchronization.rs b/13_integrated_testing/src/synchronization.rs index caa2794a..f38ce375 100644 --- a/13_integrated_testing/src/synchronization.rs +++ b/13_integrated_testing/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); /// diff --git a/14_exceptions_part2_peripheral_IRQs/README.md b/14_exceptions_part2_peripheral_IRQs/README.md index f26aeb22..112de42d 100644 --- a/14_exceptions_part2_peripheral_IRQs/README.md +++ b/14_exceptions_part2_peripheral_IRQs/README.md @@ -2580,7 +2580,7 @@ diff -uNr 13_integrated_testing/src/state.rs 14_exceptions_part2_peripheral_IRQs diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_peripheral_IRQs/src/synchronization.rs --- 13_integrated_testing/src/synchronization.rs +++ 14_exceptions_part2_peripheral_IRQs/src/synchronization.rs -@@ -42,6 +42,21 @@ +@@ -43,6 +43,21 @@ /// Creates a critical section and grants temporary mutable access to the encapsulated data. fn lock(&mut self, f: impl FnOnce(&mut Self::Data) -> R) -> R; } @@ -2602,7 +2602,7 @@ diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_perip } /// A pseudo-lock for teaching purposes. -@@ -52,10 +67,17 @@ +@@ -53,10 +68,17 @@ /// other cores to the contained data. This part is preserved for later lessons. /// /// The lock will only be used as long as it is safe to do so, i.e. as long as the kernel is @@ -2622,7 +2622,7 @@ diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_perip data: UnsafeCell, } -@@ -63,10 +85,20 @@ +@@ -64,10 +86,20 @@ // Public Code //-------------------------------------------------------------------------------------------------- @@ -2646,7 +2646,7 @@ diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_perip pub const fn new(data: T) -> Self { Self { data: UnsafeCell::new(data), -@@ -77,8 +109,9 @@ +@@ -78,8 +110,9 @@ //------------------------------------------------------------------------------ // OS Interface Code //------------------------------------------------------------------------------ @@ -2657,7 +2657,7 @@ diff -uNr 13_integrated_testing/src/synchronization.rs 14_exceptions_part2_perip type Data = T; fn lock(&mut self, f: impl FnOnce(&mut Self::Data) -> R) -> R { -@@ -86,6 +119,32 @@ +@@ -87,6 +120,32 @@ // mutable reference will ever only be given out once at a time. let data = unsafe { &mut *self.data.get() }; diff --git a/14_exceptions_part2_peripheral_IRQs/src/synchronization.rs b/14_exceptions_part2_peripheral_IRQs/src/synchronization.rs index 08edd68d..b519ea3e 100644 --- a/14_exceptions_part2_peripheral_IRQs/src/synchronization.rs +++ b/14_exceptions_part2_peripheral_IRQs/src/synchronization.rs @@ -16,10 +16,8 @@ pub mod interface { /// Any object implementing this trait guarantees exclusive access to the data contained within /// the Mutex for the duration of the provided closure. /// - /// The trait follows the [Rust embedded WG's - /// proposal](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md) and therefore - /// provides some goodness such as [deadlock - /// prevention](https://github.com/korken89/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility). + /// The trait follows the [Rust embedded WG's proposal] and therefore provides some goodness + /// such as [deadlock prevention]. /// /// # Example /// @@ -27,6 +25,9 @@ pub mod interface { /// best implemented **for a reference to a container struct**, and has a usage pattern that /// might feel strange at first: /// + /// [Rust embedded WG's proposal]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md + /// [deadlock prevention]: https://github.com/rust-embedded/wg/blob/master/rfcs/0377-mutex-trait.md#design-decisions-and-compatibility + /// /// ``` /// static MUT: Mutex> = Mutex::new(RefCell::new(0)); ///