3 * Copyright 2004 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
24 #include "fpga_regs_common.h"
25 #include "usrp_common.h"
26 #include "usrp_globals.h"
29 unsigned char g_tx_reset = 0;
30 unsigned char g_rx_reset = 0;
33 fpga_write_reg (unsigned char regno, const xdata unsigned char *regval)
35 spi_write (0, 0x00 | (regno & 0x7f),
37 SPI_FMT_MSB | SPI_FMT_HDR_1,
42 static xdata unsigned char regval[4] = {0, 0, 0, 0};
45 write_fpga_master_ctrl (void)
49 v |= bmFR_MC_ENABLE_TX;
51 v |= bmFR_MC_ENABLE_RX;
53 v |= bmFR_MC_RESET_TX;
55 v |= bmFR_MC_RESET_RX;
58 fpga_write_reg (FR_MASTER_CTRL, regval);
61 // Resets both AD9862's and the FPGA serial bus interface.
64 fpga_set_reset (unsigned char on)
69 USRP_PC &= ~bmPC_nRESET; // active low
76 USRP_PC |= bmPC_nRESET;
80 fpga_set_tx_enable (unsigned char on)
85 write_fpga_master_ctrl ();
94 fpga_set_rx_enable (unsigned char on)
99 write_fpga_master_ctrl ();
107 fpga_set_tx_reset (unsigned char on)
112 write_fpga_master_ctrl ();
116 fpga_set_rx_reset (unsigned char on)
121 write_fpga_master_ctrl ();