Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h94
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.c172
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h60
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c414
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h70
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c204
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h98
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h96
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c146
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h166
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c686
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h172
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c60
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h48
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c50
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h52
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c230
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h88
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h48
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c412
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h166
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c178
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h102
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c36
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h48
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.c90
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h114
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h332
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c56
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h40
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.c28
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h64
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/config/etRuntimeConfig.h68
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTcpSockets.c664
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c666
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etDatatypes.h144
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etLogger.c156
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etPlatform.c184
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etTimer.c220
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/info.txt2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etDatatypes.h144
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etLogger.c156
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.c582
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.h72
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTimer.c198
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etDatatypes.h144
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etLogger.c192
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etPlatform.c104
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etTimer.c138
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/info.txt2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/naming-convention.txt18
51 files changed, 4237 insertions, 4237 deletions
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 32683d8dd..b1c7d7cae 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
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2012 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"
-
-#define CEIL_ALIGN(n) ((n)+((ALIGNMENT-((n)&(ALIGNMENT-1)))&(ALIGNMENT-1)))
-
-struct etMemory;
-
-/**
- * allocates memory from the heap
- *
- * \param heap pointer to the heap memory
- * \param size the size of the requested memory in bytes
- */
-typedef void* etMemory_alloc(struct etMemory* heap, etUInt16 size);
-
-/**
- * frees memory previously allocated from the heap
- *
- * \param heap pointer to the heap memory
- * \param obj pointer to the memory returned
- * \param size the size in bytes of the memory returned
- */
-typedef void etMemory_free(struct etMemory* heap, void* obj, etUInt16 size);
-
-typedef struct etMemory {
- /** size of the heap in bytes */
- etUInt32 size;
-
- etMemory_alloc* alloc;
- etMemory_free* free;
-} etMemory;
-
-#endif /* _ETMEMORY_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 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"
+
+#define CEIL_ALIGN(n) ((n)+((ALIGNMENT-((n)&(ALIGNMENT-1)))&(ALIGNMENT-1)))
+
+struct etMemory;
+
+/**
+ * allocates memory from the heap
+ *
+ * \param heap pointer to the heap memory
+ * \param size the size of the requested memory in bytes
+ */
+typedef void* etMemory_alloc(struct etMemory* heap, etUInt16 size);
+
+/**
+ * frees memory previously allocated from the heap
+ *
+ * \param heap pointer to the heap memory
+ * \param obj pointer to the memory returned
+ * \param size the size in bytes of the memory returned
+ */
+typedef void etMemory_free(struct etMemory* heap, void* obj, etUInt16 size);
+
+typedef struct etMemory {
+ /** size of the heap in bytes */
+ etUInt32 size;
+
+ etMemory_alloc* alloc;
+ etMemory_free* free;
+} etMemory;
+
+#endif /* _ETMEMORY_H_ */
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 2bb385725..b347c171e 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
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2012 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)
- *
- *******************************************************************************/
-
-#include "base/etMemory_FixedSize.h"
-#include "base/etQueue.h"
-#include "debugging/etLogger.h"
-#include "debugging/etMSCLogger.h"
-
-
-typedef struct etFixedSizeMemory {
- etMemory base;
-
- etUInt8 *buffer;
- etUInt16 maxBlocks;
- etUInt16 blockSize;
- etQueue blockPool;
-} etFixedSizeMemory;
-
-
-void* etMemory_FixedSize_alloc(etMemory* heap, etUInt16 size) {
- etFixedSizeMemory* self = (etFixedSizeMemory*) heap;
- void* mem = NULL;
- size = CEIL_ALIGN(size);
-
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "alloc")
-
- if (size<=self->blockSize){
- if (self->blockPool.size>0) {
- mem = etQueue_pop(&self->blockPool);
- }
- }
-
- ET_MSC_LOGGER_SYNC_EXIT
- return mem;
-}
-
-void etMemory_FixedSize_free(etMemory* heap, void* obj, etUInt16 size) {
- etFixedSizeMemory* self = (etFixedSizeMemory*) heap;
-
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "free")
-
- etQueue_push(&self->blockPool, obj);
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-/*
- * the public interface
- */
-etMemory* etMemory_FixedSize_init(void* heap, etUInt32 size, etUInt16 blockSize) {
- etFixedSizeMemory* self = (etFixedSizeMemory*) heap;
- size_t data_size = CEIL_ALIGN(sizeof(etFixedSizeMemory));
- int i;
-
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "init")
-
- self->base.size = size;
- self->base.alloc = etMemory_FixedSize_alloc;
- self->base.free = etMemory_FixedSize_free;
-
- if (size > data_size) {
- self->buffer = ((etUInt8*) self) + data_size;
- self->blockSize = blockSize;
- self->maxBlocks = (size - data_size) / self->blockSize;
- for (i=0; i<self->maxBlocks; i++){
- void* block = &(self->buffer[i*self->blockSize]);
- etQueue_push(&self->blockPool, block);
- }
- }
- else {
- self->blockSize = 0;
- }
-
- ET_MSC_LOGGER_SYNC_EXIT
-
- return &self->base;
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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)
+ *
+ *******************************************************************************/
+
+#include "base/etMemory_FixedSize.h"
+#include "base/etQueue.h"
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+
+typedef struct etFixedSizeMemory {
+ etMemory base;
+
+ etUInt8 *buffer;
+ etUInt16 maxBlocks;
+ etUInt16 blockSize;
+ etQueue blockPool;
+} etFixedSizeMemory;
+
+
+void* etMemory_FixedSize_alloc(etMemory* heap, etUInt16 size) {
+ etFixedSizeMemory* self = (etFixedSizeMemory*) heap;
+ void* mem = NULL;
+ size = CEIL_ALIGN(size);
+
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "alloc")
+
+ if (size<=self->blockSize){
+ if (self->blockPool.size>0) {
+ mem = etQueue_pop(&self->blockPool);
+ }
+ }
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ return mem;
+}
+
+void etMemory_FixedSize_free(etMemory* heap, void* obj, etUInt16 size) {
+ etFixedSizeMemory* self = (etFixedSizeMemory*) heap;
+
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "free")
+
+ etQueue_push(&self->blockPool, obj);
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+/*
+ * the public interface
+ */
+etMemory* etMemory_FixedSize_init(void* heap, etUInt32 size, etUInt16 blockSize) {
+ etFixedSizeMemory* self = (etFixedSizeMemory*) heap;
+ size_t data_size = CEIL_ALIGN(sizeof(etFixedSizeMemory));
+ int i;
+
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "init")
+
+ self->base.size = size;
+ self->base.alloc = etMemory_FixedSize_alloc;
+ self->base.free = etMemory_FixedSize_free;
+
+ if (size > data_size) {
+ self->buffer = ((etUInt8*) self) + data_size;
+ self->blockSize = blockSize;
+ self->maxBlocks = (size - data_size) / self->blockSize;
+ for (i=0; i<self->maxBlocks; i++){
+ void* block = &(self->buffer[i*self->blockSize]);
+ etQueue_push(&self->blockPool, block);
+ }
+ }
+ else {
+ self->blockSize = 0;
+ }
+
+ ET_MSC_LOGGER_SYNC_EXIT
+
+ return &self->base;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h
index eb037e92a..1a8715f0d 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2012 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_FIXED_SIZE_H_
-#define _ETMEMORY_FIXED_SIZE_H_
-
-#include "base/etMemory.h"
-#include "base/etQueue.h"
-
-/**
- * initializes the heap with a simple block management
- *
- * \param heap pointer to the heap to be managed
- * \param size the size in bytes of the heap
- * \param blockSize the size of the (equal sized) blocks
- *
- * \return the pointer to the initialized etMemory struct
- */
-etMemory* etMemory_FixedSize_init(void* heap, etUInt32 size, etUInt16 blockSize);
-
-#endif /* _ETMEMORY_FIXED_SIZE_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 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_FIXED_SIZE_H_
+#define _ETMEMORY_FIXED_SIZE_H_
+
+#include "base/etMemory.h"
+#include "base/etQueue.h"
+
+/**
+ * initializes the heap with a simple block management
+ *
+ * \param heap pointer to the heap to be managed
+ * \param size the size in bytes of the heap
+ * \param blockSize the size of the (equal sized) blocks
+ *
+ * \return the pointer to the initialized etMemory struct
+ */
+etMemory* etMemory_FixedSize_init(void* heap, etUInt32 size, etUInt16 blockSize);
+
+#endif /* _ETMEMORY_FIXED_SIZE_H_ */
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 4f23cb7bc..69fea62fb 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
@@ -1,207 +1,207 @@
-/*******************************************************************************
- * Copyright (c) 2012 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)
- *
- *******************************************************************************/
-
-#include "base/etMemory_FreeList.h"
-#include "debugging/etLogger.h"
-#include "debugging/etMSCLogger.h"
-
-#define UNUSED_LIST 0
-#define DEBUG_FREE_LISTS 1
-
-typedef struct etFreeListObj {
- struct etFreeListObj* next;
-} etFreeListObj;
-
-typedef struct etFreeListInfo {
- /** the size in bytes of the objects in this list */
- etUInt16 objsize;
-
- /** the list head */
- etFreeListObj* head;
-
-#if DEBUG_FREE_LISTS
- etUInt16 nobjects;
-#endif
-
-} etFreeListInfo;
-
-typedef struct etFreeListMemory {
- etMemory base;
-
- /** next free position on the heap */
- etUInt8* current;
-
- /** number of free lists */
- etUInt16 nslots;
-
- /** array of free list infos (array used with size nslots) */
- etFreeListInfo freelists[1];
-} etFreeListMemory;
-
-/*
- * private functions
- */
-static void* etMemory_getHeapMem(etFreeListMemory* self, etUInt16 size) {
- etUInt8* obj = NULL;
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "getHeapListMem")
-
- if (self->current < ((etUInt8*)self)+self->base.size)
- {
- obj = self->current;
- self->current += size;
- }
-
- ET_MSC_LOGGER_SYNC_EXIT
- return obj;
-}
-
-static void* etMemory_getFreeListMem(etFreeListMemory* self, etUInt16 size) {
- etUInt8* mem = NULL;
- int asize, slot_offset, slot, slot_size;
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "getFreeListMem")
-
- asize = (size / ALIGNMENT);
- for (slot_offset = 0; slot_offset < self->nslots; slot_offset++) {
- slot = (asize + slot_offset) % self->nslots;
- slot_size = self->freelists[slot].objsize;
- if (slot_size == size) {
- if (self->freelists[slot].head != NULL) {
- etFreeListObj* obj = self->freelists[slot].head;
- self->freelists[slot].head = obj->next;
- mem = (void *) obj;
-#if DEBUG_FREE_LISTS
- --self->freelists[slot].nobjects;
-#endif
- }
- break;
- }
- else if (slot_size == UNUSED_LIST)
- break;
- }
- ET_MSC_LOGGER_SYNC_EXIT
- return mem;
-}
-
-static void etMemory_putFreeListMem(etFreeListMemory* self, void* obj, etUInt16 size) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "putFreeListMem")
- {
- int asize, slot_offset, slot, slot_size;
-
- asize = (size / ALIGNMENT);
- for (slot_offset = 0; slot_offset < self->nslots; slot_offset++) {
- slot = (asize + slot_offset) % self->nslots;
- slot_size = self->freelists[slot].objsize;
- if (slot_size == size) {
- /* we insert the object as new head */
- ((etFreeListObj*)obj)->next = self->freelists[slot].head;
- self->freelists[slot].head = (etFreeListObj*)obj;
-#if DEBUG_FREE_LISTS
- ++self->freelists[slot].nobjects;
-#endif
- break;
- }
- else if (slot_size == UNUSED_LIST) {
- /* initialize unused list and insert the object as new head */
- self->freelists[slot].objsize = size;
- ((etFreeListObj*)obj)->next = NULL;
- self->freelists[slot].head = (etFreeListObj*)obj;
-#if DEBUG_FREE_LISTS
- self->freelists[slot].nobjects = 1;
-#endif
- break;
- }
- }
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void* etMemory_FreeList_alloc(etMemory* heap, etUInt16 size) {
- void* mem;
- size = CEIL_ALIGN(size);
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "alloc")
-
- mem = etMemory_getFreeListMem((etFreeListMemory*) heap, size);
- if (mem==NULL)
- mem = etMemory_getHeapMem((etFreeListMemory*) heap, size);
-
- ET_MSC_LOGGER_SYNC_EXIT
- return mem;
-}
-
-void etMemory_FreeList_free(etMemory* heap, void* obj, etUInt16 size) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "free")
- {
- size = CEIL_ALIGN(size);
- etMemory_putFreeListMem((etFreeListMemory*) heap, obj, size);
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-/*
- * the public interface
- */
-etMemory* etMemory_FreeList_init(void* heap, etUInt32 size, etUInt16 nslots) {
- etFreeListMemory* self = (etFreeListMemory*) heap;
- ET_MSC_LOGGER_SYNC_ENTRY("etMemory_FreeList_init", "init")
-
- self->base.size = size;
- self->base.alloc = etMemory_FreeList_alloc;
- self->base.free = etMemory_FreeList_free;
- self->nslots = nslots;
- {
- int used = sizeof(etFreeListMemory)+(self->nslots-1)*sizeof(etFreeListObj);
- self->current = ((etUInt8*)self)+CEIL_ALIGN(used);
- }
-
- /* initialize the free lists */
- {
- int i;
- for (i=0; i<self->nslots; ++i)
- self->freelists[i].objsize = UNUSED_LIST;
- }
- ET_MSC_LOGGER_SYNC_EXIT
-
- return &self->base;
-}
-
-etUInt32 etMemory_FreeList_freeHeapMem(void* heap) {
- etFreeListMemory* self = (etFreeListMemory*) heap;
- return ((etUInt8*)self)+self->base.size - self->current;
-}
-
-etUInt16 etMemory_FreeList_freeSlots(void* heap) {
- etFreeListMemory* self = (etFreeListMemory*) heap;
- etUInt16 free = 0;
- int slot;
-
- for (slot=0; slot<self->nslots; ++slot)
- if (self->freelists[slot].objsize==UNUSED_LIST)
- ++free;
-
- return free;
-}
-
-etUInt16 etMemory_FreeList_nObjects(void* heap, etUInt16 slot) {
-#if DEBUG_FREE_LISTS
- etFreeListMemory* self = (etFreeListMemory*) heap;
- if (slot<self->nslots)
- return self->freelists[slot].nobjects;
-#endif
- return 0;
-}
-
-etUInt16 etMemory_FreeList_sizeObjects(void* heap, etUInt16 slot) {
- etFreeListMemory* self = (etFreeListMemory*) heap;
- if (slot<self->nslots)
- return self->freelists[slot].objsize;
- return 0;
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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)
+ *
+ *******************************************************************************/
+
+#include "base/etMemory_FreeList.h"
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+#define UNUSED_LIST 0
+#define DEBUG_FREE_LISTS 1
+
+typedef struct etFreeListObj {
+ struct etFreeListObj* next;
+} etFreeListObj;
+
+typedef struct etFreeListInfo {
+ /** the size in bytes of the objects in this list */
+ etUInt16 objsize;
+
+ /** the list head */
+ etFreeListObj* head;
+
+#if DEBUG_FREE_LISTS
+ etUInt16 nobjects;
+#endif
+
+} etFreeListInfo;
+
+typedef struct etFreeListMemory {
+ etMemory base;
+
+ /** next free position on the heap */
+ etUInt8* current;
+
+ /** number of free lists */
+ etUInt16 nslots;
+
+ /** array of free list infos (array used with size nslots) */
+ etFreeListInfo freelists[1];
+} etFreeListMemory;
+
+/*
+ * private functions
+ */
+static void* etMemory_getHeapMem(etFreeListMemory* self, etUInt16 size) {
+ etUInt8* obj = NULL;
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "getHeapListMem")
+
+ if (self->current < ((etUInt8*)self)+self->base.size)
+ {
+ obj = self->current;
+ self->current += size;
+ }
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ return obj;
+}
+
+static void* etMemory_getFreeListMem(etFreeListMemory* self, etUInt16 size) {
+ etUInt8* mem = NULL;
+ int asize, slot_offset, slot, slot_size;
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "getFreeListMem")
+
+ asize = (size / ALIGNMENT);
+ for (slot_offset = 0; slot_offset < self->nslots; slot_offset++) {
+ slot = (asize + slot_offset) % self->nslots;
+ slot_size = self->freelists[slot].objsize;
+ if (slot_size == size) {
+ if (self->freelists[slot].head != NULL) {
+ etFreeListObj* obj = self->freelists[slot].head;
+ self->freelists[slot].head = obj->next;
+ mem = (void *) obj;
+#if DEBUG_FREE_LISTS
+ --self->freelists[slot].nobjects;
+#endif
+ }
+ break;
+ }
+ else if (slot_size == UNUSED_LIST)
+ break;
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+ return mem;
+}
+
+static void etMemory_putFreeListMem(etFreeListMemory* self, void* obj, etUInt16 size) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "putFreeListMem")
+ {
+ int asize, slot_offset, slot, slot_size;
+
+ asize = (size / ALIGNMENT);
+ for (slot_offset = 0; slot_offset < self->nslots; slot_offset++) {
+ slot = (asize + slot_offset) % self->nslots;
+ slot_size = self->freelists[slot].objsize;
+ if (slot_size == size) {
+ /* we insert the object as new head */
+ ((etFreeListObj*)obj)->next = self->freelists[slot].head;
+ self->freelists[slot].head = (etFreeListObj*)obj;
+#if DEBUG_FREE_LISTS
+ ++self->freelists[slot].nobjects;
+#endif
+ break;
+ }
+ else if (slot_size == UNUSED_LIST) {
+ /* initialize unused list and insert the object as new head */
+ self->freelists[slot].objsize = size;
+ ((etFreeListObj*)obj)->next = NULL;
+ self->freelists[slot].head = (etFreeListObj*)obj;
+#if DEBUG_FREE_LISTS
+ self->freelists[slot].nobjects = 1;
+#endif
+ break;
+ }
+ }
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void* etMemory_FreeList_alloc(etMemory* heap, etUInt16 size) {
+ void* mem;
+ size = CEIL_ALIGN(size);
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "alloc")
+
+ mem = etMemory_getFreeListMem((etFreeListMemory*) heap, size);
+ if (mem==NULL)
+ mem = etMemory_getHeapMem((etFreeListMemory*) heap, size);
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ return mem;
+}
+
+void etMemory_FreeList_free(etMemory* heap, void* obj, etUInt16 size) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "free")
+ {
+ size = CEIL_ALIGN(size);
+ etMemory_putFreeListMem((etFreeListMemory*) heap, obj, size);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+/*
+ * the public interface
+ */
+etMemory* etMemory_FreeList_init(void* heap, etUInt32 size, etUInt16 nslots) {
+ etFreeListMemory* self = (etFreeListMemory*) heap;
+ ET_MSC_LOGGER_SYNC_ENTRY("etMemory_FreeList_init", "init")
+
+ self->base.size = size;
+ self->base.alloc = etMemory_FreeList_alloc;
+ self->base.free = etMemory_FreeList_free;
+ self->nslots = nslots;
+ {
+ int used = sizeof(etFreeListMemory)+(self->nslots-1)*sizeof(etFreeListObj);
+ self->current = ((etUInt8*)self)+CEIL_ALIGN(used);
+ }
+
+ /* initialize the free lists */
+ {
+ int i;
+ for (i=0; i<self->nslots; ++i)
+ self->freelists[i].objsize = UNUSED_LIST;
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+
+ return &self->base;
+}
+
+etUInt32 etMemory_FreeList_freeHeapMem(void* heap) {
+ etFreeListMemory* self = (etFreeListMemory*) heap;
+ return ((etUInt8*)self)+self->base.size - self->current;
+}
+
+etUInt16 etMemory_FreeList_freeSlots(void* heap) {
+ etFreeListMemory* self = (etFreeListMemory*) heap;
+ etUInt16 free = 0;
+ int slot;
+
+ for (slot=0; slot<self->nslots; ++slot)
+ if (self->freelists[slot].objsize==UNUSED_LIST)
+ ++free;
+
+ return free;
+}
+
+etUInt16 etMemory_FreeList_nObjects(void* heap, etUInt16 slot) {
+#if DEBUG_FREE_LISTS
+ etFreeListMemory* self = (etFreeListMemory*) heap;
+ if (slot<self->nslots)
+ return self->freelists[slot].nobjects;
+#endif
+ return 0;
+}
+
+etUInt16 etMemory_FreeList_sizeObjects(void* heap, etUInt16 slot) {
+ etFreeListMemory* self = (etFreeListMemory*) heap;
+ if (slot<self->nslots)
+ return self->freelists[slot].objsize;
+ return 0;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h
index 3f46272cf..b5842d523 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2012 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_FREE_LIST_H_
-#define _ETMEMORY_FREE_LIST_H_
-
-#include "base/etMemory.h"
-
-/**
- * initializes the free list memory management on the given heap
- *
- * \param heap pointer to the heap to be managed
- * \param size the size in bytes of the heap
- * \param nslots the number of slots to be used (should be greater or equal the number of different object sizes)
- *
- * \return the pointer to the initialized etMemory struct
- */
-
-etMemory* etMemory_FreeList_init(void* heap, etUInt32 size, etUInt16 nslots);
-
-etUInt32 etMemory_FreeList_freeHeapMem(void* heap);
-etUInt16 etMemory_FreeList_nObjects(void* heap, etUInt16 slot);
-etUInt16 etMemory_FreeList_sizeObjects(void* heap, etUInt16 slot);
-etUInt16 etMemory_FreeList_freeSlots(void* heap);
-
-#endif /* _ETMEMORY_FREE_LIST_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 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_FREE_LIST_H_
+#define _ETMEMORY_FREE_LIST_H_
+
+#include "base/etMemory.h"
+
+/**
+ * initializes the free list memory management on the given heap
+ *
+ * \param heap pointer to the heap to be managed
+ * \param size the size in bytes of the heap
+ * \param nslots the number of slots to be used (should be greater or equal the number of different object sizes)
+ *
+ * \return the pointer to the initialized etMemory struct
+ */
+
+etMemory* etMemory_FreeList_init(void* heap, etUInt32 size, etUInt16 nslots);
+
+etUInt32 etMemory_FreeList_freeHeapMem(void* heap);
+etUInt16 etMemory_FreeList_nObjects(void* heap, etUInt16 slot);
+etUInt16 etMemory_FreeList_sizeObjects(void* heap, etUInt16 slot);
+etUInt16 etMemory_FreeList_freeSlots(void* heap);
+
+#endif /* _ETMEMORY_FREE_LIST_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c
index 418bf5867..7659bafb6 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.c
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "base/etQueue.h"
-#include "debugging/etMSCLogger.h"
-
-void etQueue_init(etQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "init")
-
- self->first = NULL;
- self->last = NULL;
- self->highWaterMark = 0;
- self->size = 0;
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-void etQueue_push(etQueue* self, etQueueObj* obj){
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "push")
-
- if (self->first == NULL) {
- /*no object in queue*/
- self->first = self->last = obj;
- }
- else {
- /*at least one object in queue*/
- self->last->next = obj;
- self->last = obj;
- }
- obj->next = NULL; /*TODO: optimization: this line could be removed if we assume that all objects are initialized*/
-
- if (++self->size > self->highWaterMark)
- self->highWaterMark++;
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-etQueueObj* etQueue_pop(etQueue* self){
- etQueueObj* pop_msg = self->first;
-
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "pop")
-
- if (self->first == NULL){
- /*no message in queue*/
- ET_MSC_LOGGER_SYNC_EXIT
- return NULL;
- }
- if (self->first->next==NULL){
- /*only one message in queue*/
- self->first = self->last = NULL;
- }
- else {
- /*more than one message in queue -> set first to nex message*/
- self->first = self->first->next;
- }
-
- pop_msg->next=NULL;
- self->size--;
-
- ET_MSC_LOGGER_SYNC_EXIT
- return pop_msg;
-}
-
-etInt16 etQueue_getSize(etQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getSize")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->size;
-}
-
-etQueueObj* etQueue_getFirst(etQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getFirst")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->first;
-}
-
-etQueueObj* etQueue_getLast(etQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getLast")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->last;
-}
-
-etBool etQueue_isNotEmpty(etQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "isNotEmpty")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->last != NULL;
-}
-
-etInt16 etQueue_getHighWaterMark(etQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getHightWaterMark")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->highWaterMark;
-}
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "base/etQueue.h"
+#include "debugging/etMSCLogger.h"
+
+void etQueue_init(etQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "init")
+
+ self->first = NULL;
+ self->last = NULL;
+ self->highWaterMark = 0;
+ self->size = 0;
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+
+void etQueue_push(etQueue* self, etQueueObj* obj){
+ ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "push")
+
+ if (self->first == NULL) {
+ /*no object in queue*/
+ self->first = self->last = obj;
+ }
+ else {
+ /*at least one object in queue*/
+ self->last->next = obj;
+ self->last = obj;
+ }
+ obj->next = NULL; /*TODO: optimization: this line could be removed if we assume that all objects are initialized*/
+
+ if (++self->size > self->highWaterMark)
+ self->highWaterMark++;
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etQueueObj* etQueue_pop(etQueue* self){
+ etQueueObj* pop_msg = self->first;
+
+ ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "pop")
+
+ if (self->first == NULL){
+ /*no message in queue*/
+ ET_MSC_LOGGER_SYNC_EXIT
+ return NULL;
+ }
+ if (self->first->next==NULL){
+ /*only one message in queue*/
+ self->first = self->last = NULL;
+ }
+ else {
+ /*more than one message in queue -> set first to nex message*/
+ self->first = self->first->next;
+ }
+
+ pop_msg->next=NULL;
+ self->size--;
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ return pop_msg;
+}
+
+etInt16 etQueue_getSize(etQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getSize")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->size;
+}
+
+etQueueObj* etQueue_getFirst(etQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getFirst")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->first;
+}
+
+etQueueObj* etQueue_getLast(etQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getLast")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->last;
+}
+
+etBool etQueue_isNotEmpty(etQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "isNotEmpty")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->last != NULL;
+}
+
+etInt16 etQueue_getHighWaterMark(etQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etQueue", "getHightWaterMark")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->highWaterMark;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
index ab656d154..aee2780f0 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETQUEUE_H_
-#define _ETQUEUE_H_
-
-#include <stddef.h>
-#include "etDatatypes.h"
-
-typedef struct etQueueObj {
- struct etQueueObj* next;
-} etQueueObj;
-
-typedef struct etQueue {
- etQueueObj* first;
- etQueueObj* last;
- etInt16 highWaterMark;
- etInt16 size;
-
-} etQueue;
-
-void etQueue_init(etQueue* self);
-
-void etQueue_push(etQueue* self, etQueueObj* obj);
-
-etQueueObj* etQueue_pop(etQueue* self);
-
-etQueueObj* etQueue_getFirst(etQueue* self);
-
-etQueueObj* etQueue_getLast(etQueue* self);
-
-etBool etQueue_isNotEmpty(etQueue* self);
-
-etInt16 etQueue_getHighWaterMark(etQueue* self);
-
-etInt16 etQueue_getSize(etQueue* self);
-
-
-
-#endif /* _ETQUEUE_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETQUEUE_H_
+#define _ETQUEUE_H_
+
+#include <stddef.h>
+#include "etDatatypes.h"
+
+typedef struct etQueueObj {
+ struct etQueueObj* next;
+} etQueueObj;
+
+typedef struct etQueue {
+ etQueueObj* first;
+ etQueueObj* last;
+ etInt16 highWaterMark;
+ etInt16 size;
+
+} etQueue;
+
+void etQueue_init(etQueue* self);
+
+void etQueue_push(etQueue* self, etQueueObj* obj);
+
+etQueueObj* etQueue_pop(etQueue* self);
+
+etQueueObj* etQueue_getFirst(etQueue* self);
+
+etQueueObj* etQueue_getLast(etQueue* self);
+
+etBool etQueue_isNotEmpty(etQueue* self);
+
+etInt16 etQueue_getHighWaterMark(etQueue* self);
+
+etInt16 etQueue_getSize(etQueue* self);
+
+
+
+#endif /* _ETQUEUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h
index 6c46889a8..b353e6f1a 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-/*
- * etLogger.h
- *
- * Created on: 16.01.2012
- * Author: tschuetz
- */
-
-#ifndef _ETLOGGER_H_
-#define _ETLOGGER_H_
-
-#include <stdio.h>
-#include "etDatatypes.h"
-/* logging */
-
-void etLogger_logError(const char* message);
-
-void etLogger_logWarning(const char* message);
-
-void etLogger_logInfo(const char* message);
-
-void etLogger_logErrorF(const char* format, ... );
-
-void etLogger_logWarningF(const char* format, ... );
-
-void etLogger_logInfoF(const char* format, ... );
-
-
-/* File handling */
-
-etFileHandle etLogger_fopen(const char* filename, const char* mode);
-
-int etLogger_fclose(etFileHandle file);
-
-void etLogger_fprintf(etFileHandle file, const char* format, ... );
-
-#endif /* _ETLOGGER_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+/*
+ * etLogger.h
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+#ifndef _ETLOGGER_H_
+#define _ETLOGGER_H_
+
+#include <stdio.h>
+#include "etDatatypes.h"
+/* logging */
+
+void etLogger_logError(const char* message);
+
+void etLogger_logWarning(const char* message);
+
+void etLogger_logInfo(const char* message);
+
+void etLogger_logErrorF(const char* format, ... );
+
+void etLogger_logWarningF(const char* format, ... );
+
+void etLogger_logInfoF(const char* format, ... );
+
+
+/* File handling */
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode);
+
+int etLogger_fclose(etFileHandle file);
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... );
+
+#endif /* _ETLOGGER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
index d1df849fe..e701c0544 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "debugging/etMSCLogger.h"
-#include "debugging/etLogger.h"
-
-#include "osal/etThread.h"
-
-static etFileHandle etMSCLogger_fileHandle = NULL;
-static const char* etMSCLogger_objectName = "";
-
-/*TODO: move or replace ET_MAX_FILENAME_LEN */
-#define ET_MAX_FILENAME_LEN 256
-
-void etMSCLogger_open(const char* logPath, const char* mscName){
- char path[ET_MAX_FILENAME_LEN];
- sprintf(path, "%s/%s.seq", logPath, mscName);
- etMSCLogger_fileHandle = etLogger_fopen(path, "w+");
-}
-
-void etMSCLogger_close(void){
- if (etMSCLogger_fileHandle != NULL){
- etLogger_fclose(etMSCLogger_fileHandle);
- }
-
-}
-
-void etMSCLogger_setObjectName(const char* objectName){
- etMSCLogger_objectName = objectName;
-}
-
-const char* etMSCLogger_getObjectName(void){
- return etMSCLogger_objectName;
-}
-
-void etMSCLogger_syncCall(const char* sourceName, const char* messageName, const char* targetName){
- if (etMSCLogger_fileHandle != NULL) {
- etLogger_fprintf(etMSCLogger_fileHandle, "%s ==> %s %s(thread=%ld)\n", sourceName, targetName, messageName, etThread_self_id());
- }
-}
-
-void etMSCLogger_syncReturn(const char* sourceName, const char* targetName){
- if (etMSCLogger_fileHandle != NULL) {
- etLogger_fprintf(etMSCLogger_fileHandle, "%s <== %s\n", sourceName, targetName);
- }
-}
-
-void etMSCLogger_asyncOut(const char* sourceName, const char* messageName, const char* targetName){
- if (etMSCLogger_fileHandle != NULL) {
- etLogger_fprintf(etMSCLogger_fileHandle, "%s >-- %s %s\n", sourceName, targetName, messageName);
- }
-}
-
-void etMSCLogger_asyncIn(const char* sourceName, const char* messageName, const char* targetName){
- if (etMSCLogger_fileHandle != NULL) {
- etLogger_fprintf(etMSCLogger_fileHandle, "%s --> %s %s\n", sourceName, targetName, messageName);
- }
-}
-
-void etMSCLogger_setState(const char* objectName, const char* stateName){
- if (etMSCLogger_fileHandle != NULL) {
- etLogger_fprintf(etMSCLogger_fileHandle, "%s >>> %s\n", objectName, stateName);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "debugging/etMSCLogger.h"
+#include "debugging/etLogger.h"
+
+#include "osal/etThread.h"
+
+static etFileHandle etMSCLogger_fileHandle = NULL;
+static const char* etMSCLogger_objectName = "";
+
+/*TODO: move or replace ET_MAX_FILENAME_LEN */
+#define ET_MAX_FILENAME_LEN 256
+
+void etMSCLogger_open(const char* logPath, const char* mscName){
+ char path[ET_MAX_FILENAME_LEN];
+ sprintf(path, "%s/%s.seq", logPath, mscName);
+ etMSCLogger_fileHandle = etLogger_fopen(path, "w+");
+}
+
+void etMSCLogger_close(void){
+ if (etMSCLogger_fileHandle != NULL){
+ etLogger_fclose(etMSCLogger_fileHandle);
+ }
+
+}
+
+void etMSCLogger_setObjectName(const char* objectName){
+ etMSCLogger_objectName = objectName;
+}
+
+const char* etMSCLogger_getObjectName(void){
+ return etMSCLogger_objectName;
+}
+
+void etMSCLogger_syncCall(const char* sourceName, const char* messageName, const char* targetName){
+ if (etMSCLogger_fileHandle != NULL) {
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s ==> %s %s(thread=%ld)\n", sourceName, targetName, messageName, etThread_self_id());
+ }
+}
+
+void etMSCLogger_syncReturn(const char* sourceName, const char* targetName){
+ if (etMSCLogger_fileHandle != NULL) {
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s <== %s\n", sourceName, targetName);
+ }
+}
+
+void etMSCLogger_asyncOut(const char* sourceName, const char* messageName, const char* targetName){
+ if (etMSCLogger_fileHandle != NULL) {
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s >-- %s %s\n", sourceName, targetName, messageName);
+ }
+}
+
+void etMSCLogger_asyncIn(const char* sourceName, const char* messageName, const char* targetName){
+ if (etMSCLogger_fileHandle != NULL) {
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s --> %s %s\n", sourceName, targetName, messageName);
+ }
+}
+
+void etMSCLogger_setState(const char* objectName, const char* stateName){
+ if (etMSCLogger_fileHandle != NULL) {
+ etLogger_fprintf(etMSCLogger_fileHandle, "%s >>> %s\n", objectName, stateName);
+ }
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
index 131fa2343..dcef23aeb 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETMSCLOGGER_H_
-#define _ETMSCLOGGER_H_
-
-#include "etRuntimeConfig.h"
-
-void etMSCLogger_open(const char* logPath, const char* mscName);
-void etMSCLogger_close(void);
-
-void etMSCLogger_setObjectName(const char* objectName);
-const char* etMSCLogger_getObjectName(void);
-
-void etMSCLogger_syncCall(const char* sourceName, const char* messageName, const char* targetName);
-void etMSCLogger_syncReturn(const char* sourceName, const char* targetName);
-
-void etMSCLogger_asyncOut(const char* sourceName, const char* messageName, const char* targetName);
-void etMSCLogger_asyncIn(const char* sourceName, const char* messageName, const char* targetName);
-
-void etMSCLogger_setState(const char* objectName, const char* stateName);
-
-#ifdef ET_MSC_LOGGER_ACTIVATE
- #define ET_MSC_LOGGER_OPEN(object) \
- etMSCLogger_open("tmp/log", "msc"); \
- etMSCLogger_setObjectName(object);
-
- #define ET_MSC_LOGGER_CLOSE etMSCLogger_close();
-
- #define ET_MSC_LOGGER_CHANGE_STATE(objectName, stateName) \
- etMSCLogger_setState(objectName, stateName);
-
- #ifdef ET_SYNC_MSC_LOGGER_ACTIVATE
- #define ET_MSC_LOGGER_SYNC_ENTRY(object, message) \
- const char* sourceName = etMSCLogger_getObjectName(); \
- const char* targetName = object; \
- etMSCLogger_syncCall(sourceName, message, targetName); \
- etMSCLogger_setObjectName(targetName);
- #define ET_MSC_LOGGER_SYNC_EXIT \
- etMSCLogger_syncReturn(sourceName, targetName); \
- etMSCLogger_setObjectName(sourceName);
- #else
- #define ET_MSC_LOGGER_SYNC_ENTRY(object, message)
- #define ET_MSC_LOGGER_SYNC_EXIT
- #endif
-
-
- #ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE
- #define ET_MSC_LOGGER_ASYNC_OUT(sourceName, message, targetName) \
- etMSCLogger_asyncOut(sourceName, message, targetName);
-
- #define ET_MSC_LOGGER_ASYNC_IN(sourceName, message, targetName) \
- etMSCLogger_asyncIn(sourceName, message, targetName);
- #else
- #define ET_MSC_LOGGER_ASYNC_OUT(sourceName, message, targetName)
- #define ET_MSC_LOGGER_ASYNC_IN(sourceName, message, targetName)
- #endif
-
-
-#else
- #define ET_MSC_LOGGER_OPEN
- #define ET_MSC_LOGGER_CLOSE
-
- #define ET_MSC_LOGGER_SYNC_ENTRY(object, message)
- #define ET_MSC_LOGGER_SYNC_EXIT
-
- #define ET_MSC_LOGGER_ASYNC_OUT(sourceName, message, targetName)
- #define ET_MSC_LOGGER_ASYNC_IN(sourceName, message, targetName)
-
- #define ET_MSC_LOGGER_CHANGE_STATE(objectName, stateName)
-#endif
-
-
-#endif /* _ETMSCLOGGER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETMSCLOGGER_H_
+#define _ETMSCLOGGER_H_
+
+#include "etRuntimeConfig.h"
+
+void etMSCLogger_open(const char* logPath, const char* mscName);
+void etMSCLogger_close(void);
+
+void etMSCLogger_setObjectName(const char* objectName);
+const char* etMSCLogger_getObjectName(void);
+
+void etMSCLogger_syncCall(const char* sourceName, const char* messageName, const char* targetName);
+void etMSCLogger_syncReturn(const char* sourceName, const char* targetName);
+
+void etMSCLogger_asyncOut(const char* sourceName, const char* messageName, const char* targetName);
+void etMSCLogger_asyncIn(const char* sourceName, const char* messageName, const char* targetName);
+
+void etMSCLogger_setState(const char* objectName, const char* stateName);
+
+#ifdef ET_MSC_LOGGER_ACTIVATE
+ #define ET_MSC_LOGGER_OPEN(object) \
+ etMSCLogger_open("tmp/log", "msc"); \
+ etMSCLogger_setObjectName(object);
+
+ #define ET_MSC_LOGGER_CLOSE etMSCLogger_close();
+
+ #define ET_MSC_LOGGER_CHANGE_STATE(objectName, stateName) \
+ etMSCLogger_setState(objectName, stateName);
+
+ #ifdef ET_SYNC_MSC_LOGGER_ACTIVATE
+ #define ET_MSC_LOGGER_SYNC_ENTRY(object, message) \
+ const char* sourceName = etMSCLogger_getObjectName(); \
+ const char* targetName = object; \
+ etMSCLogger_syncCall(sourceName, message, targetName); \
+ etMSCLogger_setObjectName(targetName);
+ #define ET_MSC_LOGGER_SYNC_EXIT \
+ etMSCLogger_syncReturn(sourceName, targetName); \
+ etMSCLogger_setObjectName(sourceName);
+ #else
+ #define ET_MSC_LOGGER_SYNC_ENTRY(object, message)
+ #define ET_MSC_LOGGER_SYNC_EXIT
+ #endif
+
+
+ #ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE
+ #define ET_MSC_LOGGER_ASYNC_OUT(sourceName, message, targetName) \
+ etMSCLogger_asyncOut(sourceName, message, targetName);
+
+ #define ET_MSC_LOGGER_ASYNC_IN(sourceName, message, targetName) \
+ etMSCLogger_asyncIn(sourceName, message, targetName);
+ #else
+ #define ET_MSC_LOGGER_ASYNC_OUT(sourceName, message, targetName)
+ #define ET_MSC_LOGGER_ASYNC_IN(sourceName, message, targetName)
+ #endif
+
+
+#else
+ #define ET_MSC_LOGGER_OPEN
+ #define ET_MSC_LOGGER_CLOSE
+
+ #define ET_MSC_LOGGER_SYNC_ENTRY(object, message)
+ #define ET_MSC_LOGGER_SYNC_EXIT
+
+ #define ET_MSC_LOGGER_ASYNC_OUT(sourceName, message, targetName)
+ #define ET_MSC_LOGGER_ASYNC_IN(sourceName, message, targetName)
+
+ #define ET_MSC_LOGGER_CHANGE_STATE(objectName, stateName)
+#endif
+
+
+#endif /* _ETMSCLOGGER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
index 8fe509f55..9c8c3e228 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
@@ -1,343 +1,343 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "etUnit/etUnit.h"
-#include <string.h>
-#include <time.h>
-#include <stdlib.h>
-#include "debugging/etLogger.h"
-#include "osal/etSema.h"
-#include "runtime/etRuntime.h"
-
-
-/*** member variables */
-
-/* file handling */
-static FILE* etUnit_reportfile = NULL;
-
-/* counters */
-static etInt16 etUnit_nextCaseId = 1;
-static etInt32 etUnit_errorCounter = 0;
-
-#define ETUNIT_MAX_TEST_CASES 256
-static etBool etUnit_testcaseSuccess[ETUNIT_MAX_TEST_CASES];
-
-#define ETUNIT_FAILURE_TEXT_LEN 256
-
-/* time measuring */
-static clock_t etUnit_startTime = 0;
-static clock_t etUnit_currentTime = 0;
-
-/* order */
-#define ETUNIT_ORDER_MAX 16
-typedef struct OrderInfo {
- etInt16 id;
- etInt16 currentIndex;
- etInt16 size;
- etInt16* list;
-}
-OrderInfo;
-static OrderInfo etUnit_orderInfo[ETUNIT_ORDER_MAX];
-
-/* forward declarations of private functions */
-static void expect_equal_int(etInt16 id, const char* message, etInt32 expected, etInt32 actual, const char* file, int line);
-static void expect_equal_uint(etInt16 id, const char* message, etUInt32 expected, etUInt32 actual, const char* file, int line);
-static void expect_equal_float(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line);
-static void etUnit_handleExpect(etInt16 id, etBool result, const char *trace, const char* expected, const char* actual, const char* file, int line);
-
-/* public functions */
-
-void etUnit_open(const char* testResultPath, const char* testFileName) {
- etLogger_logInfoF("************* TEST START (%s) **************", testFileName);
-
- {
- char filename[ETUNIT_FAILURE_TEXT_LEN];
- int i;
-
- if (testResultPath!=NULL)
- sprintf(filename, "%s/%s.etu", testResultPath, testFileName);
- else
- sprintf(filename, "%s.etu", testFileName);
-
- /* init global data */
- for (i=0; i<ETUNIT_ORDER_MAX; ++i)
- etUnit_orderInfo[i].id = 0;
- for (i=0; i<ETUNIT_MAX_TEST_CASES; ++i)
- etUnit_testcaseSuccess[i] = TRUE;
-
- if (etUnit_reportfile == NULL) {
- etUnit_reportfile = etLogger_fopen(filename, "w+");
- if (etUnit_reportfile != NULL) {
- etLogger_fprintf(etUnit_reportfile, "etUnit report\n");
- } else {
- etLogger_logErrorF("Unable to open file %s", filename);
- }
- }
- }
-
- /* prepare time measurement */
- etUnit_startTime = clock();
- etUnit_currentTime = clock();
- etLogger_logInfoF("Start Time: %ld", etUnit_startTime);
-
-}
-
-void etUnit_close(void) {
- if (etUnit_reportfile != NULL) {
- etLogger_fclose(etUnit_reportfile);
- etUnit_reportfile = NULL;
- }
- etLogger_logInfoF("End Time: %ld", clock());
- if (etUnit_errorCounter==0)
- etLogger_logInfoF("Error Counter: %ld", etUnit_errorCounter);
- else
- etLogger_logErrorF("Error Counter: %ld", etUnit_errorCounter);
- etLogger_logInfoF("************* TEST END **************");
-}
-
-void etUnit_openTestSuite(const char* testSuiteName) {
- if (etUnit_reportfile != NULL) {
- etLogger_fprintf(etUnit_reportfile, "ts start: %s\n", testSuiteName);
- }
-}
-
-void etUnit_closeTestSuite(void) {
-}
-
-etInt16 etUnit_openTestCase(const char* testCaseName) {
- etInt16 caseId = etUnit_nextCaseId++;
-
- if (caseId >= ETUNIT_MAX_TEST_CASES) {
- etLogger_logErrorF("Too many test cases. Maximum number of test cases is %d\n", ETUNIT_MAX_TEST_CASES);
- etLogger_logErrorF("ETUNIT_MAX_TEST_CASES (etUnit_openTestCase, %s: %d)", __FILE__, __LINE__);
- exit(-1);
- }
- if (etUnit_reportfile != NULL) {
- etLogger_fprintf(etUnit_reportfile, "tc start %d: %s\n", caseId, testCaseName);
- }
-
- return caseId;
-}
-
-void etUnit_closeTestCase(etInt16 id) {
- clock_t time = clock() - etUnit_currentTime;
- etUnit_currentTime = clock();
-
- if (etUnit_reportfile != NULL) {
- etLogger_fprintf(etUnit_reportfile, "tc end %d: %d\n", id, time);
- }
-}
-
-etInt16 etUnit_openAll(const char* testResultPath, const char* testFileName, const char* testSuiteName, const char* testCaseName){
- etUnit_open(testResultPath, testFileName);
- etUnit_openTestSuite(testSuiteName);
- return etUnit_openTestCase(testCaseName);
-}
-
-void etUnit_closeAll(etInt16 id){
- etUnit_closeTestCase(id);
- etUnit_closeTestSuite();
- etUnit_close();
-}
-
-void etUnit_testFinished(etInt16 id) {
- etSema_wakeup(etRuntime_getTerminateSemaphore());
-}
-
-void expectTrue(etInt16 id, const char* message, etBool condition, const char* file, int line) {
- if (condition == FALSE) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message);
- etUnit_handleExpect(id, FALSE, testresult, "TRUE", "FALSE", file, line);
- } else {
- etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
- }
-}
-
-void expectFalse(etInt16 id, const char* message, etBool condition, const char* file, int line) {
- if (condition == TRUE) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: EXPECT_FALSE == TRUE", message);
- etUnit_handleExpect(id, FALSE, testresult, "FALSE", "TRUE", file, line);
- } else {
- etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
- }
-}
-
-void expectEqualInt8(etInt16 id, const char* message, etInt8 expected, etInt8 actual, const char* file, int line) {
- expect_equal_int(id, message, (etInt32) expected, (etInt32) actual, file, line);
-}
-
-void expectEqualInt16(etInt16 id, const char* message, etInt16 expected, etInt16 actual, const char* file, int line) {
- expect_equal_int(id, message, (etInt32) expected, (etInt32) actual, file, line);
-}
-
-void expectEqualInt32(etInt16 id, const char* message, etInt32 expected, etInt32 actual, const char* file, int line) {
- expect_equal_int(id, message, (etInt32) expected, (etInt32) actual, file, line);
-}
-
-void expectEqualUInt8(etInt16 id, const char* message, etUInt8 expected, etUInt8 actual, const char* file, int line) {
- expect_equal_uint(id, message, (etUInt32) expected, (etUInt32) actual, file, line);
-}
-
-void expectEqualUInt16(etInt16 id, const char* message, etUInt16 expected, etUInt16 actual, const char* file, int line) {
- expect_equal_uint(id, message, (etUInt32) expected, (etUInt32) actual, file, line);
-}
-
-void expectEqualUInt32(etInt16 id, const char* message, etUInt32 expected, etUInt32 actual, const char* file, int line) {
- expect_equal_uint(id, message, (etUInt32) expected, (etUInt32) actual, file, line);
-}
-
-void expect_equal_void_ptr(etInt16 id, const char* message, const void* expected, const void* actual, const char* file, int line) {
- if (expected != actual) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- char exp[16], act[16];
- sprintf(testresult, "%s: expected=%ld, actual=%ld", message, (etUInt32) expected, (etUInt32) actual);
- sprintf(exp, "%ld", (etUInt32) expected);
- sprintf(act, "%ld", (etUInt32) actual);
- etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
- } else {
- etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
- }
-}
-
-void expectEqualFloat32(etInt16 id, const char* message, etFloat32 expected, etFloat32 actual, etFloat32 precision, const char* file, int line) {
- expect_equal_float(id, message, expected, actual, precision, file, line);
-}
-
-void expectEqualFloat64(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line) {
- expect_equal_float(id, message, expected, actual, precision, file, line);
-}
-
-static OrderInfo* getOrderInfo(etInt16 id) {
- int i;
- for (i=0; i<ETUNIT_ORDER_MAX; ++i)
- if (etUnit_orderInfo[i].id==id)
- return etUnit_orderInfo+i;
-
- return NULL;
-}
-
-void expectOrderStart(etInt16 id, etInt16* list, etInt16 size, const char* file, int line) {
- int i;
- for (i=0; i<ETUNIT_ORDER_MAX; ++i)
- if (etUnit_orderInfo[i].id==0) {
- etUnit_orderInfo[i].id = id;
- etUnit_orderInfo[i].currentIndex = 0;
- etUnit_orderInfo[i].size = size;
- etUnit_orderInfo[i].list = list;
- break;
- }
-}
-
-void expectOrder(etInt16 id, const char* message, etInt16 identifier, const char* file, int line){
- OrderInfo* info = getOrderInfo(id);
- if (info!=NULL) {
- if (info->currentIndex < info->size) {
- if (info->list[info->currentIndex] != identifier){
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- char exp[16], act[16];
- sprintf(testresult, "EXPECT_ORDER %s: index=%d, expected=%d, actual=%d", message, info->currentIndex, identifier, info->list[info->currentIndex]);
- sprintf(exp, "%d", identifier);
- sprintf(act, "%d", info->list[info->currentIndex]);
- etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
- }
- else {
- etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
- info->currentIndex++;
- }
- }
- else {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "EXPECT_ORDER: index(%d) is too big in %s", info->currentIndex, message);
- etUnit_handleExpect(id, FALSE, testresult, NULL, NULL, file, line);
- etLogger_logInfoF("EXPECT_ORDER: index too big in %s", message);
- }
- }
-}
-
-void expectOrderEnd(etInt16 id, const char* message, etInt16 identifier, const char* file, int line) {
- OrderInfo* info = getOrderInfo(id);
- expectOrder(id, message, identifier, file, line);
- if (info->currentIndex != info->size){
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "EXPECT_ORDER_END %s: wrong index at the end: expected=%d, actual=%d", message, info->size, info->currentIndex);
- etUnit_handleExpect(id, FALSE, testresult, NULL, NULL, file, line);
- }
-}
-
-etBool etUnit_isSuccess(etInt16 id) {
- return etUnit_testcaseSuccess[id];
-}
-
-/* private functions */
-
-static void expect_equal_int(etInt16 id, const char* message, etInt32 expected, etInt32 actual, const char* file, int line) {
- if (expected != actual) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- char exp[16], act[16];
- sprintf(testresult, "%s: expected=%ld, actual=%ld", message, expected, actual);
- sprintf(exp, "%ld", expected);
- sprintf(act, "%ld", actual);
- etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
- } else {
- etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
- }
-}
-
-static void expect_equal_uint(etInt16 id, const char* message, etUInt32 expected, etUInt32 actual, const char* file, int line) {
- if (expected != actual) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- char exp[16], act[16];
- sprintf(testresult, "%s: expected=%lu, actual=%lu", message, expected, actual);
- sprintf(exp, "%lu", expected);
- sprintf(act, "%lu", actual);
- etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
- } else {
- etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
- }
-}
-
-
-static void expect_equal_float(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line) {
- if (expected - actual < -precision || expected - actual > precision) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- char exp[16], act[16];
- sprintf(testresult, "%s: expected=%f, actual=%f", message, expected, actual);
- sprintf(exp, "%f", expected);
- sprintf(act, "%f", actual);
- etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
- } else {
- etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
- }
-}
-
-static void etUnit_handleExpect(etInt16 id, etBool result, const char *resulttext, const char* exp, const char* act, const char* file, int line) {
- if (result == TRUE) {
- /* nothing to do because no failure */
- }
- else {
- etUnit_errorCounter++;
- if (etUnit_testcaseSuccess[id] == TRUE){
- /* first failure will be remembered */
- etUnit_testcaseSuccess[id] = FALSE;
-
- if (act!=NULL && exp!=NULL)
- etLogger_fprintf(etUnit_reportfile, "tc fail %d: #%s#%s#%s:%d#%s\n", id, exp, act, file, line, resulttext);
- else
- etLogger_fprintf(etUnit_reportfile, "tc fail %d: ###%s:%d#%s\n", id, file, line, resulttext);
- }
- else{
- /* more than one error will be ignored */
- }
- }
-}
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "etUnit/etUnit.h"
+#include <string.h>
+#include <time.h>
+#include <stdlib.h>
+#include "debugging/etLogger.h"
+#include "osal/etSema.h"
+#include "runtime/etRuntime.h"
+
+
+/*** member variables */
+
+/* file handling */
+static FILE* etUnit_reportfile = NULL;
+
+/* counters */
+static etInt16 etUnit_nextCaseId = 1;
+static etInt32 etUnit_errorCounter = 0;
+
+#define ETUNIT_MAX_TEST_CASES 256
+static etBool etUnit_testcaseSuccess[ETUNIT_MAX_TEST_CASES];
+
+#define ETUNIT_FAILURE_TEXT_LEN 256
+
+/* time measuring */
+static clock_t etUnit_startTime = 0;
+static clock_t etUnit_currentTime = 0;
+
+/* order */
+#define ETUNIT_ORDER_MAX 16
+typedef struct OrderInfo {
+ etInt16 id;
+ etInt16 currentIndex;
+ etInt16 size;
+ etInt16* list;
+}
+OrderInfo;
+static OrderInfo etUnit_orderInfo[ETUNIT_ORDER_MAX];
+
+/* forward declarations of private functions */
+static void expect_equal_int(etInt16 id, const char* message, etInt32 expected, etInt32 actual, const char* file, int line);
+static void expect_equal_uint(etInt16 id, const char* message, etUInt32 expected, etUInt32 actual, const char* file, int line);
+static void expect_equal_float(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line);
+static void etUnit_handleExpect(etInt16 id, etBool result, const char *trace, const char* expected, const char* actual, const char* file, int line);
+
+/* public functions */
+
+void etUnit_open(const char* testResultPath, const char* testFileName) {
+ etLogger_logInfoF("************* TEST START (%s) **************", testFileName);
+
+ {
+ char filename[ETUNIT_FAILURE_TEXT_LEN];
+ int i;
+
+ if (testResultPath!=NULL)
+ sprintf(filename, "%s/%s.etu", testResultPath, testFileName);
+ else
+ sprintf(filename, "%s.etu", testFileName);
+
+ /* init global data */
+ for (i=0; i<ETUNIT_ORDER_MAX; ++i)
+ etUnit_orderInfo[i].id = 0;
+ for (i=0; i<ETUNIT_MAX_TEST_CASES; ++i)
+ etUnit_testcaseSuccess[i] = TRUE;
+
+ if (etUnit_reportfile == NULL) {
+ etUnit_reportfile = etLogger_fopen(filename, "w+");
+ if (etUnit_reportfile != NULL) {
+ etLogger_fprintf(etUnit_reportfile, "etUnit report\n");
+ } else {
+ etLogger_logErrorF("Unable to open file %s", filename);
+ }
+ }
+ }
+
+ /* prepare time measurement */
+ etUnit_startTime = clock();
+ etUnit_currentTime = clock();
+ etLogger_logInfoF("Start Time: %ld", etUnit_startTime);
+
+}
+
+void etUnit_close(void) {
+ if (etUnit_reportfile != NULL) {
+ etLogger_fclose(etUnit_reportfile);
+ etUnit_reportfile = NULL;
+ }
+ etLogger_logInfoF("End Time: %ld", clock());
+ if (etUnit_errorCounter==0)
+ etLogger_logInfoF("Error Counter: %ld", etUnit_errorCounter);
+ else
+ etLogger_logErrorF("Error Counter: %ld", etUnit_errorCounter);
+ etLogger_logInfoF("************* TEST END **************");
+}
+
+void etUnit_openTestSuite(const char* testSuiteName) {
+ if (etUnit_reportfile != NULL) {
+ etLogger_fprintf(etUnit_reportfile, "ts start: %s\n", testSuiteName);
+ }
+}
+
+void etUnit_closeTestSuite(void) {
+}
+
+etInt16 etUnit_openTestCase(const char* testCaseName) {
+ etInt16 caseId = etUnit_nextCaseId++;
+
+ if (caseId >= ETUNIT_MAX_TEST_CASES) {
+ etLogger_logErrorF("Too many test cases. Maximum number of test cases is %d\n", ETUNIT_MAX_TEST_CASES);
+ etLogger_logErrorF("ETUNIT_MAX_TEST_CASES (etUnit_openTestCase, %s: %d)", __FILE__, __LINE__);
+ exit(-1);
+ }
+ if (etUnit_reportfile != NULL) {
+ etLogger_fprintf(etUnit_reportfile, "tc start %d: %s\n", caseId, testCaseName);
+ }
+
+ return caseId;
+}
+
+void etUnit_closeTestCase(etInt16 id) {
+ clock_t time = clock() - etUnit_currentTime;
+ etUnit_currentTime = clock();
+
+ if (etUnit_reportfile != NULL) {
+ etLogger_fprintf(etUnit_reportfile, "tc end %d: %d\n", id, time);
+ }
+}
+
+etInt16 etUnit_openAll(const char* testResultPath, const char* testFileName, const char* testSuiteName, const char* testCaseName){
+ etUnit_open(testResultPath, testFileName);
+ etUnit_openTestSuite(testSuiteName);
+ return etUnit_openTestCase(testCaseName);
+}
+
+void etUnit_closeAll(etInt16 id){
+ etUnit_closeTestCase(id);
+ etUnit_closeTestSuite();
+ etUnit_close();
+}
+
+void etUnit_testFinished(etInt16 id) {
+ etSema_wakeup(etRuntime_getTerminateSemaphore());
+}
+
+void expectTrue(etInt16 id, const char* message, etBool condition, const char* file, int line) {
+ if (condition == FALSE) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message);
+ etUnit_handleExpect(id, FALSE, testresult, "TRUE", "FALSE", file, line);
+ } else {
+ etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
+ }
+}
+
+void expectFalse(etInt16 id, const char* message, etBool condition, const char* file, int line) {
+ if (condition == TRUE) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: EXPECT_FALSE == TRUE", message);
+ etUnit_handleExpect(id, FALSE, testresult, "FALSE", "TRUE", file, line);
+ } else {
+ etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
+ }
+}
+
+void expectEqualInt8(etInt16 id, const char* message, etInt8 expected, etInt8 actual, const char* file, int line) {
+ expect_equal_int(id, message, (etInt32) expected, (etInt32) actual, file, line);
+}
+
+void expectEqualInt16(etInt16 id, const char* message, etInt16 expected, etInt16 actual, const char* file, int line) {
+ expect_equal_int(id, message, (etInt32) expected, (etInt32) actual, file, line);
+}
+
+void expectEqualInt32(etInt16 id, const char* message, etInt32 expected, etInt32 actual, const char* file, int line) {
+ expect_equal_int(id, message, (etInt32) expected, (etInt32) actual, file, line);
+}
+
+void expectEqualUInt8(etInt16 id, const char* message, etUInt8 expected, etUInt8 actual, const char* file, int line) {
+ expect_equal_uint(id, message, (etUInt32) expected, (etUInt32) actual, file, line);
+}
+
+void expectEqualUInt16(etInt16 id, const char* message, etUInt16 expected, etUInt16 actual, const char* file, int line) {
+ expect_equal_uint(id, message, (etUInt32) expected, (etUInt32) actual, file, line);
+}
+
+void expectEqualUInt32(etInt16 id, const char* message, etUInt32 expected, etUInt32 actual, const char* file, int line) {
+ expect_equal_uint(id, message, (etUInt32) expected, (etUInt32) actual, file, line);
+}
+
+void expect_equal_void_ptr(etInt16 id, const char* message, const void* expected, const void* actual, const char* file, int line) {
+ if (expected != actual) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ char exp[16], act[16];
+ sprintf(testresult, "%s: expected=%ld, actual=%ld", message, (etUInt32) expected, (etUInt32) actual);
+ sprintf(exp, "%ld", (etUInt32) expected);
+ sprintf(act, "%ld", (etUInt32) actual);
+ etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
+ } else {
+ etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
+ }
+}
+
+void expectEqualFloat32(etInt16 id, const char* message, etFloat32 expected, etFloat32 actual, etFloat32 precision, const char* file, int line) {
+ expect_equal_float(id, message, expected, actual, precision, file, line);
+}
+
+void expectEqualFloat64(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line) {
+ expect_equal_float(id, message, expected, actual, precision, file, line);
+}
+
+static OrderInfo* getOrderInfo(etInt16 id) {
+ int i;
+ for (i=0; i<ETUNIT_ORDER_MAX; ++i)
+ if (etUnit_orderInfo[i].id==id)
+ return etUnit_orderInfo+i;
+
+ return NULL;
+}
+
+void expectOrderStart(etInt16 id, etInt16* list, etInt16 size, const char* file, int line) {
+ int i;
+ for (i=0; i<ETUNIT_ORDER_MAX; ++i)
+ if (etUnit_orderInfo[i].id==0) {
+ etUnit_orderInfo[i].id = id;
+ etUnit_orderInfo[i].currentIndex = 0;
+ etUnit_orderInfo[i].size = size;
+ etUnit_orderInfo[i].list = list;
+ break;
+ }
+}
+
+void expectOrder(etInt16 id, const char* message, etInt16 identifier, const char* file, int line){
+ OrderInfo* info = getOrderInfo(id);
+ if (info!=NULL) {
+ if (info->currentIndex < info->size) {
+ if (info->list[info->currentIndex] != identifier){
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ char exp[16], act[16];
+ sprintf(testresult, "EXPECT_ORDER %s: index=%d, expected=%d, actual=%d", message, info->currentIndex, identifier, info->list[info->currentIndex]);
+ sprintf(exp, "%d", identifier);
+ sprintf(act, "%d", info->list[info->currentIndex]);
+ etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
+ }
+ else {
+ etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
+ info->currentIndex++;
+ }
+ }
+ else {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "EXPECT_ORDER: index(%d) is too big in %s", info->currentIndex, message);
+ etUnit_handleExpect(id, FALSE, testresult, NULL, NULL, file, line);
+ etLogger_logInfoF("EXPECT_ORDER: index too big in %s", message);
+ }
+ }
+}
+
+void expectOrderEnd(etInt16 id, const char* message, etInt16 identifier, const char* file, int line) {
+ OrderInfo* info = getOrderInfo(id);
+ expectOrder(id, message, identifier, file, line);
+ if (info->currentIndex != info->size){
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "EXPECT_ORDER_END %s: wrong index at the end: expected=%d, actual=%d", message, info->size, info->currentIndex);
+ etUnit_handleExpect(id, FALSE, testresult, NULL, NULL, file, line);
+ }
+}
+
+etBool etUnit_isSuccess(etInt16 id) {
+ return etUnit_testcaseSuccess[id];
+}
+
+/* private functions */
+
+static void expect_equal_int(etInt16 id, const char* message, etInt32 expected, etInt32 actual, const char* file, int line) {
+ if (expected != actual) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ char exp[16], act[16];
+ sprintf(testresult, "%s: expected=%ld, actual=%ld", message, expected, actual);
+ sprintf(exp, "%ld", expected);
+ sprintf(act, "%ld", actual);
+ etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
+ } else {
+ etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
+ }
+}
+
+static void expect_equal_uint(etInt16 id, const char* message, etUInt32 expected, etUInt32 actual, const char* file, int line) {
+ if (expected != actual) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ char exp[16], act[16];
+ sprintf(testresult, "%s: expected=%lu, actual=%lu", message, expected, actual);
+ sprintf(exp, "%lu", expected);
+ sprintf(act, "%lu", actual);
+ etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
+ } else {
+ etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
+ }
+}
+
+
+static void expect_equal_float(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line) {
+ if (expected - actual < -precision || expected - actual > precision) {
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ char exp[16], act[16];
+ sprintf(testresult, "%s: expected=%f, actual=%f", message, expected, actual);
+ sprintf(exp, "%f", expected);
+ sprintf(act, "%f", actual);
+ etUnit_handleExpect(id, FALSE, testresult, exp, act, file, line);
+ } else {
+ etUnit_handleExpect(id, TRUE, "", NULL, NULL, file, line);
+ }
+}
+
+static void etUnit_handleExpect(etInt16 id, etBool result, const char *resulttext, const char* exp, const char* act, const char* file, int line) {
+ if (result == TRUE) {
+ /* nothing to do because no failure */
+ }
+ else {
+ etUnit_errorCounter++;
+ if (etUnit_testcaseSuccess[id] == TRUE){
+ /* first failure will be remembered */
+ etUnit_testcaseSuccess[id] = FALSE;
+
+ if (act!=NULL && exp!=NULL)
+ etLogger_fprintf(etUnit_reportfile, "tc fail %d: #%s#%s#%s:%d#%s\n", id, exp, act, file, line, resulttext);
+ else
+ etLogger_fprintf(etUnit_reportfile, "tc fail %d: ###%s:%d#%s\n", id, file, line, resulttext);
+ }
+ else{
+ /* more than one error will be ignored */
+ }
+ }
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
index 8e896441f..5bfb41b84 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETUNIT_H_
-#define _ETUNIT_H_
-
-#include "etDatatypes.h"
-
-
-/* open / close */
-void etUnit_open(const char* testResultPath, const char* testFileName);
-void etUnit_close(void);
-void etUnit_openTestSuite(const char* testSuiteName);
-void etUnit_closeTestSuite(void);
-etInt16 etUnit_openTestCase(const char* testCaseName);
-void etUnit_closeTestCase(etInt16 id);
-etBool etUnit_isSuccess(etInt16 id);
-void etUnit_testFinished(etInt16 id);
-
-/* functions for more convenience for model and generator tests */
-
-etInt16 etUnit_openAll(const char* testResultPath, const char* testFileName, const char* testSuiteName, const char* testCaseName);
-void etUnit_closeAll(etInt16 id);
-
-/* boolean values */
-#define EXPECT_TRUE(id, msg, condition) expectTrue(id, msg, condition, __FILE__, __LINE__)
-#define EXPECT_FALSE(id, msg, condition) expectFalse(id, msg, condition, __FILE__, __LINE__)
-
-/* signed integer values */
-#define EXPECT_EQUAL_INT8(id, msg, expected, actual) expectEqualInt8(id, msg, expected, actual, __FILE__, __LINE__)
-#define EXPECT_EQUAL_INT16(id, msg, expected, actual) expectEqualInt16(id, msg, expected, actual, __FILE__, __LINE__)
-#define EXPECT_EQUAL_INT32(id, msg, expected, actual) expectEqualInt32(id, msg, expected, actual, __FILE__, __LINE__)
-
-/* unsigned integer values */
-#define EXPECT_EQUAL_UINT8(id, msg, expected, actual) expectEqualUInt8(id, msg, expected, actual, __FILE__, __LINE__)
-#define EXPECT_EQUAL_UINT16(id, msg, expected, actual) expectEqualUInt16(id, msg, expected, actual, __FILE__, __LINE__)
-#define EXPECT_EQUAL_UINT32(id, msg, expected, actual) expectEqualUInt32(id, msg, expected, actual, __FILE__, __LINE__)
-
-/* float values */
-#define EXPECT_EQUAL_FLOAT32(id, msg, expected, actual, precision) expectEqualFloat32(id, msg, expected, actual, precision, __FILE__, __LINE__)
-#define EXPECT_EQUAL_FLOAT64(id, msg, expected, actual, precision) expectEqualFloat64(id, msg, expected, actual, precision, __FILE__, __LINE__)
-
-/* Pointers */
-#define EXPECT_EQUAL_PTR(id, msg, expected, actual) \
- expect_equal_void_ptr(id, msg, (const void*) expected, (const void*) actual, __FILE__, __LINE__)
-
-
-/* more specialized functions */
-#define EXPECT_ORDER_START(id, list, size) expectOrderStart(id, list, size, __FILE__, __LINE__)
-#define EXPECT_ORDER(id, msg, val) expectOrder(id, msg, val, __FILE__, __LINE__)
-#define EXPECT_ORDER_END(id, msg, val) expectOrderEnd(id, msg, val, __FILE__, __LINE__)
-
-
-/* Helpers for adding testcases */
-
-#define ADD_TESTCASE(testcase) \
- { etInt16 id = etUnit_openTestCase(#testcase); \
- testcase(id); \
- etUnit_closeTestCase(id);}
-
-/* function prototypes, use above macros to call them */
-void expectTrue(etInt16 id, const char* msg, etBool condition, const char* file, int line);
-void expectFalse(etInt16 id, const char* msg, etBool condition, const char* file, int line);
-void expectEqualInt8(etInt16 id, const char* msg, etInt8 expected, etInt8 actual, const char* file, int line);
-void expectEqualInt16(etInt16 id, const char* msg, etInt16 expected, etInt16 actual, const char* file, int line);
-void expectEqualInt32(etInt16 id, const char* msg, etInt32 expected, etInt32 actual, const char* file, int line);
-void expectEqualUInt8(etInt16 id, const char* msg, etUInt8 expected, etUInt8 actual, const char* file, int line);
-void expectEqualUInt16(etInt16 id, const char* msg, etUInt16 expected, etUInt16 actual, const char* file, int line);
-void expectEqualUInt32(etInt16 id, const char* msg, etUInt32 expected, etUInt32 actual, const char* file, int line);
-void expectEqualFloat32(etInt16 id, const char* msg, etFloat32 expected, etFloat32 actual, etFloat32 precision, const char* file, int line);
-void expectEqualFloat64(etInt16 id, const char* msg, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line);
-void expect_equal_void_ptr(etInt16 id, const char* msg, const void* expected, const void* actual, const char* file, int line);
-void expectOrderStart(etInt16 id, etInt16* list, etInt16 size, const char* file, int line);
-void expectOrder(etInt16 id, const char* msg, etInt16 identifier, const char* file, int line);
-void expectOrderEnd(etInt16 id, const char* msg, etInt16 identifier, const char* file, int line);
-
-#endif /* _ETUNIT_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETUNIT_H_
+#define _ETUNIT_H_
+
+#include "etDatatypes.h"
+
+
+/* open / close */
+void etUnit_open(const char* testResultPath, const char* testFileName);
+void etUnit_close(void);
+void etUnit_openTestSuite(const char* testSuiteName);
+void etUnit_closeTestSuite(void);
+etInt16 etUnit_openTestCase(const char* testCaseName);
+void etUnit_closeTestCase(etInt16 id);
+etBool etUnit_isSuccess(etInt16 id);
+void etUnit_testFinished(etInt16 id);
+
+/* functions for more convenience for model and generator tests */
+
+etInt16 etUnit_openAll(const char* testResultPath, const char* testFileName, const char* testSuiteName, const char* testCaseName);
+void etUnit_closeAll(etInt16 id);
+
+/* boolean values */
+#define EXPECT_TRUE(id, msg, condition) expectTrue(id, msg, condition, __FILE__, __LINE__)
+#define EXPECT_FALSE(id, msg, condition) expectFalse(id, msg, condition, __FILE__, __LINE__)
+
+/* signed integer values */
+#define EXPECT_EQUAL_INT8(id, msg, expected, actual) expectEqualInt8(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_INT16(id, msg, expected, actual) expectEqualInt16(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_INT32(id, msg, expected, actual) expectEqualInt32(id, msg, expected, actual, __FILE__, __LINE__)
+
+/* unsigned integer values */
+#define EXPECT_EQUAL_UINT8(id, msg, expected, actual) expectEqualUInt8(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_UINT16(id, msg, expected, actual) expectEqualUInt16(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_UINT32(id, msg, expected, actual) expectEqualUInt32(id, msg, expected, actual, __FILE__, __LINE__)
+
+/* float values */
+#define EXPECT_EQUAL_FLOAT32(id, msg, expected, actual, precision) expectEqualFloat32(id, msg, expected, actual, precision, __FILE__, __LINE__)
+#define EXPECT_EQUAL_FLOAT64(id, msg, expected, actual, precision) expectEqualFloat64(id, msg, expected, actual, precision, __FILE__, __LINE__)
+
+/* Pointers */
+#define EXPECT_EQUAL_PTR(id, msg, expected, actual) \
+ expect_equal_void_ptr(id, msg, (const void*) expected, (const void*) actual, __FILE__, __LINE__)
+
+
+/* more specialized functions */
+#define EXPECT_ORDER_START(id, list, size) expectOrderStart(id, list, size, __FILE__, __LINE__)
+#define EXPECT_ORDER(id, msg, val) expectOrder(id, msg, val, __FILE__, __LINE__)
+#define EXPECT_ORDER_END(id, msg, val) expectOrderEnd(id, msg, val, __FILE__, __LINE__)
+
+
+/* Helpers for adding testcases */
+
+#define ADD_TESTCASE(testcase) \
+ { etInt16 id = etUnit_openTestCase(#testcase); \
+ testcase(id); \
+ etUnit_closeTestCase(id);}
+
+/* function prototypes, use above macros to call them */
+void expectTrue(etInt16 id, const char* msg, etBool condition, const char* file, int line);
+void expectFalse(etInt16 id, const char* msg, etBool condition, const char* file, int line);
+void expectEqualInt8(etInt16 id, const char* msg, etInt8 expected, etInt8 actual, const char* file, int line);
+void expectEqualInt16(etInt16 id, const char* msg, etInt16 expected, etInt16 actual, const char* file, int line);
+void expectEqualInt32(etInt16 id, const char* msg, etInt32 expected, etInt32 actual, const char* file, int line);
+void expectEqualUInt8(etInt16 id, const char* msg, etUInt8 expected, etUInt8 actual, const char* file, int line);
+void expectEqualUInt16(etInt16 id, const char* msg, etUInt16 expected, etUInt16 actual, const char* file, int line);
+void expectEqualUInt32(etInt16 id, const char* msg, etUInt32 expected, etUInt32 actual, const char* file, int line);
+void expectEqualFloat32(etInt16 id, const char* msg, etFloat32 expected, etFloat32 actual, etFloat32 precision, const char* file, int line);
+void expectEqualFloat64(etInt16 id, const char* msg, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line);
+void expect_equal_void_ptr(etInt16 id, const char* msg, const void* expected, const void* actual, const char* file, int line);
+void expectOrderStart(etInt16 id, etInt16* list, etInt16 size, const char* file, int line);
+void expectOrder(etInt16 id, const char* msg, etInt16 identifier, const char* file, int line);
+void expectOrderEnd(etInt16 id, const char* msg, etInt16 identifier, const char* file, int line);
+
+#endif /* _ETUNIT_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
index 6de407a30..439d7a68e 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2013 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "helpers/etTimeHelpers.h"
-
-void etTimeHelpers_subtract(etTime *first, etTime* second){
- /* TODO: implement */
-}
-
-void etTimeHelpers_add(etTime *first, etTime* second){
- /* TODO: implement */
-}
-
-etInt32 etTimeHelpers_convertToMSec(etTime *time){
- return time->sec * 1000 + time->nSec / 1000000;
-}
-
-void etTimeHelpers_convertToEtTime(etTime *result, etInt32 milliSeconds){
- result->sec = milliSeconds/1000;
- result->nSec = milliSeconds%1000 * 1000000;
-}
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "helpers/etTimeHelpers.h"
+
+void etTimeHelpers_subtract(etTime *first, etTime* second){
+ /* TODO: implement */
+}
+
+void etTimeHelpers_add(etTime *first, etTime* second){
+ /* TODO: implement */
+}
+
+etInt32 etTimeHelpers_convertToMSec(etTime *time){
+ return time->sec * 1000 + time->nSec / 1000000;
+}
+
+void etTimeHelpers_convertToEtTime(etTime *result, etInt32 milliSeconds){
+ result->sec = milliSeconds/1000;
+ result->nSec = milliSeconds%1000 * 1000000;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
index e04a5a755..6e4098c6d 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2013 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETTIMEHELPERS_H_
-#define _ETTIMEHELPERS_H_
-
-#include "osal/etTime.h"
-
-void etTime_subtract(etTime *self, etTime* subtractValue);
-void etTime_add(etTime *self, etTime* addValue);
-etInt32 etTimeHelpers_convertToMSec(etTime *time);
-void etTimeHelpers_convertToEtTime(etTime *result, etInt32 milliSeconds);
-
-
-#endif /* _ETTIMEHELPERS_H_ */
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETTIMEHELPERS_H_
+#define _ETTIMEHELPERS_H_
+
+#include "osal/etTime.h"
+
+void etTime_subtract(etTime *self, etTime* subtractValue);
+void etTime_add(etTime *self, etTime* addValue);
+etInt32 etTimeHelpers_convertToMSec(etTime *time);
+void etTimeHelpers_convertToEtTime(etTime *result, etInt32 milliSeconds);
+
+
+#endif /* _ETTIMEHELPERS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c
index 49772f7b6..224461432 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.c
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "messaging/etMessage.h"
-
-#include "debugging/etMSCLogger.h"
-
-#include <stddef.h>
-
-void etMessage_init(etMessage* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessage", "init")
- self->next = NULL;
- self->address = 0;
- self->evtID = 0;
- ET_MSC_LOGGER_SYNC_EXIT
-}
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "messaging/etMessage.h"
+
+#include "debugging/etMSCLogger.h"
+
+#include <stddef.h>
+
+void etMessage_init(etMessage* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessage", "init")
+ self->next = NULL;
+ self->address = 0;
+ self->evtID = 0;
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h
index 698a89c09..7bba6a1f3 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETMESSAGE_H_
-#define _ETMESSAGE_H_
-
-#include "etDatatypes.h"
-
-typedef struct etMessage{
- struct etMessage* next;
- etInt16 address;
- etInt16 evtID;
-} etMessage;
-
-void etMessage_init(etMessage* self);
-
-#endif /* _ETMESSAGE_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETMESSAGE_H_
+#define _ETMESSAGE_H_
+
+#include "etDatatypes.h"
+
+typedef struct etMessage{
+ struct etMessage* next;
+ etInt16 address;
+ etInt16 evtID;
+} etMessage;
+
+void etMessage_init(etMessage* self);
+
+#endif /* _ETMESSAGE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
index 145432dd1..96a86b046 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
@@ -1,115 +1,115 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "messaging/etMessageQueue.h"
-
-#include "debugging/etMSCLogger.h"
-
-void etMessageQueue_init(etMessageQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "init")
- self->first = NULL;
- self->last = NULL;
- self->highWaterMark = 0;
- self->lowWaterMark = 0;
- self->size = 0;
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-void etMessageQueue_push(etMessageQueue* self, etMessage* msg){
- /* TODO: optimize queue for concurrent push / pop */
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "push")
- if (self->first == NULL) {
- /*no message in queue*/
- self->first = self->last = msg;
- }
- else {
- /*at least one message in queue*/
- self->last->next = msg;
- self->last = msg;
- }
- msg->next = NULL; /*TODO: optimization: this line could be removed if we assume that all messages are initialized*/
-
- if (++self->size > self->highWaterMark)
- self->highWaterMark++;
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-etMessage* etMessageQueue_pop(etMessageQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "pop")
- etMessage* pop_msg = self->first;
- if(self->first == NULL){
- /*no message in queue*/
- ET_MSC_LOGGER_SYNC_EXIT
- return NULL;
- }
- if (self->first->next==NULL){
- /*only one message in queue*/
- self->first = self->last = NULL;
- }
- else {
- /*more than one message in queue -> set first to nex message*/
- self->first = self->first->next;
- }
-
- pop_msg->next=NULL;
- self->size--;
-
- if (self->size < self->lowWaterMark)
- self->lowWaterMark--;
-
- ET_MSC_LOGGER_SYNC_EXIT
- return pop_msg;
-}
-
-etInt16 etMessageQueue_getSize(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getSize")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->size;
-}
-
-etMessage* etMessageQueue_getFirst(etMessageQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getFirst")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->first;
-}
-
-etMessage* etMessageQueue_getLast(etMessageQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getLast")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->last;
-}
-
-etBool etMessageQueue_isNotEmpty(etMessageQueue* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "isNotEmpty")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->last != NULL;
-}
-
-etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getHighWaterMark")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->highWaterMark;
-}
-
-etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getLowWaterMark")
- ET_MSC_LOGGER_SYNC_EXIT
- return self->lowWaterMark;
-}
-
-void etMessageQueue_resetLowWaterMark(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "resetLowWaterMark")
- self->lowWaterMark = self->size;
- ET_MSC_LOGGER_SYNC_EXIT
-}
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "messaging/etMessageQueue.h"
+
+#include "debugging/etMSCLogger.h"
+
+void etMessageQueue_init(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "init")
+ self->first = NULL;
+ self->last = NULL;
+ self->highWaterMark = 0;
+ self->lowWaterMark = 0;
+ self->size = 0;
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+
+void etMessageQueue_push(etMessageQueue* self, etMessage* msg){
+ /* TODO: optimize queue for concurrent push / pop */
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "push")
+ if (self->first == NULL) {
+ /*no message in queue*/
+ self->first = self->last = msg;
+ }
+ else {
+ /*at least one message in queue*/
+ self->last->next = msg;
+ self->last = msg;
+ }
+ msg->next = NULL; /*TODO: optimization: this line could be removed if we assume that all messages are initialized*/
+
+ if (++self->size > self->highWaterMark)
+ self->highWaterMark++;
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etMessage* etMessageQueue_pop(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "pop")
+ etMessage* pop_msg = self->first;
+ if(self->first == NULL){
+ /*no message in queue*/
+ ET_MSC_LOGGER_SYNC_EXIT
+ return NULL;
+ }
+ if (self->first->next==NULL){
+ /*only one message in queue*/
+ self->first = self->last = NULL;
+ }
+ else {
+ /*more than one message in queue -> set first to nex message*/
+ self->first = self->first->next;
+ }
+
+ pop_msg->next=NULL;
+ self->size--;
+
+ if (self->size < self->lowWaterMark)
+ self->lowWaterMark--;
+
+ ET_MSC_LOGGER_SYNC_EXIT
+ return pop_msg;
+}
+
+etInt16 etMessageQueue_getSize(etMessageQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getSize")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->size;
+}
+
+etMessage* etMessageQueue_getFirst(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getFirst")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->first;
+}
+
+etMessage* etMessageQueue_getLast(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getLast")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->last;
+}
+
+etBool etMessageQueue_isNotEmpty(etMessageQueue* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "isNotEmpty")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->last != NULL;
+}
+
+etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getHighWaterMark")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->highWaterMark;
+}
+
+etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getLowWaterMark")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->lowWaterMark;
+}
+
+void etMessageQueue_resetLowWaterMark(etMessageQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "resetLowWaterMark")
+ self->lowWaterMark = self->size;
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
index a9a6cb13e..e79b57347 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETMESSAGEQUEUE_H_
-#define _ETMESSAGEQUEUE_H_
-
-#include "messaging/etMessage.h"
-#include <stddef.h>
-
-typedef struct etMessageQueue {
- etMessage* first;
- etMessage* last;
- etInt16 highWaterMark;
- etInt16 lowWaterMark;
- etInt16 size;
-
-} etMessageQueue;
-
-void etMessageQueue_init(etMessageQueue* self);
-
-void etMessageQueue_push(etMessageQueue* self, etMessage* msg);
-etMessage* etMessageQueue_pop(etMessageQueue* self);
-
-etMessage* etMessageQueue_getFirst(etMessageQueue* self);
-etMessage* etMessageQueue_getLast(etMessageQueue* self);
-
-etBool etMessageQueue_isNotEmpty(etMessageQueue* self);
-
-etInt16 etMessageQueue_getSize(etMessageQueue* self);
-etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self);
-etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self);
-void etMessageQueue_resetLowWaterMark(etMessageQueue* self);
-
-
-#endif /* _RMESSAGEQUEUE_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETMESSAGEQUEUE_H_
+#define _ETMESSAGEQUEUE_H_
+
+#include "messaging/etMessage.h"
+#include <stddef.h>
+
+typedef struct etMessageQueue {
+ etMessage* first;
+ etMessage* last;
+ etInt16 highWaterMark;
+ etInt16 lowWaterMark;
+ etInt16 size;
+
+} etMessageQueue;
+
+void etMessageQueue_init(etMessageQueue* self);
+
+void etMessageQueue_push(etMessageQueue* self, etMessage* msg);
+etMessage* etMessageQueue_pop(etMessageQueue* self);
+
+etMessage* etMessageQueue_getFirst(etMessageQueue* self);
+etMessage* etMessageQueue_getLast(etMessageQueue* self);
+
+etBool etMessageQueue_isNotEmpty(etMessageQueue* self);
+
+etInt16 etMessageQueue_getSize(etMessageQueue* self);
+etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self);
+etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self);
+void etMessageQueue_resetLowWaterMark(etMessageQueue* self);
+
+
+#endif /* _RMESSAGEQUEUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h
index 2eca06ebe..06cd7df78 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-
-
-#ifndef _ETMESSAGERECEIVER_H_
-#define _ETMESSAGERECEIVER_H_
-
-#include "messaging/etMessage.h"
-
-typedef void (*etActorReceiveMessage)(void* self, const void* ifitem, const etMessage* msg);
-typedef etBool (*etDispatcherReceiveMessage)(const etMessage* msg);
-typedef void (*etDispatcherExecute)(void);
-
-#endif /* _ETMESSAGERECEIVER_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
+
+#ifndef _ETMESSAGERECEIVER_H_
+#define _ETMESSAGERECEIVER_H_
+
+#include "messaging/etMessage.h"
+
+typedef void (*etActorReceiveMessage)(void* self, const void* ifitem, const etMessage* msg);
+typedef etBool (*etDispatcherReceiveMessage)(const etMessage* msg);
+typedef void (*etDispatcherExecute)(void);
+
+#endif /* _ETMESSAGERECEIVER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
index b2140166a..7b6d4c344 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
@@ -1,206 +1,206 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-
-#include "etMessageService.h"
-
-
-#include "etSystemProtocol.h"
-#include "debugging/etLogger.h"
-#include "debugging/etMSCLogger.h"
-
-static void etMessageService_timerCallback(void* data);
-static void etMessageService_deliverAllMessages(etMessageService* self);
-
-/*
- * initialize message service with all needed data and initialize message queue and message pool
- *
- */
-void etMessageService_init(
- etMessageService* self,
- etUInt8* buffer,
- etUInt16 maxBlocks,
- etUInt16 blockSize,
- etStacksize stacksize,
- etPriority priority,
- etTime interval,
- etDispatcherReceiveMessage msgDispatcher,
- etMessageService_execmode execmode){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "init")
-
- /* copy init data to self */
- self->messageBuffer.buffer = buffer;
- self->messageBuffer.maxBlocks = maxBlocks;
- self->messageBuffer.blockSize = blockSize;
- self->msgDispatcher = msgDispatcher;
- self->execmode = execmode;
-
- /* init queue and pool */
- etMessageQueue_init( &(self->messagePool) ); /* the pool is also a queue*/
- etMessageQueue_init( &(self->messageQueue) );
- etMessageService_initMessagePool(self);
-
- /* init mutexes and semaphores */
- etMutex_construct( &(self->poolMutex) );
- etMutex_construct( &(self->queueMutex) );
- etSema_construct( &(self->executionSemaphore) );
-
- /* init thread */
- etThread_construct(&self->thread, stacksize, priority, "MessageService", (etThreadFunction) etMessageService_deliverAllMessages, self);
-
- if (execmode==EXECMODE_POLLED || execmode==EXECMODE_MIXED) {
- /* init timer */
- etTimer_construct(&self->timer, &interval, etMessageService_timerCallback, self);
- }
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etMessageService_start(etMessageService* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "start")
- etThread_start( &(self->thread) );
- if (self->execmode==EXECMODE_POLLED || self->execmode==EXECMODE_MIXED) {
- etTimer_start(&self->timer);
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etMessageService_stop(etMessageService* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "stop")
-
- if (self->execmode==EXECMODE_POLLED || self->execmode==EXECMODE_MIXED) {
- etTimer_stop(&self->timer);
- }
-
- /* create a temporary port struct and send the terminate message */
- etSystemProtocolConjPort port;
- port.localId = 0;
- port.msgService = self;
- port.peerAddress = MESSAGESERVICE_ADDRESS;
- etSystemProtocolConjPort_terminate(&port);
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etMessageService_destroy(etMessageService* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "destroy")
- etMutex_destruct( &(self->poolMutex) );
- etMutex_destruct( &(self->queueMutex) );
- etSema_destruct( &(self->executionSemaphore) );
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-/*
- * initialize message pool with block buffer
- * all blocks are added to pool
- */
-void etMessageService_initMessagePool(etMessageService* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "initMessagePool")
- etInt16 i;
-
- for (i=0; i<self->messageBuffer.maxBlocks; i++){
- etMessage* block = (etMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize];
- etMessageQueue_push(&self->messagePool, block);
- }
- etMessageQueue_resetLowWaterMark(&self->messagePool);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etMessageService_pushMessage(etMessageService* self, etMessage* msg){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "pushMessage")
- etMutex_enter(&self->queueMutex);
- etMessageQueue_push(&self->messageQueue, msg);
- etSema_wakeup(&self->executionSemaphore);
- etMutex_leave(&self->queueMutex);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-etMessage* etMessageService_popMessage(etMessageService* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "popMessage")
- etMutex_enter(&self->queueMutex);
- etMessage* msg = etMessageQueue_pop(&self->messageQueue);
- etMutex_leave(&self->queueMutex);
- ET_MSC_LOGGER_SYNC_EXIT
- return msg;
-}
-
-
-etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "getMessageBuffer")
- etMutex_enter(&self->poolMutex);
- if (size<=self->messageBuffer.blockSize){
- if (self->messagePool.size>0){
- etMessage* msg = etMessageQueue_pop(&self->messagePool);
- etMutex_leave(&self->poolMutex);
- ET_MSC_LOGGER_SYNC_EXIT
- return msg;
- }
- else {
- etLogger_logErrorF("etMessageService_getMessageBuffer: message pool empty: %d", etMessageService_getMessagePoolLowWaterMark(self));
- }
- }
- else {
- etLogger_logErrorF("etMessageService_getMessageBuffer: message too big: %d, blockSize: %d", size, self->messageBuffer.blockSize);
- }
- etMutex_leave(&self->poolMutex);
- ET_MSC_LOGGER_SYNC_EXIT
- return NULL;
-}
-
-void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "returnMessageBuffer")
- etMutex_enter(&self->poolMutex);
- etMessageQueue_push(&self->messagePool, buffer);
- etMutex_leave(&self->poolMutex);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-static void etMessageService_deliverAllMessages(etMessageService* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "deliverAllMessages")
- {
- etBool cont = TRUE;
- while (cont){
- while (etMessageQueue_isNotEmpty(&self->messageQueue) && cont){
- etMessage* msg = etMessageService_popMessage(self);
- if (!self->msgDispatcher(msg))
- cont = FALSE;
- etMessageService_returnMessageBuffer(self, msg);
- }
- if (cont)
- etSema_waitForWakeup(&self->executionSemaphore);
- }
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self){
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "getMessagePoolLowWaterMark")
- etInt16 lowWaterMark = etMessageQueue_getLowWaterMark(&self->messagePool);
- ET_MSC_LOGGER_SYNC_EXIT
- return lowWaterMark;
-}
-
-static void etMessageService_timerCallback(void* data) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "timerCallback")
- {
- etMessageService* self = (etMessageService*) data;
-
- /* create a temporary port struct and send the terminate message */
- etSystemProtocolConjPort port;
- port.localId = 0;
- port.msgService = self;
- port.peerAddress = MESSAGESERVICE_ADDRESS;
- etSystemProtocolConjPort_poll(&port);
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
+#include "etMessageService.h"
+
+
+#include "etSystemProtocol.h"
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+static void etMessageService_timerCallback(void* data);
+static void etMessageService_deliverAllMessages(etMessageService* self);
+
+/*
+ * initialize message service with all needed data and initialize message queue and message pool
+ *
+ */
+void etMessageService_init(
+ etMessageService* self,
+ etUInt8* buffer,
+ etUInt16 maxBlocks,
+ etUInt16 blockSize,
+ etStacksize stacksize,
+ etPriority priority,
+ etTime interval,
+ etDispatcherReceiveMessage msgDispatcher,
+ etMessageService_execmode execmode){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "init")
+
+ /* copy init data to self */
+ self->messageBuffer.buffer = buffer;
+ self->messageBuffer.maxBlocks = maxBlocks;
+ self->messageBuffer.blockSize = blockSize;
+ self->msgDispatcher = msgDispatcher;
+ self->execmode = execmode;
+
+ /* init queue and pool */
+ etMessageQueue_init( &(self->messagePool) ); /* the pool is also a queue*/
+ etMessageQueue_init( &(self->messageQueue) );
+ etMessageService_initMessagePool(self);
+
+ /* init mutexes and semaphores */
+ etMutex_construct( &(self->poolMutex) );
+ etMutex_construct( &(self->queueMutex) );
+ etSema_construct( &(self->executionSemaphore) );
+
+ /* init thread */
+ etThread_construct(&self->thread, stacksize, priority, "MessageService", (etThreadFunction) etMessageService_deliverAllMessages, self);
+
+ if (execmode==EXECMODE_POLLED || execmode==EXECMODE_MIXED) {
+ /* init timer */
+ etTimer_construct(&self->timer, &interval, etMessageService_timerCallback, self);
+ }
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMessageService_start(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "start")
+ etThread_start( &(self->thread) );
+ if (self->execmode==EXECMODE_POLLED || self->execmode==EXECMODE_MIXED) {
+ etTimer_start(&self->timer);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMessageService_stop(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "stop")
+
+ if (self->execmode==EXECMODE_POLLED || self->execmode==EXECMODE_MIXED) {
+ etTimer_stop(&self->timer);
+ }
+
+ /* create a temporary port struct and send the terminate message */
+ etSystemProtocolConjPort port;
+ port.localId = 0;
+ port.msgService = self;
+ port.peerAddress = MESSAGESERVICE_ADDRESS;
+ etSystemProtocolConjPort_terminate(&port);
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMessageService_destroy(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "destroy")
+ etMutex_destruct( &(self->poolMutex) );
+ etMutex_destruct( &(self->queueMutex) );
+ etSema_destruct( &(self->executionSemaphore) );
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+
+/*
+ * initialize message pool with block buffer
+ * all blocks are added to pool
+ */
+void etMessageService_initMessagePool(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "initMessagePool")
+ etInt16 i;
+
+ for (i=0; i<self->messageBuffer.maxBlocks; i++){
+ etMessage* block = (etMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize];
+ etMessageQueue_push(&self->messagePool, block);
+ }
+ etMessageQueue_resetLowWaterMark(&self->messagePool);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMessageService_pushMessage(etMessageService* self, etMessage* msg){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "pushMessage")
+ etMutex_enter(&self->queueMutex);
+ etMessageQueue_push(&self->messageQueue, msg);
+ etSema_wakeup(&self->executionSemaphore);
+ etMutex_leave(&self->queueMutex);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etMessage* etMessageService_popMessage(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "popMessage")
+ etMutex_enter(&self->queueMutex);
+ etMessage* msg = etMessageQueue_pop(&self->messageQueue);
+ etMutex_leave(&self->queueMutex);
+ ET_MSC_LOGGER_SYNC_EXIT
+ return msg;
+}
+
+
+etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "getMessageBuffer")
+ etMutex_enter(&self->poolMutex);
+ if (size<=self->messageBuffer.blockSize){
+ if (self->messagePool.size>0){
+ etMessage* msg = etMessageQueue_pop(&self->messagePool);
+ etMutex_leave(&self->poolMutex);
+ ET_MSC_LOGGER_SYNC_EXIT
+ return msg;
+ }
+ else {
+ etLogger_logErrorF("etMessageService_getMessageBuffer: message pool empty: %d", etMessageService_getMessagePoolLowWaterMark(self));
+ }
+ }
+ else {
+ etLogger_logErrorF("etMessageService_getMessageBuffer: message too big: %d, blockSize: %d", size, self->messageBuffer.blockSize);
+ }
+ etMutex_leave(&self->poolMutex);
+ ET_MSC_LOGGER_SYNC_EXIT
+ return NULL;
+}
+
+void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "returnMessageBuffer")
+ etMutex_enter(&self->poolMutex);
+ etMessageQueue_push(&self->messagePool, buffer);
+ etMutex_leave(&self->poolMutex);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+static void etMessageService_deliverAllMessages(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "deliverAllMessages")
+ {
+ etBool cont = TRUE;
+ while (cont){
+ while (etMessageQueue_isNotEmpty(&self->messageQueue) && cont){
+ etMessage* msg = etMessageService_popMessage(self);
+ if (!self->msgDispatcher(msg))
+ cont = FALSE;
+ etMessageService_returnMessageBuffer(self, msg);
+ }
+ if (cont)
+ etSema_waitForWakeup(&self->executionSemaphore);
+ }
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "getMessagePoolLowWaterMark")
+ etInt16 lowWaterMark = etMessageQueue_getLowWaterMark(&self->messagePool);
+ ET_MSC_LOGGER_SYNC_EXIT
+ return lowWaterMark;
+}
+
+static void etMessageService_timerCallback(void* data) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "timerCallback")
+ {
+ etMessageService* self = (etMessageService*) data;
+
+ /* create a temporary port struct and send the terminate message */
+ etSystemProtocolConjPort port;
+ port.localId = 0;
+ port.msgService = self;
+ port.peerAddress = MESSAGESERVICE_ADDRESS;
+ etSystemProtocolConjPort_poll(&port);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
index c06898f2b..a59ed2178 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETMESSAGESERVICE_H_
-#define _ETMESSAGESERVICE_H_
-
-#include <stddef.h>
-#include "etDatatypes.h"
-#include "messaging/etMessageQueue.h"
-#include "messaging/etMessageReceiver.h"
-
-#include "osal/etMutex.h"
-#include "osal/etThread.h"
-#include "osal/etSema.h"
-#include "osal/etTimer.h"
-
-#define MESSAGESERVICE_ADDRESS 1
-#define BASE_ADDRESS 32
-
-typedef enum etMessageService_execmode {
- EXECMODE_POLLED, EXECMODE_BLOCKED, EXECMODE_MIXED
-} etMessageService_execmode;
-
-typedef struct etBuffer{
- etUInt8 *buffer; /** buffer points to the actual memory position for the message pool */
- etUInt16 maxBlocks; /** number of blocks for the message pool */
- etUInt16 blockSize; /** size of blocks for the message pool */
-} etBuffer;
-
-typedef struct etMessageService {
- etMessageQueue messageQueue; /** message queue that holds all used messages */
- etMessageQueue messagePool; /** message pool that holds all free messages */
- etBuffer messageBuffer; /** information about the message buffer that holds information about the actual memory position and size for the message pool */
- etDispatcherReceiveMessage msgDispatcher; /** function pointer to the generated message dispatcher function */
- etThread thread; /** thread for the execution of the message service */
- etMutex poolMutex; /** mutex for synchronizing the access to the message pool */
- etMutex queueMutex; /** mutex for synchronizing the access to the message queue */
- etSema executionSemaphore; /** semaphore for waiting and waking up the execution */
- etTimer timer; /** timer for cyclic calls */
- etMessageService_execmode execmode; /** execution mode*/
-} etMessageService;
-
-/* lifecycle functions to startup, execute and shutdown the message service */
-void etMessageService_init(
- etMessageService* self,
- etUInt8* buffer,
- etUInt16 maxBlocks,
- etUInt16 blockSize,
- etStacksize stacksize,
- etPriority priority,
- etTime interval,
- etDispatcherReceiveMessage msgDispatcher,
- etMessageService_execmode execmode);
-void etMessageService_start(etMessageService* self);
-void etMessageService_execute(etMessageService* self);
-void etMessageService_stop(etMessageService* self);
-void etMessageService_destroy(etMessageService* self);
-
-/* initialization of message pool */
-void etMessageService_initMessagePool(etMessageService* self);
-
-/* message queue interface for push and pop messages */
-void etMessageService_pushMessage(etMessageService* self, etMessage* msg);
-etMessage* etMessageService_popMessage(etMessageService* self);
-
-/* message pool interface to get and return (push and pop) messages */
-etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size);
-void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer);
-
-/* functions for debug and service information */
-etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self);
-
-
-#endif /* RMESSAGESERVICE_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETMESSAGESERVICE_H_
+#define _ETMESSAGESERVICE_H_
+
+#include <stddef.h>
+#include "etDatatypes.h"
+#include "messaging/etMessageQueue.h"
+#include "messaging/etMessageReceiver.h"
+
+#include "osal/etMutex.h"
+#include "osal/etThread.h"
+#include "osal/etSema.h"
+#include "osal/etTimer.h"
+
+#define MESSAGESERVICE_ADDRESS 1
+#define BASE_ADDRESS 32
+
+typedef enum etMessageService_execmode {
+ EXECMODE_POLLED, EXECMODE_BLOCKED, EXECMODE_MIXED
+} etMessageService_execmode;
+
+typedef struct etBuffer{
+ etUInt8 *buffer; /** buffer points to the actual memory position for the message pool */
+ etUInt16 maxBlocks; /** number of blocks for the message pool */
+ etUInt16 blockSize; /** size of blocks for the message pool */
+} etBuffer;
+
+typedef struct etMessageService {
+ etMessageQueue messageQueue; /** message queue that holds all used messages */
+ etMessageQueue messagePool; /** message pool that holds all free messages */
+ etBuffer messageBuffer; /** information about the message buffer that holds information about the actual memory position and size for the message pool */
+ etDispatcherReceiveMessage msgDispatcher; /** function pointer to the generated message dispatcher function */
+ etThread thread; /** thread for the execution of the message service */
+ etMutex poolMutex; /** mutex for synchronizing the access to the message pool */
+ etMutex queueMutex; /** mutex for synchronizing the access to the message queue */
+ etSema executionSemaphore; /** semaphore for waiting and waking up the execution */
+ etTimer timer; /** timer for cyclic calls */
+ etMessageService_execmode execmode; /** execution mode*/
+} etMessageService;
+
+/* lifecycle functions to startup, execute and shutdown the message service */
+void etMessageService_init(
+ etMessageService* self,
+ etUInt8* buffer,
+ etUInt16 maxBlocks,
+ etUInt16 blockSize,
+ etStacksize stacksize,
+ etPriority priority,
+ etTime interval,
+ etDispatcherReceiveMessage msgDispatcher,
+ etMessageService_execmode execmode);
+void etMessageService_start(etMessageService* self);
+void etMessageService_execute(etMessageService* self);
+void etMessageService_stop(etMessageService* self);
+void etMessageService_destroy(etMessageService* self);
+
+/* initialization of message pool */
+void etMessageService_initMessagePool(etMessageService* self);
+
+/* message queue interface for push and pop messages */
+void etMessageService_pushMessage(etMessageService* self, etMessage* msg);
+etMessage* etMessageService_popMessage(etMessageService* self);
+
+/* message pool interface to get and return (push and pop) messages */
+etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size);
+void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer);
+
+/* functions for debug and service information */
+etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self);
+
+
+#endif /* RMESSAGESERVICE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c
index 40be5342a..0f8ace1fb 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.c
@@ -1,89 +1,89 @@
-/**
- * @author generated by eTrice
- *
- * Source File of ProtocolClass etSystemProtocol
- *
- */
-
-#include "etSystemProtocol.h"
-#include "debugging/etMSCLogger.h"
-
-
-/*--------------------- port methods */
-
-
-/* getReplication */
-etInt32 etSystemProtocolReplPort_getReplication(const etSystemProtocolReplPort* self) {
- return ((etReplPort*)self)->size;
-}
-
-
-
-void etSystemProtocolConjPort_poll(const etSystemProtocolConjPort* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjPort", "poll")
- etPort_sendMessage(self, etSystemProtocol_IN_poll, 0, NULL);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etSystemProtocolConjReplPort_poll_broadcast(const etSystemProtocolConjReplPort* self) {
- int i;
- ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "poll")
- for (i=0; i<((etReplPort*)self)->size; ++i) {
- etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[i]), etSystemProtocol_IN_poll, 0, NULL);
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etSystemProtocolConjReplPort_poll(const etSystemProtocolConjReplPort* self, int idx) {
- ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "poll")
- if (0<=idx && idx<((etReplPort*)self)->size) {
- etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[idx]), etSystemProtocol_IN_poll, 0, NULL);
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etSystemProtocolConjPort_terminate(const etSystemProtocolConjPort* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjPort", "terminate")
- etPort_sendMessage(self, etSystemProtocol_IN_terminate, 0, NULL);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etSystemProtocolConjReplPort_terminate_broadcast(const etSystemProtocolConjReplPort* self) {
- int i;
- ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "terminate")
- for (i=0; i<((etReplPort*)self)->size; ++i) {
- etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[i]), etSystemProtocol_IN_terminate, 0, NULL);
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void etSystemProtocolConjReplPort_terminate(const etSystemProtocolConjReplPort* self, int idx) {
- ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "terminate")
- if (0<=idx && idx<((etReplPort*)self)->size) {
- etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[idx]), etSystemProtocol_IN_terminate, 0, NULL);
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-/* getReplication */
-etInt32 etSystemProtocolConjReplPort_getReplication(const etSystemProtocolConjReplPort* self) {
- return ((etReplPort*)self)->size;
-}
-
-
-
-/*--------------------- debug helpers */
-
-/* message names as strings for debugging (generate MSC) */
-static const char* const etSystemProtocol_messageStrings[] = {"MIN", "poll", "terminate", "MAX"};
-
-const char* etSystemProtocol_getMessageString(int msg_id) {
- if (msg_id<etSystemProtocol_MSG_MIN || msg_id>etSystemProtocol_MSG_MAX+1){
- /* id out of range */
- return "Message ID out of range";
- }
- else{
- return etSystemProtocol_messageStrings[msg_id];
- }
-}
+/**
+ * @author generated by eTrice
+ *
+ * Source File of ProtocolClass etSystemProtocol
+ *
+ */
+
+#include "etSystemProtocol.h"
+#include "debugging/etMSCLogger.h"
+
+
+/*--------------------- port methods */
+
+
+/* getReplication */
+etInt32 etSystemProtocolReplPort_getReplication(const etSystemProtocolReplPort* self) {
+ return ((etReplPort*)self)->size;
+}
+
+
+
+void etSystemProtocolConjPort_poll(const etSystemProtocolConjPort* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjPort", "poll")
+ etPort_sendMessage(self, etSystemProtocol_IN_poll, 0, NULL);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSystemProtocolConjReplPort_poll_broadcast(const etSystemProtocolConjReplPort* self) {
+ int i;
+ ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "poll")
+ for (i=0; i<((etReplPort*)self)->size; ++i) {
+ etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[i]), etSystemProtocol_IN_poll, 0, NULL);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSystemProtocolConjReplPort_poll(const etSystemProtocolConjReplPort* self, int idx) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "poll")
+ if (0<=idx && idx<((etReplPort*)self)->size) {
+ etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[idx]), etSystemProtocol_IN_poll, 0, NULL);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSystemProtocolConjPort_terminate(const etSystemProtocolConjPort* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjPort", "terminate")
+ etPort_sendMessage(self, etSystemProtocol_IN_terminate, 0, NULL);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSystemProtocolConjReplPort_terminate_broadcast(const etSystemProtocolConjReplPort* self) {
+ int i;
+ ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "terminate")
+ for (i=0; i<((etReplPort*)self)->size; ++i) {
+ etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[i]), etSystemProtocol_IN_terminate, 0, NULL);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSystemProtocolConjReplPort_terminate(const etSystemProtocolConjReplPort* self, int idx) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "terminate")
+ if (0<=idx && idx<((etReplPort*)self)->size) {
+ etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[idx]), etSystemProtocol_IN_terminate, 0, NULL);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+
+/* getReplication */
+etInt32 etSystemProtocolConjReplPort_getReplication(const etSystemProtocolConjReplPort* self) {
+ return ((etReplPort*)self)->size;
+}
+
+
+
+/*--------------------- debug helpers */
+
+/* message names as strings for debugging (generate MSC) */
+static const char* const etSystemProtocol_messageStrings[] = {"MIN", "poll", "terminate", "MAX"};
+
+const char* etSystemProtocol_getMessageString(int msg_id) {
+ if (msg_id<etSystemProtocol_MSG_MIN || msg_id>etSystemProtocol_MSG_MAX+1){
+ /* id out of range */
+ return "Message ID out of range";
+ }
+ else{
+ return etSystemProtocol_messageStrings[msg_id];
+ }
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h
index 730d5dbce..260e15608 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h
@@ -1,51 +1,51 @@
-/**
- * @author generated by eTrice
- *
- * Header File of ProtocolClass etSystemProtocol
- *
- */
-
-#ifndef _ETSYSTEMPROTOCOL_H_
-#define _ETSYSTEMPROTOCOL_H_
-
-#include "etDatatypes.h"
-#include "modelbase/etPort.h"
-
-/* message IDs */
-enum etSystemProtocol_msg_ids {
- etSystemProtocol_MSG_MIN = 0,
- etSystemProtocol_IN_poll = 1,
- etSystemProtocol_IN_terminate = 2,
- etSystemProtocol_MSG_MAX = 3
-};
-
-/*--------------------- port structs and methods */
-typedef etPort etSystemProtocolPort;
-typedef etReplPort etSystemProtocolReplPort;
-
-
-
-
-etInt32 etSystemProtocolReplPort_getReplication(const etSystemProtocolReplPort* self);
-typedef etPort etSystemProtocolConjPort;
-typedef etReplPort etSystemProtocolConjReplPort;
-
-
-void etSystemProtocolConjPort_poll(const etSystemProtocolConjPort* self);
-void etSystemProtocolConjReplPort_poll_broadcast(const etSystemProtocolConjReplPort* self);
-void etSystemProtocolConjReplPort_poll(const etSystemProtocolConjReplPort* self, int idx);
-void etSystemProtocolConjPort_terminate(const etSystemProtocolConjPort* self);
-void etSystemProtocolConjReplPort_terminate_broadcast(const etSystemProtocolConjReplPort* self);
-void etSystemProtocolConjReplPort_terminate(const etSystemProtocolConjReplPort* self, int idx);
-
-
-etInt32 etSystemProtocolConjReplPort_getReplication(const etSystemProtocolConjReplPort* self);
-
-/*--------------------- debug helpers */
-
-/* get message string for message id */
-const char* etSystemProtocol_getMessageString(int msg_id);
-
-
-#endif /* _ETSYSTEMPROTOCOL_H_ */
-
+/**
+ * @author generated by eTrice
+ *
+ * Header File of ProtocolClass etSystemProtocol
+ *
+ */
+
+#ifndef _ETSYSTEMPROTOCOL_H_
+#define _ETSYSTEMPROTOCOL_H_
+
+#include "etDatatypes.h"
+#include "modelbase/etPort.h"
+
+/* message IDs */
+enum etSystemProtocol_msg_ids {
+ etSystemProtocol_MSG_MIN = 0,
+ etSystemProtocol_IN_poll = 1,
+ etSystemProtocol_IN_terminate = 2,
+ etSystemProtocol_MSG_MAX = 3
+};
+
+/*--------------------- port structs and methods */
+typedef etPort etSystemProtocolPort;
+typedef etReplPort etSystemProtocolReplPort;
+
+
+
+
+etInt32 etSystemProtocolReplPort_getReplication(const etSystemProtocolReplPort* self);
+typedef etPort etSystemProtocolConjPort;
+typedef etReplPort etSystemProtocolConjReplPort;
+
+
+void etSystemProtocolConjPort_poll(const etSystemProtocolConjPort* self);
+void etSystemProtocolConjReplPort_poll_broadcast(const etSystemProtocolConjReplPort* self);
+void etSystemProtocolConjReplPort_poll(const etSystemProtocolConjReplPort* self, int idx);
+void etSystemProtocolConjPort_terminate(const etSystemProtocolConjPort* self);
+void etSystemProtocolConjReplPort_terminate_broadcast(const etSystemProtocolConjReplPort* self);
+void etSystemProtocolConjReplPort_terminate(const etSystemProtocolConjReplPort* self, int idx);
+
+
+etInt32 etSystemProtocolConjReplPort_getReplication(const etSystemProtocolConjReplPort* self);
+
+/*--------------------- debug helpers */
+
+/* get message string for message id */
+const char* etSystemProtocol_getMessageString(int msg_id);
+
+
+#endif /* _ETSYSTEMPROTOCOL_H_ */
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c
index 5783e905d..dff077dbe 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.c
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2012 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)
- *
- *******************************************************************************/
-
-#include "modelbase/etActor.h"
-
-etBool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) {
- /* TODO */
- return FALSE;
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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)
+ *
+ *******************************************************************************/
+
+#include "modelbase/etActor.h"
+
+etBool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data) {
+ /* TODO */
+ return FALSE;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h
index 4791fa991..a32efdbec 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2012 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 _ETACTOR_H_
-#define _ETACTOR_H_
-
-#include "etDatatypes.h"
-#include "modelbase/etPort.h"
-
-#define NOT_CAUGHT 0
-#define EVT_SHIFT 100
-
-etBool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data);
-
-#endif /* _ETACTOR_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 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 _ETACTOR_H_
+#define _ETACTOR_H_
+
+#include "etDatatypes.h"
+#include "modelbase/etPort.h"
+
+#define NOT_CAUGHT 0
+#define EVT_SHIFT 100
+
+etBool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data);
+
+#endif /* _ETACTOR_H_ */
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 a1e734618..1eff66694 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
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "modelbase/etPort.h"
-
-#include "debugging/etMSCLogger.h"
-#include "osal/etMemory.h"
-#include <string.h>
-
-/*
-void etPort_receive(const etPort* self, const etMessage* msg) {
- ET_MSC_LOGGER_SYNC_ENTRY("etPort", "receive")
- if (self->receiveMessageFunc!=NULL)
- (self->receiveMessageFunc)(self->myActor, (void*)self, msg);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-*/
-
-void etPort_sendMessage(const etPort* self, etInt16 evtId, int size, void* data) {
- int offset = MEM_CEIL(sizeof(etMessage));
- int totalSize = offset+size;
- etMessage* msg = NULL;
- ET_MSC_LOGGER_SYNC_ENTRY("etPort", "sendMessage")
- msg = etMessageService_getMessageBuffer(self->msgService, totalSize);
- if (msg!=NULL) {
- msg->address = self->peerAddress;
- msg->evtID = evtId;
-
- if (size>0 && data!=NULL) {
- memcpy(((char*)msg)+offset, data, size);
- }
-
- etMessageService_pushMessage(self->msgService, msg);
- }
- ET_MSC_LOGGER_SYNC_EXIT
-}
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "modelbase/etPort.h"
+
+#include "debugging/etMSCLogger.h"
+#include "osal/etMemory.h"
+#include <string.h>
+
+/*
+void etPort_receive(const etPort* self, const etMessage* msg) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etPort", "receive")
+ if (self->receiveMessageFunc!=NULL)
+ (self->receiveMessageFunc)(self->myActor, (void*)self, msg);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+*/
+
+void etPort_sendMessage(const etPort* self, etInt16 evtId, int size, void* data) {
+ int offset = MEM_CEIL(sizeof(etMessage));
+ int totalSize = offset+size;
+ etMessage* msg = NULL;
+ ET_MSC_LOGGER_SYNC_ENTRY("etPort", "sendMessage")
+ msg = etMessageService_getMessageBuffer(self->msgService, totalSize);
+ if (msg!=NULL) {
+ msg->address = self->peerAddress;
+ msg->evtID = evtId;
+
+ if (size>0 && data!=NULL) {
+ memcpy(((char*)msg)+offset, data, size);
+ }
+
+ etMessageService_pushMessage(self->msgService, msg);
+ }
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h
index 33008a9fc..4bf86ad18 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h
@@ -1,57 +1,57 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-
-
-#ifndef _ETPORT_H_
-#define _ETPORT_H_
-
-
-#include "messaging/etMessage.h"
-#include "messaging/etMessageReceiver.h"
-#include "messaging/etMessageService.h"
-#include "etRuntimeConfig.h"
-
-typedef struct {
- void* varData;
- etMessageService* msgService;
- etAddressId peerAddress;
- etAddressId localId;
-
- #ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE
- const char* myInstName;
- const char* peerInstName;
- #endif
- #ifdef etDEBUG
- etAddressId address;
- /* thread ID from msg service: msgService->threadId */
- #endif
-} etPort;
-
-typedef struct {
- etPort port;
- etAddressId index;
-} etReplSubPort;
-
-typedef struct {
- etInt16 size;
- const etReplSubPort* ports;
-} etReplPort;
-
-typedef etPort InterfaceItemBase;
-
-/*void etPort_receive(const etPort* self, const etMessage* msg);*/
-void etPort_sendMessage(const etPort* self, etInt16 evtId, int size, void* data);
-
-
-
-#endif /* _ETPORT_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
+
+#ifndef _ETPORT_H_
+#define _ETPORT_H_
+
+
+#include "messaging/etMessage.h"
+#include "messaging/etMessageReceiver.h"
+#include "messaging/etMessageService.h"
+#include "etRuntimeConfig.h"
+
+typedef struct {
+ void* varData;
+ etMessageService* msgService;
+ etAddressId peerAddress;
+ etAddressId localId;
+
+ #ifdef ET_ASYNC_MSC_LOGGER_ACTIVATE
+ const char* myInstName;
+ const char* peerInstName;
+ #endif
+ #ifdef etDEBUG
+ etAddressId address;
+ /* thread ID from msg service: msgService->threadId */
+ #endif
+} etPort;
+
+typedef struct {
+ etPort port;
+ etAddressId index;
+} etReplSubPort;
+
+typedef struct {
+ etInt16 size;
+ const etReplSubPort* ports;
+} etReplPort;
+
+typedef etPort InterfaceItemBase;
+
+/*void etPort_receive(const etPort* self, const etMessage* msg);*/
+void etPort_sendMessage(const etPort* self, etInt16 evtId, int size, void* data);
+
+
+
+#endif /* _ETPORT_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h
index 6f7961aff..293feaaf0 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h
@@ -1,166 +1,166 @@
-/*******************************************************************************
- * Copyright (c) 2013 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 _ETTCPSOCKETS_H_
-#define _ETTCPSOCKETS_H_
-
-#include "etDatatypes.h"
-
-/** the maximum number of connections per server */
-#define MAX_CONNECTIONS 32
-
-/** function prototype for receiving data from a socket */
-typedef int (*etSocketReceiver)(void* self, int channel, int size, const int8* data);
-/** function prototype for a function returning a writable buffer */
-typedef int8* (*etBufferProvider)(void* self, int* size);
-
-/**
- * The public part of the server data.
- * Data passed to the API methods <b>must</b> be created using
- * {@link etCreateSocketServerData()}
- */
-typedef struct etSocketServerData {
- etSocketReceiver receiver;
- etBufferProvider bufferProvider;
- void* userData;
- int maxConnections;
-}
-etSocketServerData;
-
-/**
- * The public part of the connection data.
- * Data passed to the API methods <b>must</b> be created using
- * {@link etCreateSocketConnectionData()}
- */
-typedef struct etSocketConnectionData {
- etSocketReceiver receiver;
- etBufferProvider bufferProvider;
- void* userData;
-}
-etSocketConnectionData;
-
-/** error codes for API functions */
-typedef enum {
- ETSOCKET_OK,
- ETSOCKET_ERROR
-}
-etSocketError;
-
-
-/*
- * general
- */
-
-/**
- * to be called once before working with sockets
- */
-etSocketError etInitSockets();
-
-/**
- * to be called once after working with sockets
- */
-etSocketError etCleanupSockets();
-
-/*
- * server side
- */
-
-/**
- * @return a struct with the server data allocated from the heap
- */
-etSocketServerData* etCreateSocketServerData();
-
-/**
- * @param data the previously allocated data to be freed
- */
-void etFreeSocketServerData(etSocketServerData* data);
-
-/**
- * starts a thread listening to a port
- * @param self the server data
- * @param port which is listened to
- * @return an error code of type {@link etSocketError}
- */
-etSocketError etStartListening(etSocketServerData* self, short port);
-
-/**
- * stops listening on the socket but leaves connections untouched
- * @param self the server data
- * @return an error code of type {@link etSocketError}
- */
-etSocketError etStopSocketServer(etSocketServerData* self);
-
-/**
- * write to an established connection of the server side
- * @param self the server data
- * @param connection the connection to which the data should be sent
- * @param size the size of the data in bytes
- * @param data the data to be sent
- * @return an error code of type {@link etSocketError}
- */
-etSocketError etWriteServerSocket(etSocketServerData* self, int connection, int size, const int8* data);
-
-/**
- * close a server connection (closes the socket and stops its thread)
- * @param self the server data
- * @param connection the connection to be stopped
- * @return an error code of type {@link etSocketError}
- */
-etSocketError etCloseServerSocket(etSocketServerData* self, int connection);
-
-/**
- * close all server connections (closes the sockets and stops their threads)
- * @param self the server data
- * @return an error code of type {@link etSocketError}
- */
-etSocketError etCloseAllServerSockets(etSocketServerData* self);
-
-/*
- * client side
- */
-
-/**
- * @return a struct with the client data allocated from the heap
- */
-etSocketConnectionData* etCreateSocketConnectionData();
-
-/**
- * @param data the previously allocated data to be freed
- */
-void etFreeSocketConnectionData(etSocketConnectionData* data);
-
-/**
- * connect a socket server
- * @param addr the internet address given as quadrupel, if {@code NULL} then local host is assumed
- * @param port the port to which the connection should be established
- * @param self the client data
- * @return an error code of type {@link etSocketError}
- */
-etSocketError etConnectServer(etSocketConnectionData* self, const char* addr, short port);
-
-/**
- * write to an established client connection
- * @param self the client data
- * @param size the size of the data in bytes
- * @param data the data to be sent
- * @return an error code of type {@link etSocketError}
- */
-etSocketError etWriteSocket(etSocketConnectionData* self, int size, const int8* data);
-
-/**
- * close a client connection (closes the socket and stops the thread)
- * @param self the client data
- * @return an error code of type {@link etSocketError}
- */
-etSocketError etCloseSocket(etSocketConnectionData* self);
-
-#endif /* _ETTCPSOCKETS_H_ */
+/*******************************************************************************
+ * Copyright (c) 2013 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 _ETTCPSOCKETS_H_
+#define _ETTCPSOCKETS_H_
+
+#include "etDatatypes.h"
+
+/** the maximum number of connections per server */
+#define MAX_CONNECTIONS 32
+
+/** function prototype for receiving data from a socket */
+typedef int (*etSocketReceiver)(void* self, int channel, int size, const int8* data);
+/** function prototype for a function returning a writable buffer */
+typedef int8* (*etBufferProvider)(void* self, int* size);
+
+/**
+ * The public part of the server data.
+ * Data passed to the API methods <b>must</b> be created using
+ * {@link etCreateSocketServerData()}
+ */
+typedef struct etSocketServerData {
+ etSocketReceiver receiver;
+ etBufferProvider bufferProvider;
+ void* userData;
+ int maxConnections;
+}
+etSocketServerData;
+
+/**
+ * The public part of the connection data.
+ * Data passed to the API methods <b>must</b> be created using
+ * {@link etCreateSocketConnectionData()}
+ */
+typedef struct etSocketConnectionData {
+ etSocketReceiver receiver;
+ etBufferProvider bufferProvider;
+ void* userData;
+}
+etSocketConnectionData;
+
+/** error codes for API functions */
+typedef enum {
+ ETSOCKET_OK,
+ ETSOCKET_ERROR
+}
+etSocketError;
+
+
+/*
+ * general
+ */
+
+/**
+ * to be called once before working with sockets
+ */
+etSocketError etInitSockets();
+
+/**
+ * to be called once after working with sockets
+ */
+etSocketError etCleanupSockets();
+
+/*
+ * server side
+ */
+
+/**
+ * @return a struct with the server data allocated from the heap
+ */
+etSocketServerData* etCreateSocketServerData();
+
+/**
+ * @param data the previously allocated data to be freed
+ */
+void etFreeSocketServerData(etSocketServerData* data);
+
+/**
+ * starts a thread listening to a port
+ * @param self the server data
+ * @param port which is listened to
+ * @return an error code of type {@link etSocketError}
+ */
+etSocketError etStartListening(etSocketServerData* self, short port);
+
+/**
+ * stops listening on the socket but leaves connections untouched
+ * @param self the server data
+ * @return an error code of type {@link etSocketError}
+ */
+etSocketError etStopSocketServer(etSocketServerData* self);
+
+/**
+ * write to an established connection of the server side
+ * @param self the server data
+ * @param connection the connection to which the data should be sent
+ * @param size the size of the data in bytes
+ * @param data the data to be sent
+ * @return an error code of type {@link etSocketError}
+ */
+etSocketError etWriteServerSocket(etSocketServerData* self, int connection, int size, const int8* data);
+
+/**
+ * close a server connection (closes the socket and stops its thread)
+ * @param self the server data
+ * @param connection the connection to be stopped
+ * @return an error code of type {@link etSocketError}
+ */
+etSocketError etCloseServerSocket(etSocketServerData* self, int connection);
+
+/**
+ * close all server connections (closes the sockets and stops their threads)
+ * @param self the server data
+ * @return an error code of type {@link etSocketError}
+ */
+etSocketError etCloseAllServerSockets(etSocketServerData* self);
+
+/*
+ * client side
+ */
+
+/**
+ * @return a struct with the client data allocated from the heap
+ */
+etSocketConnectionData* etCreateSocketConnectionData();
+
+/**
+ * @param data the previously allocated data to be freed
+ */
+void etFreeSocketConnectionData(etSocketConnectionData* data);
+
+/**
+ * connect a socket server
+ * @param addr the internet address given as quadrupel, if {@code NULL} then local host is assumed
+ * @param port the port to which the connection should be established
+ * @param self the client data
+ * @return an error code of type {@link etSocketError}
+ */
+etSocketError etConnectServer(etSocketConnectionData* self, const char* addr, short port);
+
+/**
+ * write to an established client connection
+ * @param self the client data
+ * @param size the size of the data in bytes
+ * @param data the data to be sent
+ * @return an error code of type {@link etSocketError}
+ */
+etSocketError etWriteSocket(etSocketConnectionData* self, int size, const int8* data);
+
+/**
+ * close a client connection (closes the socket and stops the thread)
+ * @param self the client data
+ * @return an error code of type {@link etSocketError}
+ */
+etSocketError etCloseSocket(etSocketConnectionData* self);
+
+#endif /* _ETTCPSOCKETS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c
index bca6ecd44..31dbd125e 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.c
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2013 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-
-#include "runtime/etRuntime.h"
-
-
-static etSema terminateSemaphore;
-
-etSema* etRuntime_getTerminateSemaphore() {
- static etBool initialized = FALSE;
-
- if (!initialized) {
- initialized = TRUE;
- etSema_construct(&terminateSemaphore);
- }
-
- return &terminateSemaphore;
-}
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
+#include "runtime/etRuntime.h"
+
+
+static etSema terminateSemaphore;
+
+etSema* etRuntime_getTerminateSemaphore() {
+ static etBool initialized = FALSE;
+
+ if (!initialized) {
+ initialized = TRUE;
+ etSema_construct(&terminateSemaphore);
+ }
+
+ return &terminateSemaphore;
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
index 83877fa6e..5b9aa281a 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2013 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETRUNTIME_H_
-#define _ETRUNTIME_H_
-
-#include "osal/etSema.h"
-
-etSema* etRuntime_getTerminateSemaphore();
-
-#endif /* _ETRUNTIME_H_ */
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETRUNTIME_H_
+#define _ETRUNTIME_H_
+
+#include "osal/etSema.h"
+
+etSema* etRuntime_getTerminateSemaphore();
+
+#endif /* _ETRUNTIME_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.c b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.c
index 8e488b05a..dfeb93090 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.c
@@ -1,14 +1,14 @@
-/*******************************************************************************
- * Copyright (c) 2013 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-
-#include "runtime/etThreadList.h"
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
+#include "runtime/etThreadList.h"
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
index 79f2fe1be..830ae61fd 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2013 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _etThreadController_H_
-#define _etThreadController_H_
-
-#include "osal/etThread.h"
-
-/**
- * etThreadController holds a complete list of all threads
- *
- **/
-typedef struct etThreadController{
- etThread* threadList; /**< list of all thread data (as array) **/
- int32 size; /**< size of the list **/
-}etThreadController;
-
-int32 etThreadController_getNumberOfThreads(etThreadController* self);
-void etThreadController_startAll(etThreadController* self);
-void etThreadController_stopAll(etThreadController* self);
-void etThreadController_getCurrentThreadId(void);
-
-#endif /* _etThreadController_H_ */
+/*******************************************************************************
+ * Copyright (c) 2013 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _etThreadController_H_
+#define _etThreadController_H_
+
+#include "osal/etThread.h"
+
+/**
+ * etThreadController holds a complete list of all threads
+ *
+ **/
+typedef struct etThreadController{
+ etThread* threadList; /**< list of all thread data (as array) **/
+ int32 size; /**< size of the list **/
+}etThreadController;
+
+int32 etThreadController_getNumberOfThreads(etThreadController* self);
+void etThreadController_startAll(etThreadController* self);
+void etThreadController_stopAll(etThreadController* self);
+void etThreadController_getCurrentThreadId(void);
+
+#endif /* _etThreadController_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 f234caa98..9562638e6 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/config/etRuntimeConfig.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/config/etRuntimeConfig.h
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef ETGLOBALFLAGS_H_
-#define ETGLOBALFLAGS_H_
-
-/* flags for debugging */
-
-#define ET_MSC_LOGGER_ACTIVATE /* needs ET_LOGGER_ACTIVATE */
-//#define ET_SYNC_MSC_LOGGER_ACTIVATE /* needs ET_MSC_LOGGER_ACTIVATE */
-#define ET_ASYNC_MSC_LOGGER_ACTIVATE /* needs ET_MSC_LOGGER_ACTIVATE */
-#define ET_LOGGER_ACTIVATE
-
-
-#define STRUCT_ALIGN 8
-
-/* timing and scheduling */
-//#define FREQUENCY 10L
-//#define ET_RUNTIME_MAXLOOP 100
-/*#define ET_RUNTIME_ENDLESS*/
-
-/* enable multi threading (e.g. for protection of message queues) */
-#define ET_MULTI_THREADING
-
-#endif /* ETGLOBALFLAGS_H_ */
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef ETGLOBALFLAGS_H_
+#define ETGLOBALFLAGS_H_
+
+/* flags for debugging */
+
+#define ET_MSC_LOGGER_ACTIVATE /* needs ET_LOGGER_ACTIVATE */
+//#define ET_SYNC_MSC_LOGGER_ACTIVATE /* needs ET_MSC_LOGGER_ACTIVATE */
+#define ET_ASYNC_MSC_LOGGER_ACTIVATE /* needs ET_MSC_LOGGER_ACTIVATE */
+#define ET_LOGGER_ACTIVATE
+
+
+#define STRUCT_ALIGN 8
+
+/* timing and scheduling */
+//#define FREQUENCY 10L
+//#define ET_RUNTIME_MAXLOOP 100
+/*#define ET_RUNTIME_ENDLESS*/
+
+/* enable multi threading (e.g. for protection of message queues) */
+#define ET_MULTI_THREADING
+
+#endif /* ETGLOBALFLAGS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTcpSockets.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTcpSockets.c
index b2968278e..a2ec51053 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTcpSockets.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTcpSockets.c
@@ -1,332 +1,332 @@
-/*******************************************************************************
- * Copyright (c) 2013 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)
- *
- *******************************************************************************/
-
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include "osal/etTcpSockets.h"
-#include "osal/etThread.h"
-
-#define STACK_SIZE (1024*256)
-#define PRIO 0
-#define LOCAL_HOST "127.0.0.1"
-#define INVALID_SOCKET -1
-
-#define PRINT_DEBUG(x) { printf(x); fflush(stdout); }
-
-typedef int SOCKET;
-
-/* implementation versions of data */
-
-typedef struct etSocketConnectionDataImpl {
- /* public part */
- etSocketConnectionData data;
-
- /* implementation specific */
- SOCKET socket;
- int channel;
- struct sockaddr_in address;
- etThread readThread;
-}
-etSocketConnectionDataImpl;
-
-typedef struct etSocketServerDataImpl {
- /* public part */
- etSocketServerData data;
-
- /* implementation specific */
- SOCKET socket;
- etThread listenerThread;
- int nConnections;
- etSocketConnectionDataImpl connections[MAX_CONNECTIONS];
-}
-etSocketServerDataImpl;
-
-/* thread function reading from the socket */
-static void readThreadFunc(void* threadData) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) threadData;
- int len, retval;
- int8* buffer = (self->data.bufferProvider)(self->data.userData, &len);
-
- while (TRUE) {
- retval = recv(self->socket, buffer, len, 0);
- if (retval<=0) {
- /* TODO: call WSAGetLastError and do error handling */
- PRINT_DEBUG("connection thread: socket lost, exiting\n")
- self->socket = INVALID_SOCKET;
- return;
- }
-
- (self->data.receiver)(self->data.userData, self->channel, retval, buffer);
- }
-}
-
-/* thread function listening to the socket and creating new listener threads for accepted connections */
-static void listenerThreadFunc(void* threadData) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) threadData;
-
- PRINT_DEBUG("server: listening\n")
- if (listen(self->socket, self->data.maxConnections) == INVALID_SOCKET) {
- PRINT_DEBUG("server: error\n")
- return;
- }
-
- while (self->data.maxConnections > self->nConnections) {
- int slot;
- socklen_t len;
-
- /* find next free slot */
- for (slot=0; slot<MAX_CONNECTIONS; ++slot)
- if (self->connections[slot].socket==INVALID_SOCKET)
- break;
-
- PRINT_DEBUG("server: accepting\n")
- len = sizeof(self->connections[slot].address);
- self->connections[slot].socket = accept(
- self->socket,
- (struct sockaddr*) &self->connections[slot].address,
- &len);
-
- if (self->connections[slot].socket == INVALID_SOCKET) {
- /* TODO: error handling */
- PRINT_DEBUG("server: accept interrupted, exiting\n")
- return;
- }
-
- PRINT_DEBUG("server: accepted new client, starting read thread\n")
- self->connections[slot].channel = self->nConnections++;
-
- etThread_construct(
- &self->connections[slot].readThread,
- STACK_SIZE,
- PRIO,
- "etSocketServer",
- readThreadFunc,
- &self->connections[slot]);
- }
-
- /* TODO: if maxConnections is reached this thread terminates.
- * Should we wait until a connection is closed and accept again?
- */
-
- PRINT_DEBUG("server: exiting listener thread\n")
-}
-
-etSocketError etInitSockets() {
- PRINT_DEBUG("sockets: init\n")
- return ETSOCKET_OK;
-}
-
-etSocketError etCleanupSockets() {
- PRINT_DEBUG("sockets: clean-up\n")
- return ETSOCKET_OK;
-}
-
-etSocketServerData* etCreateSocketServerData() {
- etSocketServerDataImpl* data = malloc(sizeof(etSocketServerDataImpl));
- memset(data, 0, sizeof(etSocketServerDataImpl));
- return &data->data;
-}
-
-void etFreeSocketServerData(etSocketServerData* data) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
- free(self);
-}
-
-etSocketError etStartListening(etSocketServerData* data, short port) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
- struct sockaddr_in local;
- int i;
-
- if (self==NULL)
- return ETSOCKET_ERROR;
-
- if (self->data.maxConnections>MAX_CONNECTIONS)
- return ETSOCKET_ERROR;
-
- /* mark all connections unused and set receiver and buffer provider */
- for (i=0; i<MAX_CONNECTIONS; ++i) {
- self->connections[i].socket = INVALID_SOCKET;
- self->connections[i].data.receiver = self->data.receiver;
- self->connections[i].data.bufferProvider = self->data.bufferProvider;
- self->connections[i].data.userData = self->data.userData;
- }
- self->nConnections = 0;
-
- local.sin_family = AF_INET;
- local.sin_addr.s_addr = INADDR_ANY;
-
- local.sin_port = htons(port);
-
- self->socket = socket(AF_INET, SOCK_STREAM, 0);
- if (self->socket == INVALID_SOCKET)
- return ETSOCKET_ERROR;
-
- if (bind(self->socket, (struct sockaddr*) &local, sizeof(local)) < 0)
- return ETSOCKET_ERROR;
-
- PRINT_DEBUG("server: starting listener thread\n")
- etThread_construct(
- &self->listenerThread,
- STACK_SIZE,
- PRIO,
- "etSocketServer",
- listenerThreadFunc,
- self);
-
- return ETSOCKET_OK;
-}
-
-etSocketError etStopSocketServer(etSocketServerData* data) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
- PRINT_DEBUG("server: stop\n")
- close(self->socket);
- return ETSOCKET_OK;
-}
-
-etSocketError etWriteServerSocket(etSocketServerData* dat, int connection, int size, const int8* data) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) dat;
- int offset = 0;
-
- if (connection<0 || connection>MAX_CONNECTIONS || self->connections[connection].socket==INVALID_SOCKET)
- return ETSOCKET_ERROR;
-
- /* Note: loop required because:
- * If no error occurs, send returns the total number of bytes sent, which can be less than the number
- * requested to be sent in the len parameter.
- * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740149%28v=vs.85%29.aspx
- */
-
- while (size>0) {
- int sent = send(self->connections[connection].socket, ((int8*)data)+offset, size, 0);
- if (sent<=0)
- return ETSOCKET_ERROR;
-
- offset += sent;
- size -= sent;
- }
-
- return ETSOCKET_OK;
-}
-
-etSocketError etCloseServerSocket(etSocketServerData* data, int connection) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
-
- if (self->connections[connection].socket!=INVALID_SOCKET) {
- PRINT_DEBUG("server: close connection\n")
- close(self->connections[connection].socket);
- self->connections[connection].socket = INVALID_SOCKET;
- }
-
- return ETSOCKET_OK;
-}
-
-etSocketError etCloseAllServerSockets(etSocketServerData* data) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
- int i;
-
- PRINT_DEBUG("server: close all connections\n")
- for (i=0; i<MAX_CONNECTIONS; ++i) {
- if (self->connections[i].socket!=INVALID_SOCKET) {
- close(self->connections[i].socket);
- self->connections[i].socket = INVALID_SOCKET;
- }
- }
-
- return ETSOCKET_OK;
-}
-
-etSocketConnectionData* etCreateSocketConnectionData() {
- etSocketConnectionDataImpl* data = malloc(sizeof(etSocketConnectionDataImpl));
- memset(data, 0, sizeof(etSocketConnectionDataImpl));
- return &data->data;
-}
-
-void etFreeSocketConnectionData(etSocketConnectionData* data) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
- free(self);
-}
-
-etSocketError etConnectServer(etSocketConnectionData* data, const char* addr, short port) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
- struct hostent *host;
-
- if (addr==NULL)
- addr = LOCAL_HOST;
-
- if (isalpha((int)addr[0])) {
- host = gethostbyname(addr);
- }
- else {
- unsigned long a = inet_addr(addr);
- host = gethostbyaddr((char *)&a, 4, AF_INET);
- }
-
- if (host == NULL )
- return ETSOCKET_ERROR;
-
- memset(&self->address, 0, sizeof(self->address));
- memcpy(&(self->address.sin_addr), host->h_addr, host->h_length);
- self->address.sin_family = host->h_addrtype;
- self->address.sin_port = htons(port);
-
- self->socket = socket(AF_INET, SOCK_STREAM, 0);
- if (self->socket==INVALID_SOCKET)
- return ETSOCKET_ERROR;
-
- PRINT_DEBUG("client: connecting\n")
- if (connect(self->socket, (struct sockaddr*)&(self->address), sizeof(self->address)) == INVALID_SOCKET)
- return ETSOCKET_ERROR;
-
- PRINT_DEBUG("client: connected\n")
- PRINT_DEBUG("client: starting read thread\n")
- etThread_construct(
- &self->readThread,
- STACK_SIZE,
- PRIO,
- "etSocketConnection",
- readThreadFunc,
- self);
-
- return ETSOCKET_OK;
-}
-
-etSocketError etWriteSocket(etSocketConnectionData* dat, int size, const int8* data) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) dat;
- int offset = 0;
-
- while (size>0) {
- int sent = send(self->socket, ((int8*)data)+offset, size, 0);
- if (sent<=0)
- return ETSOCKET_ERROR;
-
- offset += sent;
- size -= sent;
- }
-
- return ETSOCKET_OK;
-}
-
-etSocketError etCloseSocket(etSocketConnectionData* data) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
-
- close(self->socket);
-
- return ETSOCKET_OK;
-}
-
+/*******************************************************************************
+ * Copyright (c) 2013 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)
+ *
+ *******************************************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <arpa/inet.h>
+#include "osal/etTcpSockets.h"
+#include "osal/etThread.h"
+
+#define STACK_SIZE (1024*256)
+#define PRIO 0
+#define LOCAL_HOST "127.0.0.1"
+#define INVALID_SOCKET -1
+
+#define PRINT_DEBUG(x) { printf(x); fflush(stdout); }
+
+typedef int SOCKET;
+
+/* implementation versions of data */
+
+typedef struct etSocketConnectionDataImpl {
+ /* public part */
+ etSocketConnectionData data;
+
+ /* implementation specific */
+ SOCKET socket;
+ int channel;
+ struct sockaddr_in address;
+ etThread readThread;
+}
+etSocketConnectionDataImpl;
+
+typedef struct etSocketServerDataImpl {
+ /* public part */
+ etSocketServerData data;
+
+ /* implementation specific */
+ SOCKET socket;
+ etThread listenerThread;
+ int nConnections;
+ etSocketConnectionDataImpl connections[MAX_CONNECTIONS];
+}
+etSocketServerDataImpl;
+
+/* thread function reading from the socket */
+static void readThreadFunc(void* threadData) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) threadData;
+ int len, retval;
+ int8* buffer = (self->data.bufferProvider)(self->data.userData, &len);
+
+ while (TRUE) {
+ retval = recv(self->socket, buffer, len, 0);
+ if (retval<=0) {
+ /* TODO: call WSAGetLastError and do error handling */
+ PRINT_DEBUG("connection thread: socket lost, exiting\n")
+ self->socket = INVALID_SOCKET;
+ return;
+ }
+
+ (self->data.receiver)(self->data.userData, self->channel, retval, buffer);
+ }
+}
+
+/* thread function listening to the socket and creating new listener threads for accepted connections */
+static void listenerThreadFunc(void* threadData) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) threadData;
+
+ PRINT_DEBUG("server: listening\n")
+ if (listen(self->socket, self->data.maxConnections) == INVALID_SOCKET) {
+ PRINT_DEBUG("server: error\n")
+ return;
+ }
+
+ while (self->data.maxConnections > self->nConnections) {
+ int slot;
+ socklen_t len;
+
+ /* find next free slot */
+ for (slot=0; slot<MAX_CONNECTIONS; ++slot)
+ if (self->connections[slot].socket==INVALID_SOCKET)
+ break;
+
+ PRINT_DEBUG("server: accepting\n")
+ len = sizeof(self->connections[slot].address);
+ self->connections[slot].socket = accept(
+ self->socket,
+ (struct sockaddr*) &self->connections[slot].address,
+ &len);
+
+ if (self->connections[slot].socket == INVALID_SOCKET) {
+ /* TODO: error handling */
+ PRINT_DEBUG("server: accept interrupted, exiting\n")
+ return;
+ }
+
+ PRINT_DEBUG("server: accepted new client, starting read thread\n")
+ self->connections[slot].channel = self->nConnections++;
+
+ etThread_construct(
+ &self->connections[slot].readThread,
+ STACK_SIZE,
+ PRIO,
+ "etSocketServer",
+ readThreadFunc,
+ &self->connections[slot]);
+ }
+
+ /* TODO: if maxConnections is reached this thread terminates.
+ * Should we wait until a connection is closed and accept again?
+ */
+
+ PRINT_DEBUG("server: exiting listener thread\n")
+}
+
+etSocketError etInitSockets() {
+ PRINT_DEBUG("sockets: init\n")
+ return ETSOCKET_OK;
+}
+
+etSocketError etCleanupSockets() {
+ PRINT_DEBUG("sockets: clean-up\n")
+ return ETSOCKET_OK;
+}
+
+etSocketServerData* etCreateSocketServerData() {
+ etSocketServerDataImpl* data = malloc(sizeof(etSocketServerDataImpl));
+ memset(data, 0, sizeof(etSocketServerDataImpl));
+ return &data->data;
+}
+
+void etFreeSocketServerData(etSocketServerData* data) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+ free(self);
+}
+
+etSocketError etStartListening(etSocketServerData* data, short port) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+ struct sockaddr_in local;
+ int i;
+
+ if (self==NULL)
+ return ETSOCKET_ERROR;
+
+ if (self->data.maxConnections>MAX_CONNECTIONS)
+ return ETSOCKET_ERROR;
+
+ /* mark all connections unused and set receiver and buffer provider */
+ for (i=0; i<MAX_CONNECTIONS; ++i) {
+ self->connections[i].socket = INVALID_SOCKET;
+ self->connections[i].data.receiver = self->data.receiver;
+ self->connections[i].data.bufferProvider = self->data.bufferProvider;
+ self->connections[i].data.userData = self->data.userData;
+ }
+ self->nConnections = 0;
+
+ local.sin_family = AF_INET;
+ local.sin_addr.s_addr = INADDR_ANY;
+
+ local.sin_port = htons(port);
+
+ self->socket = socket(AF_INET, SOCK_STREAM, 0);
+ if (self->socket == INVALID_SOCKET)
+ return ETSOCKET_ERROR;
+
+ if (bind(self->socket, (struct sockaddr*) &local, sizeof(local)) < 0)
+ return ETSOCKET_ERROR;
+
+ PRINT_DEBUG("server: starting listener thread\n")
+ etThread_construct(
+ &self->listenerThread,
+ STACK_SIZE,
+ PRIO,
+ "etSocketServer",
+ listenerThreadFunc,
+ self);
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etStopSocketServer(etSocketServerData* data) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+ PRINT_DEBUG("server: stop\n")
+ close(self->socket);
+ return ETSOCKET_OK;
+}
+
+etSocketError etWriteServerSocket(etSocketServerData* dat, int connection, int size, const int8* data) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) dat;
+ int offset = 0;
+
+ if (connection<0 || connection>MAX_CONNECTIONS || self->connections[connection].socket==INVALID_SOCKET)
+ return ETSOCKET_ERROR;
+
+ /* Note: loop required because:
+ * If no error occurs, send returns the total number of bytes sent, which can be less than the number
+ * requested to be sent in the len parameter.
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740149%28v=vs.85%29.aspx
+ */
+
+ while (size>0) {
+ int sent = send(self->connections[connection].socket, ((int8*)data)+offset, size, 0);
+ if (sent<=0)
+ return ETSOCKET_ERROR;
+
+ offset += sent;
+ size -= sent;
+ }
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etCloseServerSocket(etSocketServerData* data, int connection) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+
+ if (self->connections[connection].socket!=INVALID_SOCKET) {
+ PRINT_DEBUG("server: close connection\n")
+ close(self->connections[connection].socket);
+ self->connections[connection].socket = INVALID_SOCKET;
+ }
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etCloseAllServerSockets(etSocketServerData* data) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+ int i;
+
+ PRINT_DEBUG("server: close all connections\n")
+ for (i=0; i<MAX_CONNECTIONS; ++i) {
+ if (self->connections[i].socket!=INVALID_SOCKET) {
+ close(self->connections[i].socket);
+ self->connections[i].socket = INVALID_SOCKET;
+ }
+ }
+
+ return ETSOCKET_OK;
+}
+
+etSocketConnectionData* etCreateSocketConnectionData() {
+ etSocketConnectionDataImpl* data = malloc(sizeof(etSocketConnectionDataImpl));
+ memset(data, 0, sizeof(etSocketConnectionDataImpl));
+ return &data->data;
+}
+
+void etFreeSocketConnectionData(etSocketConnectionData* data) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
+ free(self);
+}
+
+etSocketError etConnectServer(etSocketConnectionData* data, const char* addr, short port) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
+ struct hostent *host;
+
+ if (addr==NULL)
+ addr = LOCAL_HOST;
+
+ if (isalpha((int)addr[0])) {
+ host = gethostbyname(addr);
+ }
+ else {
+ unsigned long a = inet_addr(addr);
+ host = gethostbyaddr((char *)&a, 4, AF_INET);
+ }
+
+ if (host == NULL )
+ return ETSOCKET_ERROR;
+
+ memset(&self->address, 0, sizeof(self->address));
+ memcpy(&(self->address.sin_addr), host->h_addr, host->h_length);
+ self->address.sin_family = host->h_addrtype;
+ self->address.sin_port = htons(port);
+
+ self->socket = socket(AF_INET, SOCK_STREAM, 0);
+ if (self->socket==INVALID_SOCKET)
+ return ETSOCKET_ERROR;
+
+ PRINT_DEBUG("client: connecting\n")
+ if (connect(self->socket, (struct sockaddr*)&(self->address), sizeof(self->address)) == INVALID_SOCKET)
+ return ETSOCKET_ERROR;
+
+ PRINT_DEBUG("client: connected\n")
+ PRINT_DEBUG("client: starting read thread\n")
+ etThread_construct(
+ &self->readThread,
+ STACK_SIZE,
+ PRIO,
+ "etSocketConnection",
+ readThreadFunc,
+ self);
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etWriteSocket(etSocketConnectionData* dat, int size, const int8* data) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) dat;
+ int offset = 0;
+
+ while (size>0) {
+ int sent = send(self->socket, ((int8*)data)+offset, size, 0);
+ if (sent<=0)
+ return ETSOCKET_ERROR;
+
+ offset += sent;
+ size -= sent;
+ }
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etCloseSocket(etSocketConnectionData* data) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
+
+ close(self->socket);
+
+ return ETSOCKET_OK;
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c
index 8be04ac10..656ee099e 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c
@@ -1,333 +1,333 @@
-/*******************************************************************************
- * Copyright (c) 2013 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)
- *
- *******************************************************************************/
-
-#include "osal/etTcpSockets.h"
-#include <winsock2.h>
-#include <ctype.h>
-#include "osal/etThread.h"
-
-#define STACK_SIZE 0 /* let system select default size */
-#define PRIO THREAD_PRIORITY_NORMAL
-#define LOCAL_HOST "127.0.0.1"
-
-#define PRINT_DEBUG(x) { printf(x); fflush(stdout); }
-
-/* implementation versions of data */
-
-typedef struct etSocketConnectionDataImpl {
- /* public part */
- etSocketConnectionData data;
-
- /* implementation specific */
- SOCKET socket;
- int channel;
- struct sockaddr_in address;
- etThread readThread;
-}
-etSocketConnectionDataImpl;
-
-typedef struct etSocketServerDataImpl {
- /* public part */
- etSocketServerData data;
-
- /* implementation specific */
- SOCKET socket;
- etThread listenerThread;
- int nConnections;
- etSocketConnectionDataImpl connections[MAX_CONNECTIONS];
-}
-etSocketServerDataImpl;
-
-/* thread function reading from the socket */
-static void readThreadFunc(void* threadData) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) threadData;
- int len, retval;
- int8* buffer = (self->data.bufferProvider)(self->data.userData, &len);
-
- while (TRUE) {
- retval = recv(self->socket, buffer, len, 0);
- if (retval<=0) {
- /* TODO: call WSAGetLastError and do error handling
- int err = WSAGetLastError();
- */
- PRINT_DEBUG("connection thread: socket lost, exiting\n")
- self->socket = INVALID_SOCKET;
- return;
- }
-
- (self->data.receiver)(self->data.userData, self->channel, retval, buffer);
- }
-}
-
-/* thread function listening to the socket and creating new listener threads for accepted connections */
-static void listenerThreadFunc(void* threadData) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) threadData;
-
- PRINT_DEBUG("server: listening\n")
- if (listen(self->socket, self->data.maxConnections) == SOCKET_ERROR) {
- PRINT_DEBUG("server: error\n")
- return;
- }
-
- while (self->data.maxConnections > self->nConnections) {
- int slot;
- int len;
-
- /* find next free slot */
- for (slot=0; slot<MAX_CONNECTIONS; ++slot)
- if (self->connections[slot].socket==INVALID_SOCKET)
- break;
-
- PRINT_DEBUG("server: accepting\n")
- len = sizeof(self->connections[slot].address);
- self->connections[slot].socket = accept(
- self->socket,
- (struct sockaddr*) &self->connections[slot].address,
- &len);
-
- if (self->connections[slot].socket == INVALID_SOCKET) {
- /* TODO: error handling */
- PRINT_DEBUG("server: accept interrupted, exiting\n")
- return;
- }
-
- PRINT_DEBUG("server: accepted new client, starting read thread\n")
- self->connections[slot].channel = self->nConnections++;
-
- etThread_construct(
- &self->connections[slot].readThread,
- STACK_SIZE,
- PRIO,
- "etSocketServer",
- readThreadFunc,
- &self->connections[slot]);
- }
-
- /* TODO: if maxConnections is reached this thread terminates.
- * Should we wait until a connection is closed and accept again?
- */
-
- PRINT_DEBUG("server: exiting listener thread\n")
-
- /* exiting: see http://msdn.microsoft.com/en-us/library/windows/desktop/ms682659%28v=vs.85%29.aspx */
-}
-
-etSocketError etInitSockets() {
- WSADATA wsaData;
-
- PRINT_DEBUG("sockets: init\n")
- if (( WSAStartup(0x202, &wsaData)) != 0) {
- WSACleanup();
- return ETSOCKET_ERROR;
- }
- return ETSOCKET_OK;
-}
-
-etSocketError etCleanupSockets() {
- PRINT_DEBUG("sockets: clean-up\n")
- WSACleanup();
- return ETSOCKET_OK;
-}
-
-etSocketServerData* etCreateSocketServerData() {
- etSocketServerDataImpl* data = malloc(sizeof(etSocketServerDataImpl));
- memset(data, 0, sizeof(etSocketServerDataImpl));
- return &data->data;
-}
-
-void etFreeSocketServerData(etSocketServerData* data) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
- free(self);
-}
-
-etSocketError etStartListening(etSocketServerData* data, short port) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
- struct sockaddr_in local;
- int i;
-
- if (self==NULL)
- return ETSOCKET_ERROR;
-
- if (self->data.maxConnections>MAX_CONNECTIONS)
- return ETSOCKET_ERROR;
-
- /* mark all connections unused and set receiver and buffer provider */
- for (i=0; i<MAX_CONNECTIONS; ++i) {
- self->connections[i].socket = INVALID_SOCKET;
- self->connections[i].data.receiver = self->data.receiver;
- self->connections[i].data.bufferProvider = self->data.bufferProvider;
- self->connections[i].data.userData = self->data.userData;
- }
- self->nConnections = 0;
-
- local.sin_family = AF_INET;
- local.sin_addr.s_addr = INADDR_ANY;
-
- local.sin_port = htons(port);
-
- self->socket = socket(AF_INET, SOCK_STREAM, 0);
- if (self->socket == INVALID_SOCKET)
- return ETSOCKET_ERROR;
-
- if (bind(self->socket, (struct sockaddr*) &local, sizeof(local)) == SOCKET_ERROR)
- return ETSOCKET_ERROR;
-
- PRINT_DEBUG("server: starting listener thread\n")
- etThread_construct(
- &self->listenerThread,
- STACK_SIZE,
- PRIO,
- "etSocketServer",
- listenerThreadFunc,
- self);
-
- return ETSOCKET_OK;
-}
-
-etSocketError etStopSocketServer(etSocketServerData* data) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
- PRINT_DEBUG("server: stop\n")
- closesocket(self->socket);
- return ETSOCKET_OK;
-}
-
-etSocketError etWriteServerSocket(etSocketServerData* dat, int connection, int size, const int8* data) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) dat;
- int offset = 0;
-
- if (connection<0 || connection>MAX_CONNECTIONS || self->connections[connection].socket==INVALID_SOCKET)
- return ETSOCKET_ERROR;
-
- /* Note: loop required because:
- * If no error occurs, send returns the total number of bytes sent, which can be less than the number
- * requested to be sent in the len parameter.
- * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740149%28v=vs.85%29.aspx
- */
-
- while (size>0) {
- int sent = send(self->connections[connection].socket, ((int8*)data)+offset, size, 0);
- if (sent<=0)
- return ETSOCKET_ERROR;
-
- offset += sent;
- size -= sent;
- }
-
- return ETSOCKET_OK;
-}
-
-etSocketError etCloseServerSocket(etSocketServerData* data, int connection) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
-
- if (self->connections[connection].socket!=INVALID_SOCKET) {
- PRINT_DEBUG("server: close connection\n")
- closesocket(self->connections[connection].socket);
- self->connections[connection].socket = INVALID_SOCKET;
- }
-
- return ETSOCKET_OK;
-}
-
-etSocketError etCloseAllServerSockets(etSocketServerData* data) {
- etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
- int i;
-
- PRINT_DEBUG("server: close all connections\n")
- for (i=0; i<MAX_CONNECTIONS; ++i) {
- if (self->connections[i].socket!=INVALID_SOCKET) {
- closesocket(self->connections[i].socket);
- self->connections[i].socket = INVALID_SOCKET;
- }
- }
-
- return ETSOCKET_OK;
-}
-
-etSocketConnectionData* etCreateSocketConnectionData() {
- etSocketConnectionDataImpl* data = malloc(sizeof(etSocketConnectionDataImpl));
- memset(data, 0, sizeof(etSocketConnectionDataImpl));
- return &data->data;
-}
-
-void etFreeSocketConnectionData(etSocketConnectionData* data) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
- free(self);
-}
-
-etSocketError etConnectServer(etSocketConnectionData* data, const char* addr, short port) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
- struct hostent *host;
-
- if (addr==NULL)
- addr = LOCAL_HOST;
-
- if (isalpha(addr[0])) {
- host = gethostbyname(addr);
- }
- else {
- unsigned long a = inet_addr(addr);
- host = gethostbyaddr((char *)&a, 4, AF_INET);
- }
-
- if (host == NULL )
- return ETSOCKET_ERROR;
-
- memset(&self->address, 0, sizeof(self->address));
- memcpy(&(self->address.sin_addr), host->h_addr, host->h_length);
- self->address.sin_family = host->h_addrtype;
- self->address.sin_port = htons(port);
-
- self->socket = socket(AF_INET, SOCK_STREAM, 0);
- if (self->socket==INVALID_SOCKET)
- return ETSOCKET_ERROR;
-
- PRINT_DEBUG("client: connecting\n")
- if (connect(self->socket, (struct sockaddr*)&(self->address), sizeof(self->address)) == SOCKET_ERROR)
- return ETSOCKET_ERROR;
-
- PRINT_DEBUG("client: connected\n")
- PRINT_DEBUG("client: starting read thread\n")
- etThread_construct(
- &self->readThread,
- STACK_SIZE,
- PRIO,
- "etSocketConnection",
- readThreadFunc,
- self);
-
- return ETSOCKET_OK;
-}
-
-etSocketError etWriteSocket(etSocketConnectionData* dat, int size, const int8* data) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) dat;
- int offset = 0;
-
- while (size>0) {
- int sent = send(self->socket, ((int8*)data)+offset, size, 0);
- if (sent<=0)
- return ETSOCKET_ERROR;
-
- offset += sent;
- size -= sent;
- }
-
- return ETSOCKET_OK;
-}
-
-etSocketError etCloseSocket(etSocketConnectionData* data) {
- etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
-
- closesocket(self->socket);
-
- return ETSOCKET_OK;
-}
-
+/*******************************************************************************
+ * Copyright (c) 2013 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)
+ *
+ *******************************************************************************/
+
+#include "osal/etTcpSockets.h"
+#include <winsock2.h>
+#include <ctype.h>
+#include "osal/etThread.h"
+
+#define STACK_SIZE 0 /* let system select default size */
+#define PRIO THREAD_PRIORITY_NORMAL
+#define LOCAL_HOST "127.0.0.1"
+
+#define PRINT_DEBUG(x) { printf(x); fflush(stdout); }
+
+/* implementation versions of data */
+
+typedef struct etSocketConnectionDataImpl {
+ /* public part */
+ etSocketConnectionData data;
+
+ /* implementation specific */
+ SOCKET socket;
+ int channel;
+ struct sockaddr_in address;
+ etThread readThread;
+}
+etSocketConnectionDataImpl;
+
+typedef struct etSocketServerDataImpl {
+ /* public part */
+ etSocketServerData data;
+
+ /* implementation specific */
+ SOCKET socket;
+ etThread listenerThread;
+ int nConnections;
+ etSocketConnectionDataImpl connections[MAX_CONNECTIONS];
+}
+etSocketServerDataImpl;
+
+/* thread function reading from the socket */
+static void readThreadFunc(void* threadData) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) threadData;
+ int len, retval;
+ int8* buffer = (self->data.bufferProvider)(self->data.userData, &len);
+
+ while (TRUE) {
+ retval = recv(self->socket, buffer, len, 0);
+ if (retval<=0) {
+ /* TODO: call WSAGetLastError and do error handling
+ int err = WSAGetLastError();
+ */
+ PRINT_DEBUG("connection thread: socket lost, exiting\n")
+ self->socket = INVALID_SOCKET;
+ return;
+ }
+
+ (self->data.receiver)(self->data.userData, self->channel, retval, buffer);
+ }
+}
+
+/* thread function listening to the socket and creating new listener threads for accepted connections */
+static void listenerThreadFunc(void* threadData) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) threadData;
+
+ PRINT_DEBUG("server: listening\n")
+ if (listen(self->socket, self->data.maxConnections) == SOCKET_ERROR) {
+ PRINT_DEBUG("server: error\n")
+ return;
+ }
+
+ while (self->data.maxConnections > self->nConnections) {
+ int slot;
+ int len;
+
+ /* find next free slot */
+ for (slot=0; slot<MAX_CONNECTIONS; ++slot)
+ if (self->connections[slot].socket==INVALID_SOCKET)
+ break;
+
+ PRINT_DEBUG("server: accepting\n")
+ len = sizeof(self->connections[slot].address);
+ self->connections[slot].socket = accept(
+ self->socket,
+ (struct sockaddr*) &self->connections[slot].address,
+ &len);
+
+ if (self->connections[slot].socket == INVALID_SOCKET) {
+ /* TODO: error handling */
+ PRINT_DEBUG("server: accept interrupted, exiting\n")
+ return;
+ }
+
+ PRINT_DEBUG("server: accepted new client, starting read thread\n")
+ self->connections[slot].channel = self->nConnections++;
+
+ etThread_construct(
+ &self->connections[slot].readThread,
+ STACK_SIZE,
+ PRIO,
+ "etSocketServer",
+ readThreadFunc,
+ &self->connections[slot]);
+ }
+
+ /* TODO: if maxConnections is reached this thread terminates.
+ * Should we wait until a connection is closed and accept again?
+ */
+
+ PRINT_DEBUG("server: exiting listener thread\n")
+
+ /* exiting: see http://msdn.microsoft.com/en-us/library/windows/desktop/ms682659%28v=vs.85%29.aspx */
+}
+
+etSocketError etInitSockets() {
+ WSADATA wsaData;
+
+ PRINT_DEBUG("sockets: init\n")
+ if (( WSAStartup(0x202, &wsaData)) != 0) {
+ WSACleanup();
+ return ETSOCKET_ERROR;
+ }
+ return ETSOCKET_OK;
+}
+
+etSocketError etCleanupSockets() {
+ PRINT_DEBUG("sockets: clean-up\n")
+ WSACleanup();
+ return ETSOCKET_OK;
+}
+
+etSocketServerData* etCreateSocketServerData() {
+ etSocketServerDataImpl* data = malloc(sizeof(etSocketServerDataImpl));
+ memset(data, 0, sizeof(etSocketServerDataImpl));
+ return &data->data;
+}
+
+void etFreeSocketServerData(etSocketServerData* data) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+ free(self);
+}
+
+etSocketError etStartListening(etSocketServerData* data, short port) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+ struct sockaddr_in local;
+ int i;
+
+ if (self==NULL)
+ return ETSOCKET_ERROR;
+
+ if (self->data.maxConnections>MAX_CONNECTIONS)
+ return ETSOCKET_ERROR;
+
+ /* mark all connections unused and set receiver and buffer provider */
+ for (i=0; i<MAX_CONNECTIONS; ++i) {
+ self->connections[i].socket = INVALID_SOCKET;
+ self->connections[i].data.receiver = self->data.receiver;
+ self->connections[i].data.bufferProvider = self->data.bufferProvider;
+ self->connections[i].data.userData = self->data.userData;
+ }
+ self->nConnections = 0;
+
+ local.sin_family = AF_INET;
+ local.sin_addr.s_addr = INADDR_ANY;
+
+ local.sin_port = htons(port);
+
+ self->socket = socket(AF_INET, SOCK_STREAM, 0);
+ if (self->socket == INVALID_SOCKET)
+ return ETSOCKET_ERROR;
+
+ if (bind(self->socket, (struct sockaddr*) &local, sizeof(local)) == SOCKET_ERROR)
+ return ETSOCKET_ERROR;
+
+ PRINT_DEBUG("server: starting listener thread\n")
+ etThread_construct(
+ &self->listenerThread,
+ STACK_SIZE,
+ PRIO,
+ "etSocketServer",
+ listenerThreadFunc,
+ self);
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etStopSocketServer(etSocketServerData* data) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+ PRINT_DEBUG("server: stop\n")
+ closesocket(self->socket);
+ return ETSOCKET_OK;
+}
+
+etSocketError etWriteServerSocket(etSocketServerData* dat, int connection, int size, const int8* data) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) dat;
+ int offset = 0;
+
+ if (connection<0 || connection>MAX_CONNECTIONS || self->connections[connection].socket==INVALID_SOCKET)
+ return ETSOCKET_ERROR;
+
+ /* Note: loop required because:
+ * If no error occurs, send returns the total number of bytes sent, which can be less than the number
+ * requested to be sent in the len parameter.
+ * http://msdn.microsoft.com/en-us/library/windows/desktop/ms740149%28v=vs.85%29.aspx
+ */
+
+ while (size>0) {
+ int sent = send(self->connections[connection].socket, ((int8*)data)+offset, size, 0);
+ if (sent<=0)
+ return ETSOCKET_ERROR;
+
+ offset += sent;
+ size -= sent;
+ }
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etCloseServerSocket(etSocketServerData* data, int connection) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+
+ if (self->connections[connection].socket!=INVALID_SOCKET) {
+ PRINT_DEBUG("server: close connection\n")
+ closesocket(self->connections[connection].socket);
+ self->connections[connection].socket = INVALID_SOCKET;
+ }
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etCloseAllServerSockets(etSocketServerData* data) {
+ etSocketServerDataImpl* self = (etSocketServerDataImpl*) data;
+ int i;
+
+ PRINT_DEBUG("server: close all connections\n")
+ for (i=0; i<MAX_CONNECTIONS; ++i) {
+ if (self->connections[i].socket!=INVALID_SOCKET) {
+ closesocket(self->connections[i].socket);
+ self->connections[i].socket = INVALID_SOCKET;
+ }
+ }
+
+ return ETSOCKET_OK;
+}
+
+etSocketConnectionData* etCreateSocketConnectionData() {
+ etSocketConnectionDataImpl* data = malloc(sizeof(etSocketConnectionDataImpl));
+ memset(data, 0, sizeof(etSocketConnectionDataImpl));
+ return &data->data;
+}
+
+void etFreeSocketConnectionData(etSocketConnectionData* data) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
+ free(self);
+}
+
+etSocketError etConnectServer(etSocketConnectionData* data, const char* addr, short port) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
+ struct hostent *host;
+
+ if (addr==NULL)
+ addr = LOCAL_HOST;
+
+ if (isalpha(addr[0])) {
+ host = gethostbyname(addr);
+ }
+ else {
+ unsigned long a = inet_addr(addr);
+ host = gethostbyaddr((char *)&a, 4, AF_INET);
+ }
+
+ if (host == NULL )
+ return ETSOCKET_ERROR;
+
+ memset(&self->address, 0, sizeof(self->address));
+ memcpy(&(self->address.sin_addr), host->h_addr, host->h_length);
+ self->address.sin_family = host->h_addrtype;
+ self->address.sin_port = htons(port);
+
+ self->socket = socket(AF_INET, SOCK_STREAM, 0);
+ if (self->socket==INVALID_SOCKET)
+ return ETSOCKET_ERROR;
+
+ PRINT_DEBUG("client: connecting\n")
+ if (connect(self->socket, (struct sockaddr*)&(self->address), sizeof(self->address)) == SOCKET_ERROR)
+ return ETSOCKET_ERROR;
+
+ PRINT_DEBUG("client: connected\n")
+ PRINT_DEBUG("client: starting read thread\n")
+ etThread_construct(
+ &self->readThread,
+ STACK_SIZE,
+ PRIO,
+ "etSocketConnection",
+ readThreadFunc,
+ self);
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etWriteSocket(etSocketConnectionData* dat, int size, const int8* data) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) dat;
+ int offset = 0;
+
+ while (size>0) {
+ int sent = send(self->socket, ((int8*)data)+offset, size, 0);
+ if (sent<=0)
+ return ETSOCKET_ERROR;
+
+ offset += sent;
+ size -= sent;
+ }
+
+ return ETSOCKET_OK;
+}
+
+etSocketError etCloseSocket(etSocketConnectionData* data) {
+ etSocketConnectionDataImpl* self = (etSocketConnectionDataImpl*) data;
+
+ closesocket(self->socket);
+
+ return ETSOCKET_OK;
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etDatatypes.h
index a831f66ff..aa948e6b4 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etDatatypes.h
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETDATATYPES_H_
-#define _ETDATATYPES_H_
-
-/*
- * typedefs for platform specific datatypes
- * Version for TI MSP 430
- *
- * */
-
-#include <stdio.h>
-
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned long uint32;
-/* typedef unsigned long long uint64; */ /* not available on this platform */
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef long int32;
-/* typedef long long int64; */ /* not available on this platform */
-
-
-/* float datatypes */
-typedef float float32;
-/* typedef double float64; */ /* not available on this platform */
-
-/* boolean datatypes and values */
-typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
-typedef bool boolean;
-#ifndef TRUE
- #define TRUE 1
-#endif
-#ifndef FALSE
- #define FALSE 0
-#endif
-
-/*
- * typedefs for eTrice Runtime and Testing
- *
- * */
-
-typedef int8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
-
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
-
-typedef bool etBool;
-
-typedef float32 etFloat32;
-
-typedef FILE* etFileHandle;
-
-typedef int8 etAddressId;
-
-#endif /* _DATATYPES_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
+
+/*
+ * typedefs for platform specific datatypes
+ * Version for TI MSP 430
+ *
+ * */
+
+#include <stdio.h>
+
+/* unsigned integer datatypes */
+typedef unsigned char uint8;
+typedef unsigned short int uint16;
+typedef unsigned long uint32;
+/* typedef unsigned long long uint64; */ /* not available on this platform */
+
+/* signed integer datatypes */
+typedef char int8;
+typedef short int int16;
+typedef long int32;
+/* typedef long long int64; */ /* not available on this platform */
+
+
+/* float datatypes */
+typedef float float32;
+/* typedef double float64; */ /* not available on this platform */
+
+/* boolean datatypes and values */
+typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
+typedef bool boolean;
+#ifndef TRUE
+ #define TRUE 1
+#endif
+#ifndef FALSE
+ #define FALSE 0
+#endif
+
+/*
+ * typedefs for eTrice Runtime and Testing
+ *
+ * */
+
+typedef int8 etInt8;
+typedef int16 etInt16;
+typedef int32 etInt32;
+
+typedef uint8 etUInt8;
+typedef uint16 etUInt16;
+typedef uint32 etUInt32;
+
+typedef bool etBool;
+
+typedef float32 etFloat32;
+
+typedef FILE* etFileHandle;
+
+typedef int8 etAddressId;
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etLogger.c
index d43a953ba..9b20f31a3 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etLogger.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etLogger.c
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-/*
- * etLogger.c
- *
- * Created on: 16.01.2012
- * Author: tschuetz
- */
-
-
-#include "debugging/etLogger.h"
-
-#include <stdarg.h>
-
-
-void etLogger_logError(const char* message){
- printf("ERROR: %s\n", message);
-}
-
-void etLogger_logWarning(const char* message){
- printf("WARNING: %s\n", message);
-}
-
-void etLogger_logInfo(const char* message){
- printf("INFO: %s\n", message);
-}
-
-void etLogger_logErrorF(const char* format, ... ){
- printf("ERROR: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-void etLogger_logWarningF(const char* format, ... ){
- printf("WARNING: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-void etLogger_logInfoF(const char* format, ... ){
- printf("INFO: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-etFileHandle etLogger_fopen(const char* filename, const char* mode){
- return( fopen(filename, mode) );
-}
-
-int etLogger_fclose(etFileHandle file){
- return( fclose(file) );
-}
-
-void etLogger_fprintf(etFileHandle file, const char* format, ... ){
- va_list arglist;
- va_start( arglist, format );
- vfprintf(file, format, arglist );
- va_end( arglist );
-}
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+/*
+ * etLogger.c
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+
+#include "debugging/etLogger.h"
+
+#include <stdarg.h>
+
+
+void etLogger_logError(const char* message){
+ printf("ERROR: %s\n", message);
+}
+
+void etLogger_logWarning(const char* message){
+ printf("WARNING: %s\n", message);
+}
+
+void etLogger_logInfo(const char* message){
+ printf("INFO: %s\n", message);
+}
+
+void etLogger_logErrorF(const char* format, ... ){
+ printf("ERROR: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+void etLogger_logWarningF(const char* format, ... ){
+ printf("WARNING: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+void etLogger_logInfoF(const char* format, ... ){
+ printf("INFO: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode){
+ return( fopen(filename, mode) );
+}
+
+int etLogger_fclose(etFileHandle file){
+ return( fclose(file) );
+}
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... ){
+ va_list arglist;
+ va_start( arglist, format );
+ vfprintf(file, format, arglist );
+ va_end( arglist );
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etPlatform.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etPlatform.c
index 1650cd8a4..dae8dc840 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etPlatform.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etPlatform.c
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "msp430f5438a.h"
-#include "hal_MSP-EXP430F5438.h"
-#include "platform/etTimer.h"
-
-
-/* forward declarations */
-static void prvSetupHardware(void);
-void initIO(void);
-
-
-/* implemenatation for eTrice interfaces*/
-
-void etUserEntry(void){
- prvSetupHardware();
- etTimer_init();
-}
-
-void etUserPreRun(void){
- _enable_interrupt();
-}
-
-void etUserPostRun(void){ }
-void etUserExit(void){ }
-
-
-/* platform specific functions */
-
-static void prvSetupHardware(void) {
- /* Convert a Hz value to a KHz value, as required by the Init_FLL_Settle()
- function. */
- unsigned long ulCPU_Clock_KHz = (25000000UL / 1000UL );
-
- /* Disable the watchdog. */
- WDTCTL = WDTPW + 0x36;
- SFRIE1 |= WDTIE;
-
- /* select port pin functions */
- halBoardInit();
-
- P1DIR |= 0x03;
- P2DIR &= ~0xC0;
- P2REN |= 0xC0;
- P2OUT |= 0xC0;
-
- LFXT_Start(XT1DRIVE_0); /* enable oszillator */
- Init_FLL_Settle((unsigned short) ulCPU_Clock_KHz, 488); /* clock divisor */
-
-
-}
-
-unsigned char getButtonStatus(unsigned int id){
- switch (id){
- case 1:return P2IN & 0x80;
- break;
- case 2:return P2IN & 0x40;
- break;
- default: return 0xFF;
- };
-}
-
-void setLedPin (unsigned int id, unsigned int onOff){
- switch (id){
- case 1:
- if (onOff){
- P1OUT |= 0x01;
- }else{
- P1OUT &= ~0x01;
- }
- break;
- case 2:
- if (onOff){
- P1OUT |= 0x02;
- }else{
- P1OUT &= ~0x02;
- }
- break;
- default:
- }
-}
-
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "msp430f5438a.h"
+#include "hal_MSP-EXP430F5438.h"
+#include "platform/etTimer.h"
+
+
+/* forward declarations */
+static void prvSetupHardware(void);
+void initIO(void);
+
+
+/* implemenatation for eTrice interfaces*/
+
+void etUserEntry(void){
+ prvSetupHardware();
+ etTimer_init();
+}
+
+void etUserPreRun(void){
+ _enable_interrupt();
+}
+
+void etUserPostRun(void){ }
+void etUserExit(void){ }
+
+
+/* platform specific functions */
+
+static void prvSetupHardware(void) {
+ /* Convert a Hz value to a KHz value, as required by the Init_FLL_Settle()
+ function. */
+ unsigned long ulCPU_Clock_KHz = (25000000UL / 1000UL );
+
+ /* Disable the watchdog. */
+ WDTCTL = WDTPW + 0x36;
+ SFRIE1 |= WDTIE;
+
+ /* select port pin functions */
+ halBoardInit();
+
+ P1DIR |= 0x03;
+ P2DIR &= ~0xC0;
+ P2REN |= 0xC0;
+ P2OUT |= 0xC0;
+
+ LFXT_Start(XT1DRIVE_0); /* enable oszillator */
+ Init_FLL_Settle((unsigned short) ulCPU_Clock_KHz, 488); /* clock divisor */
+
+
+}
+
+unsigned char getButtonStatus(unsigned int id){
+ switch (id){
+ case 1:return P2IN & 0x80;
+ break;
+ case 2:return P2IN & 0x40;
+ break;
+ default: return 0xFF;
+ };
+}
+
+void setLedPin (unsigned int id, unsigned int onOff){
+ switch (id){
+ case 1:
+ if (onOff){
+ P1OUT |= 0x01;
+ }else{
+ P1OUT &= ~0x01;
+ }
+ break;
+ case 2:
+ if (onOff){
+ P1OUT |= 0x02;
+ }else{
+ P1OUT &= ~0x02;
+ }
+ break;
+ default:
+ }
+}
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etTimer.c
index cdffb9636..60e983c46 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etTimer.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/etTimer.c
@@ -1,110 +1,110 @@
-#include "platform/etTimer.h"
-
-#include "hal_MSP-EXP430F5438.h"
-
-/* global timer */
-
-static etTargetTime_t targetTime;
-static etTargetTime_t lastTargetTime;
-static volatile etBool etTimer_executeFlag = FALSE;
-
-void etTimer_init(void){
- targetTime.nSec=0;
- targetTime.sec=0;
- lastTargetTime.nSec=0;
- lastTargetTime.sec=0;
-}
-
-etBool etTimer_executeNeeded(void){
- if (etTimer_executeFlag == TRUE){
- etTimer_executeFlag = FALSE;
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-int isTimeGreaterThanActualTime(const etTargetTime_t *t) {
-
- _disable_interrupt();
- if (t->sec > targetTime.sec) {
- _enable_interrupt();
- return 1;
- }
-
- if (t->sec < targetTime.sec) {
- _enable_interrupt();
- return 0;
- }
-
- if (t->nSec > targetTime.nSec) {
- _enable_interrupt();
- return 1;
- }
- else {
- _enable_interrupt();
- return 0;
- }
-}
-
-uint32 getNSecFromTarget(void){
- etTargetTime_t time;
- getTimeFromTarget(&time);
- return time.nSec;
-}
-
-uint32 getSecFromTarget(void){
- etTargetTime_t time;
- getTimeFromTarget(&time);
- return time.sec;
-}
-
-
-void getTimeFromTarget(etTargetTime_t *t) {
- _disable_interrupt();
- *t = targetTime;
- _enable_interrupt();
-}
-
-#define ET_TIMER_TIME_BASE_NS 15625000L
-#define ET_TIMER_TIME_BASE_US ET_TIMER_TIME_BASE_NS / 1000L
-#define ET_TIMER_TIME_BASE_MS ET_TIMER_TIME_BASE_US / 1000L
-
-uint32 getTimeBaseNS(void){
- return ET_TIMER_TIME_BASE_NS;
-}
-
-uint32 getTimeBaseUS(void){
- return ET_TIMER_TIME_BASE_US;
-}
-
-uint32 getTimeBaseMS(void){
- return ET_TIMER_TIME_BASE_MS;
-}
-
-
-/* the timer interrupt */
-#pragma INTERRUPT(wdt_isr)
-
-#pragma vector=WDT_VECTOR
-
-void wdt_isr(void) {
-// this interrupt will be called every 15,625ms
-
- static unsigned char secCounter = 0;
- etTimer_executeFlag = TRUE;
-
- targetTime.nSec += 15625000L;
-
- if (targetTime.nSec >= 1000000000L) {
- targetTime.nSec -= 1000000000L;
- targetTime.sec++;
- }
- secCounter++;
-
- if (secCounter >= 64) {
- secCounter = 0;
- }
-
-} // end interrupt
+#include "platform/etTimer.h"
+
+#include "hal_MSP-EXP430F5438.h"
+
+/* global timer */
+
+static etTargetTime_t targetTime;
+static etTargetTime_t lastTargetTime;
+static volatile etBool etTimer_executeFlag = FALSE;
+
+void etTimer_init(void){
+ targetTime.nSec=0;
+ targetTime.sec=0;
+ lastTargetTime.nSec=0;
+ lastTargetTime.sec=0;
+}
+
+etBool etTimer_executeNeeded(void){
+ if (etTimer_executeFlag == TRUE){
+ etTimer_executeFlag = FALSE;
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+int isTimeGreaterThanActualTime(const etTargetTime_t *t) {
+
+ _disable_interrupt();
+ if (t->sec > targetTime.sec) {
+ _enable_interrupt();
+ return 1;
+ }
+
+ if (t->sec < targetTime.sec) {
+ _enable_interrupt();
+ return 0;
+ }
+
+ if (t->nSec > targetTime.nSec) {
+ _enable_interrupt();
+ return 1;
+ }
+ else {
+ _enable_interrupt();
+ return 0;
+ }
+}
+
+uint32 getNSecFromTarget(void){
+ etTargetTime_t time;
+ getTimeFromTarget(&time);
+ return time.nSec;
+}
+
+uint32 getSecFromTarget(void){
+ etTargetTime_t time;
+ getTimeFromTarget(&time);
+ return time.sec;
+}
+
+
+void getTimeFromTarget(etTargetTime_t *t) {
+ _disable_interrupt();
+ *t = targetTime;
+ _enable_interrupt();
+}
+
+#define ET_TIMER_TIME_BASE_NS 15625000L
+#define ET_TIMER_TIME_BASE_US ET_TIMER_TIME_BASE_NS / 1000L
+#define ET_TIMER_TIME_BASE_MS ET_TIMER_TIME_BASE_US / 1000L
+
+uint32 getTimeBaseNS(void){
+ return ET_TIMER_TIME_BASE_NS;
+}
+
+uint32 getTimeBaseUS(void){
+ return ET_TIMER_TIME_BASE_US;
+}
+
+uint32 getTimeBaseMS(void){
+ return ET_TIMER_TIME_BASE_MS;
+}
+
+
+/* the timer interrupt */
+#pragma INTERRUPT(wdt_isr)
+
+#pragma vector=WDT_VECTOR
+
+void wdt_isr(void) {
+// this interrupt will be called every 15,625ms
+
+ static unsigned char secCounter = 0;
+ etTimer_executeFlag = TRUE;
+
+ targetTime.nSec += 15625000L;
+
+ if (targetTime.nSec >= 1000000000L) {
+ targetTime.nSec -= 1000000000L;
+ targetTime.sec++;
+ }
+ secCounter++;
+
+ if (secCounter >= 64) {
+ secCounter = 0;
+ }
+
+} // end interrupt
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/info.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/info.txt
index 71c5f9f3f..b8f84e38c 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/info.txt
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_EXP430F5438/info.txt
@@ -1 +1 @@
-TI-MSP430
+TI-MSP430
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etDatatypes.h
index a831f66ff..aa948e6b4 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etDatatypes.h
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETDATATYPES_H_
-#define _ETDATATYPES_H_
-
-/*
- * typedefs for platform specific datatypes
- * Version for TI MSP 430
- *
- * */
-
-#include <stdio.h>
-
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned long uint32;
-/* typedef unsigned long long uint64; */ /* not available on this platform */
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef long int32;
-/* typedef long long int64; */ /* not available on this platform */
-
-
-/* float datatypes */
-typedef float float32;
-/* typedef double float64; */ /* not available on this platform */
-
-/* boolean datatypes and values */
-typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
-typedef bool boolean;
-#ifndef TRUE
- #define TRUE 1
-#endif
-#ifndef FALSE
- #define FALSE 0
-#endif
-
-/*
- * typedefs for eTrice Runtime and Testing
- *
- * */
-
-typedef int8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
-
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
-
-typedef bool etBool;
-
-typedef float32 etFloat32;
-
-typedef FILE* etFileHandle;
-
-typedef int8 etAddressId;
-
-#endif /* _DATATYPES_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
+
+/*
+ * typedefs for platform specific datatypes
+ * Version for TI MSP 430
+ *
+ * */
+
+#include <stdio.h>
+
+/* unsigned integer datatypes */
+typedef unsigned char uint8;
+typedef unsigned short int uint16;
+typedef unsigned long uint32;
+/* typedef unsigned long long uint64; */ /* not available on this platform */
+
+/* signed integer datatypes */
+typedef char int8;
+typedef short int int16;
+typedef long int32;
+/* typedef long long int64; */ /* not available on this platform */
+
+
+/* float datatypes */
+typedef float float32;
+/* typedef double float64; */ /* not available on this platform */
+
+/* boolean datatypes and values */
+typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
+typedef bool boolean;
+#ifndef TRUE
+ #define TRUE 1
+#endif
+#ifndef FALSE
+ #define FALSE 0
+#endif
+
+/*
+ * typedefs for eTrice Runtime and Testing
+ *
+ * */
+
+typedef int8 etInt8;
+typedef int16 etInt16;
+typedef int32 etInt32;
+
+typedef uint8 etUInt8;
+typedef uint16 etUInt16;
+typedef uint32 etUInt32;
+
+typedef bool etBool;
+
+typedef float32 etFloat32;
+
+typedef FILE* etFileHandle;
+
+typedef int8 etAddressId;
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etLogger.c
index d43a953ba..9b20f31a3 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etLogger.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etLogger.c
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-/*
- * etLogger.c
- *
- * Created on: 16.01.2012
- * Author: tschuetz
- */
-
-
-#include "debugging/etLogger.h"
-
-#include <stdarg.h>
-
-
-void etLogger_logError(const char* message){
- printf("ERROR: %s\n", message);
-}
-
-void etLogger_logWarning(const char* message){
- printf("WARNING: %s\n", message);
-}
-
-void etLogger_logInfo(const char* message){
- printf("INFO: %s\n", message);
-}
-
-void etLogger_logErrorF(const char* format, ... ){
- printf("ERROR: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-void etLogger_logWarningF(const char* format, ... ){
- printf("WARNING: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-void etLogger_logInfoF(const char* format, ... ){
- printf("INFO: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-}
-
-etFileHandle etLogger_fopen(const char* filename, const char* mode){
- return( fopen(filename, mode) );
-}
-
-int etLogger_fclose(etFileHandle file){
- return( fclose(file) );
-}
-
-void etLogger_fprintf(etFileHandle file, const char* format, ... ){
- va_list arglist;
- va_start( arglist, format );
- vfprintf(file, format, arglist );
- va_end( arglist );
-}
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+/*
+ * etLogger.c
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+
+#include "debugging/etLogger.h"
+
+#include <stdarg.h>
+
+
+void etLogger_logError(const char* message){
+ printf("ERROR: %s\n", message);
+}
+
+void etLogger_logWarning(const char* message){
+ printf("WARNING: %s\n", message);
+}
+
+void etLogger_logInfo(const char* message){
+ printf("INFO: %s\n", message);
+}
+
+void etLogger_logErrorF(const char* format, ... ){
+ printf("ERROR: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+void etLogger_logWarningF(const char* format, ... ){
+ printf("WARNING: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+void etLogger_logInfoF(const char* format, ... ){
+ printf("INFO: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+}
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode){
+ return( fopen(filename, mode) );
+}
+
+int etLogger_fclose(etFileHandle file){
+ return( fclose(file) );
+}
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... ){
+ va_list arglist;
+ va_start( arglist, format );
+ vfprintf(file, format, arglist );
+ va_end( arglist );
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.c
index accb2587d..9c2f2c586 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.c
@@ -1,291 +1,291 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "msp430f5438a.h"
-#include "platform/etTimer.h"
-#include "hal_pmm.h"
-#include "etPlatform.h"
-
-void enableLatchOutput(void);
-void initClockSystem(void);
-void initPortsForElevator(void);
-void setData(unsigned char data);
-void allLedsOff(void);
-void genLatchClock(unsigned int mask);
-unsigned char getFloorButtons(unsigned char floor);
-void initMotor(void);
-void initHw(void);
-void enableInterrupt(void);
-
-
-const unsigned char _7seg[15]={~0x3F,~0x06,~0x5B,~0x4F,~0x66,~0x6D,~0x7D,~0x07,~0x7F,~0x6F, ~0xBF,~0x86,~0xDB,~0xCF,~0xE6};
-const unsigned int latchClockFloorLowPattern[6]={0x0410,0x0440,0x0801,0x0804,0x0810,0x0840};
-const unsigned int latchClockFloorHighPattern[6]={0x0420,0x0480,0x0802,0x0808,0x0820,0x880};
-const unsigned int latchClockMotorPattern[12]={0x0201,0x0202,0x0204,0x0208,0x0210,0x0220,0x0240,0x0280,0x0401,0x0402,0x0404,0x0408};
-
-
-const unsigned int doorPattern1[12]={0x0000,0x0201,0x0303,0x0387,0x03CF,0x03FF,0x03FF,0x03CF,0x0387,0x0303,0x0201,0x0000};
-const unsigned int doorPattern2[12]={0x0000,0x0030,0x0078,0x00FC,0x01FE,0x03FF,0x03FF,0x01FE,0x00FC,0x0078,0x0030,0x0000};
-const unsigned int doorPattern3[12]={0x0000,0x0200,0x0300,0x0380,0x03C0,0x03E0,0x03F0,0x03F8,0x03FC,0x03FE,0x03FF,0x03FF};
-
-
-volatile unsigned char execute;
-unsigned int floorLatchShadow[6];
-unsigned char motorLatchShadow[12];
-
-
-/* implemenatation for eTrice interfaces*/
-
-void etUserEntry(void){
- initHw();
- etTimer_init();
-}
-
-void etUserPreRun(void){
- enableInterrupt();
-}
-
-void etUserPostRun(void){ }
-void etUserExit(void){ }
-
-
-/* platform specific functions */
-
-
-
-/*****************************************************/
-
-
-void initHw(void) {
-volatile unsigned int i=0;
-volatile unsigned char j,m;
-
- WDTCTL = WDTPW + 0x36; //WDT as Timer;
-
- SetVCore(PMMCOREV_3);
- initClockSystem();
-
- initPortsForElevator();
- allLedsOff();
- enableLatchOutput();
- initMotor();
-}
-
-void enableInterrupt(void){
- SFRIE1|=WDTIE;
- _enable_interrupt();
-}
-void initPortsForElevator(void){
- P2DIR |= 0x02;
- P2OUT &= ~0x02;
-
- P4OUT = 0x00;
- P4DIR = 0xFF;
-
- P3OUT = 0xC0;
- P3DIR = 0xFF;
-
- P8OUT = 0x00;
- P8DIR = 0x00;
- P8REN = 0xE0;
-}
-
-void toggleTestLed(void){
- P2OUT ^= 0x02;
-}
-void enableLatchOutput(void){
- P3OUT &= ~0x80;
-}
-
-void setData(unsigned char data){
- P4OUT = data;
- P3OUT &= ~0x01;
- P3OUT |= 0x01;
-}
-
-void allLedsOff(void){
-unsigned int i;
- P3OUT &= ~0x40;
- setData(0xFF);
- P4OUT &= ~0xFF;
- P3OUT &= ~0x1E;
- P3OUT |= 0x1E;
- P4OUT |= 0xFF;
- P3OUT &= ~0x1E;
- P3OUT |= 0x1E;
- for(i=0;i<6;i++){
- floorLatchShadow[i]=0;
- }
-}
-
-void writeTo7Seg(unsigned char data){
- if (data<=9){
- setData(_7seg[data]);
- genLatchClock(0x1001);
- }
-}
-
-void genLatchClock(unsigned int mask){
-unsigned char dataLow, dataHigh;
- dataLow=mask & 0xFF;
- dataHigh=((mask >> 8) & 0xFF);
- P4OUT = ~dataLow;
- P3OUT &= ~dataHigh;
- P3OUT |= dataHigh;
- P4OUT = 0xFF;
- P3OUT &= ~dataHigh;
- P3OUT |= dataHigh;
-}
-
-void updateFloorLatch(floor){
-unsigned char dataLow, dataHigh;
-
- dataLow=(unsigned char)(floorLatchShadow[floor]);
- dataHigh=(unsigned char) (floorLatchShadow[floor]>>8);
-
- setData(~dataLow);
- genLatchClock(latchClockFloorLowPattern[floor]);
-
- setData(~dataHigh);
- genLatchClock(latchClockFloorHighPattern[floor]);
-}
-
-void updateMotorLatch(void){
-unsigned char i;
- for(i=0;i<12;i++){
- setData(~motorLatchShadow[i]);
- genLatchClock(latchClockMotorPattern[i]);
- }
-}
-
-unsigned char getMotorPosition(void){
-
- if (motorLatchShadow[10]==0x3C) return 0x80;
- if ((motorLatchShadow[7]==0xC0)&(motorLatchShadow[8]==0x03)) return 0x81;
- if (motorLatchShadow[5]==0x78) return 0x82;
- if ((motorLatchShadow[2]==0xC0)&(motorLatchShadow[3]==0x03)) return 0x83;
- if (motorLatchShadow[0]==0x78) return 0x84;
- return 0x00;
-
-}
-
-void shiftMotorUp(void){
-unsigned char i;
- if(motorLatchShadow[0]&0x01)return;
- for(i=0;i<11;i++){
- motorLatchShadow[i]>>=1;
- if (motorLatchShadow[i+1]&0x01){motorLatchShadow[i]|=0x80;}
- }
- motorLatchShadow[11] >>=1;
- updateMotorLatch();
-}
-
-void shiftMotorDown(void){
-unsigned char i;
- if (motorLatchShadow[11]&0x02)return;
- for(i=11;i>0;i--){
- motorLatchShadow[i]<<=1;
- if (motorLatchShadow[i-1]&0x80){motorLatchShadow[i]|=0x01;}
- }
- motorLatchShadow[0] <<=1;
- updateMotorLatch();
-}
-
-void initMotor(void){
-unsigned char i;
- for(i=0;i<12;i++){
- motorLatchShadow[i]=0x00;
- }
- motorLatchShadow[11]=0x03;
- motorLatchShadow[10]=0xC0;
- updateMotorLatch();
-}
-
-void writeToButtonLed(unsigned char floor, unsigned char id, unsigned char onOff){
-unsigned int data;
- data=id;
- data<<=10;
- if (floor>5)return;
- switch (onOff){
- case ON:
- floorLatchShadow[floor] |= data;
- break;
- case OFF:
- floorLatchShadow[floor] &= ~data;
- break;
- case TOGGLE:
- floorLatchShadow[floor]^=data;
- break;
- default:break;
- };
- updateFloorLatch(floor);
-}
-
-void writeToDoor(unsigned char floor, unsigned char data){
- // clear door bits
- // avoid array out of bound access
- if (data > 11)return;
- if(floor > 5)return;
- floorLatchShadow[floor] &= ~0x03FF;
- // set door bits according data
- floorLatchShadow[floor] |= (doorPattern3[data] & 0x3FF);
- updateFloorLatch(floor);
-}
-
-unsigned char getButtonStatus(unsigned char floor, unsigned int id){
-unsigned char mask = 0x01;
-unsigned char retVal=0;
- if ((floor == 0) && (id == DOWN_BUTTON_ID)){return 0;}
- if (id == CABINE_DOOR_BUTTON_ID){floor = 0; id=DOWN_BUTTON_ID;}
- mask <<= floor;
- P8OUT = mask;
- P8DIR = mask;
- if (P8IN & id) retVal=1;
- P8DIR = 0x00;
- return retVal;
-}
-
-unsigned char getFloorButtons(unsigned char floor){
-unsigned char mask = 0x01;
- mask <<= floor;
- P8OUT = mask;
- P8DIR = mask;
- mask = P8IN & 0xE0;
- P8DIR = 0x00;
-
- return mask;
-}
-
-void initClockSystem(void){
- //Select DCO range 4..60Mhz
- UCSCTL1=DCORSEL_6;
- //enable XT1
- P7SEL|=0x01;
- UCSCTL6=0x01CC;
- // wait until Clock is ok
- while(UCSCTL7&0x0002){UCSCTL7=0;}
-
- // DCO => appr. 50Mhz
- // SMCLK MCLK => 25Mhz
- UCSCTL2 = FLLD_1 + 0x2f8;
-
- // Loop until XT1,XT2 & DCO fault flag is cleared
- do
- {
- UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
- // Clear XT2,XT1,DCO fault flags
- SFRIFG1 &= ~OFIFG; // Clear fault flags
- }while (SFRIFG1&OFIFG); // Test oscillator fault flag
-
-}
-
-
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "msp430f5438a.h"
+#include "platform/etTimer.h"
+#include "hal_pmm.h"
+#include "etPlatform.h"
+
+void enableLatchOutput(void);
+void initClockSystem(void);
+void initPortsForElevator(void);
+void setData(unsigned char data);
+void allLedsOff(void);
+void genLatchClock(unsigned int mask);
+unsigned char getFloorButtons(unsigned char floor);
+void initMotor(void);
+void initHw(void);
+void enableInterrupt(void);
+
+
+const unsigned char _7seg[15]={~0x3F,~0x06,~0x5B,~0x4F,~0x66,~0x6D,~0x7D,~0x07,~0x7F,~0x6F, ~0xBF,~0x86,~0xDB,~0xCF,~0xE6};
+const unsigned int latchClockFloorLowPattern[6]={0x0410,0x0440,0x0801,0x0804,0x0810,0x0840};
+const unsigned int latchClockFloorHighPattern[6]={0x0420,0x0480,0x0802,0x0808,0x0820,0x880};
+const unsigned int latchClockMotorPattern[12]={0x0201,0x0202,0x0204,0x0208,0x0210,0x0220,0x0240,0x0280,0x0401,0x0402,0x0404,0x0408};
+
+
+const unsigned int doorPattern1[12]={0x0000,0x0201,0x0303,0x0387,0x03CF,0x03FF,0x03FF,0x03CF,0x0387,0x0303,0x0201,0x0000};
+const unsigned int doorPattern2[12]={0x0000,0x0030,0x0078,0x00FC,0x01FE,0x03FF,0x03FF,0x01FE,0x00FC,0x0078,0x0030,0x0000};
+const unsigned int doorPattern3[12]={0x0000,0x0200,0x0300,0x0380,0x03C0,0x03E0,0x03F0,0x03F8,0x03FC,0x03FE,0x03FF,0x03FF};
+
+
+volatile unsigned char execute;
+unsigned int floorLatchShadow[6];
+unsigned char motorLatchShadow[12];
+
+
+/* implemenatation for eTrice interfaces*/
+
+void etUserEntry(void){
+ initHw();
+ etTimer_init();
+}
+
+void etUserPreRun(void){
+ enableInterrupt();
+}
+
+void etUserPostRun(void){ }
+void etUserExit(void){ }
+
+
+/* platform specific functions */
+
+
+
+/*****************************************************/
+
+
+void initHw(void) {
+volatile unsigned int i=0;
+volatile unsigned char j,m;
+
+ WDTCTL = WDTPW + 0x36; //WDT as Timer;
+
+ SetVCore(PMMCOREV_3);
+ initClockSystem();
+
+ initPortsForElevator();
+ allLedsOff();
+ enableLatchOutput();
+ initMotor();
+}
+
+void enableInterrupt(void){
+ SFRIE1|=WDTIE;
+ _enable_interrupt();
+}
+void initPortsForElevator(void){
+ P2DIR |= 0x02;
+ P2OUT &= ~0x02;
+
+ P4OUT = 0x00;
+ P4DIR = 0xFF;
+
+ P3OUT = 0xC0;
+ P3DIR = 0xFF;
+
+ P8OUT = 0x00;
+ P8DIR = 0x00;
+ P8REN = 0xE0;
+}
+
+void toggleTestLed(void){
+ P2OUT ^= 0x02;
+}
+void enableLatchOutput(void){
+ P3OUT &= ~0x80;
+}
+
+void setData(unsigned char data){
+ P4OUT = data;
+ P3OUT &= ~0x01;
+ P3OUT |= 0x01;
+}
+
+void allLedsOff(void){
+unsigned int i;
+ P3OUT &= ~0x40;
+ setData(0xFF);
+ P4OUT &= ~0xFF;
+ P3OUT &= ~0x1E;
+ P3OUT |= 0x1E;
+ P4OUT |= 0xFF;
+ P3OUT &= ~0x1E;
+ P3OUT |= 0x1E;
+ for(i=0;i<6;i++){
+ floorLatchShadow[i]=0;
+ }
+}
+
+void writeTo7Seg(unsigned char data){
+ if (data<=9){
+ setData(_7seg[data]);
+ genLatchClock(0x1001);
+ }
+}
+
+void genLatchClock(unsigned int mask){
+unsigned char dataLow, dataHigh;
+ dataLow=mask & 0xFF;
+ dataHigh=((mask >> 8) & 0xFF);
+ P4OUT = ~dataLow;
+ P3OUT &= ~dataHigh;
+ P3OUT |= dataHigh;
+ P4OUT = 0xFF;
+ P3OUT &= ~dataHigh;
+ P3OUT |= dataHigh;
+}
+
+void updateFloorLatch(floor){
+unsigned char dataLow, dataHigh;
+
+ dataLow=(unsigned char)(floorLatchShadow[floor]);
+ dataHigh=(unsigned char) (floorLatchShadow[floor]>>8);
+
+ setData(~dataLow);
+ genLatchClock(latchClockFloorLowPattern[floor]);
+
+ setData(~dataHigh);
+ genLatchClock(latchClockFloorHighPattern[floor]);
+}
+
+void updateMotorLatch(void){
+unsigned char i;
+ for(i=0;i<12;i++){
+ setData(~motorLatchShadow[i]);
+ genLatchClock(latchClockMotorPattern[i]);
+ }
+}
+
+unsigned char getMotorPosition(void){
+
+ if (motorLatchShadow[10]==0x3C) return 0x80;
+ if ((motorLatchShadow[7]==0xC0)&(motorLatchShadow[8]==0x03)) return 0x81;
+ if (motorLatchShadow[5]==0x78) return 0x82;
+ if ((motorLatchShadow[2]==0xC0)&(motorLatchShadow[3]==0x03)) return 0x83;
+ if (motorLatchShadow[0]==0x78) return 0x84;
+ return 0x00;
+
+}
+
+void shiftMotorUp(void){
+unsigned char i;
+ if(motorLatchShadow[0]&0x01)return;
+ for(i=0;i<11;i++){
+ motorLatchShadow[i]>>=1;
+ if (motorLatchShadow[i+1]&0x01){motorLatchShadow[i]|=0x80;}
+ }
+ motorLatchShadow[11] >>=1;
+ updateMotorLatch();
+}
+
+void shiftMotorDown(void){
+unsigned char i;
+ if (motorLatchShadow[11]&0x02)return;
+ for(i=11;i>0;i--){
+ motorLatchShadow[i]<<=1;
+ if (motorLatchShadow[i-1]&0x80){motorLatchShadow[i]|=0x01;}
+ }
+ motorLatchShadow[0] <<=1;
+ updateMotorLatch();
+}
+
+void initMotor(void){
+unsigned char i;
+ for(i=0;i<12;i++){
+ motorLatchShadow[i]=0x00;
+ }
+ motorLatchShadow[11]=0x03;
+ motorLatchShadow[10]=0xC0;
+ updateMotorLatch();
+}
+
+void writeToButtonLed(unsigned char floor, unsigned char id, unsigned char onOff){
+unsigned int data;
+ data=id;
+ data<<=10;
+ if (floor>5)return;
+ switch (onOff){
+ case ON:
+ floorLatchShadow[floor] |= data;
+ break;
+ case OFF:
+ floorLatchShadow[floor] &= ~data;
+ break;
+ case TOGGLE:
+ floorLatchShadow[floor]^=data;
+ break;
+ default:break;
+ };
+ updateFloorLatch(floor);
+}
+
+void writeToDoor(unsigned char floor, unsigned char data){
+ // clear door bits
+ // avoid array out of bound access
+ if (data > 11)return;
+ if(floor > 5)return;
+ floorLatchShadow[floor] &= ~0x03FF;
+ // set door bits according data
+ floorLatchShadow[floor] |= (doorPattern3[data] & 0x3FF);
+ updateFloorLatch(floor);
+}
+
+unsigned char getButtonStatus(unsigned char floor, unsigned int id){
+unsigned char mask = 0x01;
+unsigned char retVal=0;
+ if ((floor == 0) && (id == DOWN_BUTTON_ID)){return 0;}
+ if (id == CABINE_DOOR_BUTTON_ID){floor = 0; id=DOWN_BUTTON_ID;}
+ mask <<= floor;
+ P8OUT = mask;
+ P8DIR = mask;
+ if (P8IN & id) retVal=1;
+ P8DIR = 0x00;
+ return retVal;
+}
+
+unsigned char getFloorButtons(unsigned char floor){
+unsigned char mask = 0x01;
+ mask <<= floor;
+ P8OUT = mask;
+ P8DIR = mask;
+ mask = P8IN & 0xE0;
+ P8DIR = 0x00;
+
+ return mask;
+}
+
+void initClockSystem(void){
+ //Select DCO range 4..60Mhz
+ UCSCTL1=DCORSEL_6;
+ //enable XT1
+ P7SEL|=0x01;
+ UCSCTL6=0x01CC;
+ // wait until Clock is ok
+ while(UCSCTL7&0x0002){UCSCTL7=0;}
+
+ // DCO => appr. 50Mhz
+ // SMCLK MCLK => 25Mhz
+ UCSCTL2 = FLLD_1 + 0x2f8;
+
+ // Loop until XT1,XT2 & DCO fault flag is cleared
+ do
+ {
+ UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
+ // Clear XT2,XT1,DCO fault flags
+ SFRIFG1 &= ~OFIFG; // Clear fault flags
+ }while (SFRIFG1&OFIFG); // Test oscillator fault flag
+
+}
+
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.h
index 6f55965e9..40d0048bb 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatform.h
@@ -1,36 +1,36 @@
-/*
- * etPlatform.h
- *
- * Created on: 23.06.2012
- * Author: junggtho
- */
-
-#ifndef ETPLATFORM_H_
-#define ETPLATFORM_H_
-
-
-#define UP_SWITCH_LED 0x02
-#define DOWN_SWITCH_LED 0x01
-#define CABINE_SWITCH_LED 0x04
-
-#define CABINE_BUTTON_ID 0x80
-#define UP_BUTTON_ID 0x40
-#define DOWN_BUTTON_ID 0x20
-#define CABINE_DOOR_BUTTON_ID 0x10
-
-#define ON 0x01
-#define OFF 0x02
-#define TOGGLE 0x03
-
-
-void writeTo7Seg(unsigned char data);
-void writeToDoor(unsigned char floor, unsigned char data);
-unsigned char getButtonStatus(unsigned char floor, unsigned int id);
-void writeToButtonLed(unsigned char floor, unsigned char id, unsigned char onOff);
-void shiftMotorDown(void);
-void shiftMotorUp(void);
-unsigned char getMotorPosition(void);
-void toggleTestLed(void);
-
-
-#endif /* ETPLATFORM_H_ */
+/*
+ * etPlatform.h
+ *
+ * Created on: 23.06.2012
+ * Author: junggtho
+ */
+
+#ifndef ETPLATFORM_H_
+#define ETPLATFORM_H_
+
+
+#define UP_SWITCH_LED 0x02
+#define DOWN_SWITCH_LED 0x01
+#define CABINE_SWITCH_LED 0x04
+
+#define CABINE_BUTTON_ID 0x80
+#define UP_BUTTON_ID 0x40
+#define DOWN_BUTTON_ID 0x20
+#define CABINE_DOOR_BUTTON_ID 0x10
+
+#define ON 0x01
+#define OFF 0x02
+#define TOGGLE 0x03
+
+
+void writeTo7Seg(unsigned char data);
+void writeToDoor(unsigned char floor, unsigned char data);
+unsigned char getButtonStatus(unsigned char floor, unsigned int id);
+void writeToButtonLed(unsigned char floor, unsigned char id, unsigned char onOff);
+void shiftMotorDown(void);
+void shiftMotorUp(void);
+unsigned char getMotorPosition(void);
+void toggleTestLed(void);
+
+
+#endif /* ETPLATFORM_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTimer.c
index 27550efb0..67f193b29 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTimer.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTimer.c
@@ -1,99 +1,99 @@
-#include "msp430f5438a.h"
-#include "platform/etTimer.h"
-
-/* global timer */
-
-static etTargetTime_t targetTime;
-static etTargetTime_t lastTargetTime;
-static volatile etBool etTimer_executeFlag = FALSE;
-
-void etTimer_init(void){
- targetTime.nSec=0;
- targetTime.sec=0;
- lastTargetTime.nSec=0;
- lastTargetTime.sec=0;
-}
-
-etBool etTimer_executeNeeded(void){
- if (etTimer_executeFlag == TRUE){
- etTimer_executeFlag = FALSE;
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-int isTimeGreaterThanActualTime(const etTargetTime_t *t) {
-
- _disable_interrupt();
- if (t->sec > targetTime.sec) {
- _enable_interrupt();
- return 1;
- }
-
- if (t->sec < targetTime.sec) {
- _enable_interrupt();
- return 0;
- }
-
- if (t->nSec > targetTime.nSec) {
- _enable_interrupt();
- return 1;
- }
- else {
- _enable_interrupt();
- return 0;
- }
-}
-
-uint32 getNSecFromTarget(void){
- etTargetTime_t time;
- getTimeFromTarget(&time);
- return time.nSec;
-}
-
-uint32 getSecFromTarget(void){
- etTargetTime_t time;
- getTimeFromTarget(&time);
- return time.sec;
-}
-
-
-void getTimeFromTarget(etTargetTime_t *t) {
- _disable_interrupt();
- *t = targetTime;
- _enable_interrupt();
-}
-
-#define ET_TIMER_TIME_BASE_NS 15625000L
-#define ET_TIMER_TIME_BASE_US ET_TIMER_TIME_BASE_NS / 1000L
-#define ET_TIMER_TIME_BASE_MS ET_TIMER_TIME_BASE_US / 1000L
-
-uint32 getTimeBaseNS(void){
- return ET_TIMER_TIME_BASE_NS;
-}
-
-uint32 getTimeBaseUS(void){
- return ET_TIMER_TIME_BASE_US;
-}
-
-uint32 getTimeBaseMS(void){
- return ET_TIMER_TIME_BASE_MS;
-}
-
-
-/* the timer interrupt */
-#pragma INTERRUPT(wdt_isr)
-#pragma vector=WDT_VECTOR
-void wdt_isr(void) {
-// this interrupt will be called every 15,625ms
-
- etTimer_executeFlag = TRUE;
- targetTime.nSec += 15625000L;
-
- if (targetTime.nSec >= 1000000000L) {
- targetTime.nSec -= 1000000000L;
- targetTime.sec++;
- }
-} // end interrupt
+#include "msp430f5438a.h"
+#include "platform/etTimer.h"
+
+/* global timer */
+
+static etTargetTime_t targetTime;
+static etTargetTime_t lastTargetTime;
+static volatile etBool etTimer_executeFlag = FALSE;
+
+void etTimer_init(void){
+ targetTime.nSec=0;
+ targetTime.sec=0;
+ lastTargetTime.nSec=0;
+ lastTargetTime.sec=0;
+}
+
+etBool etTimer_executeNeeded(void){
+ if (etTimer_executeFlag == TRUE){
+ etTimer_executeFlag = FALSE;
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+int isTimeGreaterThanActualTime(const etTargetTime_t *t) {
+
+ _disable_interrupt();
+ if (t->sec > targetTime.sec) {
+ _enable_interrupt();
+ return 1;
+ }
+
+ if (t->sec < targetTime.sec) {
+ _enable_interrupt();
+ return 0;
+ }
+
+ if (t->nSec > targetTime.nSec) {
+ _enable_interrupt();
+ return 1;
+ }
+ else {
+ _enable_interrupt();
+ return 0;
+ }
+}
+
+uint32 getNSecFromTarget(void){
+ etTargetTime_t time;
+ getTimeFromTarget(&time);
+ return time.nSec;
+}
+
+uint32 getSecFromTarget(void){
+ etTargetTime_t time;
+ getTimeFromTarget(&time);
+ return time.sec;
+}
+
+
+void getTimeFromTarget(etTargetTime_t *t) {
+ _disable_interrupt();
+ *t = targetTime;
+ _enable_interrupt();
+}
+
+#define ET_TIMER_TIME_BASE_NS 15625000L
+#define ET_TIMER_TIME_BASE_US ET_TIMER_TIME_BASE_NS / 1000L
+#define ET_TIMER_TIME_BASE_MS ET_TIMER_TIME_BASE_US / 1000L
+
+uint32 getTimeBaseNS(void){
+ return ET_TIMER_TIME_BASE_NS;
+}
+
+uint32 getTimeBaseUS(void){
+ return ET_TIMER_TIME_BASE_US;
+}
+
+uint32 getTimeBaseMS(void){
+ return ET_TIMER_TIME_BASE_MS;
+}
+
+
+/* the timer interrupt */
+#pragma INTERRUPT(wdt_isr)
+#pragma vector=WDT_VECTOR
+void wdt_isr(void) {
+// this interrupt will be called every 15,625ms
+
+ etTimer_executeFlag = TRUE;
+ targetTime.nSec += 15625000L;
+
+ if (targetTime.nSec >= 1000000000L) {
+ targetTime.nSec -= 1000000000L;
+ targetTime.sec++;
+ }
+} // end interrupt
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etDatatypes.h
index a831f66ff..aa948e6b4 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etDatatypes.h
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#ifndef _ETDATATYPES_H_
-#define _ETDATATYPES_H_
-
-/*
- * typedefs for platform specific datatypes
- * Version for TI MSP 430
- *
- * */
-
-#include <stdio.h>
-
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned long uint32;
-/* typedef unsigned long long uint64; */ /* not available on this platform */
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef long int32;
-/* typedef long long int64; */ /* not available on this platform */
-
-
-/* float datatypes */
-typedef float float32;
-/* typedef double float64; */ /* not available on this platform */
-
-/* boolean datatypes and values */
-typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
-typedef bool boolean;
-#ifndef TRUE
- #define TRUE 1
-#endif
-#ifndef FALSE
- #define FALSE 0
-#endif
-
-/*
- * typedefs for eTrice Runtime and Testing
- *
- * */
-
-typedef int8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
-
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
-
-typedef bool etBool;
-
-typedef float32 etFloat32;
-
-typedef FILE* etFileHandle;
-
-typedef int8 etAddressId;
-
-#endif /* _DATATYPES_H_ */
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
+
+/*
+ * typedefs for platform specific datatypes
+ * Version for TI MSP 430
+ *
+ * */
+
+#include <stdio.h>
+
+/* unsigned integer datatypes */
+typedef unsigned char uint8;
+typedef unsigned short int uint16;
+typedef unsigned long uint32;
+/* typedef unsigned long long uint64; */ /* not available on this platform */
+
+/* signed integer datatypes */
+typedef char int8;
+typedef short int int16;
+typedef long int32;
+/* typedef long long int64; */ /* not available on this platform */
+
+
+/* float datatypes */
+typedef float float32;
+/* typedef double float64; */ /* not available on this platform */
+
+/* boolean datatypes and values */
+typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
+typedef bool boolean;
+#ifndef TRUE
+ #define TRUE 1
+#endif
+#ifndef FALSE
+ #define FALSE 0
+#endif
+
+/*
+ * typedefs for eTrice Runtime and Testing
+ *
+ * */
+
+typedef int8 etInt8;
+typedef int16 etInt16;
+typedef int32 etInt32;
+
+typedef uint8 etUInt8;
+typedef uint16 etUInt16;
+typedef uint32 etUInt32;
+
+typedef bool etBool;
+
+typedef float32 etFloat32;
+
+typedef FILE* etFileHandle;
+
+typedef int8 etAddressId;
+
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etLogger.c
index cf9543081..0ed0a557b 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etLogger.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etLogger.c
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-/*
- * etLogger.c
- *
- * Created on: 16.01.2012
- * Author: tschuetz
- */
-
-//#define ET_LOGGER_ACTIVATE 1
-#include "debugging/etLogger.h"
-
-#include <stdarg.h>
-
-
-void etLogger_logError(const char* message){
-#ifdef ET_LOGGER_ACTIVATE
- printf("ERROR: %s\n", message);
-#endif
-}
-
-void etLogger_logWarning(const char* message){
-#ifdef ET_LOGGER_ACTIVATE
- printf("WARNING: %s\n", message);
-#endif
-}
-
-void etLogger_logInfo(const char* message){
-#ifdef ET_LOGGER_ACTIVATE
- printf("INFO: %s\n", message);
-#endif
-}
-
-void etLogger_logErrorF(const char* format, ... ){
-#ifdef ET_LOGGER_ACTIVATE
- printf("ERROR: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-#endif
-}
-
-void etLogger_logWarningF(const char* format, ... ){
-#ifdef ET_LOGGER_ACTIVATE
- printf("WARNING: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-#endif
-}
-
-void etLogger_logInfoF(const char* format, ... ){
-#ifdef ET_LOGGER_ACTIVATE
- printf("INFO: ");
- va_list arglist;
- va_start( arglist, format );
- vprintf( format, arglist );
- va_end( arglist );
- printf("\n");
-#endif
-}
-
-etFileHandle etLogger_fopen(const char* filename, const char* mode){
-#ifdef ET_LOGGER_ACTIVATE
- return( fopen(filename, mode) );
-#endif
-}
-
-int etLogger_fclose(etFileHandle file){
-#ifdef ET_LOGGER_ACTIVATE
- return( fclose(file) );
-#endif
-}
-
-void etLogger_fprintf(etFileHandle file, const char* format, ... ){
-#ifdef ET_LOGGER_ACTIVATE
- va_list arglist;
- va_start( arglist, format );
- vfprintf(file, format, arglist );
- va_end( arglist );
-#endif
-}
+/*******************************************************************************
+ * 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+/*
+ * etLogger.c
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+//#define ET_LOGGER_ACTIVATE 1
+#include "debugging/etLogger.h"
+
+#include <stdarg.h>
+
+
+void etLogger_logError(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("ERROR: %s\n", message);
+#endif
+}
+
+void etLogger_logWarning(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("WARNING: %s\n", message);
+#endif
+}
+
+void etLogger_logInfo(const char* message){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("INFO: %s\n", message);
+#endif
+}
+
+void etLogger_logErrorF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("ERROR: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+void etLogger_logWarningF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("WARNING: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+void etLogger_logInfoF(const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ printf("INFO: ");
+ va_list arglist;
+ va_start( arglist, format );
+ vprintf( format, arglist );
+ va_end( arglist );
+ printf("\n");
+#endif
+}
+
+etFileHandle etLogger_fopen(const char* filename, const char* mode){
+#ifdef ET_LOGGER_ACTIVATE
+ return( fopen(filename, mode) );
+#endif
+}
+
+int etLogger_fclose(etFileHandle file){
+#ifdef ET_LOGGER_ACTIVATE
+ return( fclose(file) );
+#endif
+}
+
+void etLogger_fprintf(etFileHandle file, const char* format, ... ){
+#ifdef ET_LOGGER_ACTIVATE
+ va_list arglist;
+ va_start( arglist, format );
+ vfprintf(file, format, arglist );
+ va_end( arglist );
+#endif
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etPlatform.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etPlatform.c
index 5c81101ea..08798627a 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etPlatform.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etPlatform.c
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2012 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:
- * Thomas Schuetz (initial contribution)
- *
- *******************************************************************************/
-
-#include "msp430g2553.h"
-#include "platform/etTimer.h"
-
-
-/* forward declarations */
-
-
-/* implemenatation for eTrice interfaces*/
-
-void etUserEntry(void){
- //Use WDT as interrupt timer
- WDTCTL = WDTPW + 0x16;
-
- DCOCTL = CALDCO_16MHZ;
- BCSCTL1 = CALBC1_16MHZ;
- BCSCTL2 = 0x00;
- BCSCTL3 = 0x0C;
-
- P1DIR = 0x01;
-
- IE1 |= 1;
-
- etTimer_init();
-
- _enable_interrupt();
-
-
-}
-
-void etUserPreRun(void){
- _enable_interrupt();
-}
-
-void etUserPostRun(void){ }
-void etUserExit(void){ }
-
-
-/* platform specific functions */
-
-
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "msp430g2553.h"
+#include "platform/etTimer.h"
+
+
+/* forward declarations */
+
+
+/* implemenatation for eTrice interfaces*/
+
+void etUserEntry(void){
+ //Use WDT as interrupt timer
+ WDTCTL = WDTPW + 0x16;
+
+ DCOCTL = CALDCO_16MHZ;
+ BCSCTL1 = CALBC1_16MHZ;
+ BCSCTL2 = 0x00;
+ BCSCTL3 = 0x0C;
+
+ P1DIR = 0x01;
+
+ IE1 |= 1;
+
+ etTimer_init();
+
+ _enable_interrupt();
+
+
+}
+
+void etUserPreRun(void){
+ _enable_interrupt();
+}
+
+void etUserPostRun(void){ }
+void etUserExit(void){ }
+
+
+/* platform specific functions */
+
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etTimer.c
index 22a691f61..d3fd107ab 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etTimer.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/etTimer.c
@@ -1,69 +1,69 @@
-#include "msp430g2553.h"
-#include "platform/etTimer.h"
-
-/* global timer */
-
-static etTargetTime_t targetTime;
-static etTargetTime_t lastTargetTime;
-static volatile etBool etTimer_executeFlag = FALSE;
-
-void etTimer_init(void){
- targetTime.nSec=0;
- targetTime.sec=0;
- lastTargetTime.nSec=0;
- lastTargetTime.sec=0;
-}
-
-etBool etTimer_executeNeeded(void){
- if (etTimer_executeFlag == TRUE){
- etTimer_executeFlag = FALSE;
- return TRUE;
- }
- else {
- return FALSE;
- }
-}
-
-uint32 getNSecFromTarget(void){
- etTargetTime_t time;
- getTimeFromTarget(&time);
- return time.nSec;
-}
-
-uint32 getSecFromTarget(void){
- etTargetTime_t time;
- getTimeFromTarget(&time);
- return time.sec;
-}
-
-
-void getTimeFromTarget(etTargetTime_t *t) {
- _disable_interrupt();
- *t = targetTime;
- _enable_interrupt();
-}
-
-/* the timer interrupt */
-#pragma INTERRUPT(wdt_isr)
-#pragma vector=WDT_VECTOR
-
-void wdt_isr(void) {
-// this interrupt will be called every 15,625ms
-
- static unsigned char secCounter = 0;
- etTimer_executeFlag = TRUE;
-
- targetTime.nSec += 15625000L;
-
- if (targetTime.nSec >= 1000000000L) {
- targetTime.nSec -= 1000000000L;
- targetTime.sec++;
- }
- secCounter++;
-
- if (secCounter >= 64) {
- secCounter = 0;
-// P1OUT^=0x01;
- }
-
-} // end interrupt
+#include "msp430g2553.h"
+#include "platform/etTimer.h"
+
+/* global timer */
+
+static etTargetTime_t targetTime;
+static etTargetTime_t lastTargetTime;
+static volatile etBool etTimer_executeFlag = FALSE;
+
+void etTimer_init(void){
+ targetTime.nSec=0;
+ targetTime.sec=0;
+ lastTargetTime.nSec=0;
+ lastTargetTime.sec=0;
+}
+
+etBool etTimer_executeNeeded(void){
+ if (etTimer_executeFlag == TRUE){
+ etTimer_executeFlag = FALSE;
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+uint32 getNSecFromTarget(void){
+ etTargetTime_t time;
+ getTimeFromTarget(&time);
+ return time.nSec;
+}
+
+uint32 getSecFromTarget(void){
+ etTargetTime_t time;
+ getTimeFromTarget(&time);
+ return time.sec;
+}
+
+
+void getTimeFromTarget(etTargetTime_t *t) {
+ _disable_interrupt();
+ *t = targetTime;
+ _enable_interrupt();
+}
+
+/* the timer interrupt */
+#pragma INTERRUPT(wdt_isr)
+#pragma vector=WDT_VECTOR
+
+void wdt_isr(void) {
+// this interrupt will be called every 15,625ms
+
+ static unsigned char secCounter = 0;
+ etTimer_executeFlag = TRUE;
+
+ targetTime.nSec += 15625000L;
+
+ if (targetTime.nSec >= 1000000000L) {
+ targetTime.nSec -= 1000000000L;
+ targetTime.sec++;
+ }
+ secCounter++;
+
+ if (secCounter >= 64) {
+ secCounter = 0;
+// P1OUT^=0x01;
+ }
+
+} // end interrupt
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/info.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/info.txt
index 71c5f9f3f..b8f84e38c 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/info.txt
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_G2553_CCS5_LaunchPad/info.txt
@@ -1 +1 @@
-TI-MSP430
+TI-MSP430
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/naming-convention.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/naming-convention.txt
index 8223f93b9..ae52add6e 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/naming-convention.txt
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/naming-convention.txt
@@ -1,9 +1,9 @@
-Naming convention for platforms:
-<threading-type>_<processor-family and/or operating-system>_<processor or operating-system derivative>_<compiler>(_<board or application type>)
-
-<threading-type> : ST(single treaded) MT(multi-threaded)
-
-Examples:
-ST_MSP430_F5438_CCS5_EXP430F5438 : single threaded, processor-family:TI-MSP430, derivative:F5438, compiler: Code Composer Studio 5, board: EXP430F5438
-MT_POSIX_GENERIC_GCC : multi threaded, operation-system: POSIX, derivative: GENERIC, compiler: Gnu C++ Compiler
-
+Naming convention for platforms:
+<threading-type>_<processor-family and/or operating-system>_<processor or operating-system derivative>_<compiler>(_<board or application type>)
+
+<threading-type> : ST(single treaded) MT(multi-threaded)
+
+Examples:
+ST_MSP430_F5438_CCS5_EXP430F5438 : single threaded, processor-family:TI-MSP430, derivative:F5438, compiler: Code Composer Studio 5, board: EXP430F5438
+MT_POSIX_GENERIC_GCC : multi threaded, operation-system: POSIX, derivative: GENERIC, compiler: Gnu C++ Compiler
+

Back to the top