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_info_t Struct Reference

#include <spiFlash_list.h>

Data Fields

const char * part_no
 String representation of Part Number (e.g., "W25Q128").
u32 jedec_id
 Expected JEDEC ID (Manuf + Type + Cap).
u32 flags
 Capability Flags (Flash Capability Flags).
flash_hook post_init_hook
 Optional callback (NULL if unused).

Detailed Description

SPI Flash Device Descriptor.

Note
This structure defines the properties of a specific Flash such as
  • Part Number
  • JEDEC ID
  • Capability Flash Flag
  • Custom Function
  • The driver uses this to look up capabilities based on the detected JEDEC ID.

Example of Creating Custom Flash Descriptor

If user's specific Flash chip is not supported by the factory library, user can define a custom descriptor. This allows the driver to recognize the chip and apply specific vendor profiles or initialization logic.

Steps to Implement:

  1. Create an array of spiFlash_info_t containing user's chip's JEDEC ID.
    • Make sure the JEDEC_ID is correctly formatted (Manuf + Type + Cap + 0x00 padding).
    • User can set the flags field to match the capabilities of the chip, or assign a predefined profile (e.g., PROFILE_WINBOND_64) if it matches an existing profile. Else set to '0' if no matching profile is available.
  2. Define a post_init_hook function Only if user plan to execute custom setup function after the initialization.
  3. Call spiFlash_register before spiFlash_probe.

Below are the example of how to create a custom flash descriptor and register it to the driver.

int custom_chip_setup(void *instance);
// Example: Creating user's custom Flash with supported vendor profile
const spiFlash_info_t user_flash[] = {
{
.part_no = "CUSTOM_X", // The name of the flash
.jedec_id = 0x9D701A00, // Expected ID, make sure it is aligned
.flags = PROFILE_WINBOND_64, // Vendor profile
.post_init_hook = custom_chip_setup, // Custom function
},
};
// Custom Flash - Example of how to configure a user-defined flash chip.
// Users are allowed to define the part_no, id, flags, and post-init function.
int custom_chip_setup(void *instance){
Flash.cmd_wr_status =0x77;
Flash.mask_qe= 0x40; //Just an example !
printf("This is a user spiFlash function\n" );
return 0;
}
void main (){
// Register the user flash table.
spiFlash_register(user_flash);
spiFlash_probe(&Flash);
}
spiFlash_status_t spiFlash_probe(spiFlash_instance_t *flash)
Main wrapper function to initialize the SPI Flash.
Definition spiFlash.c:62
#define spiFlash_register(table)
High level Wrapper to register Custom Flash to the driver.
Definition spiFlash.h:285
#define PROFILE_WINBOND_64
Profile for Winbond <= 64Mb.
SPI Flash driver API definitions.
SPI Flash Device Descriptor.

Definition at line 343 of file spiFlash_list.h.

Field Documentation

◆ flags

u32 spiFlash_info_t::flags

Capability Flags (Flash Capability Flags).

Definition at line 346 of file spiFlash_list.h.

◆ jedec_id

u32 spiFlash_info_t::jedec_id

Expected JEDEC ID (Manuf + Type + Cap).

Definition at line 345 of file spiFlash_list.h.

◆ part_no

const char* spiFlash_info_t::part_no

String representation of Part Number (e.g., "W25Q128").

Definition at line 344 of file spiFlash_list.h.

◆ post_init_hook

flash_hook spiFlash_info_t::post_init_hook

Optional callback (NULL if unused).

Definition at line 347 of file spiFlash_list.h.


The documentation for this struct was generated from the following file:
  • C:/Users/JasonLau/Downloads/workspace_local/GitLab/efx_IP/efx_soc_rv64/embedded_sw/software/standalone/driver/spiFlash/spiFlash_list.h