firmware: fix sayma_amc_standalone build with sawg.

This commit is contained in:
whitequark 2017-12-28 08:15:51 +00:00
parent 4ea801b2ea
commit 8f33061a6d
5 changed files with 63 additions and 64 deletions

View File

@ -1,5 +1,4 @@
use csr; use board::{csr, clock};
use clock;
use ad9154_reg; use ad9154_reg;
fn spi_setup(dacno: u8) { fn spi_setup(dacno: u8) {

View File

@ -11,7 +11,7 @@
*/ */
mod clock_mux { mod clock_mux {
use csr; use board::csr;
const CLK_SRC_EXT_SEL : u8 = 1 << 0; const CLK_SRC_EXT_SEL : u8 = 1 << 0;
const REF_CLK_SRC_SEL : u8 = 1 << 1; const REF_CLK_SRC_SEL : u8 = 1 << 1;
@ -28,8 +28,7 @@ mod clock_mux {
} }
mod hmc830 { mod hmc830 {
use clock; use board::{csr, clock};
use csr;
const HMC830_WRITES: [(u8, u32); 16] = [ const HMC830_WRITES: [(u8, u32); 16] = [
(0x0, 0x20), (0x0, 0x20),
@ -117,7 +116,7 @@ mod hmc830 {
} }
mod hmc7043 { mod hmc7043 {
use csr; use board::csr;
include!(concat!(env!("OUT_DIR"), "/hmc7043_writes.rs")); include!(concat!(env!("OUT_DIR"), "/hmc7043_writes.rs"));

View File

@ -1,4 +1,4 @@
use csr; use board::csr;
pub fn wait_init() { pub fn wait_init() {
info!("waiting for AMC/RTM serwb bridge to be ready..."); info!("waiting for AMC/RTM serwb bridge to be ready...");

View File

@ -1,7 +1,7 @@
#[cfg(has_converter_spi)] #[cfg(has_converter_spi)]
use csr; mod imp {
use board::csr;
#[cfg(has_converter_spi)]
pub fn set_config(busno: u8, flags: u8, write_div: u8, read_div: u8) -> Result<(), ()> { pub fn set_config(busno: u8, flags: u8, write_div: u8, read_div: u8) -> Result<(), ()> {
if busno != 0 { if busno != 0 {
return Err(()) return Err(())
@ -20,8 +20,8 @@ pub fn set_config(busno: u8, flags: u8, write_div: u8, read_div: u8) -> Result<(
Ok(()) Ok(())
} }
#[cfg(has_converter_spi)] pub fn set_xfer(busno: u8, chip_select: u16, write_length: u8, read_length: u8)
pub fn set_xfer(busno: u8, chip_select: u16, write_length: u8, read_length: u8) -> Result<(), ()> { -> Result<(), ()> {
if busno != 0 { if busno != 0 {
return Err(()) return Err(())
} }
@ -33,7 +33,6 @@ pub fn set_xfer(busno: u8, chip_select: u16, write_length: u8, read_length: u8)
Ok(()) Ok(())
} }
#[cfg(has_converter_spi)]
pub fn write(busno: u8, data: u32) -> Result<(), ()> { pub fn write(busno: u8, data: u32) -> Result<(), ()> {
if busno != 0 { if busno != 0 {
return Err(()) return Err(())
@ -46,7 +45,6 @@ pub fn write(busno: u8, data: u32) -> Result<(), ()> {
Ok(()) Ok(())
} }
#[cfg(has_converter_spi)]
pub fn read(busno: u8) -> Result<u32, ()> { pub fn read(busno: u8) -> Result<u32, ()> {
if busno != 0 { if busno != 0 {
return Err(()) return Err(())
@ -55,12 +53,15 @@ pub fn read(busno: u8) -> Result<u32, ()> {
csr::converter_spi::data_read_read() csr::converter_spi::data_read_read()
}) })
} }
}
#[cfg(not(has_converter_spi))] #[cfg(not(has_converter_spi))]
mod imp {
pub fn set_config(_busno: u8, _flags: u8, _write_div: u8, _read_div: u8) -> Result<(), ()> { Err(()) } pub fn set_config(_busno: u8, _flags: u8, _write_div: u8, _read_div: u8) -> Result<(), ()> { Err(()) }
#[cfg(not(has_converter_spi))] pub fn set_xfer(_busno: u8,_chip_select: u16, _write_length: u8, _read_length: u8)
pub fn set_xfer(_busno: u8,_chip_select: u16, _write_length: u8, _read_length: u8) -> Result<(), ()> { Err(()) } -> Result<(), ()> { Err(()) }
#[cfg(not(has_converter_spi))]
pub fn write(_busno: u8,_data: u32) -> Result<(), ()> { Err(()) } pub fn write(_busno: u8,_data: u32) -> Result<(), ()> { Err(()) }
#[cfg(not(has_converter_spi))]
pub fn read(_busno: u8,) -> Result<u32, ()> { Err(()) } pub fn read(_busno: u8,) -> Result<u32, ()> { Err(()) }
}
pub use self::imp::*;

View File

@ -56,7 +56,7 @@ fn startup() {
info!("gateware version {}", board::ident::read(&mut [0; 64])); info!("gateware version {}", board::ident::read(&mut [0; 64]));
#[cfg(has_serwb_phy_amc)] #[cfg(has_serwb_phy_amc)]
board::serwb::wait_init(); board_artiq::serwb::wait_init();
let t = board::clock::get_ms(); let t = board::clock::get_ms();
info!("press 'e' to erase startup and idle kernels..."); info!("press 'e' to erase startup and idle kernels...");
@ -75,9 +75,9 @@ fn startup() {
#[cfg(si5324_free_running)] #[cfg(si5324_free_running)]
setup_si5324_free_running(); setup_si5324_free_running();
#[cfg(has_hmc830_7043)] #[cfg(has_hmc830_7043)]
board::hmc830_7043::init().expect("cannot initialize HMC830/7043"); board_artiq::hmc830_7043::init().expect("cannot initialize HMC830/7043");
#[cfg(has_ad9154)] #[cfg(has_ad9154)]
board::ad9154::init().expect("cannot initialize AD9154"); board_artiq::ad9154::init().expect("cannot initialize AD9154");
#[cfg(has_ethmac)] #[cfg(has_ethmac)]
startup_ethernet(); startup_ethernet();