Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms')
-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
18 files changed, 1893 insertions, 1893 deletions
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