mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
try to layer in the fcc agent
This commit is contained in:
parent
886f48ba61
commit
b9a31f7d99
16 changed files with 261 additions and 82 deletions
17
Cargo.lock
generated
17
Cargo.lock
generated
|
|
@ -156,7 +156,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "com_rs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/betrusted-io/com_rs.git?rev=9a91a81f482ea8eba2f2de5d6c20b9bd399f39a9#9a91a81f482ea8eba2f2de5d6c20b9bd399f39a9"
|
||||
source = "git+https://github.com/betrusted-io/com_rs.git?rev=a9e05f414accef08348b77be6fc0f668b319e6ff#a9e05f414accef08348b77be6fc0f668b319e6ff"
|
||||
|
||||
[[package]]
|
||||
name = "crc"
|
||||
|
|
@ -217,6 +217,20 @@ dependencies = [
|
|||
"termcolor",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fcc-agent"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"com",
|
||||
"heapless",
|
||||
"log",
|
||||
"log-server",
|
||||
"ticktimer-server",
|
||||
"typenum",
|
||||
"utralib",
|
||||
"xous",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-cprng"
|
||||
version = "0.1.1"
|
||||
|
|
@ -801,7 +815,6 @@ dependencies = [
|
|||
"bitflags",
|
||||
"blitstr",
|
||||
"com",
|
||||
"com_rs",
|
||||
"graphics-server",
|
||||
"log",
|
||||
"log-server",
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ members = [
|
|||
"services/ticktimer-server",
|
||||
"services/com",
|
||||
"services/trng-tester",
|
||||
"services/fcc-agent",
|
||||
# "services/xous-names",
|
||||
"svd2utra",
|
||||
"xtask",
|
||||
|
|
@ -19,6 +20,7 @@ default-members = [
|
|||
"services/graphics-server",
|
||||
"services/ticktimer-server",
|
||||
"services/trng-tester",
|
||||
"services/fcc-agent",
|
||||
# "services/xous-names",
|
||||
"services/com",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -81,6 +81,11 @@ then
|
|||
sudo wishbone-tool --csr-csv $CSR_CSV --load-name $KERNEL_IMAGE --load-address 0x500000 --load-flash
|
||||
fi
|
||||
else
|
||||
|
||||
md5sum $FPGA_IMAGE
|
||||
md5sum $KERNEL_IMAGE
|
||||
md5sum $CSR_CSV
|
||||
|
||||
if [ $USE_IDENTITY -eq 1 ]
|
||||
then
|
||||
# there is a private key
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ heapless = "0.5"
|
|||
log-server = { path = "../log-server" }
|
||||
ticktimer-server = { path = "../ticktimer-server" }
|
||||
log = "0.4"
|
||||
com_rs = { git = "https://github.com/betrusted-io/com_rs.git", rev = "9a91a81f482ea8eba2f2de5d6c20b9bd399f39a9" }
|
||||
com_rs = { git = "https://github.com/betrusted-io/com_rs.git", rev = "a9e05f414accef08348b77be6fc0f668b319e6ff" }
|
||||
typenum = "1.12"
|
||||
|
||||
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
||||
|
|
@ -21,5 +21,6 @@ utralib = { path = "../../utralib"}
|
|||
|
||||
[features]
|
||||
debugprint = []
|
||||
fccagent = []
|
||||
#default = [] # "debugprint"
|
||||
default = ["debugprint"]
|
||||
default = ["debugprint", "fccagent"]
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ impl Into<[usize; 2]> for BattStats {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Opcode {
|
||||
pub enum Opcode<'a> {
|
||||
/// Battery stats
|
||||
BattStats,
|
||||
|
||||
|
|
@ -76,16 +76,28 @@ pub enum Opcode {
|
|||
FlashErase,
|
||||
|
||||
/// Program a page of FLASH
|
||||
FlashProgram,
|
||||
FlashProgram(&'a [u8]),
|
||||
|
||||
/// Update the SSID list
|
||||
SsidScan,
|
||||
|
||||
/// Return the latest SSID list
|
||||
SsidFetch,
|
||||
|
||||
/// Fetch the git ID of the EC
|
||||
EcGitRev,
|
||||
|
||||
/// Fetch the firmware rev of the WF200
|
||||
Wf200Rev,
|
||||
|
||||
/// Send a line of PDS data
|
||||
Wf200PdsLine(&'a [u8]),
|
||||
|
||||
/// Send Rx stats to fcc-agent
|
||||
RxStatsAgent,
|
||||
}
|
||||
|
||||
impl<'a> core::convert::TryFrom<&'a Message> for Opcode {
|
||||
impl<'a> core::convert::TryFrom<&'a Message> for Opcode<'a> {
|
||||
type Error = &'static str;
|
||||
fn try_from(message: &'a Message) -> Result<Self, Self::Error> {
|
||||
match message {
|
||||
|
|
@ -103,6 +115,8 @@ impl<'a> core::convert::TryFrom<&'a Message> for Opcode {
|
|||
} else if m.id as u16 == ComState::STAT_RETURN.verb {
|
||||
let raw_stats: [usize; 2] = [m.arg1, m.arg2];
|
||||
Ok(Opcode::BattStatsReturn(raw_stats.into()))
|
||||
} else if m.id as u16 == ComState::WFX_RXSTAT_GET.verb {
|
||||
Ok(Opcode::RxStatsAgent)
|
||||
} else {
|
||||
Err("unrecognized command")
|
||||
}
|
||||
|
|
@ -112,6 +126,23 @@ impl<'a> core::convert::TryFrom<&'a Message> for Opcode {
|
|||
Ok(Opcode::BattStats)
|
||||
} else if m.id as u16 == ComState::GYRO_READ.verb {
|
||||
Ok(Opcode::ImuAccelRead)
|
||||
} else if m.id as u16 == ComState::WFX_FW_REV_GET.verb {
|
||||
Ok(Opcode::Wf200Rev)
|
||||
} else if m.id as u16 == ComState::EC_GIT_REV.verb {
|
||||
Ok(Opcode::EcGitRev)
|
||||
} else {
|
||||
Err("unrecognized opcode")
|
||||
}
|
||||
},
|
||||
Message::Borrow(m) => {
|
||||
if m.id as u16 == ComState::WFX_PDS_LINE_SET.verb {
|
||||
let line = unsafe {
|
||||
core::slice::from_raw_parts(
|
||||
m.buf.as_ptr(),
|
||||
m.valid.map(|x| x.get()).unwrap_or_else(|| m.buf.len()),
|
||||
)
|
||||
};
|
||||
Ok(Opcode::Wf200PdsLine(line))
|
||||
} else {
|
||||
Err("unrecognized opcode")
|
||||
}
|
||||
|
|
@ -121,7 +152,7 @@ impl<'a> core::convert::TryFrom<&'a Message> for Opcode {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<Message> for Opcode {
|
||||
impl<'a> Into<Message> for Opcode<'a> {
|
||||
fn into(self) -> Message {
|
||||
match self {
|
||||
Opcode::BoostOn => Message::Scalar(ScalarMessage {
|
||||
|
|
@ -147,7 +178,17 @@ impl Into<Message> for Opcode {
|
|||
arg3: 0,
|
||||
arg4: 0,
|
||||
})
|
||||
}
|
||||
},
|
||||
Opcode::Wf200Rev => Message::BlockingScalar(ScalarMessage {
|
||||
id: ComState::WFX_FW_REV_GET.verb as _, arg1: 0, arg2: 0, arg3: 0, arg4: 0 }),
|
||||
Opcode::EcGitRev => Message::BlockingScalar(ScalarMessage {
|
||||
id: ComState::EC_GIT_REV.verb as _, arg1: 0, arg2: 0, arg3: 0, arg4: 0 }),
|
||||
Opcode::Wf200PdsLine(pdsline) => {
|
||||
let data = xous::carton::Carton::from_bytes(pdsline);
|
||||
Message::Borrow(data.into_message(ComState::WFX_PDS_LINE_SET.verb as _))
|
||||
},
|
||||
Opcode::RxStatsAgent => Message::Scalar(ScalarMessage {
|
||||
id: ComState::WFX_RXSTAT_GET.verb as _, arg1: 0, arg2: 0, arg3: 0, arg4: 0 }),
|
||||
_ => todo!("message type not yet implemented")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,3 +25,35 @@ pub fn get_batt_stats(cid: CID) -> Result<BattStats, xous::Error> {
|
|||
pub fn get_batt_stats_nb(cid: CID) -> Result<(), xous::Error> {
|
||||
send_message(cid, api::Opcode::BattStatsNb.into()).map(|_|())
|
||||
}
|
||||
|
||||
pub fn get_wf200_fw_rev(cid: CID) -> Result<(u8, u8, u8), xous::Error> {
|
||||
let response = send_message(cid, api::Opcode::Wf200Rev.into())?;
|
||||
if let xous::Result::Scalar1(rev) = response {
|
||||
Ok(((rev >> 16) as u8, (rev >> 8) as u8, rev as u8))
|
||||
} else {
|
||||
panic!("unexpected return value: {:#?}", response);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_ec_git_rev(cid: CID) -> Result<(u32, bool), Error> {
|
||||
let response = send_message(cid, api::Opcode::EcGitRev.into())?;
|
||||
if let xous::Result::Scalar2(rev, dirty) = response {
|
||||
let dirtybool: bool;
|
||||
if dirty == 0 {
|
||||
dirtybool = false;
|
||||
} else {
|
||||
dirtybool = true;
|
||||
}
|
||||
Ok((rev as u32, dirtybool))
|
||||
} else {
|
||||
panic!("unexpected return value: {:#?}", response);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn send_pds_line(cid: CID, line: &[u8]) -> Result<(), Error> {
|
||||
send_message(cid, api::Opcode::Wf200PdsLine(line).into()).map(|_| ())
|
||||
}
|
||||
|
||||
pub fn get_rx_stats_agent(cid: CID) -> Result<(), Error> {
|
||||
send_message(cid, api::Opcode::RxStatsAgent.into()).map(|_| ())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ use log::{error, info};
|
|||
use com_rs::*;
|
||||
|
||||
use xous::CID;
|
||||
|
||||
const STD_TIMEOUT: u32 = 100;
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct WorkRequest {
|
||||
work: ComSpec,
|
||||
|
|
@ -31,6 +33,7 @@ mod implementation {
|
|||
use xous::CID;
|
||||
use log::{error, info};
|
||||
use crate::return_battstats;
|
||||
use crate::STD_TIMEOUT;
|
||||
|
||||
#[macro_use]
|
||||
use heapless::Vec;
|
||||
|
|
@ -41,8 +44,6 @@ mod implementation {
|
|||
use typenum::bit::{B0, B1};
|
||||
type U1280 = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>, B0>;
|
||||
*/
|
||||
const STD_TIMEOUT: u32 = 100;
|
||||
|
||||
pub struct XousCom {
|
||||
csr: utralib::CSR<u32>,
|
||||
ticktimer: CID,
|
||||
|
|
@ -222,6 +223,14 @@ fn xmain() -> ! {
|
|||
let shell_id = xous::SID::from_bytes(b"shell ").unwrap();
|
||||
let shell_conn = xous::connect(shell_id).unwrap();
|
||||
|
||||
let agent_conn: usize;
|
||||
if cfg!(feature = "fccagent") {
|
||||
let agent_id = xous::SID::from_bytes(b"fcc-agent-server").unwrap();
|
||||
agent_conn = xous::connect(agent_id).expect("Couldn't connect to fcc-agent! Are you building with the right features enabled?");
|
||||
} else {
|
||||
agent_conn = 0; // bogus value
|
||||
}
|
||||
|
||||
// Create a new com object
|
||||
let mut com = XousCom::new();
|
||||
|
||||
|
|
@ -250,7 +259,61 @@ fn xmain() -> ! {
|
|||
Opcode::BattStatsNb => {
|
||||
com.workqueue.push(WorkRequest { work: ComState::STAT, sender: shell_conn }).unwrap();
|
||||
}
|
||||
_ => error!("unknown opcode"),
|
||||
Opcode::Wf200Rev => {
|
||||
com.txrx(ComState::WFX_FW_REV_GET.verb);
|
||||
let major = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT)) as u8;
|
||||
let minor = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT)) as u8;
|
||||
let build = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT)) as u8;
|
||||
xous::return_scalar(
|
||||
envelope.sender,
|
||||
((major as usize) << 16) | ((minor as usize) << 8) | (build as usize)
|
||||
)
|
||||
.expect("COM: couldn't return WF200 firmware rev");
|
||||
}
|
||||
Opcode::EcGitRev => {
|
||||
com.txrx(ComState::EC_GIT_REV.verb);
|
||||
let rev_msb = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT)) as u8;
|
||||
let rev_lsb = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT)) as u8;
|
||||
let dirty = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT)) as u8;
|
||||
xous::return_scalar2(
|
||||
envelope.sender,
|
||||
((rev_msb as usize) << 16) | (rev_lsb as usize),
|
||||
dirty as usize
|
||||
)
|
||||
.expect("COM: couldn't return WF200 firmware rev");
|
||||
}
|
||||
Opcode::Wf200PdsLine(line) => {
|
||||
let length = line.len() as u16;
|
||||
com.txrx(ComState::WFX_PDS_LINE_SET.verb);
|
||||
com.txrx(length);
|
||||
for i in 0..(ComState::WFX_PDS_LINE_SET.w_words as usize - 1) {
|
||||
let word: u16;
|
||||
if (i * 2 + 1) == (length as usize - 1) { // odd last element
|
||||
word = line[i * 2] as u16;
|
||||
} else if i * 2 < length as usize {
|
||||
word = (line[i*2] as u16) | ((line[i*2+1] as u16) << 8);
|
||||
} else {
|
||||
word = 0;
|
||||
}
|
||||
com.txrx(word);
|
||||
}
|
||||
}
|
||||
Opcode::RxStatsAgent => {
|
||||
let mut stats: [u8; (ComState::WFX_RXSTAT_GET.r_words*2) as usize] = [0; (ComState::WFX_RXSTAT_GET.r_words*2) as usize];
|
||||
com.txrx(ComState::WFX_RXSTAT_GET.verb);
|
||||
for i in 0..ComState::WFX_RXSTAT_GET.r_words as usize {
|
||||
let data = com.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT));
|
||||
stats[i*2] = data as u8;
|
||||
stats[i*2+1] = (data >> 8) as u8;
|
||||
}
|
||||
if cfg!(feature = "fccagent") {
|
||||
// hard-coded from fccagent to break circular dependency of fcc agent on com on agent on com on...
|
||||
let data = xous::carton::Carton::from_bytes(&stats);
|
||||
let m = xous::Message::Borrow(data.into_message(2));
|
||||
xous::send_message(agent_conn, m);
|
||||
}
|
||||
}
|
||||
_ => error!("unknown opcode"),
|
||||
}
|
||||
} else {
|
||||
error!("couldn't convert opcode");
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ log = "0.4"
|
|||
utralib = { path = "../../utralib"}
|
||||
|
||||
[features]
|
||||
debugprint = []
|
||||
logging = []
|
||||
debugprint = [] # adding this allocates the UART for debugging the logger
|
||||
logging = [] # adding this allocates the UART for logging of Xous
|
||||
default = []
|
||||
#default = ["logging"]
|
||||
#default = ["debugprint"]
|
||||
|
|
|
|||
|
|
@ -43,54 +43,64 @@ pub const DEFAULT: Uart = Uart {};
|
|||
|
||||
impl Uart {
|
||||
fn map_uart(&self) {
|
||||
/*
|
||||
Note: the memory address and interrupt specified here needs to map to a unique hardware
|
||||
UART resource. Modify in this function as necessary.
|
||||
*/
|
||||
let uart = xous::syscall::map_memory(
|
||||
xous::MemoryAddress::new(utra::console::HW_CONSOLE_BASE),
|
||||
None,
|
||||
4096,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
)
|
||||
.expect("couldn't map debug uart");
|
||||
unsafe{ DEFAULT_UART_ADDR = uart.as_mut_ptr() as _; }
|
||||
println!("Mapped UART @ {:08x}", uart.addr.get());
|
||||
// core::mem::forget(uart);
|
||||
if cfg!(feature = "debugprint") {
|
||||
/*
|
||||
Note: the memory address and interrupt specified here needs to map to a unique hardware
|
||||
UART resource. Modify in this function as necessary.
|
||||
*/
|
||||
let uart = xous::syscall::map_memory(
|
||||
xous::MemoryAddress::new(utra::console::HW_CONSOLE_BASE),
|
||||
None,
|
||||
4096,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
)
|
||||
.expect("couldn't map debug uart");
|
||||
unsafe{ DEFAULT_UART_ADDR = uart.as_mut_ptr() as _; }
|
||||
println!("Mapped UART @ {:08x}", uart.addr.get());
|
||||
// core::mem::forget(uart);
|
||||
|
||||
println!("Allocating IRQ...");
|
||||
xous::claim_interrupt(utra::console::CONSOLE_IRQ, handle_irq, core::ptr::null_mut::<usize>()).expect("unable to allocate IRQ");
|
||||
self.enable_rx();
|
||||
println!("Allocating IRQ...");
|
||||
xous::claim_interrupt(utra::console::CONSOLE_IRQ, handle_irq, core::ptr::null_mut::<usize>()).expect("unable to allocate IRQ");
|
||||
self.enable_rx();
|
||||
}
|
||||
}
|
||||
|
||||
pub fn putc(&self, c: u8) {
|
||||
if unsafe{DEFAULT_UART_ADDR} as usize == 0 {
|
||||
self.map_uart();
|
||||
}
|
||||
let mut uart_csr = CSR::new(unsafe{ DEFAULT_UART_ADDR as *mut u32});
|
||||
if cfg!(feature = "debugprint") {
|
||||
if unsafe{DEFAULT_UART_ADDR} as usize == 0 {
|
||||
self.map_uart();
|
||||
}
|
||||
let mut uart_csr = CSR::new(unsafe{ DEFAULT_UART_ADDR as *mut u32});
|
||||
|
||||
// Wait until TXFULL is `0`
|
||||
while uart_csr.r(utra::uart::TXFULL) != 0 {}
|
||||
uart_csr.wo(utra::uart::RXTX, c as u32);
|
||||
// Wait until TXFULL is `0`
|
||||
while uart_csr.r(utra::uart::TXFULL) != 0 {}
|
||||
uart_csr.wo(utra::uart::RXTX, c as u32);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn enable_rx(&self) {
|
||||
let mut uart_csr = CSR::new(unsafe{DEFAULT_UART_ADDR as *mut u32});
|
||||
uart_csr.rmwf(utra::uart::EV_ENABLE_RX, 1 );
|
||||
if cfg!(feature = "debugprint") {
|
||||
let mut uart_csr = CSR::new(unsafe{DEFAULT_UART_ADDR as *mut u32});
|
||||
uart_csr.rmwf(utra::uart::EV_ENABLE_RX, 1 );
|
||||
}
|
||||
}
|
||||
|
||||
pub fn getc(&self) -> Option<u8> {
|
||||
if unsafe{DEFAULT_UART_ADDR} as usize == 0 {
|
||||
self.map_uart();
|
||||
}
|
||||
let mut uart_csr = CSR::new(unsafe{DEFAULT_UART_ADDR as *mut u32});
|
||||
match uart_csr.rf(utra::uart::EV_PENDING_RX) {
|
||||
0 => None,
|
||||
ack => {
|
||||
let c = Some(uart_csr.rf(utra::uart::RXTX_RXTX) as u8);
|
||||
uart_csr.wfo(utra::uart::EV_PENDING_RX, ack);
|
||||
c
|
||||
if cfg!(feature = "debugprint") {
|
||||
if unsafe{DEFAULT_UART_ADDR} as usize == 0 {
|
||||
self.map_uart();
|
||||
}
|
||||
let mut uart_csr = CSR::new(unsafe{DEFAULT_UART_ADDR as *mut u32});
|
||||
match uart_csr.rf(utra::uart::EV_PENDING_RX) {
|
||||
0 => None,
|
||||
ack => {
|
||||
let c = Some(uart_csr.rf(utra::uart::RXTX_RXTX) as u8);
|
||||
uart_csr.wfo(utra::uart::EV_PENDING_RX, ack);
|
||||
c
|
||||
}
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,27 +102,29 @@ mod implementation {
|
|||
pub struct Output {}
|
||||
|
||||
pub fn init() -> Output {
|
||||
let uart = xous::syscall::map_memory(
|
||||
xous::MemoryAddress::new(utra::console::HW_CONSOLE_BASE),
|
||||
None,
|
||||
4096,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
)
|
||||
.expect("couldn't map serial port");
|
||||
unsafe { crate::debug::DEFAULT_UART_ADDR = uart.as_mut_ptr() as _ };
|
||||
println!("Mapped UART @ {:08x}", uart.addr.get());
|
||||
if cfg!(feature = "logging") {
|
||||
let uart = xous::syscall::map_memory(
|
||||
xous::MemoryAddress::new(utra::console::HW_CONSOLE_BASE),
|
||||
None,
|
||||
4096,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
)
|
||||
.expect("couldn't map serial port");
|
||||
unsafe { crate::debug::DEFAULT_UART_ADDR = uart.as_mut_ptr() as _ };
|
||||
println!("Mapped UART @ {:08x}", uart.addr.get());
|
||||
|
||||
println!("Process: map success!");
|
||||
crate::debug::DEFAULT.enable_rx();
|
||||
println!("Process: map success!");
|
||||
crate::debug::DEFAULT.enable_rx();
|
||||
|
||||
println!("Allocating IRQ...");
|
||||
xous::syscall::claim_interrupt(
|
||||
utra::console::CONSOLE_IRQ,
|
||||
handle_irq,
|
||||
core::ptr::null_mut::<usize>(),
|
||||
)
|
||||
.expect("couldn't claim interrupt");
|
||||
println!("Claimed IRQ {}", utra::console::CONSOLE_IRQ);
|
||||
println!("Allocating IRQ...");
|
||||
xous::syscall::claim_interrupt(
|
||||
utra::console::CONSOLE_IRQ,
|
||||
handle_irq,
|
||||
core::ptr::null_mut::<usize>(),
|
||||
)
|
||||
.expect("couldn't claim interrupt");
|
||||
println!("Claimed IRQ {}", utra::console::CONSOLE_IRQ);
|
||||
}
|
||||
Output {}
|
||||
}
|
||||
|
||||
|
|
@ -139,23 +141,27 @@ mod implementation {
|
|||
}
|
||||
|
||||
fn handle_irq(irq_no: usize, arg: *mut usize) {
|
||||
print!("Handling IRQ {} (arg: {:08x}): ", irq_no, arg as usize);
|
||||
if cfg!(feature = "logging") {
|
||||
print!("Handling IRQ {} (arg: {:08x}): ", irq_no, arg as usize);
|
||||
|
||||
while let Some(c) = crate::debug::DEFAULT.getc() {
|
||||
print!("0x{:02x}", c);
|
||||
while let Some(c) = crate::debug::DEFAULT.getc() {
|
||||
print!("0x{:02x}", c);
|
||||
}
|
||||
println!();
|
||||
}
|
||||
println!();
|
||||
}
|
||||
|
||||
pub struct OutputWriter {}
|
||||
|
||||
impl OutputWriter {
|
||||
pub fn putc(&self, c: u8) {
|
||||
let mut uart_csr = CSR::new(unsafe { crate::debug::DEFAULT_UART_ADDR as *mut u32 });
|
||||
if cfg!(feature = "logging") {
|
||||
let mut uart_csr = CSR::new(unsafe { crate::debug::DEFAULT_UART_ADDR as *mut u32 });
|
||||
|
||||
// Wait until TXFULL is `0`
|
||||
while uart_csr.r(utra::uart::TXFULL) != 0 {}
|
||||
uart_csr.wo(utra::uart::RXTX, c as u32);
|
||||
// Wait until TXFULL is `0`
|
||||
while uart_csr.r(utra::uart::TXFULL) != 0 {}
|
||||
uart_csr.wo(utra::uart::RXTX, c as u32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ log-server = { path = "../log-server" }
|
|||
log = "0.4"
|
||||
|
||||
com = { path = "../com"}
|
||||
com_rs = { git = "https://github.com/betrusted-io/com_rs.git", rev = "9a91a81f482ea8eba2f2de5d6c20b9bd399f39a9" }
|
||||
|
||||
# blitstr = { path = "../../../blitstr" }
|
||||
blitstr = { git = "https://github.com/betrusted-io/blitstr.git", rev = "69f7c04b9f44a20571c4792c8fc9166f5d6b548d" }
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ fn shell_main() -> ! {
|
|||
}
|
||||
|
||||
// rate limit graphics
|
||||
ticktimer_server::sleep_ms(ticktimer_conn, 1000).expect("couldn't sleep");
|
||||
// ticktimer_server::sleep_ms(ticktimer_conn, 1000).expect("couldn't sleep");
|
||||
|
||||
// draw the ball
|
||||
graphics_server::draw_rectangle(
|
||||
|
|
|
|||
|
|
@ -18,4 +18,6 @@ utralib = { path = "../../utralib"}
|
|||
|
||||
[features]
|
||||
debugprint = []
|
||||
default = [] # "debugprint"
|
||||
disablewatchdog = []
|
||||
# generally you want to disable watchdog if you're doing development.
|
||||
default = ["disablewatchdog"] # "debugprint"
|
||||
|
|
|
|||
|
|
@ -94,7 +94,11 @@ mod implementation {
|
|||
connection,
|
||||
};
|
||||
|
||||
xtt.wdt.wfo(utra::wdt::WATCHDOG_ENABLE, 1);
|
||||
if cfg!(feature = "disablewatchdog") {
|
||||
// do nothing
|
||||
} else {
|
||||
xtt.wdt.wfo(utra::wdt::WATCHDOG_ENABLE, 1);
|
||||
}
|
||||
|
||||
xous::claim_interrupt(
|
||||
utra::ticktimer::TICKTIMER_IRQ,
|
||||
|
|
|
|||
|
|
@ -8,3 +8,4 @@ then
|
|||
fi
|
||||
|
||||
riscv64-unknown-elf-gdb -ex 'set riscv use-compressed-breakpoints off' -ex 'file kernel/target/riscv32imac-unknown-none-elf/release/kernel' -ex "tar rem $1:3333"
|
||||
#riscv64-unknown-elf-gdb -ex 'set riscv use-compressed-breakpoints off' -ex 'file target/riscv32imac-unknown-none-elf/release/fcc-agent' -ex "tar rem $1:3333"
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ fn build_hw_image(debug: bool, svd: Option<String>) -> Result<(), DynError> {
|
|||
|
||||
let kernel = build_kernel(debug)?;
|
||||
let mut init = vec![];
|
||||
for pkg in &["shell", "graphics-server", "ticktimer-server", "log-server", "com", "trng-tester"] { // "xous-names"
|
||||
for pkg in &["shell", "graphics-server", "ticktimer-server", "log-server", "com", "fcc-agent"] { // "xous-names", "trng-tester"
|
||||
init.push(build(pkg, debug, Some(TARGET), None)?);
|
||||
}
|
||||
let loader = build("loader", debug, Some(TARGET), Some("loader".into()))?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue