Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-05-03 04:06:01 -0400
committerHenrik Rentz-Reichert2013-05-03 04:06:01 -0400
commit6703890a8bc841dc6dfe7fbfaff8aa41daeb0d24 (patch)
treee95c1b8e23fb7917ce97172458ea4316888f30a4 /runtime/org.eclipse.etrice.runtime.c/src/common/messaging
parent542803b0983becd79ff95133bec44526c03b7adc (diff)
parent3f26e81bc9be937a2f6c0bf765628093e6eda05b (diff)
downloadorg.eclipse.etrice-6703890a8bc841dc6dfe7fbfaff8aa41daeb0d24.tar.gz
org.eclipse.etrice-6703890a8bc841dc6dfe7fbfaff8aa41daeb0d24.tar.xz
org.eclipse.etrice-6703890a8bc841dc6dfe7fbfaff8aa41daeb0d24.zip
Merge remote branch 'origin/CGenPhysical' into CGenPhysical
Conflicts: tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/common/messaging')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c18
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h9
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c3
3 files changed, 23 insertions, 7 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
index b1a5fea54..8c87c853f 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.c
@@ -19,6 +19,7 @@ void etMessageQueue_init(etMessageQueue* self){
self->first = NULL;
self->last = NULL;
self->highWaterMark = 0;
+ self->lowWaterMark = 0;
self->size = 0;
ET_MSC_LOGGER_SYNC_EXIT
}
@@ -64,6 +65,9 @@ etMessage* etMessageQueue_pop(etMessageQueue* self){
pop_msg->next=NULL;
self->size--;
+ if (self->size < self->lowWaterMark)
+ self->lowWaterMark--;
+
ET_MSC_LOGGER_SYNC_EXIT
return pop_msg;
}
@@ -93,7 +97,19 @@ etBool etMessageQueue_isNotEmpty(etMessageQueue* self){
}
etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self) {
- ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getHightWaterMark")
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getHighWaterMark")
ET_MSC_LOGGER_SYNC_EXIT
return self->highWaterMark;
}
+
+etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "getLowWaterMark")
+ ET_MSC_LOGGER_SYNC_EXIT
+ return self->lowWaterMark;
+}
+
+void etMessageQueue_resetLowWaterMark(etMessageQueue* self) {
+ ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "resetLowWaterMark")
+ self->lowWaterMark = self->size;
+ ET_MSC_LOGGER_SYNC_EXIT
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
index f305d1aa9..a9a6cb13e 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
@@ -20,6 +20,7 @@ typedef struct etMessageQueue {
etMessage* first;
etMessage* last;
etInt16 highWaterMark;
+ etInt16 lowWaterMark;
etInt16 size;
} etMessageQueue;
@@ -27,19 +28,17 @@ typedef struct etMessageQueue {
void etMessageQueue_init(etMessageQueue* self);
void etMessageQueue_push(etMessageQueue* self, etMessage* msg);
-
etMessage* etMessageQueue_pop(etMessageQueue* self);
etMessage* etMessageQueue_getFirst(etMessageQueue* self);
-
etMessage* etMessageQueue_getLast(etMessageQueue* self);
etBool etMessageQueue_isNotEmpty(etMessageQueue* self);
-etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self);
-
etInt16 etMessageQueue_getSize(etMessageQueue* self);
-
+etInt16 etMessageQueue_getHighWaterMark(etMessageQueue* self);
+etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self);
+void etMessageQueue_resetLowWaterMark(etMessageQueue* self);
#endif /* _RMESSAGEQUEUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
index 4f70b98e2..9e66c95fd 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.c
@@ -111,6 +111,7 @@ void etMessageService_initMessagePool(etMessageService* self){
etMessage* block = (etMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize];
etMessageQueue_push(&self->messagePool, block);
}
+ etMessageQueue_resetLowWaterMark(&self->messagePool);
ET_MSC_LOGGER_SYNC_EXIT
}
@@ -189,7 +190,7 @@ void etMessageService_execute(etMessageService* self){
etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self){
ET_MSC_LOGGER_SYNC_ENTRY("etMessageService", "getMessagePoolLowWaterMark")
- etInt16 lowWaterMark = self->messageBuffer.maxBlocks - etMessageQueue_getHighWaterMark(&self->messageQueue);
+ etInt16 lowWaterMark = etMessageQueue_getLowWaterMark(&self->messagePool);
ET_MSC_LOGGER_SYNC_EXIT
return lowWaterMark;
}

Back to the top