Commit graph

106 commits

Author SHA1 Message Date
Brian Padalino
b1057815d3 cli: Add external sampling from ADC pins.
A new command for print/set for sampling being internal via the normal
RXVGA2 path or external via the differential pin header.
2013-07-30 23:16:24 -04:00
Jon Szymaniak
70a628fc3d lib: Typo fix in LMS register access
Function call was missing a device handle argument
2013-07-26 00:37:09 -04:00
Brian Padalino
183518d4fb lib: Do not want to enable the modules via pins until we're ready to do something with them. 2013-07-25 23:49:16 -04:00
Brian Padalino
51a3905881 kernel: Remove some breaks which were causing issues.
lib: Add some device initialization after the FPGA is loaded.
2013-07-25 23:39:50 -04:00
Jon Szymaniak
780fcd143c CLI: Fixed a few small typos in the README.md 2013-07-25 22:49:28 -04:00
Jon Szymaniak
f1708ef940 CLI: Added interactive mode support for RX and TX, misc. refactoring.
See the README.md in the linux/apps directory for more details.

Note that -d <device> is now optional if only one device is connected.
2013-07-25 22:41:22 -04:00
Jon Szymaniak
807007f193 libbladeRF: Cleand up gpio_* return values and remove a few printf()'s 2013-07-25 21:43:06 -04:00
Jon Szymaniak
9828c91201 CLI: Typo fixes in comments from previous commit 2013-07-25 10:02:25 -04:00
Jon Szymaniak
cf8336c159 CLI: Added missing bladerf_enable_module() implementation
This routine is used to enable/disable the RX/TX on the LMS,
and should be used instead of the gpio_* routines.

All calls that are not prefixed with bladerf_* will be removed
and replaced with more appropriate interfaces in the near future.
2013-07-25 10:01:00 -04:00
Comics
ac2b1d61e4 Update bladeRF.c
Fix to add missing include on bladeRF.c
2013-07-25 10:26:32 +01:00
Jon
e40e0898fb libbladeRF: Fixed typos introduced in previous commit
The patch applied as f6018c14d9 wasn't
intended to be merged. This cleans up said patch and touches
up surrounding documentation a bit.

This compiles but is untested as I don't currently have access to
hardware. (Just wanted to ensure the build isn't left broken all day!)

My apologies if this inconvenience anyone!
2013-07-24 10:14:59 -04:00
Jon
f6018c14d9 libbladeRF: change to using BLADERF_GPIO_FEATURE_HW macro
Minor clean up.
2013-07-24 02:53:15 -07:00
Jon
00b7c67aed linux_driver: change when the buffers are marked as valid
This commit initializes RX buffers as valid at creation and when RX is
(re)enabled.
2013-07-24 02:53:15 -07:00
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