Skip to content

Commit

Permalink
ctb: allowing adc enable for 10g to be 0, romode changing bit from di…
Browse files Browse the repository at this point in the history
…sable analog to enable analog, removing matterhorn specific (#789)
  • Loading branch information
thattil authored Jul 25, 2023
1 parent c9dfa40 commit d5ce039
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 41 deletions.
4 changes: 2 additions & 2 deletions slsDetectorServers/ctbDetectorServer/RegisterDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@

#define CONFIG_LED_DSBL_OFST (0)
#define CONFIG_LED_DSBL_MSK (0x00000001 << CONFIG_LED_DSBL_OFST)
#define CONFIG_DSBL_ANLG_OTPT_OFST (8)
#define CONFIG_DSBL_ANLG_OTPT_MSK (0x00000001 << CONFIG_DSBL_ANLG_OTPT_OFST)
#define CONFIG_ENBLE_ANLG_OTPT_OFST (8)
#define CONFIG_ENBLE_ANLG_OTPT_MSK (0x00000001 << CONFIG_ENBLE_ANLG_OTPT_OFST)
#define CONFIG_ENBLE_DGTL_OTPT_OFST (9)
#define CONFIG_ENBLE_DGTL_OTPT_MSK (0x00000001 << CONFIG_ENBLE_DGTL_OTPT_OFST)
#define CONFIG_ENBLE_TRNSCVR_OTPT_OFST (10)
Expand Down
Binary file not shown.
34 changes: 9 additions & 25 deletions slsDetectorServers/ctbDetectorServer/slsDetectorFunctionList.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,20 +785,14 @@ int setADCEnableMask(uint32_t mask) {
uint32_t getADCEnableMask() { return adcEnableMask_1g; }

void setADCEnableMask_10G(uint32_t mask) {
if (mask == 0u) {
LOG(logERROR, ("Cannot set 10gb adc mask to 0\n"));
return;
}
// convert 32 bit mask to 8 bit mask
uint8_t actualMask = 0;
if (mask != 0) {
int ival = 0;
for (int ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
if ((1 << ich) & mask) {
actualMask |= (1 << ival);
}
++ival;
int ival = 0;
for (int ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
if ((1 << ich) & mask) {
actualMask |= (1 << ival);
}
++ival;
}

LOG(logINFO, ("Setting adcEnableMask 10G to 0x%x (from 0x%08x)\n",
Expand Down Expand Up @@ -919,15 +913,15 @@ int setReadoutMode(enum readoutMode mode) {
uint32_t addr = CONFIG_REG;
uint32_t addr_readout_10g = READOUT_10G_ENABLE_REG;

bus_w(addr, (bus_r(addr) | CONFIG_DSBL_ANLG_OTPT_MSK) &
(~CONFIG_ENBLE_DGTL_OTPT_MSK) &
(~CONFIG_ENBLE_TRNSCVR_OTPT_MSK));
bus_w(addr,
(bus_r(addr) & (~CONFIG_ENBLE_ANLG_OTPT_MSK) &
(~CONFIG_ENBLE_DGTL_OTPT_MSK) & (~CONFIG_ENBLE_TRNSCVR_OTPT_MSK)));
bus_w(addr_readout_10g, bus_r(addr_readout_10g) &
(~READOUT_10G_ENABLE_ANLG_MSK) &
~(READOUT_10G_ENABLE_DGTL_MSK) &
~(READOUT_10G_ENABLE_TRNSCVR_MSK));
if (analogEnable) {
bus_w(addr, bus_r(addr) & ~(CONFIG_DSBL_ANLG_OTPT_MSK));
bus_w(addr, bus_r(addr) | (CONFIG_ENBLE_ANLG_OTPT_MSK));
bus_w(addr_readout_10g,
bus_r(addr_readout_10g) |
((adcEnableMask_10g << READOUT_10G_ENABLE_ANLG_OFST) &
Expand Down Expand Up @@ -2240,16 +2234,6 @@ int startStateMachine() {

LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));

// TODO: Temporary Matternhorn Specific ( will be moved to the pattern )
if (transceiverEnable) {
uint32_t addr = 0x202 << MEM_MAP_SHIFT;
bus_w(addr, bus_r(addr) | (1 << 1));
LOG(logINFOBLUE, ("Writing 1 to reg 0x202\n"))
usleep(1);
cleanFifos();
usleep(1);
}

return OK;
}

Expand Down
19 changes: 6 additions & 13 deletions slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4345,22 +4345,15 @@ int set_adc_enable_mask_10g(int file_des) {
#else
// only set
if (Server_VerifyLock() == OK) {
if (arg == 0u) {
setADCEnableMask_10G(arg);
uint32_t retval = getADCEnableMask_10G();
if (arg != retval) {
ret = FAIL;
sprintf(mess,
"Not allowed to set adc mask of 0 due to data readout \n");
"Could not set 10Gb ADC Enable mask. Set 0x%x, but "
"read 0x%x\n",
arg, retval);
LOG(logERROR, (mess));
} else {
setADCEnableMask_10G(arg);
uint32_t retval = getADCEnableMask_10G();
if (arg != retval) {
ret = FAIL;
sprintf(mess,
"Could not set 10Gb ADC Enable mask. Set 0x%x, but "
"read 0x%x\n",
arg, retval);
LOG(logERROR, (mess));
}
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion slsSupportLib/include/sls/versionAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#define APIEIGER "developer 0x230525"
#define APIGOTTHARD "developer 0x230615"
#define APIGOTTHARD2 "developer 0x230615"
#define APICTB "developer 0x230629"
#define APIMYTHEN3 "developer 0x230621"
#define APIMOENCH "developer 0x230707"
#define APIJUNGFRAU "developer 0x230720"
#define APICTB "developer 0x230720"

0 comments on commit d5ce039

Please sign in to comment.