forked from M-Labs/artiq-zynq
use logging
This commit is contained in:
parent
79846504bd
commit
4cb73f32aa
@ -3,12 +3,12 @@ use core::fmt;
|
||||
use core::cmp::min;
|
||||
use core::cell::RefCell;
|
||||
use alloc::rc::Rc;
|
||||
use log::{warn, error};
|
||||
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use num_traits::{FromPrimitive, ToPrimitive};
|
||||
|
||||
use libboard_zynq::{
|
||||
println,
|
||||
self as zynq,
|
||||
smoltcp::{
|
||||
self,
|
||||
@ -185,7 +185,7 @@ async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Contr
|
||||
write_chunk(&stream, b"core1 failed to process data").await?;
|
||||
},
|
||||
_ => {
|
||||
println!("received unexpected message from core1: {:?}", reply);
|
||||
error!("received unexpected message from core1: {:?}", reply);
|
||||
write_header(&stream, Reply::LoadFailed).await?;
|
||||
write_chunk(&stream, b"core1 sent unexpected reply").await?;
|
||||
}
|
||||
@ -250,7 +250,7 @@ pub fn main() {
|
||||
task::spawn(async {
|
||||
let _ = handle_connection(&stream, control)
|
||||
.await
|
||||
.map_err(|e| println!("Connection: {}", e));
|
||||
.map_err(|e| warn!("Connection: {}", e));
|
||||
let _ = stream.flush().await;
|
||||
let _ = stream.abort().await;
|
||||
});
|
||||
|
@ -1,7 +1,7 @@
|
||||
use log::{debug, error};
|
||||
use alloc::{vec, vec::Vec, sync::Arc};
|
||||
|
||||
use libcortex_a9::{mutex::Mutex, sync_channel::{self, sync_channel}};
|
||||
use libboard_zynq::println;
|
||||
use libsupport_zynq::boot::Core1;
|
||||
|
||||
use dyld;
|
||||
@ -93,7 +93,7 @@ fn resolve(required: &[u8]) -> Option<u32> {
|
||||
|
||||
#[no_mangle]
|
||||
pub fn main_core1() {
|
||||
println!("Core1 started");
|
||||
debug!("Core1 started");
|
||||
|
||||
let mut core1_tx = None;
|
||||
while core1_tx.is_none() {
|
||||
@ -116,12 +116,12 @@ pub fn main_core1() {
|
||||
core1_tx.send(Message::LoadCompleted)
|
||||
},
|
||||
Err(error) => {
|
||||
println!("failed to load shared library: {}", error);
|
||||
error!("failed to load shared library: {}", error);
|
||||
core1_tx.send(Message::LoadFailed)
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => println!("Core1 received unexpected message: {:?}", message),
|
||||
_ => error!("Core1 received unexpected message: {:?}", message),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,9 @@ extern crate alloc;
|
||||
extern crate log;
|
||||
|
||||
use core::{cmp, str};
|
||||
use log::info;
|
||||
|
||||
use libboard_zynq::{
|
||||
println,
|
||||
self as zynq, clocks::Clocks, clocks::source::{ClockSource, ArmPll, IoPll},
|
||||
};
|
||||
use libsupport_zynq::{logger, ram};
|
||||
@ -33,9 +33,9 @@ fn identifier_read(buf: &mut [u8]) -> &str {
|
||||
|
||||
#[no_mangle]
|
||||
pub fn main_core0() {
|
||||
println!("ARTIQ runtime starting...");
|
||||
let _ = logger::init();
|
||||
log::set_max_level(log::LevelFilter::Debug);
|
||||
info!("NAR3 starting...");
|
||||
|
||||
const CPU_FREQ: u32 = 800_000_000;
|
||||
|
||||
@ -46,7 +46,7 @@ pub fn main_core0() {
|
||||
let mut ddr = zynq::ddr::DdrRam::new();
|
||||
ram::init_alloc(&mut ddr);
|
||||
|
||||
println!("Detected gateware: {}", identifier_read(&mut [0; 64]));
|
||||
info!("Detected gateware: {}", identifier_read(&mut [0; 64]));
|
||||
|
||||
comms::main();
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
use core::ptr::{read_volatile, write_volatile};
|
||||
use cslice::CSlice;
|
||||
|
||||
use libboard_zynq::println;
|
||||
use log::error;
|
||||
|
||||
use crate::pl::csr;
|
||||
|
||||
@ -56,11 +55,11 @@ unsafe fn process_exceptional_status(channel: i32, status: u8) {
|
||||
while csr::rtio::o_status_read() & RTIO_O_STATUS_WAIT != 0 {}
|
||||
}
|
||||
if status & RTIO_O_STATUS_UNDERFLOW != 0 {
|
||||
println!("RTIO underflow at {0} mu, channel {1}, slack {2} mu",
|
||||
error!("RTIO underflow at {0} mu, channel {1}, slack {2} mu",
|
||||
timestamp, channel as i64, timestamp - get_counter());
|
||||
}
|
||||
if status & RTIO_O_STATUS_DESTINATION_UNREACHABLE != 0 {
|
||||
println!("RTIO destination unreachable, output, at {0} mu, channel {1}",
|
||||
error!("RTIO destination unreachable, output, at {0} mu, channel {1}",
|
||||
timestamp, channel as i64);
|
||||
}
|
||||
}
|
||||
@ -103,14 +102,14 @@ pub extern fn input_timestamp(timeout: i64, channel: i32) -> i64 {
|
||||
|
||||
if status & RTIO_I_STATUS_OVERFLOW != 0 {
|
||||
csr::rtio::i_overflow_reset_write(1);
|
||||
println!("RTIO input overflow on channel {0}",
|
||||
error!("RTIO input overflow on channel {0}",
|
||||
channel as i64);
|
||||
}
|
||||
if status & RTIO_I_STATUS_WAIT_EVENT != 0 {
|
||||
return -1
|
||||
}
|
||||
if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 {
|
||||
println!("RTIO destination unreachable, input, on channel {0}",
|
||||
error!("RTIO destination unreachable, input, on channel {0}",
|
||||
channel as i64);
|
||||
}
|
||||
|
||||
@ -130,11 +129,11 @@ pub extern fn input_data(channel: i32) -> i32 {
|
||||
|
||||
if status & RTIO_I_STATUS_OVERFLOW != 0 {
|
||||
csr::rtio::i_overflow_reset_write(1);
|
||||
println!("RTIO input overflow on channel {0}",
|
||||
error!("RTIO input overflow on channel {0}",
|
||||
channel as i64);
|
||||
}
|
||||
if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 {
|
||||
println!("RTIO destination unreachable, input, on channel {0}",
|
||||
error!("RTIO destination unreachable, input, on channel {0}",
|
||||
channel as i64);
|
||||
}
|
||||
|
||||
@ -154,14 +153,14 @@ pub extern fn input_timestamped_data(timeout: i64, channel: i32) -> TimestampedD
|
||||
|
||||
if status & RTIO_I_STATUS_OVERFLOW != 0 {
|
||||
csr::rtio::i_overflow_reset_write(1);
|
||||
println!("RTIO input overflow on channel {0}",
|
||||
error!("RTIO input overflow on channel {0}",
|
||||
channel as i64);
|
||||
}
|
||||
if status & RTIO_I_STATUS_WAIT_EVENT != 0 {
|
||||
return TimestampedData { timestamp: -1, data: 0 }
|
||||
}
|
||||
if status & RTIO_I_STATUS_DESTINATION_UNREACHABLE != 0 {
|
||||
println!("RTIO destination unreachable, input, on channel {0}",
|
||||
error!("RTIO destination unreachable, input, on channel {0}",
|
||||
channel as i64);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user