12#error This is a C++ include file and cannot be used from plain C
33#define ngcdcsSLX_MAX_WIN 48
38#define ngcdcsSLX_MCR_CHAN 0x03
39#define ngcdcsSLX_MCR_CHAN4 0x00
40#define ngcdcsSLX_MCR_CHAN8 0x01
41#define ngcdcsSLX_MCR_CHAN16 0x02
42#define ngcdcsSLX_MCR_CHAN32 0x03
43#define ngcdcsSLX_MCR_EXTRST 0x04
44#define ngcdcsSLX_MCR_NO_REF 0x08
45#define ngcdcsSLX_MCR_CB_REF_EN 0x10
46#define ngcdcsSLX_MCR_CB_EN 0x20
47#define ngcdcsSLX_MCR_LSP_EN 0x40
48#define ngcdcsSLX_MCR_NO_CLAMP 0x80
53#define ngcdcsSLX_RM_ITR 0x00
54#define ngcdcsSLX_RM_RR 0x01
55#define ngcdcsSLX_RM_RDRSTRD 0x02
60#define ngcdcsSLX_DCR_RM 0x0f
61#define ngcdcsSLX_DCR_SELECT 0xf0
62#define ngcdcsSLX_DCR_MCR 0x10
63#define ngcdcsSLX_DCR_WDR 0x20
64#define ngcdcsSLX_DCR_WRR 0x40
69#define ngcdcsSLX_NROW 256
74#define ngcdcsSLX_NCOL 320
79#define ngcdcsSLX_NCOL_NO_REF 256
101 if ((
numBits % 8) > 0) numBytes++;
103 if ((numBytes % 4) > 0) n++;
226#define ngcdcsSHIFT_MAX 32
295 dcr_ |= (char)readMode_;
303 char DCR() {
return (dcr_);}
307 mcr_ = (char)(value & 0xff);
319 char MCR() {
return (mcr_);}
328 void ClearCfg() {rmX_ = 0; wdrX_ = 0; wrrX_ = 0; mcrX_ = 0;}
359 shift[n].numBits = 8;
374 shift[n].numBits = 8;
393 shift[n].numBits = 8;
409 shift[n].numBits = 8;
420 int Key(
const char *name,
const char *value) {
429 for (n=0;n<(int)strlen(v);n++)
431 if ((v[n] ==
'_') || (v[n] ==
',') || (v[n] ==
'|')) v[n] =
' ';
437 sprintf(
ErrMsg(),
"invalid keyword <%s> - %s", name,
443 if (strcmp(tmp,
"SLX.ENA") == 0)
445 if (strcmp(v,
"T") == 0)
enabled = 1;
446 else if (strcmp(v,
"F") == 0)
enabled = 0;
449 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
453 else if (strcmp(tmp,
"SLX.MCR") == 0)
458 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
463 else if (strcmp(tmp,
"SLX.REFPIX") == 0)
470 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
475 else if (strcmp(tmp,
"SLX.EXTRST") == 0)
482 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
487 else if (strcmp(tmp,
"SLX.CBENA") == 0)
494 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
499 else if (strcmp(tmp,
"SLX.CBREFENA") == 0)
506 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
511 else if (strcmp(tmp,
"SLX.LSPENA") == 0)
518 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
523 else if (strcmp(tmp,
"SLX.CLAMP") == 0)
530 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
535 else if (strcmp(tmp,
"SLX.MODE") == 0)
543 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
547 else if (strcmp(tmp,
"SLX.WIN") == 0)
550 else if (strcmp(v,
"T") == 0)
fullFrame = 0;
554 if (sscanf(v,
"%10d", &intVal) < 1)
556 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
563 else if (strcmp(tmp,
"SLX.DCOL") == 0)
567 sprintf(
ErrMsg(),
"column index out of range [1,10]");
570 if (strcmp(v,
"T") == 0)
576 else if (strcmp(v,
"F") == 0)
584 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
588 else if (strcmp(tmp,
"SLX.RCOL") == 0)
592 sprintf(
ErrMsg(),
"column index out of range [1,10]");
595 if (strcmp(v,
"T") == 0)
601 else if (strcmp(v,
"F") == 0)
609 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
613 else if (strcmp(tmp,
"SLX.COL") == 0)
617 sprintf(
ErrMsg(),
"column index out of range [1,10]");
620 if (strcmp(v,
"T") == 0)
635 else if (strcmp(v,
"F") == 0)
652 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
656 else if (strcmp(tmp,
"SLX.ROW") == 0)
659 if (sscanf(v,
"%10d %10d", &sy, &ny) < 2)
661 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
669 else if (strcmp(tmp,
"SLX.DROW") == 0)
672 if (sscanf(v,
"%10d %10d", &sy, &ny) < 2)
674 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
680 else if (strcmp(tmp,
"SLX.RROW") == 0)
683 if (sscanf(v,
"%10d %10d", &sy, &ny) < 2)
685 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
749 void GetDim(
int *sx,
int *sy,
int *nx,
int *ny) {
752 *sx = 1; *sy = 1; *nx = 0; *ny = 0;
757 if (wdrCol_[0] & (1 << j)) (*nx) += 32;
758 else if (*nx == 0) (*sx) += 32;
760 if (wdrCol_[1] & 0x1) (*nx) += 32;
761 else if (*nx == 0) (*sx) += 32;
767 if (wdrCol_[0] & (1 << j)) (*nx) += 32;
768 else if (*nx == 0) (*sx) += 32;
772 if (wdrCol_[1] & (1 << j)) (*nx) += 32;
773 else if (*nx == 0) (*sx) += 32;
781 if (wdrRow_[i] & (1 << j)) (*ny)++;
782 else if (*ny == 0) (*sy)++;
788 int DCOL() {
return (wdrCol_[0] | wdrCol_[1] << 8);}
791 int RCOL() {
return (wrrCol_[0] | wrrCol_[1] << 8);}
823 shiftReg[0] = (dcr_ & 0xff) | (mcr_ & 0xff) << 8;
833 Win2Shift_(wdrRow_, wdrCol_);
842 Win2Shift_(wrrRow_, wrrCol_);
849 wdrCol_[0] = (char)0xff; wdrCol_[1] = (char)0x3;
850 memset(wdrRow_, 0xff,
sizeof(wdrRow_));
856 wrrCol_[0] = (char)0xff; wrrCol_[1] = (char)0x3;
857 memset(wrrRow_, 0xff,
sizeof(wdrRow_));
863 memset(wdrCol_, 0x00,
sizeof(wdrCol_));
864 memset(wdrRow_, 0x00,
sizeof(wdrRow_));
870 memset(wrrCol_, 0x00,
sizeof(wdrCol_));
871 memset(wrrRow_, 0x00,
sizeof(wdrRow_));
877 AdjustRow_(&sy, &ny);
878 Row2Reg_(sy, ny, wdrRow_);
883 AdjustRow_(&sy, &ny);
884 Row2Reg_(sy, ny, wrrRow_);
888 void WDRCOL_ON() {wdrCol_[0] = (char)0xff; wdrCol_[1] = (char)0x3;}
891 void WRRCOL_ON() {wrrCol_[0] = (char)0xff; wrrCol_[1] = (char)0x3;}
894 void WDRCOL_OFF() {wdrCol_[0] = (char)0x0; wdrCol_[1] = (char)0x0;}
897 void WRRCOL_OFF() {wrrCol_[0] = (char)0x0; wrrCol_[1] = (char)0x0;}
949 void AdjustRow_(
int *sy,
int *ny) {
950 if (*sy < 0) *sy = 0;
956 void Col2Reg_(
int n,
char *reg) {
959 if (n > 7) reg[1] |= (char)(1 << (n - 8));
960 else reg[0] |= (char)(1 << n);
964 void ColRemove_(
int n,
char *reg) {
965 if ((n < 0) || (n > 9))
return;
966 if (n > 7) reg[1] &= (char)~(1 << (n - 8));
967 else reg[0] &= (char)~(1 << n);
971 void Row2Reg_(
int start,
int n,
char *reg) {
976 r = reg + (start / 8);
977 for (i=start;i<(start+n);i++)
979 *r |= (char)(1 << s);
986 void Reg2Row_(
char *reg, ngcdcs_slxrow_t *w) {
996 if (reg[i] & (1 << j)) ny++;
997 else if (ny == 0) sy++;
1010 void Win2Shift_(
char *wr,
char *wc) {
1019 *r |= (wr[i] & 0xff) << s;
1026 char b = (char)(((wc[0] >> 1) & 0x7f) | ((wc[1] & 0x1) << 7));
1027 *r |= (b & 0xff) << s;
1032 *r |= (wc[0] & 0xff) << s;
1035 *r |= (wc[1] & 0xff) << s;
int fullFrame
Full frame readout.
Definition ngcdcsSLX.hpp:237
void WDRROW(int sy, int ny)
Map window to row data registers.
Definition ngcdcsSLX.hpp:876
void WDRALL()
Enable all pixels in WDR.
Definition ngcdcsSLX.hpp:848
int RCOL()
Definition ngcdcsSLX.hpp:791
void WRRCLR()
Clear all pixels in WRR.
Definition ngcdcsSLX.hpp:869
void ClearCfg()
Clear configuration flags.
Definition ngcdcsSLX.hpp:328
void WRRROW(int sy, int ny)
Map window to row reset registers.
Definition ngcdcsSLX.hpp:882
int DCOL()
Definition ngcdcsSLX.hpp:788
void WRRCOL_ON()
Enable all reset-columns in WDR.
Definition ngcdcsSLX.hpp:891
void MCR(int value)
Preset MCR value.
Definition ngcdcsSLX.hpp:306
char DCR()
Return detector control register.
Definition ngcdcsSLX.hpp:303
char MCR()
Return multiplexer control register.
Definition ngcdcsSLX.hpp:319
void WRRALL()
Enable all pixels in WRR.
Definition ngcdcsSLX.hpp:855
void WDRCOL_ON(int n)
Enable data-column in WDR.
Definition ngcdcsSLX.hpp:900
void WDRCLR()
Clear all pixels in WDR.
Definition ngcdcsSLX.hpp:862
int shiftReg[ngcbSEQ_SHRAM_SIZE]
Shift register.
Definition ngcdcsSLX.hpp:801
ngcdcs_shift_t shift[ngcdcsSHIFT_MAX]
Pennding shift register instructions.
Definition ngcdcsSLX.hpp:234
void RM2REG(int nextSelect=0)
Push read-out mode to shift register.
Definition ngcdcsSLX.hpp:807
void Preset(ngcdcs_slxcfg_t &cfg)
Preset with external configuration.
Definition ngcdcsSLX.hpp:696
ngcdcsSLX()
Constructor.
Definition ngcdcsSLX.hpp:243
void WRRCOL_OFF()
Disable all reset-columns in WDR.
Definition ngcdcsSLX.hpp:897
void WRRCOL_OFF(int n)
Disable reset-column in WDR.
Definition ngcdcsSLX.hpp:909
void WRRCOL_ON(int n)
Enable reset-column in WDR.
Definition ngcdcsSLX.hpp:903
virtual ~ngcdcsSLX()
Definition ngcdcsSLX.hpp:286
void WDR2REG(int nextSelect=0)
Push WDR to shift register.
Definition ngcdcsSLX.hpp:830
void RROW(ngcdcs_slxrow_t *w)
Definition ngcdcsSLX.hpp:797
void DROW(ngcdcs_slxrow_t *w)
Definition ngcdcsSLX.hpp:794
void WDRCOL_OFF(int n)
Disable data-column in WDR.
Definition ngcdcsSLX.hpp:906
void ClearWin()
Clear window mappings.
Definition ngcdcsSLX.hpp:325
char * ErrMsg()
Return global error message.
Definition ngcdcsSLX.hpp:289
int shiftRegSize
Number of bits in shift register.
Definition ngcdcsSLX.hpp:804
void FullFrame()
Full frame read-out.
Definition ngcdcsSLX.hpp:322
void GetDim(int *sx, int *sy, int *nx, int *ny)
Definition ngcdcsSLX.hpp:749
void Configure()
Configure shift register instructions.
Definition ngcdcsSLX.hpp:331
void ReadMode(int mode)
Preset read-out mode.
Definition ngcdcsSLX.hpp:292
void MCR2REG(int nextSelect=0)
Push MCR to shift register.
Definition ngcdcsSLX.hpp:814
int ReadMode()
Return read-out mode.
Definition ngcdcsSLX.hpp:300
void WDRCOL_OFF()
Disable all data-columns in WDR.
Definition ngcdcsSLX.hpp:894
int Key(const char *name, const char *value)
Parse setup key.
Definition ngcdcsSLX.hpp:420
int enabled
SELEX interface enabled.
Definition ngcdcsSLX.hpp:240
void WDRCOL_ON()
Enable all data-columns in WDR.
Definition ngcdcsSLX.hpp:888
void WRR2REG(int nextSelect=0)
Push WRR to shift register.
Definition ngcdcsSLX.hpp:839
#define ngcbSEQ_SHRAM_SIZE
Definition ngcbAddr.h:180
int ngcbFmt2Int(const char *s, int *value)
Definition ngcbString.c:235
int ngcbKeyIdx(char *key, int *nsplit, int *kval, char *erms)
Definition ngcbKey.c:375
#define ngcbSUCCESS
Definition ngcb.h:137
void ngcbToLower(char *s)
Definition ngcbString.c:27
#define ngcbFAILURE
Definition ngcb.h:139
#define ngcdcsSLX_MCR_NO_REF
Definition ngcdcsSLX.hpp:44
#define ngcdcsSLX_MCR_CHAN
Definition ngcdcsSLX.hpp:38
#define ngcdcsSLX_RM_RR
Definition ngcdcsSLX.hpp:54
#define ngcdcsSLX_DCR_WDR
Definition ngcdcsSLX.hpp:63
#define ngcdcsSLX_DCR_WRR
Definition ngcdcsSLX.hpp:64
#define ngcdcsSLX_MCR_CB_REF_EN
Definition ngcdcsSLX.hpp:45
#define ngcdcsSLX_MCR_NO_CLAMP
Definition ngcdcsSLX.hpp:48
#define ngcdcsSLX_MCR_LSP_EN
Definition ngcdcsSLX.hpp:47
#define ngcdcsSLX_MCR_CB_EN
Definition ngcdcsSLX.hpp:46
#define ngcdcsSLX_DCR_RM
Definition ngcdcsSLX.hpp:60
#define ngcdcsSLX_RM_ITR
Definition ngcdcsSLX.hpp:53
#define ngcdcsSLX_MCR_CHAN32
Definition ngcdcsSLX.hpp:42
#define ngcdcsSHIFT_MAX
Definition ngcdcsSLX.hpp:226
#define ngcdcsSLX_MAX_WIN
Definition ngcdcsSLX.hpp:33
#define ngcdcsSLX_MCR_EXTRST
Definition ngcdcsSLX.hpp:43
#define ngcdcsSLX_NROW
Definition ngcdcsSLX.hpp:69
#define ngcdcsSLX_DCR_SELECT
Definition ngcdcsSLX.hpp:61
#define ngcdcsSLX_RM_RDRSTRD
Definition ngcdcsSLX.hpp:55
#define ngcdcsSLX_DCR_MCR
Definition ngcdcsSLX.hpp:62
Definition ngcdcsSLX.hpp:84
ngcdcs_shift_t()
Constructor.
Definition ngcdcsSLX.hpp:92
int array[ngcbSEQ_SHRAM_SIZE]
Shift RAM (32-bit word array)
Definition ngcdcsSLX.hpp:89
int numBits
Number of bits to transfer.
Definition ngcdcsSLX.hpp:86
int TxSize()
Return number of words to transfer.
Definition ngcdcsSLX.hpp:98
void Init()
Initialize.
Definition ngcdcsSLX.hpp:95
Definition ngcdcsSLX.hpp:136
int newCfg
Flag indicating a new configuration.
Definition ngcdcsSLX.hpp:159
void ClearWin()
Clear.
Definition ngcdcsSLX.hpp:179
int ValidWin()
Valid window.
Definition ngcdcsSLX.hpp:207
void ClearRstWin()
Clear reset windows.
Definition ngcdcsSLX.hpp:193
short colRst
Columns (reset)
Definition ngcdcsSLX.hpp:138
short colData
Columns (data)
Definition ngcdcsSLX.hpp:141
int valid
Configuration is valid.
Definition ngcdcsSLX.hpp:165
int enabled
SELEX interface enabled.
Definition ngcdcsSLX.hpp:162
int readMode
Read-out mode.
Definition ngcdcsSLX.hpp:150
ngcdcs_slxrow_t rowData[ngcdcsSLX_MAX_WIN]
Rows (data)
Definition ngcdcsSLX.hpp:147
ngcdcs_slxrow_t rowRst[ngcdcsSLX_MAX_WIN]
Rows (reset)
Definition ngcdcsSLX.hpp:144
int mcr
MCR.
Definition ngcdcsSLX.hpp:153
ngcdcs_slxcfg_t()
Constructor.
Definition ngcdcsSLX.hpp:168
void ClearDataWin()
Clear data windows.
Definition ngcdcsSLX.hpp:200
int fullFrame
Full frame read-out.
Definition ngcdcsSLX.hpp:156
Definition ngcdcsSLX.hpp:111
int start
Start coordinate.
Definition ngcdcsSLX.hpp:113
void Clear()
Clear.
Definition ngcdcsSLX.hpp:122
int Valid()
Validity check.
Definition ngcdcsSLX.hpp:125
friend int operator==(const ngcdcs_slxrow_t &a, const ngcdcs_slxrow_t &b)
Operator ==.
Definition ngcdcsSLX.hpp:128
ngcdcs_slxrow_t()
Constructor.
Definition ngcdcsSLX.hpp:119
int size
Size.
Definition ngcdcsSLX.hpp:116