13#error This is a C++ include file and cannot be used from plain C
34#define ngcdcsSLX_MAX_WIN 48
39#define ngcdcsSLX_MCR_CHAN 0x03
40#define ngcdcsSLX_MCR_CHAN4 0x00
41#define ngcdcsSLX_MCR_CHAN8 0x01
42#define ngcdcsSLX_MCR_CHAN16 0x02
43#define ngcdcsSLX_MCR_CHAN32 0x03
44#define ngcdcsSLX_MCR_EXTRST 0x04
45#define ngcdcsSLX_MCR_NO_REF 0x08
46#define ngcdcsSLX_MCR_CB_REF_EN 0x10
47#define ngcdcsSLX_MCR_CB_EN 0x20
48#define ngcdcsSLX_MCR_LSP_EN 0x40
49#define ngcdcsSLX_MCR_NO_CLAMP 0x80
54#define ngcdcsSLX_RM_ITR 0x00
55#define ngcdcsSLX_RM_RR 0x01
56#define ngcdcsSLX_RM_RDRSTRD 0x02
61#define ngcdcsSLX_DCR_RM 0x0f
62#define ngcdcsSLX_DCR_SELECT 0xf0
63#define ngcdcsSLX_DCR_MCR 0x10
64#define ngcdcsSLX_DCR_WDR 0x20
65#define ngcdcsSLX_DCR_WRR 0x40
70#define ngcdcsSLX_NROW 256
75#define ngcdcsSLX_NCOL 320
80#define ngcdcsSLX_NCOL_NO_REF 256
102 if ((
numBits % 8) > 0) numBytes++;
104 if ((numBytes % 4) > 0) n++;
227#define ngcdcsSHIFT_MAX 32
296 dcr_ |= (char)readMode_;
304 char DCR() {
return (dcr_);}
308 mcr_ = (char)(value & 0xff);
320 char MCR() {
return (mcr_);}
329 void ClearCfg() {rmX_ = 0; wdrX_ = 0; wrrX_ = 0; mcrX_ = 0;}
360 shift[n].numBits = 8;
375 shift[n].numBits = 8;
394 shift[n].numBits = 8;
410 shift[n].numBits = 8;
421 int Key(
const char *name,
const char *value) {
430 for (n=0;n<(int)strlen(v);n++)
432 if ((v[n] ==
'_') || (v[n] ==
',') || (v[n] ==
'|')) v[n] =
' ';
438 sprintf(
ErrMsg(),
"invalid keyword <%s> - %s", name,
444 if (strcmp(tmp,
"SLX.ENA") == 0)
446 if (strcmp(v,
"T") == 0)
enabled = 1;
447 else if (strcmp(v,
"F") == 0)
enabled = 0;
450 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
454 else if (strcmp(tmp,
"SLX.MCR") == 0)
459 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
464 else if (strcmp(tmp,
"SLX.REFPIX") == 0)
471 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
476 else if (strcmp(tmp,
"SLX.EXTRST") == 0)
483 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
488 else if (strcmp(tmp,
"SLX.CBENA") == 0)
495 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
500 else if (strcmp(tmp,
"SLX.CBREFENA") == 0)
507 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
512 else if (strcmp(tmp,
"SLX.LSPENA") == 0)
519 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
524 else if (strcmp(tmp,
"SLX.CLAMP") == 0)
531 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
536 else if (strcmp(tmp,
"SLX.MODE") == 0)
544 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
548 else if (strcmp(tmp,
"SLX.WIN") == 0)
551 else if (strcmp(v,
"T") == 0)
fullFrame = 0;
555 if (sscanf(v,
"%10d", &intVal) < 1)
557 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
564 else if (strcmp(tmp,
"SLX.DCOL") == 0)
568 sprintf(
ErrMsg(),
"column index out of range [1,10]");
571 if (strcmp(v,
"T") == 0)
577 else if (strcmp(v,
"F") == 0)
585 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
589 else if (strcmp(tmp,
"SLX.RCOL") == 0)
593 sprintf(
ErrMsg(),
"column index out of range [1,10]");
596 if (strcmp(v,
"T") == 0)
602 else if (strcmp(v,
"F") == 0)
610 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
614 else if (strcmp(tmp,
"SLX.COL") == 0)
618 sprintf(
ErrMsg(),
"column index out of range [1,10]");
621 if (strcmp(v,
"T") == 0)
636 else if (strcmp(v,
"F") == 0)
653 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
657 else if (strcmp(tmp,
"SLX.ROW") == 0)
660 if (sscanf(v,
"%10d %10d", &sy, &ny) < 2)
662 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
670 else if (strcmp(tmp,
"SLX.DROW") == 0)
673 if (sscanf(v,
"%10d %10d", &sy, &ny) < 2)
675 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
681 else if (strcmp(tmp,
"SLX.RROW") == 0)
684 if (sscanf(v,
"%10d %10d", &sy, &ny) < 2)
686 sprintf(
ErrMsg(),
"invalid keyword value <%s>", name);
750 void GetDim(
int *sx,
int *sy,
int *nx,
int *ny) {
753 *sx = 1; *sy = 1; *nx = 0; *ny = 0;
758 if (wdrCol_[0] & (1 << j)) (*nx) += 32;
759 else if (*nx == 0) (*sx) += 32;
761 if (wdrCol_[1] & 0x1) (*nx) += 32;
762 else if (*nx == 0) (*sx) += 32;
768 if (wdrCol_[0] & (1 << j)) (*nx) += 32;
769 else if (*nx == 0) (*sx) += 32;
773 if (wdrCol_[1] & (1 << j)) (*nx) += 32;
774 else if (*nx == 0) (*sx) += 32;
782 if (wdrRow_[i] & (1 << j)) (*ny)++;
783 else if (*ny == 0) (*sy)++;
789 int DCOL() {
return (wdrCol_[0] | wdrCol_[1] << 8);}
792 int RCOL() {
return (wrrCol_[0] | wrrCol_[1] << 8);}
824 shiftReg[0] = (dcr_ & 0xff) | (mcr_ & 0xff) << 8;
834 Win2Shift_(wdrRow_, wdrCol_);
843 Win2Shift_(wrrRow_, wrrCol_);
850 wdrCol_[0] = (char)0xff; wdrCol_[1] = (char)0x3;
851 memset(wdrRow_, 0xff,
sizeof(wdrRow_));
857 wrrCol_[0] = (char)0xff; wrrCol_[1] = (char)0x3;
858 memset(wrrRow_, 0xff,
sizeof(wdrRow_));
864 memset(wdrCol_, 0x00,
sizeof(wdrCol_));
865 memset(wdrRow_, 0x00,
sizeof(wdrRow_));
871 memset(wrrCol_, 0x00,
sizeof(wdrCol_));
872 memset(wrrRow_, 0x00,
sizeof(wdrRow_));
878 AdjustRow_(&sy, &ny);
879 Row2Reg_(sy, ny, wdrRow_);
884 AdjustRow_(&sy, &ny);
885 Row2Reg_(sy, ny, wrrRow_);
889 void WDRCOL_ON() {wdrCol_[0] = (char)0xff; wdrCol_[1] = (char)0x3;}
892 void WRRCOL_ON() {wrrCol_[0] = (char)0xff; wrrCol_[1] = (char)0x3;}
895 void WDRCOL_OFF() {wdrCol_[0] = (char)0x0; wdrCol_[1] = (char)0x0;}
898 void WRRCOL_OFF() {wrrCol_[0] = (char)0x0; wrrCol_[1] = (char)0x0;}
950 void AdjustRow_(
int *sy,
int *ny) {
951 if (*sy < 0) *sy = 0;
957 void Col2Reg_(
int n,
char *reg) {
960 if (n > 7) reg[1] |= (char)(1 << (n - 8));
961 else reg[0] |= (char)(1 << n);
965 void ColRemove_(
int n,
char *reg) {
966 if ((n < 0) || (n > 9))
return;
967 if (n > 7) reg[1] &= (char)~(1 << (n - 8));
968 else reg[0] &= (char)~(1 << n);
972 void Row2Reg_(
int start,
int n,
char *reg) {
977 r = reg + (start / 8);
978 for (i=start;i<(start+n);i++)
980 *r |= (char)(1 << s);
987 void Reg2Row_(
char *reg, ngcdcs_slxrow_t *w) {
997 if (reg[i] & (1 << j)) ny++;
998 else if (ny == 0) sy++;
1011 void Win2Shift_(
char *wr,
char *wc) {
1020 *r |= (wr[i] & 0xff) << s;
1027 char b = (char)(((wc[0] >> 1) & 0x7f) | ((wc[1] & 0x1) << 7));
1028 *r |= (b & 0xff) << s;
1033 *r |= (wc[0] & 0xff) << s;
1036 *r |= (wc[1] & 0xff) << s;
int fullFrame
Full frame readout.
Definition ngcdcsSLX.hpp:238
void WDRROW(int sy, int ny)
Map window to row data registers.
Definition ngcdcsSLX.hpp:877
void WDRALL()
Enable all pixels in WDR.
Definition ngcdcsSLX.hpp:849
int RCOL()
Definition ngcdcsSLX.hpp:792
void WRRCLR()
Clear all pixels in WRR.
Definition ngcdcsSLX.hpp:870
void ClearCfg()
Clear configuration flags.
Definition ngcdcsSLX.hpp:329
void WRRROW(int sy, int ny)
Map window to row reset registers.
Definition ngcdcsSLX.hpp:883
int DCOL()
Definition ngcdcsSLX.hpp:789
void WRRCOL_ON()
Enable all reset-columns in WDR.
Definition ngcdcsSLX.hpp:892
void MCR(int value)
Preset MCR value.
Definition ngcdcsSLX.hpp:307
char DCR()
Return detector control register.
Definition ngcdcsSLX.hpp:304
char MCR()
Return multiplexer control register.
Definition ngcdcsSLX.hpp:320
void WRRALL()
Enable all pixels in WRR.
Definition ngcdcsSLX.hpp:856
void WDRCOL_ON(int n)
Enable data-column in WDR.
Definition ngcdcsSLX.hpp:901
void WDRCLR()
Clear all pixels in WDR.
Definition ngcdcsSLX.hpp:863
int shiftReg[ngcbSEQ_SHRAM_SIZE]
Shift register.
Definition ngcdcsSLX.hpp:802
ngcdcs_shift_t shift[ngcdcsSHIFT_MAX]
Pennding shift register instructions.
Definition ngcdcsSLX.hpp:235
void RM2REG(int nextSelect=0)
Push read-out mode to shift register.
Definition ngcdcsSLX.hpp:808
void Preset(ngcdcs_slxcfg_t &cfg)
Preset with external configuration.
Definition ngcdcsSLX.hpp:697
ngcdcsSLX()
Constructor.
Definition ngcdcsSLX.hpp:244
void WRRCOL_OFF()
Disable all reset-columns in WDR.
Definition ngcdcsSLX.hpp:898
void WRRCOL_OFF(int n)
Disable reset-column in WDR.
Definition ngcdcsSLX.hpp:910
void WRRCOL_ON(int n)
Enable reset-column in WDR.
Definition ngcdcsSLX.hpp:904
virtual ~ngcdcsSLX()
Definition ngcdcsSLX.hpp:287
void WDR2REG(int nextSelect=0)
Push WDR to shift register.
Definition ngcdcsSLX.hpp:831
void RROW(ngcdcs_slxrow_t *w)
Definition ngcdcsSLX.hpp:798
void DROW(ngcdcs_slxrow_t *w)
Definition ngcdcsSLX.hpp:795
void WDRCOL_OFF(int n)
Disable data-column in WDR.
Definition ngcdcsSLX.hpp:907
void ClearWin()
Clear window mappings.
Definition ngcdcsSLX.hpp:326
char * ErrMsg()
Return global error message.
Definition ngcdcsSLX.hpp:290
int shiftRegSize
Number of bits in shift register.
Definition ngcdcsSLX.hpp:805
void FullFrame()
Full frame read-out.
Definition ngcdcsSLX.hpp:323
void GetDim(int *sx, int *sy, int *nx, int *ny)
Definition ngcdcsSLX.hpp:750
void Configure()
Configure shift register instructions.
Definition ngcdcsSLX.hpp:332
void ReadMode(int mode)
Preset read-out mode.
Definition ngcdcsSLX.hpp:293
void MCR2REG(int nextSelect=0)
Push MCR to shift register.
Definition ngcdcsSLX.hpp:815
int ReadMode()
Return read-out mode.
Definition ngcdcsSLX.hpp:301
void WDRCOL_OFF()
Disable all data-columns in WDR.
Definition ngcdcsSLX.hpp:895
int Key(const char *name, const char *value)
Parse setup key.
Definition ngcdcsSLX.hpp:421
int enabled
SELEX interface enabled.
Definition ngcdcsSLX.hpp:241
void WDRCOL_ON()
Enable all data-columns in WDR.
Definition ngcdcsSLX.hpp:889
void WRR2REG(int nextSelect=0)
Push WRR to shift register.
Definition ngcdcsSLX.hpp:840
#define ngcbSEQ_SHRAM_SIZE
Definition ngcbAddr.h:181
int ngcbFmt2Int(const char *s, int *value)
Definition ngcbString.c:236
int ngcbKeyIdx(char *key, int *nsplit, int *kval, char *erms)
Definition ngcbKey.c:376
#define ngcbSUCCESS
Definition ngcb.h:138
void ngcbToLower(char *s)
Definition ngcbString.c:28
#define ngcbFAILURE
Definition ngcb.h:140
#define ngcdcsSLX_MCR_NO_REF
Definition ngcdcsSLX.hpp:45
#define ngcdcsSLX_MCR_CHAN
Definition ngcdcsSLX.hpp:39
#define ngcdcsSLX_RM_RR
Definition ngcdcsSLX.hpp:55
#define ngcdcsSLX_DCR_WDR
Definition ngcdcsSLX.hpp:64
#define ngcdcsSLX_DCR_WRR
Definition ngcdcsSLX.hpp:65
#define ngcdcsSLX_MCR_CB_REF_EN
Definition ngcdcsSLX.hpp:46
#define ngcdcsSLX_MCR_NO_CLAMP
Definition ngcdcsSLX.hpp:49
#define ngcdcsSLX_MCR_LSP_EN
Definition ngcdcsSLX.hpp:48
#define ngcdcsSLX_MCR_CB_EN
Definition ngcdcsSLX.hpp:47
#define ngcdcsSLX_DCR_RM
Definition ngcdcsSLX.hpp:61
#define ngcdcsSLX_RM_ITR
Definition ngcdcsSLX.hpp:54
#define ngcdcsSLX_MCR_CHAN32
Definition ngcdcsSLX.hpp:43
#define ngcdcsSHIFT_MAX
Definition ngcdcsSLX.hpp:227
#define ngcdcsSLX_MAX_WIN
Definition ngcdcsSLX.hpp:34
#define ngcdcsSLX_MCR_EXTRST
Definition ngcdcsSLX.hpp:44
#define ngcdcsSLX_NROW
Definition ngcdcsSLX.hpp:70
#define ngcdcsSLX_DCR_SELECT
Definition ngcdcsSLX.hpp:62
#define ngcdcsSLX_RM_RDRSTRD
Definition ngcdcsSLX.hpp:56
#define ngcdcsSLX_DCR_MCR
Definition ngcdcsSLX.hpp:63
Definition ngcdcsSLX.hpp:85
ngcdcs_shift_t()
Constructor.
Definition ngcdcsSLX.hpp:93
int array[ngcbSEQ_SHRAM_SIZE]
Shift RAM (32-bit word array)
Definition ngcdcsSLX.hpp:90
int numBits
Number of bits to transfer.
Definition ngcdcsSLX.hpp:87
int TxSize()
Return number of words to transfer.
Definition ngcdcsSLX.hpp:99
void Init()
Initialize.
Definition ngcdcsSLX.hpp:96
Definition ngcdcsSLX.hpp:137
int newCfg
Flag indicating a new configuration.
Definition ngcdcsSLX.hpp:160
void ClearWin()
Clear.
Definition ngcdcsSLX.hpp:180
int ValidWin()
Valid window.
Definition ngcdcsSLX.hpp:208
void ClearRstWin()
Clear reset windows.
Definition ngcdcsSLX.hpp:194
short colRst
Columns (reset)
Definition ngcdcsSLX.hpp:139
short colData
Columns (data)
Definition ngcdcsSLX.hpp:142
int valid
Configuration is valid.
Definition ngcdcsSLX.hpp:166
int enabled
SELEX interface enabled.
Definition ngcdcsSLX.hpp:163
int readMode
Read-out mode.
Definition ngcdcsSLX.hpp:151
ngcdcs_slxrow_t rowData[ngcdcsSLX_MAX_WIN]
Rows (data)
Definition ngcdcsSLX.hpp:148
ngcdcs_slxrow_t rowRst[ngcdcsSLX_MAX_WIN]
Rows (reset)
Definition ngcdcsSLX.hpp:145
int mcr
MCR.
Definition ngcdcsSLX.hpp:154
ngcdcs_slxcfg_t()
Constructor.
Definition ngcdcsSLX.hpp:169
void ClearDataWin()
Clear data windows.
Definition ngcdcsSLX.hpp:201
int fullFrame
Full frame read-out.
Definition ngcdcsSLX.hpp:157
Definition ngcdcsSLX.hpp:112
int start
Start coordinate.
Definition ngcdcsSLX.hpp:114
void Clear()
Clear.
Definition ngcdcsSLX.hpp:123
int Valid()
Validity check.
Definition ngcdcsSLX.hpp:126
friend int operator==(const ngcdcs_slxrow_t &a, const ngcdcs_slxrow_t &b)
Operator ==.
Definition ngcdcsSLX.hpp:129
ngcdcs_slxrow_t()
Constructor.
Definition ngcdcsSLX.hpp:120
int size
Size.
Definition ngcdcsSLX.hpp:117