dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / fsm / scd_sts_busy.cpp
diff --git a/dol/src/dol/visitor/hdsd/scd/fsm/scd_sts_busy.cpp b/dol/src/dol/visitor/hdsd/scd/fsm/scd_sts_busy.cpp
new file mode 100644 (file)
index 0000000..a9bb214
--- /dev/null
@@ -0,0 +1,36 @@
+#include "fsm/scd_sts_busy.h"
+
+#include "scd_logging.h"
+#include "scd_exception.h"
+#include "scd_cont_man_slave.h"
+
+
+void scd_sts_busy::set_idle(const sc_core::sc_time& time)
+{
+    /* prevents the situation where no events exist, but a huge
+     * ammount of data is being transferred that will generate events later
+     */
+    if (_sim.get_poller().wait(SCD_CONT_DELAY))
+        return;
+
+    scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_IDLE, time);
+    _fsm.send_command(cmd);
+    _fsm.set_state(_st_idle);
+}
+
+
+void scd_sts_busy::set_done()
+{
+    /* prevents the situation where no events exist, but a huge
+     * ammount of data is being transferred that will generate events later
+     */
+    if (_sim.get_poller().wait(SCD_CONT_DELAY))
+        return;
+
+    scd_command* cmd = new scd_command(SCD_CM_CONTROL, SCD_CM_DONE);
+    _fsm.send_command(cmd);
+    _fsm.set_state(_st_done);
+}
+
+
+bool scd_sts_busy::busy() const { return true; }