Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-12-03 03:44:53 -0500
committerHenrik Rentz-Reichert2013-12-03 03:44:53 -0500
commit875489e111ab5daec26b45771643a93c2277b202 (patch)
tree2fb61436fe9ed160c86dda9f10d6c806c6ed4907
parent799a8f1d48018512bb560a24e2e5957cecb078ef (diff)
downloadorg.eclipse.etrice-875489e111ab5daec26b45771643a93c2277b202.tar.gz
org.eclipse.etrice-875489e111ab5daec26b45771643a93c2277b202.tar.xz
org.eclipse.etrice-875489e111ab5daec26b45771643a93c2277b202.zip
406870: [runtime.c] unify etMemory.h
https://bugs.eclipse.org/bugs/show_bug.cgi?id=406870
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zipbin105593 -> 105045 bytes
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.c4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c6
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h25
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/config/etRuntimeConfig.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h2
9 files changed, 9 insertions, 36 deletions
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
index 46f10fdf9..266404d59 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
Binary files differ
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
index b1c7d7cae..a0baa20ff 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
@@ -15,7 +15,7 @@
#include "etDatatypes.h"
-#define CEIL_ALIGN(n) ((n)+((ALIGNMENT-((n)&(ALIGNMENT-1)))&(ALIGNMENT-1)))
+#define MEM_CEIL(n) ((n)+((ALIGNMENT-((n)&(ALIGNMENT-1)))&(ALIGNMENT-1)))
struct etMemory;
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.c
index b347c171e..bcd5f0501 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.c
@@ -29,7 +29,7 @@ typedef struct etFixedSizeMemory {
void* etMemory_FixedSize_alloc(etMemory* heap, etUInt16 size) {
etFixedSizeMemory* self = (etFixedSizeMemory*) heap;
void* mem = NULL;
- size = CEIL_ALIGN(size);
+ size = MEM_CEIL(size);
ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "alloc")
@@ -58,7 +58,7 @@ void etMemory_FixedSize_free(etMemory* heap, void* obj, etUInt16 size) {
*/
etMemory* etMemory_FixedSize_init(void* heap, etUInt32 size, etUInt16 blockSize) {
etFixedSizeMemory* self = (etFixedSizeMemory*) heap;
- size_t data_size = CEIL_ALIGN(sizeof(etFixedSizeMemory));
+ size_t data_size = MEM_CEIL(sizeof(etFixedSizeMemory));
int i;
ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "init")
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
index 69fea62fb..2421932fb 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
@@ -126,7 +126,7 @@ static void etMemory_putFreeListMem(etFreeListMemory* self, void* obj, etUInt16
void* etMemory_FreeList_alloc(etMemory* heap, etUInt16 size) {
void* mem;
- size = CEIL_ALIGN(size);
+ size = MEM_CEIL(size);
ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "alloc")
mem = etMemory_getFreeListMem((etFreeListMemory*) heap, size);
@@ -140,7 +140,7 @@ void* etMemory_FreeList_alloc(etMemory* heap, etUInt16 size) {
void etMemory_FreeList_free(etMemory* heap, void* obj, etUInt16 size) {
ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "free")
{
- size = CEIL_ALIGN(size);
+ size = MEM_CEIL(size);
etMemory_putFreeListMem((etFreeListMemory*) heap, obj, size);
}
ET_MSC_LOGGER_SYNC_EXIT
@@ -159,7 +159,7 @@ etMemory* etMemory_FreeList_init(void* heap, etUInt32 size, etUInt16 nslots) {
self->nslots = nslots;
{
int used = sizeof(etFreeListMemory)+(self->nslots-1)*sizeof(etFreeListObj);
- self->current = ((etUInt8*)self)+CEIL_ALIGN(used);
+ self->current = ((etUInt8*)self)+MEM_CEIL(used);
}
/* initialize the free lists */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
index 1eff66694..f7cb41b13 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c
@@ -13,7 +13,7 @@
#include "modelbase/etPort.h"
#include "debugging/etMSCLogger.h"
-#include "osal/etMemory.h"
+#include "base/etMemory.h"
#include <string.h>
/*
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h
deleted file mode 100644
index 7854b1dbf..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMemory.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETMEMORY_H_
-#define _ETMEMORY_H_
-
-#include "etDatatypes.h"
-#include "etRuntimeConfig.h"
-
-#define CONSTANT_MEM_CEIL(n) \
- ((n)+(((int32)STRUCT_ALIGN-((n)&((int32)STRUCT_ALIGN-1)))&((int32)STRUCT_ALIGN-1)))
-
-#define MEM_ALIGNMENT STRUCT_ALIGN /* power of 2 and >= sizeof(int) ! */
-#define MEM_CEIL(n) CONSTANT_MEM_CEIL(n)
-
-#endif /* _ETMEMORY_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/config/etRuntimeConfig.h b/runtime/org.eclipse.etrice.runtime.c/src/config/etRuntimeConfig.h
index a58cf0282..3e2992349 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/config/etRuntimeConfig.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/config/etRuntimeConfig.h
@@ -24,8 +24,6 @@
/* data logger */
#define ET_DATA_LOGGER_ACTIVATE
-#define STRUCT_ALIGN 8
-
/* timing and scheduling */
//#define FREQUENCY 10L
//#define ET_RUNTIME_MAXLOOP 100
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
index 87465dd6f..aabc4ca8b 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
@@ -62,7 +62,7 @@ typedef bool boolean;
#define FALSE 0
#endif
-#define ALIGNMENT 4
+#define ALIGNMENT 8 /* power of 2 and >= sizeof(int) ! */
/*
* typedefs for eTrice Runtime and Testing
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
index 03551675c..a9c754848 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
@@ -59,7 +59,7 @@ typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already define
#define FALSE 0
#endif
-#define ALIGNMENT 4
+#define ALIGNMENT 8 /* power of 2 and >= sizeof(int) ! */
/*
* typedefs for eTrice Runtime and Testing

Back to the top