mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 03:08:27 +08:00
satman: define constants for JdacBasicRequest reqnos
This commit is contained in:
parent
4b3baf4825
commit
5ee81dc643
4
artiq/firmware/satman/jdac_requests.rs
Normal file
4
artiq/firmware/satman/jdac_requests.rs
Normal file
@ -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_artiq::drtioaux;
|
||||
|
||||
use super::jdac_requests;
|
||||
|
||||
pub fn jesd_reset(reset: bool) {
|
||||
unsafe {
|
||||
csr::jesd_crg::jreset_write(if reset {1} else {0});
|
||||
@ -67,17 +69,17 @@ pub fn init() {
|
||||
jesd_prbs(dacno, false);
|
||||
jesd_stpl(dacno, false);
|
||||
|
||||
jdac_basic_request(dacno, 0);
|
||||
jdac_basic_request(dacno, jdac_requests::INIT);
|
||||
|
||||
jesd_prbs(dacno, true);
|
||||
jdac_basic_request(dacno, 2);
|
||||
jdac_basic_request(dacno, jdac_requests::PRBS);
|
||||
jesd_prbs(dacno, false);
|
||||
|
||||
jesd_stpl(dacno, true);
|
||||
jdac_basic_request(dacno, 3);
|
||||
jdac_basic_request(dacno, jdac_requests::STPL);
|
||||
jesd_stpl(dacno, false);
|
||||
|
||||
jdac_basic_request(dacno, 0);
|
||||
jdac_basic_request(dacno, jdac_requests::INIT);
|
||||
|
||||
let t = clock::get_ms();
|
||||
while !jesd_ready(dacno) {
|
||||
@ -87,7 +89,7 @@ pub fn init() {
|
||||
}
|
||||
}
|
||||
clock::spin_us(5000);
|
||||
jdac_basic_request(dacno, 1);
|
||||
jdac_basic_request(dacno, jdac_requests::PRINT_STATUS);
|
||||
|
||||
if !jesd_jsync(dacno) {
|
||||
error!("bad SYNC");
|
||||
|
@ -17,6 +17,8 @@ use board_artiq::hmc830_7043;
|
||||
mod repeater;
|
||||
#[cfg(has_jdcg)]
|
||||
mod jdcg;
|
||||
#[cfg(any(has_ad9154, has_jdcg))]
|
||||
pub mod jdac_requests;
|
||||
|
||||
fn drtiosat_reset(reset: bool) {
|
||||
unsafe {
|
||||
@ -299,10 +301,10 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater],
|
||||
#[cfg(rtio_frequency = "150.0")]
|
||||
const LINERATE: u64 = 6_000_000_000;
|
||||
match _reqno {
|
||||
0 => board_artiq::ad9154::setup(_dacno, LINERATE).is_ok(),
|
||||
1 => { board_artiq::ad9154::status(_dacno); true },
|
||||
2 => board_artiq::ad9154::prbs(_dacno).is_ok(),
|
||||
3 => board_artiq::ad9154::stpl(_dacno, 4, 2).is_ok(),
|
||||
jdac_requests::INIT => board_artiq::ad9154::setup(_dacno, LINERATE).is_ok(),
|
||||
jdac_requests::PRINT_STATUS => { board_artiq::ad9154::status(_dacno); true },
|
||||
jdac_requests::PRBS => board_artiq::ad9154::prbs(_dacno).is_ok(),
|
||||
jdac_requests::STPL => board_artiq::ad9154::stpl(_dacno, 4, 2).is_ok(),
|
||||
_ => false
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user