Skip to main content

Config

Struct Config 

Source
pub struct Config { /* private fields */ }

Implementations§

Source§

impl Config

Source

pub const WORD_COUNT: usize = 64

Source

pub fn new() -> Self

Source

pub fn from_words(words: [u16; 64]) -> Self

Source

pub fn words(&self) -> &[u16; 64]

Source

pub fn vericomm_clock_high_delay(&self) -> u16

Source

pub fn set_vericomm_clock_high_delay(&mut self, delay: u16)

Source

pub fn vericomm_clock_low_delay(&self) -> u16

Source

pub fn set_vericomm_clock_low_delay(&mut self, delay: u16)

Source

pub fn vericomm_isv(&self) -> u8

Source

pub fn set_vericomm_isv(&mut self, value: u8)

Source

pub fn vericomm_clock_check_enabled(&self) -> bool

Source

pub fn set_vericomm_clock_check_enabled(&mut self, enabled: bool)

Source

pub fn veri_sdk_channel_selector(&self) -> u8

Source

pub fn set_veri_sdk_channel_selector(&mut self, channel: u8)

Source

pub fn mode_selector(&self) -> u8

Source

pub fn set_mode_selector(&mut self, mode: u8)

Source

pub fn flash_begin_block_addr(&self) -> u16

Source

pub fn set_flash_begin_block_addr(&mut self, addr: u16)

Source

pub fn flash_begin_cluster_addr(&self) -> u16

Source

pub fn set_flash_begin_cluster_addr(&mut self, addr: u16)

Source

pub fn flash_read_end_block_addr(&self) -> u16

Source

pub fn set_flash_read_end_block_addr(&mut self, addr: u16)

Source

pub fn flash_read_end_cluster_addr(&self) -> u16

Source

pub fn set_flash_read_end_cluster_addr(&mut self, addr: u16)

Source

pub fn licence_key(&self) -> u16

Source

pub fn security_key(&self) -> u16

The hardware exposes the security key through the same configuration word used for the active license key.

Source

pub fn set_licence_key(&mut self, key: u16)

Source

pub fn smims_version_raw(&self) -> u16

Examples found in repository?
examples/stress_abort.rs (line 62)
12fn real_main() -> Result<(), Box<dyn Error>> {
13    let mut iterations = 10usize;
14    let mut words = 512usize;
15    let mut window = 4usize;
16    let mut clock_high = 4u16;
17    let mut clock_low = 4u16;
18    let mut settle_ms = 0u64;
19
20    let mut args = env::args().skip(1);
21    while let Some(flag) = args.next() {
22        match flag.as_str() {
23            "--iterations" => {
24                iterations = args
25                    .next()
26                    .ok_or("missing value for --iterations")?
27                    .parse()?
28            }
29            "--words" => words = args.next().ok_or("missing value for --words")?.parse()?,
30            "--window" => window = args.next().ok_or("missing value for --window")?.parse()?,
31            "--clock-high" => {
32                clock_high = args
33                    .next()
34                    .ok_or("missing value for --clock-high")?
35                    .parse()?
36            }
37            "--clock-low" => {
38                clock_low = args
39                    .next()
40                    .ok_or("missing value for --clock-low")?
41                    .parse()?
42            }
43            "--settle-ms" => {
44                settle_ms = args
45                    .next()
46                    .ok_or("missing value for --settle-ms")?
47                    .parse()?
48            }
49            other => return Err(format!("unknown flag `{other}`").into()),
50        }
51    }
52
53    let tx = vec![0x1234u16; words];
54
55    for iteration in 0..iterations {
56        println!("iter={iteration} phase=open");
57        let mut board = Board::open()?;
58        println!(
59            "iter={iteration} config programmed={} fifo_words={} version=0x{:04x}",
60            board.config().is_programmed(),
61            board.config().fifo_size_words(),
62            board.config().smims_version_raw()
63        );
64
65        let mut io = board.configure_io(&IoConfig {
66            clock_high_delay: clock_high,
67            clock_low_delay: clock_low,
68            ..IoConfig::default()
69        })?;
70
71        {
72            let mut rolling = io.transfer_window(words, window)?;
73            for submit_index in 0..window {
74                rolling.submit(&tx)?;
75                println!("iter={iteration} submit={submit_index}");
76            }
77            if settle_ms > 0 {
78                thread::sleep(Duration::from_millis(settle_ms));
79            }
80        }
81
82        io.finish()?;
83        board.close()?;
84
85        println!("iter={iteration} phase=reopen");
86        let reopened = Board::open()?;
87        println!(
88            "iter={iteration} reopened programmed={} fifo_words={} version=0x{:04x}",
89            reopened.config().is_programmed(),
90            reopened.config().fifo_size_words(),
91            reopened.config().smims_version_raw()
92        );
93        reopened.close()?;
94    }
95
96    Ok(())
97}
Source

pub fn smims_major_version(&self) -> u8

Source

pub fn smims_sub_version(&self) -> u8

Source

pub fn smims_patch_version(&self) -> u8

Source

pub fn fifo_size_words(&self) -> u16

Returns the FIFO capacity in 16-bit words.

This matches the legacy C++ implementation, where CFG[33] is passed directly to SMIMS_FIFO_Write / SMIMS_FIFO_Read as a word count.

Examples found in repository?
examples/bench_transfer.rs (line 149)
147fn run_device_bench(options: &Options) -> Result<(), Box<dyn Error>> {
148    let mut board = Board::open_with_transport(options.transport)?;
149    let max_cycles_per_transfer = usize::from(board.config().fifo_size_words()) / WORDS_PER_CYCLE;
150    let mut io = board.configure_io(&IoConfig {
151        clock_high_delay: options.clock_high_delay,
152        clock_low_delay: options.clock_low_delay,
153        ..IoConfig::default()
154    })?;
155
156    if options.window == 0 {
157        return Err("window must be at least 1".into());
158    }
159
160    let template = vec![0x1234u16; options.words];
161    let mut rx = vec![0u16; options.words];
162    let mut outputs = vec![vec![0u16; options.words]; options.window];
163    let mut stage_profile = TransferStageProfile::default();
164
165    let started = Instant::now();
166    if options.window == 1 {
167        if options.profile_stages {
168            for _ in 0..options.iterations {
169                let profile = io.transfer_profiled_into(&template, &mut rx)?;
170                stage_profile.merge(&profile);
171            }
172        } else {
173            for _ in 0..options.iterations {
174                io.transfer(&template, &mut rx)?;
175            }
176        }
177    } else {
178        let mut window = io.transfer_window(options.words, options.window)?;
179        let initial = options.iterations.min(options.window);
180        for _ in 0..initial {
181            if options.profile_stages {
182                let profile = window.submit_profiled(&template)?;
183                stage_profile.merge(&profile);
184            } else {
185                window.submit(&template)?;
186            }
187        }
188
189        let mut submitted = initial;
190        let mut completed = 0usize;
191        while completed < options.iterations {
192            let output = outputs[completed % options.window].as_mut_slice();
193            if options.profile_stages {
194                let profile = window.receive_into_profiled(output)?;
195                stage_profile.merge(&profile);
196            } else {
197                window.receive_into(output)?;
198            }
199            completed += 1;
200
201            if submitted < options.iterations {
202                if options.profile_stages {
203                    let profile = window.submit_profiled(&template)?;
204                    stage_profile.merge(&profile);
205                } else {
206                    window.submit(&template)?;
207                }
208                submitted += 1;
209            }
210        }
211    }
212    let elapsed = started.elapsed();
213    io.finish()?;
214
215    print_summary(
216        "device",
217        options.words,
218        options.iterations,
219        elapsed,
220        Some(max_cycles_per_transfer),
221    );
222    if options.profile_stages {
223        print_stage_profile(&stage_profile, elapsed);
224    }
225    Ok(())
226}
More examples
Hide additional examples
examples/stress_abort.rs (line 61)
12fn real_main() -> Result<(), Box<dyn Error>> {
13    let mut iterations = 10usize;
14    let mut words = 512usize;
15    let mut window = 4usize;
16    let mut clock_high = 4u16;
17    let mut clock_low = 4u16;
18    let mut settle_ms = 0u64;
19
20    let mut args = env::args().skip(1);
21    while let Some(flag) = args.next() {
22        match flag.as_str() {
23            "--iterations" => {
24                iterations = args
25                    .next()
26                    .ok_or("missing value for --iterations")?
27                    .parse()?
28            }
29            "--words" => words = args.next().ok_or("missing value for --words")?.parse()?,
30            "--window" => window = args.next().ok_or("missing value for --window")?.parse()?,
31            "--clock-high" => {
32                clock_high = args
33                    .next()
34                    .ok_or("missing value for --clock-high")?
35                    .parse()?
36            }
37            "--clock-low" => {
38                clock_low = args
39                    .next()
40                    .ok_or("missing value for --clock-low")?
41                    .parse()?
42            }
43            "--settle-ms" => {
44                settle_ms = args
45                    .next()
46                    .ok_or("missing value for --settle-ms")?
47                    .parse()?
48            }
49            other => return Err(format!("unknown flag `{other}`").into()),
50        }
51    }
52
53    let tx = vec![0x1234u16; words];
54
55    for iteration in 0..iterations {
56        println!("iter={iteration} phase=open");
57        let mut board = Board::open()?;
58        println!(
59            "iter={iteration} config programmed={} fifo_words={} version=0x{:04x}",
60            board.config().is_programmed(),
61            board.config().fifo_size_words(),
62            board.config().smims_version_raw()
63        );
64
65        let mut io = board.configure_io(&IoConfig {
66            clock_high_delay: clock_high,
67            clock_low_delay: clock_low,
68            ..IoConfig::default()
69        })?;
70
71        {
72            let mut rolling = io.transfer_window(words, window)?;
73            for submit_index in 0..window {
74                rolling.submit(&tx)?;
75                println!("iter={iteration} submit={submit_index}");
76            }
77            if settle_ms > 0 {
78                thread::sleep(Duration::from_millis(settle_ms));
79            }
80        }
81
82        io.finish()?;
83        board.close()?;
84
85        println!("iter={iteration} phase=reopen");
86        let reopened = Board::open()?;
87        println!(
88            "iter={iteration} reopened programmed={} fifo_words={} version=0x{:04x}",
89            reopened.config().is_programmed(),
90            reopened.config().fifo_size_words(),
91            reopened.config().smims_version_raw()
92        );
93        reopened.close()?;
94    }
95
96    Ok(())
97}
Source

pub fn fifo_size(&self) -> u16

Legacy alias for Self::fifo_size_words.

Source

pub fn flash_total_block(&self) -> u16

Source

pub fn flash_block_size(&self) -> u16

Source

pub fn flash_cluster_size(&self) -> u16

Source

pub fn vericomm_ability(&self) -> bool

Source

pub fn veri_instrument_ability(&self) -> bool

Source

pub fn veri_soc_ability(&self) -> bool

Source

pub fn vericomm_pro_ability(&self) -> bool

Source

pub fn veri_sdk_ability(&self) -> bool

Source

pub fn is_programmed(&self) -> bool

Examples found in repository?
examples/stress_abort.rs (line 60)
12fn real_main() -> Result<(), Box<dyn Error>> {
13    let mut iterations = 10usize;
14    let mut words = 512usize;
15    let mut window = 4usize;
16    let mut clock_high = 4u16;
17    let mut clock_low = 4u16;
18    let mut settle_ms = 0u64;
19
20    let mut args = env::args().skip(1);
21    while let Some(flag) = args.next() {
22        match flag.as_str() {
23            "--iterations" => {
24                iterations = args
25                    .next()
26                    .ok_or("missing value for --iterations")?
27                    .parse()?
28            }
29            "--words" => words = args.next().ok_or("missing value for --words")?.parse()?,
30            "--window" => window = args.next().ok_or("missing value for --window")?.parse()?,
31            "--clock-high" => {
32                clock_high = args
33                    .next()
34                    .ok_or("missing value for --clock-high")?
35                    .parse()?
36            }
37            "--clock-low" => {
38                clock_low = args
39                    .next()
40                    .ok_or("missing value for --clock-low")?
41                    .parse()?
42            }
43            "--settle-ms" => {
44                settle_ms = args
45                    .next()
46                    .ok_or("missing value for --settle-ms")?
47                    .parse()?
48            }
49            other => return Err(format!("unknown flag `{other}`").into()),
50        }
51    }
52
53    let tx = vec![0x1234u16; words];
54
55    for iteration in 0..iterations {
56        println!("iter={iteration} phase=open");
57        let mut board = Board::open()?;
58        println!(
59            "iter={iteration} config programmed={} fifo_words={} version=0x{:04x}",
60            board.config().is_programmed(),
61            board.config().fifo_size_words(),
62            board.config().smims_version_raw()
63        );
64
65        let mut io = board.configure_io(&IoConfig {
66            clock_high_delay: clock_high,
67            clock_low_delay: clock_low,
68            ..IoConfig::default()
69        })?;
70
71        {
72            let mut rolling = io.transfer_window(words, window)?;
73            for submit_index in 0..window {
74                rolling.submit(&tx)?;
75                println!("iter={iteration} submit={submit_index}");
76            }
77            if settle_ms > 0 {
78                thread::sleep(Duration::from_millis(settle_ms));
79            }
80        }
81
82        io.finish()?;
83        board.close()?;
84
85        println!("iter={iteration} phase=reopen");
86        let reopened = Board::open()?;
87        println!(
88            "iter={iteration} reopened programmed={} fifo_words={} version=0x{:04x}",
89            reopened.config().is_programmed(),
90            reopened.config().fifo_size_words(),
91            reopened.config().smims_version_raw()
92        );
93        reopened.close()?;
94    }
95
96    Ok(())
97}
Source

pub fn is_pcb_connected(&self) -> bool

Source

pub fn vericomm_clock_continues(&self) -> bool

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Config

Source§

fn eq(&self, other: &Config) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for Config

Source§

impl StructuralPartialEq for Config

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.