Commit graph

12 commits

Author SHA1 Message Date
Jon Szymaniak
20b7196e2d libbladeRF: Return BLADERF_ERR_PERMISSION in file operations 2015-08-25 14:40:51 -04:00
Jon Szymaniak
7b0cc24f95 libbladeRF: Introduced thread-safety to the API
Top-level API functions now acquire a per-device "control lock" before
performing control, programming, and low-level access operations.
(Specifically, these are the functions that manipulate the device handle
and utilize the FX3 <-> FPGA UART.)

Synchronous data transfer functions now hold a per-device, per-module
"sync lock" to ensure these operations are carried out atomically. The
control lock is also held during sync configuration, as upcoming changes
to introduce metadata support will require flipping some config bits on
the FPGA during this operation.

Only these top-level functions shall acquire these locks; the core logic
code should be able to assume that locks are already acquired.

To alleviate confusion, functions that are *not* part of the API, and
therefore are safe to call within the core logic, are stripped of the
bladerf_ prefix.

Now that pthreads is a required dependency, use of the sync API is
is no longer marked optional in the libbladeRF build.
ENABLE_LIBBLADERF_SYNC and related items have been removed from the
CMake build.
2014-08-02 19:22:49 -04:00
Jon Szymaniak
eaa76ee831 libbladeRF: Added bladerf_load_calibration_table()
This function provides the ability to load DC offset tables, and will
be used to support loading of IQ balance correction tables in the future.
2014-06-30 00:04:38 -04:00
Jon Szymaniak
0d2f271ef1 bladeRF-cli: Added DC offset calibration table generation 2014-06-30 00:04:38 -04:00
Jon Szymaniak
e05eb84e9b libbladeRF: Added image types for additional calibrations, typo fix 2014-06-30 00:04:37 -04:00
Jon Szymaniak
cdba131f25 libbladeRF: Fixed potential memory leak in cases with bad args (CID 1213846) 2014-05-23 13:44:28 -04:00
Jon Szymaniak
96e9633604 libbladeRF: Further revisions and API changes to the SPI flash interface
After further discussion, it was concluded that little benefit is gained
by providing byte interfaces to the SPI flash; users using this API were
already forced to be aware of page/eraseblock alignment, and would have
to be aware of the underlying flash memory map.

Therefore, the following API changes have been made:

 - bladerf_erase_flash() now takes an erase_block number and an
    erase_block count.

 - bladerf_read_flash()/bladerf_write_flash() now take a page number,
    and a page count.

 - The unaligned flash read/write functions have been removed. If users
   are going to be working at a low-level with flash, they'll likely
   want to manage the read-modify-erase cycles themselves.

Internal to libbladeRF, these changes have been propagated down to the
backend interface. Although the flash on the current bladeRF is only
a 4 MiB part, the types have been kept as uint32_t, to accommodate
any future HW changes.
2014-05-06 21:59:42 -04:00
Jon Szymaniak
695c7fc892 libbladeRF, bladeRF-cli: Fixed defects reported by Converity Scan
Addresses CID: 113696 - 1133700, which consist of potential NULL pointer
dereferences, dead code, and invalid memory access (clobbered a NUL
terminator).
2013-11-29 14:36:56 -05:00
Jon Szymaniak
30997a9f61 libbladeRF, bladeRF-cli: Reworked cal data generation and misc cleanup
The function to create cal data now is a wrapper around
bladerf_alloc_image() which initializes the returned image with
calibration data.

The associated CLI command now allows this to be either written to a
file or to the device directly.

API header cleanup: Pushed the lower level functions to to the end of
the header, so the functions people will use more frequently will be at
the top of the generated documentation.

Also added a missing API_EXPORT and made the Doxygen color scheme a little
more blue. (Tired of grayscale ;) )

Windows cleanup: Added get_timestamp() implementation, cleaned up
warnings, address some portability issues.
2013-11-28 14:14:38 -05:00
Jon Szymaniak
ad3faf9dd7 bladeRF-cli: Added flash_image command and alphabetized commands 2013-11-28 14:07:49 -05:00
Jon Szymaniak
fd7af2edc6 libbladeRF, bladeRF-cli: Simplified flash image format and handling
These changes simplify the image format a bit; the metadata fields are
flattened into the image to simplify both image creation and manually
viewing/extracting contents from images.

The checksum has been moved to directly after the file format's magic
value (i.e., signature), to make it a bit easier to just extract data
via dd. Similar to the approach used by mkimage for U-Boot headers,
the checksum calculation is performed over the entire image, with the
checksum field zeroed out.

Touched up CLI backup/restore commands and separated <address>
and <length> to separate args.
2013-11-28 14:05:54 -05:00
Daniel Gröber
bb0128e15e libbladeRF: Supporting changes for backup/restore of flash
- Verify flash pages as they are written
- Add function for initializing the calibration region in flash
- Add functions to read/write flash images with sha256 and metadata
- Add support for unaligned read/program
2013-11-28 13:58:08 -05:00