![]() |
libbladeRF 2.6.0-git
Nuand bladeRF library
|
This section contains a file format and associated routines for storing and loading flash contents with metadata.
These functions are thread-safe.
Topics | |
Flash image format constants |
Data Structures | |
struct | bladerf_image |
Macros | |
#define | BLADERF_IMAGE_MAGIC_LEN 7 |
#define | BLADERF_IMAGE_CHECKSUM_LEN 32 |
#define | BLADERF_IMAGE_RESERVED_LEN 128 |
Functions | |
API_EXPORT struct bladerf_image *CALL_CONV | bladerf_alloc_image (struct bladerf *dev, bladerf_image_type type, uint32_t address, uint32_t length) |
API_EXPORT struct bladerf_image *CALL_CONV | bladerf_alloc_cal_image (struct bladerf *dev, bladerf_fpga_size fpga_size, uint16_t vctcxo_trim) |
API_EXPORT void CALL_CONV | bladerf_free_image (struct bladerf_image *image) |
API_EXPORT int CALL_CONV | bladerf_image_print_metadata (const struct bladerf_image *image) |
Prints the metadata of a bladeRF image structure. | |
API_EXPORT const char * | bladerf_image_type_to_string (bladerf_image_type type) |
Converts a bladeRF image type to its corresponding string representation. | |
API_EXPORT int CALL_CONV | bladerf_image_write (struct bladerf *dev, struct bladerf_image *image, const char *file) |
API_EXPORT int CALL_CONV | bladerf_image_read (struct bladerf_image *image, const char *file) |
enum bladerf_image_type |
Type of data stored in a flash image
Definition at line 3312 of file libbladeRF.h.
#define BLADERF_IMAGE_CHECKSUM_LEN 32 |
Size of bladeRF flash image checksum
Definition at line 3333 of file libbladeRF.h.
#define BLADERF_IMAGE_MAGIC_LEN 7 |
Size of the magic signature at the beginning of bladeRF image files
Definition at line 3330 of file libbladeRF.h.
#define BLADERF_IMAGE_RESERVED_LEN 128 |
Size of reserved region of flash image
Definition at line 3336 of file libbladeRF.h.
API_EXPORT struct bladerf_image *CALL_CONV bladerf_alloc_cal_image | ( | struct bladerf * | dev, |
bladerf_fpga_size | fpga_size, | ||
uint16_t | vctcxo_trim ) |
Create a flash image initialized to contain a calibration data region.
This is intended to be used in conjunction with bladerf_image_write(), or a write of the image's data field to flash.
[in] | dev | Device handle |
[in] | fpga_size | Target FPGA size |
[in] | vctcxo_trim | VCTCXO oscillator trim value. |
API_EXPORT struct bladerf_image *CALL_CONV bladerf_alloc_image | ( | struct bladerf * | dev, |
bladerf_image_type | type, | ||
uint32_t | address, | ||
uint32_t | length ) |
Allocate and initialize an image structure.
This following bladerf_image fields are populated: magic, version, timestamp, type, address, and length
The following bladerf_image fields are zeroed out: checksum, serial, and reserved
If the length parameter is not 0, the bladerf_image data field will be dynamically allocated. Otherwise, data will be set to NULL.
The address and length fields should be set 0 when reading an image from a file.
[in] | dev | Device handle |
[in] | type | Image type to be created, represented by bladerf_image_type |
[in] | address | Address in flash memory where the image is stored. Use 0xffffffff if not applicable. |
[in] | length | Length of the image data in bytes |
API_EXPORT void CALL_CONV bladerf_free_image | ( | struct bladerf_image * | image | ) |
Free a bladerf_image previously obtained via bladerf_alloc_image.
If the bladerf_image's data field is non-NULL, it will be freed.
[in,out] | image | Flash image |
API_EXPORT int CALL_CONV bladerf_image_print_metadata | ( | const struct bladerf_image * | image | ) |
Prints the metadata of a bladeRF image structure.
This function displays the metadata of a provided bladerf_image structure. It includes information such as the magic number, version, timestamp, serial number, address, and length of the image. The function will return an error code if the provided image pointer is NULL.
[in] | image | Pointer to the bladerf_image structure whose metadata is to be printed. It should not be NULL. |
API_EXPORT int CALL_CONV bladerf_image_read | ( | struct bladerf_image * | image, |
const char * | file ) |
Read flash image from a file.
[out] | image | Flash image structure to populate. |
[in] | file | File to read image from. |
API_EXPORT const char * bladerf_image_type_to_string | ( | bladerf_image_type | type | ) |
Converts a bladeRF image type to its corresponding string representation.
This function maps a bladerf_image_type enumeration value to a human-readable string. It is useful for logging, debugging, or displaying the image type to an end user.
[in] | type | The bladerf_image_type enumeration value to be converted. |
API_EXPORT int CALL_CONV bladerf_image_write | ( | struct bladerf * | dev, |
struct bladerf_image * | image, | ||
const char * | file ) |
Write a flash image to a file.
This function will fill in the checksum field before writing the contents to the specified file. The user-supplied contents of this field are ignored.
[in] | dev | Device handle |
[in] | image | Flash image |
[in] | file | File to write the flash image to |