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.
23 #include "usrp_common.h"
27 set_led_0 (unsigned char on)
29 if (!on) // active low
32 USRP_PC &= ~bmPC_LED0;
36 set_led_1 (unsigned char on)
38 if (!on) // active low
41 USRP_PC &= ~bmPC_LED1;
62 set_sleep_bits (unsigned char bits, unsigned char mask)
67 static xdata unsigned char xbuf[1];
70 write_9862 (unsigned char which, unsigned char regno, unsigned char value)
74 spi_write (0, regno & 0x3f,
75 which == 0 ? SPI_ENABLE_CODEC_A : SPI_ENABLE_CODEC_B,
76 SPI_FMT_MSB | SPI_FMT_HDR_1,
81 write_both_9862s (unsigned char regno, unsigned char value)
85 spi_write (0, regno & 0x3f,
86 SPI_ENABLE_CODEC_A | SPI_ENABLE_CODEC_B,
87 SPI_FMT_MSB | SPI_FMT_HDR_1,
91 #define REG_RX_PWR_DN 1
92 #define REG_TX_PWR_DN 8
93 #define REG_TX_MODULATOR 20
96 power_down_9862s (void)
98 write_both_9862s (REG_RX_PWR_DN, 0x01);
99 write_both_9862s (REG_TX_PWR_DN, 0x0f); // pwr dn digital and analog_both
100 write_both_9862s (REG_TX_MODULATOR, 0x00); // coarse & fine modulators disabled
109 USRP_PC &= ~bmPC_nRESET; // active low reset
110 USRP_PC |= bmPC_nRESET;