pico2-ice
RaspberryPi Pico with an iCE40 FPGA
|
Flash chip I/O. More...
Macros | |
#define | ICE_FLASH_PAGE_SIZE 256 |
The size of the flash. | |
#define | ICE_FLASH_SECTOR_SIZE 4096 |
#define | ICE_FLASH_BLOCK_SIZE 65536 |
Functions | |
int | ice_flash_init (const ice_spibus spibus, int baudrate) |
Initialise the SPI1 peripheral, dedicated to flashing the FPGA. | |
int | ice_flash_read (const ice_spibus spibus, uint32_t addr, uint8_t *buf, size_t sz) |
Communicate to the chip over SPI and read multiple bytes at chosen address onto onto a buffer. | |
int | ice_flash_erase_sector (const ice_spibus spibus, uint32_t addr) |
Erase a sector of the flash chip at the given address. | |
int | ice_flash_program_page (const ice_spibus spibus, uint32_t addr, uint8_t const page[ICE_FLASH_PAGE_SIZE]) |
Program a page of the flash chip at the given address. | |
int | ice_flash_erase_block (const ice_spibus spibus, uint32_t addr) |
Send a command to erase a whole block. | |
int | ice_flash_erase_chip (const ice_spibus spibus) |
Send a command to erase the whole chip. | |
int | ice_flash_wakeup (const ice_spibus spibus) |
Send a command to wakeup the chip. | |
int | ice_flash_sleep (const ice_spibus spibus) |
Send a command to put the chip to sleep. | |
int | ice_flash_deinit (const ice_spibus spibus) |
Free SPI bus. | |
Flash chip I/O.
All these functions act on the on-board flash chip. For a generic flash memory I/O, you can see the low-level ice_smem.h
int ice_flash_erase_block | ( | const ice_spibus | spibus, |
uint32_t | addr | ||
) |
Send a command to erase a whole block.
addr | The address at which the data is written. |
int ice_flash_erase_sector | ( | const ice_spibus | spibus, |
uint32_t | addr | ||
) |
Erase a sector of the flash chip at the given address.
addr | The beginning of the sector. |
int ice_flash_program_page | ( | const ice_spibus | spibus, |
uint32_t | addr, | ||
uint8_t const | page[ICE_FLASH_PAGE_SIZE] | ||
) |
Program a page of the flash chip at the given address.
addr | The address at which the data is written. |
data | The buffer holding the data to be sent to the flash chip, of size ICE_FLASH_PAGE_SIZE. |
int ice_flash_read | ( | const ice_spibus | spibus, |
uint32_t | addr, | ||
uint8_t * | buf, | ||
size_t | sz | ||
) |
Communicate to the chip over SPI and read multiple bytes at chosen address onto onto a buffer.
addr | The address at which the data is read. |
data | The buffer onto which the data read is stored. |
data_size | The size of the buffer in bytes. |