mirror of https://github.com/m-labs/artiq.git
artiq_coreboot: block until hotswap image is actually received.
This commit is contained in:
parent
804e69b144
commit
795a3e24d8
|
@ -60,6 +60,8 @@ class _D2HMsgType(Enum):
|
|||
WATCHDOG_EXPIRED = 14
|
||||
CLOCK_FAILURE = 15
|
||||
|
||||
HOTSWAP_IMMINENT = 16
|
||||
|
||||
|
||||
class _LogLevel(Enum):
|
||||
OFF = 0
|
||||
|
@ -332,6 +334,8 @@ class CommKernel:
|
|||
self._write_header(_H2DMsgType.HOTSWAP)
|
||||
self._write_bytes(image)
|
||||
|
||||
self._read_empty(_D2HMsgType.HOTSWAP_IMMINENT)
|
||||
|
||||
def load(self, kernel_library):
|
||||
self._write_header(_H2DMsgType.LOAD_KERNEL)
|
||||
self._write_bytes(kernel_library)
|
||||
|
|
|
@ -140,6 +140,8 @@ pub enum Reply<'a> {
|
|||
|
||||
WatchdogExpired,
|
||||
ClockFailure,
|
||||
|
||||
HotswapImminent,
|
||||
}
|
||||
|
||||
impl<'a> Reply<'a> {
|
||||
|
@ -219,6 +221,9 @@ impl<'a> Reply<'a> {
|
|||
Reply::ClockFailure => {
|
||||
writer.write_u8(15)?;
|
||||
},
|
||||
Reply::HotswapImminent => {
|
||||
writer.write_u8(16)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -116,6 +116,7 @@ fn host_read(stream: &mut TcpStream) -> io::Result<host::Request> {
|
|||
let request = host::Request::read_from(stream)?;
|
||||
match &request {
|
||||
&host::Request::LoadKernel(_) => debug!("comm<-host LoadLibrary(...)"),
|
||||
&host::Request::Hotswap(_) => debug!("comm<-host Hotswap(...)"),
|
||||
_ => debug!("comm<-host {:?}", request)
|
||||
}
|
||||
Ok(request)
|
||||
|
@ -269,8 +270,12 @@ fn process_host_message(io: &Io,
|
|||
}
|
||||
|
||||
// artiq_coreboot
|
||||
host::Request::Hotswap(binary) =>
|
||||
unsafe { board::hotswap::run(&binary) },
|
||||
host::Request::Hotswap(binary) => {
|
||||
host_write(stream, host::Reply::HotswapImminent)?;
|
||||
stream.close()?;
|
||||
warn!("hotswapping firmware");
|
||||
unsafe { board::hotswap::run(&binary) }
|
||||
}
|
||||
|
||||
// artiq_run/artiq_master
|
||||
host::Request::SwitchClock(clk) => {
|
||||
|
|
Loading…
Reference in New Issue