opentitanlib/ownership/
mod.rs

1// Copyright lowRISC contributors (OpenTitan project).
2// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3// SPDX-License-Identifier: Apache-2.0
4
5use std::sync::atomic::{AtomicBool, Ordering};
6
7mod application_key;
8mod flash;
9mod flash_info;
10mod misc;
11pub mod owner;
12mod rescue;
13
14pub use application_key::{ApplicationKeyDomain, OwnerApplicationKey};
15pub use flash::{FlashFlags, OwnerFlashConfig, OwnerFlashRegion};
16pub use flash_info::{OwnerFlashInfoConfig, OwnerInfoPage};
17pub use misc::{KeyMaterial, OwnershipKeyAlg, TlvHeader, TlvTag};
18pub use owner::{OwnerBlock, OwnerConfigItem, SramExecMode};
19pub use rescue::{CommandTag, OwnerRescueConfig, RescueType};
20
21pub struct GlobalFlags;
22
23static DEBUG: AtomicBool = AtomicBool::new(false);
24
25impl GlobalFlags {
26    /// Set the value of the ownership debug flag.  This controls the serialization
27    /// of header and reserved fields in the ownership structs.
28    pub fn set_debug(v: bool) {
29        DEBUG.store(v, Ordering::Relaxed);
30    }
31
32    // Used by the serde serializer to query whether or not a field should be serialized.
33    pub fn not_debug<T>(_: &T) -> bool {
34        !DEBUG.load(Ordering::Relaxed)
35    }
36}