Commit graph

93 commits

Author SHA1 Message Date
Robert Ghilduta
eb3eee0097 linux_driver: fix typo in function call 2013-07-23 02:01:49 -07:00
jynik
c728ceb7c5 doc: Fixed typo in linux driver README.md 2013-07-22 21:21:49 -04:00
Robert Ghilduta
6c3b1ec453 linux_diver: track which file descriptors are readers and writers
This commit disallows multiple file descriptors from simulatenously reading or
simultaneously writing to the bladeRF.
2013-07-22 03:45:55 -07:00
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
Robert Ghilduta
a4f2a0027e linux_kernel: RX and TX fixes
data_*_used variable is introduced to keep track of the total number of data
packets that are inflight or have data in them. In the case of RX, a packet is
"used" when it is submitted, and it "unused" after data has been read. In the
case of TX, a packet is "used" when user-mode data is copied to it, and it is
"unused" after the URB has completed.
2013-07-22 03:45:28 -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
Robert Ghilduta
3b18c1a87e linux_driver: fixup a few flash write bugs
This commits fixes a buffer length issues and pipe directionality issues.
2013-07-20 07:32:53 -04:00
Jon Szymaniak
cc305fe81b cli: Fixed bladerf_is_fpga_configured() calls to check for errors
Also removed an extranous check of state->curr_device and FPGA from
print_gpio, as this will be checked in cmd_print before print_gpio
is called.
2013-07-18 23:42:02 -04:00
Jon Szymaniak
bd5567a092 cli: Added 'print samplerate [rx|tx]' support 2013-07-18 09:13:32 -04: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
84cac257a6 cli: Added check for FPGA not loaded before performing action. 2013-07-17 20:58:16 -04:00
Jon Szymaniak
ede9dbca3f linux_driver: Fixed GPIO copy size bug and added/fixed timeouts
An incorrect size in for GPIO read/write resulted in memory corruption.

Added and fixed timeouts to ensure control returns to caller if the FX3
fails to respond.
2013-07-17 05:31:08 -04:00
Brian Padalino
f6c6a3abcb Getting rid of checked in FPGA image that was for 15kLE FPGA. 2013-07-17 00:44:20 -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
Jon Szymaniak
ed7938436d cli: Fixed definition of "open" command names.
What was supposed to be a NULL terminator had quotes around it,
yielding unruly behavior.
2013-07-16 19:08:47 -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
Brian Padalino
1997babb18 cli: Changed print out of samplerate for RX and TX to be consistent. 2013-07-15 00:10:55 -04:00
Robert Ghilduta
55c3879a3e linux: stop driver from submitting URBs once device has been disconnected
This fixes and issues where the drive would continue to submit URBs even after
the device was unplugged, and the usb_device was freed from the usb core causing
kernel panics.
2013-07-10 01:17:05 -04:00
Robert Ghilduta
15215dfbc7 linux: only create a bladeRF device on interface 0
The linux USB stack creates a device for each interface. Since bladeRF has 3
interfaces, 3 different /dev/bladerfX files are created.
2013-07-08 00:36:58 -07: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
Rob
b00e363b98 linux_driver: add ioctl()s for reading and writing OTP and NAND
This also include a method of erase NAND flash pages.
2013-07-06 14:14:21 -07:00
Rob
7d2b62428e linux_driver: correctly return error when upgrading NAND firmware 2013-07-06 14:14:19 -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
Jon Szymaniak
0c13b4d0dd cli: Cleanup and bugfixes for peek/poke/print commands & cli_err(). 2013-07-06 14:14:15 -07:00
Jon Szymaniak
a62a6bb7ba cli: First pass of CLI code cleanup
Another pass or two will definitely be required. So far, cleanup
includes:
  - Adding checks of libbladeRF return codes
  - Unifying the way errors are printed
  - Reorganizing command order (as they're searched linearly), by
    what's most time-sensitive.
  - Removed "specialized help" stubs. These can be re-added if/when
    this functionality is added
  - Removed some noisy warnings and replaced some with errors.
  - Script execution stops at first error encountered in script

Added:
  - "clear" command to clear terminal

Remaining issues:
  - We're still lacking a "run" command
  - Valgrind indicates we have some remaining issues in cli_err()
    that we should address.
2013-07-06 14:14:13 -07:00
Jon Szymaniak
b1c8236bd7 cli: Merged command name and aliases list 2013-07-06 14:14:12 -07:00
Jon Szymaniak
15253274dc cli: Preliminary script support
Added support to run scripts from the command line. A 'run' command
still needs to be added. This will required a script stack and
detection of recursive loops.
2013-07-06 14:14:10 -07:00
Jon Szymaniak
5592d11c0c cli: Fixed extraneous error messages when failing to opend device
A message regarding the use of -d was being printed under incorrect
conditions due to an error status not being checked.
2013-07-06 14:14:07 -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
Rob
86fe5f2a8b host: fixup uart_cmd 2013-07-06 14:13:09 -07:00
Brian Padalino
74102bbcda cli: Added gpio printing. 2013-07-06 14:03:59 -07:00
Brian Padalino
b20948c7c7 cli: Formatting of poke changed to match peek. 2013-07-06 14:03:58 -07:00
Jon Szymaniak
888b3f0596 cli: Exit cleanly on SIGTERM, SIGINT, and SIGQUIT 2013-07-06 14:03:56 -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