// See flash.h for documentation of this function. status_t flash_erase_all(flash_driver_t * driver, uint32_t key) { if (driver == NULL) { return kStatus_InvalidArgument; } // preparing passing parameter to erase all flash blocks // 1st element for the FCCOB register FTFx_WR_FCCOBx(FTFx, 0, FTFx_ERASE_ALL_BLOCK); // Validate the user key status_t returnCode = flash_check_user_key(key); if (returnCode) { return returnCode; } // calling flash command sequence function to execute the command returnCode = flash_command_sequence(driver); flash_cache_clear(driver); return returnCode; }
// See flash.h for documentation of this function. status_t flash_erase_all_unsecure(flash_driver_t * driver, uint32_t key) { // Validate the user key status_t returnCode = flash_check_user_key(key); if (returnCode) { return returnCode; } if (driver == NULL) { return kStatus_InvalidArgument; } // Prepare passing parameter to erase all flash blocks (unsecure). // 1st element for the FCCOB register. HW_FTFx_FCCOBx_WR(FTFx_BASE, 0, FTFx_ERASE_ALL_BLOCK_UNSECURE); // Call flash command sequence function to execute the command. return flash_command_sequence(); }