00001
00002
00003 #ifndef SCTPIXELROD_TIMSEQUIN_H
00004 #define SCTPIXELROD_TIMSEQUIN_H
00005
00021 #include "TimDefine.h"
00022
00023 namespace SctPixelRod {
00024
00025
00026
00028
00029 struct TimScanControl {
00030 int size;
00031 int byte;
00032 int print;
00033 int offset;
00034 int orbit;
00035 int pipeline;
00036 int nextL1ID;
00037 int nextBCID;
00038 int nextTTID;
00039 };
00040
00041
00042
00044
00045 struct TimScanResults {
00046 int lastL1ID;
00047 int lastBCID;
00048 int lastTTID;
00049 int indexL1A;
00050 int countL1A;
00051 int countECR;
00052 int countBCR;
00053 int countCAL;
00054 int bitCount;
00055 int errors;
00056 };
00057
00058
00059
00061
00067 class TimSequin {
00068
00069 public:
00070
00073
00074 TimSequin();
00075 ~TimSequin();
00076
00077
00078
00079 int getBuffer( const UINT16 size, UINT16 buffer[] );
00080 int setBuffer( const UINT16 size, const UINT16 buffer[] );
00081
00082 int getLength() { return m_size; };
00083 void setOffset( const int offset ) { m_offset = offset; };
00084
00085
00086
00087 void addByBunch( const TimBitBackplane mask, const int bcid );
00088 void addByIndex( const TimBitBackplane mask, const int index );
00089 void addTrigger( const int index, const UINT32 ids[3], const int delays[2] );
00090
00091 void fill( const UINT16 size, const UINT16 value );
00092
00093 int getBCID( const int iL1A, const int iBCR, const int offset );
00094 int getIndex( const int bcid, const int iBCR, const int offset );
00095
00096 void reset();
00097 int scanRun();
00098
00099 TimScanResults scan( const TimScanControl control );
00100 TimScanControl scanDefaults();
00101
00102 private:
00103
00104 void m_scanError( const char *s, const int x, const int y );
00105 void m_scanPrintCMD( const char *s, const int x, const int y,
00106 const char *c );
00107 void m_scanPrintL1A( const int index, const int start[2], const int stop[2],
00108 const int bcid, const int l1id, const int ttid );
00109
00110 UINT16 m_buffer[ TIM_SEQ_SIZE ];
00111
00112 INT32 m_l1id;
00113 int m_lastBCR;
00114 int m_size;
00115 int m_offset;
00116 int m_scanErrors;
00117
00118 };
00119
00120 }
00121
00122 #endif // SCTPIXELROD_TIMSEQUIN_H