10#if EFI_STORAGE_INT_FLASH
34#ifdef KINETIS_FLASH_DEBUG
36 debugLog(
"* flashInit status=%d\r\n",
initStatus);
40 uint32_t dflashBlockBase = 0;
41 uint32_t dflashTotalSize = 0;
42 uint32_t dflashSectorSize = 0;
49 debugLog(
"Data Flash Base Address: (0x%x)\r\n", dflashBlockBase);
50 debugLog(
"Data Flash Total Size:\t%d KB, Hex: (0x%x)\r\n", (dflashTotalSize / 1024), dflashTotalSize);
51 debugLog(
"Data Flash Sector Size:\t%d KB, Hex: (0x%x)\r\n", (dflashSectorSize / 1024), dflashSectorSize);
67#ifdef KINETIS_FLASH_DEBUG
112 return (v + FSL_FEATURE_FLASH_FLEX_NVM_SECTOR_CMD_ADDRESS_ALIGMENT - 1) & ~(FSL_FEATURE_FLASH_FLEX_NVM_SECTOR_CMD_ADDRESS_ALIGMENT - 1);
117 return FLASH_RETURN_NO_PERMISSION;
124#ifdef KINETIS_FLASH_DEBUG
125 debugLog(
"* flashErase(addr=%08x siz=%d sizeAligned=%d)=%d\r\n", address,
size, sizeAligned, status);
135 return FLASH_RETURN_NO_PERMISSION;
144#ifdef KINETIS_FLASH_DEBUG
145 debugLog(
"* flashWrite(addr=%08x siz=%d sizeAligned=%d)=%d\r\n", address,
size, sizeAligned, status);
164 if (*(
char*) address != 0xFF)
175 uint32_t failAddr = 0, failDat = 0;
190 if (*(
volatile char*) address != *
buffer)
201 memcpy(destination, (
char*) source,
size);
void ke1xf_clock_init(kinetis_clock_type_e ct)
This function executes the configuration of clocks.
kinetis_clock_type_e ke1xf_clock_get_current_type(void)
kinetis_clock_type_e
Kinetis Clock Type.
@ kinetis_clock_int_osc_run
return FLASH_RETURN_SUCCESS
int intFlashWrite(flashaddr_t address, const char *buffer, size_t size)
Copy data from a buffer to the flash memory.
static int alignToWord(int v)
bool intFlashIsErased(flashaddr_t address, size_t size)
Check if the size bytes of flash memory starting at address are erased.
int intFlashRead(flashaddr_t source, char *destination, size_t size)
Copy data from the flash memory to a destination.
bool intFlashCompare(flashaddr_t address, const char *buffer, size_t size)
Check if the data in buffer are identical to the one in flash memory.
int intFlashErase(flashaddr_t address, size_t size)
Erase the sectors containing the span of size bytes starting at address.
uintptr_t flashaddr_t
Address in the flash memory.
enum _ftfx_security_state ftfx_security_state_t
Enumeration for the three possible FTFx security states.
status_t FLEXNVM_DflashVerifyProgram(flexnvm_config_t *config, uint32_t start, uint32_t lengthInBytes, const uint8_t *expectedData, ftfx_margin_value_t margin, uint32_t *failedAddress, uint32_t *failedData)
Verifies programming of the desired flash area at a specified margin level.
status_t FLEXNVM_GetSecurityState(flexnvm_config_t *config, ftfx_security_state_t *state)
Returns the security state via the pointer passed into the function.
status_t FLEXNVM_DflashErase(flexnvm_config_t *config, uint32_t start, uint32_t lengthInBytes, uint32_t key)
Erases the Dflash sectors encompassed by parameters passed into function.
status_t FLEXNVM_DflashProgram(flexnvm_config_t *config, uint32_t start, uint8_t *src, uint32_t lengthInBytes)
Programs flash with data at locations passed in through parameters.
status_t FLEXNVM_Init(flexnvm_config_t *config)
Initializes the global flash properties structure members.
status_t FLEXNVM_GetProperty(flexnvm_config_t *config, flexnvm_property_tag_t whichProperty, uint32_t *value)
Returns the desired flexnvm property.
status_t FLEXNVM_DflashGetProtection(flexnvm_config_t *config, uint8_t *protectStatus)
Gets the DFlash protection status.
@ kFLEXNVM_PropertyDflashSectorSize
@ kFLEXNVM_PropertyDflashTotalSize
@ kFLEXNVM_PropertyDflashBlockBaseAddr
int32_t status_t
Type used for all status and error return values.
static flexnvm_config_t flashCfg
static status_t securityStatus
void flashPrintStatus(void)
static bool isInitializing
static status_t protectStatus
static uint8_t protectValue
static bool flashInit(void)
static status_t initStatus
static kinetis_clock_type_e savedClockType
static ftfx_security_state_t sstate
Flexnvm driver state information.
static BigBufferHandle buffer