sim: Allow access to the boot response
When the bootloader completes, it fills a response structure with
various information.  Move this into the BootGoResult and provide an
accessor for it.
@@ -20,6 +20,8 @@ pub enum BootGoResult {
Normal {
result: i32,
asserts: u8,
+
+ resp: api::BootRsp,
},
}
@@ -39,6 +41,7 @@ impl BootGoResult {
matches!(self, BootGoResult::Normal {
result: 0,
asserts: 0,
+ ..
})
}
@@ -49,6 +52,14 @@ impl BootGoResult {
_ => 0,
}
}
+
+ /// Retrieve the 'resp' field that is filled in.
+ pub fn resp(&self) -> Option<&api::BootRsp> {
+ match self {
+ BootGoResult::Normal { resp, .. } => Some(resp),
+ _ => None,
+ }
+ }
}
/// Invoke the bootloader on this flash device.
@@ -86,7 +97,7 @@ pub fn boot_go(multiflash: &mut SimMultiFlash, areadesc: &AreaDesc,
if result == -0x13579 {
BootGoResult::Stopped
} else {
- BootGoResult::Normal { result, asserts }
+ BootGoResult::Normal { result, asserts, resp: rsp }
}
}
