diff options
Diffstat (limited to 'usrp')
26 files changed, 180 insertions, 172 deletions
diff --git a/usrp/host/include/usrp/usrp_basic.h b/usrp/host/include/usrp/usrp_basic.h index 063cb3c23..c24630eb6 100644 --- a/usrp/host/include/usrp/usrp_basic.h +++ b/usrp/host/include/usrp/usrp_basic.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++ -*- */ +/* -*- c++ -*- */ /* * Copyright 2005,2009 Free Software Foundation, Inc. * @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _USRP_BASIC_H_ -#define _USRP_BASIC_H_ +#ifndef INCLUDED_USRP_BASIC_H +#define INCLUDED_USRP_BASIC_H #include <usrp/db_base.h> #include <usrp/usrp_slots.h> @@ -990,4 +990,4 @@ public: bool stop (); }; -#endif +#endif /* INCLUDED_USRP_BASIC_H */ diff --git a/usrp/host/include/usrp/usrp_prims.h b/usrp/host/include/usrp/usrp_prims.h index 042958653..323287d02 100644 --- a/usrp/host/include/usrp/usrp_prims.h +++ b/usrp/host/include/usrp/usrp_prims.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++ -*- */ +/* -*- c++ -*- */ /* * Copyright 2005,2009 Free Software Foundation, Inc. * @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef _USRP_PRIMS_H_ -#define _USRP_PRIMS_H_ +#ifndef INCLUDED_USRP_PRIMS_H +#define INCLUDED_USRP_PRIMS_H #include <usrp/usrp_slots.h> #include <usrp/libusb_types.h> @@ -40,15 +40,15 @@ enum usrp_load_status_t { ULS_ERROR = 0, ULS_OK, ULS_ALREADY_LOADED }; * * Probe busses and devices. The argument is ignored and defaults to NULL. * Safe to call more than once. - * + * * libusb-1.0 * * If an location to a libusb_context is passed in, create and write in the new * context. If no argument is provided, initialize libusb with the default - * (NULL) context. + * (NULL) context. * * Generally _not_ safe to call more than once with non-NULL argument since a - * new context will be created each time. + * new context will be created each time. */ void usrp_one_time_init (libusb_context **ctx = NULL); @@ -295,4 +295,4 @@ bool usrp_write_dboard_offsets (libusb_device_handle *udh, int slot_id, */ std::string usrp_serial_number(libusb_device_handle *udh); -#endif /* _USRP_PRIMS_H_ */ +#endif /* INCLUDED_USRP_PRIMS_H */ diff --git a/usrp/host/lib/db_dbs_rx.cc b/usrp/host/lib/db_dbs_rx.cc index 98b05d0bf..7fe8c4951 100644 --- a/usrp/host/lib/db_dbs_rx.cc +++ b/usrp/host/lib/db_dbs_rx.cc @@ -1,5 +1,5 @@ // -// Copyright 2008 Free Software Foundation, Inc. +// Copyright 2008,2009 Free Software Foundation, Inc. // // This file is part of GNU Radio // diff --git a/usrp/host/lib/db_dtt754.cc b/usrp/host/lib/db_dtt754.cc index 9634c610d..9ced705e4 100644 --- a/usrp/host/lib/db_dtt754.cc +++ b/usrp/host/lib/db_dtt754.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ // -// Copyright 2008 Free Software Foundation, Inc. +// Copyright 2008,2009 Free Software Foundation, Inc. // // This file is part of GNU Radio // diff --git a/usrp/host/lib/db_dtt768.cc b/usrp/host/lib/db_dtt768.cc index 68e307723..0dfe1a8f3 100644 --- a/usrp/host/lib/db_dtt768.cc +++ b/usrp/host/lib/db_dtt768.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ // -// Copyright 2008 Free Software Foundation, Inc. +// Copyright 2008,2009 Free Software Foundation, Inc. // // This file is part of GNU Radio // diff --git a/usrp/host/lib/db_flexrf.cc b/usrp/host/lib/db_flexrf.cc index f6b44834b..85ef79bd3 100644 --- a/usrp/host/lib/db_flexrf.cc +++ b/usrp/host/lib/db_flexrf.cc @@ -1,5 +1,5 @@ // -// Copyright 2008 Free Software Foundation, Inc. +// Copyright 2008,2009 Free Software Foundation, Inc. // // This file is part of GNU Radio // diff --git a/usrp/host/lib/db_flexrf_mimo.cc b/usrp/host/lib/db_flexrf_mimo.cc index e2db5cd10..29bbbd58f 100644 --- a/usrp/host/lib/db_flexrf_mimo.cc +++ b/usrp/host/lib/db_flexrf_mimo.cc @@ -19,6 +19,10 @@ * Boston, MA 02110-1301, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <usrp/db_flexrf_mimo.h> #include <fpga_regs_standard.h> #include <fpga_regs_common.h> diff --git a/usrp/host/lib/db_tv_rx.cc b/usrp/host/lib/db_tv_rx.cc index 4b28e9bc1..1822479e1 100644 --- a/usrp/host/lib/db_tv_rx.cc +++ b/usrp/host/lib/db_tv_rx.cc @@ -1,5 +1,5 @@ // -// Copyright 2008 Free Software Foundation, Inc. +// Copyright 2008,2009 Free Software Foundation, Inc. // // This file is part of GNU Radio // diff --git a/usrp/host/lib/db_tv_rx_mimo.cc b/usrp/host/lib/db_tv_rx_mimo.cc index d0dcb52a9..0964c5d8b 100644 --- a/usrp/host/lib/db_tv_rx_mimo.cc +++ b/usrp/host/lib/db_tv_rx_mimo.cc @@ -1,5 +1,5 @@ // -// Copyright 2008 Free Software Foundation, Inc. +// Copyright 2008,2009 Free Software Foundation, Inc. // // This file is part of GNU Radio // @@ -18,6 +18,10 @@ // the Free Software Foundation, Inc., 51 Franklin Street, // Boston, MA 02110-1301, USA. +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <usrp/db_tv_rx_mimo.h> db_tv_rx_mimo::db_tv_rx_mimo(usrp_basic_sptr usrp, int which, diff --git a/usrp/host/lib/fusb.cc b/usrp/host/lib/fusb.cc index c14d7c1fb..2a597b67c 100644 --- a/usrp/host/lib/fusb.cc +++ b/usrp/host/lib/fusb.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/usrp/host/lib/fusb.h b/usrp/host/lib/fusb.h index 5e3f3aacb..538ae1ae0 100644 --- a/usrp/host/lib/fusb.h +++ b/usrp/host/lib/fusb.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++ -*- */ +/* -*- c++ -*- */ /* * Copyright 2005,2009 Free Software Foundation, Inc. * diff --git a/usrp/host/lib/fusb_libusb1.cc b/usrp/host/lib/fusb_libusb1.cc index 0171235de..4846f51a5 100644 --- a/usrp/host/lib/fusb_libusb1.cc +++ b/usrp/host/lib/fusb_libusb1.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. - * + * Copyright 2003,2009 Free Software Foundation, Inc. + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -35,9 +35,9 @@ #include <errno.h> #include <string.h> -#define MINIMIZE_TX_BUFFERING true +#define MINIMIZE_TX_BUFFERING true -static const int MAX_BLOCK_SIZE = fusb_sysconfig::max_block_size(); +static const int MAX_BLOCK_SIZE = fusb_sysconfig::max_block_size(); static const int DEFAULT_BLOCK_SIZE = MAX_BLOCK_SIZE; static const int DEFAULT_BUFFER_SIZE = 4 * (1L << 20); // 4 MB endpoint static const int LIBUSB_TIMEOUT = 0; // no timeout @@ -49,7 +49,7 @@ lut_get_ephandle (libusb_transfer *lut) } // ------------------------------------------------------------------------ -// libusb_transfer allocation, deallocation, and callback +// libusb_transfer allocation, deallocation, and callback // ------------------------------------------------------------------------ static void @@ -60,14 +60,14 @@ free_lut (libusb_transfer *lut) if (lut->endpoint & 0x80) delete [] ((unsigned char *) lut->buffer); - libusb_free_transfer(lut); + libusb_free_transfer(lut); } /* * The callback means the libusb_transfer is completed whether sent, cancelled, * or failed. Move the libusb_transfer from the pending list to the - * completed list. If the cancel is from the destructor then free the + * completed list. If the cancel is from the destructor then free the * transfer instead; normally this won't happen since all endpoints should be * destroyed first leaving the pending list empty. */ @@ -77,7 +77,7 @@ generic_callback(struct libusb_transfer *lut) { // Fish out devhandle from endpoint - fusb_devhandle_libusb1* dev_handle = + fusb_devhandle_libusb1* dev_handle = lut_get_ephandle(lut)->get_fusb_devhandle_libusb1(); dev_handle->pending_remove(lut); @@ -87,10 +87,10 @@ generic_callback(struct libusb_transfer *lut) free_lut (lut); return; } - + lut_get_ephandle(lut)->completed_list_add(lut); -} +} static libusb_transfer* alloc_lut (fusb_ephandle_libusb1 *self, int buffer_length, int endpoint, @@ -110,11 +110,11 @@ alloc_lut (fusb_ephandle_libusb1 *self, int buffer_length, int endpoint, // Load the libusb_transfer for bulk transfer libusb_fill_bulk_transfer (lut, // transfer - dev_handle, // dev_handle + dev_handle, // dev_handle endpoint, // endpoint write_buffer, // buffer buffer_length, // length - generic_callback, // callback + generic_callback, // callback self, // user_data LIBUSB_TIMEOUT); // timeout @@ -129,7 +129,7 @@ fusb_devhandle_libusb1::fusb_devhandle_libusb1 (libusb_device_handle *udh, libusb_context *ctx) : fusb_devhandle (udh), d_ctx (ctx), d_teardown (false) { - // that's it + // that's it } fusb_devhandle_libusb1::~fusb_devhandle_libusb1 () @@ -160,10 +160,10 @@ fusb_devhandle_libusb1::make_ephandle (int endpoint, bool input_p, } /* - * devhandle list manipulators + * devhandle list manipulators */ -void +void fusb_devhandle_libusb1::pending_add (libusb_transfer *lut) { d_pending_rqsts.push_back (lut); @@ -201,7 +201,7 @@ fusb_devhandle_libusb1::pending_get () } /* - * Match libusb_tranfer with the pending list and erase + * Match libusb_tranfer with the pending list and erase * Return true if found, false otherwise */ @@ -241,11 +241,11 @@ fusb_devhandle_libusb1::_submit_lut (libusb_transfer *lut) } /* - * Attempt to cancel any pending libusb_transfer transactions. + * Attempt to cancel any pending libusb_transfer transactions. * Return true in the absence of errors, which does not mean that the transfer * is cancelled. Cancellation can be checked after the callback is fired off - * by libusb. - */ + * by libusb. + */ bool fusb_devhandle_libusb1::_cancel_lut (libusb_transfer *lut) @@ -287,12 +287,12 @@ fusb_devhandle_libusb1::_reap (bool ok_to_block_p) tv.tv_sec = 0; tv.tv_usec = 0; } - + if ((ret = libusb_handle_events_timeout(d_ctx, &tv)) < 0) { fprintf (stderr, "fusb::_reap libusb_handle_events() %i\n", ret); return false; } - + return true; } @@ -300,9 +300,9 @@ void fusb_devhandle_libusb1::_wait_for_completion () { - while (!d_pending_rqsts.empty ()) - if (!_reap(true)) - break; + while (!d_pending_rqsts.empty ()) + if (!_reap(true)) + break; } @@ -339,7 +339,7 @@ fusb_ephandle_libusb1::fusb_ephandle_libusb1 (fusb_devhandle_libusb1 *dh, fprintf(stderr, "fusb_ephandle_libusb1::ctor: d_block_size = %d d_nblocks = %d\n", d_block_size, d_nblocks); - // allocate libusb_transfers + // allocate libusb_transfers for (int i = 0; i < d_nblocks; i++) d_free_list.push_back (alloc_lut (this, d_block_size, d_endpoint, d_input_p, d_write_buffer, d_devhandle)); @@ -391,7 +391,7 @@ fusb_ephandle_libusb1::start () } /* - * Cancel all transfers in progress or pending and return to initial state + * Cancel all transfers in progress or pending and return to initial state */ bool @@ -434,7 +434,7 @@ fusb_ephandle_libusb1::stop () } // ------------------------------------------------------------------------ -// routines for writing +// routines for writing // ------------------------------------------------------------------------ #if (MINIMIZE_TX_BUFFERING) @@ -444,7 +444,7 @@ fusb_ephandle_libusb1::write (const void *buffer, int nbytes) { if (!d_started) // doesn't matter here, but keeps semantics constant return -1; - + if (d_input_p) return -1; @@ -465,7 +465,7 @@ fusb_ephandle_libusb1::write (const void *buffer, int nbytes) n += m; src += m; - + if (!submit_lut(lut)) return -1; @@ -547,11 +547,11 @@ fusb_ephandle_libusb1::reap_complete_writes () while ((lut = completed_list_get ()) != 0) { // Check for any errors or short writes that were reporetd in the transfer. - // libusb1 sets status, actual_length. + // libusb1 sets status, actual_length. - if (lut->status != LIBUSB_TRANSFER_COMPLETED) { + if (lut->status != LIBUSB_TRANSFER_COMPLETED) { fprintf (stderr, "fusb: (status %d) \n", lut->status ); - } + } else if (lut->actual_length != lut->length){ fprintf (stderr, "fusb: short write xfer: %d != %d\n", lut->actual_length, lut->length); @@ -568,7 +568,7 @@ fusb_ephandle_libusb1::wait_for_completion () } // ------------------------------------------------------------------------ -// routines for reading +// routines for reading // ------------------------------------------------------------------------ int @@ -619,12 +619,12 @@ fusb_ephandle_libusb1::reload_read_buffer () while (1) { - while ((lut = completed_list_get ()) == 0 ) + while ((lut = completed_list_get ()) == 0 ) if (!d_devhandle->_reap(true)) - return false; + return false; if (lut->status != LIBUSB_TRANSFER_COMPLETED) { - fprintf (stderr, "fust: (rd status %d) %s\n", lut->status, + fprintf (stderr, "fust: (rd status %d) %s\n", lut->status, strerror (-lut->status)); lut->actual_length = 0; free_list_add (lut); @@ -641,7 +641,7 @@ fusb_ephandle_libusb1::reload_read_buffer () /* - * ephandle list manipulation + * ephandle list manipulation */ diff --git a/usrp/host/lib/fusb_libusb1.h b/usrp/host/lib/fusb_libusb1.h index 4bc49aafb..c0e3736bd 100644 --- a/usrp/host/lib/fusb_libusb1.h +++ b/usrp/host/lib/fusb_libusb1.h @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. - * + * Copyright 2003,2009 Free Software Foundation, Inc. + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -85,8 +85,8 @@ private: libusb_transfer *get_write_work_in_progress (); void reap_complete_writes (); bool reload_read_buffer (); - bool submit_lut (libusb_transfer *lut); - + bool submit_lut (libusb_transfer *lut); + public: // CREATORS fusb_ephandle_libusb1 (fusb_devhandle_libusb1 *dh, int endpoint, bool input_p, @@ -121,7 +121,7 @@ public: struct libusb_transfer *free_list_get (); struct libusb_transfer *completed_list_get (); - // accessor to work from callback context + // accessor to work from callback context fusb_devhandle_libusb1* get_fusb_devhandle_libusb1 () const { return d_devhandle; } diff --git a/usrp/host/lib/fusb_sysconfig_darwin.cc b/usrp/host/lib/fusb_sysconfig_darwin.cc index 3d1f656cd..68dd64815 100644 --- a/usrp/host/lib/fusb_sysconfig_darwin.cc +++ b/usrp/host/lib/fusb_sysconfig_darwin.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/usrp/host/lib/fusb_sysconfig_generic.cc b/usrp/host/lib/fusb_sysconfig_generic.cc index 271ba6e3a..e0986510c 100644 --- a/usrp/host/lib/fusb_sysconfig_generic.cc +++ b/usrp/host/lib/fusb_sysconfig_generic.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/usrp/host/lib/fusb_sysconfig_libusb1.cc b/usrp/host/lib/fusb_sysconfig_libusb1.cc index a005f540d..46daf561a 100644 --- a/usrp/host/lib/fusb_sysconfig_libusb1.cc +++ b/usrp/host/lib/fusb_sysconfig_libusb1.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. + * Copyright 2003,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/usrp/host/lib/fusb_sysconfig_linux.cc b/usrp/host/lib/fusb_sysconfig_linux.cc index c2e453881..e33b90ba4 100644 --- a/usrp/host/lib/fusb_sysconfig_linux.cc +++ b/usrp/host/lib/fusb_sysconfig_linux.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. - * + * Copyright 2003,2009 Free Software Foundation, Inc. + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -30,7 +30,7 @@ static const int FUSB_BUFFER_SIZE = 1 * (1L << 20); // 1MB fusb_devhandle * fusb_sysconfig::make_devhandle (usb_dev_handle *udh, libusb_context *ctx) { - return new fusb_devhandle_linux (udh); + return new fusb_devhandle_linux (udh); } int fusb_sysconfig::max_block_size () diff --git a/usrp/host/lib/fusb_sysconfig_ra_wb.cc b/usrp/host/lib/fusb_sysconfig_ra_wb.cc index 561ab2223..c527e3099 100644 --- a/usrp/host/lib/fusb_sysconfig_ra_wb.cc +++ b/usrp/host/lib/fusb_sysconfig_ra_wb.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2006 Free Software Foundation, Inc. + * Copyright 2003,2006,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/usrp/host/lib/fusb_sysconfig_win32.cc b/usrp/host/lib/fusb_sysconfig_win32.cc index a0d140543..fb4be8829 100644 --- a/usrp/host/lib/fusb_sysconfig_win32.cc +++ b/usrp/host/lib/fusb_sysconfig_win32.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2003,2005 Free Software Foundation, Inc. + * Copyright 2003,2005,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * diff --git a/usrp/host/lib/usrp_basic_common.cc b/usrp/host/lib/usrp_basic_common.cc index 91417dbe7..721301dec 100644 --- a/usrp/host/lib/usrp_basic_common.cc +++ b/usrp/host/lib/usrp_basic_common.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2003,2004,2008,2009 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -84,7 +84,7 @@ open_tx_interface (libusb_device *dev) // Given: // CLKIN = 64 MHz -// CLKSEL pin = high +// CLKSEL pin = high // // These settings give us: // CLKOUT1 = CLKIN = 64 MHz @@ -107,8 +107,8 @@ usrp_basic::shutdown_daughterboards() // nuke d'boards before we close down USB in ~usrp_basic // shutdown() will do any board shutdown while the USRP can still // be talked to - for(size_t i = 0; i < d_db.size(); i++) - for(size_t j = 0; j < d_db[i].size(); j++) + for(size_t i = 0; i < d_db.size(); i++) + for(size_t j = 0; j < d_db[i].size(); j++) d_db[i][j]->shutdown(); } @@ -122,7 +122,7 @@ usrp_basic::init_db(usrp_basic_sptr u) d_db[1] = instantiate_dbs(d_dbid[1], u, 1); } -std::vector<db_base_sptr> +std::vector<db_base_sptr> usrp_basic::db(int which_side) { which_side &= 0x1; // clamp it to avoid any reporting any errors @@ -307,7 +307,7 @@ usrp_basic::set_adc_buffer_bypass (int which_adc, bool bypass) bool usrp_basic::set_dc_offset_cl_enable(int bits, int mask) { - return _write_fpga_reg(FR_DC_OFFSET_CL_EN, + return _write_fpga_reg(FR_DC_OFFSET_CL_EN, (d_fpga_shadows[FR_DC_OFFSET_CL_EN] & ~mask) | (bits & mask)); } @@ -399,7 +399,7 @@ usrp_basic::_read_spi (int optional_header, int enables, int format, int len) { if (len <= 0) return ""; - + char buf[len]; if (!usrp_spi_read (d_udh, optional_header, enables, format, buf, len)) @@ -741,7 +741,7 @@ usrp_basic_rx::usrp_basic_rx (int which_board, int fusb_block_size, int fusb_nbl if (fusb_nblocks < 0) throw std::out_of_range ("usrp_basic_rx: invalid fusb_nblocks"); - + if (fusb_block_size == 0) fusb_block_size = fusb_sysconfig::default_block_size(); @@ -799,7 +799,7 @@ usrp_basic_rx::start () fprintf (stderr, "usrp_basic_rx: set_rx_enable failed\n"); return false; } - + return true; } @@ -827,7 +827,7 @@ usrp_basic_rx::make (int which_board, int fusb_block_size, int fusb_nblocks, const std::string firmware_filename) { usrp_basic_rx *u = 0; - + try { u = new usrp_basic_rx (which_board, fusb_block_size, fusb_nblocks, fpga_filename, firmware_filename); @@ -860,10 +860,10 @@ int usrp_basic_rx::read (void *buf, int len, bool *overrun) { int r; - + if (overrun) *overrun = false; - + if (len < 0 || (len % 512) != 0){ fprintf (stderr, "usrp_basic_rx::read: invalid length = %d\n", len); return -1; @@ -890,7 +890,7 @@ usrp_basic_rx::read (void *buf, int len, bool *overrun) fprintf (stderr, "usrp_basic_rx: usrp_check_rx_overrun failed\n"); } } - + return r; } @@ -940,21 +940,21 @@ usrp_basic_rx::probe_rx_slots (bool verbose) _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | eeprom.oe); _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); break; - + case UDBE_NO_EEPROM: d_dbid[i] = -1; msg = "<none>"; _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000); _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); break; - + case UDBE_INVALID_EEPROM: d_dbid[i] = -2; msg = "Invalid EEPROM contents"; _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000); _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); break; - + case UDBE_BAD_SLOT: default: assert (0); @@ -1144,7 +1144,7 @@ usrp_basic_tx::usrp_basic_tx (int which_board, int fusb_block_size, int fusb_nbl if (fusb_nblocks < 0) throw std::out_of_range ("usrp_basic_rx: invalid fusb_nblocks"); - + if (fusb_block_size == 0) fusb_block_size = FUSB_BLOCK_SIZE; @@ -1194,7 +1194,7 @@ usrp_basic_tx::start () fprintf (stderr, "usrp_basic_tx: set_tx_enable failed\n"); return false; } - + if (!d_ephandle->start ()){ fprintf (stderr, "usrp_basic_tx: failed to start end point streaming"); return false; @@ -1227,7 +1227,7 @@ usrp_basic_tx::make (int which_board, int fusb_block_size, int fusb_nblocks, const std::string firmware_filename) { usrp_basic_tx *u = 0; - + try { u = new usrp_basic_tx (which_board, fusb_block_size, fusb_nblocks, fpga_filename, firmware_filename); @@ -1260,10 +1260,10 @@ int usrp_basic_tx::write (const void *buf, int len, bool *underrun) { int r; - + if (underrun) *underrun = false; - + if (len < 0 || (len % 512) != 0){ fprintf (stderr, "usrp_basic_tx::write: invalid length = %d\n", len); return -1; @@ -1272,7 +1272,7 @@ usrp_basic_tx::write (const void *buf, int len, bool *underrun) r = d_ephandle->write (buf, len); if (r > 0) d_bytes_seen += r; - + /* * In many cases, the FPGA reports an tx underrun right after we * enable the Tx path. If this is our first write, check for the @@ -1347,21 +1347,21 @@ usrp_basic_tx::probe_tx_slots (bool verbose) _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | eeprom.oe); _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); break; - + case UDBE_NO_EEPROM: d_dbid[i] = -1; msg = "<none>"; _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000); _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); break; - + case UDBE_INVALID_EEPROM: d_dbid[i] = -2; msg = "Invalid EEPROM contents"; _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000); _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); break; - + case UDBE_BAD_SLOT: default: assert (0); diff --git a/usrp/host/lib/usrp_basic_libusb0.cc b/usrp/host/lib/usrp_basic_libusb0.cc index 6e41585bb..217480580 100644 --- a/usrp/host/lib/usrp_basic_libusb0.cc +++ b/usrp/host/lib/usrp_basic_libusb0.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2003,2004,2008,2009 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -56,7 +56,7 @@ static const double POLLING_INTERVAL = 0.1; // seconds // Given: // CLKIN = 64 MHz -// CLKSEL pin = high +// CLKSEL pin = high // // CLKOUT1 = CLKIN = 64 MHz // CLKOUT2 = CLKIN = 64 MHz @@ -73,7 +73,7 @@ static unsigned char common_regs[] = { }; -usrp_basic::usrp_basic (int which_board, +usrp_basic::usrp_basic (int which_board, struct usb_dev_handle * open_interface (struct usb_device *dev), const std::string fpga_filename, @@ -87,7 +87,7 @@ usrp_basic::usrp_basic (int which_board, * SWAG: Scientific Wild Ass Guess. * * d_usb_data_rate is used only to determine how often to poll for over- and under-runs. - * We defualt it to 1/2 of our best case. Classes derived from usrp_basic (e.g., + * We defualt it to 1/2 of our best case. Classes derived from usrp_basic (e.g., * usrp_standard_tx and usrp_standard_rx) call set_usb_data_rate() to tell us the * actual rate. This doesn't change our throughput, that's determined by the signal * processing code in the FPGA (which we know nothing about), and the system limits diff --git a/usrp/host/lib/usrp_basic_libusb1.cc b/usrp/host/lib/usrp_basic_libusb1.cc index 64cff6078..35009dc66 100644 --- a/usrp/host/lib/usrp_basic_libusb1.cc +++ b/usrp/host/lib/usrp_basic_libusb1.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2003,2004,2008,2009 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -57,7 +57,7 @@ static const double POLLING_INTERVAL = 0.1; // seconds // Given: // CLKIN = 64 MHz -// CLKSEL pin = high +// CLKSEL pin = high // // These settings give us: // CLKOUT1 = CLKIN = 64 MHz @@ -74,7 +74,7 @@ static unsigned char common_regs[] = { REG_AUX_ADC_CLK, AUX_ADC_CLK_CLK_OVER_4 }; -usrp_basic::usrp_basic (int which_board, +usrp_basic::usrp_basic (int which_board, struct libusb_device_handle * open_interface (struct libusb_device *dev), const std::string fpga_filename, @@ -88,7 +88,7 @@ usrp_basic::usrp_basic (int which_board, * SWAG: Scientific Wild Ass Guess. * * d_usb_data_rate is used only to determine how often to poll for over- and under-runs. - * We defualt it to 1/2 of our best case. Classes derived from usrp_basic (e.g., + * We defualt it to 1/2 of our best case. Classes derived from usrp_basic (e.g., * usrp_standard_tx and usrp_standard_rx) call set_usb_data_rate() to tell us the * actual rate. This doesn't change our throughput, that's determined by the signal * processing code in the FPGA (which we know nothing about), and the system limits diff --git a/usrp/host/lib/usrp_prims_common.cc b/usrp/host/lib/usrp_prims_common.cc index b687a18e7..70e90d7fe 100644 --- a/usrp/host/lib/usrp_prims_common.cc +++ b/usrp/host/lib/usrp_prims_common.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2003,2004,2006,2009 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -255,7 +255,7 @@ _usrp_load_firmware (libusb_device_handle *udh, const char *filename, if (!reset_cpu (udh, true)) // hold CPU in reset while loading firmware goto fail; - + char s[1024]; int length; int addr; @@ -347,7 +347,7 @@ _usrp_load_fpga (libusb_device_handle *udh, const char *filename, if (write_cmd (udh, VRQ_FPGA_LOAD, 0, FL_BEGIN, 0, 0) != 0) goto fail; - + while ((n = fread (buf, 1, sizeof (buf), fp)) > 0){ if (write_cmd (udh, VRQ_FPGA_LOAD, 0, FL_XFER, buf, n) != n) goto fail; @@ -355,7 +355,7 @@ _usrp_load_fpga (libusb_device_handle *udh, const char *filename, if (write_cmd (udh, VRQ_FPGA_LOAD, 0, FL_END, 0, 0) != 0) goto fail; - + fclose (fp); if (!usrp_set_hash (udh, FPGA_HASH_SLOT, hash)) @@ -368,7 +368,7 @@ _usrp_load_fpga (libusb_device_handle *udh, const char *filename, usrp_set_fpga_reset (udh, 0); // fpga out of master reset // now these commands will work - + ok &= usrp_set_fpga_tx_enable (udh, 0); ok &= usrp_set_fpga_rx_enable (udh, 0); @@ -402,7 +402,7 @@ _usrp_load_fpga (libusb_device_handle *udh, const char *filename, // ---------------------------------------------------------------- -bool +bool usrp_set_led (libusb_device_handle *udh, int which, bool on) { int r = write_cmd (udh, VRQ_SET_LED, on, which, 0, 0); @@ -421,7 +421,7 @@ usrp_set_hash (libusb_device_handle *udh, int which, (unsigned char *) hash, USRP_HASH_SIZE, 1000); return r == USRP_HASH_SIZE; } - + bool usrp_get_hash (libusb_device_handle *udh, int which, unsigned char hash[USRP_HASH_SIZE]) @@ -454,7 +454,7 @@ usrp1_fpga_write (libusb_device_handle *udh, buf[1] = (value >> 16) & 0xff; buf[2] = (value >> 8) & 0xff; buf[3] = (value >> 0) & 0xff; - + return usrp_spi_write (udh, 0x00 | (regno & 0x7f), SPI_ENABLE_FPGA, SPI_FMT_MSB | SPI_FMT_HDR_1, @@ -503,31 +503,31 @@ usrp_read_fpga_reg (libusb_device_handle *udh, int reg, int *value) } } -bool +bool usrp_set_fpga_reset (libusb_device_handle *udh, bool on) { return usrp_set_switch (udh, VRQ_FPGA_SET_RESET, on); } -bool +bool usrp_set_fpga_tx_enable (libusb_device_handle *udh, bool on) { return usrp_set_switch (udh, VRQ_FPGA_SET_TX_ENABLE, on); } -bool +bool usrp_set_fpga_rx_enable (libusb_device_handle *udh, bool on) { return usrp_set_switch (udh, VRQ_FPGA_SET_RX_ENABLE, on); } -bool +bool usrp_set_fpga_tx_reset (libusb_device_handle *udh, bool on) { return usrp_set_switch (udh, VRQ_FPGA_SET_TX_RESET, on); } -bool +bool usrp_set_fpga_rx_reset (libusb_device_handle *udh, bool on) { return usrp_set_switch (udh, VRQ_FPGA_SET_RX_RESET, on); @@ -550,7 +550,7 @@ compute_hash (const char *filename, unsigned char hash[USRP_HASH_SIZE]) } int r = md5_stream (fp, hash); fclose (fp); - + return r == 0; } @@ -565,7 +565,7 @@ usrp_conditionally_load_something (libusb_device_handle *udh, { unsigned char file_hash[USRP_HASH_SIZE]; unsigned char usrp_hash[USRP_HASH_SIZE]; - + if (access (filename, R_OK) != 0){ perror (filename); return ULS_ERROR; @@ -677,13 +677,13 @@ usrp_load_firmware_nth (int nth, const char *filename, bool force, libusb_contex case ULS_OK: // we loaded firmware successfully. - + // It's highly likely that the board will renumerate (simulate a // disconnect/reconnect sequence), invalidating our current // handle. // FIXME. Turn this into a loop that rescans until we refind ourselves - + struct timespec t; // delay for 1 second t.tv_sec = 2; t.tv_nsec = 0; @@ -702,12 +702,12 @@ load_status_msg (usrp_load_status_t s, const char *type, const char *filename) { char *e = getenv("USRP_VERBOSE"); bool verbose = e != 0; - + switch (s){ case ULS_ERROR: fprintf (stderr, "usrp: failed to load %s %s.\n", type, filename); break; - + case ULS_ALREADY_LOADED: if (verbose) fprintf (stderr, "usrp: %s %s already loaded.\n", type, filename); @@ -772,7 +772,7 @@ usrp_load_standard_bits (int nth, bool force, libusb_device_handle *udh = open_nth_cmd_interface (nth, ctx); if (udh == 0) return false; - + s = usrp_load_fpga (udh, filename, force); usrp_close_interface (udh); load_status_msg (s, "fpga bitstream", filename); @@ -789,7 +789,7 @@ _usrp_get_status (libusb_device_handle *udh, int which, bool *trouble) { unsigned char status; *trouble = true; - + if (write_cmd (udh, VRQ_GET_STATUS, 0, which, &status, sizeof (status)) != sizeof (status)) return false; @@ -874,7 +874,7 @@ usrp_9862_write (libusb_device_handle *udh, int which_codec, unsigned char buf[1]; buf[0] = value; - + return usrp_spi_write (udh, 0x00 | (regno & 0x3f), which_codec == 0 ? SPI_ENABLE_CODEC_A : SPI_ENABLE_CODEC_B, SPI_FMT_MSB | SPI_FMT_HDR_1, @@ -952,7 +952,7 @@ usrp_eeprom_write (libusb_device_handle *udh, int i2c_addr, { unsigned char cmd[2]; const unsigned char *p = (unsigned char *) buf; - + // The simplest thing that could possibly work: // all writes are single byte writes. // @@ -967,7 +967,7 @@ usrp_eeprom_write (libusb_device_handle *udh, int i2c_addr, if (!r) return false; } - + return true; } @@ -994,14 +994,14 @@ usrp_eeprom_read (libusb_device_handle *udh, int i2c_addr, } return true; } - + // ---------------------------------------------------------------- static bool slot_to_codec (int slot, int *which_codec) { *which_codec = 0; - + switch (slot){ case SLOT_TX_A: case SLOT_RX_A: @@ -1038,7 +1038,7 @@ usrp_write_aux_dac (libusb_device_handle *udh, int slot, int which_dac, int value) { int which_codec; - + if (!slot_to_codec (slot, &which_codec)) return false; @@ -1048,7 +1048,7 @@ usrp_write_aux_dac (libusb_device_handle *udh, int slot, } value &= 0x0fff; // mask to 12-bits - + if (which_dac == 3){ // dac 3 is really 12-bits. Use value as is. bool r = true; @@ -1057,7 +1057,7 @@ usrp_write_aux_dac (libusb_device_handle *udh, int slot, return r; } else { - // dac 0, 1, and 2 are really 8 bits. + // dac 0, 1, and 2 are really 8 bits. value = value >> 4; // shift value appropriately return usrp_9862_write (udh, which_codec, 36 + which_dac, value); } @@ -1084,7 +1084,7 @@ usrp_read_aux_adc (libusb_device_handle *udh, int slot, | AUX_ADC_CTRL_REFSEL_B; // on chip reference int rd_reg = 26; // base address of two regs to read for result - + // program the ADC mux bits if (tx_slot_p (slot)) aux_adc_control |= AUX_ADC_CTRL_SELECT_A2 | AUX_ADC_CTRL_SELECT_B2; @@ -1092,7 +1092,7 @@ usrp_read_aux_adc (libusb_device_handle *udh, int slot, rd_reg += 2; aux_adc_control |= AUX_ADC_CTRL_SELECT_A1 | AUX_ADC_CTRL_SELECT_B1; } - + // I'm not sure if we can set the mux and issue a start conversion // in the same cycle, so let's do them one at a time. @@ -1116,7 +1116,7 @@ usrp_read_aux_adc (libusb_device_handle *udh, int slot, if (r) *value = ((v_hi << 2) | ((v_lo >> 6) & 0x3)) << 2; // format as 12-bit - + return r; } diff --git a/usrp/host/lib/usrp_prims_libusb0.cc b/usrp/host/lib/usrp_prims_libusb0.cc index 23d278fe8..7a82eabfa 100644 --- a/usrp/host/lib/usrp_prims_libusb0.cc +++ b/usrp/host/lib/usrp_prims_libusb0.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2003,2004,2006,2009 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -109,7 +109,7 @@ usrp_find_device (int nth, bool fx2_ok_p, libusb_context *ctx) int n_found = 0; usrp_one_time_init (); - + p = usb_get_busses(); while (p != NULL){ q = p->devices; @@ -147,7 +147,7 @@ usrp_open_interface (struct usb_device *dev, int interface, int altinterface) // Appears to be required for libusb-win32 and Cygwin -- dew 09/20/06 if (usb_set_configuration (udh, 1) < 0){ /* - * Ignore this error. + * Ignore this error. * * Seems that something changed in drivers/usb/core/devio.c:proc_setconfig such that * it returns -EBUSY if _any_ of the interfaces of a device are open. diff --git a/usrp/host/lib/usrp_prims_libusb1.cc b/usrp/host/lib/usrp_prims_libusb1.cc index 0b514e97f..cf1f8fe07 100644 --- a/usrp/host/lib/usrp_prims_libusb1.cc +++ b/usrp/host/lib/usrp_prims_libusb1.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* * Copyright 2003,2004,2006,2009 Free Software Foundation, Inc. - * + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, diff --git a/usrp/host/lib/usrp_primsi.h b/usrp/host/lib/usrp_primsi.h index 83cc31aee..b1cf7263a 100644 --- a/usrp/host/lib/usrp_primsi.h +++ b/usrp/host/lib/usrp_primsi.h @@ -1,19 +1,19 @@ /* -*- c++ -*- */ /* - * Copyright 2003 Free Software Foundation, Inc. - * + * Copyright 2003,2009 Free Software Foundation, Inc. + * * This file is part of GNU Radio - * + * * GNU Radio 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, or (at your option) * any later version. - * + * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, @@ -30,7 +30,7 @@ #include "usrp/usrp_prims.h" /* - * Internal functions + * Internal functions */ libusb_device_handle * @@ -40,7 +40,7 @@ int write_cmd (libusb_device_handle *udh, int request, int value, int index, unsigned char *bytes, int len); /* - * Compatibility functions + * Compatibility functions */ libusb_device *_get_usb_device (libusb_device_handle *udh); |