Go to the documentation of this file.00001
00006
00007
00008 #ifndef NXYTER_FEBUTIL_H
00009 #define NXYTER_FEBUTIL_H
00010
00011 #include <iostream>
00012
00013 #include "roc/Board.h"
00014 #include "nxyter/FebBase.h"
00015 #include "nxyter/NxContext.h"
00016 #include "nxyter/QuickDaq.h"
00017 #include "nxyter/DistFuncArray.h"
00018 #include "nxyter/NxDataSummary.h"
00019
00020 namespace nxyter {
00021
00022 class FebUtil {
00023 protected:
00024 FebBase* fFeb;
00025 QuickDaq* fQdaq;
00026 int fLoopState;
00027 double fStartLoopTime;
00028 double fTestLoopTime;
00029 double fTestTime;
00030 uint64_t fLoopCount;
00031
00032 public:
00033 enum LoopState { kLoopStopped = 0,
00034 kLoopInterrupted,
00035 kLoopRunning
00036 };
00037
00039 struct RunCond {
00040 uint32_t npuls;
00041 uint32_t pulsperiod;
00042 int32_t pulswidth;
00043 RunCond() : npuls(0), pulsperiod(0), pulswidth(0)
00044 {}
00045 };
00046
00047
00048 explicit FebUtil(FebBase* feb, QuickDaq* qdaq=0);
00049 virtual ~FebUtil();
00050
00051 void startLoop(double time);
00052 bool testLoop();
00053 void interruptLoop();
00054 void stopLoop();
00055
00057
00062 uint64_t getLoopCount() const
00063 { return fLoopCount; }
00064
00066 double getStartLoopTime() const
00067 { return fStartLoopTime; }
00068
00070 double getTestLoopTime() const
00071 { return fStartLoopTime; }
00072
00074 int getLoopState() const
00075 { return fLoopState; }
00076
00077 int saveFeb(NxContext cntx[4], int domask=nxyter::kDoAll);
00078 int restoreFeb(NxContext cntx[4], int domask=nxyter::kDoAll);
00079
00080 int acquireTestTriggerData(int nxind, int npuls, DistFuncArray& dfa,
00081 bool cleardist=true);
00082 int acquireTestTriggerData(int nxind, int npuls, NxDataSummary& nds);
00083
00084 int acquireTestPulserData(int nxind, const NxContext& cntx,
00085 int npuls, DistFuncArray& dfa);
00086 int acquireTestPulserData(int nxind, const NxContext& cntx,
00087 int npuls, NxDataSummary& nds);
00088
00089 int testNxControlPath(int nxind, double time);
00090 int testNxRegisters(int nxind);
00091 int testMainAdcControlPath(double time);
00092 int testMainAdcDataPath(double time);
00093 int testFebControlPathCombo(double time);
00094
00095 static void probe(base::Board* board, bool verbose=true,
00096 std::ostream& os=std::cout);
00097 static double now();
00098 };
00099
00100 }
00101
00102 #endif