move error definition to api crate, fixes hosted ci

This commit is contained in:
bunnie 2026-04-04 00:08:39 +08:00
parent f2371f49eb
commit 44a53e590a
4 changed files with 15 additions and 17 deletions

View file

@ -20,6 +20,17 @@ pub const RRAM_STORAGE_LEN: usize = 0x3D_A000;
pub const SWAP_START_UF2: usize = 0x7000_0000;
pub const SWAP_UF2_LEN: usize = 0x0800_0000; // 128 MiB
#[derive(Clone, Copy, Debug, PartialEq, Eq, num_derive::FromPrimitive, num_derive::ToPrimitive)]
pub enum OneWayErr {
OutOfBounds,
IncFail,
InvalidCoding,
// used to report messaging errors in xous environments
InternalError,
// used to indicate things are OK in xous environments
None,
}
// Define a trait with just the offset
pub trait OneWayEncoding: TryFrom<u32> {
const OFFSET: usize;

View file

@ -7,9 +7,9 @@
//! In the case of baremetal targets of course everything is mapped, so these
//! restrictions are not a concern.
use bao1x_api::OneWayEncoding;
use bao1x_api::bollard;
use bao1x_api::offsets::*;
use bao1x_api::{OneWayEncoding, OneWayErr};
#[cfg(feature = "std")]
use xous::MemoryRange;
@ -30,17 +30,6 @@ pub const ONEWAY_MAX_VALUE: u32 = 10_0000;
/// a single boot attempt.
pub const ONEWAY_MAX_DELTA: u32 = 512;
#[derive(Clone, Copy, Debug, PartialEq, Eq, num_derive::FromPrimitive, num_derive::ToPrimitive)]
pub enum OneWayErr {
OutOfBounds,
IncFail,
InvalidCoding,
// used to report messaging errors in xous environments
InternalError,
// used to indicate things are OK in xous environments
None,
}
pub struct OneWayCounter {
#[cfg(feature = "std")]
mapping: MemoryRange,

View file

@ -1,4 +1,4 @@
use bao1x_api::{BackupFlags, OneWayEncoding};
use bao1x_api::{BackupFlags, OneWayEncoding, OneWayErr};
pub use cipher::{
BlockBackend, BlockCipher, BlockClosure, BlockDecrypt, BlockEncrypt, BlockSizeUser, ParBlocksSizeUser,
consts::U16, generic_array::GenericArray, inout::InOut,
@ -10,8 +10,6 @@ use xous_ipc::Buffer;
pub(crate) type BatchBlocks = GenericArray<Block, U16>;
use std::convert::TryInto;
use bao1x_hal::acram::*;
#[derive(Debug)] // there is no confidential information in the external structure; it's safe to Debug it
pub struct Keystore {
conn: CID,

View file

@ -1,5 +1,5 @@
use bao1x_api::BackupFlags;
use bao1x_hal::acram::{MAX_ONEWAY_COUNTERS, OneWayErr};
use bao1x_api::{BackupFlags, OneWayErr};
use bao1x_hal::acram::MAX_ONEWAY_COUNTERS;
use bao1x_hal::board::{BOOKEND_END, BOOKEND_START};
use bao1x_hal::rram::Reram;
use keystore_api::*;