summaryrefslogtreecommitdiff
path: root/cesar/maximus
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/maximus')
-rw-r--r--cesar/maximus/scheduler/Module2
-rw-r--r--cesar/maximus/scheduler/inc/Scheduler.h14
-rw-r--r--cesar/maximus/scheduler/inc/SchedulerEvent.h80
-rw-r--r--cesar/maximus/scheduler/src/Scheduler.cpp40
-rw-r--r--cesar/maximus/scheduler/src/SchedulerEvent.cpp30
5 files changed, 32 insertions, 134 deletions
diff --git a/cesar/maximus/scheduler/Module b/cesar/maximus/scheduler/Module
index 2010eec5c7..5bc57db98b 100644
--- a/cesar/maximus/scheduler/Module
+++ b/cesar/maximus/scheduler/Module
@@ -1 +1 @@
-SOURCES := Scheduler.cpp SchedulerEvent.cpp
+SOURCES := Scheduler.cpp
diff --git a/cesar/maximus/scheduler/inc/Scheduler.h b/cesar/maximus/scheduler/inc/Scheduler.h
index a3424239ad..69fc58b1b5 100644
--- a/cesar/maximus/scheduler/inc/Scheduler.h
+++ b/cesar/maximus/scheduler/inc/Scheduler.h
@@ -19,8 +19,16 @@
#include "maximus/sci/sci_msg.h"
#include <map>
-class SchedulerEvent;
-typedef std::multimap <Network_Clock_Tick, SchedulerEvent> calendar_t;
+struct SchedulerEvent_t
+{
+ Sci_Msg_Station_Id sta_id;
+ Network_Clock_Id clock_id;
+ Network_Clock_Type type;
+ SciMsg *msg;
+};
+
+typedef SchedulerEvent_t SchedulerEvent_t;
+typedef std::multimap <Network_Clock_Tick, SchedulerEvent_t> calendar_t;
class Scheduler
{
@@ -88,7 +96,7 @@ private:
Network_Clock_Type evt_type,
SciMsg *msg);
- void remove_generic_event (SchedulerEvent &evt);
+ void remove_generic_event (SchedulerEvent_t &evt);
void display_calendar () const;
};
diff --git a/cesar/maximus/scheduler/inc/SchedulerEvent.h b/cesar/maximus/scheduler/inc/SchedulerEvent.h
deleted file mode 100644
index 99b7597175..0000000000
--- a/cesar/maximus/scheduler/inc/SchedulerEvent.h
+++ /dev/null
@@ -1,80 +0,0 @@
-#ifndef maximus_scheduler_inc_schedulerevent_h
-#define maximus_scheduler_inc_schedulerevent_h
-/* Maximus project {{{
- *
- * Copyright (C) 2012 MStar Semiconductor
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file maximus/scheduler/inc/SchedulerEvent.h
- * \ingroup maximus_scheduler
- *
- */
-
-#include "maximus/common/types/sci_types.h"
-#include "maximus/common/types/networkclock_types.h"
-#include "maximus/sci/sci_msg.h"
-
-
-class SchedulerEvent
-{
-private:
- Sci_Msg_Station_Id sta_id;
- Network_Clock_Id id;
- Network_Clock_Type type;
- SciMsg *msg;
-
-public:
-
- SchedulerEvent (
- Sci_Msg_Station_Id arg1,
- Network_Clock_Id arg2,
- Network_Clock_Type arg3,
- SciMsg *arg4);
-
- virtual ~SchedulerEvent ();
-
- inline void set_sta_id (Sci_Msg_Station_Id val)
- {
- sta_id = val;
- }
-
- inline Sci_Msg_Station_Id get_sta_id () const
- {
- return sta_id;
- }
-
- inline void set_clock_id (Network_Clock_Id val)
- {
- id = val;
- }
-
- inline Network_Clock_Id get_clock_id () const
- {
- return id;
- }
-
- inline void set_clock_type (Network_Clock_Type val)
- {
- type = val;
- }
-
- inline Network_Clock_Type get_clock_type () const
- {
- return type;
- }
-
- inline void set_sci_msg (SciMsg *val)
- {
- msg = val;
- }
-
- inline SciMsg *get_sci_msg () const
- {
- return msg;
- }
-};
-
-#endif // maximus_scheduler_inc_schedulerevent_h
diff --git a/cesar/maximus/scheduler/src/Scheduler.cpp b/cesar/maximus/scheduler/src/Scheduler.cpp
index 4a3e47ed90..45f0edf58d 100644
--- a/cesar/maximus/scheduler/src/Scheduler.cpp
+++ b/cesar/maximus/scheduler/src/Scheduler.cpp
@@ -11,7 +11,6 @@
*
*/
#include "maximus/scheduler/inc/Scheduler.h"
-#include "maximus/scheduler/inc/SchedulerEvent.h"
#include "maximus/processors/inc/PhyProcessor.h"
#include "maximus/processors/inc/ClockProcessor.h"
#include "maximus/utils/inc/Error.h"
@@ -45,13 +44,13 @@ Scheduler::~Scheduler ()
}
inline void
-Scheduler::remove_generic_event (SchedulerEvent &evt)
+Scheduler::remove_generic_event (SchedulerEvent_t &evt)
{
/* Note :
* Polymorphism possible on 'scheduler_drop_event ()'.
* */
- if (evt.get_clock_type () == NETWORK_CLOCK_TYPE_PHY)
- phy_proc.scheduler_drop_event (evt.get_sci_msg ());
+ if (evt.type == NETWORK_CLOCK_TYPE_PHY)
+ phy_proc.scheduler_drop_event (evt.msg);
}
inline void
@@ -73,8 +72,8 @@ Scheduler::add_generic_event (
for (it = range.first ; it != range.second; ++it)
{
- if ((it->second.get_sta_id () == sta_id)
- && (it->second.get_clock_id () == clock_id))
+ if ((it->second.sta_id == sta_id)
+ && (it->second.clock_id == clock_id))
{
is_event_already_exist = true;
break;
@@ -83,13 +82,14 @@ Scheduler::add_generic_event (
assert (!is_event_already_exist);
+ SchedulerEvent_t event = {sta_id, clock_id, evt_type, msg};
+
calendar.insert (
#if CONFIG_SCHEDULER_FASTER
range.first,
#endif
- std::pair <Network_Clock_Tick, SchedulerEvent>
- (tick, SchedulerEvent (sta_id, clock_id,
- evt_type, msg)));
+ std::pair <Network_Clock_Tick, SchedulerEvent_t>
+ (tick, event));
}
void
@@ -160,8 +160,8 @@ Scheduler::remove_event (
for (it = range.first ; it != range.second; ++it)
{
- if ((it->second.get_sta_id () == sta_id)
- && (it->second.get_clock_id () == clock_id))
+ if ((it->second.sta_id == sta_id)
+ && (it->second.clock_id == clock_id))
{
remove_generic_event (it->second);
calendar.erase (it);
@@ -182,7 +182,7 @@ Scheduler::remove_sta_events (
for (it = calendar.begin (); it != calendar.end (); ++it)
{
- if (it->second.get_sta_id () == sta_id)
+ if (it->second.sta_id == sta_id)
{
remove_generic_event (it->second);
todel.push_back (it);
@@ -246,10 +246,10 @@ Scheduler::process_next_event ()
}
else if (!is_calendar_empty)
{
- clock_staid = next->second.get_sta_id ();
- clock_id = next->second.get_clock_id ();
- clock_type = next->second.get_clock_type ();
- clock_msg = next->second.get_sci_msg ();
+ clock_staid = next->second.sta_id;
+ clock_id = next->second.clock_id;
+ clock_type = next->second.type;
+ clock_msg = next->second.msg;
calendar.erase (next);
maximus_log (
@@ -290,10 +290,10 @@ Scheduler::display_calendar () const
{
maximus_log (LOG_INFO, " ["
<< std::hex << it->first << "] = {"
- << "staid (" << std::hex << it->second.get_sta_id () << "), "
- << "id (" << std::hex << it->second.get_clock_id () << "), "
- << "type (" << std::hex << it->second.get_clock_type () << "), "
- << "scimsg* (" << std::hex << it->second.get_sci_msg () << ")},");
+ << "staid (" << std::hex << it->second.sta_id << "), "
+ << "id (" << std::hex << it->second.clock_id << "), "
+ << "type (" << std::hex << it->second.type << "), "
+ << "scimsg* (" << std::hex << it->second.msg << ")},");
}
#endif
}
diff --git a/cesar/maximus/scheduler/src/SchedulerEvent.cpp b/cesar/maximus/scheduler/src/SchedulerEvent.cpp
deleted file mode 100644
index 35ddbf1a49..0000000000
--- a/cesar/maximus/scheduler/src/SchedulerEvent.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Maximus project {{{
- *
- * Copyright (C) 2012 MStar Semiconductor
- *
- * <<<Licence>>>
- *
- * }}} */
-/**
- * \file maximus/scheduler/src/SchedulerEvent.cpp
- * \ingroup maximus_scheduler
- *
- */
-
-#include "maximus/scheduler/inc/SchedulerEvent.h"
-
-SchedulerEvent::SchedulerEvent (
- Sci_Msg_Station_Id arg1,
- Network_Clock_Id arg2,
- Network_Clock_Type arg3,
- SciMsg *arg4):
- sta_id (arg1),
- id (arg2),
- type (arg3),
- msg (arg4)
-{
-}
-
-SchedulerEvent::~SchedulerEvent ()
-{
-}