From 02738b7af6ab01cd8f37472918498a2888bb8b95 Mon Sep 17 00:00:00 2001 From: Rohit Grover Date: Fri, 22 Jul 2016 09:51:11 +0100 Subject: [PATCH] Add a separate error code for runtime/intergrity-check failures --- hal/hal/storage_abstraction/Driver_Storage.h | 1 + .../TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hal/hal/storage_abstraction/Driver_Storage.h b/hal/hal/storage_abstraction/Driver_Storage.h index 8b5410ff59..5d8c9012ff 100644 --- a/hal/hal/storage_abstraction/Driver_Storage.h +++ b/hal/hal/storage_abstraction/Driver_Storage.h @@ -42,6 +42,7 @@ extern "C" { #define ARM_STORAGE_ERROR_NOT_ERASABLE (ARM_DRIVER_ERROR_SPECIFIC - 1) ///< Part (or all) of the range provided to Erase() isn't erasable. #define ARM_STORAGE_ERROR_NOT_PROGRAMMABLE (ARM_DRIVER_ERROR_SPECIFIC - 2) ///< Part (or all) of the range provided to ProgramData() isn't programmable. #define ARM_STORAGE_ERROR_PROTECTED (ARM_DRIVER_ERROR_SPECIFIC - 3) ///< Part (or all) of the range to Erase() or ProgramData() is protected. +#define ARM_STORAGE_ERROR_RUNTIME_OR_INTEGRITY_FAILURE (ARM_DRIVER_ERROR_SPECIFIC - 4) ///< Runtime or sanity-check failure. /** * \brief Attributes of the storage range within a storage block. diff --git a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c index 166bda2386..2eb5e87ae4 100644 --- a/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c +++ b/hal/targets/hal/TARGET_Freescale/TARGET_KSDK2_MCUS/TARGET_K64F/storage_driver.c @@ -591,7 +591,7 @@ static int32_t executeCommand(struct mtd_k64f_data *context) return ARM_DRIVER_ERROR_PARAMETER; } if (failedWithRunTimeError()) { - return ARM_DRIVER_ERROR; /* unspecified runtime error. */ + return ARM_STORAGE_ERROR_RUNTIME_OR_INTEGRITY_FAILURE; } /* signal synchronous completion. */ @@ -638,7 +638,7 @@ static void ftfe_ccie_irq_handler(void) } if (failedWithRunTimeError()) { if (context->commandCompletionCallback) { - context->commandCompletionCallback(ARM_DRIVER_ERROR, context->currentCommand); + context->commandCompletionCallback(ARM_STORAGE_ERROR_RUNTIME_OR_INTEGRITY_FAILURE, context->currentCommand); } return; }