diff options
author | xmarvla <vlatko.markovic@seavus.com> | 2011-06-16 14:45:38 +0100 |
---|---|---|
committer | Viktor Mladenovski <viktor.mladenovski@seavus.com> | 2011-08-17 22:10:43 +0200 |
commit | b9b4df06ddb81a6d14354fc0d42e22acf0b4c30c (patch) | |
tree | 48b17930f3f28c72094f090ba38e6761aa43416b /lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h | |
parent | c9d1f9613e3ac18d5dd3b9432646e289bb88cec9 (diff) |
LCM R1T and LCDriver R1N official release.
ST-Ericsson ID: 345044
ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10204
Change-Id: Ib1901abfc2efa6c887c70b8583ddd2258e21aa78
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/25187
Tested-by: Vlatko STENKOSKI
Tested-by: Cvetko MLADENOVSKI <cvetko.mladenovski@seavus.com>
Tested-by: Aleksandar GASOSKI <aleksandar.gasoski@seavus.com>
Reviewed-by: Zoran ANCEVSKI <zoran.ancevski@seavus.com>
Reviewed-by: QATEST
Reviewed-by: Vlatko PISTOLOV <vlatko.pistolov@seavus.com>
Conflicts:
lcmodule/win_binaries/LCM.dll
win_binaries/LCDriver_CNH1606432.dll
Diffstat (limited to 'lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h')
-rw-r--r-- | lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h b/lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h new file mode 100644 index 0000000..ee5eb18 --- /dev/null +++ b/lcmodule/source/cnh1605551_ldr_utilities/include/r_memory_utils.h @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (C) ST-Ericsson SA 2011 + * License terms: 3-clause BSD license + ******************************************************************************/ +#ifndef _R_MEMMORY_UTILS_H_ +#define _R_MEMMORY_UTILS_H_ + +/** + * @addtogroup ldr_utilities + * @{ + * @addtogroup memory_utils + * @{ + */ + +/******************************************************************************* + * Includes + ******************************************************************************/ +#include <stdlib.h> +#include "error_codes.h" +#include "t_basicdefinitions.h" +#ifdef CFG_ENABLE_LOADER_TYPE +#include "cpu_support.h" + +/******************************************************************************* + * Macro that release allocated memory space in heap. + ******************************************************************************/ +#define BUFFER_FREE(Buffer) \ +if (NULL != (Buffer)) \ +{ \ + CPU_Irq_State_t IRQ_status; \ + \ + IRQ_status = CPU_IrqDisable();\ + free(Buffer); \ + (Buffer) = NULL; \ + \ + if (IRQ_status == CPU_IRQ_ENABLE)\ + {\ + CPU_IrqEnable();\ + }\ +} +#else //CFG_ENABLE_LOADER_TYPE +#define BUFFER_FREE(Buffer) \ +if (NULL != (Buffer)) \ +{ \ + free(Buffer); \ + (Buffer) = NULL; \ +} +#endif // CFG_ENABLE_LOADER_TYPE + +/** + * Macro that check alignment. If variable is not aligned it set the status + * variable ReturnValue to appropriate error code and send the function to error + * label. + * + * @param [in] x Variable for alignment check. + * + */ +#define IS_ALIGNED(x) if(((x) & 3)) \ + { \ + ReturnValue = E_UNALIGNED_DATA; \ + goto ErrorExit; \ + } \ + +/** @} */ +/** @} */ +#endif /*_R_MEMMORY_UTILS_H_*/ |