Works around a minor bug in fpga v0.10.2 where the frequency
post-init is not valid, which makes bladerf_enable_module fail
until a frequency change is done.
Also only enable RX channels, not TX channels.
Also don't try to change gain modes on TX channels.
This adds a bladerf_get_fpga_bytes() function, which returns the
expected length of the FPGA image.
This is a dynamic replacement for BLADERF_FLASH_BYTE_LEN_FPGA,
which has been removed.
In particular, this is used in spi_flash_write_fpga_bitstream() and
spi_flash_erase_fpga() to determine the number of blocks to erase
during FPGA flashing operations.
This fixes an issue where xA9 boards were not being adequately
erased before writing.
Replaced these macros with appropriate calculations using
BLADERF_FLASH_ADDR_FIRMWARE and the page size held in the device's flash
architecture structure. Page size may change depending on the flash
used.
Replaced this macro with an appropriate calculation using the
BLADERF_FLASH_ADDR_FPGA macro and the page size held in the device's
flash architecture structure. Page size may change depending on the
flash used.
API change:
- bladerf_image_write(): new parameter: bladeRF device handle
Change is inspired by the pending removal of BLADERF_FLASH_EB_SIZE
macro. This macro really shouldn't be exposed to the world, nor
should it be constant as it may change depending on the flash
used on the board.
API new function:
- bladerf_erase_flash_bytes(): new function
Similar to the existing bladerf_erase_flash() function, but
handles the conversion from bytes to flash erase block pages
internally. This function is recommended for new designs because
the erase block size may change depending on the board. This
function also checks for proper alignment along erase block
boundaries.
General changes:
Although the macro still exists (for now), all uses of
BLADERF_FLASH_EB_SIZE have been replaced with equivalent
dev->flash_arch->ebsize_bytes because the value may change depending
on the flash used on the board.
The BLADERF_FLASH_PAGE_SIZE macro was replaced with a similar value from
the from the device's flash architecture
structure (e.g. dev->flash_arch->psize_bytes).
The BLADERF_FLASH_TO_PAGES() macro was replaced by using the new(er) API
functions bladerf_{read,write}_flash_bytes(). The conversion from bytes
to pages occurs in those functions, removing the need for the
macro. Going forward, the *_bytes() functions should be preferred
because the flash architecture may change.
New API functions:
- bladerf_read_flash_bytes()
This function is nearly identical to the existing
bladerf_read_flash() function, but takes the address and length in
units of bytes instead of flash pages. The function performs the
necessary conversions from bytes to pages internally based on the
specific flash architecture in use.
- bladerf_write_flash_bytes()
Same as above, for writes.
New code is advised to use these byte-unit functions instead of the
older page-unit functions because the page size may not be guaranteed to
be 256 bytes in future bladeRF platforms.
The BLADERF_FLASH_NUM_EBS macro was replaced with data from the device's
flash architecture structure (e.g. dev->flash_arch->num_ebs).
Functions with new parameters include:
- spi_flash.c: check_eb_access() - bladeRF device handle
The BLADERF_FLASH_NUM_PAGES macro was replaced with data from the
device's flash architecture structure (e.g. dev->flash_arch->num_pages).
Functions with new parameters include:
- spi_flash.c: check_page_access() - bladeRF device handle
API changes:
- bladerf_alloc_image(): new parameter - bladeRF device handle
- bladerf_alloc_cal_image(): new parameter - bladeRF device handle
General changes:
Although the macro still exists (for now), all uses of the
BLADERF_FLASH_TOTAL_SIZE macro have been replaced with equivalent
dev->flash_arch->tsize_bytes because the value may change depending on
teh flash used on the board.
During this process, some function prototypes were modified so the
device handle could be passed in, thus allowing flash architecture
data to be extracted.
- calibration.c: dc_cal_tbl_image_load()
- image.c: is_valid_addr_len()
libad936x needs -fshort-enums as well, so that structs line up
properly.
I believe this is mostly cosmetic in practice, as libad936x
manages its own memory, but it does cause some distress when
debugging.
libad936x needs ALTERA_PLATFORM because, apparently, memcpy
doesn't work properly on the Nios. This resulted in TX sample
rates being half of the expected value.
fix validity bitmask for gain setting
- This caused attempts to get/set TX gain to fail
improve init failure detection
- Also check pdata for a null value, as this is a canary for a
mismatch in struct alignments between libad936x and bladeRF_nios.
- On failure, de-init and free and such.
This was fixed for the Host CMakeFiles.txt, but did not get fixed
on the Nios side of things.
Fixes:
-- libad936x: Applying patch: 0001-0bba46e-nuand-modifications.patch
-- libad936x: Applying patch: 0006-0bba46e-compilefix.patch
CMake Error at CMakeLists.txt:192 (message):
Failed to apply 0006-0bba46e-compilefix.patch: error: patch failed:
ad9361.c:40
error: ad9361.c: patch does not apply
-- Configuring incomplete, errors occurred!