Commit graph

54 commits

Author SHA1 Message Date
Robert Ghilduta
8d9ed972ca fix HS buffering
This commit defines nios_gpio(7) as the GPIF buffer size control signal. The FX3
firmware makes the DMA engine operate on GPIF buffers that are twice the size of
the maximum sized URB. Since this is speed dependent, bladeRFs operating in HS
will have their GPIF DMA controllers only read 1024 bytes of data (512*2)
instead of 2048 (1024) as is expected when the device is in SS mode. To fix
this, the driver tells the library when a device is HS, the library then s the
nios_gpio bit that causes the FPGA to limit itself to only reading/writing to
the 32bit GPIF for 256 cycle at a time (instead of 512 cycles at SS).
2013-07-22 03:45:40 -07:00
Sylvain Munaut
718210ba9a lib/lms: Add a function to convert a lms_freq struct to frequency in Hz
... and use it.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-21 22:10:34 +02:00
Sylvain Munaut
f27f71c7f9 lib/lms: New VCOCAP search algorithm
Seems more resilient to errors than the previous one.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-21 13:38:20 +02:00
Sylvain Munaut
c658692e25 lib/lms: Clean up of the PLL parameters setting
Using 64 bit math is just way easier to read and
just as safe and precise.

Also cleanup random bits in that area

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-21 13:37:03 +02:00
Sylvain Munaut
ce22ce2611 lib: Avoid warning in lib when using lms_printf in 'if'
When you have something like:

if (bad_thing_happenned)
    lms_printf("Panic !");

defining lms_printf to nothing creates a warning.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-21 13:30:48 +02:00
Sylvain Munaut
65a9715666 lib: Fix band selection
There was two issues :
 - Swap between the RX/TX GPIOs controlling the switch
 - The proper LNA was not being selected inside the LMS

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-21 12:52:51 +02:00
Sylvain Munaut
1efc77b1f5 lib: Fix TXVGA2/RXVGA2, avoid casting (int*) to (uint8_t *)
Not everyone is little endian !

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-20 19:29:05 +02:00
Sylvain Munaut
3ca91833f9 lib: Fix RXVGA1 set/get to convert from dB to raw value
The formula used is a very crude quadratic approximation from the
3 data points given in the programming manual ... for something more
precise, we'd need a LUT. But it may vary with temp and device anyway.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2013-07-20 19:28:18 +02:00
Jon Szymaniak
4806ccdf52 lib: Added temporary workaround for not being able to read sample rate
Currently the sample rate is not read back from the si5338 and
reconstructed. For the time being, this value is cached in the the
device structure. However, this is a crappy workaround because this
value obviously won't persist, for example, upon
opening/closing/re-opening the CLI.
2013-07-18 09:10:48 -04:00
Brian Padalino
3cddc493cc linux: Fixed some typos an added some URLs. 2013-07-17 00:33:13 -04:00
Brian Padalino
a1477e6bae linux: README files updated. 2013-07-17 00:26:01 -04:00
Jon Szymaniak
a1bd7a2b22 libbladeRF: Fixed 'make install' target to copy symlinks correctly.
The copy previously was dereferencing symlinks, resulting in
copies of the library being installed. Asides from being terribly
undesirable, this also resulted in ldconfig warnings.
2013-07-16 23:06:24 -04:00
Brian Padalino
2aed383bc7 cli: Set frequency bounds checking.
lib: Add band selection when setting frequency.
2013-07-15 00:30:30 -04:00
Rob
24455aa55f hdl: driver: add subscripted VCTCXO read/write support
The VCTCXO DAC operations now have the same functionality as GPIO reads/writes.
The Nios core stores the least significant byte in a temporary variable and only
performs a write to the DAC when the most sigificant byte of the 16bit DAC value
is written to it by the host.

This commit does not address host endianness.
2013-07-07 18:35:04 -07:00
Rob
e892db1aaf hdl: driver: change GPIO register size to 32 bits
GPIO reads and writes can now 8 bits of the 32bit nios_gpio (GPIO register)
register at a time by subscripting into the register with the uart_cmd.addr
variable. addr 0 operates on the least significant byte, addr 1 operates on the
second least significant byte.
2013-07-07 18:20:45 -07:00
Jon Szymaniak
21e44fc710 libbladeRF: Fixed send/read_c16 size defect.
This defect was introduced in cf3ef1d0fa0bd67f487e5e1535067966ef91046
and results in truncated reads and writes.
2013-07-06 21:24:33 -04:00
Jon Szymaniak
6ff54e7399 libbladeRF: Updated doxygen comments to reflect send/read_c16 changes 2013-07-06 14:14:24 -07:00
Jon Szymaniak
ecf3ef1d0f libbladeRF: c16 send/read calls now retry when hit with EINTR.
GNU Radio appears to utilize some RT signals, which was causing
bladerf_read_c16 to fail out. These calls now retry so long
as the only error encountered is EINTR.

A last_errno field has been added to struct bladerf to assist
in debugging. We may want to either remove this or make it
(and its accesses/updates) conditionally compiled.
2013-07-06 14:14:22 -07:00
Brian Padalino
3e863eb9c2 cli: Fixed frequency division SIGFPE.
The value of x was being returned as 0 when the FPGA was either not
loaded or when the LMS was still in reset.  Catch this condition and
return back an invalid parameter.
2013-07-06 14:14:16 -07:00
Brian Padalino
cd3552f73a lib: Cleaned up reported github issue #5 and #6
Fixed lms_lpf_enable() to always enable the LPF.
Fixed lms_lpf_disable() to not disturb DCO_DACCAL_LPF.
2013-07-06 14:14:04 -07:00
Brian Padalino
1c9849538f apps: Adding an rx_test to see if the samplerate is being kept up.
cli: Adding trimdac writing.
nios: Removing the unions.
2013-07-06 14:14:03 -07:00
Brian Padalino
480e115537 lib: Set Si5338 to 2x requested sample rate
The ADC/DAC clocks runs at 2x their actual sample rate,
so the Si5338 should be generating a 2x sample clock
for the requested rate.
2013-07-06 14:14:01 -07:00
Rob
a1377133b0 libbladeRF: add Si5338 read support
Support for reading Si5338 registers has existed in the driver for a while. This
commit now allows the library to utilze it as well.
2013-06-23 21:57:46 -07:00
Rob
a589bb1260 libbladeRF: add dac_write() DAC control support
This commit adds support for writing values to the VCTCXO calibration DAC.
2013-06-23 21:57:36 -07:00
Brian Padalino
b6ffd3f9d4 cli: Added rxvga1 and rxvga2.
lib: Modified calls to rxvga2 since units are in 3dB increments.
2013-07-06 14:03:55 -07:00
Brian Padalino
57c6c424a8 lib: Allow reloading of FPGA 2013-07-06 14:03:51 -07:00
Brian Padalino
8dcd48a561 cli: More print/set updated.
lib: Moved all implementation code to bladerf.c
2013-07-06 14:03:49 -07:00
Brian Padalino
b97eb3554d cli: Implemented txvga1 print/set and fixed library calls for txvga1. 2013-07-06 14:03:48 -07:00
Brian Padalino
ef2a542136 cli: Adding extra functionality.
lib: Added device path to bladerf structure to know where fd is pointing.
2013-07-06 04:50:37 -07:00
Robert Ghilduta
9b80370f0c libbladeRF: fixup RX function 2013-06-16 18:17:50 -07:00
Jon Szymaniak
eecc0d2799 libbladeRF: Implemented firmware flashing, touched up FPGA loading.
Credit where credit is due -- All the code here is basically
copy/paste from Robert's earlier test code, with some added error
checks and debug output.

The firmware loading now checks the write return value and
performs partial writes as needed.

Items that need to be revisited are the sanity checks on file
sizes. In the future I plan to implement a "bladeRF Image" format
that will wrap size and a hash around a firmware/bitstream. These
checks will probably go into that code.
2013-06-16 18:17:49 -07:00
Jon Szymaniak
265755de0b libbladeRF: Header file cleanup, added bladerf_strerror
Misc cleanup. Added reference to RETCODES in doxygen @return's.
2013-06-16 18:17:46 -07:00
Brian Padalino
d8ae03cabe bladerf: Adding documentation and liblms calls. 2013-06-16 18:17:44 -07:00
Brian Padalino
c10b7a7b83 Adding some new getters/setters. 2013-06-16 18:17:43 -07:00
Brian Padalino
4997c38d3d libbladeRF: Added setters/getters
Added some extra setters/getters for center frequency and gain.
2013-06-16 18:17:42 -07:00
Robert Ghilduta
f8e78fba46 libbladeRF: driver: add host software support for GPIO over UART bridge 2013-06-09 23:03:28 -07:00
Robert Ghilduta
3843d1909e libbladeRF: add FPGA programming support 2013-06-09 23:03:27 -07:00
Robert Ghilduta
5c41729ac3 libbladeRF: add support for LMS6002D
This commit introduces LMS library support for controlling the LimeMicro
LMS6002D transceiver. The LMS library functions were originally developed by
bpadalino.
2013-06-04 20:22:59 -07:00
jon
c2e3c54422 apps: Added hooks to build without 'make install'-ing libbladeRF 2013-06-09 22:58:33 -07:00
jon
7f22b26f7d libbladeRF/apps: Moving cli build to apps/
This is the first commit in a set of upcoming changes that will
move functionality from simple_load and upgrade_firmware into the
libbladeRF library and provide access to these routines through a
bladeRF cli.

Don't merge from jon-dev until I get this straightened out, or
you'll be left with something possibly unusable...
2013-06-09 22:58:32 -07:00
jon
aad9e99bfb libbladeRF: 'make install' now prints what it's executing to install 2013-06-09 22:58:31 -07:00
Robert Ghilduta
e467bdf85a libbladeRF: add Si5338 support
This commit introduces support for controlling the on-board programmable PLL and
clock distribution Si5338 chip.
2013-06-04 20:42:06 -07:00
jon
cbad06a5a1 libbladeRF: More lib renaming & fixes for tempoarary (un)install targets 2013-06-09 22:58:18 -07:00
jon
7ccd37aa7d libbladeRF: header and lib renamed to libbladeRF. Minor fixes added.
Fixed bladerf_get_device_list return value for condition where no
devices are attached. (Now returns 0, previously returned -1).

Also added a missing catch of a malloc failure and now return appropriate
error value.
2013-06-09 22:58:17 -07:00
jon
5a7b8a253d libbladeRF: Makefile now creates and installs libbladerf.pc 2013-06-09 22:58:06 -07:00
jon
2807d5d3fe libbladeRF: Added header inclusion guards and cplusplus check. Fixed 'make uninstall' 2013-06-09 22:58:05 -07:00
jon
95c2c3db70 libbladeRF: Added stubs for fetching FPGA version info. 2013-06-09 22:58:05 -07:00
jon
ca35519b34 libbladeRF: Added calls to fetch some device info, and did a bit of cleanup. 2013-06-09 22:58:04 -07:00
jon
52a3d834ea libbladeRF: Removed duplicate bladerf_flash_firmware() from header and erroneous #include 2013-06-09 22:58:03 -07:00
jon
bffd52e1f5 libbladeRF: Implemented bladerf_get_device_list(). Removed missing logo from Doxygen
With these changes, the cli can be used to probe for attached bladeRF
devices on the system, assuming the user has r/w on the /dev/bladeRF
nodes.
2013-06-09 22:58:02 -07:00