1
0
Fork 0

improve debug messaging

This commit is contained in:
Sebastien Bourdeauducq 2020-04-26 16:10:09 +08:00
parent b7eacaeac7
commit 44b37aba7d
2 changed files with 5 additions and 3 deletions

View File

@ -3,7 +3,7 @@ use core::fmt;
use core::cmp::min; use core::cmp::min;
use core::cell::RefCell; use core::cell::RefCell;
use alloc::rc::Rc; use alloc::rc::Rc;
use log::{warn, error}; use log::{debug, warn, error};
use num_derive::{FromPrimitive, ToPrimitive}; use num_derive::{FromPrimitive, ToPrimitive};
use num_traits::{FromPrimitive, ToPrimitive}; use num_traits::{FromPrimitive, ToPrimitive};
@ -105,6 +105,7 @@ async fn write_header(stream: &TcpStream, reply: Reply) -> Result<()> {
async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Control>>) -> Result<()> { async fn handle_connection(stream: &TcpStream, control: Rc<RefCell<kernel::Control>>) -> Result<()> {
expect(&stream, b"ARTIQ coredev\n").await?; expect(&stream, b"ARTIQ coredev\n").await?;
debug!("received connection");
loop { loop {
if !expect(&stream, &[0x5a, 0x5a, 0x5a, 0x5a]).await? { if !expect(&stream, &[0x5a, 0x5a, 0x5a, 0x5a]).await? {
return Err(Error::UnexpectedPattern) return Err(Error::UnexpectedPattern)

View File

@ -125,6 +125,7 @@ pub fn main_core1() {
ptr::write_bytes(__bss_start as *mut u8, 0, (_end - __bss_start) as usize); ptr::write_bytes(__bss_start as *mut u8, 0, (_end - __bss_start) as usize);
} }
current_modinit = Some(__modinit__); current_modinit = Some(__modinit__);
debug!("kernel loaded");
core1_tx.send(Message::LoadCompleted) core1_tx.send(Message::LoadCompleted)
}, },
Err(error) => { Err(error) => {
@ -134,13 +135,13 @@ pub fn main_core1() {
} }
}, },
Message::StartRequest => { Message::StartRequest => {
debug!("starting"); debug!("kernel starting");
if let Some(__modinit__) = current_modinit { if let Some(__modinit__) = current_modinit {
unsafe { unsafe {
(mem::transmute::<u32, fn()>(__modinit__))(); (mem::transmute::<u32, fn()>(__modinit__))();
} }
} }
debug!("stopping"); debug!("kernel terminated");
} }
_ => error!("Core1 received unexpected message: {:?}", message), _ => error!("Core1 received unexpected message: {:?}", message),
} }