00001 #include <CCrateController.h>
00002 #include <CBD8210.h>
00003 #include <CCamacNimout.h>
00004 #include <CCAMACStatusModule.h>
00005 #include <CVMEStatusModule.h>
00006 #include <SpectroFramework.h>
00007 #include <CTimedEvent.h>
00008 #include <CTimer.h>
00009 #include <iostream.h>
00010
00011
00012
00013
00014 class CamacTestThread : public CTimedEvent
00015 {
00016 CBD8210 m_Branch;
00017 CCrateController m_Crate;
00018 CCAMACStatusModule m_Module;
00019 bool m_nValue;
00020 public:
00021 CamacTestThread(int nms, int b, int c, int n) :
00022 CTimedEvent(nms),
00023 m_Branch(b),
00024 m_Crate(b,c),
00025 m_Module(b,c,n),
00026 m_nValue(false)
00027 {
00028 m_Branch.InitBranch();
00029 m_Crate.InitializeCrate();
00030 }
00031 virtual void operator()();
00032 };
00033
00034 void
00035 CamacTestThread::operator()()
00036 {
00037
00038 if(m_nValue) {
00039 m_Module.GoBusy();
00040 }
00041 else {
00042 m_Module.GoClear();
00043 }
00044 m_nValue = !m_nValue;
00045 }
00046
00047
00048 class VMETestThread : public CTimedEvent
00049 {
00050 CVMEStatusModule m_Module;
00051 bool m_nValue;
00052 public:
00053 VMETestThread(int nms, unsigned int base):
00054 CTimedEvent(nms),
00055 m_Module(base),
00056 m_nValue(false)
00057 {
00058 }
00059 virtual void operator()();
00060 };
00061
00062 void
00063 VMETestThread::operator()()
00064 {
00065 if(m_nValue) {
00066 m_Module.GoBusy();
00067 }
00068 else {
00069 m_Module.GoClear();
00070 }
00071 m_nValue = !m_nValue;
00072 };
00073
00074 class MyApp : public DAQROCNode
00075 {
00076 int operator()(int argc, char** argv);
00077 };
00078
00079 MyApp app;
00080
00081
00082 int
00083 MyApp::operator()(int argc, char** argv)
00084 {
00085 CTimer Sched;
00086 CamacTestThread TheTest(100, 0, 2, 18);
00087 VMETestThread Vtest(100, 0x444400);
00088
00089 Sched.EstablishEvent(TheTest);
00090 Sched.EstablishEvent(Vtest);
00091 Sched.Start(100);
00092
00093 string input;
00094
00095 cin >> input;
00096
00097 exit(0);
00098
00099 }