Commit graph

59 commits

Author SHA1 Message Date
Brian Padalino
62956eb580 libbladeRF: Updated calibration routine.
Also updated the calibration routine in the CLI.  The CLI might need rethinking since, for the calibration to be successful, the module must be enabled.  Currently unless we're actively transmitting or receiving, the module is disabled.

Need to add a way to figure out if the module is enabled before trying to calibrate it.
2013-09-02 13:54:53 -04:00
Jon Szymaniak
eea73dda67 libbladeRF: Use _completed variant of libusb event handler call. 2013-09-02 12:09:48 -04:00
Brian Padalino
826b5888fe libbladeRF: First stab at DC offset calibration.
Some users have shown large DC offsets.  I've seen these offsets
initially but they become much more reasonable after the first
few sample buffers come out of the FPGA.

Currently DC offset appears to be +/-30 or so after running
the calibration.

In the cli, run 'cal' to run through all modules of calibration.
2013-09-01 15:57:15 -04:00
Brian Padalino
5f3827919b libbladeRF: Use sector_to_erase instead of 'i'
sector_to_erase is more clear than just erasing 'i'.  Also gets rid of a warning of an unused variable.
2013-08-31 16:55:19 -04:00
Jon Szymaniak
4f5f715bd1 libbladeRF: Fixed bad FPGA identification (Issue #68)
Thank you, jmichelp, for tracking this down!
2013-08-31 13:19:58 -04:00
Damiano at Engidea
d9b0a8cac8 removed dependency for double, merged port handling structures, cleared up to implement the rationale setter/getter
Signed-off-by: Jon Szymaniak <jon.szymaniak@gmail.com>
2013-08-30 02:24:23 -04:00
Jon Szymaniak
e337d8cc4f libbladeRF: Reverting f34fbf6577 2013-08-29 22:26:20 -04:00
Jon Szymaniak
f34fbf6577 libbladeRF: Fixed return value in libusb backend's change_setting()
This routine was returning a libusb error code, not a libbladeRF code.
2013-08-29 22:15:57 -04:00
Brian Padalino
4d8312b59b libbladeRF: Add API to change the ADC sampling location.
The ADC can be configured to sample from the internal inputs
or from the external pins.  Adding the API to change the sampling
between internal and external.  Also using the appropriate API
function for the CLI.
2013-08-28 23:48:53 -04:00
Brian Padalino
4ce532b674 libbladeRF: Re-enable transmit and receive.
Call the vendor commands to get RX and TX flowing, like at the
end of the FPGA programming routine.
2013-08-28 20:12:43 -04:00
Brian Padalino
4c79f4be5f libbladeRF: Cleanup on the updated si5338 code. 2013-08-27 20:36:06 -04:00
Nuand
23bc3de51c Merge pull request #63 from Engidea/master
cleaning up for better code, cosmetic
2013-08-27 17:28:05 -07:00
Brian Padalino
e0b91de2f2 Some minor printing fixups. 2013-08-27 20:23:12 -04:00
Brian Padalino
f96bef205b Don't freak out if the calibration information is not there. 2013-08-27 20:05:57 -04:00
Damiano @ Engidea
b6adbd7929 cleaning up for better code, cosmetic 2013-08-27 21:42:18 +02:00
Damiano @ Engidea
b18de71697 Merge branch 'master' of https://github.com/Nuand/bladeRF 2013-08-27 09:07:18 +02:00
Robert Ghilduta
73b743ef8e libbladeRF: correct slight pointer arithmetic
ptr should be incremented by read_size (a constant value of either 64 or 256
bytes) not n_read, the total amount of bytes read so far.
2013-08-26 23:01:26 -07:00
Jon Szymaniak
c64e8dc503 libbladeRF: Renamed a few internal routines more appropriately 2013-08-27 00:41:26 -04:00
Jon Szymaniak
bc24723c92 libbladeRF: Macro name & usage typo fix
Does not introduce a functional change.
2013-08-27 00:31:45 -04:00
Jon Szymaniak
b82952687e libbladeRF: Cleaned up a few items and issues in OTP/cal readback.
This addresses some invalid accesses reported by valgrind. However, a few issues remain:
  - Accessing calibration data on a 2.0 port causes an invalid access
  - The libusb backend's implemation of open() will need to be
  refactored in order to support matching on serial numbers.
2013-08-27 00:07:13 -04:00
Jon Szymaniak
1fb34a2441 Removed vim swap file that snuck in. Updated .gitignore to exlude these. 2013-08-26 21:02:59 -04:00
Jon Szymaniak
76eaed00a3 libbladeRF: Moved null pointer check (assert()) before dereference 2013-08-26 19:53:26 -04:00
Damiano @ Engidea
6a98dcd1be acquire samplerate frequency from si5338 registers using integer arithmetic, also use the standard debug mechanism 2013-08-26 19:02:05 +02:00
Marco Schwan
9e9cfe39aa Remove the warning for a implicitly declaring of the function printf 2013-08-26 11:52:07 +02:00
Brian Padalino
b2c3d06f62 libbladeRF: Updates to work with OSX. 2013-08-26 00:14:44 -04:00
Robert Ghilduta
10ffba1b39 Add device reset functionality
This commit adds the much needed device reset functionality that allows the
device to reset after an upgrade and start running the new firmware.
2013-08-25 18:21:07 -07:00
Robert Ghilduta
a728e88991 libbladeRF: add legacy mode support for devices running <v1.1
Lagecay mode support allows libbladeRF to upgrade and downgrade the firmware to
and from any version. All other features such as streaming samples, and talking
to any of the on-board devices will not work; the user has to upgrade the
firmware to the latest version before anything else can be done. The command
line now prints a message when legacy mode is enabled, and asks the user to
upgrade to the latest version.
2013-08-25 18:21:07 -07:00
Robert Ghilduta
1b4b3acf1c libbladeRF: switch to RFLink mode if FPGA is programmed
This commit was introduced because the change over to using USB alternate
settings causes the libusb to change the device to its first alt-interface when
it is released. This basically means that as soon as the command line is closed
the device goes back to alt-interface 0. This commit figures out when this
happens and manually goes back to RFLink mode, alt-interface #1.
2013-08-25 18:21:07 -07:00
Robert Ghilduta
33957f17c1 libbladeRF: cache calibration and OTP data reads
This commit caches the caclibration and OTP data reads, and performs them when
the USB device is "open()"ed.
2013-08-25 18:21:01 -07:00
Robert Ghilduta
da7a0e16e8 libbladeRF: change to using alt_settings
This commit correctly changes the bladeRF's behavior by using mutually exclusive
alternate interface settings. Interfaces are not guaranteed to be exist one at a
time, thus they are unfit for use as an operating mode index.
2013-08-25 15:16:52 -07:00
Jon Szymaniak
b7c335a69a Merge branch 'dev-libusb_support' into bladerf
This merge introduces libusb-1.0 support into libbladeRF. This is now
preferred over the Linux driver backend for the time being, as it will
allow quicker ports to Windows and OSX. The Linux driver will be
significantly refactored and improved at a later time; it is not
recommended for use with this set of changes.

As of this commit, Windows and OSX builds are still works in progress.
Linux builds have been tested and verified.

** Important **
This branch also introduces CMake support, code base reorganization, and
significant API changes. Please review the updated API header (best viewed
via the Doxygen-generated html files.)

If you've been working out of the bladerf branch, it is recommended that
you clean up the following:

1. Uninstall Linux kernel module, if you have it loading at boot
2. Remove installed libbladeRF files (libbladeRF.h, pkg-config, files, .so's)
3. Remove installed CLI program
4. Remove udev rules

Please review the new "Getting started" text and the instructions in the
README.md and  host/README.md files for the new build procedure.

Manually resolved Conflicts:
	README.md
	host/drivers/linux/bladeRF.c
	host/utilities/bladeRF-cli/src/interactive/interactive.h
	linux/lib/src/bladerf.c
2013-08-25 13:53:13 -04:00
Jon Szymaniak
439e099b01 libbladeRF: Renamed configuration GPIO read/write functions
Renamed to avoid confusion with expansion board GPIO routines that
will be added in the future.
2013-08-25 12:27:25 -04:00
Jon Szymaniak
71641d1198 host: Fixed a handful of Windows build issues. May break Linux build. 2013-08-25 01:14:24 -04:00
Jon Szymaniak
0a5f853d47 host: Replaced designated (struct) initializers with FIELD_INIT
This is needed to work around msvc not supporting this functionality.
2013-08-24 17:44:25 -04:00
Jon Szymaniak
5cd490e515 libbladeRF: Fixed overzealous error message 2013-08-24 16:51:37 -04:00
Jon Szymaniak
792894c228 libbladeRF: [WIP] Changed API interfaces to use int instead of ssize_t.
This is intended to simplify some portability issues, since an int
type is sufficient in the few spots where we had ssize_t.

We'll need to still add a ssize_t wrapper around the Windows
[SSIZE_T](msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#SSIZE_T)
for use inside the library.
2013-08-23 01:44:13 -04:00
Jon Szymaniak
29a4ebb8ca libbladeRF: Check for invalide module value in bladerf_enable_module 2013-08-23 00:57:19 -04:00
Jon Szymaniak
2237314a4f host: First cut at portability issues with endianess macros.
This changeset includes changes suggested by maggo1404 in the
following pull request.

https://github.com/Nuand/bladeRF/pull/52

These suggestions were reworked a bit to avoid having #ifdef
blocks throughout the codebase and to alleviate the need to copy items
between utilitie and library code.
2013-08-23 00:25:14 -04:00
Jon Szymaniak
6a76a4817e libbladeRF: Updated header file and documentation for async changes
Added check that # transfers <= # buffers in bladerf_stream(),
as this is noted in the interface documentation.
2013-08-22 22:28:06 -04:00
Jon Szymaniak
d53423c671 host: Reorganized some common host code 2013-08-22 20:42:41 -04:00
Jon Szymaniak
894f0f48d6 Moved firmware-host common files. Fixed linux backend build.
Moved common -> firmware_common to avoid confusion with the upcoming
host/common directory.

API changes were  not incorporated into the linux backend in  changeset
8cc9f2a4b5 - this is addressed in this
changeset.
2013-08-22 19:56:03 -04:00
smagruder1
217409f270 Update libusb.c
Changing from "NULL to context" to fix bug presented upon execution of bladeRF-cli. Symptom: Segmentation Fault.
2013-08-22 01:19:13 -05:00
Jon Szymaniak
8cc9f2a4b5 libbladeRF: Cleaned up API enumerations and macro definitions.
The _t suffix on enums has been removed, as "_t" is reserved for
POSIX types.

To avoid naming collisions, macro definitions and enumeration values are
now prefixed with at least "BLADERF_".

Also in the mix is a stubbed out "unsupported" implementation of the
stream routines for the Linux driver backend.
2013-08-22 01:01:23 -04:00
Jon Szymaniak
27de30d0cf libbladeRF: Fixed incorrect variable assignment in async test program.
Also touched up some debug prints to aid in debugging an issue that
arises if buffers are not multiples of 4096 bytes. (FX3 DMA size?)
2013-08-21 22:46:16 -04:00
Jon Szymaniak
cb2e5bea50 libbladeRF: Fixed rx async issue where same buffer was being re-submitted 2013-08-21 22:10:59 -04:00
Jon Szymaniak
753aa3366f libbladeRF: Added LIBUSB_CALL to libusb callback. Cleaned up debug info. 2013-08-21 21:08:41 -04:00
Jon Szymaniak
32ec6d97ef libbladeRF: [WIP] Touched up error handling in libusb backend.
Added some memory allocation checks and attempts to tear down the
stream at the first sign of errors, avoiding submitting transfers
if intialization errors occurred. Also did some misc. error
code house keeping.

STREAM_ERROR has been removed. Use STREAM_SHUTTING_DOWN and the
bladerf_stream->error_code field to differentiate between a clean an
error-driven shutdown.

It appears that attempting to use the libusb backend before the FPGA is
loaded yields erroneous behavior when attempting to load the FPGA after
encountering a BLADERF_ERR_IO. (This situation requires a power on reset
of the board.) As such, an FPGA check has been added to the async test
program.
2013-08-20 00:11:22 -04:00
Jon Szymaniak
61daff905b libbladeRF: Rearranged a few items in libusb backend.
No functional changes. Added static qualifier to functions where
missing.
2013-08-19 22:08:49 -04:00
Jon Szymaniak
d49dffb633 libbladeRF: bladerf_stream() no longer enables/disabled modules.
The caller is responsible for enabling/disabling the module.
2013-08-19 18:56:25 -04:00
Jon Szymaniak
3f7b80a60c libbladeRF: [WIP] Minor warning and style cleanups. Removed "dead" code. 2013-08-19 18:48:32 -04:00