These functions provide the ability to erase, read, and write the SPI flash.
- Warning
- Use of SPI flash functions requires an understanding of the underlying SPI flash device, and the bladeRF's flash memory map. Be sure to review the following page and the associated flash datasheet before using these functions: https://github.com/nuand/bladeRF/wiki/FX3-Firmware#spi-flash-layout
These functions are thread-safe.
◆ bladerf_erase_flash()
API_EXPORT int CALL_CONV bladerf_erase_flash |
( |
struct bladerf * |
dev, |
|
|
uint32_t |
erase_block, |
|
|
uint32_t |
count |
|
) |
| |
Erase regions of the bladeRF's SPI flash
- Note
- This function operates in units of 64 KiB erase blocks
- Parameters
-
| dev | Device handle |
[in] | erase_block | Erase block from which to start erasing |
[in] | count | Number of blocks to erase |
- Returns
- 0 on success, or BLADERF_ERR_INVAL on an invalid
erase_block
or count
value, or a value from Error codes list on other failures
◆ bladerf_read_flash()
API_EXPORT int CALL_CONV bladerf_read_flash |
( |
struct bladerf * |
dev, |
|
|
uint8_t * |
buf, |
|
|
uint32_t |
page, |
|
|
uint32_t |
count |
|
) |
| |
Read data from the bladeRF's SPI flash
- Note
- This function operates in units of 256-byte pages.
- Parameters
-
| dev | Device handle |
[in] | buf | Buffer to read data into. Must be count * BLADERF_FLASH_PAGE_SIZE bytes or larger. |
[in] | page | Page to begin reading from |
[in] | count | Number of pages to read |
- Returns
- 0 on success, or BLADERF_ERR_INVAL on an invalid
page
or count
value, or a value from Error codes list on other failures.
◆ bladerf_write_flash()
API_EXPORT int CALL_CONV bladerf_write_flash |
( |
struct bladerf * |
dev, |
|
|
const uint8_t * |
buf, |
|
|
uint32_t |
page, |
|
|
uint32_t |
count |
|
) |
| |
Write data to the bladeRF's SPI flash device
- Note
- This function operates in units of 256-byte pages.
- Parameters
-
| dev | Device handle |
[in] | buf | Data to write to flash |
[in] | page | Page to begin writing at |
[in] | count | Number of pages to write |
- Returns
- 0 on success, or BLADERF_ERR_INVAL on an invalid
page
or count
value, or a value from Error codes list on other failures.