/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <memory_map.h>
#include <db_base.h>
#include <hal_io.h>
-#include <ad9510.h>
#include <stdio.h>
#include <mdelay.h>
#include <lsdac.h>
unsigned char CP1;
unsigned char CP2;
int freq_mult;
- int spi_mask;
+ int spi_mask;
};
struct db_rfx_dummy {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
.base.atr_rxval = POWER_UP|MIX_EN,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 0,
.common.CP1 = 7,
.common.CP2 = 7,
//.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
.base.is_quadrature = true,
- .base.i_and_q_swapped = true,
+ .base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
.base.atr_rxval = POWER_UP|ANT_SW,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 1,
.common.CP1 = 7,
.common.CP2 = 7,
.base.is_tx = false,
.base.output_enables = 0x00E0,
.base.used_pins = 0x00FF,
- .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(800e6),
- .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1000e6),
+ .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(750e6),
+ .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1050e6),
.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70),
.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034),
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
.base.atr_rxval = MIX_EN,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 1,
.common.CP1 = 7,
.common.CP2 = 7,
.base.is_tx = true,
.base.output_enables = 0x00E0,
.base.used_pins = 0x00FF,
- .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(800e6),
- .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1000e6),
+ .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(750e6),
+ .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1050e6),
//.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
.base.is_quadrature = true,
- .base.i_and_q_swapped = true,
+ .base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
.base.atr_rxval = ANT_SW,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 1,
.common.CP1 = 7,
.common.CP2 = 7,
.base.output_enables = 0x00E0,
.base.used_pins = 0x00FF,
.base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1150e6),
- .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1350e6),
+ .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1450e6),
.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70),
.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034),
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
.base.atr_rxval = MIX_EN,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 1,
.common.CP1 = 7,
.common.CP2 = 7,
.base.output_enables = 0x00E0,
.base.used_pins = 0x00FF,
.base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1150e6),
- .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1350e6),
+ .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1450e6),
//.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
.base.is_quadrature = true,
- .base.i_and_q_swapped = true,
+ .base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
.base.atr_rxval = ANT_SW,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 1,
.common.CP1 = 7,
.common.CP2 = 7,
.base.is_tx = false,
.base.output_enables = 0x00E0,
.base.used_pins = 0x00FF,
- .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1600e6),
- .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2000e6),
+ .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1500e6),
+ .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2100e6),
.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70),
.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034),
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
.base.atr_rxval = MIX_EN,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 0,
.common.CP1 = 7,
.common.CP2 = 7,
.base.is_tx = true,
.base.output_enables = 0x00E0,
.base.used_pins = 0x00FF,
- .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1600e6),
- .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2000e6),
+ .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1500e6),
+ .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2100e6),
//.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
.base.is_quadrature = true,
- .base.i_and_q_swapped = true,
+ .base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
.base.atr_rxval = ANT_SW,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 0,
.common.CP1 = 7,
.common.CP2 = 7,
.common.spi_mask = SPI_SS_TX_DB,
- .common.freq_mult = 1
+ .common.freq_mult = 1
};
.base.output_enables = 0x00E0,
.base.used_pins = 0x00FF,
.base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2300e6),
- .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2700e6),
+ .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2900e6),
.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70),
.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034),
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
.base.atr_rxval = MIX_EN,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 0,
.common.CP1 = 7,
.common.CP2 = 7,
.base.output_enables = 0x00E0,
.base.used_pins = 0x00FF,
.base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2300e6),
- .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2700e6),
+ .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2900e6),
//.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
//.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
.base.is_quadrature = true,
- .base.i_and_q_swapped = true,
+ .base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
.base.atr_rxval = ANT_SW,
// .base.atr_tx_delay =
// .base.atr_rx_delay =
+ .base.set_antenna = 0,
.common.DIV2 = 0,
.common.CP1 = 7,
.common.CP2 = 7,
*dc = 0;
struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb;
- //u2_fxpt_freq_t desired_n = db->common.freq_mult*freq/phdet_freq;
- //int N_DIV = u2_fxpt_freq_round_to_int(desired_n);
- u2_fxpt_freq_t desired_n = ((1LL<<20) * db->common.freq_mult*freq)/phdet_freq;
+ u2_fxpt_freq_t desired_n = (U2_DOUBLE_TO_FXPT_FREQ(1.0)*db->common.freq_mult*freq)/phdet_freq;
int N_DIV = u2_fxpt_freq_round_to_int(desired_n);
int B = N_DIV/PRESCALER;
int A = N_DIV - PRESCALER*B;
//printf("DACWORD %d\n",dacword);
lsdac_write_rx(1,dacword);
return true;
- /*
- def set_gain(self, gain):
- """
- Set the gain.
-
- @param gain: gain in decibels
- @returns True/False
- """
- maxgain = self.gain_range()[1] - self._u.pga_max()
- mingain = self.gain_range()[0]
- if gain > maxgain:
- pga_gain = gain-maxgain
- assert pga_gain <= self._u.pga_max()
- agc_gain = maxgain
- else:
- pga_gain = 0
- agc_gain = gain
- V_maxgain = .2
- V_mingain = 1.2
- V_fullscale = 3.3
- dac_value = (agc_gain*(V_maxgain-V_mingain)/(maxgain-mingain) + V_mingain)*4096/V_fullscale
- assert dac_value>=0 and dac_value<4096
- return self._u.write_aux_dac(self._which, 0, int(dac_value)) and \
- self._set_pga(int(pga_gain))
-
- def gain_range(self):
- return (self._u.pga_min(), self._u.pga_max() + 70, 0.05) -- For 900-2400
- return (self._u.pga_min(), self._u.pga_max() + 45, 0.035) -- For 400
- */
}