Flash Memory (Flash)

Detailed Description

This section describes the programming interface of the Flash Peripheral Driver.

Data Structures

struct  flash_user_config_t
 Flash User Configuration Structure. More...
 
struct  flash_ssd_config_t
 Flash SSD Configuration Structure. More...
 
struct  flash_eeprom_status_t
 EEPROM status structure. More...
 

Macros

#define FTFx_BASE   FTFC_BASE
 
#define FTFx_FSTAT   FTFC->FSTAT
 
#define FTFx_FCNFG   FTFC->FCNFG
 
#define FTFx_FSEC   FTFC->FSEC
 
#define FTFx_FOPT   FTFC->FOPT
 
#define FTFx_FCCOB3   FTFC->FCCOB[0]
 
#define FTFx_FCCOB2   FTFC->FCCOB[1]
 
#define FTFx_FCCOB1   FTFC->FCCOB[2]
 
#define FTFx_FCCOB0   FTFC->FCCOB[3]
 
#define FTFx_FCCOB7   FTFC->FCCOB[4]
 
#define FTFx_FCCOB6   FTFC->FCCOB[5]
 
#define FTFx_FCCOB5   FTFC->FCCOB[6]
 
#define FTFx_FCCOB4   FTFC->FCCOB[7]
 
#define FTFx_FCCOBB   FTFC->FCCOB[8]
 
#define FTFx_FCCOBA   FTFC->FCCOB[9]
 
#define FTFx_FCCOB9   FTFC->FCCOB[10]
 
#define FTFx_FCCOB8   FTFC->FCCOB[11]
 
#define FTFx_FPROT3   FTFC->FPROT[0]
 
#define FTFx_FPROT2   FTFC->FPROT[1]
 
#define FTFx_FPROT1   FTFC->FPROT[2]
 
#define FTFx_FPROT0   FTFC->FPROT[3]
 
#define FTFx_FEPROT   FTFC->FEPROT
 
#define FTFx_FDPROT   FTFC->FDPROT
 
#define FTFx_FCSESTAT   FTFC->FCSESTAT
 
#define FTFx_FERSTAT   FTFC->FERSTAT
 
#define FTFx_FERCNFG   FTFC->FERCNFG
 
#define FTFx_FSTAT_MGSTAT0_MASK   FTFC_FSTAT_MGSTAT0_MASK
 
#define FTFx_FSTAT_MGSTAT0_SHIFT   FTFC_FSTAT_MGSTAT0_SHIFT
 
#define FTFx_FSTAT_MGSTAT0_WIDTH   FTFC_FSTAT_MGSTAT0_WIDTH
 
#define FTFx_FSTAT_MGSTAT0(x)    FTFC_FSTAT_MGSTAT0(x)
 
#define FTFx_FSTAT_FPVIOL_MASK   FTFC_FSTAT_FPVIOL_MASK
 
#define FTFx_FSTAT_FPVIOL_SHIFT   FTFC_FSTAT_FPVIOL_SHIFT
 
#define FTFx_FSTAT_FPVIOL_WIDTH   FTFC_FSTAT_FPVIOL_WIDTH
 
#define FTFx_FSTAT_FPVIOL(x)    FTFC_FSTAT_FPVIOL(x)
 
#define FTFx_FSTAT_ACCERR_MASK   FTFC_FSTAT_ACCERR_MASK
 
#define FTFx_FSTAT_ACCERR_SHIFT   FTFC_FSTAT_ACCERR_SHIFT
 
#define FTFx_FSTAT_ACCERR_WIDTH   FTFC_FSTAT_ACCERR_WIDTH
 
#define FTFx_FSTAT_ACCERR(x)    FTFC_FSTAT_ACCERR(x)
 
#define FTFx_FSTAT_RDCOLERR_MASK   FTFC_FSTAT_RDCOLERR_MASK
 
#define FTFx_FSTAT_RDCOLERR_SHIFT   FTFC_FSTAT_RDCOLERR_SHIFT
 
#define FTFx_FSTAT_RDCOLERR_WIDTH   FTFC_FSTAT_RDCOLERR_WIDTH
 
#define FTFx_FSTAT_RDCOLERR(x)    FTFC_FSTAT_RDCOLERR(x)
 
#define FTFx_FSTAT_CCIF_MASK   FTFC_FSTAT_CCIF_MASK
 
#define FTFx_FSTAT_CCIF_SHIFT   FTFC_FSTAT_CCIF_SHIFT
 
#define FTFx_FSTAT_CCIF_WIDTH   FTFC_FSTAT_CCIF_WIDTH
 
#define FTFx_FSTAT_CCIF(x)    FTFC_FSTAT_CCIF(x)
 
#define FTFx_FCNFG_EEERDY_MASK   FTFC_FCNFG_EEERDY_MASK
 
#define FTFx_FCNFG_EEERDY_SHIFT   FTFC_FCNFG_EEERDY_SHIFT
 
#define FTFx_FCNFG_EEERDY_WIDTH   FTFC_FCNFG_EEERDY_WIDTH
 
#define FTFx_FCNFG_EEERDY(x)    FTFC_FCNFG_EEERDY(x)
 
#define FTFx_FCNFG_RAMRDY_MASK   FTFC_FCNFG_RAMRDY_MASK
 
#define FTFx_FCNFG_RAMRDY_SHIFT   FTFC_FCNFG_RAMRDY_SHIFT
 
#define FTFx_FCNFG_RAMRDY_WIDTH   FTFC_FCNFG_RAMRDY_WIDTH
 
#define FTFx_FCNFG_RAMRDY(x)    FTFC_FCNFG_RAMRDY(x)
 
#define FTFx_FCNFG_ERSSUSP_MASK   FTFC_FCNFG_ERSSUSP_MASK
 
#define FTFx_FCNFG_ERSSUSP_SHIFT   FTFC_FCNFG_ERSSUSP_SHIFT
 
#define FTFx_FCNFG_ERSSUSP_WIDTH   FTFC_FCNFG_ERSSUSP_WIDTH
 
#define FTFx_FCNFG_ERSSUSP(x)    FTFC_FCNFG_ERSSUSP(x)
 
#define FTFx_FCNFG_ERSAREQ_MASK   FTFC_FCNFG_ERSAREQ_MASK
 
#define FTFx_FCNFG_ERSAREQ_SHIFT   FTFC_FCNFG_ERSAREQ_SHIFT
 
#define FTFx_FCNFG_ERSAREQ_WIDTH   FTFC_FCNFG_ERSAREQ_WIDTH
 
#define FTFx_FCNFG_ERSAREQ(x)    FTFC_FCNFG_ERSAREQ(x)
 
#define FTFx_FCNFG_RDCOLLIE_MASK   FTFC_FCNFG_RDCOLLIE_MASK
 
#define FTFx_FCNFG_RDCOLLIE_SHIFT   FTFC_FCNFG_RDCOLLIE_SHIFT
 
#define FTFx_FCNFG_RDCOLLIE_WIDTH   FTFC_FCNFG_RDCOLLIE_WIDTH
 
#define FTFx_FCNFG_RDCOLLIE(x)    FTFC_FCNFG_RDCOLLIE(x)
 
#define FTFx_FCNFG_CCIE_MASK   FTFC_FCNFG_CCIE_MASK
 
#define FTFx_FCNFG_CCIE_SHIFT   FTFC_FCNFG_CCIE_SHIFT
 
#define FTFx_FCNFG_CCIE_WIDTH   FTFC_FCNFG_CCIE_WIDTH
 
#define FTFx_FCNFG_CCIE(x)    FTFC_FCNFG_CCIE(x)
 
#define FTFx_FSEC_SEC_MASK   FTFC_FSEC_SEC_MASK
 
#define FTFx_FSEC_SEC_SHIFT   FTFC_FSEC_SEC_SHIFT
 
#define FTFx_FSEC_SEC_WIDTH   FTFC_FSEC_SEC_WIDTH
 
#define FTFx_FSEC_SEC(x)    FTFC_FSEC_SEC(x)
 
#define FTFx_FSEC_FSLACC_MASK   FTFC_FSEC_FSLACC_MASK
 
#define FTFx_FSEC_FSLACC_SHIFT   FTFC_FSEC_FSLACC_SHIFT
 
#define FTFx_FSEC_FSLACC_WIDTH   FTFC_FSEC_FSLACC_WIDTH
 
#define FTFx_FSEC_FSLACC(x)    FTFC_FSEC_FSLACC(x)
 
#define FTFx_FSEC_MEEN_MASK   FTFC_FSEC_MEEN_MASK
 
#define FTFx_FSEC_MEEN_SHIFT   FTFC_FSEC_MEEN_SHIFT
 
#define FTFx_FSEC_MEEN_WIDTH   FTFC_FSEC_MEEN_WIDTH
 
#define FTFx_FSEC_MEEN(x)    FTFC_FSEC_MEEN(x)
 
#define FTFx_FSEC_KEYEN_MASK   FTFC_FSEC_KEYEN_MASK
 
#define FTFx_FSEC_KEYEN_SHIFT   FTFC_FSEC_KEYEN_SHIFT
 
#define FTFx_FSEC_KEYEN_WIDTH   FTFC_FSEC_KEYEN_WIDTH
 
#define FTFx_FSEC_KEYEN(x)    FTFC_FSEC_KEYEN(x)
 
#define FTFx_FOPT_OPT_MASK   FTFC_FOPT_OPT_MASK
 
#define FTFx_FOPT_OPT_SHIFT   FTFC_FOPT_OPT_SHIFT
 
#define FTFx_FOPT_OPT_WIDTH   FTFC_FOPT_OPT_WIDTH
 
#define FTFx_FOPT_OPT(x)    FTFC_FOPT_OPT(x)
 
#define FTFx_FCCOB_CCOBn_MASK   FTFC_FCCOB_CCOBn_MASK
 
#define FTFx_FCCOB_CCOBn_SHIFT   FTFC_FCCOB_CCOBn_SHIFT
 
#define FTFx_FCCOB_CCOBn_WIDTH   FTFC_FCCOB_CCOBn_WIDTH
 
#define FTFx_FCCOB_CCOBn(x)    FTFC_FCCOB_CCOBn(x)
 
#define FTFx_FPROT_PROT_MASK   FTFC_FPROT_PROT_MASK
 
#define FTFx_FPROT_PROT_SHIFT   FTFC_FPROT_PROT_SHIFT
 
#define FTFx_FPROT_PROT_WIDTH   FTFC_FPROT_PROT_WIDTH
 
#define FTFx_FPROT_PROT(x)    FTFC_FPROT_PROT(x)
 
#define FTFx_FEPROT_EPROT_MASK   FTFC_FEPROT_EPROT_MASK
 
#define FTFx_FEPROT_EPROT_SHIFT   FTFC_FEPROT_EPROT_SHIFT
 
#define FTFx_FEPROT_EPROT_WIDTH   FTFC_FEPROT_EPROT_WIDTH
 
#define FTFx_FEPROT_EPROT(x)    FTFC_FEPROT_EPROT(x)
 
#define FTFx_FDPROT_DPROT_MASK   FTFC_FDPROT_DPROT_MASK
 
#define FTFx_FDPROT_DPROT_SHIFT   FTFC_FDPROT_DPROT_SHIFT
 
#define FTFx_FDPROT_DPROT_WIDTH   FTFC_FDPROT_DPROT_WIDTH
 
#define FTFx_FDPROT_DPROT(x)    FTFC_FDPROT_DPROT(x)
 
#define FTFx_FCSESTAT_IDB_MASK   FTFC_FCSESTAT_IDB_MASK
 
#define FTFx_FCSESTAT_IDB_SHIFT   FTFC_FCSESTAT_IDB_SHIFT
 
#define FTFx_FCSESTAT_IDB_WIDTH   FTFC_FCSESTAT_IDB_WIDTH
 
#define FTFx_FCSESTAT_IDB(x)    FTFC_FCSESTAT_IDB(x)
 
#define FTFx_FCSESTAT_EDB_MASK   FTFC_FCSESTAT_EDB_MASK
 
#define FTFx_FCSESTAT_EDB_SHIFT   FTFC_FCSESTAT_EDB_SHIFT
 
#define FTFx_FCSESTAT_EDB_WIDTH   FTFC_FCSESTAT_EDB_WIDTH
 
#define FTFx_FCSESTAT_EDB(x)    FTFC_FCSESTAT_EDB(x)
 
#define FTFx_FCSESTAT_RIN_MASK   FTFC_FCSESTAT_RIN_MASK
 
#define FTFx_FCSESTAT_RIN_SHIFT   FTFC_FCSESTAT_RIN_SHIFT
 
#define FTFx_FCSESTAT_RIN_WIDTH   FTFC_FCSESTAT_RIN_WIDTH
 
#define FTFx_FCSESTAT_RIN(x)    FTFC_FCSESTAT_RIN(x)
 
#define FTFx_FCSESTAT_BOK_MASK   FTFC_FCSESTAT_BOK_MASK
 
#define FTFx_FCSESTAT_BOK_SHIFT   FTFC_FCSESTAT_BOK_SHIFT
 
#define FTFx_FCSESTAT_BOK_WIDTH   FTFC_FCSESTAT_BOK_WIDTH
 
#define FTFx_FCSESTAT_BOK(x)    FTFC_FCSESTAT_BOK(x)
 
#define FTFx_FCSESTAT_BFN_MASK   FTFC_FCSESTAT_BFN_MASK
 
#define FTFx_FCSESTAT_BFN_SHIFT   FTFC_FCSESTAT_BFN_SHIFT
 
#define FTFx_FCSESTAT_BFN_WIDTH   FTFC_FCSESTAT_BFN_WIDTH
 
#define FTFx_FCSESTAT_BFN(x)    FTFC_FCSESTAT_BFN(x)
 
#define FTFx_FCSESTAT_BIN_MASK   FTFC_FCSESTAT_BIN_MASK
 
#define FTFx_FCSESTAT_BIN_SHIFT   FTFC_FCSESTAT_BIN_SHIFT
 
#define FTFx_FCSESTAT_BIN_WIDTH   FTFC_FCSESTAT_BIN_WIDTH
 
#define FTFx_FCSESTAT_BIN(x)    FTFC_FCSESTAT_BIN(x)
 
#define FTFx_FCSESTAT_SB_MASK   FTFC_FCSESTAT_SB_MASK
 
#define FTFx_FCSESTAT_SB_SHIFT   FTFC_FCSESTAT_SB_SHIFT
 
#define FTFx_FCSESTAT_SB_WIDTH   FTFC_FCSESTAT_SB_WIDTH
 
#define FTFx_FCSESTAT_SB(x)    FTFC_FCSESTAT_SB(x)
 
#define FTFx_FCSESTAT_BSY_MASK   FTFC_FCSESTAT_BSY_MASK
 
#define FTFx_FCSESTAT_BSY_SHIFT   FTFC_FCSESTAT_BSY_SHIFT
 
#define FTFx_FCSESTAT_BSY_WIDTH   FTFC_FCSESTAT_BSY_WIDTH
 
#define FTFx_FCSESTAT_BSY(x)    FTFC_FCSESTAT_BSY(x)
 
#define FTFx_FERSTAT_DFDIF_MASK   FTFC_FERSTAT_DFDIF_MASK
 
#define FTFx_FERSTAT_DFDIF_SHIFT   FTFC_FERSTAT_DFDIF_SHIFT
 
#define FTFxFERSTAT_DFDIF_WIDTH   FTFC_FERSTAT_DFDIF_WIDTH
 
#define FTFx_FERSTAT_DFDIF(x)    FTFC_FERSTAT_DFDIF(x)
 
#define FTFx_FERCNFG_DFDIE_MASK   FTFC_FERCNFG_DFDIE_MASK
 
#define FTFx_FERCNFG_DFDIE_SHIFT   FTFC_FERCNFG_DFDIE_SHIFT
 
#define FTFx_FERCNFG_DFDIE_WIDTH   FTFC_FERCNFG_DFDIE_WIDTH
 
#define FTFx_FERCNFG_DFDIE(x)    FTFC_FERCNFG_DFDIE(x)
 
#define FTFx_FERCNFG_FDFD_MASK   FTFC_FERCNFG_FDFD_MASK
 
#define FTFx_FERCNFG_FDFD_SHIFT   FTFC_FERCNFG_FDFD_SHIFT
 
#define FTFx_FERCNFG_FDFD_WIDTH   FTFC_FERCNFG_FDFD_WIDTH
 
#define FTFx_FERCNFG_FDFD(x)    FTFC_FERCNFG_FDFD(x)
 
#define CLEAR_FTFx_FSTAT_ERROR_BITS   FTFx_FSTAT = (uint8_t)(FTFx_FSTAT_FPVIOL_MASK | FTFx_FSTAT_ACCERR_MASK | FTFx_FSTAT_RDCOLERR_MASK)
 
#define FTFx_WORD_SIZE   0x0002U
 
#define FTFx_LONGWORD_SIZE   0x0004U
 
#define FTFx_PHRASE_SIZE   0x0008U
 
#define FTFx_DPHRASE_SIZE   0x0010U
 
#define FTFx_RSRC_CODE_REG   FTFx_FCCOB4
 
#define FTFx_VERIFY_BLOCK   0x00U
 
#define FTFx_VERIFY_SECTION   0x01U
 
#define FTFx_PROGRAM_CHECK   0x02U
 
#define FTFx_READ_RESOURCE   0x03U
 
#define FTFx_PROGRAM_LONGWORD   0x06U
 
#define FTFx_PROGRAM_PHRASE   0x07U
 
#define FTFx_ERASE_BLOCK   0x08U
 
#define FTFx_ERASE_SECTOR   0x09U
 
#define FTFx_PROGRAM_SECTION   0x0BU
 
#define FTFx_VERIFY_ALL_BLOCK   0x40U
 
#define FTFx_READ_ONCE   0x41U
 
#define FTFx_PROGRAM_ONCE   0x43U
 
#define FTFx_ERASE_ALL_BLOCK   0x44U
 
#define FTFx_SECURITY_BY_PASS   0x45U
 
#define FTFx_PFLASH_SWAP   0x46U
 
#define FTFx_ERASE_ALL_BLOCK_UNSECURE   0x49U
 
#define FTFx_PROGRAM_PARTITION   0x80U
 
#define FTFx_SET_EERAM   0x81U
 
#define RESUME_WAIT_CNT   0x20U
 Resume wait count used in FLASH_DRV_EraseResume function. More...
 
#define SUSPEND_WAIT_CNT   0x40U
 Suspend wait count used in FLASH_DRV_EraseSuspend function. More...
 
#define DFLASH_IFR_READRESOURCE_ADDRESS   0x8000FCU
 
#define GET_BIT_0_7(value)    ((uint8_t)(((uint32_t)(value)) & 0xFFU))
 
#define GET_BIT_8_15(value)   ((uint8_t)((((uint32_t)(value)) >> 8) & 0xFFU))
 
#define GET_BIT_16_23(value)   ((uint8_t)((((uint32_t)(value)) >> 16) & 0xFFU))
 
#define GET_BIT_24_31(value)   ((uint8_t)(((uint32_t)(value)) >> 24))
 
#define FLASH_SECURITY_STATE_KEYEN   0x80U
 
#define FLASH_SECURITY_STATE_UNSECURED   0x02U
 
#define CSE_KEY_SIZE_CODE_MAX   0x03U
 
#define FLASH_CALLBACK_CS   0x0AU
 Callback period count for FlashCheckSum. More...
 

Typedefs

typedef void(* flash_callback_t) (void)
 Call back function pointer data type. More...
 

Enumerations

enum  flash_flexRam_function_control_code_t {
  EEE_ENABLE = 0x00U, EEE_QUICK_WRITE = 0x55U, EEE_STATUS_QUERY = 0x77U, EEE_COMPLETE_INTERRUPT_QUICK_WRITE = 0xAAU,
  EEE_DISABLE = 0xFFU
}
 FlexRAM Function control Code. More...
 

Variables

uint32_t PFlashBase
 
uint32_t PFlashSize
 
uint32_t DFlashBase
 
uint32_t EERAMBase
 
flash_callback_t CallBack
 
uint32_t PFlashBase
 
uint32_t PFlashSize
 
uint32_t DFlashBase
 
uint32_t DFlashSize
 
uint32_t EERAMBase
 
uint32_t EEESize
 
flash_callback_t CallBack
 
uint8_t brownOutCode
 
uint16_t numOfRecordReqMaintain
 
uint16_t sectorEraseCount
 

PFlash swap control codes

#define FTFx_SWAP_SET_INDICATOR_ADDR   0x01U
 Initialize Swap System control code. More...
 
#define FTFx_SWAP_SET_IN_PREPARE   0x02U
 Set Swap in Update State. More...
 
#define FTFx_SWAP_SET_IN_COMPLETE   0x04U
 Set Swap in Complete State. More...
 
#define FTFx_SWAP_REPORT_STATUS   0x08U
 Report Swap Status. More...
 

PFlash swap states

#define FTFx_SWAP_UNINIT   0x00U
 Uninitialized swap mode. More...
 
#define FTFx_SWAP_READY   0x01U
 Ready swap mode. More...
 
#define FTFx_SWAP_UPDATE   0x02U
 Update swap mode. More...
 
#define FTFx_SWAP_UPDATE_ERASED   0x03U
 Update-Erased swap mode. More...
 
#define FTFx_SWAP_COMPLETE   0x04U
 Complete swap mode. More...
 

Flash security status

#define FLASH_NOT_SECURE   0x01U
 Flash currently not in secure state. More...
 
#define FLASH_SECURE_BACKDOOR_ENABLED   0x02U
 Flash is secured and backdoor key access enabled. More...
 
#define FLASH_SECURE_BACKDOOR_DISABLED   0x04U
 Flash is secured and backdoor key access disabled. More...
 

Null Callback function definition

#define NULL_CALLBACK   ((flash_callback_t)0xFFFFFFFFU)
 Null callback. More...
 

Flash driver APIs

status_t FLASH_DRV_Init (const flash_user_config_t *const pUserConf, flash_ssd_config_t *const pSSDConfig)
 Initializes Flash. More...
 
void FLASH_DRV_GetPFlashProtection (uint32_t *protectStatus)
 P-Flash get protection. More...
 
status_t FLASH_DRV_SetPFlashProtection (uint32_t protectStatus)
 P-Flash set protection. More...
 
void FLASH_DRV_GetSecurityState (uint8_t *securityState)
 Flash get security state. More...
 
status_t FLASH_DRV_SecurityBypass (const flash_ssd_config_t *pSSDConfig, const uint8_t *keyBuffer)
 Flash security bypass. More...
 
status_t FLASH_DRV_EraseAllBlock (const flash_ssd_config_t *pSSDConfig)
 Flash erase all blocks. More...
 
status_t FLASH_DRV_VerifyAllBlock (const flash_ssd_config_t *pSSDConfig, uint8_t marginLevel)
 Flash verify all blocks. More...
 
status_t FLASH_DRV_EraseSector (const flash_ssd_config_t *pSSDConfig, uint32_t dest, uint32_t size)
 Flash erase sector. More...
 
status_t FLASH_DRV_VerifySection (const flash_ssd_config_t *pSSDConfig, uint32_t dest, uint16_t number, uint8_t marginLevel)
 Flash verify section. More...
 
void FLASH_DRV_EraseSuspend (void)
 Flash erase suspend. More...
 
void FLASH_DRV_EraseResume (void)
 Flash erase resume. More...
 
status_t FLASH_DRV_ReadOnce (const flash_ssd_config_t *pSSDConfig, uint8_t recordIndex, uint8_t *pDataArray)
 Flash read once. More...
 
status_t FLASH_DRV_ProgramOnce (const flash_ssd_config_t *pSSDConfig, uint8_t recordIndex, const uint8_t *pDataArray)
 Flash program once. More...
 
status_t FLASH_DRV_Program (const flash_ssd_config_t *pSSDConfig, uint32_t dest, uint32_t size, const uint8_t *pData)
 Flash program. More...
 
status_t FLASH_DRV_ProgramCheck (const flash_ssd_config_t *pSSDConfig, uint32_t dest, uint32_t size, const uint8_t *pExpectedData, uint32_t *pFailAddr, uint8_t marginLevel)
 Flash program check. More...
 
status_t FLASH_DRV_CheckSum (const flash_ssd_config_t *pSSDConfig, uint32_t dest, uint32_t size, uint32_t *pSum)
 Calculates check sum. More...
 
status_t FLASH_DRV_ProgramSection (const flash_ssd_config_t *pSSDConfig, uint32_t dest, uint16_t number)
 Flash program section. More...
 
status_t FLASH_DRV_EraseBlock (const flash_ssd_config_t *pSSDConfig, uint32_t dest)
 Flash erase block. More...
 
status_t FLASH_DRV_VerifyBlock (const flash_ssd_config_t *pSSDConfig, uint32_t dest, uint8_t marginLevel)
 Flash verify block. More...
 
status_t FLASH_DRV_GetEERAMProtection (uint8_t *protectStatus)
 EERAM get protection. More...
 
status_t FLASH_DRV_SetEERAMProtection (uint8_t protectStatus)
 EERAM set protection. More...
 
status_t FLASH_DRV_SetFlexRamFunction (const flash_ssd_config_t *pSSDConfig, flash_flexRam_function_control_code_t flexRamFuncCode, uint16_t byteOfQuickWrite, flash_eeprom_status_t *const pEEPROMStatus)
 Set FlexRAM function. More...
 
status_t FLASH_DRV_EEEWrite (const flash_ssd_config_t *pSSDConfig, uint32_t dest, uint32_t size, const uint8_t *pData)
 EEPROM Emulator Write. More...
 
status_t FLASH_DRV_DEFlashPartition (const flash_ssd_config_t *pSSDConfig, uint8_t uEEEDataSizeCode, uint8_t uDEPartitionCode, uint8_t uCSEcKeySize, bool uSFE, bool flexRamEnableLoadEEEData)
 Flash D/E-Flash Partition. More...
 
status_t FLASH_DRV_GetDFlashProtection (const flash_ssd_config_t *pSSDConfig, uint8_t *protectStatus)
 D-Flash get protection. More...
 
status_t FLASH_DRV_SetDFlashProtection (const flash_ssd_config_t *pSSDConfig, uint8_t protectStatus)
 D-Flash set protection. More...
 
status_t FLASH_DRV_EraseAllBlockUnsecure (const flash_ssd_config_t *pSSDConfig)
 Flash erase all blocks unsecure. More...
 
status_t FLASH_DRV_EnableCmdCompleteInterupt (void)
 Enable the command complete interrupt. More...
 
void FLASH_DRV_DisableCmdCompleteInterupt (void)
 Disable the command complete interrupt. More...
 
static bool FLASH_DRV_GetCmdCompleteFlag (void)
 Check the command complete flag has completed or not. More...
 
status_t FLASH_DRV_EnableReadColisionInterupt (void)
 Enable the read collision error interrupt. More...
 
void FLASH_DRV_DisableReadColisionInterupt (void)
 Disable the read collision error interrupt. More...
 
static bool FLASH_DRV_GetReadColisionFlag (void)
 Check the read collision error flag is detected or not. More...
 
static void FLASH_DRV_ClearReadColisionFlag (void)
 Clear the read collision error flag. More...
 
status_t FLASH_DRV_EnableDoubleBitFaultInterupt (void)
 Enable the double bit fault detect interrupt. More...
 
void FLASH_DRV_DisableDoubleBitFaultInterupt (void)
 Disable the double bit fault detect interrupt. More...
 
static bool FLASH_DRV_GetDoubleBitFaultFlag (void)
 Check the double bit fault flag is detected during a valid flash read access. More...
 
static void FLASH_DRV_ClearDoubleBitFaultFlag (void)
 Clear the double bit fault detect flag. More...
 
static void FLASH_DRV_ForceDoubleBitFaultDetectCmd (bool isEnable)
 Force Double Bit Fault Detect. More...
 

Macro Definition Documentation

#define CLEAR_FTFx_FSTAT_ERROR_BITS   FTFx_FSTAT = (uint8_t)(FTFx_FSTAT_FPVIOL_MASK | FTFx_FSTAT_ACCERR_MASK | FTFx_FSTAT_RDCOLERR_MASK)

Definition at line 380 of file flash_driver.h.

#define CSE_KEY_SIZE_CODE_MAX   0x03U

Definition at line 472 of file flash_driver.h.

#define DFLASH_IFR_READRESOURCE_ADDRESS   0x8000FCU

Definition at line 459 of file flash_driver.h.

#define FLASH_CALLBACK_CS   0x0AU

Callback period count for FlashCheckSum.

This value is only relevant for FlashCheckSum operation, where a high rate of calling back can impair performance. The rest of the flash operations invoke the callback as often as possible while waiting for the flash controller to finish the requested operation.

Definition at line 515 of file flash_driver.h.

#define FLASH_NOT_SECURE   0x01U

Flash currently not in secure state.

Definition at line 498 of file flash_driver.h.

#define FLASH_SECURE_BACKDOOR_DISABLED   0x04U

Flash is secured and backdoor key access disabled.

Definition at line 502 of file flash_driver.h.

#define FLASH_SECURE_BACKDOOR_ENABLED   0x02U

Flash is secured and backdoor key access enabled.

Definition at line 500 of file flash_driver.h.

#define FLASH_SECURITY_STATE_KEYEN   0x80U

Definition at line 468 of file flash_driver.h.

#define FLASH_SECURITY_STATE_UNSECURED   0x02U

Definition at line 469 of file flash_driver.h.

#define FTFx_BASE   FTFC_BASE

Definition at line 210 of file flash_driver.h.

#define FTFx_DPHRASE_SIZE   0x0010U

Definition at line 389 of file flash_driver.h.

#define FTFx_ERASE_ALL_BLOCK   0x44U

Definition at line 413 of file flash_driver.h.

#define FTFx_ERASE_ALL_BLOCK_UNSECURE   0x49U

Definition at line 416 of file flash_driver.h.

#define FTFx_ERASE_BLOCK   0x08U

Definition at line 407 of file flash_driver.h.

#define FTFx_ERASE_SECTOR   0x09U

Definition at line 408 of file flash_driver.h.

#define FTFx_FCCOB0   FTFC->FCCOB[3]

Definition at line 218 of file flash_driver.h.

#define FTFx_FCCOB1   FTFC->FCCOB[2]

Definition at line 217 of file flash_driver.h.

#define FTFx_FCCOB2   FTFC->FCCOB[1]

Definition at line 216 of file flash_driver.h.

#define FTFx_FCCOB3   FTFC->FCCOB[0]

Definition at line 215 of file flash_driver.h.

#define FTFx_FCCOB4   FTFC->FCCOB[7]

Definition at line 222 of file flash_driver.h.

#define FTFx_FCCOB5   FTFC->FCCOB[6]

Definition at line 221 of file flash_driver.h.

#define FTFx_FCCOB6   FTFC->FCCOB[5]

Definition at line 220 of file flash_driver.h.

#define FTFx_FCCOB7   FTFC->FCCOB[4]

Definition at line 219 of file flash_driver.h.

#define FTFx_FCCOB8   FTFC->FCCOB[11]

Definition at line 226 of file flash_driver.h.

#define FTFx_FCCOB9   FTFC->FCCOB[10]

Definition at line 225 of file flash_driver.h.

#define FTFx_FCCOB_CCOBn (   x)    FTFC_FCCOB_CCOBn(x)

Definition at line 310 of file flash_driver.h.

#define FTFx_FCCOB_CCOBn_MASK   FTFC_FCCOB_CCOBn_MASK

Definition at line 307 of file flash_driver.h.

#define FTFx_FCCOB_CCOBn_SHIFT   FTFC_FCCOB_CCOBn_SHIFT

Definition at line 308 of file flash_driver.h.

#define FTFx_FCCOB_CCOBn_WIDTH   FTFC_FCCOB_CCOBn_WIDTH

Definition at line 309 of file flash_driver.h.

#define FTFx_FCCOBA   FTFC->FCCOB[9]

Definition at line 224 of file flash_driver.h.

#define FTFx_FCCOBB   FTFC->FCCOB[8]

Definition at line 223 of file flash_driver.h.

#define FTFx_FCNFG   FTFC->FCNFG

Definition at line 212 of file flash_driver.h.

#define FTFx_FCNFG_CCIE (   x)    FTFC_FCNFG_CCIE(x)

Definition at line 283 of file flash_driver.h.

#define FTFx_FCNFG_CCIE_MASK   FTFC_FCNFG_CCIE_MASK

Definition at line 280 of file flash_driver.h.

#define FTFx_FCNFG_CCIE_SHIFT   FTFC_FCNFG_CCIE_SHIFT

Definition at line 281 of file flash_driver.h.

#define FTFx_FCNFG_CCIE_WIDTH   FTFC_FCNFG_CCIE_WIDTH

Definition at line 282 of file flash_driver.h.

#define FTFx_FCNFG_EEERDY (   x)    FTFC_FCNFG_EEERDY(x)

Definition at line 263 of file flash_driver.h.

#define FTFx_FCNFG_EEERDY_MASK   FTFC_FCNFG_EEERDY_MASK

Definition at line 260 of file flash_driver.h.

#define FTFx_FCNFG_EEERDY_SHIFT   FTFC_FCNFG_EEERDY_SHIFT

Definition at line 261 of file flash_driver.h.

#define FTFx_FCNFG_EEERDY_WIDTH   FTFC_FCNFG_EEERDY_WIDTH

Definition at line 262 of file flash_driver.h.

#define FTFx_FCNFG_ERSAREQ (   x)    FTFC_FCNFG_ERSAREQ(x)

Definition at line 275 of file flash_driver.h.

#define FTFx_FCNFG_ERSAREQ_MASK   FTFC_FCNFG_ERSAREQ_MASK

Definition at line 272 of file flash_driver.h.

#define FTFx_FCNFG_ERSAREQ_SHIFT   FTFC_FCNFG_ERSAREQ_SHIFT

Definition at line 273 of file flash_driver.h.

#define FTFx_FCNFG_ERSAREQ_WIDTH   FTFC_FCNFG_ERSAREQ_WIDTH

Definition at line 274 of file flash_driver.h.

#define FTFx_FCNFG_ERSSUSP (   x)    FTFC_FCNFG_ERSSUSP(x)

Definition at line 271 of file flash_driver.h.

#define FTFx_FCNFG_ERSSUSP_MASK   FTFC_FCNFG_ERSSUSP_MASK

Definition at line 268 of file flash_driver.h.

#define FTFx_FCNFG_ERSSUSP_SHIFT   FTFC_FCNFG_ERSSUSP_SHIFT

Definition at line 269 of file flash_driver.h.

#define FTFx_FCNFG_ERSSUSP_WIDTH   FTFC_FCNFG_ERSSUSP_WIDTH

Definition at line 270 of file flash_driver.h.

#define FTFx_FCNFG_RAMRDY (   x)    FTFC_FCNFG_RAMRDY(x)

Definition at line 267 of file flash_driver.h.

#define FTFx_FCNFG_RAMRDY_MASK   FTFC_FCNFG_RAMRDY_MASK

Definition at line 264 of file flash_driver.h.

#define FTFx_FCNFG_RAMRDY_SHIFT   FTFC_FCNFG_RAMRDY_SHIFT

Definition at line 265 of file flash_driver.h.

#define FTFx_FCNFG_RAMRDY_WIDTH   FTFC_FCNFG_RAMRDY_WIDTH

Definition at line 266 of file flash_driver.h.

#define FTFx_FCNFG_RDCOLLIE (   x)    FTFC_FCNFG_RDCOLLIE(x)

Definition at line 279 of file flash_driver.h.

#define FTFx_FCNFG_RDCOLLIE_MASK   FTFC_FCNFG_RDCOLLIE_MASK

Definition at line 276 of file flash_driver.h.

#define FTFx_FCNFG_RDCOLLIE_SHIFT   FTFC_FCNFG_RDCOLLIE_SHIFT

Definition at line 277 of file flash_driver.h.

#define FTFx_FCNFG_RDCOLLIE_WIDTH   FTFC_FCNFG_RDCOLLIE_WIDTH

Definition at line 278 of file flash_driver.h.

#define FTFx_FCSESTAT   FTFC->FCSESTAT

Definition at line 233 of file flash_driver.h.

#define FTFx_FCSESTAT_BFN (   x)    FTFC_FCSESTAT_BFN(x)

Definition at line 346 of file flash_driver.h.

#define FTFx_FCSESTAT_BFN_MASK   FTFC_FCSESTAT_BFN_MASK

Definition at line 343 of file flash_driver.h.

#define FTFx_FCSESTAT_BFN_SHIFT   FTFC_FCSESTAT_BFN_SHIFT

Definition at line 344 of file flash_driver.h.

#define FTFx_FCSESTAT_BFN_WIDTH   FTFC_FCSESTAT_BFN_WIDTH

Definition at line 345 of file flash_driver.h.

#define FTFx_FCSESTAT_BIN (   x)    FTFC_FCSESTAT_BIN(x)

Definition at line 350 of file flash_driver.h.

#define FTFx_FCSESTAT_BIN_MASK   FTFC_FCSESTAT_BIN_MASK

Definition at line 347 of file flash_driver.h.

#define FTFx_FCSESTAT_BIN_SHIFT   FTFC_FCSESTAT_BIN_SHIFT

Definition at line 348 of file flash_driver.h.

#define FTFx_FCSESTAT_BIN_WIDTH   FTFC_FCSESTAT_BIN_WIDTH

Definition at line 349 of file flash_driver.h.

#define FTFx_FCSESTAT_BOK (   x)    FTFC_FCSESTAT_BOK(x)

Definition at line 342 of file flash_driver.h.

#define FTFx_FCSESTAT_BOK_MASK   FTFC_FCSESTAT_BOK_MASK

Definition at line 339 of file flash_driver.h.

#define FTFx_FCSESTAT_BOK_SHIFT   FTFC_FCSESTAT_BOK_SHIFT

Definition at line 340 of file flash_driver.h.

#define FTFx_FCSESTAT_BOK_WIDTH   FTFC_FCSESTAT_BOK_WIDTH

Definition at line 341 of file flash_driver.h.

#define FTFx_FCSESTAT_BSY (   x)    FTFC_FCSESTAT_BSY(x)

Definition at line 358 of file flash_driver.h.

#define FTFx_FCSESTAT_BSY_MASK   FTFC_FCSESTAT_BSY_MASK

Definition at line 355 of file flash_driver.h.

#define FTFx_FCSESTAT_BSY_SHIFT   FTFC_FCSESTAT_BSY_SHIFT

Definition at line 356 of file flash_driver.h.

#define FTFx_FCSESTAT_BSY_WIDTH   FTFC_FCSESTAT_BSY_WIDTH

Definition at line 357 of file flash_driver.h.

#define FTFx_FCSESTAT_EDB (   x)    FTFC_FCSESTAT_EDB(x)

Definition at line 334 of file flash_driver.h.

#define FTFx_FCSESTAT_EDB_MASK   FTFC_FCSESTAT_EDB_MASK

Definition at line 331 of file flash_driver.h.

#define FTFx_FCSESTAT_EDB_SHIFT   FTFC_FCSESTAT_EDB_SHIFT

Definition at line 332 of file flash_driver.h.

#define FTFx_FCSESTAT_EDB_WIDTH   FTFC_FCSESTAT_EDB_WIDTH

Definition at line 333 of file flash_driver.h.

#define FTFx_FCSESTAT_IDB (   x)    FTFC_FCSESTAT_IDB(x)

Definition at line 330 of file flash_driver.h.

#define FTFx_FCSESTAT_IDB_MASK   FTFC_FCSESTAT_IDB_MASK

Definition at line 327 of file flash_driver.h.

#define FTFx_FCSESTAT_IDB_SHIFT   FTFC_FCSESTAT_IDB_SHIFT

Definition at line 328 of file flash_driver.h.

#define FTFx_FCSESTAT_IDB_WIDTH   FTFC_FCSESTAT_IDB_WIDTH

Definition at line 329 of file flash_driver.h.

#define FTFx_FCSESTAT_RIN (   x)    FTFC_FCSESTAT_RIN(x)

Definition at line 338 of file flash_driver.h.

#define FTFx_FCSESTAT_RIN_MASK   FTFC_FCSESTAT_RIN_MASK

Definition at line 335 of file flash_driver.h.

#define FTFx_FCSESTAT_RIN_SHIFT   FTFC_FCSESTAT_RIN_SHIFT

Definition at line 336 of file flash_driver.h.

#define FTFx_FCSESTAT_RIN_WIDTH   FTFC_FCSESTAT_RIN_WIDTH

Definition at line 337 of file flash_driver.h.

#define FTFx_FCSESTAT_SB (   x)    FTFC_FCSESTAT_SB(x)

Definition at line 354 of file flash_driver.h.

#define FTFx_FCSESTAT_SB_MASK   FTFC_FCSESTAT_SB_MASK

Definition at line 351 of file flash_driver.h.

#define FTFx_FCSESTAT_SB_SHIFT   FTFC_FCSESTAT_SB_SHIFT

Definition at line 352 of file flash_driver.h.

#define FTFx_FCSESTAT_SB_WIDTH   FTFC_FCSESTAT_SB_WIDTH

Definition at line 353 of file flash_driver.h.

#define FTFx_FDPROT   FTFC->FDPROT

Definition at line 232 of file flash_driver.h.

#define FTFx_FDPROT_DPROT (   x)    FTFC_FDPROT_DPROT(x)

Definition at line 325 of file flash_driver.h.

#define FTFx_FDPROT_DPROT_MASK   FTFC_FDPROT_DPROT_MASK

Definition at line 322 of file flash_driver.h.

#define FTFx_FDPROT_DPROT_SHIFT   FTFC_FDPROT_DPROT_SHIFT

Definition at line 323 of file flash_driver.h.

#define FTFx_FDPROT_DPROT_WIDTH   FTFC_FDPROT_DPROT_WIDTH

Definition at line 324 of file flash_driver.h.

#define FTFx_FEPROT   FTFC->FEPROT

Definition at line 231 of file flash_driver.h.

#define FTFx_FEPROT_EPROT (   x)    FTFC_FEPROT_EPROT(x)

Definition at line 320 of file flash_driver.h.

#define FTFx_FEPROT_EPROT_MASK   FTFC_FEPROT_EPROT_MASK

Definition at line 317 of file flash_driver.h.

#define FTFx_FEPROT_EPROT_SHIFT   FTFC_FEPROT_EPROT_SHIFT

Definition at line 318 of file flash_driver.h.

#define FTFx_FEPROT_EPROT_WIDTH   FTFC_FEPROT_EPROT_WIDTH

Definition at line 319 of file flash_driver.h.

#define FTFx_FERCNFG   FTFC->FERCNFG

Definition at line 236 of file flash_driver.h.

#define FTFx_FERCNFG_DFDIE (   x)    FTFC_FERCNFG_DFDIE(x)

Definition at line 369 of file flash_driver.h.

#define FTFx_FERCNFG_DFDIE_MASK   FTFC_FERCNFG_DFDIE_MASK

Definition at line 366 of file flash_driver.h.

#define FTFx_FERCNFG_DFDIE_SHIFT   FTFC_FERCNFG_DFDIE_SHIFT

Definition at line 367 of file flash_driver.h.

#define FTFx_FERCNFG_DFDIE_WIDTH   FTFC_FERCNFG_DFDIE_WIDTH

Definition at line 368 of file flash_driver.h.

#define FTFx_FERCNFG_FDFD (   x)    FTFC_FERCNFG_FDFD(x)

Definition at line 373 of file flash_driver.h.

#define FTFx_FERCNFG_FDFD_MASK   FTFC_FERCNFG_FDFD_MASK

Definition at line 370 of file flash_driver.h.

#define FTFx_FERCNFG_FDFD_SHIFT   FTFC_FERCNFG_FDFD_SHIFT

Definition at line 371 of file flash_driver.h.

#define FTFx_FERCNFG_FDFD_WIDTH   FTFC_FERCNFG_FDFD_WIDTH

Definition at line 372 of file flash_driver.h.

#define FTFx_FERSTAT   FTFC->FERSTAT

Definition at line 235 of file flash_driver.h.

#define FTFx_FERSTAT_DFDIF (   x)    FTFC_FERSTAT_DFDIF(x)

Definition at line 364 of file flash_driver.h.

#define FTFx_FERSTAT_DFDIF_MASK   FTFC_FERSTAT_DFDIF_MASK

Definition at line 361 of file flash_driver.h.

#define FTFx_FERSTAT_DFDIF_SHIFT   FTFC_FERSTAT_DFDIF_SHIFT

Definition at line 362 of file flash_driver.h.

#define FTFx_FOPT   FTFC->FOPT

Definition at line 214 of file flash_driver.h.

#define FTFx_FOPT_OPT (   x)    FTFC_FOPT_OPT(x)

Definition at line 305 of file flash_driver.h.

#define FTFx_FOPT_OPT_MASK   FTFC_FOPT_OPT_MASK

Definition at line 302 of file flash_driver.h.

#define FTFx_FOPT_OPT_SHIFT   FTFC_FOPT_OPT_SHIFT

Definition at line 303 of file flash_driver.h.

#define FTFx_FOPT_OPT_WIDTH   FTFC_FOPT_OPT_WIDTH

Definition at line 304 of file flash_driver.h.

#define FTFx_FPROT0   FTFC->FPROT[3]

Definition at line 230 of file flash_driver.h.

#define FTFx_FPROT1   FTFC->FPROT[2]

Definition at line 229 of file flash_driver.h.

#define FTFx_FPROT2   FTFC->FPROT[1]

Definition at line 228 of file flash_driver.h.

#define FTFx_FPROT3   FTFC->FPROT[0]

Definition at line 227 of file flash_driver.h.

#define FTFx_FPROT_PROT (   x)    FTFC_FPROT_PROT(x)

Definition at line 315 of file flash_driver.h.

#define FTFx_FPROT_PROT_MASK   FTFC_FPROT_PROT_MASK

Definition at line 312 of file flash_driver.h.

#define FTFx_FPROT_PROT_SHIFT   FTFC_FPROT_PROT_SHIFT

Definition at line 313 of file flash_driver.h.

#define FTFx_FPROT_PROT_WIDTH   FTFC_FPROT_PROT_WIDTH

Definition at line 314 of file flash_driver.h.

#define FTFx_FSEC   FTFC->FSEC

Definition at line 213 of file flash_driver.h.

#define FTFx_FSEC_FSLACC (   x)    FTFC_FSEC_FSLACC(x)

Definition at line 292 of file flash_driver.h.

#define FTFx_FSEC_FSLACC_MASK   FTFC_FSEC_FSLACC_MASK

Definition at line 289 of file flash_driver.h.

#define FTFx_FSEC_FSLACC_SHIFT   FTFC_FSEC_FSLACC_SHIFT

Definition at line 290 of file flash_driver.h.

#define FTFx_FSEC_FSLACC_WIDTH   FTFC_FSEC_FSLACC_WIDTH

Definition at line 291 of file flash_driver.h.

#define FTFx_FSEC_KEYEN (   x)    FTFC_FSEC_KEYEN(x)

Definition at line 300 of file flash_driver.h.

#define FTFx_FSEC_KEYEN_MASK   FTFC_FSEC_KEYEN_MASK

Definition at line 297 of file flash_driver.h.

#define FTFx_FSEC_KEYEN_SHIFT   FTFC_FSEC_KEYEN_SHIFT

Definition at line 298 of file flash_driver.h.

#define FTFx_FSEC_KEYEN_WIDTH   FTFC_FSEC_KEYEN_WIDTH

Definition at line 299 of file flash_driver.h.

#define FTFx_FSEC_MEEN (   x)    FTFC_FSEC_MEEN(x)

Definition at line 296 of file flash_driver.h.

#define FTFx_FSEC_MEEN_MASK   FTFC_FSEC_MEEN_MASK

Definition at line 293 of file flash_driver.h.

#define FTFx_FSEC_MEEN_SHIFT   FTFC_FSEC_MEEN_SHIFT

Definition at line 294 of file flash_driver.h.

#define FTFx_FSEC_MEEN_WIDTH   FTFC_FSEC_MEEN_WIDTH

Definition at line 295 of file flash_driver.h.

#define FTFx_FSEC_SEC (   x)    FTFC_FSEC_SEC(x)

Definition at line 288 of file flash_driver.h.

#define FTFx_FSEC_SEC_MASK   FTFC_FSEC_SEC_MASK

Definition at line 285 of file flash_driver.h.

#define FTFx_FSEC_SEC_SHIFT   FTFC_FSEC_SEC_SHIFT

Definition at line 286 of file flash_driver.h.

#define FTFx_FSEC_SEC_WIDTH   FTFC_FSEC_SEC_WIDTH

Definition at line 287 of file flash_driver.h.

#define FTFx_FSTAT   FTFC->FSTAT

Definition at line 211 of file flash_driver.h.

#define FTFx_FSTAT_ACCERR (   x)    FTFC_FSTAT_ACCERR(x)

Definition at line 250 of file flash_driver.h.

#define FTFx_FSTAT_ACCERR_MASK   FTFC_FSTAT_ACCERR_MASK

Definition at line 247 of file flash_driver.h.

#define FTFx_FSTAT_ACCERR_SHIFT   FTFC_FSTAT_ACCERR_SHIFT

Definition at line 248 of file flash_driver.h.

#define FTFx_FSTAT_ACCERR_WIDTH   FTFC_FSTAT_ACCERR_WIDTH

Definition at line 249 of file flash_driver.h.

#define FTFx_FSTAT_CCIF (   x)    FTFC_FSTAT_CCIF(x)

Definition at line 258 of file flash_driver.h.

#define FTFx_FSTAT_CCIF_MASK   FTFC_FSTAT_CCIF_MASK

Definition at line 255 of file flash_driver.h.

#define FTFx_FSTAT_CCIF_SHIFT   FTFC_FSTAT_CCIF_SHIFT

Definition at line 256 of file flash_driver.h.

#define FTFx_FSTAT_CCIF_WIDTH   FTFC_FSTAT_CCIF_WIDTH

Definition at line 257 of file flash_driver.h.

#define FTFx_FSTAT_FPVIOL (   x)    FTFC_FSTAT_FPVIOL(x)

Definition at line 246 of file flash_driver.h.

#define FTFx_FSTAT_FPVIOL_MASK   FTFC_FSTAT_FPVIOL_MASK

Definition at line 243 of file flash_driver.h.

#define FTFx_FSTAT_FPVIOL_SHIFT   FTFC_FSTAT_FPVIOL_SHIFT

Definition at line 244 of file flash_driver.h.

#define FTFx_FSTAT_FPVIOL_WIDTH   FTFC_FSTAT_FPVIOL_WIDTH

Definition at line 245 of file flash_driver.h.

#define FTFx_FSTAT_MGSTAT0 (   x)    FTFC_FSTAT_MGSTAT0(x)

Definition at line 242 of file flash_driver.h.

#define FTFx_FSTAT_MGSTAT0_MASK   FTFC_FSTAT_MGSTAT0_MASK

Definition at line 239 of file flash_driver.h.

#define FTFx_FSTAT_MGSTAT0_SHIFT   FTFC_FSTAT_MGSTAT0_SHIFT

Definition at line 240 of file flash_driver.h.

#define FTFx_FSTAT_MGSTAT0_WIDTH   FTFC_FSTAT_MGSTAT0_WIDTH

Definition at line 241 of file flash_driver.h.

#define FTFx_FSTAT_RDCOLERR (   x)    FTFC_FSTAT_RDCOLERR(x)

Definition at line 254 of file flash_driver.h.

#define FTFx_FSTAT_RDCOLERR_MASK   FTFC_FSTAT_RDCOLERR_MASK

Definition at line 251 of file flash_driver.h.

#define FTFx_FSTAT_RDCOLERR_SHIFT   FTFC_FSTAT_RDCOLERR_SHIFT

Definition at line 252 of file flash_driver.h.

#define FTFx_FSTAT_RDCOLERR_WIDTH   FTFC_FSTAT_RDCOLERR_WIDTH

Definition at line 253 of file flash_driver.h.

#define FTFx_LONGWORD_SIZE   0x0004U

Definition at line 385 of file flash_driver.h.

#define FTFx_PFLASH_SWAP   0x46U

Definition at line 415 of file flash_driver.h.

#define FTFx_PHRASE_SIZE   0x0008U

Definition at line 387 of file flash_driver.h.

#define FTFx_PROGRAM_CHECK   0x02U

Definition at line 403 of file flash_driver.h.

#define FTFx_PROGRAM_LONGWORD   0x06U

Definition at line 405 of file flash_driver.h.

#define FTFx_PROGRAM_ONCE   0x43U

Definition at line 412 of file flash_driver.h.

#define FTFx_PROGRAM_PARTITION   0x80U

Definition at line 417 of file flash_driver.h.

#define FTFx_PROGRAM_PHRASE   0x07U

Definition at line 406 of file flash_driver.h.

#define FTFx_PROGRAM_SECTION   0x0BU

Definition at line 409 of file flash_driver.h.

#define FTFx_READ_ONCE   0x41U

Definition at line 411 of file flash_driver.h.

#define FTFx_READ_RESOURCE   0x03U

Definition at line 404 of file flash_driver.h.

#define FTFx_RSRC_CODE_REG   FTFx_FCCOB4

Definition at line 393 of file flash_driver.h.

#define FTFx_SECURITY_BY_PASS   0x45U

Definition at line 414 of file flash_driver.h.

#define FTFx_SET_EERAM   0x81U

Definition at line 418 of file flash_driver.h.

#define FTFx_SWAP_COMPLETE   0x04U

Complete swap mode.

Definition at line 448 of file flash_driver.h.

#define FTFx_SWAP_READY   0x01U

Ready swap mode.

Definition at line 442 of file flash_driver.h.

#define FTFx_SWAP_REPORT_STATUS   0x08U

Report Swap Status.

Definition at line 432 of file flash_driver.h.

#define FTFx_SWAP_SET_IN_COMPLETE   0x04U

Set Swap in Complete State.

Definition at line 430 of file flash_driver.h.

#define FTFx_SWAP_SET_IN_PREPARE   0x02U

Set Swap in Update State.

Definition at line 428 of file flash_driver.h.

#define FTFx_SWAP_SET_INDICATOR_ADDR   0x01U

Initialize Swap System control code.

Definition at line 426 of file flash_driver.h.

#define FTFx_SWAP_UNINIT   0x00U

Uninitialized swap mode.

Definition at line 440 of file flash_driver.h.

#define FTFx_SWAP_UPDATE   0x02U

Update swap mode.

Definition at line 444 of file flash_driver.h.

#define FTFx_SWAP_UPDATE_ERASED   0x03U

Update-Erased swap mode.

Definition at line 446 of file flash_driver.h.

#define FTFx_VERIFY_ALL_BLOCK   0x40U

Definition at line 410 of file flash_driver.h.

#define FTFx_VERIFY_BLOCK   0x00U

Definition at line 401 of file flash_driver.h.

#define FTFx_VERIFY_SECTION   0x01U

Definition at line 402 of file flash_driver.h.

#define FTFx_WORD_SIZE   0x0002U

Definition at line 383 of file flash_driver.h.

#define FTFxFERSTAT_DFDIF_WIDTH   FTFC_FERSTAT_DFDIF_WIDTH

Definition at line 363 of file flash_driver.h.

#define GET_BIT_0_7 (   value)    ((uint8_t)(((uint32_t)(value)) & 0xFFU))

Definition at line 462 of file flash_driver.h.

#define GET_BIT_16_23 (   value)    ((uint8_t)((((uint32_t)(value)) >> 16) & 0xFFU))

Definition at line 464 of file flash_driver.h.

#define GET_BIT_24_31 (   value)    ((uint8_t)(((uint32_t)(value)) >> 24))

Definition at line 465 of file flash_driver.h.

#define GET_BIT_8_15 (   value)    ((uint8_t)((((uint32_t)(value)) >> 8) & 0xFFU))

Definition at line 463 of file flash_driver.h.

#define NULL_CALLBACK   ((flash_callback_t)0xFFFFFFFFU)

Null callback.

Definition at line 526 of file flash_driver.h.

#define RESUME_WAIT_CNT   0x20U

Resume wait count used in FLASH_DRV_EraseResume function.

Definition at line 452 of file flash_driver.h.

#define SUSPEND_WAIT_CNT   0x40U

Suspend wait count used in FLASH_DRV_EraseSuspend function.

Definition at line 454 of file flash_driver.h.

Typedef Documentation

typedef void(* flash_callback_t) (void)

Call back function pointer data type.

If using callback in the application, any code reachable from this function must not be placed in a Flash block targeted for a program/erase operation. Functions can be placed in RAM section by using the START/END_FUNCTION_DEFINITION/DECLARATION_RAMSECTION macros.

Definition at line 543 of file flash_driver.h.

Enumeration Type Documentation

FlexRAM Function control Code.

Implements : flash_flexRAM_function_control_code_t_Class

Enumerator
EEE_ENABLE 

Make FlexRAM available for emulated EEPROM

EEE_QUICK_WRITE 

Make FlexRAM available for EEPROM quick writes

EEE_STATUS_QUERY 

EEPROM quick write status query

EEE_COMPLETE_INTERRUPT_QUICK_WRITE 

Complete interrupted EEPROM quick write process

EEE_DISABLE 

Make FlexRAM available as RAM

Definition at line 484 of file flash_driver.h.

Function Documentation

status_t FLASH_DRV_CheckSum ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest,
uint32_t  size,
uint32_t *  pSum 
)

Calculates check sum.

This API performs 32 bit sum of each byte data over a specified Flash memory range without carry which provides rapid method for checking data integrity. The callback time period of this API is determined via FLASH_CALLBACK_CS macro in flash_driver.h which is used as a counter value for the CallBack() function calling in this API. This value can be changed as per the user requirement. User can change this value to obtain the maximum permissible callback time period. This API always returns STATUS_SUCCESS if size provided by user is zero regardless of the input validation.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destStart address of the Flash range to be summed.
[in]sizeSize in byte of the Flash range to be summed.
[in]pSumTo return the sum value.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
static void FLASH_DRV_ClearDoubleBitFaultFlag ( void  )
inlinestatic

Clear the double bit fault detect flag.

Implements : FLASH_DRV_ClearDoubleBitFaultFlag_Activity

Definition at line 1491 of file flash_driver.h.

static void FLASH_DRV_ClearReadColisionFlag ( void  )
inlinestatic

Clear the read collision error flag.

Implements : FLASH_DRV_ClearReadColisionFlag_Activity

Definition at line 1447 of file flash_driver.h.

status_t FLASH_DRV_DEFlashPartition ( const flash_ssd_config_t pSSDConfig,
uint8_t  uEEEDataSizeCode,
uint8_t  uDEPartitionCode,
uint8_t  uCSEcKeySize,
bool  uSFE,
bool  flexRamEnableLoadEEEData 
)

Flash D/E-Flash Partition.

This API prepares the FlexNVM block for use as D-Flash, EEPROM backup, or a combination of both and initializes the FlexRAM. In addition, this function is used to configure number of user keys and user key 'Verify Only' attribute if CSEc is enabled.

The single partition choice should be used through entire life time of a given application to guarantee the Flash endurance and data retention of Flash module.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer
[in]uEEEDataSizeCodeEEPROM Data Size Code
[in]uDEPartitionCodeFlexNVM Partition Code
[in]uCSEcKeySizeCSEc Key Size Code, it should be 0 if the function is not used for configuring CSEc part. It can be:
  • 0x00U: Number of User Keys is Zero Number of Bytes (subtracts from the total 4K EEERAM space) is 0
  • 0x01U: Number of User Keys is 1 to 6 keys Number of Bytes (subtracts from the total 4K EEERAM space) is 128 bytes
  • 0x02U: Number of User Keys is 1 to 12 keys Number of Bytes (subtracts from the total 4K EEERAM space) is 256 bytes
  • 0x03U: Number of User Keys is 1 to 24 keys Number of Bytes (subtracts from the total 4K EEERAM space) is 512 bytes
[in]uSFESecurity Flag Extension, it should be false if the function is not used for configuring CSEc part.
[in]flexRamEnableLoadEEEDataFlexRAM load during reset option.
  • true : FlexRAM loaded with valid EEPROM data during reset sequence
  • false : FlexRAM not loaded during reset sequence
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
void FLASH_DRV_DisableCmdCompleteInterupt ( void  )

Disable the command complete interrupt.

void FLASH_DRV_DisableDoubleBitFaultInterupt ( void  )

Disable the double bit fault detect interrupt.

void FLASH_DRV_DisableReadColisionInterupt ( void  )

Disable the read collision error interrupt.

status_t FLASH_DRV_EEEWrite ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest,
uint32_t  size,
const uint8_t *  pData 
)

EEPROM Emulator Write.

This API is used to write data to FlexRAM section which is partitioned as EEPROM use for EEPROM operation. After data has been written to EEPROM use section of FlexRAM, the EEPROM file system will create new data record in EEPROM back-up area of FlexNVM in round-robin fashion. There is no alignment constraint for destination and size parameters provided by user. However, according to user's input provided, this API will set priority to write to FlexRAM with following rules: 32-bit writing is invoked if destination is 32 bit aligned and size is not less than 32 bits. 16-bit writing is invoked if destination is 16 bit aligned and size is not less than 16 bits. 8-bit writing is invoked if destination is 8 bit aligned and size is not less than 8 bits. When EEPROM was set to EEPROM quick writes mode, the dest address should be aligned 4 bytes,the size should be divided by 4.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destStart address for the intended write operation.
[in]sizeSize in byte to be written.
[in]pDataPointer to source address from which data has to be taken for writing operation.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
status_t FLASH_DRV_EnableCmdCompleteInterupt ( void  )

Enable the command complete interrupt.

This function will enable the command complete interrupt is generated when an FTFC command completes.

Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
status_t FLASH_DRV_EnableDoubleBitFaultInterupt ( void  )

Enable the double bit fault detect interrupt.

This function will enable the double bit fault detect interrupt generation when an uncorrectable ECC fault is detected during a valid flash read access from the platform flash controller.

Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
status_t FLASH_DRV_EnableReadColisionInterupt ( void  )

Enable the read collision error interrupt.

This function will enable the read collision error interrupt generation when an FTFC read collision error occurs.

Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
status_t FLASH_DRV_EraseAllBlock ( const flash_ssd_config_t pSSDConfig)

Flash erase all blocks.

This API erases all Flash memory, initializes the FlexRAM, verifies all memory contents, and then releases the MCU security.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_EraseAllBlockUnsecure ( const flash_ssd_config_t pSSDConfig)

Flash erase all blocks unsecure.

This API erases all Flash memory, initializes the FlexRAM, verifies all memory contents, and then releases the MCU security.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_EraseBlock ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest 
)

Flash erase block.

This API erases all addresses in an individual P-Flash or D-Flash block. For the derivatives including multiply logical P-Flash or D-Flash blocks, this API erases a single block in a single call.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destStart address for the intended erase operation. This address should be aligned following a below table:
FLASH TYPE/MCU S32K116 S32K118 S32K142 S32K144 S32K146 S32K148
P-FLASH 8 8 8 16 16 16
D-FLASH 8 8 8 8 8 16
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
void FLASH_DRV_EraseResume ( void  )

Flash erase resume.

This API is used to resume a previous suspended operation of Flash erase sector command This function must be located in RAM memory or different Flash blocks which are targeted for writing to avoid RWW error.

status_t FLASH_DRV_EraseSector ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest,
uint32_t  size 
)

Flash erase sector.

This API erases one or more sectors in P-Flash or D-Flash memory. This API always returns FTFx_OK if size provided by the user is zero regardless of the input validation.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destAddress in the first sector to be erased. This address should be aligned following a below table
FLASH TYPE/MCU S32K116 S32K118 S32K142 S32K144 S32K146 S32K148
P-FLASH 8 8 8 16 16 16
D-FLASH 8 8 8 8 8 16
[in]sizeSize to be erased in bytes. It is used to determine number of sectors to be erased. This size should be aligned following a below table
FLASH TYPE/MCU S32K116 S32K118 S32K142 S32K144 S32K146 S32K148
P-FLASH 8 8 8 16 16 16
D-FLASH 8 8 8 8 8 16
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
void FLASH_DRV_EraseSuspend ( void  )

Flash erase suspend.

This API is used to suspend a current operation of Flash erase sector command. This function must be located in RAM memory or different Flash blocks which are targeted for writing to avoid the RWW error.

static void FLASH_DRV_ForceDoubleBitFaultDetectCmd ( bool  isEnable)
inlinestatic

Force Double Bit Fault Detect.

This API will enable the user to emulate the setting of the double bit fault detect interrupt flag to check the associated interrupt routine.

Parameters
[in]isEnableEnable/disable the user to emulate the double bit fault detect flag.

Implements : FLASH_DRV_ForceDoubleBitFaultDetectCmd_Activity

Definition at line 1506 of file flash_driver.h.

static bool FLASH_DRV_GetCmdCompleteFlag ( void  )
inlinestatic

Check the command complete flag has completed or not.

Returns
the command complete flag
  • true: The FTFC command has completed.
  • false: The FTFC command is in progress.

Implements : FLASH_DRV_GetCmdCompleteFlag_Activity

Definition at line 1406 of file flash_driver.h.

status_t FLASH_DRV_GetDFlashProtection ( const flash_ssd_config_t pSSDConfig,
uint8_t *  protectStatus 
)

D-Flash get protection.

This API retrieves current P-Flash protection status. Considering the time consumption for getting protection is very low and even can be ignored, it is not necessary to utilize the Callback function to support the time-critical events.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer
[out]protectStatusTo return the current value of the D-Flash Protection Register. Each bit is corresponding to protection status of 1/8 of the total D-Flash. The least significant bit is corresponding to the lowest address area of D-Flash. The most significant bit is corresponding to the highest address area of D-Flash and so on. There are two possible cases as below:
  • 0 : this area is protected.
  • 1 : this area is unprotected.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_UNSUPPORTED: Operation was unsupported.
static bool FLASH_DRV_GetDoubleBitFaultFlag ( void  )
inlinestatic

Check the double bit fault flag is detected during a valid flash read access.

Returns
the flash error status
  • true: Double bit fault detected.
  • false: Double bit fault not detected.

Implements : FLASH_DRV_GetDoubleBitFaultFlag_Activity

Definition at line 1481 of file flash_driver.h.

status_t FLASH_DRV_GetEERAMProtection ( uint8_t *  protectStatus)

EERAM get protection.

This API retrieves which EEPROM sections of FlexRAM are protected against program and erase operations. Considering the time consumption for getting protection is very low and even can be ignored, it is not necessary to utilize the Callback function to support the time-critical events

Parameters
[out]protectStatusTo return the current value of the EEPROM Protection Register. Each bit is corresponding to protection status of 1/8 of the total EEPROM use. The least significant bit is corresponding to the lowest address area of EEPROM. The most significant bit is corresponding to the highest address area of EEPROM and so on. There are two possible cases as below:
  • 0: this area is protected.
  • 1: this area is unprotected.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_UNSUPPORTED: Operation was unsupported.
void FLASH_DRV_GetPFlashProtection ( uint32_t *  protectStatus)

P-Flash get protection.

This API retrieves the current P-Flash protection status. Considering the time consumption for getting protection is very low and even can be ignored. It is not necessary to utilize the Callback function to support the time-critical events.

Parameters
[out]protectStatusTo return the current value of the P-Flash Protection. Each bit is corresponding to protection of 1/32 of the total P-Flash. The least significant bit is corresponding to the lowest address area of P-Flash. The most significant bit is corresponding to the highest address area of P-Flash and so on. There are two possible cases as below:
  • 0: this area is protected.
  • 1: this area is unprotected.
static bool FLASH_DRV_GetReadColisionFlag ( void  )
inlinestatic

Check the read collision error flag is detected or not.

Returns
the read collision error flag
  • true: Collision error detected.
  • false: No collision error detected.

Implements : FLASH_DRV_GetReadColisionFlag_Activity

Definition at line 1437 of file flash_driver.h.

void FLASH_DRV_GetSecurityState ( uint8_t *  securityState)

Flash get security state.

This API retrieves the current Flash security status, including the security enabling state and the back door key enabling state.

Parameters
[out]securityStateTo return the current security status code.
  • FLASH_NOT_SECURE (0x01U): Flash currently not in secure state
  • FLASH_SECURE_BACKDOOR_ENABLED (0x02U): Flash is secured and back door key access enabled
  • FLASH_SECURE_BACKDOOR_DISABLED (0x04U): Flash is secured and back door key access disabled.
status_t FLASH_DRV_Init ( const flash_user_config_t *const  pUserConf,
flash_ssd_config_t *const  pSSDConfig 
)

Initializes Flash.

This API initializes Flash module by clearing status error bit and reporting the memory configuration via SSD configuration structure.

Parameters
[in]pUserConfThe user configuration structure pointer.
[in]pSSDConfigThe SSD configuration structure pointer.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
status_t FLASH_DRV_Program ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest,
uint32_t  size,
const uint8_t *  pData 
)

Flash program.

This API is used to program 4 consecutive bytes (for program long word command) and 8 consecutive bytes (for program phrase command) on P-Flash or D-Flash block. This API always returns FTFx_OK if size provided by user is zero regardless of the input validation

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destStart address for the intended program operation. This address should be aligned to 8 bytes.
[in]sizeSize in byte to be programmed. This size should be aligned to 8 bytes.
[in]pDataPointer of source address from which data has to be taken for program operation.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_ProgramCheck ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest,
uint32_t  size,
const uint8_t *  pExpectedData,
uint32_t *  pFailAddr,
uint8_t  marginLevel 
)

Flash program check.

This API tests a previously programmed P-Flash or D-Flash long word to see if it reads correctly at the specified margin level. This API always returns FTFx_OK if size provided by user is zero regardless of the input validation

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destStart address for the intended program check operation. This address should be aligned to 4 bytes.
[in]sizeSize in byte to check accuracy of program operation. This size should be aligned to 4 bytes.
[in]pExpectedDataThe pointer to the expected data.
[in]pFailAddrReturned the first aligned failing address.
[in]marginLevelRead margin choice as follows:
  • marginLevel = 0x1U: read at User margin 1/0 level.
  • marginLevel = 0x2U: read at Factory margin 1/0 level.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_ProgramOnce ( const flash_ssd_config_t pSSDConfig,
uint8_t  recordIndex,
const uint8_t *  pDataArray 
)

Flash program once.

This API is used to program to a reserved 64 byte field located in the P-Flash IFR via given number of record. See the corresponding reference manual to get correct value of this number.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]recordIndexThe record index will be read. It can be from 0x0U to 0x7U or from 0x0U to 0xF according to specific derivative.
[in]pDataArrayPointer to the array from which data will be taken for program once command.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_ProgramSection ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest,
uint16_t  number 
)

Flash program section.

This API will program the data found in the Section Program Buffer to previously erased locations in the Flash memory. Data is preloaded into the Section Program Buffer by writing to the acceleration Ram and FlexRam while it is set to function as a RAM. The Section Program Buffer is limited to the value of FlexRam divides by a ratio. Refer to the associate reference manual to get correct value of this ratio. For derivatives including swap feature, the swap indicator address is encountered during FlashProgramSection, it is bypassed without setting FPVIOL but the content are not be programmed. In addition, the content of source data used to program to swap indicator will be re-initialized to 0xFF after completion of this command.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destStart address for the intended program operation. This address should be aligned following a below table:
FLASH TYPE/MCU S32K116 S32K118 S32K142 S32K144 S32K146 S32K148
P-FLASH 8 8 8 16 16 16
D-FLASH 8 8 8 8 8 16
[in]numberNumber of alignment unit to be programmed. Refer to associate reference manual to get correct value of this alignment constrain.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_UNSUPPORTED: Operation was unsupported.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_ReadOnce ( const flash_ssd_config_t pSSDConfig,
uint8_t  recordIndex,
uint8_t *  pDataArray 
)

Flash read once.

This API is used to read out a reserved 64 byte field located in the P-Flash IFR via given number of record. See the corresponding reference manual to get the correct value of this number.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]recordIndexThe record index will be read. It can be from 0x0U to 0x7U or from 0x0U to 0xF according to specific derivative.
[in]pDataArrayPointer to the array to return the data read by the read once command.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_SecurityBypass ( const flash_ssd_config_t pSSDConfig,
const uint8_t *  keyBuffer 
)

Flash security bypass.

This API un-secures the device by comparing the user's provided back door key with the ones in the Flash Configuration Field. If they are matched, the security is released. Otherwise, an error code is returned.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]keyBufferPoint to the user buffer containing the back door key.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_SetDFlashProtection ( const flash_ssd_config_t pSSDConfig,
uint8_t  protectStatus 
)

D-Flash set protection.

This API sets the D-Flash protection to the intended protection status. Setting D-Flash protection status is subject to a protection transition restriction. If there is a setting violation, it returns failed information and the current protection status will not be changed.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer
[in]protectStatusThe expected protect status user wants to set to D-Flash Protection Register. Each bit is corresponding to protection status of 1/8 of the total D-Flash. The least significant bit is corresponding to the lowest address area of D-Flash. The most significant bit is corresponding to the highest address area of D-Flash and so on. There are two possible cases as below:
  • 0 : this area is protected.
  • 1 : this area is unprotected.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_UNSUPPORTED: Operation was unsupported.
status_t FLASH_DRV_SetEERAMProtection ( uint8_t  protectStatus)

EERAM set protection.

This API sets protection to the intended protection status for EEPROM us area of FlexRam. This is subject to a protection transition restriction. If there is a setting violation, it returns failed information and the current protection status will not be changed.

Parameters
[in]protectStatusThe intended protection status value should be written to the EEPROM Protection Register. Each bit is corresponding to protection status of 1/8 of the total EEPROM use. The least significant bit is corresponding to the lowest address area of EEPROM. The most significant bit is corresponding to the highest address area of EEPROM and so on. There are two possible cases as below:
  • 0: this area is protected.
  • 1: this area is unprotected.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_UNSUPPORTED: Operation was unsupported.
status_t FLASH_DRV_SetFlexRamFunction ( const flash_ssd_config_t pSSDConfig,
flash_flexRam_function_control_code_t  flexRamFuncCode,
uint16_t  byteOfQuickWrite,
flash_eeprom_status_t *const  pEEPROMStatus 
)

Set FlexRAM function.

This function is used to change the function of the FlexRAM. When not partitioned for emulated EEPROM, the FlexRAM is typically used as traditional RAM. Otherwise, the FlexRam is typically used to store EEPROM data, the writing to EEPROM is normal write or quick write. In addition, this function may be used to get EEPROM status or complete interrupted EEPROM quick write process. For example, after partitioning to have EEPROM backup, FlexRAM is used for EEPROM use accordingly and if want to change FlexRAM to traditional RAM for FlashProgramSection() use, call this API with the function control code is 0xFFU.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]flexRamFuncCodeFlexRam function control code. It can be:
  • 0x00U: Make FlexRAM available for emulated EEPROM.
  • 0x55U: Make FlexRAM available for EEPROM quick writes.
  • 0x77U: EEPROM quick write status query.
  • 0xAAU: Complete interrupted EEPROM quick write process.
  • 0xFFU: Make FlexRAM available as RAM.
[in]byteOfQuickWriteNumber of FlexRAM bytes allocated for EEPROM quick writes. This parameter is only used for EEE_QUICK_WRITE command. It should not be less than 16 bytes and more than 512 bytes and It must be divided by 4 in EEPROM quick writes. This one should be 0 if the function is not used for EEEPROM quick write.
[out]pEEPROMStatusPointer to the EEPROM status. This parameter is only used for EEE_STATUS_QUERY command, it should be NULL if the function is not used for EEPROM status query.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_SetPFlashProtection ( uint32_t  protectStatus)

P-Flash set protection.

This API sets the P-Flash protection to the intended protection status. Setting P-Flash protection status is subject to a protection, transition restriction. If there is a setting violation, it returns an error code and the current protection status will not be changed.

Parameters
[in]protectStatusThe expected protect status user wants to set to P-Flash protection register. Each bit is corresponding to protection of 1/32 of the total P-Flash. The least significant bit is corresponding to the lowest address area of P-Flash. The most significant bit is corresponding to the highest address area of P- Flash, and so on. There are two possible cases as shown below:
  • 0: this area is protected.
  • 1: this area is unprotected.
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
status_t FLASH_DRV_VerifyAllBlock ( const flash_ssd_config_t pSSDConfig,
uint8_t  marginLevel 
)

Flash verify all blocks.

This function checks to see if the P-Flash and/or D-Flash, EEPROM backup area, and D-Flash IFR have been erased to the specified read margin level, if applicable, and releases security if the readout passes.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]marginLevelRead Margin Choice as follows:
  • marginLevel = 0x0U: use the Normal read level
  • marginLevel = 0x1U: use the User read
  • marginLevel = 0x2U: use the Factory read
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_VerifyBlock ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest,
uint8_t  marginLevel 
)

Flash verify block.

This API checks to see if an entire P-Flash or D-Flash block has been erased to the specified margin level For the derivatives including multiply logical P-Flash or D-Flash blocks, this API erases a single block in a single call.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destStart address for the intended verify operation.
[in]marginLevelRead Margin Choice as follows:
  • marginLevel = 0x0U: use Normal read level
  • marginLevel = 0x1U: use the User read
  • marginLevel = 0x2U: use the Factory read
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.
status_t FLASH_DRV_VerifySection ( const flash_ssd_config_t pSSDConfig,
uint32_t  dest,
uint16_t  number,
uint8_t  marginLevel 
)

Flash verify section.

This API checks if a section of the P-Flash or the D-Flash memory is erased to the specified read margin level.

Parameters
[in]pSSDConfigThe SSD configuration structure pointer.
[in]destStart address for the intended verify operation. This address should be aligned following a below table
FLASH TYPE/MCU S32K116 S32K118 S32K142 S32K144 S32K146 S32K148
P-FLASH 8 8 8 16 16 16
D-FLASH 8 8 8 8 8 16
[in]numberNumber of alignment unit to be verified. Refer to corresponding reference manual to get correct information of alignment constrain.
[in]marginLevelRead Margin Choice as follows:
  • marginLevel = 0x0U: use Normal read level
  • marginLevel = 0x1U: use the User read
  • marginLevel = 0x2U: use the Factory read
Returns
operation status
  • STATUS_SUCCESS: Operation was successful.
  • STATUS_ERROR: Operation failure was occurred.
  • STATUS_BUSY: Operation was busy.

Variable Documentation

uint8_t brownOutCode

Brown-out detection code

Definition at line 605 of file flash_driver.h.

flash_callback_t CallBack

Call back function to service the time critical events. Any code reachable from this function must not be placed in a Flash block targeted for a program/erase operation

Definition at line 565 of file flash_driver.h.

flash_callback_t CallBack

Call back function to service the time critical events. Any code reachable from this function must not be placed in a Flash block targeted for a program/erase operation

Definition at line 594 of file flash_driver.h.

uint32_t DFlashBase

For FlexNVM device, this is the base address of D-Flash memory (FlexNVM memory); For non-FlexNVM device, this field is unused

Definition at line 561 of file flash_driver.h.

uint32_t DFlashBase

For FlexNVM device, this is the base address of D-Flash memory (FlexNVM memory); For non-FlexNVM device, this field is unused

Definition at line 585 of file flash_driver.h.

uint32_t DFlashSize

For FlexNVM device, this is the size in byte of area which is used as D-Flash from FlexNVM memory; For non-FlexNVM device, this field is unused

Definition at line 587 of file flash_driver.h.

uint32_t EEESize

For FlexNVM device, this is the size in byte of EEPROM area which was partitioned from FlexRAM; For non-FlexNVM device, this field is unused

Definition at line 592 of file flash_driver.h.

uint32_t EERAMBase

The base address of FlexRAM (for FlexNVM device) or acceleration RAM memory (for non-FlexNVM device)

Definition at line 563 of file flash_driver.h.

uint32_t EERAMBase

The base address of FlexRAM (for FlexNVM device) or acceleration RAM memory (for non-FlexNVM device)

Definition at line 590 of file flash_driver.h.

uint16_t numOfRecordReqMaintain

Number of EEPROM quick write records requiring maintenance

Definition at line 606 of file flash_driver.h.

uint32_t PFlashBase

The base address of P-Flash memory

Definition at line 559 of file flash_driver.h.

uint32_t PFlashBase

The base address of P-Flash memory

Definition at line 583 of file flash_driver.h.

uint32_t PFlashSize

The size in byte of P-Flash memory

Definition at line 560 of file flash_driver.h.

uint32_t PFlashSize

The size in byte of P-Flash memory

Definition at line 584 of file flash_driver.h.

uint16_t sectorEraseCount

EEPROM sector erase count

Definition at line 607 of file flash_driver.h.