1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! Logic and implementations for CASPER "Yellow Block" devices.
//! These are at the heart of a casperfpga design and will be the structs you primarily interact
//! with.
//!
//! From a design perspective, all of the yellow block structs contain a `transport` field which is
//! of type `Weak<Mutex<T: Transport>>`, this allows the yellow block to interact with the
//! transport, but not own the transport. This is important as one will almost certainly have
//! many yellow blocks that will all needs to interface to the hardware. Although nothing enforces
//! the convention, it is best practice to put the owned `Arc<Mutex<T:Transport>>` in some top-level
//! struct and then have the yellow blocks as members of that struct.
//!
//! To this end, all yellow block structs follow the constructor convention of `new(transport:
//! &Arc<Mutex<T:Transport>>, reg_name: &str, ..<metadata>)`, where the constructor implicitly calls
//! `Arc::downgrade`.
//!
//! Additionally, from an error handling perspective, every yellow block will have its own error
//! type, usually including a thin wrapper around the transport error.
use Error;
/// Certain Yellow Block struct types will implement this trait to allow for auto offsets in
/// transport read methods
/// Top level error for all yellow blocks (rarely used)