forked from M-Labs/artiq
satman: define constants for JdacBasicRequest reqnos
This commit is contained in:
parent
4b3baf4825
commit
5ee81dc643
|
@ -0,0 +1,4 @@
|
||||||
|
pub const INIT: u8 = 0x00;
|
||||||
|
pub const PRINT_STATUS: u8 = 0x01;
|
||||||
|
pub const PRBS: u8 = 0x02;
|
||||||
|
pub const STPL: u8 = 0x03;
|
|
@ -1,6 +1,8 @@
|
||||||
use board_misoc::{csr, clock};
|
use board_misoc::{csr, clock};
|
||||||
use board_artiq::drtioaux;
|
use board_artiq::drtioaux;
|
||||||
|
|
||||||
|
use super::jdac_requests;
|
||||||
|
|
||||||
pub fn jesd_reset(reset: bool) {
|
pub fn jesd_reset(reset: bool) {
|
||||||
unsafe {
|
unsafe {
|
||||||
csr::jesd_crg::jreset_write(if reset {1} else {0});
|
csr::jesd_crg::jreset_write(if reset {1} else {0});
|
||||||
|
@ -67,17 +69,17 @@ pub fn init() {
|
||||||
jesd_prbs(dacno, false);
|
jesd_prbs(dacno, false);
|
||||||
jesd_stpl(dacno, false);
|
jesd_stpl(dacno, false);
|
||||||
|
|
||||||
jdac_basic_request(dacno, 0);
|
jdac_basic_request(dacno, jdac_requests::INIT);
|
||||||
|
|
||||||
jesd_prbs(dacno, true);
|
jesd_prbs(dacno, true);
|
||||||
jdac_basic_request(dacno, 2);
|
jdac_basic_request(dacno, jdac_requests::PRBS);
|
||||||
jesd_prbs(dacno, false);
|
jesd_prbs(dacno, false);
|
||||||
|
|
||||||
jesd_stpl(dacno, true);
|
jesd_stpl(dacno, true);
|
||||||
jdac_basic_request(dacno, 3);
|
jdac_basic_request(dacno, jdac_requests::STPL);
|
||||||
jesd_stpl(dacno, false);
|
jesd_stpl(dacno, false);
|
||||||
|
|
||||||
jdac_basic_request(dacno, 0);
|
jdac_basic_request(dacno, jdac_requests::INIT);
|
||||||
|
|
||||||
let t = clock::get_ms();
|
let t = clock::get_ms();
|
||||||
while !jesd_ready(dacno) {
|
while !jesd_ready(dacno) {
|
||||||
|
@ -87,7 +89,7 @@ pub fn init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clock::spin_us(5000);
|
clock::spin_us(5000);
|
||||||
jdac_basic_request(dacno, 1);
|
jdac_basic_request(dacno, jdac_requests::PRINT_STATUS);
|
||||||
|
|
||||||
if !jesd_jsync(dacno) {
|
if !jesd_jsync(dacno) {
|
||||||
error!("bad SYNC");
|
error!("bad SYNC");
|
||||||
|
|
|
@ -17,6 +17,8 @@ use board_artiq::hmc830_7043;
|
||||||
mod repeater;
|
mod repeater;
|
||||||
#[cfg(has_jdcg)]
|
#[cfg(has_jdcg)]
|
||||||
mod jdcg;
|
mod jdcg;
|
||||||
|
#[cfg(any(has_ad9154, has_jdcg))]
|
||||||
|
pub mod jdac_requests;
|
||||||
|
|
||||||
fn drtiosat_reset(reset: bool) {
|
fn drtiosat_reset(reset: bool) {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -299,10 +301,10 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater],
|
||||||
#[cfg(rtio_frequency = "150.0")]
|
#[cfg(rtio_frequency = "150.0")]
|
||||||
const LINERATE: u64 = 6_000_000_000;
|
const LINERATE: u64 = 6_000_000_000;
|
||||||
match _reqno {
|
match _reqno {
|
||||||
0 => board_artiq::ad9154::setup(_dacno, LINERATE).is_ok(),
|
jdac_requests::INIT => board_artiq::ad9154::setup(_dacno, LINERATE).is_ok(),
|
||||||
1 => { board_artiq::ad9154::status(_dacno); true },
|
jdac_requests::PRINT_STATUS => { board_artiq::ad9154::status(_dacno); true },
|
||||||
2 => board_artiq::ad9154::prbs(_dacno).is_ok(),
|
jdac_requests::PRBS => board_artiq::ad9154::prbs(_dacno).is_ok(),
|
||||||
3 => board_artiq::ad9154::stpl(_dacno, 4, 2).is_ok(),
|
jdac_requests::STPL => board_artiq::ad9154::stpl(_dacno, 4, 2).is_ok(),
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue