TTEthernet Model for INET Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
TTEScheduler.h
Go to the documentation of this file.
1 //
2 // This program is free software: you can redistribute it and/or modify
3 // it under the terms of the GNU Lesser General Public License as published by
4 // the Free Software Foundation, either version 3 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Lesser General Public License for more details.
11 //
12 // You should have received a copy of the GNU Lesser General Public License
13 // along with this program. If not, see http://www.gnu.org/licenses/.
14 //
15 
16 #ifndef __TTETHERNETMODELV2_TTESCHEDULER_H_
17 #define __TTETHERNETMODELV2_TTESCHEDULER_H_
18 
19 #include <omnetpp.h>
20 
21 #include <SchedulerMessage_m.h>
22 #include <SchedulerEvent.h>
24 
25 namespace TTEthernetModel {
26 
34 class TTEScheduler : public cSimpleModule
35 {
36  private:
40  simtime_t lastCycleStart;
45 
50  uint64_t lastCycleTicks;
51 
57  std::list<SchedulerEvent*> registredEvents;
58 
59  cMessage* newCyclemsg;
60 
64  simtime_t maxDriftChange;
68  simtime_t maxDrift;
69 
73  simtime_t currentTick;
77  simtime_t tick;
81  uint32_t cycleTicks;
82 
86  uint32_t cycles;
87 
88  public:
94  virtual int numInitStages() const;
95  protected:
101  virtual void initialize(int stage);
102 
111  virtual void handleMessage(cMessage *msg);
112 
118  virtual void handleParameterChange(const char* parname);
119 
120  public:
126  virtual uint32_t getTicks();
127 
133  virtual uint64_t getTotalTicks();
134 
140  virtual uint32_t getCycles();
141 
147  virtual void clockCorrection(int32_t ticks);
148 
159  virtual bool registerEvent(SchedulerEvent *event);
160 
173  virtual bool registerEvent(SchedulerActionTimeEvent *actionTimeEvent, bool forceNextCycle);
174 
185  virtual void unregisterEvent(SchedulerEvent *event);
186 
190  virtual void correctEvents();
191 
197  virtual void changeDrift();
198  protected:
202  static simsignal_t currentDrift;
203 
207  static simsignal_t newCycle;
208 };
209 
210 } //namespace
211 
212 #endif