6.2. Migration Guide to New Flash driver updates¶
6.2.1. Background¶
Earlier for any custom flash used, the user had to define the flash specific parameters and commands in form of Macros which were used in the driver. These parameters and commands include flash page size , sector size , block size and commands for read, write, erase operations. These macros were defined in $MCAL_INSTALL_DIR/mcal/Fls/V1/Fls_Nor_Device.h file inside the driver.
Now the flash specific commands and parameters are defined within a predefined structure where the members inside the structure specifies different commands and parameters. If the flash supports SFDP, then the value of the structure members can be obtained by simply running the $MCAL_INSTALL_DIR/mcal/examples/flsdiag example. If the flash does not support SFDP, then the user has to manually fill the flash specific details in the structure from the datasheet. The values will be written inside Flash_sfdpParams_init API in $MCAL_INSTALL_DIR/mcal/Fls/V1/Fls_Nor_Config.c file.
Below table can be used as a reference to migrate existing Flash specific command macros to SFDP parameters. The user can use it as a reference to fill the flash related details.
6.2.2. Structure Members corresponding to each Macros¶
MACROS Used Earlier |
Parameter Used Now |
---|---|
NOR_CMD_RDID |
idCfg.cmd |
NOR_CMD_SINGLE_READ |
protos[FLS_QSPI_RX_LINES_SINGLE].cmdRd |
NOR_CMD_QUAD_READ |
protos[FLS_QSPI_RX_LINES_QUAD].cmdRd |
NOR_PAGE_PROG |
protos[FLS_QSPI_RX_LINES_SINGLE].cmdWr protos[FLS_QSPI_RX_LINES_QUAD].cmdWr |
NOR_RDID_NUM_BYTES |
idCfg.numBytes |
NOR_MANF_ID |
manfId |
NOR_DEVICE_ID |
deviceId |
NOR_CMD_WREN |
cmdWren |
NOR_CMD_WRR |
cmdWrsr |
NOR_CMD_RDSR1 |
cmdRdsr |
NOR_CMD_RDCR |
cmdRdsr2 |
NOR_CMD_SECTOR_ERASE |
eraseCfg.cmdSectorErase3B eraseCfg.cmdSectorErase4B |
NOR_CMD_BLOCK_ERASE |
eraseCfg.cmdBlockErase3B eraseCfg.cmdBlockErase4B |
NOR_CMD_BULK_ERASE |
cmdChipErase |
NOR_QUAD_READ_DUMMY_CYCLE |
protos[FLS_QSPI_RX_LINES_QUAD].dummyClksRd |
NOR_BULK_ERASE_TIMEOUT |
chipEraseTimeout |
NOR_WRR_WRITE_TIMEOUT |
wrrwriteTimeout |
NOR_PAGE_PROG_TIMEOUT |
flashWriteTimeout |
NOR_PAGE_SIZE |
pageSize |
NOR_ADDR_NUM_BYTES |
addrnumBytes |
NOR_SIZE |
flashSize |
NOR_SECTOR_SIZE |
eraseCfg.sectorSize |
NOR_BLOCK_SIZE |
eraseCfg.blockSize |
FLASH_PAGE_SIZE |
pageSize |
FLS_QE_BIT |
protos[FLS_QSPI_RX_LINES_QUAD].enableType |