Repository navigation
Expand file tree
/
Copy pathSimbaR.patch
More file actions
3518 lines (3440 loc) · 117 KB
/
Copy pathSimbaR.patch
File metadata and controls
3518 lines (3440 loc) · 117 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/lib/etsi-messages/Makefile b/lib/etsi-messages/Makefile
index c4fe048807..e9c916e5ce 100644
--- a/lib/etsi-messages/Makefile
+++ b/lib/etsi-messages/Makefile
@@ -25,6 +25,10 @@ ASN_MODULE_SOURCES= \
CAM.c \
CoopAwareness.c \
CamParameters.c \
+ EvaluationContainer.c \
+ EvalSequenceNumber.c \
+ RunNumber.c \
+ ByteBuffer.c \
HighFrequencyContainer.c \
LowFrequencyContainer.c \
SpecialVehicleContainer.c \
@@ -348,6 +352,10 @@ ASN_MODULE_HEADERS= \
CAM.h \
CoopAwareness.h \
CamParameters.h \
+ EvaluationContainer.h \
+ EvalSequenceNumber.h \
+ RunNumber.h \
+ ByteBuffer.h \
HighFrequencyContainer.h \
LowFrequencyContainer.h \
SpecialVehicleContainer.h \
@@ -763,7 +771,6 @@ buildclean:
clean: buildclean
rm -rf $(INCLDIR)
rm -f $(TGTLIB)
- rm -rf $(ASN1DIR)
regen: $(WITNESS)
diff --git a/lib/etsi-messages/asn1/ITS_ASN1-CAM.asn b/lib/etsi-messages/asn1/ITS_ASN1-CAM.asn
index e6cb301a6d..fb01dc9ce8 100644
--- a/lib/etsi-messages/asn1/ITS_ASN1-CAM.asn
+++ b/lib/etsi-messages/asn1/ITS_ASN1-CAM.asn
@@ -7,7 +7,7 @@ DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
IMPORTS
-ItsPduHeader, CauseCode, ReferencePosition, AccelerationControl, Curvature, CurvatureCalculationMode, Heading, LanePosition, EmergencyPriority, EmbarkationStatus, Speed, DriveDirection, LongitudinalAcceleration, LateralAcceleration, VerticalAcceleration, StationType, ExteriorLights, DangerousGoodsBasic, SpecialTransportType, LightBarSirenInUse, VehicleRole, VehicleLength, VehicleWidth, PathHistory, RoadworksSubCauseCode, ClosedLanes, TrafficRule, SpeedLimit, SteeringWheelAngle, PerformanceClass, YawRate, ProtectedCommunicationZone, PtActivation, Latitude, Longitude, ProtectedCommunicationZonesRSU, CenDsrcTollingZone FROM ITS-Container {
+EvalSequenceNumber, RunNumber, ByteBuffer, ItsPduHeader, CauseCode, ReferencePosition, AccelerationControl, Curvature, CurvatureCalculationMode, Heading, LanePosition, EmergencyPriority, EmbarkationStatus, Speed, DriveDirection, LongitudinalAcceleration, LateralAcceleration, VerticalAcceleration, StationType, ExteriorLights, DangerousGoodsBasic, SpecialTransportType, LightBarSirenInUse, VehicleRole, VehicleLength, VehicleWidth, PathHistory, RoadworksSubCauseCode, ClosedLanes, TrafficRule, SpeedLimit, SteeringWheelAngle, PerformanceClass, YawRate, ProtectedCommunicationZone, PtActivation, Latitude, Longitude, ProtectedCommunicationZonesRSU, CenDsrcTollingZone FROM ITS-Container {
itu-t (0) identified-organization (4) etsi (0) itsDomain (5) wg1 (1) ts (102894) cdd (2) version (1)
};
@@ -29,6 +29,14 @@ CamParameters ::= SEQUENCE {
highFrequencyContainer HighFrequencyContainer,
lowFrequencyContainer LowFrequencyContainer OPTIONAL,
specialVehicleContainer SpecialVehicleContainer OPTIONAL,
+ evaluationContainer EvaluationContainer OPTIONAL,
+ ...
+}
+
+EvaluationContainer ::= SEQUENCE {
+ evalSequenceNumber EvalSequenceNumber,
+ runNumber RunNumber,
+ byteBuffer ByteBuffer OPTIONAL,
...
}
@@ -129,4 +137,4 @@ RSUContainerHighFrequency ::= SEQUENCE {
GenerationDeltaTime ::= INTEGER { oneMilliSec(1) } (0..65535)
-END
\ No newline at end of file
+END
diff --git a/lib/etsi-messages/asn1/ITS_ASN1-ITS-Container.asn b/lib/etsi-messages/asn1/ITS_ASN1-ITS-Container.asn
index a45fe1b079..942e27e463 100644
--- a/lib/etsi-messages/asn1/ITS_ASN1-ITS-Container.asn
+++ b/lib/etsi-messages/asn1/ITS_ASN1-ITS-Container.asn
@@ -14,6 +14,12 @@ ItsPduHeader ::= SEQUENCE {
StationID ::= INTEGER(0..4294967295)
+EvalSequenceNumber ::= INTEGER(0..4294967295)
+
+RunNumber ::= INTEGER(0..4294967295)
+
+ByteBuffer ::= OCTET STRING (SIZE(0..2048))
+
ReferencePosition ::= SEQUENCE {
latitude Latitude,
longitude Longitude,
@@ -495,4 +501,4 @@ ProtectedZoneID ::= INTEGER (0.. 134217727)
CenDsrcTollingZoneID ::= ProtectedZoneID
-END
\ No newline at end of file
+END
diff --git a/lib/omnetpp/include/omnetpp/cdefaultlist.h b/lib/omnetpp/include/omnetpp/cdefaultlist.h
index 79f7de7cf1..79a69bd08e 100644
--- a/lib/omnetpp/include/omnetpp/cdefaultlist.h
+++ b/lib/omnetpp/include/omnetpp/cdefaultlist.h
@@ -17,6 +17,7 @@
#define __OMNETPP_CDEFAULTLIST_H
#include "cownedobject.h"
+#include <mutex>
namespace omnetpp {
@@ -43,6 +44,8 @@ class SIM_API cDefaultList : public cNoncopyableOwnedObject
cOwnedObject **objs; // array of owned objects
int numObjs; // number of elements used in objects[] (0..num-1)
int capacity; // allocated size of objs[]
+ mutable std::mutex mutex_objs;
+
#ifdef SIMFRONTEND_SUPPORT
private:
diff --git a/lib/omnetpp/include/omnetpp/ceventheap.h b/lib/omnetpp/include/omnetpp/ceventheap.h
index b600c368e1..cc8146850d 100644
--- a/lib/omnetpp/include/omnetpp/ceventheap.h
+++ b/lib/omnetpp/include/omnetpp/ceventheap.h
@@ -17,6 +17,7 @@
#define __OMNETPP_CEVENTHEAP_H
#include "cfutureeventset.h"
+#include <mutex>
namespace omnetpp {
@@ -47,6 +48,9 @@ class SIM_API cEventHeap : public cFutureEventSet
int cbhead, cbtail; // cbhead is inclusive, cbtail is exclusive
bool useCb; // for disabling cb
+ mutable std::mutex mutex_fes;
+ // std::mutex mutex_fes;
+
private:
void copy(const cEventHeap& other);
diff --git a/lib/omnetpp/include/omnetpp/cscheduler.h b/lib/omnetpp/include/omnetpp/cscheduler.h
index cebde589f4..643da3b15e 100644
--- a/lib/omnetpp/include/omnetpp/cscheduler.h
+++ b/lib/omnetpp/include/omnetpp/cscheduler.h
@@ -19,6 +19,7 @@
#include "cobject.h"
#include "simtime_t.h"
#include "clifecyclelistener.h"
+#include "coutvector.h"
namespace omnetpp {
@@ -221,6 +222,8 @@ class SIM_API cRealTimeScheduler : public cScheduler
bool waitUntil(int64_t targetTime); // in microseconds
int64_t toUsecs(simtime_t t);
+ cOutVector eventTimeDifferences;
+
public:
/**
* Constructor.
diff --git a/lib/omnetpp/src/sim/cdefaultlist.cc b/lib/omnetpp/src/sim/cdefaultlist.cc
index 53600644c8..18e797442b 100644
--- a/lib/omnetpp/src/sim/cdefaultlist.cc
+++ b/lib/omnetpp/src/sim/cdefaultlist.cc
@@ -42,15 +42,19 @@ cDefaultList::cDefaultList(const char *name) : cNoncopyableOwnedObject(name)
// careful: if we are a global variable (ctor called before main()),
// then insert() may get called before constructor and it invoked
// construct() already.
- if (cStaticFlag::insideMain() || capacity == 0)
+ mutex_objs.lock();
+ if (cStaticFlag::insideMain() || capacity == 0) {
construct();
+ }
+ mutex_objs.unlock();
// if we're invoked before main, then we are a global variable (dynamic
// instances of cDefaultList are not supposed to be created
// before main()) --> remove ourselves from ownership tree because
// we shouldn't be destroyed via operator delete
- if (!cStaticFlag::insideMain())
+ if (!cStaticFlag::insideMain()) {
removeFromOwnershipTree();
+ }
}
void cDefaultList::construct()
@@ -67,6 +71,7 @@ void cDefaultList::construct()
cDefaultList::~cDefaultList()
{
+ mutex_objs.lock();
if (getPerformFinalGC()) {
// delete all owned objects. One place we make use of this is behavior is
// when a simple module gets deleted -- there we have to delete all dynamically
@@ -91,10 +96,12 @@ cDefaultList::~cDefaultList()
// we can free up the pointer array itself though
delete[] objs;
}
+ mutex_objs.unlock();
}
void cDefaultList::doInsert(cOwnedObject *obj)
{
+ mutex_objs.lock();
ASSERT(obj != this || this == &defaultList);
if (numObjs >= capacity) {
@@ -117,10 +124,12 @@ void cDefaultList::doInsert(cOwnedObject *obj)
#ifdef SIMFRONTEND_SUPPORT
lastChangeSerial = changeCounter++;
#endif
+ mutex_objs.unlock();
}
void cDefaultList::ownedObjectDeleted(cOwnedObject *obj)
{
+ mutex_objs.lock();
ASSERT(obj && obj->owner == this);
// move last object to obj's old position
@@ -129,10 +138,12 @@ void cDefaultList::ownedObjectDeleted(cOwnedObject *obj)
#ifdef SIMFRONTEND_SUPPORT
lastChangeSerial = changeCounter++;
#endif
+ mutex_objs.unlock();
}
void cDefaultList::yieldOwnership(cOwnedObject *obj, cObject *newowner)
{
+ mutex_objs.lock();
ASSERT(obj && obj->owner == this && numObjs > 0);
// give object to its new owner
@@ -144,48 +155,61 @@ void cDefaultList::yieldOwnership(cOwnedObject *obj, cObject *newowner)
#ifdef SIMFRONTEND_SUPPORT
lastChangeSerial = changeCounter++;
#endif
+ mutex_objs.unlock();
}
void cDefaultList::takeAllObjectsFrom(cDefaultList& other)
{
- while (other.defaultListSize() > 0)
+ while (other.defaultListSize() > 0) {
take(other.defaultListGet(0));
+ }
}
std::string cDefaultList::str() const
{
+ mutex_objs.lock();
std::stringstream out;
out << "n=" << numObjs;
+ mutex_objs.unlock();
return out.str();
}
void cDefaultList::forEachChild(cVisitor *v)
{
- for (int i = 0; i < numObjs; i++)
+ mutex_objs.lock();
+ for (int i = 0; i < numObjs; i++) {
v->visit(objs[i]);
+ }
+ mutex_objs.unlock();
}
void cDefaultList::parsimPack(cCommBuffer *buffer) const
{
+ mutex_objs.lock();
#ifndef WITH_PARSIM
throw cRuntimeError(this, E_NOPARSIM);
#else
cOwnedObject::parsimPack(buffer);
- if (numObjs > 0)
+ if (numObjs > 0) {
throw cRuntimeError(this, "parsimPack() not supported (makes no sense)");
+ }
#endif
+ mutex_objs.unlock();
}
void cDefaultList::parsimUnpack(cCommBuffer *buffer)
{
+ mutex_objs.lock();
#ifndef WITH_PARSIM
throw cRuntimeError(this, E_NOPARSIM);
#else
cOwnedObject::parsimUnpack(buffer);
- if (numObjs > 0)
+ if (numObjs > 0) {
throw cRuntimeError(this, "parsimUnpack(): Can only unpack into empty object");
+ }
#endif
+ mutex_objs.unlock();
}
void cDefaultList::take(cOwnedObject *obj)
@@ -207,8 +231,12 @@ void cDefaultList::drop(cOwnedObject *obj)
cOwnedObject *cDefaultList::defaultListGet(int k)
{
- if (k < 0 || k >= numObjs)
+ mutex_objs.lock();
+ if (k < 0 || k >= numObjs) {
+ mutex_objs.unlock();
return nullptr;
+ }
+ mutex_objs.unlock();
return objs[k];
}
diff --git a/lib/omnetpp/src/sim/ceventheap.cc b/lib/omnetpp/src/sim/ceventheap.cc
index 8518a47aed..e0c7c2e34a 100644
--- a/lib/omnetpp/src/sim/ceventheap.cc
+++ b/lib/omnetpp/src/sim/ceventheap.cc
@@ -66,7 +66,7 @@ cEventHeap::cEventHeap(const char *name, int intialCapacity) : cFutureEventSet(n
cbsize = 4; // must be power of 2!
cb = new cEvent *[cbsize];
cbhead = cbtail = 0;
- useCb = true;
+ useCb = false;
}
cEventHeap::cEventHeap(const cEventHeap& other) : cFutureEventSet(other)
@@ -86,10 +86,12 @@ cEventHeap::~cEventHeap()
std::string cEventHeap::str() const
{
+ // mutex_fes.lock();
if (isEmpty())
return std::string("empty");
std::stringstream out;
out << "length=" << getLength();
+ // mutex_fes.unlock();
return out.str();
}
@@ -107,6 +109,7 @@ void cEventHeap::forEachChild(cVisitor *v)
void cEventHeap::clear()
{
+ mutex_fes.lock();
for (int i = cbhead; i != cbtail; CBINC(i))
dropAndDelete(cb[i]);
cbhead = cbtail = 0;
@@ -114,10 +117,12 @@ void cEventHeap::clear()
for (int i = 1; i <= heapLength; i++)
dropAndDelete(heap[i]);
heapLength = 0;
+ mutex_fes.unlock();
}
void cEventHeap::copy(const cEventHeap& other)
{
+ mutex_fes.lock();
// copy heap
heapLength = other.heapLength;
heapCapacity = other.heapCapacity;
@@ -135,50 +140,68 @@ void cEventHeap::copy(const cEventHeap& other)
cb = new cEvent *[cbsize];
for (int i = cbhead; i != cbtail; CBINC(i))
take(cb[i] = other.cb[i]->dup());
+ mutex_fes.unlock();
}
cEventHeap& cEventHeap::operator=(const cEventHeap& other)
{
+ // mutex_fes.lock();
if (this == &other)
+ // mutex_fes.unlock();
return *this;
cFutureEventSet::operator=(other);
clear();
copy(other);
+ // mutex_fes.unlock();
return *this;
}
cEvent *cEventHeap::get(int k)
{
- if (k < 0)
+ mutex_fes.lock();
+ if (k < 0) {
+ mutex_fes.unlock();
return nullptr;
+ }
// first few elements map into the circular buffer
int cblen = cblength();
- if (k < cblen)
+ if (k < cblen) {
+ mutex_fes.unlock();
return cbget(k);
+ }
k -= cblen;
// map the rest to h[1]..h[n] (h[] is 1-based)
- if (k >= heapLength)
+ if (k >= heapLength) {
+ mutex_fes.unlock();
return nullptr;
+ }
+ mutex_fes.unlock();
return heap[k+1];
}
void cEventHeap::sort()
{
+ mutex_fes.lock();
qsort(heap+1, heapLength, sizeof(cEvent *), qsort_cmp_msgs);
- for (int i = 1; i <= heapLength; i++)
+ for (int i = 1; i <= heapLength; i++) {
heap[i]->heapIndex = i;
+ }
+ mutex_fes.unlock();
}
void cEventHeap::insert(cEvent *event)
{
+ mutex_fes.lock();
take(event);
+ ASSERT(event->getOwner() == this);
event->insertOrder = insertCount++;
if (!useCb) {
heapInsert(event);
+ mutex_fes.unlock();
return;
}
@@ -195,10 +218,12 @@ void cEventHeap::insert(cEvent *event)
flushCb(); // move all events into the heap
}
- if (eligible)
+ if (eligible) {
cbInsert(event);
- else
+ }else{
heapInsert(event);
+ }
+ mutex_fes.unlock();
}
void cEventHeap::cbInsert(cEvent *event)
@@ -254,6 +279,7 @@ void cEventHeap::flushCb()
void cEventHeap::shiftup(int from)
{
+ // mutex_fes.lock();
// restores heap structure (in a sub-heap)
int i, j;
cEvent *temp;
@@ -271,21 +297,37 @@ void cEventHeap::shiftup(int from)
else
break;
}
+ // mutex_fes.unlock();
}
cEvent *cEventHeap::peekFirst() const
{
- return cbhead != cbtail ? cb[cbhead] : heapLength != 0 ? heap[1] : nullptr;
+ // return cbhead != cbtail ? cb[cbhead] : heapLength != 0 ? heap[1] : nullptr;
+ mutex_fes.lock();
+ if (cbhead != cbtail) {
+ mutex_fes.unlock();
+ return cb[cbhead];
+ }else{
+ if (heapLength != 0) {
+ mutex_fes.unlock();
+ return heap[1];
+ }else{
+ mutex_fes.unlock();
+ return nullptr;
+ }
+ }
}
cEvent *cEventHeap::removeFirst()
{
+ mutex_fes.lock();
if (cbhead != cbtail) {
// remove head element from circular buffer
cEvent *event = cb[cbhead];
CBINC(cbhead);
drop(event);
event->heapIndex = -1;
+ mutex_fes.unlock();
return event;
}
else if (heapLength > 0) {
@@ -295,16 +337,21 @@ cEvent *cEventHeap::removeFirst()
shiftup();
drop(event);
event->heapIndex = -1;
+ mutex_fes.unlock();
return event;
}
+ mutex_fes.unlock();
return nullptr;
}
cEvent *cEventHeap::remove(cEvent *event)
{
+ mutex_fes.lock();
// make sure it is really on the heap
- if (event->heapIndex == -1)
+ if (event->heapIndex == -1) {
+ mutex_fes.unlock();
return nullptr;
+ }
if (event->heapIndex < 0) {
// event is in the circular buffer
@@ -337,19 +384,23 @@ cEvent *cEventHeap::remove(cEvent *event)
drop(event);
event->heapIndex = -1;
+ mutex_fes.unlock();
return event;
}
void cEventHeap::putBackFirst(cEvent *event)
{
+ mutex_fes.lock();
take(event);
CBDEC(cbhead);
cb[cbhead] = event;
event->heapIndex = CBHEAPINDEX(cbhead);
- if (cbtail == cbhead)
+ if (cbtail == cbhead) {
cbgrow();
+ }
+ mutex_fes.unlock();
}
} // namespace omnetpp
diff --git a/lib/omnetpp/src/sim/cscheduler.cc b/lib/omnetpp/src/sim/cscheduler.cc
index f3788ad766..a9abe33b47 100644
--- a/lib/omnetpp/src/sim/cscheduler.cc
+++ b/lib/omnetpp/src/sim/cscheduler.cc
@@ -125,6 +125,8 @@ void cRealTimeScheduler::startRun()
doScaling = (factor != 0);
baseTime = opp_get_monotonic_clock_usecs();
+
+ eventTimeDifferences.setName("eventTimeDifferences");
}
int64_t cRealTimeScheduler::toUsecs(simtime_t t)
@@ -143,6 +145,7 @@ bool cRealTimeScheduler::waitUntil(int64_t targetTime)
// if there's more than 200ms to wait, wait in 100ms chunks
// in order to keep UI responsiveness by invoking getEnvir()->idle()
int64_t currentTime = opp_get_monotonic_clock_usecs();
+ eventTimeDifferences.record(targetTime - currentTime);
while (targetTime - currentTime >= 200000) {
usleep(100000); // 100ms
if (getEnvir()->idle())
@@ -164,10 +167,16 @@ cEvent *cRealTimeScheduler::guessNextEvent()
cEvent *cRealTimeScheduler::takeNextEvent()
{
- cEvent *event = sim->getFES()->peekFirst();
+ // cEvent *event = sim->getFES()->peekFirst();
+ cEvent *event = sim->getFES()->removeFirst();
if (!event)
throw cTerminationException(E_ENDEDOK);
+ // check message type
+ if (std::string("check simint msg buffer").compare(event->getName()) == 0 || std::string("check dut msg buffer").compare(event->getName()) == 0) {
+ // event is asynchronous, process it immediately
+ return event;
+ }
// calculate target time
simtime_t eventSimtime = event->getArrivalTime();
int64_t targetTime = baseTime + toUsecs(eventSimtime);
@@ -184,8 +193,8 @@ cEvent *cRealTimeScheduler::takeNextEvent()
}
// remove event from FES and return it
- cEvent *tmp = sim->getFES()->removeFirst();
- ASSERT(tmp == event);
+ // cEvent *tmp = sim->getFES()->removeFirst();
+ // ASSERT(tmp == event);
return event;
}
diff --git a/lib/omnetpp/src/sim/csimulation.cc b/lib/omnetpp/src/sim/csimulation.cc
index ede9df00c2..9c7c7fc2d1 100644
--- a/lib/omnetpp/src/sim/csimulation.cc
+++ b/lib/omnetpp/src/sim/csimulation.cc
@@ -593,7 +593,15 @@ void cSimulation::executeEvent(cEvent *event)
currentEventNumber++;
// advance simulation time
- currentSimtime = event->getArrivalTime();
+ if (std::string("check simint msg buffer").compare(event->getName()) == 0 || std::string("check dut msg buffer").compare(event->getName()) == 0) {
+ if (currentSimtime < event->getArrivalTime()) {
+ currentSimtime = event->getArrivalTime();
+ }else{
+ // std::cout << "cSimulation: causality violation due to race condition: currentSimtime: " << currentSimtime << ", event arrival time: " << event->getArrivalTime() << ", do not advance currentSimtime!!!" << std::endl;
+ }
+ }else{
+ currentSimtime = event->getArrivalTime();
+ }
// notify the environment about the event (writes eventlog, etc.)
EVCB.simulationEvent(event);
diff --git a/lib/openWRT/build_firmware.sh b/lib/openWRT/build_firmware.sh
new file mode 100755
index 0000000000..d73f4128b2
--- /dev/null
+++ b/lib/openWRT/build_firmware.sh
@@ -0,0 +1,28 @@
+# This file is part of Lanradio.
+#
+# Lanradio is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Lanradio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Lanradio. If not, see <http://www.gnu.org/licenses/>.
+#
+# Authors:
+# Florian Klingler <klingler@ccs-labs.org>
+
+#!/bin/bash
+./scripts/feeds update -a
+./scripts/feeds install -a
+
+VERSION="0.01"
+#BUILD_DATE="$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y-%m-%d)"
+BUILD_DATE="$(date --utc)"
+
+make package/base-files/clean
+make -j4 CONFIG_VERSION_CODE="$VERSION - built $BUILD_DATE"
diff --git a/lib/openWRT/feeds.conf.default b/lib/openWRT/feeds.conf.default
index 050b3ee4ed..21c573dc71 100644
--- a/lib/openWRT/feeds.conf.default
+++ b/lib/openWRT/feeds.conf.default
@@ -2,3 +2,4 @@ src-git packages https://git.openwrt.org/feed/packages.git^99efce0cd27adfcc53384
src-git luci https://git.openwrt.org/project/luci.git^13dd17fca148965d38f0d4e578b19679a7c4daa2
src-git routing https://git.openwrt.org/feed/routing.git^efa6e5445adda9c6545f551808829ec927cbade8
src-git telephony https://git.openwrt.org/feed/telephony.git^6f95d6ab3f359ee2ce81c20522700937424d1591
+src-cpy lanradioFeed ../../src/openWRT-feed
diff --git a/lib/openWRT/package/firmware/wireless-regdb/Makefile b/lib/openWRT/package/firmware/wireless-regdb/Makefile
index 26f470af44..ada3211e9f 100644
--- a/lib/openWRT/package/firmware/wireless-regdb/Makefile
+++ b/lib/openWRT/package/firmware/wireless-regdb/Makefile
@@ -20,6 +20,7 @@ define Package/wireless-regdb
endef
define Build/Compile
+ $(CP) ./files/db.txt $(PKG_BUILD_DIR)/db.txt
$(STAGING_DIR_HOST)/bin/$(PYTHON) $(PKG_BUILD_DIR)/db2fw.py $(PKG_BUILD_DIR)/regulatory.db $(PKG_BUILD_DIR)/db.txt
endef
diff --git a/lib/openWRT/package/firmware/wireless-regdb/files/db.txt b/lib/openWRT/package/firmware/wireless-regdb/files/db.txt
new file mode 100644
index 0000000000..93bb4abdff
--- /dev/null
+++ b/lib/openWRT/package/firmware/wireless-regdb/files/db.txt
@@ -0,0 +1,1384 @@
+wmmrule ETSI:
+ vo_c: cw_min=3, cw_max=7, aifsn=2, cot=2
+ vi_c: cw_min=7, cw_max=15, aifsn=2, cot=4
+ be_c: cw_min=15, cw_max=1023, aifsn=3, cot=6
+ bk_c: cw_min=15, cw_max=1023, aifsn=7, cot=6
+ vo_ap: cw_min=3, cw_max=7, aifsn=1, cot=2
+ vi_ap: cw_min=7, cw_max=15, aifsn=1, cot=4
+ be_ap: cw_min=15, cw_max=63, aifsn=3, cot=6
+ bk_ap: cw_min=15, cw_max=1023, aifsn=7, cot=6
+
+# This is the world regulatory domain
+country 00:
+ (2402 - 2472 @ 40), (20)
+ # Channel 12 - 13.
+ (2457 - 2482 @ 20), (20), NO-IR, AUTO-BW
+ # Channel 14. Only JP enables this and for 802.11b only
+ (2474 - 2494 @ 20), (20), NO-IR, NO-OFDM
+ # Channel 36 - 48
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ # Channel 52 - 64
+ (5250 - 5330 @ 80), (20), NO-IR, DFS, AUTO-BW
+ # Channel 100 - 144
+ (5490 - 5730 @ 160), (20), NO-IR, DFS
+ # Channel 149 - 165
+ (5735 - 5835 @ 80), (20), NO-IR
+ # IEEE 802.11ad (60GHz), channels 1..3
+ (57240 - 63720 @ 2160), (0)
+
+
+country AD:
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), wmmrule=ETSI
+ (5250 - 5330 @ 80), (20), DFS, wmmrule=ETSI
+ (5490 - 5710 @ 80), (27), DFS, wmmrule=ETSI
+ # 60 GHz band channels 1-4, ref: Etsi En 302 567
+ (57000 - 66000 @ 2160), (40)
+
+country AE: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (17), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+country AF: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+ (5490 - 5710 @ 160), (27), DFS
+
+# Source:
+# http://pucanguilla.org/Downloads/January2005-Anguilla%20Table%20of%20Allocations.pdf
+country AI: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW, wmmrule=ETSI
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW, wmmrule=ETSI
+ (5490 - 5710 @ 160), (27), DFS, wmmrule=ETSI
+
+country AL: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20.00), AUTO-BW
+ (5250 - 5330 @ 80), (20.00), DFS, AUTO-BW
+ (5490 - 5710 @ 160), (27.00), DFS
+
+country AM: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 20), (18)
+ (5250 - 5330 @ 20), (18), DFS
+
+country AN: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+ (5490 - 5710 @ 160), (27), DFS
+
+country AR: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (17), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+country AS: DFS-FCC
+ (2402 - 2472 @ 40), (30)
+ (5170 - 5250 @ 80), (24), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+country AT: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW, wmmrule=ETSI
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW, wmmrule=ETSI
+ (5490 - 5710 @ 160), (27), DFS, wmmrule=ETSI
+ # 60 GHz band channels 1-4, ref: Etsi En 302 567
+ (57000 - 66000 @ 2160), (40)
+
+# Source:
+# https://www.legislation.gov.au/Details/F2016C00432
+# Both DFS-ETSI and DFS-FCC are acceptable per AS/NZS 4268 Appendix B.
+# The EIRP for DFS bands can be increased by 3dB if TPC is implemented.
+# In order to allow 80MHz operation between 5650-5730MHz the upper boundary
+# of this more restrictive band has been shifted up by 5MHz from 5725MHz.
+country AU: DFS-ETSI
+ (2400 - 2483.5 @ 40), (36)
+ (5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW
+ (5250 - 5350 @ 80), (20), NO-OUTDOOR, AUTO-BW, DFS
+ (5470 - 5600 @ 80), (27), DFS
+ (5650 - 5730 @ 80), (27), DFS
+ (5730 - 5850 @ 80), (36)
+ (57000 - 66000 @ 2160), (43), NO-OUTDOOR
+
+country AW: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+ (5490 - 5710 @ 160), (27), DFS
+
+country AZ: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (18), AUTO-BW
+ (5250 - 5330 @ 80), (18), DFS, AUTO-BW
+
+country BA: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW, wmmrule=ETSI
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW, wmmrule=ETSI
+ (5490 - 5710 @ 160), (27), DFS, wmmrule=ETSI
+ # 60 GHz band channels 1-4, ref: Etsi En 302 567
+ (57000 - 66000 @ 2160), (40)
+
+country BB: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (23), AUTO-BW
+ (5250 - 5330 @ 80), (23), DFS, AUTO-BW
+ (5735 - 5835 @ 80), (30)
+
+country BD: DFS-JP
+ (2402 - 2482 @ 40), (20)
+ (5735 - 5835 @ 80), (30)
+
+country BE: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW, wmmrule=ETSI
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW, wmmrule=ETSI
+ (5490 - 5710 @ 160), (27), DFS, wmmrule=ETSI
+ # 60 GHz band channels 1-4, ref: Etsi En 302 567
+ (57000 - 66000 @ 2160), (40)
+
+country BF: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (17), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+# Bulgarian rules as defined by the Communications Regulation Commission in the
+# following documents:
+#
+# Rules for carrying out electronic communications through radio equipment using
+# radio spectrum, which does not need to be individually assigned (the Rules):
+# http://www.crc.bg/files/_bg/Pravila_09_06_2015.pdf
+#
+# List of radio equipment that uses harmonized within the European Union bands
+# and electronic communications terminal equipment (the List):
+# http://www.crc.bg/files/_bg/Spisak_2015.pdf
+#
+# Note: The transmit power limits in the 5250-5350 MHz and 5470-5725 MHz bands
+# can be raised by 3 dBm if TPC is enabled. Refer to BDS EN 301 893 for details.
+country BG: DFS-ETSI
+ # Wideband data transmission systems (WDTS) in the 2.4GHz ISM band, ref:
+ # I.22 of the List, BDS EN 300 328
+ (2402 - 2482 @ 40), (20)
+ # 5 GHz Radio Local Area Networks (RLANs), ref:
+ # II.H01 of the List, BDS EN 301 893
+ (5170 - 5250 @ 80), (23), AUTO-BW, wmmrule=ETSI
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW, wmmrule=ETSI
+ # II.H01 of the List, I.54 from the List, BDS EN 301 893
+ (5490 - 5710 @ 160), (27), DFS, wmmrule=ETSI
+ # Short range devices (SRDs) in the 5725-5875 MHz frequency range, ref:
+ # I.43 of the List, BDS EN 300 440-2, BDS EN 300 440-1
+ (5725 - 5875 @ 80), (14)
+ # 60 GHz Multiple-Gigabit RLAN Systems, ref:
+ # II.H03 of the List, BDS EN 302 567-2
+ (57000 - 66000 @ 2160), (40), NO-OUTDOOR
+
+country BH: DFS-JP
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 20), (20)
+ (5250 - 5330 @ 20), (20), DFS
+ (5735 - 5835 @ 20), (20)
+
+country BL: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+ (5490 - 5710 @ 160), (27), DFS
+
+country BM: DFS-FCC
+ (2402 - 2472 @ 40), (30)
+ (5170 - 5250 @ 80), (24), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+country BN: DFS-JP
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+ (5735 - 5835 @ 80), (20)
+
+country BO: DFS-JP
+ (2402 - 2482 @ 40), (20)
+ (5250 - 5330 @ 80), (30), DFS
+ (5735 - 5835 @ 80), (30)
+
+country BR: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (17), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+country BS: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (24), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+# Source:
+# http://www.bicma.gov.bt/paper/publication/nrrpart4.pdf
+country BT: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+ (5490 - 5710 @ 160), (27), DFS
+
+country BY: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+ (5490 - 5710 @ 160), (27), DFS
+
+country BZ: DFS-JP
+ (2402 - 2482 @ 40), (30)
+ (5735 - 5835 @ 80), (30)
+
+# Source:
+# https://www.ic.gc.ca/eic/site/smt-gst.nsf/vwapj/rss-247-i2-e.pdf/$file/rss-247-i2-e.pdf
+country CA: DFS-FCC
+ (2402 - 2472 @ 40), (30)
+ (5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW
+ (5250 - 5350 @ 80), (24), DFS, AUTO-BW
+ (5470 - 5600 @ 80), (24), DFS
+ (5650 - 5730 @ 80), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+# Source:
+# http://www.art-rca.org
+country CF: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 40), (17)
+ (5250 - 5330 @ 40), (24), DFS
+ (5490 - 5730 @ 40), (24), DFS
+ (5735 - 5835 @ 40), (30)
+
+# Source:
+# https://www.ofcomnet.ch/#/fatTable
+# Note that the maximum transmitter power can be doubled for 5250-5710MHz if
+# transmitter power control is in use: 5250-5330@23db, 5490-5710@30db
+country CH: DFS-ETSI
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW, wmmrule=ETSI
+ (5150 - 5330 @ 80), (20), NO-OUTDOOR, DFS, AUTO-BW, wmmrule=ETSI
+ (5490 - 5710 @ 160), (27), DFS, wmmrule=ETSI
+ # 60 GHz band channels 1-4, ref: Etsi En 302 567
+ (57000 - 66000 @ 2160), (40)
+
+country CI: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (17), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+country CL: DFS-JP
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (20), AUTO-BW
+ (5250 - 5330 @ 80), (20), DFS, AUTO-BW
+ (5735 - 5835 @ 80), (20)
+
+country CN: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (23), AUTO-BW
+ (5250 - 5330 @ 80), (23), DFS, AUTO-BW
+ (5735 - 5835 @ 80), (30)
+ # 60 GHz band channels 1,4: 28dBm, channels 2,3: 44dBm
+ # ref: http://www.miit.gov.cn/n11293472/n11505629/n11506593/n11960250/n11960606/n11960700/n12330791.files/n12330790.pdf
+ (57240 - 59400 @ 2160), (28)
+ (59400 - 63720 @ 2160), (44)
+ (63720 - 65880 @ 2160), (28)
+
+country CO: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (17), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW
+ (5490 - 5730 @ 160), (24), DFS
+ (5735 - 5835 @ 80), (30)
+
+country CR: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 20), (17)
+ (5250 - 5330 @ 20), (24), DFS
+ (5490 - 5730 @ 20), (24), DFS
+ (5735 - 5835 @ 20), (30)
+
+# Source:
+# https://www.mincom.gob.cu/es/marco-legal
+# - Redes Informáticas
+# Resolución 127- 2011 Reglamento de Banda de frecuencias de 2,4 GHz.
+country CU: DFS-FCC
+ (2400 - 2483.5 @ 40), (200 mW)
+
+country CX: DFS-FCC
+ (2402 - 2482 @ 40), (20)
+ (5170 - 5250 @ 80), (24), AUTO-BW
+ (5250 - 5330 @ 80), (24), DFS, AUTO-BW