Commit d82de8c7 authored by David Brown's avatar David Brown Committed by David Brown
Browse files

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.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
parent 6d47d42e
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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 }
    }
}