firmware: remove legacy hmc542 code

This commit is contained in:
Sebastien Bourdeauducq 2019-12-20 15:25:12 +08:00
parent a3e2a46510
commit 26e8b9d02a
4 changed files with 0 additions and 66 deletions

View File

@ -1,60 +0,0 @@
use board_misoc::{csr, clock};
const PIN_LE: u32 = 1 << 0;
const PIN_SIN: u32 = 1 << 1;
const PIN_CLK: u32 = 1 << 2;
const PIN_RST_N: u32 = 1 << 3;
const PIN_RST: u32 = PIN_RST_N;
const CARDS: usize = 4;
const CHANNELS: usize = 2;
fn set_pins(card_index: usize, chan_index: usize, pins: u32) {
let pins = pins ^ PIN_RST_N;
let shift = (card_index * 2 + chan_index)*4;
unsafe {
let state = csr::allaki_atts::out_read();
let state = state & !(0xf << shift);
let state = state | (pins << shift);
csr::allaki_atts::out_write(state);
}
clock::spin_us(100);
}
/// Attenuation is in units of 0.5 dB, from 0 dB (0) to 31.5 dB (63).
pub fn program(card_index: usize, chan_index: usize, atten: u8) {
assert!(card_index < 4 && chan_index < 2);
info!("card {} channel {} set to {}{} dB",
card_index, chan_index,
atten / 2, if atten % 2 != 0 { ".5" } else { "" });
// 0b111111 = 0dB
// 0b111110 = 0.5dB
// 0b111101 = 1dB
// 0b111100 = 1.5dB
// ...
// 0b011111 = 16dB
// ...
// 0b000000 = 31.5dB
let atten = !atten << 2;
let set_pins = |pins| set_pins(card_index, chan_index, pins);
set_pins(PIN_RST);
set_pins(0);
for n in (0..8).rev() {
let sin = if atten & 1 << n != 0 { PIN_SIN } else { 0 };
set_pins(sin);
set_pins(sin | PIN_CLK);
}
set_pins(PIN_LE);
}
/// See `program`.
pub fn program_all(atten: u8) {
for card in 0..CARDS {
for chan in 0..CHANNELS {
program(card, chan, atten)
}
}
}

View File

@ -33,8 +33,6 @@ pub mod hmc830_7043;
mod ad9154_reg;
#[cfg(has_ad9154)]
pub mod ad9154;
#[cfg(has_allaki_atts)]
pub mod hmc542;
#[cfg(has_grabber)]
pub mod grabber;

View File

@ -103,8 +103,6 @@ fn sayma_hw_init() {
error!("failed to align SYSREF at DAC: {}", e);
}
}
#[cfg(has_allaki_atts)]
board_artiq::hmc542::program_all(8/*=4dB*/);
}
fn startup() {

View File

@ -465,8 +465,6 @@ pub extern fn main() -> i32 {
board_artiq::ad9154::reset_and_detect(dacno as u8).expect("AD9154 DAC not detected");
}
}
#[cfg(has_allaki_atts)]
board_artiq::hmc542::program_all(8/*=4dB*/);
#[cfg(has_drtio_routing)]
let mut repeaters = [repeater::Repeater::default(); csr::DRTIOREP.len()];