mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-18 07:56:30 +08:00
runtime: reset local DRTIO state
This commit is contained in:
parent
9a048c2b3a
commit
1c74249638
@ -42,7 +42,7 @@ mod drtio {
|
|||||||
use board::csr;
|
use board::csr;
|
||||||
use sched::{Scheduler, Waiter, Spawner};
|
use sched::{Scheduler, Waiter, Spawner};
|
||||||
|
|
||||||
pub fn init(scheduler: &Scheduler) {
|
pub fn startup(scheduler: &Scheduler) {
|
||||||
scheduler.spawner().spawn(4096, link_thread);
|
scheduler.spawner().spawn(4096, link_thread);
|
||||||
scheduler.spawner().spawn(4096, error_thread);
|
scheduler.spawner().spawn(4096, error_thread);
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ mod drtio {
|
|||||||
unsafe {
|
unsafe {
|
||||||
csr::drtio::chan_sel_override_write(channel);
|
csr::drtio::chan_sel_override_write(channel);
|
||||||
csr::drtio::chan_sel_override_en_write(1);
|
csr::drtio::chan_sel_override_en_write(1);
|
||||||
|
|
||||||
csr::drtio::o_reset_channel_status_write(1);
|
csr::drtio::o_reset_channel_status_write(1);
|
||||||
csr::drtio::o_get_fifo_space_write(1);
|
csr::drtio::o_get_fifo_space_write(1);
|
||||||
while csr::drtio::o_wait_read() == 1 {}
|
while csr::drtio::o_wait_read() == 1 {}
|
||||||
@ -74,6 +74,18 @@ mod drtio {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn init() {
|
||||||
|
if link_is_up() {
|
||||||
|
unsafe {
|
||||||
|
csr::drtio::reset_write(1);
|
||||||
|
while csr::drtio::o_wait_read() == 1 {}
|
||||||
|
}
|
||||||
|
for channel in 0..16 {
|
||||||
|
init_channel(channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn link_thread(waiter: Waiter, _spawner: Spawner) {
|
pub fn link_thread(waiter: Waiter, _spawner: Spawner) {
|
||||||
loop {
|
loop {
|
||||||
waiter.until(link_is_up).unwrap();
|
waiter.until(link_is_up).unwrap();
|
||||||
@ -84,9 +96,7 @@ mod drtio {
|
|||||||
|
|
||||||
sync_tsc();
|
sync_tsc();
|
||||||
info!("TSC synced");
|
info!("TSC synced");
|
||||||
for channel in 0..16 {
|
init();
|
||||||
init_channel(channel);
|
|
||||||
}
|
|
||||||
info!("link initialization completed");
|
info!("link initialization completed");
|
||||||
|
|
||||||
waiter.until(|| !link_is_up()).unwrap();
|
waiter.until(|| !link_is_up()).unwrap();
|
||||||
@ -121,7 +131,8 @@ mod drtio {
|
|||||||
mod drtio {
|
mod drtio {
|
||||||
use sched::Scheduler;
|
use sched::Scheduler;
|
||||||
|
|
||||||
pub fn init(_scheduler: &Scheduler) {}
|
pub fn startup(_scheduler: &Scheduler) {}
|
||||||
|
pub fn init() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn startup(scheduler: &Scheduler) {
|
pub fn startup(scheduler: &Scheduler) {
|
||||||
@ -150,7 +161,7 @@ pub fn startup(scheduler: &Scheduler) {
|
|||||||
warn!("fix clocking and reset the device");
|
warn!("fix clocking and reset the device");
|
||||||
}
|
}
|
||||||
|
|
||||||
drtio::init(scheduler);
|
drtio::startup(scheduler);
|
||||||
init_core()
|
init_core()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,4 +169,5 @@ pub fn init_core() {
|
|||||||
unsafe {
|
unsafe {
|
||||||
csr::rtio_core::reset_write(1);
|
csr::rtio_core::reset_write(1);
|
||||||
}
|
}
|
||||||
|
drtio::init()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user