copied everything over from 2012 and removed all of the actual robot code except the drivetrain stuff
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4078 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/aos/crio/motor_server/CRIOControlLoopRunner.h b/aos/crio/motor_server/CRIOControlLoopRunner.h
new file mode 100644
index 0000000..efed120
--- /dev/null
+++ b/aos/crio/motor_server/CRIOControlLoopRunner.h
@@ -0,0 +1,40 @@
+#ifndef AOS_CRIO_MOTOR_SERVER_CRIO_CONTROL_LOOP_RUNNER_H_
+#define AOS_CRIO_MOTOR_SERVER_CRIO_CONTROL_LOOP_RUNNER_H_
+
+#include <vector>
+#include <semLib.h>
+
+#include "aos/common/control_loop/ControlLoop.h"
+#include "aos/common/mutex.h"
+
+namespace aos {
+namespace crio {
+
+// Runs crio-side control loops. Completely static because there is no reason
+// for multiple ones and it gets rid of the problem of passing an instance
+// around.
+class CRIOControlLoopRunner {
+ public:
+ // Spawns a new Task that loops forever.
+ // No other functions should be called before this one returns.
+ static void Start();
+
+ // Adds a control loop to run.
+ // This class takes control of the instance.
+ static void AddControlLoop(control_loops::SerializableControlLoop *loop);
+
+ private:
+ static bool started_;
+
+ static std::vector<control_loops::SerializableControlLoop *> loops_;
+ static Mutex loops_lock;
+
+ // Gets called by a WDInterruptNotifier on 0.01 second intervals.
+ static void Notify(void *);
+};
+
+
+} // namespace crio
+} // namespace aos
+
+#endif