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.
48 lines
1.7 KiB
C
48 lines
1.7 KiB
C
|
|
#define BLADERF_IOCTL_BASE 'N'
|
|
#define BLADE_QUERY_VERSION _IOR(BLADERF_IOCTL_BASE, 0, struct bladeRF_version)
|
|
#define BLADE_QUERY_FPGA_STATUS _IOR(BLADERF_IOCTL_BASE, 1, unsigned int)
|
|
#define BLADE_BEGIN_PROG _IOR(BLADERF_IOCTL_BASE, 2, unsigned int)
|
|
#define BLADE_END_PROG _IOR(BLADERF_IOCTL_BASE, 3, unsigned int)
|
|
#define BLADE_CHECK_PROG _IOR(BLADERF_IOCTL_BASE, 4, unsigned int)
|
|
#define BLADE_RF_RX _IOR(BLADERF_IOCTL_BASE, 5, unsigned int)
|
|
#define BLADE_RF_TX _IOR(BLADERF_IOCTL_BASE, 6, unsigned int)
|
|
|
|
#define BLADE_UPGRADE_FW _IOR(BLADERF_IOCTL_BASE, 50, unsigned int)
|
|
|
|
#define BLADE_USB_CMD_QUERY_VERSION 0
|
|
#define BLADE_USB_CMD_QUERY_FPGA_STATUS 1
|
|
#define BLADE_USB_CMD_BEGIN_PROG 2
|
|
#define BLADE_USB_CMD_END_PROG 3
|
|
#define BLADE_USB_CMD_RF_RX 4
|
|
#define BLADE_USB_CMD_RF_TX 5
|
|
#define BLADE_USB_CMD_FLASH_READ 100
|
|
#define BLADE_USB_CMD_FLASH_WRITE 101
|
|
#define BLADE_USB_CMD_FLASH_ERASE 102
|
|
|
|
#define BLADE_USB_CMD_QUERY_VERSION 0
|
|
#define BLADE_USB_CMD_QUERY_FPGA_STATUS 1
|
|
#define BLADE_USB_CMD_BEGIN_PROG 2
|
|
#define BLADE_USB_CMD_END_PROG 3
|
|
#define BLADE_USB_CMD_RF_RX 4
|
|
|
|
struct bladeRF_version {
|
|
unsigned short major;
|
|
unsigned short minor;
|
|
};
|
|
|
|
struct bladeRF_firmware {
|
|
unsigned int len;
|
|
unsigned char *ptr;
|
|
};
|
|
|
|
#define BLADE_USB_TYPE_OUT 0x40
|
|
#define BLADE_USB_TYPE_IN 0xC0
|
|
#define BLADE_USB_TIMEOUT_MS 1000
|
|
|
|
#define USB_NUAND_VENDOR_ID 0x04b4
|
|
#define USB_NUAND_BLADERF_PRODUCT_ID 0x00f1
|
|
#define NUM_CONCURRENT 8
|
|
#define NUM_DATA_URB (128)
|
|
#define DATA_BUF_SZ (1024*4)
|
|
|