runtime: fix rtio::log

This commit is contained in:
Sebastien Bourdeauducq 2017-11-03 09:25:37 +08:00
parent 4387b0be1e
commit 0d8bad5128
1 changed files with 5 additions and 4 deletions

View File

@ -140,17 +140,18 @@ pub fn log(timestamp: i64, data: &[u8]) {
for i in 0..data.len() { for i in 0..data.len() {
word <<= 8; word <<= 8;
word |= data[i] as u32; word |= data[i] as u32;
if i != 0 && i % 4 == 0 { if i % 4 == 3 {
rtio_o_data_write(0, word); rtio_o_data_write(0, word);
csr::rtio::o_we_write(1); csr::rtio::o_we_write(1);
word = 0; word = 0;
} }
} }
word <<= 8; if word != 0 {
rtio_o_data_write(0, word); rtio_o_data_write(0, word);
csr::rtio::o_we_write(1); csr::rtio::o_we_write(1);
} }
}
} }
#[cfg(not(has_rtio_log))] #[cfg(not(has_rtio_log))]