mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
add the flash offset of the swap region in swap args
Each platform interprets this differently. On Precursor, it's the offset in FLASH of the swap region. Probably, flags should be added to configure this somehow for each platform, but still figuring a lot of things out. The plan is on Cramium for the swap data to always be at 0 in the external SPI, so, we don't store an offset (field is ignored).
This commit is contained in:
parent
eeeb9281c0
commit
28d07da7f1
1 changed files with 7 additions and 6 deletions
|
|
@ -5,10 +5,10 @@ use crate::xous_arguments::{XousArgument, XousArgumentCode, XousSize};
|
|||
|
||||
#[derive(Debug, Default, Clone, Copy)]
|
||||
pub struct Swap {
|
||||
/// Starting offset (in bytes)
|
||||
/// Starting offset (in bytes) of the swap RAM
|
||||
pub offset: u32,
|
||||
|
||||
/// Length (in bytes)
|
||||
/// Total swap length (in bytes) - not all is usable, as a portion is reserved for the MAC codes
|
||||
pub size: u32,
|
||||
|
||||
/// Region name (as a type)
|
||||
|
|
@ -18,8 +18,8 @@ pub struct Swap {
|
|||
/// by the device upon completion of the keying ceremony.
|
||||
pub key: [u8; 32],
|
||||
|
||||
/// Unused
|
||||
_padding: u32,
|
||||
/// Starting offset of swap in FLASH
|
||||
pub offset_flash: u32,
|
||||
}
|
||||
|
||||
impl fmt::Display for Swap {
|
||||
|
|
@ -37,7 +37,8 @@ impl Swap {
|
|||
size,
|
||||
name: u32::from_le_bytes(*b"Swap") as XousArgumentCode,
|
||||
key: [0u8; 32],
|
||||
_padding: 0,
|
||||
// location for swap offset in FLASH (for precursor)
|
||||
offset_flash: 0x21200000,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +54,7 @@ impl XousArgument for Swap {
|
|||
output.write_all(&self.size.to_le_bytes())?;
|
||||
output.write_all(&self.name.to_le_bytes())?;
|
||||
output.write_all(&self.key)?;
|
||||
output.write_all(&0u32.to_le_bytes())?;
|
||||
output.write_all(&self.offset_flash.to_le_bytes())?;
|
||||
written += 4 * 4 + 32;
|
||||
Ok(written)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue