fixed compilation errors - runtime compiles now

This commit is contained in:
mwojcik 2021-07-27 12:40:55 +02:00
parent 76b085333f
commit 4e5f1a0673
6 changed files with 25 additions and 9 deletions

View File

@ -3,6 +3,8 @@ use libconfig::Config;
use pl::csr; // <- check if it works in the same way
use core::fmt;
use log::{warn, info};
#[cfg(has_drtio_routing)]
pub const DEST_COUNT: usize = 256;
#[cfg(not(has_drtio_routing))]
@ -55,12 +57,18 @@ impl fmt::Display for RoutingTable {
pub fn config_routing_table(default_n_links: usize, cfg: Config) -> RoutingTable {
let mut ret = RoutingTable::default_master(default_n_links);
if let Ok(data) = cfg.read("routing_table").ok() && data.len() == DEST_COUNT*MAX_HOPS {
if let Ok(data) = cfg.read("routing_table") {
if data.len() == DEST_COUNT*MAX_HOPS
{
for i in 0..DEST_COUNT {
for j in 0..MAX_HOPS {
ret.0[i][j] = data[i*MAX_HOPS+j];
}
}
}
else {
warn!("could not read routing table from configuration, using default");
}
}
else {
warn!("could not read routing table from configuration, using default");

View File

@ -1,5 +1,11 @@
#![no_std]
extern crate log;
extern crate libboard_zynq;
extern crate libconfig;
extern crate libcortex_a9;
extern crate log_buffer;
// has csr; taken from runtime main
#[path = "../../../build/pl.rs"]
pub mod pl;

View File

@ -93,6 +93,7 @@ fn write(i2c: &mut I2c, reg: u8, val: u8) -> Result<()> {
Ok(())
}
#[allow(dead_code)]
fn write_no_ack_value(i2c: &mut I2c, reg: u8, val: u8) -> Result<()> {
i2c.start().unwrap();
if !i2c.write(ADDRESS << 1).unwrap() {
@ -134,7 +135,7 @@ fn ident(i2c: &mut I2c) -> Result<u16> {
Ok(((read(i2c, 134)? as u16) << 8) | (read(i2c, 135)? as u16))
}
fn soft_reset(i2c: &mut I2c) -> Result<()> {
fn soft_reset(_i2c: &mut I2c) -> Result<()> {
//TODO write_no_ack_value(i2c, 136, read(136)? | 0x80)?;
//TODO clock::spin_us(10_000);
Ok(())

View File

@ -11,9 +11,9 @@ use alloc;
#[cfg(feature = "byteorder")]
extern crate byteorder;
mod cursor;
pub mod cursor;
#[cfg(feature = "byteorder")]
mod proto;
pub mod proto;
pub use cursor::Cursor;
#[cfg(feature = "byteorder")]

View File

@ -23,8 +23,9 @@ use embedded_hal::blocking::delay::DelayMs;
use libconfig::Config;
use libregister::RegisterW;
use libcortex_a9::l2c::enable_l2_cache;
use libboard_artiq::logger;
#[cfg(feature = "target_kasli_soc")]
use libboard_artiq::{si5324, logger};
use libboard_artiq::si5324;
mod proto_async;
mod comms;

View File

@ -16,12 +16,12 @@ mod repeater;
fn identifier_read(buf: &mut [u8]) -> &str {
unsafe {
pl::csr::identifier::address_write(0);
let len = pl::csr::identifier::data_read();
csr::identifier::address_write(0);
let len = csr::identifier::data_read();
let len = cmp::min(len, buf.len() as u8);
for i in 0..len {
pl::csr::identifier::address_write(1 + i);
buf[i as usize] = pl::csr::identifier::data_read();
csr::identifier::address_write(1 + i);
buf[i as usize] = csr::identifier::data_read();
}
str::from_utf8_unchecked(&buf[..len as usize])
}