Commit graph

32 commits

Author SHA1 Message Date
Jon Szymaniak
9015bdbb5c libbladeRF, bladeRF-flash: Added device identifier info matching to API routines
Initializing, extracting, and comparing device identifier information
(struct bladerf_devinfo) is now exposed through the API. Among other
things, this allow users to check if a device specifier string matches a
device they already have a handle for.

To support this, a copy of bladerf_devinfo information is now kept around in
the device handle; backends are responsible for populating this in their
open() implementation. A couple of the fields were already present, so
this only adds a couple small variables worth of overhead.

Some re-arranging of the linux and libusb probe and open calls has been done
to achieve this. A few warnings and bugs were addressed in this process:

  - The Linux backend was attempting to fill in a serial number via
    a cached entry.

  - There was some potential for a read of an uninitialized portion
    of an otp buffer.

  - Missing serial # has been made non-fatal. (Some developers'
    device do not have serial numbers.)

Files associated with this functionality was moved from host/common
back into the library, which should now be used instead. bladeRF-flash
has been updated to use these new API functions.
2013-09-18 23:15:48 -04:00
Keith Rothman
d36f91cb7d Initial JUMP_TO_BOOTLOADER support
- Added method to libbladeRF
 - Added new VID/PID pair to udev rule to prevent requiring root access
 - Added jump_to_boot bladeRF-cli command
 - Fixed most warnings in FX3 firmware
2013-09-15 05:32:04 +00:00
Keith Rothman
1c4fa232eb [libbladeRF/bladeRF-cli] Added support booting directly from the FX3 bootloader 2013-09-15 05:31:57 +00:00
Keith Rothman
ee37214898 [libbladeRF] Exposed erase/read/write functions 2013-09-15 04:59:03 +00:00
Jon Szymaniak
354625e809 libbladeRF: Clarified a few items in the header documentation. 2013-09-14 18:02:27 -04:00
Jon Szymaniak
ce2367c562 libbladeRF: Cleaned up a few minor Doxygen warnings 2013-09-14 17:39:43 -04:00
Jon Szymaniak
6819369b61 libbladeRF: bladerf_load_fpga no longer checks current FPGA status
This check was only being used to print an informational message.
However, it was supposed to be used to change the return value to
indicate the FPGA being re-loaded versus loaded.

Because the caller can check the FPGA state via
bladerf_is_fpga_configured(), this check has been pulled out, and the
interface now specifies that this functions return value only indicates
success (0) or failure (error code).
2013-09-14 17:14:47 -04:00
Brian Padalino
46eacaa462 libbladeRF: si5338 refactored to support fractional sample rates. 2013-09-14 16:52:59 -04:00
Jon Szymaniak
2dcae9eeb2 libbladeRF & common: Renamed logging routines to address conflicts
The common logging functions have been renamed in order to not
conflict with the library's bladerf_log_set_verbosity().
2013-09-11 00:29:14 -04:00
Adam Greig
38273dcd8a libbladeRF: Add bladerf_set/get_lpf_mode
Add functions to bypass and disable the LPF and check whether it is currently
bypassed or disabled.
2013-09-09 03:55:03 +01:00
Jon Szymaniak
56693c0675 libbladeRF: Changed bladerf_stream parameters, refactored stream init
Parameters have been removed from the bladerf_stream() call, because
these parameters would already have been associated with the provided
stream via the bladerf_init_stream() call.

A backend stream_init() has been added, and libusb transfer
initialization has been moved into the implementation of this
backend-specific function.  This is required to ensure that
bladerf_deinit() stream can be called directly after
bladerf_init_stream(), without a call to bladerf_stream().  Such
a use case might occur if an error was detected before kicking off the
stream.
2013-09-05 00:06:14 -04:00
Jon Szymaniak
985a8a4548 libbladeRF: Added API_EXPORT for API routines. 2013-09-03 00:02:58 -04:00
Frank Jenner
3655b3d516 Added variable-level logging mechanism
Added a mechanism to log messages with different priority levels, and to
filter which messages are output by setting a threshold level. The
function to set the current log level/verbosity is exposed through
libbladeRF.h, while the logging function/macros themselves are private
to this project, and are present in log.c/log.h. Callers should use the
convenience macros bladerf_log_[level]() to issue their log messages.
These macros piece together a format string that contains the message
priority and, for warning and higher priorities, the function and line
number on which the message was logged. Also, warning level and higher
level messages are output to stderr, rather than stdout.
2013-09-02 15:39:41 -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
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
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
e5b8f42279 Fixed misc. (nonfunctional) typos 2013-08-26 20:06:46 -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
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
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
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
c1de666afb libbladeRF: Touched up note about LOW_LEVEL routines. 2013-08-22 22:37:04 -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
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
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
Brian Padalino
f349d209eb libbladeRF: [WIP] Fixed streams for both TX and RX.
Using libusb for streams of both TX and RX.  The example
tx_async test is now for both and wil save off samples
in CSV to a file.  The code still needs to be audited
before it can be brought down to the mainline.
2013-08-18 23:58:42 -04:00
Brian Padalino
5fc3284e2c libbladeRF: [WIP] Zero copy TX async interface. 2013-08-18 20:15:54 -04:00
Jon Szymaniak
456efcbd90 libbladeRF: [WIP] Updated a few fields.
Does not compile.
2013-08-18 16:30:05 -04:00
Brian Padalino
b926523b17 libbladeRF: [WIP] Updating test program. 2013-08-18 14:03:25 -04:00
Jon Szymaniak
29cabea762 libbladeRF: [WIP] Starting to re-work today's design. 2013-08-17 23:27:56 -04:00
Jon Szymaniak
bd4408a6e3 libbladeRF: [WIP] In the process of adding and testing tx stream.
Additionally authored by bpadalino.
This functionality is currently not working.
2013-08-16 23:56:28 -04:00
Jon Szymaniak
df05b174ec libbladeRF & bladeRF-CLI: Fixed build issues. Moved backend config info.
From henceforth, all backend selection should live in the
backend_config.h.in file, so backend.c or backend.h doesn't get muddied
with #ifdef's.
2013-08-13 23:44:42 -04:00
Renamed from host/libraries/include/libbladeRF.h (Browse further)