ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcdcsSEQ.hpp
Go to the documentation of this file.
1
7#ifndef ngcdcsSEQ_H
8#define ngcdcsSEQ_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15#include <ngc/core/ngcbAddr.h>
16#include <ngc/core/ngcbMOD.hpp>
18#include <ngc/core/ngcbDIC.hpp>
21
25#define ngcdcsSEQ_NGCII 0x00010000
26
30#define ngcdcsSEQ_MAX_PAT (ngcbSEQ_PATRAM_SIZE / 4)
31
35#define ngcdcsSEQ_MAX_STATES ngcbSEQ_PATRAM_SIZE
36
37/*
38 * Sequencer soft states
39 */
40#define ngcdcsSEQ_STAT_IDLE 0x00000000 //< sequencer idle state
41#define ngcdcsSEQ_STAT_WAITING 0x00000001 //< sequencer waiting state
42#define ngcdcsSEQ_STAT_RUNNING 0x00000002 //< sequencer running state
43#define ngcdcsSEQ_STAT_PAUSED 0x00000004 //< sequencer paused state
44#define ngcdcsSEQ_STAT_FAILURE 0x10000000 //< sequencer failure state
45
46/*
47 * Trigger modes
48 */
49#define ngcdcsSEQ_TRIGGERMODE_DIRECT 0x0 //< direct trigger mode
50#define ngcdcsSEQ_TRIGGERMODE_SHUTTER 0x1 //< shutter mode
51
52/*
53 * Sequencer control flags alignment
54 */
55#define ngcdcsSEQ_CTRL_DISABLE 0 //< disable sequencer control flags
56#define ngcdcsSEQ_CTRL_ALIGN 1 //< align sequencer control flags
57
63 unsigned int low;
64
66 unsigned int high;
67
69 int time;
70
72 int mod;
73
75 ngcdcs_pat_st_t() {low = 0x0; high = 0x0; time = 0; mod = 0;}
76};
77
82{
83public:
85 int addr;
86
89
92
94 int time;
95
97 char name[128];
98
101 addr = -1;
102 numStates = 0;
103 time = 0;
104 memset(name, 0, sizeof(name));
105 state = NULL;
106 }
107
109 virtual ~ngcdcs_pat_t() {}
110
111protected:
112private:
113};
114
119{
120public:
123
125 virtual ~ngcdcs_pat_ld_t() {delete[] state;}
126
127protected:
128private:
129};
130
135 int idx; //< Pattern index
136 char name[64]; //< Pattern name
137
139 ngcdcs_pat_assign_t() {idx = 0; name[0] = '\0';}
140};
141
146 char name[64]; //< Keyword name
147 char value[256]; //< Keyword value
148
150 ngcdcs_key_assign_t() {name[0] = '\0'; value[0] = '\0';}
151};
152
157 int sx; //< Start pixel in x-direction
158 int sy; //< Start pixel in y-direction
159 int nx; //< Window dimension in x-direction
160 int ny; //< Window dimension in y-direction
161 int dx; //< Chip dimension in x-direction
162 int dy; //< Chip dimension in y-direction
163 int rot; //< Rotation
164 int sx_flag; //< Start pixel in x-direction changed
165 int sy_flag; //< Start pixel in y-direction changed
166 int nx_flag; //< Dimension in x-direction changed
167 int ny_flag; //< Dimension in y-direction changed
168 int rot_flag; //< Rotation has changed
169
172 sx = 1; sy = 1;
173 nx = 0; ny = 0; // full size
174 rot = 0; dx = 0; dy = 0; // no rotation
175 sx_flag = 0; sy_flag = 0;
176 nx_flag = 0; ny_flag = 0;
177 rot_flag = 0;
178 }
179};
180
185{
186public:
188 double clock;
189
192
194 int cvtExt;
195
198
201
204
207
210
213
215 int status;
216
219
221 char clkFile[256];
222
224 char prgFile[256];
225
228
231
234
237
240
243
245 double realDit;
246
248 double tim;
249
252
254 int sync;
255
257 int convert[2];
258
261
264
267
270
273
275 FILE *sdebug;
276
278 ngcdcsSEQ0(const ngcb_route_t &r, int nc, int nb)
279 : ngcdcsCLDC0(r, nc, nb) {
280 Init_();
281 }
282
287 ngcdcsSEQ0(ngcbIFC *ifc, const ngcb_route_t &r, int nc, int nb)
288 : ngcdcsCLDC0(ifc, r, nc, nb) {
289 Init_();
290 }
291
293 virtual ~ngcdcsSEQ0() {}
294
296 virtual int Selftest() {
297 Verbose("ngcdcsSEQ%d: selftest\n", Instance()+1);
298 return (Success());
299 }
300
302 virtual int RunCtrl(int flag) {
303 runCtrl = flag;
304 return (Success());
305 }
306
308 virtual int CvtExt(int flag) {
309 cvtExt = flag;
310 return (Success());
311 }
312
314 virtual int Convert(int strobe, int flag) {
315 if ((strobe == 1) || (strobe == 2)) convert[strobe - 1] = flag;
316 return (Success());
317 }
318
320 virtual int SyncExt(int flag) {
321 syncExt = flag;
322 return (Success());
323 }
324
326 virtual int Start() {
327 numTrigger_ = 0;
329 return (Success());
330 }
331
333 virtual int Pause() {
335 return (Success());
336 }
337
339 virtual int Stop(int align, int force = 0) {
340 USE(align); USE(force);
342 return (Success());
343 }
344
346 virtual int Align() {return (Success());}
347
349 virtual int Disarm() {return (Success());}
350
352 virtual int Break(int trigger = 1) {
353 USE(trigger);
354 return (Stop(ngcdcsSEQ_CTRL_ALIGN, 1));
355 }
356
358 virtual int BreakTimeout(int force = 0) {
359 USE(force);
360 return (0);
361 }
362
364 virtual int Wait(int event, int timeout, int interval) {
365 USE(event); USE(timeout); USE(interval);
366 return (Success());
367 }
368
370 virtual int TriggerOn(int flag) {
371 triggerOn = flag;
372 return (Success());
373 }
374
376 virtual int TriggerMode(int mode) {
377 triggerMode = mode;
378 return (Success());
379 }
380
382 virtual int Trigger(int armed=1) {
383 USE(armed);
384 numTrigger_++;
385 return (Success());
386 }
387
389 virtual int ClearPrgFile() {
390 prgFile[0] = '\0';
391 return (Success());
392 }
393
395 virtual int LoadPrgFile(const char *fileName = NULL) {
396 if (fileName != NULL) str2str(prgFile, fileName, sizeof(prgFile) - 1);
397 return (Success());
398 }
399
401 virtual int Window(ngcdcs_win_t w) {
402 win.sx = w.sx; win.sy = w.sy; win.nx = w.nx; win.ny = w.ny;
403 win.rot = w.rot;
404 updateFlag = 1;
405 Verbose("ngcdcsSEQ%d: window is [%d,%d,%d,%d] - rot = %d\n",
406 Instance() + 1, win.sx, win.sy, win.nx, win.ny, win.rot);
407
408 return (Success());
409 }
410
412 virtual void NewStatus(int newStatus) {
413 status = newStatus;
414 switch (status)
415 {
417 {
418 strcpy(statStr_, "idle"); break;
419 }
421 {
422 strcpy(statStr_, "running"); break;
423 }
425 {
426 strcpy(statStr_, "paused"); break;
427 }
429 {
430 strcpy(statStr_, "waiting"); break;
431 }
433 {
434 strcpy(statStr_, "failure"); break;
435 }
436 default:
437 {
438 strcpy(statStr_, "unknown"); break;
439 }
440 }
441 }
442
444 virtual char *StatusString() {return statStr_;}
445
447 virtual int Status(int *s) {*s = 0x0; return (Success());}
448
450 virtual int RunningState() {
451 return ((status != ngcdcsSEQ_STAT_IDLE) &&
453 }
454
456 virtual int FailureState() {return (status == ngcdcsSEQ_STAT_FAILURE);}
457
459 virtual ngcb_evt_t Event(int stat) {
460 ngcb_evt_t e;
461 e.board = route.Board();
464 e.cond = 1;
465 switch (stat)
466 {
468 {
469 e.reference = e.mask;
470 break;
471 }
472 default:
473 {
474 e.reference = ~e.mask;
475 break;
476 }
477 }
478 return (e);
479 }
480
482 virtual int DwellTime(int f, int a) {
483 timeFactor = f; timeAdd = a;
484 return (Success());
485 }
486
488 virtual int TimeFactor(int f) {
489 timeFactor = f;
490 return (Success());
491 }
492
494 virtual int TimeAdd(int a) {
495 timeAdd = a;
496 return (Success());
497 }
498
500 virtual int SimSeqTiming() {return (Success());}
501
503 virtual int LoadClkFile(const char *fileName) {
504 USE(fileName);
505 return (Success());
506 }
507
509 virtual unsigned int NumTrigger() {return (0);}
510
515 virtual unsigned int BlindTrigger() {return (0);}
516
521 virtual unsigned int LostTrigger() {return (0);}
522
523protected:
524
525private:
527 char statStr_[32];
528
530 int numTrigger_;
531
533 void Init_() {
535 strcpy(statStr_, "idle");
536 clock = 10e-9; // default clock is 10 nanoseconds
537 runCtrl = 1;
538 cvtExt = 1;
539 breakMode = 0;
540 continuous = 0;
541 memset(clkFile, 0, sizeof(clkFile));
542 memset(prgFile, 0, sizeof(prgFile));
543 clkFile[0] = '\0';
544 prgFile[0] = '\0';
545 triggerOn = 0;
547 timeFactor = 1;
548 timeAdd = 0;
549 timeSim = 1;
550 updateFlag = 0;
551 useBreakTmo = 0;
552 triggerCtrl = 1;
553 numTrigger_ = 0;
554 realDit = 0.0;
555 tim = 0.0;
556 timAuto = 0;
557 autoStop = 1;
558 sync = 0x2; // disbled by default
559 stopDelay = 5; // 5 milliseconds
560 syncExt = 1;
561 convert[0] = 1;
562 convert[1] = 1;
563 dictionary = NULL;
564 dicParam = NULL;
565 sdebug = NULL;
566 optimize = 0;
567 }
568};
569
574{
575public:
577 explicit ngcdcsSEQ(const ngcb_route_t &r);
578
580 ngcdcsSEQ(ngcbIFC *ifc, const ngcb_route_t &r);
581
584
586 ngcdcsSEQ(ngcbIFC *ifc, const ngcb_route_t &r, ngcbPARAM_LIST *p);
587
589 virtual ~ngcdcsSEQ();
590
593
596
599
602
605
608
611
613 int pdu[4];
614
616 int packets[4];
617
620
622 int Selftest();
623
624 /*
625 * Clock patterns
626 */
627
629 int ClkState(int idx, int flag);
630
632 int ClkState(int idx);
633
635 int PatTime(const ngcdcs_pat_t &pat, int apply = 1);
636
638 int PatNumStates(const ngcdcs_pat_t &pat);
639
641 void StorePatSetup();
642
644 int RestorePatSetup();
645
647 int InitPat(int low, int high);
648
650 int InitPatLow(int value);
651
653 int InitPatHigh(int value);
654
656 int InitPatFirst(int n);
657
659 int InitPatLast(int n);
660
662 int InitPatLow();
663
665 int InitPatHigh();
666
668 int LastPat(int *low, int *high);
669
671 int FirstPat(int *low, int *high);
672
674 int SetupPat(int stopFlag = 1);
675
677 int SetPat(int idx, ngcdcs_pat_t &pat);
678
680 int GetPat(ngcdcs_pat_t *pat);
681
683 int GetPat(int idx, ngcdcs_pat_t *pat);
684
686 int CheckPatRam();
687
689 int GetState(int *low, int *high, int patNum, int stateNum);
690
692 int SetPatClk(int idx, int clkNum, const char *s);
693
695 void DumpPat(char *reply, const ngcdcs_pat_t &pat);
696
698 int DwellTime(int factor, int add);
699
701 int TimeFactor(int factor);
702
704 int TimeAdd(int add);
705
707 int LoadClkFile(const char *name);
708
710 int SaveClkFile(const char *fileName);
711
713 virtual int LoadClk(const char *fileName);
714
716 virtual int SaveClk(const char *fileName);
717
719 int Monitor(int num, int clkChan);
720
721 /*
722 * Sequencer program
723 */
724
726 int ExecTime(double *execTime);
727
729 int ExecTime(double *execTime, int *prgCode, int codeAddr, int length);
730
732 int ResolveSubRt(ngcdcs_seqp_t *prg);
733
735 int CleanLoop(ngcdcs_seqp_t *prg);
736
738 int CheckPrg(const ngcdcs_seqp_t &prg);
739
741 int CheckSeqRam();
742
744 int SetPrg(const ngcdcs_seqp_t &prg);
745
747 int GetPrg(ngcdcs_seqp_t *prg);
748
750 void DumpCode(char *reply, const ngcdcs_seqp_t &prg, int offset, int length);
751
753 int DumpPrg(char *reply, ngcdcs_seqp_t &prg, int n = -1);
754
756 int ClearPrgFile();
757
759 int LoadPrgFile(const char *name = NULL);
760
762 virtual int PrgFile(const char *fileName);
763
765 int Parameters(const char *fileName, char *list);
766
768 int MinPulse(double *min, int clkNum);
769
771 int PulseCnt(int *rising, int *falling, int clkNum);
772
774 int BreakTimeout(int force = 0);
775
777 int SimPrg(ngcdcsSEQ_EMU *emulator, ngcdcs_ticks_t start, int length);
778
780 int SimSeqTiming();
781
783 int SetPdu(int value, int chan = 0);
784
786 int SetPackets(int value, int chan = 0);
787
788 // Get RTMS frame configuration
789 int GetFramCfg(int *pduValue, int *packetsValue, int chan);
790
791 /*
792 * Sequencer control
793 */
794
796 void Reset();
797
799 int Enable(int check = 1);
800
802 int Disable();
803
805 int Convert(int strobe, int flag);
806
808 int TriggerOn(int flag);
809
811 int TriggerMode(int mode);
812
814 int RunCtrl(int flag);
815
817 int CvtExt(int flag);
818
820 int SyncExt(int flag);
821
823 int Start();
824
826 int Step();
827
829 int Stop(int align, int force = 0);
830
832 int Align();
833
835 int Disarm();
836
838 int Pause();
839
841 int Break(int trigger = 1);
842
844 int BreakWait(int timeout, int interval = 100);
845
846 // Poll with timeout until status matches event
847 int Wait(int event, int timeout, int interval = 100);
848
850 int Trigger(int armed = 1);
851
852
853 /*
854 * Status
855 */
856
858 void NewStatus(int newStatus);
859
861 char *StatusString();
862
864 int Status(int *hwStat);
865
867 ngcb_evt_t Event(int stat);
868
871 return ((status != ngcdcsSEQ_STAT_IDLE) &&
873 }
874
877
879 unsigned int NumTrigger() {return (numTrigger_);}
880
885 unsigned int BlindTrigger() {return (blindTrigger_);}
886
891 unsigned int LostTrigger() {return (lostTrigger_);}
892
894 virtual int LookupCB(const char *name, char *value);
895
897 int SlxEnable();
898
900 int SlxDisable();
901
903 int ShiftOut(const char *array, int numBits);
904
906 int ShiftOut(const int *array, int numBits);
907
909 int SlxSetup(const char *key, const int *idx, const char *value,
910 int *status = NULL);
911
913 int SlxStatus(const char *key, const int *idx, char *value,
914 int *status = NULL);
915
916protected:
917
918private:
920 void Init_();
921
923 int revision_;
924
926 ngcbPARAM_LIST *paramList_;
927
928
929 /*
930 * Clock patterns
931 */
932
935
938
940 ngcdcs_pat_t *pattern_;
941
943 int clkMask_[2];
944
946 int initPatLow_;
947
949 int initPatHigh_;
950
952 int initPatLow0_;
953
955 int initPatHigh0_;
956
958 int initPatNum_;
959
961 int autoInitDone_;
962
964 int InitPat_(int low, int high);
965
967 int AutoInit_();
968
970 int patStored_;
971
973 int WritePat_(const ngcdcs_pat_t &pat);
974
976 int LoadClkBin_(const char *fileName);
977
979 int SaveClkBin_(const char *fileName);
980
982 int LoadClkAscii_(const char *fileName);
983
985 int SaveClkAscii_(const char *fileName);
986
988 int ResetPatterns_(int clr = 0);
989
991 int ClockVal_(int c, const ngcdcs_pat_st_t &s);
992
994 int CheckDwellTime_(int factor, int add);
995
997 int LastPatNum_(const ngcdcs_seqp_t &prg, const int *code, int size);
998
1000 int FirstPatNum_(const ngcdcs_seqp_t &prg, const int *code, int size);
1001
1002
1003 /*
1004 * Sequencer program
1005 */
1006
1008 int seqRamClr_[3];
1009
1011 int seqRam_[ngcbSEQ_RAM_SIZE];
1012
1014 int breakTmo_;
1015
1017 int breakTmoFlag_;
1018
1020 int WritePrg_(const ngcdcs_seqp_t &prg);
1021
1023 int PrgFileBin_(const char *fileName);
1024
1026 int PrgFileAscii_(const char *fileName, char *setupBuf = NULL);
1027
1029 void AddSeqIdx_(char *keyWord);
1030
1032 void DelSeqIdx_(char *keyWord);
1033
1035 int Lookup_(const char *name, char *value);
1036
1038 ngcbPARAM *DynParam_(const char *name);
1039
1041 int CleanLoop_(int *code, int *codeLength);
1042
1044 int LdCode_(const char *fileName, int *code, int *length,
1045 ngcdcs_shift_t *shift, char *setupBuf = NULL);
1046
1048 int Script_(const char *shell, const char *script, FILE *dbg,
1049 ngcdcs_key_assign_t *defParam, int numDefParam,
1050 ngcdcs_key_assign_t *defSubRt, int numDefSubRt,
1051 ngcdcs_pat_assign_t *defPat, int numDefPat,
1052 ngcdcs_key_assign_t *newParam, int *numNewParam,
1053 int *loops);
1054
1056 int NumWaitStates_(int *prgCode, int codeAddr, int length, int *ret = NULL);
1057
1059 int BreakTimeout_(double *timeout);
1060
1061 /*
1062 * Status and monitoring
1063 */
1064
1066 unsigned int numTrigger_;
1067
1069 unsigned int blindTrigger_;
1070
1072 unsigned int lostTrigger_;
1073
1075 char statStr_[32];
1076
1078 int stopped_;
1079
1081 int firstRun_;
1082
1084 int Start_(int step = 0);
1085};
1086
1087#endif
Definition ngcbDIC.hpp:50
Definition ngcbIFC.hpp:754
ngcb_route_t route
Local route to module (header)
Definition ngcbMOD.hpp:30
virtual int Success()
Return success.
Definition ngcbOBJ.cpp:67
int Instance()
Get instance.
Definition ngcbOBJ.cpp:57
virtual void Verbose(int level, const char *format,...) __attribute__((format(printf
Verbose message if verbose level exceeds level.
Definition ngcbOBJ.cpp:73
Definition ngcbPARAM.hpp:200
Definition ngcbPARAM.hpp:40
ngcdcsCLDC0(const ngcb_route_t &r, int nc, int nb)
Constructor with route, number of clocks and number of biases.
Definition ngcdcsCLDC.hpp:212
virtual int LoadPrgFile(const char *fileName=NULL)
Load program file.
Definition ngcdcsSEQ.hpp:395
virtual int Start()
Start sequencer.
Definition ngcdcsSEQ.hpp:326
char clkFile[256]
Clock pattern file name.
Definition ngcdcsSEQ.hpp:221
virtual unsigned int LostTrigger()
Definition ngcdcsSEQ.hpp:521
int status
Soft state: idle, waiting, running or failure.
Definition ngcdcsSEQ.hpp:215
virtual int LoadClkFile(const char *fileName)
Load clock pattern file.
Definition ngcdcsSEQ.hpp:503
virtual int SyncExt(int flag)
Enable/disable external SYNC pulse.
Definition ngcdcsSEQ.hpp:320
ngcdcs_win_t win
Read-out window.
Definition ngcdcsSEQ.hpp:218
virtual int SimSeqTiming()
Simulate timing.
Definition ngcdcsSEQ.hpp:500
int timAuto
Automatic computation of minimum TIM-period.
Definition ngcdcsSEQ.hpp:251
int syncExt
External SYNC pulse.
Definition ngcdcsSEQ.hpp:197
virtual int TimeFactor(int f)
Set dwell-time factor.
Definition ngcdcsSEQ.hpp:488
virtual int BreakTimeout(int force=0)
Compute timeout for break command.
Definition ngcdcsSEQ.hpp:358
int timeAdd
Global dwell-time add.
Definition ngcdcsSEQ.hpp:236
ngcdcsSEQ0(const ngcb_route_t &r, int nc, int nb)
Constructor with route, number of clocks and number of biases.
Definition ngcdcsSEQ.hpp:278
virtual int FailureState()
Check if sequencer is in failure state.
Definition ngcdcsSEQ.hpp:456
int breakMode
Break mode.
Definition ngcdcsSEQ.hpp:200
virtual int Window(ngcdcs_win_t w)
Set read-out window.
Definition ngcdcsSEQ.hpp:401
int runCtrl
External run-control flag.
Definition ngcdcsSEQ.hpp:191
FILE * sdebug
Script debug stream.
Definition ngcdcsSEQ.hpp:275
virtual int Convert(int strobe, int flag)
Enable/disable convert strobe.
Definition ngcdcsSEQ.hpp:314
int stopDelay
Delay after sequencer stop/reset (ms)
Definition ngcdcsSEQ.hpp:242
virtual int TimeAdd(int a)
Set dwell-time add-value.
Definition ngcdcsSEQ.hpp:494
int triggerMode
Trigger mode.
Definition ngcdcsSEQ.hpp:230
virtual int RunningState()
Check if sequencer is in running state.
Definition ngcdcsSEQ.hpp:450
virtual int Status(int *s)
Get status value.
Definition ngcdcsSEQ.hpp:447
int triggerCtrl
Enable/disable automatic trigger control during break.
Definition ngcdcsSEQ.hpp:212
virtual void NewStatus(int newStatus)
Set new soft status.
Definition ngcdcsSEQ.hpp:412
ngcdcsSEQ0(ngcbIFC *ifc, const ngcb_route_t &r, int nc, int nb)
Definition ngcdcsSEQ.hpp:287
virtual int TriggerMode(int mode)
Set Trigger mode.
Definition ngcdcsSEQ.hpp:376
virtual ngcb_evt_t Event(int stat)
Return event configuration for status switch.
Definition ngcdcsSEQ.hpp:459
int convert[2]
Convert strobe enabled.
Definition ngcdcsSEQ.hpp:257
virtual int Stop(int align, int force=0)
Stop sequencer.
Definition ngcdcsSEQ.hpp:339
virtual int RunCtrl(int flag)
Ebnable/disable external run control.
Definition ngcdcsSEQ.hpp:302
int optimize
Optimize.
Definition ngcdcsSEQ.hpp:263
virtual int Align()
Align sequencer control flags.
Definition ngcdcsSEQ.hpp:346
int cvtExt
Exteranl convert.
Definition ngcdcsSEQ.hpp:194
virtual int TriggerOn(int flag)
Enable/disable external trigger.
Definition ngcdcsSEQ.hpp:370
virtual int Disarm()
Disable sequencer control flags.
Definition ngcdcsSEQ.hpp:349
virtual int Break(int trigger=1)
Stop sequencer at next break-point.
Definition ngcdcsSEQ.hpp:352
ngcbPARAM_LIST postSetup
Post-setup.
Definition ngcdcsSEQ.hpp:272
virtual int ClearPrgFile()
Clear program file.
Definition ngcdcsSEQ.hpp:389
int sync
Sequencer synchronized (generic flag)
Definition ngcdcsSEQ.hpp:254
virtual int Trigger(int armed=1)
Issue trigger command.
Definition ngcdcsSEQ.hpp:382
virtual int CvtExt(int flag)
Enable/disable external convert.
Definition ngcdcsSEQ.hpp:308
virtual int DwellTime(int f, int a)
Set dwell-time factor and add-value.
Definition ngcdcsSEQ.hpp:482
virtual int Selftest()
Selftest.
Definition ngcdcsSEQ.hpp:296
double realDit
Actual DIT.
Definition ngcdcsSEQ.hpp:245
ngcbDIC * dictionary
Pointer to dictionary;.
Definition ngcdcsSEQ.hpp:266
double tim
Minimum TIM-period.
Definition ngcdcsSEQ.hpp:248
ngcbPARAM_LIST * dicParam
Dictionary placeholders.
Definition ngcdcsSEQ.hpp:269
int continuous
Continuous mode flag.
Definition ngcdcsSEQ.hpp:203
virtual unsigned int BlindTrigger()
Definition ngcdcsSEQ.hpp:515
virtual char * StatusString()
Get status string.
Definition ngcdcsSEQ.hpp:444
virtual int Pause()
Pause sequencer.
Definition ngcdcsSEQ.hpp:333
double clock
Time of one clock tick.
Definition ngcdcsSEQ.hpp:188
char prgFile[256]
Sequencer program file name.
Definition ngcdcsSEQ.hpp:224
int autoStop
Automatic stop/start.
Definition ngcdcsSEQ.hpp:260
int timeFactor
Global dwell-time factor.
Definition ngcdcsSEQ.hpp:233
virtual unsigned int NumTrigger()
Return number of trigger commands since last start.
Definition ngcdcsSEQ.hpp:509
virtual ~ngcdcsSEQ0()
Destructor.
Definition ngcdcsSEQ.hpp:293
int timeSim
Enable sequence time simulation.
Definition ngcdcsSEQ.hpp:239
virtual int Wait(int event, int timeout, int interval)
Poll with timeout until status register matches event.
Definition ngcdcsSEQ.hpp:364
int triggerOn
Trigger enable flag.
Definition ngcdcsSEQ.hpp:227
int useBreakTmo
Use break-timeout.
Definition ngcdcsSEQ.hpp:209
int updateFlag
Flag to update the sequencer program.
Definition ngcdcsSEQ.hpp:206
Definition ngcdcsSEQ_PRG.hpp:204
int GetPrg(ngcdcs_seqp_t *prg)
Get sequencer program.
Definition ngcdcsSeqPrg.cpp:164
int SaveClkFile(const char *fileName)
Save clock pattern file.
Definition ngcdcsSeqClk.cpp:122
int FailureState()
Check if sequencer is in failure state.
Definition ngcdcsSEQ.hpp:876
int clkMon3
Clock on monitor 3.
Definition ngcdcsSEQ.hpp:607
int LoadClkFile(const char *name)
Load clock pattern file.
Definition ngcdcsSeqClk.cpp:26
void Reset()
Align soft-states after reset.
Definition ngcdcsSEQ.cpp:206
int Pause()
Pause sequencer.
Definition ngcdcsSEQ.cpp:1824
int SetPackets(int value, int chan=0)
Set packets per frame per channel.
Definition ngcdcsSeqPrg.cpp:4440
unsigned int BlindTrigger()
Definition ngcdcsSEQ.hpp:885
int packets[4]
Payload packets per frame.
Definition ngcdcsSEQ.hpp:616
int SetPrg(const ngcdcs_seqp_t &prg)
Set sequencer program.
Definition ngcdcsSeqPrg.cpp:121
int Parameters(const char *fileName, char *list)
Get used parameters from file.
Definition ngcdcsSeqPrg.cpp:3639
virtual int LoadClk(const char *fileName)
Clock pattern file loader.
Definition ngcdcsSeqClk.cpp:165
int ShiftOut(const char *array, int numBits)
Copy byte array to shift register.
Definition ngcdcsSeqSlx.cpp:26
int Enable(int check=1)
Call-back at transition to operational state.
Definition ngcdcsSEQ.cpp:216
int CheckSeqRam()
Verify sequencer program RAM consistency.
Definition ngcdcsSeqPrg.cpp:194
int softMon
Use soft monitor for digital clocks.
Definition ngcdcsSEQ.hpp:610
int PulseCnt(int *rising, int *falling, int clkNum)
Compute number of edges on clock.
Definition ngcdcsSEQ.cpp:2443
int Step()
Run til next break-point.
Definition ngcdcsSEQ.cpp:1049
int DumpPrg(char *reply, ngcdcs_seqp_t &prg, int n=-1)
Dump program to string.
Definition ngcdcsSeqPrg.cpp:4173
ngcdcs_pat_t * pattern
Clock pattern setup.
Definition ngcdcsSEQ.hpp:592
void StorePatSetup()
Store patterns to private copy.
Definition ngcdcsSeqPat.cpp:997
int LoadPrgFile(const char *name=NULL)
Load sequencer program file.
Definition ngcdcsSeqPrg.cpp:309
int TimeFactor(int factor)
Set global dwell-time factor.
Definition ngcdcsSeqPat.cpp:809
int SetPatClk(int idx, int clkNum, const char *s)
Set specific clock timing.
Definition ngcdcsSeqPat.cpp:1382
int clkMon1
Clock on monitor 1.
Definition ngcdcsSEQ.hpp:601
int InitPatFirst(int n)
Init with first state of pattern.
Definition ngcdcsSeqPat.cpp:603
int GetFramCfg(int *pduValue, int *packetsValue, int chan)
Definition ngcdcsSeqPrg.cpp:4491
int Disarm()
Disable sequencer control flags.
Definition ngcdcsSEQ.cpp:1277
int Start()
Start sequencer.
Definition ngcdcsSEQ.cpp:1044
int BreakWait(int timeout, int interval=100)
Poll with timeout until break-point is reached.
Definition ngcdcsSEQ.cpp:1317
virtual int SaveClk(const char *fileName)
Clock pattern file saver.
Definition ngcdcsSeqClk.cpp:173
int Break(int trigger=1)
Stop sequencer at next breakpoint.
Definition ngcdcsSEQ.cpp:1338
int Disable()
Call-back at transition to not operational state.
Definition ngcdcsSEQ.cpp:397
void NewStatus(int newStatus)
Set new soft status.
Definition ngcdcsSEQ.cpp:746
int SimSeqTiming()
Simulate sequence timing.
Definition ngcdcsSEQ.cpp:3138
int ClkState(int idx, int flag)
Enable/disable clock.
Definition ngcdcsSeqClk.cpp:1368
int BreakTimeout(int force=0)
Compute timeout for break command.
Definition ngcdcsSEQ.cpp:3125
int SimPrg(ngcdcsSEQ_EMU *emulator, ngcdcs_ticks_t start, int length)
Program Simulator.
Definition ngcdcsSeqPrg.cpp:4264
char * StatusString()
Get status string.
Definition ngcdcsSEQ.cpp:797
virtual int PrgFile(const char *fileName)
Sequencer program loader.
Definition ngcdcsSeqPrg.cpp:525
int RestorePatSetup()
Restore patterns from private copy.
Definition ngcdcsSeqPat.cpp:1028
int InitPatLow()
Get actual initial pattern (low)
Definition ngcdcsSeqPat.cpp:735
ngcdcsSEQ(const ngcb_route_t &r)
Constructor with route.
Definition ngcdcsSEQ.cpp:27
int CheckPrg(const ngcdcs_seqp_t &prg)
Check and cleanup program.
Definition ngcdcsSeqPrg.cpp:92
int Wait(int event, int timeout, int interval=100)
Poll with timeout until status register matches event.
Definition ngcdcsSEQ.cpp:1496
ngcdcs_slxcfg_t slx
SELEX configuration.
Definition ngcdcsSEQ.hpp:619
int Monitor(int num, int clkChan)
Set channel for clock-monitor.
Definition ngcdcsSEQ.cpp:1891
int DwellTime(int factor, int add)
Set global dwell-time factor+add.
Definition ngcdcsSeqPat.cpp:871
int SyncExt(int flag)
Enable/disable external SYNC pulse.
Definition ngcdcsSEQ.cpp:685
int CvtExt(int flag)
Enable/disable external convert.
Definition ngcdcsSEQ.cpp:624
int GetState(int *low, int *high, int patNum, int stateNum)
Get pattern state.
Definition ngcdcsSeqPat.cpp:1321
int FirstPat(int *low, int *high)
Get first executed clock state.
Definition ngcdcsSeqPat.cpp:557
int SlxEnable()
Enable SELEX serial interface.
Definition ngcdcsSeqSlx.cpp:162
int SetupPat(int stopFlag=1)
Upload all defined patterns.
Definition ngcdcsSeqPat.cpp:933
void DumpCode(char *reply, const ngcdcs_seqp_t &prg, int offset, int length)
Dump piece of prg-code.
Definition ngcdcsSeqPrg.cpp:3958
int SetPat(int idx, ngcdcs_pat_t &pat)
Set a clock pattern.
Definition ngcdcsSeqPat.cpp:1062
int ClearPrgFile()
Clear program file.
Definition ngcdcsSeqPrg.cpp:249
int PatTime(const ngcdcs_pat_t &pat, int apply=1)
Compute pattern time.
Definition ngcdcsSeqPat.cpp:745
int RunCtrl(int flag)
Enable/disable external run-control.
Definition ngcdcsSEQ.cpp:563
int PatNumStates(const ngcdcs_pat_t &pat)
Compute number of states.
Definition ngcdcsSeqPat.cpp:792
int SetPdu(int value, int chan=0)
Set payload data units per channel.
Definition ngcdcsSeqPrg.cpp:4395
int SlxSetup(const char *key, const int *idx, const char *value, int *status=NULL)
SELEX setup.
Definition ngcdcsSeqSlx.cpp:200
int TriggerMode(int mode)
Select trigger mode.
Definition ngcdcsSEQ.cpp:500
int ResolveSubRt(ngcdcs_seqp_t *prg)
Resolve subroutines.
Definition ngcdcsSeqPrg.cpp:3835
int autoInit
Automatic clock pattern initialization.
Definition ngcdcsSEQ.hpp:598
int clkMon2
Clock on monitor 2.
Definition ngcdcsSEQ.hpp:604
int GetPat(ngcdcs_pat_t *pat)
Get a clock pattern by address.
Definition ngcdcsSeqPat.cpp:1240
virtual int LookupCB(const char *name, char *value)
Parameter lookup.
Definition ngcdcsSeqPrg.cpp:676
int Align()
Align sequencer control flags.
Definition ngcdcsSEQ.cpp:1211
int CleanLoop(ngcdcs_seqp_t *prg)
Remove zero loops etc. in sequencer program.
Definition ngcdcsSeqOptimize.cpp:195
int Status(int *hwStat)
Get status value.
Definition ngcdcsSEQ.cpp:802
int RunningState()
Check if sequencer is in running state.
Definition ngcdcsSEQ.hpp:870
int MinPulse(double *min, int clkNum)
Compute minimum pulse distance on clock.
Definition ngcdcsSEQ.cpp:2272
ngcdcs_seqp_t program
Sequencer program.
Definition ngcdcsSEQ.hpp:595
int SlxStatus(const char *key, const int *idx, char *value, int *status=NULL)
SELEX status.
Definition ngcdcsSeqSlx.cpp:521
int Trigger(int armed=1)
Send trigger command to sequencer.
Definition ngcdcsSEQ.cpp:1710
int LastPat(int *low, int *high)
Get last executed clock state.
Definition ngcdcsSeqPat.cpp:511
int Convert(int strobe, int flag)
Enable/disable convert strobe.
Definition ngcdcsSeqPat.cpp:908
unsigned int LostTrigger()
Definition ngcdcsSEQ.hpp:891
virtual ~ngcdcsSEQ()
Destructor.
Definition ngcdcsSEQ.cpp:57
int Stop(int align, int force=0)
Stop sequencer.
Definition ngcdcsSEQ.cpp:1054
int InitPatLast(int n)
Init with last state of pattern.
Definition ngcdcsSeqPat.cpp:640
int TimeAdd(int add)
Set global dwell-time add.
Definition ngcdcsSeqPat.cpp:840
int InitPatHigh()
Get actual initial pattern (high)
Definition ngcdcsSeqPat.cpp:740
int ExecTime(double *execTime)
Compute program execution time.
Definition ngcdcsSEQ.cpp:1958
int SlxDisable()
Disable SELEX serial interface.
Definition ngcdcsSeqSlx.cpp:181
void DumpPat(char *reply, const ngcdcs_pat_t &pat)
Dump pattern to string.
Definition ngcdcsSeqPat.cpp:1545
unsigned int NumTrigger()
Return number of trigger commands since last start.
Definition ngcdcsSEQ.hpp:879
int CheckPatRam()
Verify sequencer pattern RAM consistency.
Definition ngcdcsSeqPat.cpp:1571
int pdu[4]
Payload data units.
Definition ngcdcsSEQ.hpp:613
int Selftest()
Selftest.
Definition ngcdcsSeqSelftest.cpp:26
ngcb_evt_t Event(int stat)
Return event configuration for status switch.
Definition ngcdcsSEQ.cpp:910
int InitPat(int low, int high)
Set default initial pattern.
Definition ngcdcsSeqPat.cpp:677
int TriggerOn(int flag)
Enable/disable trigger mode.
Definition ngcdcsSEQ.cpp:431
ngcdcs_pat_ld_t()
Constructor.
Definition ngcdcsSEQ.hpp:122
virtual ~ngcdcs_pat_ld_t()
Destructor.
Definition ngcdcsSEQ.hpp:125
Definition ngcdcsSEQ.hpp:82
ngcdcs_pat_st_t * state
States array pointer.
Definition ngcdcsSEQ.hpp:88
int numStates
Number of states in this pattern.
Definition ngcdcsSEQ.hpp:91
int addr
Address (relative to RAM base)
Definition ngcdcsSEQ.hpp:85
ngcdcs_pat_t()
Constructor.
Definition ngcdcsSEQ.hpp:100
char name[128]
Pattern name.
Definition ngcdcsSEQ.hpp:97
int time
Clock pattern execution time in ticks.
Definition ngcdcsSEQ.hpp:94
virtual ~ngcdcs_pat_t()
Destructor.
Definition ngcdcsSEQ.hpp:109
#define ngcbDFE_STAT_SEQ
Definition ngcbAddr.h:86
#define ngcbDFE_ADDR_STAT
Definition ngcbAddr.h:34
#define ngcbSEQ_RAM_SIZE
Definition ngcbAddr.h:277
#define ngcbSEQ_PATRAM_SIZE
Definition ngcbAddr.h:282
#define str2str(s1, s2, n)
Definition ngcb.h:73
#define USE(x)
Definition ngcb.h:28
#define ngcdcsSEQ_STAT_RUNNING
Definition ngcdcsSEQ.hpp:42
#define ngcdcsSEQ_STAT_IDLE
Definition ngcdcsSEQ.hpp:40
#define ngcdcsSEQ_STAT_WAITING
Definition ngcdcsSEQ.hpp:41
#define ngcdcsSEQ_STAT_PAUSED
Definition ngcdcsSEQ.hpp:43
#define ngcdcsSEQ_STAT_FAILURE
Definition ngcdcsSEQ.hpp:44
#define ngcdcsSEQ_CTRL_ALIGN
Definition ngcdcsSEQ.hpp:56
#define ngcdcsSEQ_TRIGGERMODE_DIRECT
Definition ngcdcsSEQ.hpp:49
#define ngcdcsSEQ_MAX_STATES
Definition ngcdcsSEQ.hpp:35
Definition ngcbIFC.hpp:514
int addr
Address.
Definition ngcbIFC.hpp:519
int board
Board number (1, ...)
Definition ngcbIFC.hpp:516
int mask
32-bit mask
Definition ngcbIFC.hpp:522
int reference
32-bit reference value
Definition ngcbIFC.hpp:525
int cond
Condition: 0 = match any, 1 = match all (default)
Definition ngcbIFC.hpp:528
Definition ngcbIFC.hpp:72
Definition ngcdcsSEQ.hpp:145
ngcdcs_key_assign_t()
Constructor.
Definition ngcdcsSEQ.hpp:150
char value[256]
Definition ngcdcsSEQ.hpp:147
char name[64]
Definition ngcdcsSEQ.hpp:146
Definition ngcdcsSEQ.hpp:134
int idx
Definition ngcdcsSEQ.hpp:135
ngcdcs_pat_assign_t()
Constructor.
Definition ngcdcsSEQ.hpp:139
char name[64]
Definition ngcdcsSEQ.hpp:136
Definition ngcdcsSEQ.hpp:61
unsigned int high
Pattern state high.
Definition ngcdcsSEQ.hpp:66
int time
Pattern state dwell-time (in ticks)
Definition ngcdcsSEQ.hpp:69
int mod
Allow global dewll time modification.
Definition ngcdcsSEQ.hpp:72
ngcdcs_pat_st_t()
Constructor.
Definition ngcdcsSEQ.hpp:75
unsigned int low
Pattern state low.
Definition ngcdcsSEQ.hpp:63
Definition ngcdcsSEQ_PRG.hpp:117
Definition ngcdcsSLX.hpp:84
Definition ngcdcsSLX.hpp:136
Definition ngcdcsSEQ_PRG.hpp:21
Definition ngcdcsSEQ.hpp:156
int sx_flag
Definition ngcdcsSEQ.hpp:164
int ny_flag
Definition ngcdcsSEQ.hpp:167
int nx_flag
Definition ngcdcsSEQ.hpp:166
int dx
Definition ngcdcsSEQ.hpp:161
int rot
Definition ngcdcsSEQ.hpp:163
int nx
Definition ngcdcsSEQ.hpp:159
int dy
Definition ngcdcsSEQ.hpp:162
ngcdcs_win_t()
Constructor.
Definition ngcdcsSEQ.hpp:171
int sy
Definition ngcdcsSEQ.hpp:158
int sy_flag
Definition ngcdcsSEQ.hpp:165
int ny
Definition ngcdcsSEQ.hpp:160
int rot_flag
Definition ngcdcsSEQ.hpp:168
int sx
Definition ngcdcsSEQ.hpp:157