1
0
Fork 0
artiq-zynq/runtime/src/main.rs

36 lines
798 B
Rust
Raw Normal View History

2020-04-11 20:19:39 +08:00
#![no_std]
#![no_main]
extern crate alloc;
use libboard_zynq::println;
use libsupport_zynq::ram;
2020-04-11 21:32:44 +08:00
use core::{cmp, str};
mod pl;
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])
}
}
2020-04-11 20:19:39 +08:00
#[no_mangle]
pub fn main_core0() {
2020-04-11 21:32:44 +08:00
println!("[CORE0] hello world {}", identifier_read(&mut [0; 64]));
2020-04-11 20:19:39 +08:00
loop {}
}
#[no_mangle]
pub fn main_core1() {
2020-04-11 21:32:44 +08:00
println!("[CORE1] hello world {}", identifier_read(&mut [0; 64]));
2020-04-11 20:19:39 +08:00
loop {}
}