Commit graph

20 commits

Author SHA1 Message Date
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
Comics
ac2b1d61e4 Update bladeRF.c
Fix to add missing include on bladeRF.c
2013-07-25 10:26:32 +01: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
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
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
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
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
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
Rob
86fe5f2a8b host: fixup uart_cmd 2013-07-06 14:13:09 -07:00
Jon Szymaniak
75a277cc99 kernel: Removed urb print from driver 2013-06-16 18:17:48 -07:00
Jon Szymaniak
45f8316207 kernel: Fixed issue where write() returns 0 when programming FPGA 2013-06-16 18:17:47 -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
552d779567 linux driver: add support for writing to the LMS, Si5388, and the VCTCXO
This commit adds the ioctls necessary to configure the LMS, Si5338, and VCTCXO.
The FX3's second endpoint is configured to receive and transmit things over
UART. At the other end of the UART is the Nios II core in the FPGA. The Nios
core simply parses the read or write operation and sends it to the appropriate
device.

NB: At least a 16byte URB has to be sent to the FX3 for it to send data on UART
due to a minimum buffer count enforced by the GPIF's DMA controller.

The UART packet format is as follows:
   Byte 0) "Magic" byte is 'N'

   Byte 1) Indicates the direction and intended device of each subsequent
           operation. Count is number of struct uart_cmd data structures that
           will be transferred.
   //  | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |$
   //  |  dir  |  dev  |     cnt       |$

   Byte 2..N) The following byte pairs are struct uart_cmd, which consist of
           addresses and values;
   struct uart_cmd {$
       unsigned char addr;$
       unsigned char data;$
   };$

As an example, if you are looking to write 0xC0 to register 0x30 on the Si5338,
the UART packet you would have to send would have to look like this:
   Byte 0) 'N'
   Byte 1) UART_PKT_MODE_DIR_WRITE | UART_PKT_DEV_SI5338 | 0x01;$
   Byte 2) 0x30$
   Byte 3) 0xC0$

Before sending this packet to the second endpoint, the packet would have to be
zero padded to the nearest 16 byte boundary.
2013-06-02 23:57:36 -07:00
Robert Ghilduta
10040ef56c linux driver: add RX and TX buffering
This commit adds RX and TX functionality for the bladeRF. The driver uses a ring
buffer of URBs that are allocated when the driver probe()s each bladeRF. At the
moment the driver allocates 1024 4KB URB buffers for RX and TX, meaning that
each bladeRF requires at least 8MB of RAM. The total number of allocated URBs
(NUM_DATA_URB) can be lowered when operating at USB 2.0, but the number should
be a power of 2 for the ring buffer to work.

Test read/write speeds of 320MB/s were observed with this driver on an Intel xHCI.
2013-06-02 23:57:35 -07:00
Nuand
ce7d8a7ab2 FSK bridge example
This should include everything needed to build the FSK bridge example from scratch.

1) Open existing hdl/quartus/bladerf.qsf project in Quartus
        a) Generate the Nios core
                i) Tools -> QSys -> File -> Open -> navigate to ./hdl/fpga/ip/altera/nios_system/nios_system.qsys
                ii) After opening qsys file, go to Generation tab, click the "Generate" button
        b) Compile the embedded Nios image
                i) Tools -> Nios II Software Build Tools for Eclipse
                        I)   File -> Import -> General -> Existing Projects into Workspace -> Next
                                -> Browse to checkout root directory -> check both lms_spi_controller and lms_spi_controller_bsp
                                -> Finish
                        II)  right click lms_spi_controller_bsp -> NIOS II -> Generate BSP
                        III) right click lms_spi_controller -> Build
                        IV)  right click lms_spi_controller -> Make Targets -> Build... -> select mem_init_generate -> Build
        c) Synthesize FPGA image
                i) Processing -> Start Compilation

2) Compile driver and user mode applications
        a) cd linux/kernel ; make ; inmod bladeRF.ko
        b) cd ../apps; make
        c) To program the fpga execute ./simple_load c4images/blink.rbf
                i) Load bladerf.rbf from the quartus output_files directory

3) Use bladeRF's UART as an FSK bridge!

NB. The firmware upgrade utility does work, only use it on valid .img files.
2013-02-18 20:11:39 -08:00