NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
spi_flash.h File Reference

SPI flash driver. More...

#include <stdint.h>

Go to the source code of this file.

Functions

int spi_flash_check (void)
 
int spi_flash_read_word (uint32_t addr, uint32_t *rdata)
 
int spi_flash_write_word (uint32_t addr, uint32_t wdata)
 
int spi_flash_erase_sector (uint32_t addr)
 

Detailed Description

SPI flash driver.

Function Documentation

◆ spi_flash_check()

int spi_flash_check ( void )

Check if SPI and flash are available/working by making sure the WEL flag of the flash status register can be set and cleared again.

Returns
0 if success, !=0 if error

◆ spi_flash_erase_sector()

int spi_flash_erase_sector ( uint32_t addr)

Erase sector (64kB) at base address.

Parameters
[in]addrBase address of sector to erase.
Returns
0 if success, !=0 if error

◆ spi_flash_read_word()

int spi_flash_read_word ( uint32_t addr,
uint32_t * rdata )

Read byte from SPI flash.

Parameters
[in]addrWord-aligned address.
[in,out]rdataPointer for returned data (uint32_t).
Returns
0 if success, !=0 if error

◆ spi_flash_write_word()

int spi_flash_write_word ( uint32_t addr,
uint32_t wdata )

Write word to SPI flash.

Parameters
addrSPI flash write address.
wdataSPI flash write data.
Returns
0 if success, !=0 if error