Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etSema.c1
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c1
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c21
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c2
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c10
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu4
6 files changed, 23 insertions, 16 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etSema.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etSema.c
index 2a4ee716f..94213f4ec 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etSema.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etSema.c
@@ -26,6 +26,7 @@ void etSema_construct(etSema* self){
ET_MSC_LOGGER_SYNC_ENTRY("etSema", "construct")
if (sem_init(&(self->osData), 0, 0) == -1) {
/* handle error */
+ printf("etSema_construct: error\n"); fflush(stdout); // TODO: remove debug output
}
ET_MSC_LOGGER_SYNC_EXIT
}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c
index c6f2ebb15..95fc528da 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c
@@ -91,6 +91,7 @@ void etThread_destruct(etThread* self){
void etThread_sleep(etInt32 millis){
ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
{
+ // TODO: nanosleep doesn't work at all
// struct timespec time;
// time.tv_nsec = 1000*1000*millis;
// time.tv_sec = 0;
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c
index 7795b7388..7dba99ffd 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etTimer.c
@@ -92,6 +92,7 @@ static void timerHandler(int sig, siginfo_t *si, void *uc) {
if (&it->osTimerData.timerid==tid) {
it->osTimerData.signaled = TRUE;
etSema_wakeup(&timer_sema);
+ printf("timerHandler\n"); fflush(stdout); // TODO: remove debug output
break;
}
}
@@ -120,6 +121,16 @@ void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction tim
etMutex_construct(&timer_mutex);
etSema_construct(&timer_sema);
+ /* we set up a signal handler */
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_SIGINFO;
+ sa.sa_sigaction = timerHandler;
+ if (sigaction(TIMER_SIGNAL, &sa, NULL) != 0) {
+ fprintf(stderr, "etTimer_construct: failed setting action handler\n");
+ fflush(stderr);
+ return;
+ }
+
/* we start the timer thread */
etThread_construct(
&timer_thread,
@@ -130,15 +141,7 @@ void etTimer_construct(etTimer* self, etTime* timerInterval, etTimerFunction tim
NULL);
etThread_start(&timer_thread);
- /* we set up a signal handler */
- sa.sa_flags = SA_SIGINFO;
- sa.sa_sigaction = timerHandler;
- sigemptyset(&sa.sa_mask);
- if (sigaction(TIMER_SIGNAL, &sa, NULL) != 0) {
- fprintf(stderr, "etTimer_construct: failed setting action handler\n");
- fflush(stderr);
- return;
- }
+ printf("etTimer_construct: installed signal handler and started thread\n"); fflush(stdout); // TODO: remove debug output
}
/* place at list head */
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
index 851f7b108..d4b9a3c01 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtMessageService.c
@@ -42,7 +42,7 @@ etBool DummyMessageDispatcher(const etMessage* msg){
default:
break;
}
- return FALSE;
+ return TRUE;
}
void TestEtMessageService_init(etInt16 id){
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c
index f1ea5bc2a..87ad15aaf 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtTimer.c
@@ -28,10 +28,12 @@ etSema GlobalSema;
etInt32 counter;
void TestEtTimer_TimerCallback1(void* data){
+ printf("TestEtTimer_TimerCallback1\n"); fflush(stdout); // TODO: remove debug output
etSema_wakeup(&GlobalSema);
}
void TestEtTimer_TimerCallback2(void* data){
+ printf("TestEtTimer_TimerCallback2\n"); fflush(stdout); // TODO: remove debug output
counter++;
}
@@ -52,16 +54,16 @@ static void TestEtTimer_lifecycle (etInt16 id) {
NULL);
getTimeFromTarget(&startTime);
- printf("TestEtTimer_lifecycle: start timer\n"); fflush(stdout); // remove debug output
+ printf("TestEtTimer_lifecycle: start timer\n"); fflush(stdout); // TODO: remove debug output
etTimer_start(&timer1);
- printf("TestEtTimer_lifecycle: wait for timer\n"); fflush(stdout); // remove debug output
+ printf("TestEtTimer_lifecycle: wait for timer\n"); fflush(stdout); // TODO: remove debug output
etSema_waitForWakeup(&GlobalSema); /* wait until callback function releases timer the first time (fires immediately) */
- printf("TestEtTimer_lifecycle: wait again\n"); fflush(stdout); // remove debug output
+ printf("TestEtTimer_lifecycle: wait again\n"); fflush(stdout); // TODO: remove debug output
etSema_waitForWakeup(&GlobalSema); /* wait until callback function releases timer the second time (fires after first interval)*/
etTimer_stop(&timer1);
getTimeFromTarget(&endTime);
- printf("TestEtTimer_lifecycle: timer stopped\n"); fflush(stdout); // remove debug output
+ printf("TestEtTimer_lifecycle: timer stopped\n"); fflush(stdout); // TODO: remove debug output
etInt32 elapsed = etTimeHelpers_convertToMSec(&endTime) - etTimeHelpers_convertToMSec(&startTime);
EXPECT_TRUE(id, "elapsed time wrong", (elapsed > 1400) && (elapsed < 1600));
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu
index a3c2ec10f..5435d343a 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu
+++ b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu
@@ -1,4 +1,4 @@
etUnit report
ts start: etUnit
-tc start 17: openAll and closeAll
-tc end 17: 0
+tc start 16: openAll and closeAll
+tc end 16: 0

Back to the top