- made memory alignment configurable

pull/143/head
Michael Zillgith 8 years ago
parent 02a330e414
commit 68d56d947e

@ -157,6 +157,9 @@
/* include support for IEC 61850 log services */
#define CONFIG_IEC61850_LOG_SERVICE 1
/* Force memory alignment - required for some platforms (required more memory for buffered reporting) */
#define CONFIG_IEC61850_FORCE_MEMORY_ALIGNMENT 1
/* overwrite default results for MMS identify service */
//#define CONFIG_DEFAULT_MMS_VENDOR_NAME "libiec61850.com"
//#define CONFIG_DEFAULT_MMS_MODEL_NAME "LIBIEC61850"

@ -151,6 +151,9 @@
/* include support for IEC 61850 log services */
#cmakedefine01 CONFIG_IEC61850_LOG_SERVICE
/* Force memory alignment - required for some platforms (required more memory for buffered reporting) */
#define CONFIG_IEC61850_FORCE_MEMORY_ALIGNMENT 1
/* default results for MMS identify service */
#define CONFIG_DEFAULT_MMS_VENDOR_NAME "libiec61850.com"
#define CONFIG_DEFAULT_MMS_MODEL_NAME "LIBIEC61850"

@ -23,6 +23,7 @@
#include "libiec61850_platform_includes.h"
#include "simple_allocator.h"
#include "stack_config.h"
void
MemoryAllocator_init(MemoryAllocator* self, char* memoryBlock, int size)
@ -35,10 +36,14 @@ MemoryAllocator_init(MemoryAllocator* self, char* memoryBlock, int size)
int inline
MemoryAllocator_getAlignedSize(int size)
{
#if (CONFIG_IEC61850_FORCE_MEMORY_ALIGNMENT == 1)
if ((size % sizeof(void*)) > 0)
return sizeof(void*) * ((size + sizeof(void*) - 1) / sizeof(void*));
else
return size;
#else
return size;
#endif
}
char*

Loading…
Cancel
Save