2021-10-06 13:02:28 +08:00
|
|
|
#![no_std]
|
|
|
|
#![feature(never_type)]
|
|
|
|
|
2023-02-22 11:02:43 +08:00
|
|
|
extern crate core_io;
|
2021-10-06 13:02:28 +08:00
|
|
|
extern crate crc;
|
|
|
|
extern crate embedded_hal;
|
|
|
|
extern crate io;
|
2023-02-22 11:02:43 +08:00
|
|
|
extern crate libasync;
|
2021-10-06 13:02:28 +08:00
|
|
|
extern crate libboard_zynq;
|
|
|
|
extern crate libconfig;
|
|
|
|
extern crate libcortex_a9;
|
2023-02-22 11:02:43 +08:00
|
|
|
extern crate libregister;
|
|
|
|
extern crate log;
|
2021-10-06 13:02:28 +08:00
|
|
|
extern crate log_buffer;
|
|
|
|
|
|
|
|
pub mod drtio_routing;
|
|
|
|
#[cfg(has_drtio)]
|
|
|
|
pub mod drtioaux;
|
|
|
|
#[cfg(has_drtio)]
|
|
|
|
pub mod drtioaux_async;
|
2023-02-22 11:02:43 +08:00
|
|
|
pub mod drtioaux_proto;
|
|
|
|
#[cfg(feature = "target_kasli_soc")]
|
|
|
|
pub mod io_expander;
|
|
|
|
pub mod logger;
|
2021-10-06 14:26:37 +08:00
|
|
|
#[cfg(has_drtio)]
|
2023-02-22 11:02:43 +08:00
|
|
|
#[rustfmt::skip]
|
2021-10-06 13:02:28 +08:00
|
|
|
#[path = "../../../build/mem.rs"]
|
|
|
|
pub mod mem;
|
2023-02-22 11:02:43 +08:00
|
|
|
#[rustfmt::skip]
|
|
|
|
#[path = "../../../build/pl.rs"]
|
|
|
|
pub mod pl;
|
|
|
|
#[cfg(has_si5324)]
|
|
|
|
pub mod si5324;
|
2021-10-06 13:02:28 +08:00
|
|
|
|
|
|
|
use core::{cmp, str};
|
|
|
|
|
|
|
|
pub fn identifier_read(buf: &mut [u8]) -> &str {
|
|
|
|
unsafe {
|
|
|
|
pl::csr::identifier::address_write(0);
|
|
|
|
let len = pl::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();
|
|
|
|
}
|
|
|
|
str::from_utf8_unchecked(&buf[..len as usize])
|
|
|
|
}
|
|
|
|
}
|