RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
spiFlash.c File Reference
#include <stdio.h>
#include "bsp.h"
#include "spiFlash/spiFlash.h"

Go to the source code of this file.

Overview

spiFlash driver implementation.

Implements the functions defined in spiFlash.h for controlling spiFlash input/output and interrupts on the EfxSapphireSoC platform.

Definition in file spiFlash.c.

Functions

void spiFlash_registerFlash (const spiFlash_info_t *table, size_t count)
 Register Custom Flash to the driver.
void spiFlash_initController (spiFlash_instance_t *flash)
 Initialize SPI setting.
spiFlash_status_t spiFlash_probe (spiFlash_instance_t *flash)
 Main wrapper function to initialize the SPI Flash.
void spiFlash_applyConfig (spiFlash_instance_t *flash)
 Apply stored SPI Flash configuration to hardware.
void spiFlash_wake (spiFlash_instance_t *flash)
 Select spi and wake up SPI Flash.
u8 spiFlash_readId (spiFlash_instance_t *flash)
 Select and Read Device ID from spiFlash.
u32 spiFlash_readJedecId (spiFlash_instance_t *flash)
 Select and read JEDEC ID from spiFlash.
const spiFlash_info_tspiFlash_lookup (u32 detected_id)
 Identify SPI Flash by looking up User Flash Table and known flash table.
spiFlash_status_t spiFlash_verify (spiFlash_instance_t *flash)
 Verify spiFlash.
void spiFlash_applyQuirks (spiFlash_instance_t *flash)
 Handle those spiFlash that have unique register/way.
u8 spiFlash_write_single (spiFlash_instance_t *flash, u32 flashAddress, u8 *src, u32 len)
 Write N byte to Flash using standard write mode via single Data Line.
void spiFlash_read_single (spiFlash_instance_t *flash, u32 flashAddress, u8 *buffer, u32 len)
 Read N byte from Flash using standard read mode via single Data Line.
u8 spiFlash_readStatusReg (spiFlash_instance_t *flash)
 Read Status Register.
void spiFlash_writeStatusReg (spiFlash_instance_t *flash, u8 data)
 Write Status Register.
void spiFlash_f2m_single (spiFlash_instance_t *flash, u32 flashAddress, uintptr_t memoryAddress, u32 size)
 This function read data from FlashAddress and copy to memoryAddress of specific size with single data line.
void spiFlash_f2m_dual (spiFlash_instance_t *flash, u32 flashAddress, uintptr_t memoryAddress, u32 size)
 This function read data from FlashAddress and copy to memoryAddress of specific size with dual data line.
void spiFlash_f2m_quad (spiFlash_instance_t *flash, u32 flashAddress, uintptr_t memoryAddress, u32 size)
 This function read data from FlashAddress and copy to memoryAddress of specific size with quad data line.
void spiFlash_enableQuadMode (spiFlash_instance_t *flash)
 Set Write Enable Latch and set Quad Enable bit to enable Quad Mode.
void spiFlash_enableQPI (spiFlash_instance_t *flash)
 Set Write Enable Latch and send CMD 0x38 to enable QPI Mode.
void spiFlash_enableWrite (spiFlash_instance_t *flash)
 Set Write Enable Latch (WEL) to 1.
u8 spiFlash_exit4ByteAddr (spiFlash_instance_t *flash)
 Exit 4-byte addressing.
void spiFlash_lockGlobal (spiFlash_instance_t *flash)
 Globally locks the SPI flash.
void spiFlash_unlockGlobal (spiFlash_instance_t *flash)
 Globally unlocks the SPI flash.
spiFlash_status_t spiFlash_waitBusy (spiFlash_instance_t *flash)
 Wait for spiFlash to be free.
void spiFlash_eraseSector (spiFlash_instance_t *flash, u32 flashAddress)
 Erases a sector of the SPI flash given an address.