flash

group flash

SPI flash chip I/O library for reading/writing to/from the onboard flash chip.

for programming the FPGA.

Defines

FLASH_PAGE_SIZE

Functions

void flash_prepare(void)

Prepare the GPIO setup for the SPI flash interface.

void flash_init(void)

Configure the SPI peripheral.

uint32_t flash_get_id(void)

Read the manufacturer ID.

Returns

The combined manufacturer ID and device ID.

void flash_program_page(uint32_t addr, uint8_t const page[FLASH_PAGE_SIZE])

Program a page of the flash chip at the given address.

Parameters
  • addr – The address at which the data is written.

  • page – The buffer holding the data to be sent to the flash chip, of size FLASH_PAGE_SIZE.

void flash_read(uint32_t addr, uint8_t *buf, size_t len)

Communicate to the chip over SPI and read multiple bytes at chosen address onto onto a buffer.

Parameters
  • addr – The address at which the data is read.

  • buf – The buffer onto which the data read is stored.

  • len – The size of buf.

void flash_erase_chip(void)

Send a command to erase the whole chip.