summaryrefslogtreecommitdiffstats
path: root/Master/Real-Time Systems/RTS_P6/A1/src
diff options
context:
space:
mode:
Diffstat (limited to 'Master/Real-Time Systems/RTS_P6/A1/src')
-rw-r--r--Master/Real-Time Systems/RTS_P6/A1/src/CanAnalyzer.cpp24
-rw-r--r--Master/Real-Time Systems/RTS_P6/A1/src/CanAnalyzer.h23
-rw-r--r--Master/Real-Time Systems/RTS_P6/A1/src/CanMessage.cpp36
-rw-r--r--Master/Real-Time Systems/RTS_P6/A1/src/CanMessage.h30
-rw-r--r--Master/Real-Time Systems/RTS_P6/A1/src/main.cpp13
5 files changed, 126 insertions, 0 deletions
diff --git a/Master/Real-Time Systems/RTS_P6/A1/src/CanAnalyzer.cpp b/Master/Real-Time Systems/RTS_P6/A1/src/CanAnalyzer.cpp
new file mode 100644
index 0000000..7bfcd99
--- /dev/null
+++ b/Master/Real-Time Systems/RTS_P6/A1/src/CanAnalyzer.cpp
@@ -0,0 +1,24 @@
+/*
+ * CanAnalyzer.cpp
+ *
+ * Created on: 18.01.2011
+ * Author: istsveise
+ */
+
+#include "CanAnalyzer.h"
+#include <math.h>
+
+CanAnalyzer::CanAnalyzer() {
+ // TODO Auto-generated constructor stub
+
+}
+
+CanAnalyzer::~CanAnalyzer() {
+ // TODO Auto-generated destructor stub
+}
+int CanAnalyzer::getMaxTransmissionTimeUsec(CanMessage& m)
+{
+ int tau = 1; // 1 mircosecond bit time
+ int transTimeUsec = (floor((34+8*m.byteCount)/5)+47+8*m.byteCount)*tau;
+ return transTimeUsec;
+}
diff --git a/Master/Real-Time Systems/RTS_P6/A1/src/CanAnalyzer.h b/Master/Real-Time Systems/RTS_P6/A1/src/CanAnalyzer.h
new file mode 100644
index 0000000..1012bb3
--- /dev/null
+++ b/Master/Real-Time Systems/RTS_P6/A1/src/CanAnalyzer.h
@@ -0,0 +1,23 @@
+/*
+ * CanAnalyzer.h
+ *
+ * Created on: 18.01.2011
+ * Author: istsveise
+ */
+
+#ifndef CANANALYZER_H_
+#define CANANALYZER_H_
+
+#include "CanMessage.h"
+#include <vector>
+
+using namespace std;
+
+class CanAnalyzer {
+public:
+ CanAnalyzer();
+ virtual ~CanAnalyzer();
+ static int getMaxTransmissionTimeUsec(CanMessage&);
+};
+
+#endif /* CANANALYZER_H_ */
diff --git a/Master/Real-Time Systems/RTS_P6/A1/src/CanMessage.cpp b/Master/Real-Time Systems/RTS_P6/A1/src/CanMessage.cpp
new file mode 100644
index 0000000..c6bad99
--- /dev/null
+++ b/Master/Real-Time Systems/RTS_P6/A1/src/CanMessage.cpp
@@ -0,0 +1,36 @@
+/*
+ * CanMessage.cpp
+ *
+ * Created on: 18.01.2011
+ * Author: istsveise
+ */
+
+#include "CanMessage.h"
+
+CanMessage::CanMessage() {
+ // TODO Auto-generated constructor stub
+
+}
+
+CanMessage::~CanMessage() {
+ // TODO Auto-generated destructor stub
+}
+CanMessage::CanMessage(int pri, int per, int jit, int byteCnt, string& descr)
+:prio(pri),period(per),jitter(jit),byteCount(byteCnt),desc(descr)
+{
+
+}
+bool CanMessage::operator =(const CanMessage& rhs)
+{
+ this->prio = rhs.prio;
+ this->period = rhs.period;
+ this->jitter = rhs.jitter;
+ this->byteCount = rhs.byteCount;
+ this->desc = rhs.desc;
+ return *this;
+}
+
+CanMessage& CanMessage::operator ==(const CanMessage& rhs)
+{
+ return (this->prio == rhs.prio) && (this->period == rhs.period) && (this->jitter == rhs.jitter) && (this->byteCount == rhs.byteCount) && (this->desc == rhs.desc);
+}
diff --git a/Master/Real-Time Systems/RTS_P6/A1/src/CanMessage.h b/Master/Real-Time Systems/RTS_P6/A1/src/CanMessage.h
new file mode 100644
index 0000000..1a8066c
--- /dev/null
+++ b/Master/Real-Time Systems/RTS_P6/A1/src/CanMessage.h
@@ -0,0 +1,30 @@
+/*
+ * CanMessage.h
+ *
+ * Created on: 18.01.2011
+ * Author: istsveise
+ */
+
+#ifndef CANMESSAGE_H_
+#define CANMESSAGE_H_
+
+#include <string>
+
+using namespace std;
+
+class CanMessage {
+public:
+ CanMessage();
+ CanMessage(int,int,int,int,string&);
+ virtual ~CanMessage();
+ bool operator==(const CanMessage&);
+ CanMessage& operator=(const CanMessage&);
+
+ int prio;
+ int period;
+ int jitter;
+ int byteCount;
+ string desc;
+};
+
+#endif /* CANMESSAGE_H_ */
diff --git a/Master/Real-Time Systems/RTS_P6/A1/src/main.cpp b/Master/Real-Time Systems/RTS_P6/A1/src/main.cpp
new file mode 100644
index 0000000..a8f1c00
--- /dev/null
+++ b/Master/Real-Time Systems/RTS_P6/A1/src/main.cpp
@@ -0,0 +1,13 @@
+/*
+ * main.cpp
+ *
+ * Created on: 18.01.2011
+ * Author: istsveise
+ */
+
+#include <stdlib.h>
+
+int main(int argc, char* argv[])
+{
+ return EXIT_SUCCESS;
+}