diff options
author | Josh Blum <josh@joshknows.com> | 2010-04-28 11:10:50 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-04-28 11:10:50 -0700 |
commit | cbd9e1da0866893d86320787a99cf4257478c539 (patch) | |
tree | 0b2515cd96d9c341795b91efed25df0616ea821c /firmware/microblaze/lib | |
parent | f5b6776a0b642c0357fbecdead9d2b1ac6ece3d3 (diff) | |
parent | 8497eb2ac016f72e2b9a9028e5126bc73f5b0c9a (diff) | |
download | uhd-cbd9e1da0866893d86320787a99cf4257478c539.tar.gz uhd-cbd9e1da0866893d86320787a99cf4257478c539.tar.bz2 uhd-cbd9e1da0866893d86320787a99cf4257478c539.zip |
Merge branch 'master' of git@ettus.sourcerepo.com:ettus/uhdpriv into usrp_e
Diffstat (limited to 'firmware/microblaze/lib')
-rw-r--r-- | firmware/microblaze/lib/Makefile.am | 6 | ||||
-rw-r--r-- | firmware/microblaze/lib/db.h | 31 | ||||
-rw-r--r-- | firmware/microblaze/lib/db_init.c | 77 | ||||
-rw-r--r-- | firmware/microblaze/lib/lsadc.c | 73 | ||||
-rw-r--r-- | firmware/microblaze/lib/lsadc.h | 45 | ||||
-rw-r--r-- | firmware/microblaze/lib/lsdac.c | 68 | ||||
-rw-r--r-- | firmware/microblaze/lib/lsdac.h | 47 | ||||
-rw-r--r-- | firmware/microblaze/lib/u2_init.c | 5 |
8 files changed, 0 insertions, 352 deletions
diff --git a/firmware/microblaze/lib/Makefile.am b/firmware/microblaze/lib/Makefile.am index 3d02cfe8b..783895850 100644 --- a/firmware/microblaze/lib/Makefile.am +++ b/firmware/microblaze/lib/Makefile.am @@ -28,7 +28,6 @@ libu2fw_a_SOURCES = \ bsm12.c \ buffer_pool.c \ clocks.c \ - db_init.c \ dbsm.c \ eeprom.c \ ethernet.c \ @@ -38,8 +37,6 @@ libu2fw_a_SOURCES = \ hal_io.c \ hal_uart.c \ i2c.c \ - lsadc.c \ - lsdac.c \ mdelay.c \ memcpy_wa.c \ memset_wa.c \ @@ -62,7 +59,6 @@ noinst_HEADERS = \ bsm12.h \ buffer_pool.h \ clocks.h \ - db.h \ dbsm.h \ eth_mac.h \ eth_mac_regs.h \ @@ -71,8 +67,6 @@ noinst_HEADERS = \ hal_io.h \ hal_uart.h \ i2c.h \ - lsadc.h \ - lsdac.h \ mdelay.h \ memcpy_wa.h \ memory_map.h \ diff --git a/firmware/microblaze/lib/db.h b/firmware/microblaze/lib/db.h deleted file mode 100644 index 358cb222b..000000000 --- a/firmware/microblaze/lib/db.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* - * Interface to daughterboard code - */ - -#ifndef INCLUDED_DB_H -#define INCLUDED_DB_H - -#include <usrp2_types.h> -#include <usrp2_i2c_addr.h> - -int read_dboard_eeprom(int i2c_addr); - -#endif /* INCLUDED_DB_H */ diff --git a/firmware/microblaze/lib/db_init.c b/firmware/microblaze/lib/db_init.c deleted file mode 100644 index 23805d9cd..000000000 --- a/firmware/microblaze/lib/db_init.c +++ /dev/null @@ -1,77 +0,0 @@ -// -// Copyright 2010 Ettus Research LLC -// -/* - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#include <memory_map.h> -#include <i2c.h> -#include <string.h> -#include <stdio.h> -#include <db.h> -#include <hal_io.h> -#include <nonstdio.h> - - -typedef enum { UDBE_OK, UDBE_NO_EEPROM, UDBE_INVALID_EEPROM } usrp_dbeeprom_status_t; - -static usrp_dbeeprom_status_t -read_raw_dboard_eeprom (unsigned char *buf, int i2c_addr) -{ - if (!eeprom_read (i2c_addr, 0, buf, DB_EEPROM_CLEN)) - return UDBE_NO_EEPROM; - - if (buf[DB_EEPROM_MAGIC] != DB_EEPROM_MAGIC_VALUE) - return UDBE_INVALID_EEPROM; - - int sum = 0; - unsigned int i; - for (i = 0; i < DB_EEPROM_CLEN; i++) - sum += buf[i]; - - if ((sum & 0xff) != 0) - return UDBE_INVALID_EEPROM; - - return UDBE_OK; -} - - -/* - * Return DBID, -1 <none> or -2 <invalid eeprom contents> - */ -int -read_dboard_eeprom(int i2c_addr) -{ - unsigned char buf[DB_EEPROM_CLEN]; - - usrp_dbeeprom_status_t s = read_raw_dboard_eeprom (buf, i2c_addr); - - //printf("\nread_raw_dboard_eeprom: %d\n", s); - - switch (s){ - case UDBE_OK: - return (buf[DB_EEPROM_ID_MSB] << 8) | buf[DB_EEPROM_ID_LSB]; - - case UDBE_NO_EEPROM: - default: - return -1; - - case UDBE_INVALID_EEPROM: - return -2; - } -} diff --git a/firmware/microblaze/lib/lsadc.c b/firmware/microblaze/lib/lsadc.c deleted file mode 100644 index 7983552e7..000000000 --- a/firmware/microblaze/lib/lsadc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "lsadc.h" -#include "spi.h" -#include "memory_map.h" - - -// AD9712 or AD7922 1 MS/s, 10-/12-bit ADCs - -//#define SPI_SS_DEBUG SPI_SS_RX_DB -#define SPI_SS_DEBUG 0 - - -void -lsadc_init(void) -{ - // nop -} - -/* - * The ADC's are pipelined. That is, you have to tell them - * which of the two inputs you want one cycle ahead of time. - * We could optimize and keep track of which one we used last - * time, but for simplicity we'll always tell it which - * one we want. This takes 2 16-bit xfers, one to set the - * input and one to read the one we want. - */ - -int -_lsadc_read(int which_adc, int slave_select) -{ - uint32_t r; - int channel = which_adc & 0x1; - - // Set CHN and STY equal to channel number. We don't want "daisy chain mode" - uint16_t cmd = (channel << 13) | (channel << 12); - - spi_transact(SPI_TXONLY, slave_select | SPI_SS_DEBUG, - cmd, 16, SPIF_PUSH_RISE | SPIF_LATCH_RISE); - - r = spi_transact(SPI_TXRX, slave_select | SPI_SS_DEBUG, - cmd, 16, SPIF_PUSH_RISE | SPIF_LATCH_RISE); - - return r & 0x0fff; -} - -int -lsadc_read_rx(int which_adc) -{ - return _lsadc_read(which_adc, SPI_SS_RX_ADC); -} - -int -lsadc_read_tx(int which_adc) -{ - return _lsadc_read(which_adc, SPI_SS_TX_ADC); -} diff --git a/firmware/microblaze/lib/lsadc.h b/firmware/microblaze/lib/lsadc.h deleted file mode 100644 index 319f34d91..000000000 --- a/firmware/microblaze/lib/lsadc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#ifndef INCLUDED_LSADC_H -#define INCLUDED_LSADC_H - -#include "memory_map.h" - -/*! - * \brief One time call to initialize low-speed ADCs. - */ -void lsadc_init(void); - -/*! - * \brief Read one of the low-speed Rx daughterboard ADCs. - * \param which_adc in [0, 1] - * - * \returns 12-bit value in [0,4095] - */ -int lsadc_read_rx(int which_adc); - -/*! - * \brief Read one of the low-speed Tx daughterboard ADCs. - * \param which_adc in [0, 1] - * - * \returns 12-bit value in [0,4095] - */ -int lsadc_read_tx(int which_adc); - - -#endif /* INCLUDED_LSADC_H */ diff --git a/firmware/microblaze/lib/lsdac.c b/firmware/microblaze/lib/lsdac.c deleted file mode 100644 index 6bc2e5cb5..000000000 --- a/firmware/microblaze/lib/lsdac.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "lsdac.h" -#include "spi.h" -#include "memory_map.h" - -// AD5624, AD5623 - -#define CMD(x) ((x) << 19) -#define CMD_WR_INPUT_N CMD(0) // write input N -#define CMD_UP_DAC_N CMD(1) // update DAC N from input reg -#define CMD_WR_INPUT_N_LDAC CMD(2) // write input N, update all -#define CMD_WR_UP_DAC_N CMD(3) // write and update N -#define CMD_WR_PWR_CONFIG CMD(4) // write power up/down config reg -#define CMD_SW_RESET CMD(5) // force s/w reset -#define CMD_WR_LDAC_CFG CMD(6) // write LDAC config reg -#define CMD_WR_INT_REF_CFG CMD(7) // write internal ref cfg reg (AD5623R only) - - -//#define SPI_SS_DEBUG SPI_SS_TX_DB -#define SPI_SS_DEBUG 0 - -inline static void -_write_rx(uint32_t v) -{ - spi_transact(SPI_TXONLY, SPI_SS_RX_DAC | SPI_SS_DEBUG, v, 24, SPIF_PUSH_RISE); -} - -inline static void -_write_tx(uint32_t v) -{ - spi_transact(SPI_TXONLY, SPI_SS_TX_DAC | SPI_SS_DEBUG, v, 24, SPIF_PUSH_RISE); -} - -void -lsdac_init(void) -{ - _write_tx(CMD_SW_RESET | 0x1); // power-on reset - _write_rx(CMD_SW_RESET | 0x1); // power-on reset -} - -void -lsdac_write_rx(int which_dac, int value) -{ - _write_rx(CMD_WR_UP_DAC_N | ((which_dac & 0x7) << 16) | ((value << 4) & 0xffff)); -} - -void -lsdac_write_tx(int which_dac, int value) -{ - _write_tx(CMD_WR_UP_DAC_N | ((which_dac & 0x7) << 16) | ((value << 4) & 0xffff)); -} diff --git a/firmware/microblaze/lib/lsdac.h b/firmware/microblaze/lib/lsdac.h deleted file mode 100644 index 9cad917e3..000000000 --- a/firmware/microblaze/lib/lsdac.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#ifndef INCLUDED_LSDAC_H -#define INCLUDED_LSDAC_H - -#include "memory_map.h" - -/*! - * \brief One time call to initialize low-speed DACs. - */ -void lsdac_init(void); - -/*! - * \brief Write one of the low-speed Rx daughterboard DACs. - * \param which_dac in [0, 3] - * \param unsigned 12-bit value in [0, 4095] - * - * value maps linearly to output voltage from 0 to 3.3V - */ -void lsdac_write_rx(int which_dac, int value); - -/*! - * \brief Write one of the low-speed Tx daughterboard DACs. - * \param which_dac in [0, 3] - * \param unsigned 12-bit value in [0, 4095] - * - * value maps linearly to output voltage from 0 to 3.3V - */ -void lsdac_write_tx(int which_dac, int value); - - -#endif /* INCLUDED_LSDAC_H */ diff --git a/firmware/microblaze/lib/u2_init.c b/firmware/microblaze/lib/u2_init.c index bd3302d95..399d834cb 100644 --- a/firmware/microblaze/lib/u2_init.c +++ b/firmware/microblaze/lib/u2_init.c @@ -20,14 +20,11 @@ #include "spi.h" #include "pic.h" #include "hal_io.h" -#include "lsadc.h" -#include "lsdac.h" #include "buffer_pool.h" #include "hal_uart.h" #include "i2c.h" #include "mdelay.h" #include "clocks.h" -#include "db.h" #include "usrp2_i2c_addr.h" //#include "nonstdio.h" @@ -84,8 +81,6 @@ u2_init(void) pic_init(); // progammable interrupt controller bp_init(); // buffer pool - lsadc_init(); // low-speed ADCs - lsdac_init(); // low-speed DACs hal_enable_ints(); |