libboard_artiq: added mem.rs, yet to fix drtioaux

This commit is contained in:
mwojcik 2021-08-24 14:11:30 +02:00
parent 37eb4669fb
commit a8a2da575b
2 changed files with 15 additions and 13 deletions

View File

@ -1,35 +1,28 @@
use core::slice;
use crc;
use io::{ProtoRead, ProtoWrite, Cursor, Error as IoError};
//use board_misoc::{mem::DRTIOAUX_MEM}; // <- port
//^ uses generated files (like csr, but mem) - todo check after initial generation
use mem::mem::DRTIOAUX_MEM;
use pl::csr::DRTIOAUX;
use drtioaux_proto::Error as ProtocolError;
use crate::drtioaux_proto::Error as ProtocolError;
use libboard_zynq::{timer::GlobalTimer, time::Milliseconds};
pub use drtioaux_proto::Packet;
pub use crate::drtioaux_proto::Packet;
// this is parametric over T because there's no impl Fail for !.
#[derive(Fail, Debug)]
#[derive(Debug)]
pub enum Error<T> {
#[fail(display = "gateware reported error")]
GatewareError,
#[fail(display = "packet CRC failed")]
CorruptedPacket,
#[fail(display = "link is down")]
LinkDown,
#[fail(display = "timed out waiting for data")]
TimedOut,
#[fail(display = "unexpected reply")]
UnexpectedReply,
#[fail(display = "routing error")]
RoutingError,
#[fail(display = "protocol error: {}", _0)]
Protocol(#[cause] ProtocolError<T>)
Protocol(ProtocolError<T>)
}
impl<T> From<ProtocolError<T>> for Error<T> {

View File

@ -2,10 +2,14 @@
#![feature(never_type)]
extern crate log;
extern crate crc;
extern crate failure;
extern crate failure_derive;
extern crate libboard_zynq;
extern crate libconfig;
extern crate libcortex_a9;
extern crate log_buffer;
extern crate io;
// has csr; taken from runtime main
#[path = "../../../build/pl.rs"]
@ -13,6 +17,11 @@ pub mod pl;
#[cfg(has_drtio)]
pub mod drtioaux;
// for now, memory map is only needed for DRTIO firmware
#[cfg(has_drtio)]
#[path = "../../../build/mem.rs"]
pub mod mem;
pub mod drtio_routing;
pub mod logger;