summaryrefslogtreecommitdiff
path: root/usrp/host/swig
diff options
context:
space:
mode:
Diffstat (limited to 'usrp/host/swig')
-rw-r--r--usrp/host/swig/.gitignore16
-rw-r--r--usrp/host/swig/Makefile.am56
-rw-r--r--usrp/host/swig/Makefile.swig.gen145
-rw-r--r--usrp/host/swig/__init__.py1
-rw-r--r--usrp/host/swig/usrp_fpga_regs.py30
-rw-r--r--usrp/host/swig/usrp_prims.i265
-rw-r--r--usrp/host/swig/util.py95
7 files changed, 0 insertions, 608 deletions
diff --git a/usrp/host/swig/.gitignore b/usrp/host/swig/.gitignore
deleted file mode 100644
index 9897dac41f..0000000000
--- a/usrp/host/swig/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-/Makefile
-/Makefile.in
-/.la
-/.lo
-/.deps
-/.libs
-/*.la
-/*.lo
-/usrp_prims.cc
-/usrp_prims.py
-/usrp_prims.scm
-/prims.cc
-/prims.py
-/gnuradio
-/guile
-/python
diff --git a/usrp/host/swig/Makefile.am b/usrp/host/swig/Makefile.am
deleted file mode 100644
index 5baeff4cbe..0000000000
--- a/usrp/host/swig/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# Copyright 2001,2003,2004,2006,2007,2008,2009,2010 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,
-# Boston, MA 02110-1301, USA.
-#
-
-include $(top_srcdir)/Makefile.common
-include $(top_srcdir)/Makefile.swig
-
-AM_CPPFLAGS = \
- $(USRP_INCLUDES) \
- -I$(srcdir) \
- $(PYTHON_CPPFLAGS) \
- $(USB_INCLUDES) \
- $(WITH_INCLUDES)
-
-#################################
-# SWIG interface and library
-
-TOP_SWIG_IFILES = \
- usrp_prims.i
-
-# Install so that they end up available as:
-# import usrpm.usrp_prims
-# This ends up at:
-# ${prefix}/lib/python${python_version}/site-packages/usrpm
-usrp_prims_pythondir_category = \
- usrpm
-
-# additional arguments to the SWIG command
-usrp_prims_swig_args = \
- $(USRP_INCLUDES)
-
-# additional libraries for linking with the SWIG-generated library
-usrp_prims_la_swig_libadd = \
- $(USRP_LA)
-
-# additional Python files to be installed along with the SWIG-generated one
-usrp_prims_python = \
- __init__.py \
- usrp_fpga_regs.py
diff --git a/usrp/host/swig/Makefile.swig.gen b/usrp/host/swig/Makefile.swig.gen
deleted file mode 100644
index b772e97da2..0000000000
--- a/usrp/host/swig/Makefile.swig.gen
+++ /dev/null
@@ -1,145 +0,0 @@
-# -*- Makefile -*-
-#
-# Copyright 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,
-# Boston, MA 02110-1301, USA.
-#
-
-# Makefile.swig.gen for usrp_prims.i
-
-## Default install locations for these files:
-##
-## Default location for the Python directory is:
-## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp_prims
-## Default location for the Python exec directory is:
-## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp_prims
-##
-## The following can be overloaded to change the install location, but
-## this has to be done in the including Makefile.am -before-
-## Makefile.swig is included.
-
-usrp_prims_pythondir_category ?= gnuradio/usrp_prims
-usrp_prims_pylibdir_category ?= $(usrp_prims_pythondir_category)
-usrp_prims_pythondir = $(pythondir)/$(usrp_prims_pythondir_category)
-usrp_prims_pylibdir = $(pyexecdir)/$(usrp_prims_pylibdir_category)
-
-# The .so libraries for the guile modules get installed whereever guile
-# is installed, usually /usr/lib/guile/gnuradio/
-# FIXME: determince whether these should be installed with gnuradio.
-usrp_prims_scmlibdir = $(libdir)
-
-# The scm files for the guile modules get installed where ever guile
-# is installed, usually /usr/share/guile/site/usrp_prims
-# FIXME: determince whether these should be installed with gnuradio.
-usrp_prims_scmdir = $(guiledir)
-
-## SWIG headers are always installed into the same directory.
-
-usrp_prims_swigincludedir = $(swigincludedir)
-
-## This is a template file for a "generated" Makefile addition (in
-## this case, "Makefile.swig.gen"). By including the top-level
-## Makefile.swig, this file will be used to generate the SWIG
-## dependencies. Assign the variable TOP_SWIG_FILES to be the list of
-## SWIG .i files to generated wrappings for; there can be more than 1
-## so long as the names are unique (no sorting is done on the
-## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i
-## file will generate .cc, .py, and possibly .h files -- meaning that
-## all of these files will have the same base name (that provided for
-## the SWIG .i file).
-##
-## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
-## right thing. For more info, see <
-## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
-
-## Other cleaned files: dependency files generated by SWIG or this Makefile
-
-MOSTLYCLEANFILES += $(DEPDIR)/*.S*
-
-## Various SWIG variables. These can be overloaded in the including
-## Makefile.am by setting the variable value there, then including
-## Makefile.swig .
-
-usrp_prims_swiginclude_HEADERS = \
- usrp_prims.i \
- $(usrp_prims_swiginclude_headers)
-
-if PYTHON
-usrp_prims_pylib_LTLIBRARIES = \
- _usrp_prims.la
-
-_usrp_prims_la_SOURCES = \
- python/usrp_prims.cc \
- $(usrp_prims_la_swig_sources)
-
-usrp_prims_python_PYTHON = \
- usrp_prims.py \
- $(usrp_prims_python)
-
-_usrp_prims_la_LIBADD = \
- $(STD_SWIG_LA_LIB_ADD) \
- $(usrp_prims_la_swig_libadd)
-
-_usrp_prims_la_LDFLAGS = \
- $(STD_SWIG_LA_LD_FLAGS) \
- $(usrp_prims_la_swig_ldflags)
-
-_usrp_prims_la_CXXFLAGS = \
- $(STD_SWIG_CXX_FLAGS) \
- -I$(top_builddir) \
- $(usrp_prims_la_swig_cxxflags)
-
-python/usrp_prims.cc: usrp_prims.py
-usrp_prims.py: usrp_prims.i
-
-# Include the python dependencies for this file
--include python/usrp_prims.d
-
-endif # end of if python
-
-if GUILE
-
-usrp_prims_scmlib_LTLIBRARIES = \
- libguile-gnuradio-usrp_prims.la
-libguile_gnuradio_usrp_prims_la_SOURCES = \
- guile/usrp_prims.cc \
- $(usrp_prims_la_swig_sources)
-nobase_usrp_prims_scm_DATA = \
- gnuradio/usrp_prims.scm \
- gnuradio/usrp_prims-primitive.scm
-libguile_gnuradio_usrp_prims_la_LIBADD = \
- $(STD_SWIG_LA_LIB_ADD) \
- $(usrp_prims_la_swig_libadd)
-libguile_gnuradio_usrp_prims_la_LDFLAGS = \
- $(STD_SWIG_LA_LD_FLAGS) \
- $(usrp_prims_la_swig_ldflags)
-libguile_gnuradio_usrp_prims_la_CXXFLAGS = \
- $(STD_SWIG_CXX_FLAGS) \
- -I$(top_builddir) \
- $(usrp_prims_la_swig_cxxflags)
-
-guile/usrp_prims.cc: gnuradio/usrp_prims.scm
-gnuradio/usrp_prims.scm: usrp_prims.i
-gnuradio/usrp_prims-primitive.scm: gnuradio/usrp_prims.scm
-
-# Include the guile dependencies for this file
--include guile/usrp_prims.d
-
-endif # end of GUILE
-
-
diff --git a/usrp/host/swig/__init__.py b/usrp/host/swig/__init__.py
deleted file mode 100644
index a4917cf64c..0000000000
--- a/usrp/host/swig/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-# make this a package
diff --git a/usrp/host/swig/usrp_fpga_regs.py b/usrp/host/swig/usrp_fpga_regs.py
deleted file mode 100644
index b116d7b7a7..0000000000
--- a/usrp/host/swig/usrp_fpga_regs.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright 2005 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,
-# Boston, MA 02110-1301, USA.
-#
-
-from usrpm import usrp_prims
-
-# Copy everything that starts with FR_ or bmFR_ from the usrp_prims
-# name space into our name space. This is effectively a python binding for
-# the contents of firmware/include/fpga_regs_common.h and fpga_regs_standard.h
-
-for name in dir(usrp_prims):
- if name.startswith("FR_") or name.startswith("bmFR_"):
- globals()[name] = usrp_prims.__dict__[name]
diff --git a/usrp/host/swig/usrp_prims.i b/usrp/host/swig/usrp_prims.i
deleted file mode 100644
index a58f8aacf9..0000000000
--- a/usrp/host/swig/usrp_prims.i
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2003,2004,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,
- * Boston, MA 02110-1301, USA.
- */
-
-/*
- * Low level primitives for directly messing with USRP hardware.
- *
- * If you're trying to use the USRP, you'll probably want to take a
- * look at the usrp_standard_rx and usrp_standard_tx classes. They
- * hide a bunch of low level details and provide high performance
- * streaming i/o.
- *
- * This interface is built on top of libusb, which allegedly works under
- * Linux, *BSD and Mac OS/X. http://libusb.sourceforge.net
- */
-
-%include <stl.i> // pick up string stuff
-
-
-%{
-#include <usrp/usrp_prims.h>
-#include <stddef.h> // ptrdiff_t
-%}
-
-
-enum usrp_load_status_t { ULS_ERROR = 0, ULS_OK, ULS_ALREADY_LOADED };
-
-
-/*!
- * \brief initialize libusb; probe busses and devices.
- * Safe to call more than once.
- */
-void usrp_one_time_init (libusb_context **ctx = NULL);
-
-void usrp_rescan ();
-
-/*!
- * \brief locate Nth (zero based) USRP device in system.
- * Return pointer or 0 if not found.
- *
- * The following kinds of devices are considered USRPs:
- *
- * unconfigured USRP (no firwmare loaded)
- * configured USRP (firmware loaded)
- * unconfigured Cypress FX2 (only if fx2_ok_p is true)
- */
-libusb_device *usrp_find_device (int nth, bool fx2_ok_p = false, libusb_context *ctx = NULL);
-
-bool usrp_usrp_p (libusb_device *q); //< is this a USRP
-bool usrp_usrp0_p (libusb_device *q); //< is this a USRP Rev 0
-bool usrp_usrp1_p (libusb_device *q); //< is this a USRP Rev 1
-bool usrp_usrp2_p (libusb_device *q); //< is this a USRP Rev 2
-int usrp_hw_rev (libusb_device *q); //< return h/w rev code
-bool usrp_fx2_p (libusb_device *q); //< is this an unconfigured Cypress FX2
-
-bool usrp_unconfigured_usrp_p (libusb_device *q); //< some kind of unconfigured USRP
-bool usrp_configured_usrp_p (libusb_device *q); //< some kind of configured USRP
-
-/*!
- * \brief given a libusb_device return an instance of the appropriate libusb_device_handle
- *
- * These routines claim the specified interface and select the
- * correct alternate interface. (USB nomenclature is totally screwed!)
- *
- * If interface can't be opened, or is already claimed by some other
- * process, 0 is returned.
- */
-libusb_device_handle *usrp_open_cmd_interface (libusb_device *dev);
-libusb_device_handle *usrp_open_rx_interface (libusb_device *dev);
-libusb_device_handle *usrp_open_tx_interface (libusb_device *dev);
-
-/*!
- * \brief close interface.
- */
-bool usrp_close_interface (libusb_device_handle *udh);
-
-/*!
- * \brief load intel hex format file into USRP/Cypress FX2 (8051).
- *
- * The filename extension is typically *.ihx
- *
- * Note that loading firmware may cause the device to renumerate. I.e.,
- * change its configuration, invalidating the current device handle.
- */
-
-usrp_load_status_t
-usrp_load_firmware (libusb_device_handle *udh, const char *filename, bool force);
-
-/*!
- * \brief load intel hex format file into USRP FX2 (8051).
- *
- * The filename extension is typically *.ihx
- *
- * Note that loading firmware may cause the device to renumerate. I.e.,
- * change its configuration, invalidating the current device handle.
- * If the result is ULS_OK, usrp_load_firmware_nth delays 1 second
- * then rescans the busses and devices.
- */
-usrp_load_status_t
-usrp_load_firmware_nth (int nth, const char *filename, bool force, libusb_context *ctx = NULL);
-
-/*!
- * \brief load fpga configuration bitstream
- */
-usrp_load_status_t
-usrp_load_fpga (libusb_device_handle *udh, const char *filename, bool force);
-
-/*!
- * \brief load the regular firmware and fpga bitstream in the Nth USRP.
- *
- * This is the normal starting point...
- */
-bool usrp_load_standard_bits (int nth, bool force);
-
-
-%include <fpga_regs_common.h>
-%include <fpga_regs_standard.h>
-
-
-bool usrp_write_fpga_reg (libusb_device_handle *udh, int reg, int value);
-
-%inline %{
-
-int
-usrp_read_fpga_reg (libusb_device_handle *udh, int reg)
-{
- int value;
- bool ok = usrp_read_fpga_reg (udh, reg, &value);
- if (ok)
- return value;
- else
- return -999;
-}
-
-%}
-
-bool usrp_set_fpga_reset (libusb_device_handle *udh, bool on);
-bool usrp_set_fpga_tx_enable (libusb_device_handle *udh, bool on);
-bool usrp_set_fpga_rx_enable (libusb_device_handle *udh, bool on);
-bool usrp_set_fpga_tx_reset (libusb_device_handle *udh, bool on);
-bool usrp_set_fpga_rx_reset (libusb_device_handle *udh, bool on);
-bool usrp_set_led (libusb_device_handle *udh, int which, bool on);
-
-bool usrp_check_rx_overrun (libusb_device_handle *udh, bool *overrun_p);
-bool usrp_check_tx_underrun (libusb_device_handle *udh, bool *underrun_p);
-
-// i2c_read and i2c_write are limited to a maximum len of 64 bytes.
-
-bool usrp_i2c_write (libusb_device_handle *udh, int i2c_addr,
- void *buf, int len);
-
-bool usrp_i2c_read (libusb_device_handle *udh, int i2c_addr,
- void *buf, int len);
-
-// spi_read and spi_write are limited to a maximum of 64 bytes
-// See usrp_spi_defs.h for more info
-
-bool usrp_spi_write (libusb_device_handle *udh,
- int optional_header, int enables, int format,
- unsigned char *buf, int len);
-
-bool usrp_spi_read (libusb_device_handle *udh,
- int optional_header, int enables, int format,
- unsigned char *buf, int len);
-
-
-bool usrp_9862_write (libusb_device_handle *udh,
- int which_codec, // [0, 1]
- int regno, // [0, 63]
- int value); // [0, 255]
-
-%inline %{
-
-int
-usrp_9862_read (libusb_device_handle *udh, int which_codec, int reg)
-{
- unsigned char value;
- bool ok = usrp_9862_read (udh, which_codec, reg, &value);
- if (ok)
- return value;
- else
- return -999;
-}
-
-%}
-
-%inline %{
-
-bool
-usrp_eeprom_write (libusb_device_handle *udh, int i2c_addr,
- int eeprom_offset, const std::string buf)
-{
- return usrp_eeprom_write (udh, i2c_addr, eeprom_offset,
- buf.data (), buf.size ());
-}
-
-std::string
-usrp_eeprom_read (libusb_device_handle *udh, int i2c_addr,
- int eeprom_offset, int len)
-{
- if (len <= 0)
- return "";
-
- char buf[len];
-
- if (!usrp_eeprom_read (udh, i2c_addr, eeprom_offset, buf, len))
- return "";
-
- return std::string (buf, len);
-}
-
-%}
-
-bool usrp_write_aux_dac (libusb_device_handle *uhd, int slot,
- int which_dac, int value);
-
-%inline %{
-
-int usrp_read_aux_adc (libusb_device_handle *udh, int slot, int which_adc)
-{
- int value;
- bool ok = usrp_read_aux_adc (udh, slot, which_adc, &value);
- if (ok)
- return value;
- else
- return -999;
-}
-
-%}
-
-/*!
- * \brief return a usrp's serial number.
- *
- * Note that this only works on a configured usrp.
- * \returns non-zero length string iff successful.
- */
-std::string usrp_serial_number(libusb_device_handle *udh);
-
-/*!
- * \brief usrp daughterboard id to name mapping
- */
-const std::string usrp_dbid_to_string (int dbid);
-
-%inline %{
-#include "../../firmware/include/fpga_regs_common.h"
-#include "../../firmware/include/fpga_regs_standard.h"
-%}
diff --git a/usrp/host/swig/util.py b/usrp/host/swig/util.py
deleted file mode 100644
index 089bcaaac2..0000000000
--- a/usrp/host/swig/util.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# utilities
-
-from usrp_prims import *
-
-def setup (which_board = 0):
- if not usrp_load_standard_bits (which_board, False):
- raise RuntimeError, "usrp_load_standard_bits"
- dev = usrp_find_device (which_board)
- if not dev:
- raise RuntimeError, "usrp_find_device"
- u = usrp_open_cmd_interface (dev)
- if not u:
- raise RuntimeError, "usrp_open_cmd_interface"
-
- # FIXME setup high speed paths, Aux ADC Clock, ...
-
- # usrp_9862_write (u, 0, 35, 0x1) # aux ADC clock = CLK/4
- # usrp_9862_write (u, 1, 35, 0x1)
-
- return u
-
-def write_slot_oe (u, slot, value, mask):
- assert 0 <= slot and slot < 4
- return usrp_write_fpga_reg (u, slot + FR_OE_0,
- ((mask & 0xffff) << 16) | (value & 0xffff))
-
-def write_slot_io (u, slot, value, mask):
- assert 0 <= slot and slot < 4
- return usrp_write_fpga_reg (u, slot + FR_IO_0,
- ((mask & 0xffff) << 16) | (value & 0xffff))
-
-
-# ----------------------------------------------------------------
-
-
-def ramp_aux_dac (u, which_codec, which_dac):
- if not (which_codec == 0 or which_codec == 1):
- raise AssertionError
- if not (which_dac >= 0 and which_dac < 4):
- raise AssertionError
- try:
- if which_dac == 3: # sigma delta output
- sigma_delta_loop (u, which_codec)
- else:
- aux_dac_loop (u, which_codec, which_dac)
- except KeyboardInterrupt:
- return
-
-def sigma_delta_loop (u, which_codec):
- counter = 0
- while True:
- usrp_9862_write (u, which_codec, 43, counter >> 4)
- usrp_9862_write (u, which_codec, 42, (counter & 0xf) << 4)
- # counter += 1 FIXME
- counter += 4
- if counter > 0xfff:
- counter = 0
-
-def aux_dac_loop (u, which_codec, which_dac):
- reg = 36 + which_dac # Aux DAC A,B,C
- counter = 0
- while True:
- usrp_9862_write (u, which_codec, reg, counter)
- counter += 1
- if counter > 0xff:
- counter = 0
-
-
-def read_aux_adc_loop (u, slot, which_adc):
- while True:
- v = usrp_read_aux_adc (u, slot, which_adc)
- print "%3d %5.3f" % (v, v * 3.3 / 1024)
-
-def ramp_io_port (u, slot):
- counter = 0
- try:
- while True:
- write_slot_io (u, slot, counter, 0xffff)
- counter += 1
- if counter > 0xffff:
- counter = 0
- except KeyboardInterrupt:
- return
-
-def walk_io_port (u, slot):
- bit = 1
- try:
- while True:
- write_slot_io (u, slot, bit, 0xffff)
- bit = (bit << 1) & 0xffff
- if bit == 0:
- bit = 1
- except KeyboardInterrupt:
- return
-