Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjung2014-01-28 19:04:06 +0000
committertjung2014-01-28 19:04:06 +0000
commit3bcfd05693108051f88b07e0fa32e85b1e4b058f (patch)
treea00c4c12d29a64d701d7f870c059259698790476
parentebd70072c69a75a4ede60674403e4c44272b0adb (diff)
downloadorg.eclipse.etrice-3bcfd05693108051f88b07e0fa32e85b1e4b058f.tar.gz
org.eclipse.etrice-3bcfd05693108051f88b07e0fa32e85b1e4b058f.tar.xz
org.eclipse.etrice-3bcfd05693108051f88b07e0fa32e85b1e4b058f.zip
single threaded runtime for HW Elevator
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etMutex.c44
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatformLifecycle.c38
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etSema.c43
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etThread.c72
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c43
5 files changed, 240 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etMutex.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etMutex.c
new file mode 100644
index 000000000..cc0f0ef60
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etMutex.c
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etMutex.c MinGW implementation of etMutex
+ *
+ */
+
+#include "osal/etMutex.h"
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+void etMutex_construct(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "construct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etMutex_destruct(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "destruct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etMutex_enter(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "enter")
+ _disable_interrupt();
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etMutex_leave(etMutex* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etMutex", "leave")
+ _enable_interrupt();
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatformLifecycle.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatformLifecycle.c
new file mode 100644
index 000000000..481adcc5b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etPlatformLifecycle.c
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+
+
+#include "osal/etPlatformLifecycle.h"
+#include "etPlatform.h"
+#include "etThread.h"
+/* implemenatation for eTrice interfaces*/
+
+extern etThread * noThread;
+
+void etUserEntry(void){
+ initHw();
+ etTime_init();
+}
+
+void etUserPreRun(void){
+ /* Start the scheduler. */
+ enableInterrupt();
+ etThread_execute(noThread);
+// ToDo: implement the run loop
+// vTaskStartScheduler();
+
+}
+
+void etUserPostRun(void){ }
+void etUserExit(void){ }
+
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etSema.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etSema.c
new file mode 100644
index 000000000..a291d37b8
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etSema.c
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+
+#include "osal/etSema.h"
+#include "etTimer.h"
+
+#include "debugging/etMSCLogger.h"
+
+extern etTimer * singleThreadedTimer;
+
+void etSema_construct(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "construct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+void etSema_destruct(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "destruct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_wakeup(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "wakeup")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etSema_waitForWakeup(etSema* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etSema", "waitForWakeup")
+ // call the execute function
+ singleThreadedTimer->timerFunction(singleThreadedTimer->timerFunctionData);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etThread.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etThread.c
new file mode 100644
index 000000000..f2a5daf71
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etThread.c
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etThread.c FreeRTOS implementation of etThread
+ *
+ */
+
+#include "osal/etThread.h"
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+void etThread_execute(etThread* self);
+
+etThread * noThread;
+
+void etThread_construct(
+ etThread* self,
+ etStacksize stacksize,
+ etPriority priority,
+ etThreadname threadName,
+ etThreadFunction threadFunction,
+ void* threadFunctionData)
+{
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "construct")
+
+ /* fill in data */
+ self->stacksize = stacksize;
+ self->priority = priority;
+ self->threadName = threadName;
+ self->threadFunction = threadFunction;
+ self->threadFunctionData = threadFunctionData;
+ // for the single threaded port stacksize and prio is not needed
+ // save the Threadpointer as singleton
+ noThread=self;
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_start(etThread* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "start")
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_execute(etThread* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "execute")
+ /* etThread_execute redirects the call from the thread to the execute function in the eTrice runtime to enable correct synchronous MSC logging */
+ self->threadFunction(self->threadFunctionData);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_destruct(etThread* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "destruct")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_sleep(etInt32 millis){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
+
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c
new file mode 100644
index 000000000..7d17c4c12
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_MSP430_F5438_CCS5_HWElevator/etTime.c
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "osal/etTime.h"
+
+etTime targetTime;
+
+void etTime_init(void){
+ targetTime.nSec=0;
+ targetTime.sec=0;
+}
+
+
+void getTimeFromTarget(etTime *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 or 1,953125ms
+ targetTime.nSec += 15625000L;
+
+ if (targetTime.nSec >= 1000000000L) {
+ targetTime.nSec -= 1000000000L;
+ targetTime.sec++;
+ }
+// P10OUT ^= 0x01; //toggle testpin
+} // end interrupt
+
+

Back to the top