Skip to content

Commit 965fdd3

Browse files
author
whitequark
committedNov 22, 2016
runtime: show a prompt to erase startup/idle kernels.
1 parent 1d1e821 commit 965fdd3

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed
 

‎artiq/runtime.rs/src/lib.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use logger::BufferLogger;
1818
extern {
1919
fn putchar(c: libc::c_int) -> libc::c_int;
2020
fn readchar() -> libc::c_char;
21+
fn readchar_nonblock() -> libc::c_int;
2122
}
2223

2324
#[macro_export]
@@ -100,11 +101,23 @@ pub unsafe extern fn rust_main() {
100101
static mut LOG_BUFFER: [u8; 65536] = [0; 65536];
101102
BufferLogger::new(&mut LOG_BUFFER[..])
102103
.register(move || {
103-
info!("booting ARTIQ...");
104+
clock::init();
105+
info!("booting ARTIQ");
104106
info!("software version {}", GIT_COMMIT);
105107
info!("gateware version {}", ::board::ident(&mut [0; 64]));
106108

107-
clock::init();
109+
let t = clock::get_ms();
110+
info!("press 'e' to erase startup and idle kernels...");
111+
while clock::get_ms() < t + 1000 {
112+
if readchar_nonblock() != 0 && readchar() == b'e' as libc::c_char {
113+
config::remove("startup_kernel");
114+
config::remove("idle_kernel");
115+
info!("startup and idle kernels erased");
116+
break
117+
}
118+
}
119+
info!("continuing boot");
120+
108121
rtio_crg::init();
109122
network_init();
110123

0 commit comments

Comments
 (0)
Please sign in to comment.