mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-04 03:40:04 +02:00
Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer
This commit is contained in:
commit
5900403f20
@ -23,7 +23,6 @@ add_subdirectory(ctbDetectorServer)
|
|||||||
add_subdirectory(eigerDetectorServer)
|
add_subdirectory(eigerDetectorServer)
|
||||||
add_subdirectory(gotthardDetectorServer)
|
add_subdirectory(gotthardDetectorServer)
|
||||||
add_subdirectory(jungfrauDetectorServer)
|
add_subdirectory(jungfrauDetectorServer)
|
||||||
#add_subdirectory(moenchDetectorServer)
|
|
||||||
add_subdirectory(mythen3DetectorServer)
|
add_subdirectory(mythen3DetectorServer)
|
||||||
add_subdirectory(gotthard2DetectorServer)
|
add_subdirectory(gotthard2DetectorServer)
|
||||||
add_subdirectory(moenchDetectorServer)
|
add_subdirectory(moenchDetectorServer)
|
||||||
|
Binary file not shown.
@ -5,13 +5,11 @@
|
|||||||
#include "communication_funcs_UDP.h"
|
#include "communication_funcs_UDP.h"
|
||||||
#include "UDPPacketHeaderGenerator.h"
|
#include "UDPPacketHeaderGenerator.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h
|
|
||||||
#include "AD7689.h" // slow adcs
|
#include "AD7689.h" // slow adcs
|
||||||
#include "LTC2620.h" // dacs
|
#include "LTC2620.h" // dacs
|
||||||
#include "MAX1932.h" // hv
|
#include "MAX1932.h" // hv
|
||||||
#include "INA226.h" // i2c
|
#include "INA226.h" // i2c
|
||||||
#include "ALTERA_PLL.h" // pll
|
#include "ALTERA_PLL.h" // pll
|
||||||
#include "blackfin.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
@ -1360,19 +1358,19 @@ int getADC(enum ADCINDEX ind){
|
|||||||
return INA226_ReadCurrent(I2C_POWER_VIO_DEVICE_ID + (int)(ind - I_PWR_IO));
|
return INA226_ReadCurrent(I2C_POWER_VIO_DEVICE_ID + (int)(ind - I_PWR_IO));
|
||||||
|
|
||||||
// slow adcs
|
// slow adcs
|
||||||
case SLOW_ADC_TEMP:
|
case S_TMP:
|
||||||
FILE_LOG(logDEBUG1, ("Reading Slow ADC Temperature\n"));
|
FILE_LOG(logDEBUG1, ("Reading Slow ADC Temperature\n"));
|
||||||
return AD7689_GetTemperature();
|
return AD7689_GetTemperature();
|
||||||
case SLOW_ADC0:
|
case S_ADC0:
|
||||||
case SLOW_ADC1:
|
case S_ADC1:
|
||||||
case SLOW_ADC2:
|
case S_ADC2:
|
||||||
case SLOW_ADC3:
|
case S_ADC3:
|
||||||
case SLOW_ADC4:
|
case S_ADC4:
|
||||||
case SLOW_ADC5:
|
case S_ADC5:
|
||||||
case SLOW_ADC6:
|
case S_ADC6:
|
||||||
case SLOW_ADC7:
|
case S_ADC7:
|
||||||
FILE_LOG(logDEBUG1, ("Reading Slow ADC Channel %d\n", (int)ind - SLOW_ADC0));
|
FILE_LOG(logDEBUG1, ("Reading Slow ADC Channel %d\n", (int)ind - S_ADC0));
|
||||||
return AD7689_GetChannel((int)ind - SLOW_ADC0);
|
return AD7689_GetChannel((int)ind - S_ADC0);
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logERROR, ("Adc Index %d not defined \n", (int)ind));
|
FILE_LOG(logERROR, ("Adc Index %d not defined \n", (int)ind));
|
||||||
return -1;
|
return -1;
|
||||||
@ -1844,7 +1842,7 @@ int getPipeline(enum CLKINDEX ind) {
|
|||||||
// patterns
|
// patterns
|
||||||
|
|
||||||
uint64_t writePatternIOControl(uint64_t word) {
|
uint64_t writePatternIOControl(uint64_t word) {
|
||||||
if (word != -1) {
|
if ((int64_t)word != -1) {
|
||||||
FILE_LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int) word));
|
FILE_LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int) word));
|
||||||
set64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
set64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
||||||
}
|
}
|
||||||
@ -1854,7 +1852,7 @@ uint64_t writePatternIOControl(uint64_t word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t writePatternClkControl(uint64_t word) {
|
uint64_t writePatternClkControl(uint64_t word) {
|
||||||
if (word != -1) {
|
if ((int64_t)word != -1) {
|
||||||
FILE_LOG(logINFO, ("Setting Pattern Clock Control: 0x%llx\n", (long long int) word));
|
FILE_LOG(logINFO, ("Setting Pattern Clock Control: 0x%llx\n", (long long int) word));
|
||||||
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
|
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
|
||||||
}
|
}
|
||||||
@ -1893,7 +1891,7 @@ uint64_t readPatternWord(int addr) {
|
|||||||
|
|
||||||
uint64_t writePatternWord(int addr, uint64_t word) {
|
uint64_t writePatternWord(int addr, uint64_t word) {
|
||||||
// get
|
// get
|
||||||
if (word == -1)
|
if ((int64_t)word == -1)
|
||||||
return readPatternWord(addr);
|
return readPatternWord(addr);
|
||||||
|
|
||||||
// error (handled in tcp)
|
// error (handled in tcp)
|
||||||
@ -1994,7 +1992,7 @@ uint64_t setPatternWaitTime(int level, uint64_t t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set
|
// set
|
||||||
if (t >= 0) {
|
if ((int64_t)t >= 0) {
|
||||||
FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t));
|
FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t));
|
||||||
set64BitReg(t, regl, regm);
|
set64BitReg(t, regl, regm);
|
||||||
}
|
}
|
||||||
@ -2558,7 +2556,7 @@ int getTotalNumberOfChannels() {
|
|||||||
return nchanx * nchany;
|
return nchanx * nchany;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNumberOfChannels(int* nchanx, int* nchany) {
|
void getNumberOfChannels(int* nchanx, int* nchany) {
|
||||||
int nachans = 0, ndchans = 0;
|
int nachans = 0, ndchans = 0;
|
||||||
// analog channels (normal, analog/digital readout)
|
// analog channels (normal, analog/digital readout)
|
||||||
if (analogEnable) {
|
if (analogEnable) {
|
||||||
|
@ -36,7 +36,7 @@ typedef struct udp_header_struct {
|
|||||||
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
#define UDP_IP_HEADER_LENGTH_BYTES (28)
|
||||||
|
|
||||||
/* Enums */
|
/* Enums */
|
||||||
enum ADCINDEX {V_PWR_IO, V_PWR_A, V_PWR_B, V_PWR_C, V_PWR_D, I_PWR_IO, I_PWR_A, I_PWR_B, I_PWR_C, I_PWR_D};
|
enum ADCINDEX {V_PWR_IO, V_PWR_A, V_PWR_B, V_PWR_C, V_PWR_D, I_PWR_IO, I_PWR_A, I_PWR_B, I_PWR_C, I_PWR_D, S_ADC0, S_ADC1, S_ADC2, S_ADC3, S_ADC4, S_ADC5, S_ADC6, S_ADC7, S_TMP};
|
||||||
enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
|
enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
|
||||||
D10, D11, D12, D13, D14, D15, D16, D17,
|
D10, D11, D12, D13, D14, D15, D16, D17,
|
||||||
D_PWR_D, D_PWR_CHIP, D_PWR_C, D_PWR_B, D_PWR_A, D_PWR_IO};
|
D_PWR_D, D_PWR_CHIP, D_PWR_C, D_PWR_B, D_PWR_A, D_PWR_IO};
|
||||||
|
Binary file not shown.
@ -11,6 +11,7 @@
|
|||||||
#include <unistd.h> //to gethostname
|
#include <unistd.h> //to gethostname
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
#include <netinet/in.h>
|
||||||
#include "communication_funcs_UDP.h"
|
#include "communication_funcs_UDP.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@ -241,7 +242,11 @@ u_int64_t getDetectorMAC() {
|
|||||||
strcat(mac,pch);
|
strcat(mac,pch);
|
||||||
pch = strtok (NULL, ":");
|
pch = strtok (NULL, ":");
|
||||||
}
|
}
|
||||||
sscanf(mac,"%llx",&res);
|
#ifdef VIRTUAL
|
||||||
|
sscanf(mac,"%lx",&res);
|
||||||
|
#else
|
||||||
|
sscanf(mac, "%llx", &res);
|
||||||
|
#endif
|
||||||
//increment by 1 for 10g
|
//increment by 1 for 10g
|
||||||
if (send_to_ten_gig)
|
if (send_to_ten_gig)
|
||||||
res++;
|
res++;
|
||||||
@ -1161,6 +1166,25 @@ int configureMAC() {
|
|||||||
int destport = udpDetails.dstport;
|
int destport = udpDetails.dstport;
|
||||||
int destport2 = udpDetails.dstport2;
|
int destport2 = udpDetails.dstport2;
|
||||||
|
|
||||||
|
FILE_LOG(logINFO, ("Configuring MAC\n"));
|
||||||
|
|
||||||
|
char src_mac[50], src_ip[INET_ADDRSTRLEN],dst_mac[50], dst_ip[INET_ADDRSTRLEN];
|
||||||
|
getMacAddressinString(src_mac, 50, sourcemac);
|
||||||
|
getMacAddressinString(dst_mac, 50, destmac);
|
||||||
|
getIpAddressinString(src_ip, sourceip);
|
||||||
|
getIpAddressinString(dst_ip, destip);
|
||||||
|
|
||||||
|
FILE_LOG(logINFO, (
|
||||||
|
"\tSource IP : %s\n"
|
||||||
|
"\tSource MAC : %s\n"
|
||||||
|
"\tSource Port : %d\n"
|
||||||
|
"\tDest IP : %s\n"
|
||||||
|
"\tDest MAC : %s\n"
|
||||||
|
"\tDest Port : %d\n"
|
||||||
|
"\tDest Port2 : %d\n",
|
||||||
|
src_ip, src_mac, src_port,
|
||||||
|
dst_ip, dst_mac, destport, destport2));
|
||||||
|
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
char cDestIp[MAX_STR_LENGTH];
|
char cDestIp[MAX_STR_LENGTH];
|
||||||
memset(cDestIp, 0, MAX_STR_LENGTH);
|
memset(cDestIp, 0, MAX_STR_LENGTH);
|
||||||
@ -1176,23 +1200,6 @@ int configureMAC() {
|
|||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
#else
|
#else
|
||||||
FILE_LOG(logINFO, ("Configuring MAC\n"));
|
|
||||||
|
|
||||||
char src_mac[50], src_ip[INET_ADDRSTRLEN],dst_mac[50], dst_ip[INET_ADDRSTRLEN];
|
|
||||||
getMacAddressinString(src_mac, 50, sourcemac);
|
|
||||||
getMacAddressinString(dst_mac, 50, destmac);
|
|
||||||
getIpAddressinString(src_ip, sourceip);
|
|
||||||
getIpAddressinString(dst_ip, destip);
|
|
||||||
|
|
||||||
FILE_LOG(logINFO, (
|
|
||||||
"\tSource IP : %s\n"
|
|
||||||
"\tSource MAC : %s\n"
|
|
||||||
"\tSource Port : %d\n"
|
|
||||||
"\tDest IP : %s\n"
|
|
||||||
"\tDest MAC : %s\n",
|
|
||||||
src_ip, src_mac, src_port,
|
|
||||||
dst_ip, dst_mac));
|
|
||||||
|
|
||||||
|
|
||||||
int beb_num = detid;
|
int beb_num = detid;
|
||||||
int header_number = 0;
|
int header_number = 0;
|
||||||
@ -1283,8 +1290,8 @@ int setInterruptSubframe(int value) {
|
|||||||
if(!Feb_Control_SetInterruptSubframe(value)) {
|
if(!Feb_Control_SetInterruptSubframe(value)) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
|
||||||
#endif
|
#endif
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getInterruptSubframe() {
|
int getInterruptSubframe() {
|
||||||
@ -1303,8 +1310,8 @@ int setReadNLines(int value) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
Beb_SetReadNLines(value);
|
Beb_SetReadNLines(value);
|
||||||
return OK;
|
|
||||||
#endif
|
#endif
|
||||||
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getReadNLines() {
|
int getReadNLines() {
|
||||||
@ -1531,7 +1538,7 @@ int64_t getCurrentTau() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setExternalGating(int enable[]) {
|
void setExternalGating(int enable[]) {
|
||||||
if (enable>=0) {
|
if (enable[0]>=0 && enable[1]>=0) {
|
||||||
#ifndef VIRTUAL
|
#ifndef VIRTUAL
|
||||||
Feb_Control_SetExternalEnableMode(enable[0], enable[1]);//enable = 0 or 1, polarity = 0 or 1 , where 1 is positive
|
Feb_Control_SetExternalEnableMode(enable[0], enable[1]);//enable = 0 or 1, polarity = 0 or 1 , where 1 is positive
|
||||||
#endif
|
#endif
|
||||||
|
Binary file not shown.
@ -2,7 +2,6 @@
|
|||||||
#include "RegisterDefs.h"
|
#include "RegisterDefs.h"
|
||||||
#include "versionAPI.h"
|
#include "versionAPI.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
#include "nios.h"
|
|
||||||
#include "DAC6571.h"
|
#include "DAC6571.h"
|
||||||
#include "LTC2620_Driver.h"
|
#include "LTC2620_Driver.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -41,8 +40,8 @@ int32_t clkPhase[NUM_CLOCKS] = {};
|
|||||||
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
||||||
uint32_t systemFrequency = 0;
|
uint32_t systemFrequency = 0;
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {};
|
||||||
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {0};
|
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {};
|
||||||
int injectedChannelsOffset = 0;
|
int injectedChannelsOffset = 0;
|
||||||
int injectedChannelsIncrement = 0;
|
int injectedChannelsIncrement = 0;
|
||||||
int vetoReference[NCHIP][NCHAN];
|
int vetoReference[NCHIP][NCHAN];
|
||||||
@ -205,8 +204,8 @@ int testBus() {
|
|||||||
|
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
u_int32_t addr = DTA_OFFSET_REG;
|
u_int32_t addr = DTA_OFFSET_REG;
|
||||||
int times = 1000 * 1000;
|
u_int32_t times = 1000 * 1000;
|
||||||
int i = 0;
|
u_int32_t i = 0;
|
||||||
|
|
||||||
for (i = 0; i < times; ++i) {
|
for (i = 0; i < times; ++i) {
|
||||||
bus_w(addr, i * 100);
|
bus_w(addr, i * 100);
|
||||||
|
Binary file not shown.
@ -3,10 +3,7 @@
|
|||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
#include "RegisterDefs.h"
|
#include "RegisterDefs.h"
|
||||||
|
|
||||||
#include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h
|
|
||||||
#include "AD9252.h" // old board compatibility
|
|
||||||
#include "LTC2620.h" // dacs
|
#include "LTC2620.h" // dacs
|
||||||
#include "blackfin.h"
|
|
||||||
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include <unistd.h> // usleep
|
#include <unistd.h> // usleep
|
||||||
|
Binary file not shown.
@ -2,11 +2,9 @@
|
|||||||
#include "versionAPI.h"
|
#include "versionAPI.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
|
|
||||||
#include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h
|
|
||||||
#include "LTC2620.h" // dacs
|
#include "LTC2620.h" // dacs
|
||||||
#include "MAX1932.h" // hv
|
#include "MAX1932.h" // hv
|
||||||
#include "ALTERA_PLL.h" // pll
|
#include "ALTERA_PLL.h" // pll
|
||||||
#include "blackfin.h"
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
#include "communication_funcs_UDP.h"
|
#include "communication_funcs_UDP.h"
|
||||||
@ -207,8 +205,8 @@ int testBus() {
|
|||||||
|
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
u_int32_t addr = SET_TRIGGER_DELAY_LSB_REG;
|
u_int32_t addr = SET_TRIGGER_DELAY_LSB_REG;
|
||||||
int times = 1000 * 1000;
|
u_int32_t times = 1000 * 1000;
|
||||||
int i = 0;
|
u_int32_t i = 0;
|
||||||
|
|
||||||
for (i = 0; i < times; ++i) {
|
for (i = 0; i < times; ++i) {
|
||||||
bus_w(addr, i * 100);
|
bus_w(addr, i * 100);
|
||||||
@ -1173,8 +1171,8 @@ int configureMAC() {
|
|||||||
|
|
||||||
int setDetectorPosition(int pos[]) {
|
int setDetectorPosition(int pos[]) {
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
int innerPos[2] = {pos[X], pos[Y]};
|
uint32_t innerPos[2] = {pos[X], pos[Y]};
|
||||||
int outerPos[2] = {pos[X], pos[Y]};
|
uint32_t outerPos[2] = {pos[X], pos[Y]};
|
||||||
int selInterface = getPrimaryInterface();
|
int selInterface = getPrimaryInterface();
|
||||||
|
|
||||||
if (getNumberofUDPInterfaces() == 1) {
|
if (getNumberofUDPInterfaces() == 1) {
|
||||||
@ -1514,7 +1512,7 @@ int setThresholdTemperature(int val) {
|
|||||||
// conversion
|
// conversion
|
||||||
temp = (temp * (625.0/10.0));
|
temp = (temp * (625.0/10.0));
|
||||||
|
|
||||||
float ftemp = (double)temp/1000.00;
|
double ftemp = (double)temp/1000.00;
|
||||||
FILE_LOG(logDEBUG1, ("Threshold Temperature read %f °C\n",ftemp));
|
FILE_LOG(logDEBUG1, ("Threshold Temperature read %f °C\n",ftemp));
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
|
Binary file not shown.
@ -4,12 +4,9 @@
|
|||||||
|
|
||||||
#include "communication_funcs_UDP.h"
|
#include "communication_funcs_UDP.h"
|
||||||
#include "UDPPacketHeaderGenerator.h"
|
#include "UDPPacketHeaderGenerator.h"
|
||||||
#include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h
|
|
||||||
#include "LTC2620.h" // dacs
|
#include "LTC2620.h" // dacs
|
||||||
#include "MAX1932.h" // hv
|
#include "MAX1932.h" // hv
|
||||||
#include "ALTERA_PLL.h" // pll
|
#include "ALTERA_PLL.h" // pll
|
||||||
#include "blackfin.h"
|
|
||||||
#include "readDefaultPattern.h"
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -1544,7 +1541,7 @@ int getPipeline(enum CLKINDEX ind) {
|
|||||||
// patterns
|
// patterns
|
||||||
|
|
||||||
uint64_t writePatternIOControl(uint64_t word) {
|
uint64_t writePatternIOControl(uint64_t word) {
|
||||||
if (word != -1) {
|
if ((int64_t)word != -1) {
|
||||||
FILE_LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int) word));
|
FILE_LOG(logINFO, ("Setting Pattern I/O Control: 0x%llx\n", (long long int) word));
|
||||||
set64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
set64BitReg(word, PATTERN_IO_CNTRL_LSB_REG, PATTERN_IO_CNTRL_MSB_REG);
|
||||||
}
|
}
|
||||||
@ -1554,7 +1551,7 @@ uint64_t writePatternIOControl(uint64_t word) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t writePatternClkControl(uint64_t word) {
|
uint64_t writePatternClkControl(uint64_t word) {
|
||||||
if (word != -1) {
|
if ((int64_t)word != -1) {
|
||||||
FILE_LOG(logINFO, ("Setting Pattern Clock Control: 0x%llx\n", (long long int) word));
|
FILE_LOG(logINFO, ("Setting Pattern Clock Control: 0x%llx\n", (long long int) word));
|
||||||
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
|
set64BitReg(word, PATTERN_IO_CLK_CNTRL_LSB_REG, PATTERN_IO_CLK_CNTRL_MSB_REG);
|
||||||
}
|
}
|
||||||
@ -1593,7 +1590,7 @@ uint64_t readPatternWord(int addr) {
|
|||||||
|
|
||||||
uint64_t writePatternWord(int addr, uint64_t word) {
|
uint64_t writePatternWord(int addr, uint64_t word) {
|
||||||
// get
|
// get
|
||||||
if (word == -1)
|
if ((int64_t)word == -1)
|
||||||
return readPatternWord(addr);
|
return readPatternWord(addr);
|
||||||
|
|
||||||
// error (handled in tcp)
|
// error (handled in tcp)
|
||||||
@ -1694,7 +1691,7 @@ uint64_t setPatternWaitTime(int level, uint64_t t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set
|
// set
|
||||||
if (t >= 0) {
|
if ((int64_t)t >= 0) {
|
||||||
FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t));
|
FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t));
|
||||||
set64BitReg(t, regl, regm);
|
set64BitReg(t, regl, regm);
|
||||||
}
|
}
|
||||||
@ -2183,7 +2180,7 @@ int getTotalNumberOfChannels() {
|
|||||||
return nchanx * nchany;
|
return nchanx * nchany;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getNumberOfChannels(int* nchanx, int* nchany) {
|
void getNumberOfChannels(int* nchanx, int* nchany) {
|
||||||
uint32_t mask = enableTenGigabitEthernet(-1) ? adcEnableMask_10g : adcEnableMask_1g;
|
uint32_t mask = enableTenGigabitEthernet(-1) ? adcEnableMask_10g : adcEnableMask_1g;
|
||||||
// count number of channels in x, each adc has 25 channels each
|
// count number of channels in x, each adc has 25 channels each
|
||||||
int nchanTop = __builtin_popcount(mask & 0xF0F0F0F0) * NCHANS_PER_ADC;
|
int nchanTop = __builtin_popcount(mask & 0xF0F0F0F0) * NCHANS_PER_ADC;
|
||||||
|
Binary file not shown.
@ -1,7 +1,6 @@
|
|||||||
#include "slsDetectorFunctionList.h"
|
#include "slsDetectorFunctionList.h"
|
||||||
#include "versionAPI.h"
|
#include "versionAPI.h"
|
||||||
#include "clogger.h"
|
#include "clogger.h"
|
||||||
#include "nios.h"
|
|
||||||
#include "DAC6571.h"
|
#include "DAC6571.h"
|
||||||
#include "LTC2620_Driver.h"
|
#include "LTC2620_Driver.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
@ -37,7 +36,7 @@ int32_t clkPhase[NUM_CLOCKS] = {};
|
|||||||
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
||||||
|
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {};
|
||||||
int detPos[2] = {};
|
int detPos[2] = {};
|
||||||
uint32_t countermask = 0; // will be removed later when in firmware converted to mask
|
uint32_t countermask = 0; // will be removed later when in firmware converted to mask
|
||||||
|
|
||||||
@ -194,8 +193,8 @@ int testBus() {
|
|||||||
|
|
||||||
int ret = OK;
|
int ret = OK;
|
||||||
u_int32_t addr = DTA_OFFSET_REG;
|
u_int32_t addr = DTA_OFFSET_REG;
|
||||||
int times = 1000 * 1000;
|
u_int32_t times = 1000 * 1000;
|
||||||
int i = 0;
|
u_int32_t i = 0;
|
||||||
|
|
||||||
for (i = 0; i < times; ++i) {
|
for (i = 0; i < times; ++i) {
|
||||||
bus_w(addr, i * 100);
|
bus_w(addr, i * 100);
|
||||||
@ -911,7 +910,7 @@ uint64_t readPatternWord(int addr) {
|
|||||||
|
|
||||||
uint64_t writePatternWord(int addr, uint64_t word) {
|
uint64_t writePatternWord(int addr, uint64_t word) {
|
||||||
// get
|
// get
|
||||||
if (word == -1)
|
if ((int64_t)word == -1)
|
||||||
return readPatternWord(addr);
|
return readPatternWord(addr);
|
||||||
|
|
||||||
// error (handled in tcp)
|
// error (handled in tcp)
|
||||||
@ -1003,7 +1002,7 @@ uint64_t setPatternWaitTime(int level, uint64_t t) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set
|
// set
|
||||||
if (t >= 0) {
|
if ((int64_t)t >= 0) {
|
||||||
FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t));
|
FILE_LOG(logINFO, ("Setting Pattern Wait Time (level:%d, t:%lld)\n", level, (long long int)t));
|
||||||
set64BitReg(t, regl, regm);
|
set64BitReg(t, regl, regm);
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,28 @@
|
|||||||
#include "slsDetectorServer_defs.h" // DAC_INDEX, ADC_INDEX, also include RegisterDefs.h
|
#include "slsDetectorServer_defs.h" // DAC_INDEX, ADC_INDEX, also include RegisterDefs.h
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
#include "clogger.h" // runState(enum TLogLevel)
|
#include "clogger.h" // runState(enum TLogLevel)
|
||||||
|
#include "AD9252.h" // old board compatibility
|
||||||
#endif
|
#endif
|
||||||
#ifndef VIRTUAL
|
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
|
#include "AD9257.h" // commonServerFunctions.h, blackfin.h, ansi.h
|
||||||
|
#endif
|
||||||
|
#ifdef MOENCHD
|
||||||
|
#include "readDefaultPattern.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
#include "programFpgaNios.h"
|
#include "programFpgaNios.h"
|
||||||
#elif defined(CHIPTESTBOARDD) || defined(JUNGFRAUD) || defined(MOENCHD)
|
#elif defined(CHIPTESTBOARDD) || defined(JUNGFRAUD) || defined(MOENCHD)
|
||||||
#include "programFpgaBlackfin.h"
|
#include "programFpgaBlackfin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
#include "nios.h"
|
||||||
|
#elif defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
|
#include "blackfin.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h> // FILE
|
#include <stdio.h> // FILE
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -107,9 +120,6 @@ int readRegister(uint32_t offset, uint32_t* retval);
|
|||||||
#elif GOTTHARDD
|
#elif GOTTHARDD
|
||||||
uint32_t writeRegister16And32(uint32_t offset, uint32_t data); //FIXME its not there in ctb or moench?
|
uint32_t writeRegister16And32(uint32_t offset, uint32_t data); //FIXME its not there in ctb or moench?
|
||||||
uint32_t readRegister16And32(uint32_t offset);
|
uint32_t readRegister16And32(uint32_t offset);
|
||||||
#else
|
|
||||||
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h or nios.h
|
|
||||||
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h or nios.h
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -271,16 +281,6 @@ int setThresholdEnergy(int ev);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// parameters - dac, adc, hv
|
// parameters - dac, adc, hv
|
||||||
#ifdef GOTTHARDD
|
|
||||||
extern void AD9252_Set(int addr, int val); // AD9252.h (old board)
|
|
||||||
#endif
|
|
||||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
|
||||||
extern void AD9257_Set(int addr, int val); // AD9257.h
|
|
||||||
#endif
|
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
|
||||||
extern int AD9257_GetVrefVoltage(int mV); // AD9257.h
|
|
||||||
extern int AD9257_SetVrefVoltage(int val, int mV); // AD9257.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GOTTHARD2D
|
#ifdef GOTTHARD2D
|
||||||
int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val);
|
int setOnChipDAC(enum ONCHIP_DACINDEX ind, int chipIndex, int val);
|
||||||
@ -382,10 +382,6 @@ int getFrequency(enum CLKINDEX ind);
|
|||||||
void configureSyncFrequency(enum CLKINDEX ind);
|
void configureSyncFrequency(enum CLKINDEX ind);
|
||||||
void setPipeline(enum CLKINDEX ind, int val);
|
void setPipeline(enum CLKINDEX ind, int val);
|
||||||
int getPipeline(enum CLKINDEX ind);
|
int getPipeline(enum CLKINDEX ind);
|
||||||
extern void eraseFlash(); // programFpgaBlackfin.h
|
|
||||||
extern int startWritingFPGAprogram(FILE** filefp); // programFpgaBlackfin.h
|
|
||||||
extern void stopWritingFPGAprogram(FILE* filefp); // programFpgaBlackfin.h
|
|
||||||
extern int writeFPGAProgram(char* fpgasrc, uint64_t fsize, FILE* filefp); // programFpgaBlackfin.h
|
|
||||||
// patterns
|
// patterns
|
||||||
uint64_t writePatternIOControl(uint64_t word);
|
uint64_t writePatternIOControl(uint64_t word);
|
||||||
uint64_t writePatternClkControl(uint64_t word);
|
uint64_t writePatternClkControl(uint64_t word);
|
||||||
@ -403,9 +399,6 @@ uint64_t getPatternMask();
|
|||||||
void setPatternBitMask(uint64_t mask);
|
void setPatternBitMask(uint64_t mask);
|
||||||
uint64_t getPatternBitMask();
|
uint64_t getPatternBitMask();
|
||||||
#endif
|
#endif
|
||||||
#ifdef MOENCHD
|
|
||||||
extern int loadDefaultPattern(char* fname); // readDefaultPattern.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, pll, flashing firmware
|
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, pll, flashing firmware
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
@ -422,10 +415,6 @@ int validatePhaseinDegrees(enum CLKINDEX ind, int val, int retval);
|
|||||||
int setThresholdTemperature(int val);
|
int setThresholdTemperature(int val);
|
||||||
int setTemperatureControl(int val);
|
int setTemperatureControl(int val);
|
||||||
int setTemperatureEvent(int val);
|
int setTemperatureEvent(int val);
|
||||||
extern void eraseFlash(); // programFpgaBlackfin.h
|
|
||||||
extern int startWritingFPGAprogram(FILE** filefp); // programFpgaBlackfin.h
|
|
||||||
extern void stopWritingFPGAprogram(FILE* filefp); // programFpgaBlackfin.h
|
|
||||||
extern int writeFPGAProgram(char* fpgasrc, uint64_t fsize, FILE* filefp); // programFpgaBlackfin.h
|
|
||||||
void alignDeserializer();
|
void alignDeserializer();
|
||||||
|
|
||||||
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
// eiger specific - iodelay, pulse, rate, temp, activate, delay nw parameter
|
||||||
@ -504,18 +493,6 @@ void setTimingSource(enum timingSourceType value);
|
|||||||
enum timingSourceType getTimingSource();
|
enum timingSourceType getTimingSource();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
|
||||||
extern void NotifyServerStartSuccess();
|
|
||||||
extern void CreateNotificationForCriticalTasks();
|
|
||||||
extern void rebootControllerAndFPGA(); // programFpgaNios.h
|
|
||||||
extern int findFlash(char* mess); // programFpgaNios.h
|
|
||||||
extern void eraseFlash(); // programFpgaNios.h
|
|
||||||
extern int eraseAndWriteToFlash(char* mess, char* fpgasrc, uint64_t fsize); // programFpgaNios.h
|
|
||||||
extern int writeFPGAProgram(char* mess, char* fpgasrc, uint64_t fsize, FILE* filefp); // programFpgaNios.h
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||||
int getTenGigaFlowControl();
|
int getTenGigaFlowControl();
|
||||||
int setTenGigaFlowControl(int value);
|
int setTenGigaFlowControl(int value);
|
||||||
@ -575,7 +552,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod);
|
|||||||
int calculateDataBytes();
|
int calculateDataBytes();
|
||||||
int getTotalNumberOfChannels();
|
int getTotalNumberOfChannels();
|
||||||
#if defined(MOENCHD) || defined(CHIPTESTBOARDD)
|
#if defined(MOENCHD) || defined(CHIPTESTBOARDD)
|
||||||
int getNumberOfChannels(int* nchanx, int* nchany);
|
void getNumberOfChannels(int* nchanx, int* nchany);
|
||||||
#endif
|
#endif
|
||||||
int getNumberOfChips();
|
int getNumberOfChips();
|
||||||
int getNumberOfDACs();
|
int getNumberOfDACs();
|
||||||
|
@ -20,7 +20,7 @@ void validate64(int64_t arg, int64_t retval, char* modename, enum numberMode num
|
|||||||
int executeCommand(char* command, char* result, enum TLogLevel level);
|
int executeCommand(char* command, char* result, enum TLogLevel level);
|
||||||
int M_nofunc(int);
|
int M_nofunc(int);
|
||||||
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
extern void rebootControllerAndFPGA();
|
void rebootNiosControllerAndFPGA();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// functions called by client
|
// functions called by client
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// Global variables from errno.h
|
// Global variables from errno.h
|
||||||
extern int errno;
|
//extern int errno;
|
||||||
|
|
||||||
// Variables that will be exported
|
// Variables that will be exported
|
||||||
int lockStatus = 0;
|
int lockStatus = 0;
|
||||||
|
@ -63,7 +63,11 @@ int loadDefaultPattern(char* fname) {
|
|||||||
uint64_t word = 0;
|
uint64_t word = 0;
|
||||||
|
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if (sscanf(line, "%s 0x%x 0x%lx", command, &addr, &word) != 3) {
|
||||||
|
#else
|
||||||
if (sscanf(line, "%s 0x%x 0x%llx", command, &addr, &word) != 3) {
|
if (sscanf(line, "%s 0x%x 0x%llx", command, &addr, &word) != 3) {
|
||||||
|
#endif
|
||||||
sprintf(initErrorMessage, "Could not scan patword arguments from default "
|
sprintf(initErrorMessage, "Could not scan patword arguments from default "
|
||||||
"pattern file. Line:[%s].\n", line);
|
"pattern file. Line:[%s].\n", line);
|
||||||
break;
|
break;
|
||||||
@ -79,7 +83,11 @@ int loadDefaultPattern(char* fname) {
|
|||||||
uint64_t arg = 0;
|
uint64_t arg = 0;
|
||||||
|
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if (sscanf(line, "%s 0x%lx", command, &arg) != 2) {
|
||||||
|
#else
|
||||||
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
|
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
|
||||||
|
#endif
|
||||||
sprintf(initErrorMessage, "Could not scan patioctrl arguments from default "
|
sprintf(initErrorMessage, "Could not scan patioctrl arguments from default "
|
||||||
"pattern file. Line:[%s].\n", line);
|
"pattern file. Line:[%s].\n", line);
|
||||||
break;
|
break;
|
||||||
@ -95,7 +103,11 @@ int loadDefaultPattern(char* fname) {
|
|||||||
uint64_t arg = 0;
|
uint64_t arg = 0;
|
||||||
|
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if (sscanf(line, "%s 0x%lx", command, &arg) != 2) {
|
||||||
|
#else
|
||||||
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
|
if (sscanf(line, "%s 0x%llx", command, &arg) != 2) {
|
||||||
|
#endif
|
||||||
sprintf(initErrorMessage, "Could not scan patclkctrl arguments from default "
|
sprintf(initErrorMessage, "Could not scan patclkctrl arguments from default "
|
||||||
"pattern file. Line:[%s].\n", line);
|
"pattern file. Line:[%s].\n", line);
|
||||||
break;
|
break;
|
||||||
@ -226,7 +238,11 @@ int loadDefaultPattern(char* fname) {
|
|||||||
uint64_t waittime = 0;
|
uint64_t waittime = 0;
|
||||||
|
|
||||||
// cannot scan values
|
// cannot scan values
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
if (sscanf(line, "%s %ld", command, &waittime) != 2) {
|
||||||
|
#else
|
||||||
if (sscanf(line, "%s %lld", command, &waittime) != 2) {
|
if (sscanf(line, "%s %lld", command, &waittime) != 2) {
|
||||||
|
#endif
|
||||||
sprintf(initErrorMessage, "Could not scan patwaittime%d arguments from default "
|
sprintf(initErrorMessage, "Could not scan patwaittime%d arguments from default "
|
||||||
"pattern file. Line:[%s].\n", level, line);
|
"pattern file. Line:[%s].\n", level, line);
|
||||||
break;
|
break;
|
||||||
@ -253,7 +269,7 @@ int loadDefaultPattern(char* fname) {
|
|||||||
|
|
||||||
int default_writePatternWord(char* line, uint32_t addr, uint64_t word) {
|
int default_writePatternWord(char* line, uint32_t addr, uint64_t word) {
|
||||||
//validations
|
//validations
|
||||||
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
if ((int32_t)addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
||||||
sprintf(initErrorMessage, "Cannot set pattern word from default "
|
sprintf(initErrorMessage, "Cannot set pattern word from default "
|
||||||
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
|
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
|
||||||
MAX_PATTERN_LENGTH, line);
|
MAX_PATTERN_LENGTH, line);
|
||||||
@ -267,8 +283,13 @@ int default_writePatternWord(char* line, uint32_t addr, uint64_t word) {
|
|||||||
int default_writePatternIOControl(char* line, uint64_t arg) {
|
int default_writePatternIOControl(char* line, uint64_t arg) {
|
||||||
uint64_t retval = writePatternIOControl(arg);
|
uint64_t retval = writePatternIOControl(arg);
|
||||||
if (retval != arg) {
|
if (retval != arg) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
sprintf(initErrorMessage, "Could not set patioctrl from default pattern "
|
||||||
|
"file. Set 0x%lx, read 0x%lx. Line:[%s]\n", arg, retval, line);
|
||||||
|
#else
|
||||||
sprintf(initErrorMessage, "Could not set patioctrl from default pattern "
|
sprintf(initErrorMessage, "Could not set patioctrl from default pattern "
|
||||||
"file. Set 0x%llx, read 0x%llx. Line:[%s]\n", arg, retval, line);
|
"file. Set 0x%llx, read 0x%llx. Line:[%s]\n", arg, retval, line);
|
||||||
|
#endif
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@ -278,8 +299,13 @@ int default_writePatternIOControl(char* line, uint64_t arg) {
|
|||||||
int default_writePatternClkControl(char* line, uint64_t arg) {
|
int default_writePatternClkControl(char* line, uint64_t arg) {
|
||||||
uint64_t retval = writePatternClkControl(arg);
|
uint64_t retval = writePatternClkControl(arg);
|
||||||
if (retval != arg) {
|
if (retval != arg) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
sprintf(initErrorMessage, "Could not set patclkctrl from default pattern "
|
||||||
|
"file. Set 0x%lx, read 0x%lx. Line:[%s]\n", arg, retval, line);
|
||||||
|
#else
|
||||||
sprintf(initErrorMessage, "Could not set patclkctrl from default pattern "
|
sprintf(initErrorMessage, "Could not set patclkctrl from default pattern "
|
||||||
"file. Set 0x%llx, read 0x%llx. Line:[%s]\n", arg, retval, line);
|
"file. Set 0x%llx, read 0x%llx. Line:[%s]\n", arg, retval, line);
|
||||||
|
#endif
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@ -287,8 +313,8 @@ int default_writePatternClkControl(char* line, uint64_t arg) {
|
|||||||
|
|
||||||
int default_setPatternLoopLimits(char* line, uint32_t startAddr, uint32_t stopAddr) {
|
int default_setPatternLoopLimits(char* line, uint32_t startAddr, uint32_t stopAddr) {
|
||||||
//validations
|
//validations
|
||||||
if (startAddr < 0 || startAddr >= MAX_PATTERN_LENGTH ||
|
if ((int32_t)startAddr < 0 || startAddr >= MAX_PATTERN_LENGTH ||
|
||||||
stopAddr < 0 || stopAddr >= MAX_PATTERN_LENGTH) {
|
(int32_t)stopAddr < 0 || stopAddr >= MAX_PATTERN_LENGTH) {
|
||||||
sprintf(initErrorMessage, "Cannot set patlimits from default "
|
sprintf(initErrorMessage, "Cannot set patlimits from default "
|
||||||
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
|
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
|
||||||
MAX_PATTERN_LENGTH, line);
|
MAX_PATTERN_LENGTH, line);
|
||||||
@ -299,7 +325,7 @@ int default_setPatternLoopLimits(char* line, uint32_t startAddr, uint32_t stopAd
|
|||||||
setPatternLoop(-1, &r_startAddr, &r_stopAddr, &numLoops);
|
setPatternLoop(-1, &r_startAddr, &r_stopAddr, &numLoops);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
if (r_startAddr != startAddr || r_stopAddr != stopAddr) {
|
if (r_startAddr != (int)startAddr || r_stopAddr != (int)stopAddr) {
|
||||||
sprintf(initErrorMessage, "Could not set patlimits from default pattern "
|
sprintf(initErrorMessage, "Could not set patlimits from default pattern "
|
||||||
"file. Read start addr:0x%x, stop addr: 0x%x. Line:[%s]\n",
|
"file. Read start addr:0x%x, stop addr: 0x%x. Line:[%s]\n",
|
||||||
r_startAddr, r_stopAddr, line);
|
r_startAddr, r_stopAddr, line);
|
||||||
@ -316,8 +342,8 @@ int default_setPatternLoopAddresses(char* line, int level, uint32_t startAddr, u
|
|||||||
line);
|
line);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (startAddr < 0 || startAddr >= MAX_PATTERN_LENGTH ||
|
if ((int32_t)startAddr < 0 || startAddr >= MAX_PATTERN_LENGTH ||
|
||||||
stopAddr < 0 || stopAddr >= MAX_PATTERN_LENGTH) {
|
(int32_t)stopAddr < 0 || stopAddr >= MAX_PATTERN_LENGTH) {
|
||||||
sprintf(initErrorMessage, "Cannot set patloop (level: %d) from default "
|
sprintf(initErrorMessage, "Cannot set patloop (level: %d) from default "
|
||||||
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
|
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
|
||||||
level, MAX_PATTERN_LENGTH, line);
|
level, MAX_PATTERN_LENGTH, line);
|
||||||
@ -328,7 +354,7 @@ int default_setPatternLoopAddresses(char* line, int level, uint32_t startAddr, u
|
|||||||
setPatternLoop(level, &r_startAddr, &r_stopAddr, &numLoops);
|
setPatternLoop(level, &r_startAddr, &r_stopAddr, &numLoops);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
if (r_startAddr != startAddr || r_stopAddr != stopAddr) {
|
if (r_startAddr != (int)startAddr || r_stopAddr != (int)stopAddr) {
|
||||||
sprintf(initErrorMessage, "Could not set patloop (level: %d) from default "
|
sprintf(initErrorMessage, "Could not set patloop (level: %d) from default "
|
||||||
"pattern file. Read start addr:0x%x, stop addr: 0x%x. Line:[%s]\n",
|
"pattern file. Read start addr:0x%x, stop addr: 0x%x. Line:[%s]\n",
|
||||||
level, r_startAddr, r_stopAddr, line);
|
level, r_startAddr, r_stopAddr, line);
|
||||||
@ -374,14 +400,14 @@ int default_setPatternWaitAddresses(char* line, int level, uint32_t addr) {
|
|||||||
line);
|
line);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
if ((int32_t)addr < 0 || addr >= MAX_PATTERN_LENGTH) {
|
||||||
sprintf(initErrorMessage, "Cannot set patwait address (level: %d) from default "
|
sprintf(initErrorMessage, "Cannot set patwait address (level: %d) from default "
|
||||||
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
|
"pattern file. Addr must be between 0 and 0x%x. Line:[%s]\n",
|
||||||
level, MAX_PATTERN_LENGTH, line);
|
level, MAX_PATTERN_LENGTH, line);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int retval = setPatternWaitAddress(level, addr);
|
uint32_t retval = setPatternWaitAddress(level, addr);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
if (retval != addr) {
|
if (retval != addr) {
|
||||||
@ -405,9 +431,15 @@ int default_setPatternWaitTime(char* line, int level, uint64_t waittime) {
|
|||||||
|
|
||||||
// validate
|
// validate
|
||||||
if (retval != waittime) {
|
if (retval != waittime) {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
sprintf(initErrorMessage, "Could not set patwaittime (level: %d) from default "
|
||||||
|
"pattern file. Read %ld wait time. Line:[%s]\n",
|
||||||
|
level, retval, line);
|
||||||
|
#else
|
||||||
sprintf(initErrorMessage, "Could not set patwaittime (level: %d) from default "
|
sprintf(initErrorMessage, "Could not set patwaittime (level: %d) from default "
|
||||||
"pattern file. Read %lld wait time. Line:[%s]\n",
|
"pattern file. Read %lld wait time. Line:[%s]\n",
|
||||||
level, retval, line);
|
level, retval, line);
|
||||||
|
#endif
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -152,7 +152,7 @@ int main(int argc, char *argv[]){
|
|||||||
FILE_LOG(logINFORED,("Rebooting!\n"));
|
FILE_LOG(logINFORED,("Rebooting!\n"));
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
rebootControllerAndFPGA();
|
rebootNiosControllerAndFPGA();
|
||||||
#else
|
#else
|
||||||
system("reboot");
|
system("reboot");
|
||||||
#endif
|
#endif
|
||||||
|
@ -611,6 +611,11 @@ int M_nofunc(int file_des) {
|
|||||||
return Server_SendResult(file_des, OTHER, NO_UPDATE, NULL, 0);
|
return Server_SendResult(file_des, OTHER, NO_UPDATE, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
|
void rebootNiosControllerAndFPGA() {
|
||||||
|
rebootControllerAndFPGA();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int exec_command(int file_des) {
|
int exec_command(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
@ -1377,14 +1382,35 @@ int get_adc(int file_des) {
|
|||||||
case I_POWER_IO:
|
case I_POWER_IO:
|
||||||
serverAdcIndex = I_PWR_IO;
|
serverAdcIndex = I_PWR_IO;
|
||||||
break;
|
break;
|
||||||
|
case SLOW_ADC0:
|
||||||
|
serverAdcIndex = S_ADC0;
|
||||||
|
break;
|
||||||
|
case SLOW_ADC1:
|
||||||
|
serverAdcIndex = S_ADC1;
|
||||||
|
break;
|
||||||
|
case SLOW_ADC2:
|
||||||
|
serverAdcIndex = S_ADC2;
|
||||||
|
break;
|
||||||
|
case SLOW_ADC3:
|
||||||
|
serverAdcIndex = S_ADC3;
|
||||||
|
break;
|
||||||
|
case SLOW_ADC4:
|
||||||
|
serverAdcIndex = S_ADC4;
|
||||||
|
break;
|
||||||
|
case SLOW_ADC5:
|
||||||
|
serverAdcIndex = S_ADC5;
|
||||||
|
break;
|
||||||
|
case SLOW_ADC6:
|
||||||
|
serverAdcIndex = S_ADC6;
|
||||||
|
break;
|
||||||
|
case SLOW_ADC7:
|
||||||
|
serverAdcIndex = S_ADC7;
|
||||||
|
break;
|
||||||
|
case SLOW_ADC_TEMP:
|
||||||
|
serverAdcIndex = S_TMP;
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
#ifdef CHIPTESTBOARDD
|
|
||||||
if (ind >= SLOW_ADC0 && ind <= SLOW_ADC_TEMP) {
|
|
||||||
serverAdcIndex = ind;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
modeNotImplemented("Adc Index", (int)ind);
|
modeNotImplemented("Adc Index", (int)ind);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1535,7 +1561,7 @@ int set_module(int file_des) {
|
|||||||
module.reg, module.nchan, module.nchip,
|
module.reg, module.nchan, module.nchip,
|
||||||
module.ndac, module.iodelay, module.tau, module.eV));
|
module.ndac, module.iodelay, module.tau, module.eV));
|
||||||
// should at least have a dac
|
// should at least have a dac
|
||||||
if (ts <= sizeof(sls_detector_module)) {
|
if (ts <= (int)sizeof(sls_detector_module)) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Cannot set module. Received incorrect number of dacs or channels\n");
|
sprintf(mess, "Cannot set module. Received incorrect number of dacs or channels\n");
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
@ -2992,7 +3018,7 @@ int set_pattern_io_control(int file_des) {
|
|||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
FILE_LOG(logDEBUG1, ("Setting Pattern IO Control to 0x%llx\n", (long long int)arg));
|
FILE_LOG(logDEBUG1, ("Setting Pattern IO Control to 0x%llx\n", (long long int)arg));
|
||||||
if ((arg == -1) || (Server_VerifyLock() == OK)) {
|
if (((int64_t)arg == -1) || (Server_VerifyLock() == OK)) {
|
||||||
retval = writePatternIOControl(arg);
|
retval = writePatternIOControl(arg);
|
||||||
FILE_LOG(logDEBUG1, ("Pattern IO Control retval: 0x%llx\n", (long long int) retval));
|
FILE_LOG(logDEBUG1, ("Pattern IO Control retval: 0x%llx\n", (long long int) retval));
|
||||||
validate64(arg, retval, "Pattern IO Control", HEX);
|
validate64(arg, retval, "Pattern IO Control", HEX);
|
||||||
@ -3018,7 +3044,7 @@ int set_pattern_clock_control(int file_des) {
|
|||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
FILE_LOG(logDEBUG1, ("Setting Pattern Clock Control to 0x%llx\n", (long long int)arg));
|
FILE_LOG(logDEBUG1, ("Setting Pattern Clock Control to 0x%llx\n", (long long int)arg));
|
||||||
if ((arg == -1) || (Server_VerifyLock() == OK)) {
|
if (((int64_t)arg == -1) || (Server_VerifyLock() == OK)) {
|
||||||
retval = writePatternClkControl(arg);
|
retval = writePatternClkControl(arg);
|
||||||
FILE_LOG(logDEBUG1, ("Pattern Clock Control retval: 0x%llx\n", (long long int) retval));
|
FILE_LOG(logDEBUG1, ("Pattern Clock Control retval: 0x%llx\n", (long long int) retval));
|
||||||
validate64(arg, retval, "Pattern Clock Control", HEX);
|
validate64(arg, retval, "Pattern Clock Control", HEX);
|
||||||
@ -3204,7 +3230,7 @@ int set_pattern_wait_time(int file_des) {
|
|||||||
int loopLevel = (int)args[0];
|
int loopLevel = (int)args[0];
|
||||||
uint64_t timeval = args[1];
|
uint64_t timeval = args[1];
|
||||||
FILE_LOG(logDEBUG1, ("Setting Pattern wait time (loopLevel:%d timeval:0x%llx)\n", loopLevel, (long long int)timeval));
|
FILE_LOG(logDEBUG1, ("Setting Pattern wait time (loopLevel:%d timeval:0x%llx)\n", loopLevel, (long long int)timeval));
|
||||||
if ((timeval == -1) || (Server_VerifyLock() == OK)) {
|
if (((int64_t)timeval == -1) || (Server_VerifyLock() == OK)) {
|
||||||
// valid loop level 0-2
|
// valid loop level 0-2
|
||||||
if (loopLevel < 0 || loopLevel > 2) {
|
if (loopLevel < 0 || loopLevel > 2) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -4608,7 +4634,11 @@ int set_starting_frame_number(int file_des) {
|
|||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
else if (arg > UDP_HEADER_MAX_FRAME_VALUE) {
|
else if (arg > UDP_HEADER_MAX_FRAME_VALUE) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
sprintf(mess, "Could not set starting frame number. Must be less then %ld (0x%lx)\n", UDP_HEADER_MAX_FRAME_VALUE, UDP_HEADER_MAX_FRAME_VALUE);
|
||||||
|
#else
|
||||||
sprintf(mess, "Could not set starting frame number. Must be less then %lld (0x%llx)\n", UDP_HEADER_MAX_FRAME_VALUE, UDP_HEADER_MAX_FRAME_VALUE);
|
sprintf(mess, "Could not set starting frame number. Must be less then %lld (0x%llx)\n", UDP_HEADER_MAX_FRAME_VALUE, UDP_HEADER_MAX_FRAME_VALUE);
|
||||||
|
#endif
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4630,7 +4660,11 @@ int set_starting_frame_number(int file_des) {
|
|||||||
} else {
|
} else {
|
||||||
if (arg != retval) {
|
if (arg != retval) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
sprintf(mess, "Could not set starting frame number. Set 0x%lx, but read 0x%lx\n", arg, retval);
|
||||||
|
#else
|
||||||
sprintf(mess, "Could not set starting frame number. Set 0x%llx, but read 0x%llx\n", arg, retval);
|
sprintf(mess, "Could not set starting frame number. Set 0x%llx, but read 0x%llx\n", arg, retval);
|
||||||
|
#endif
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
#define APILIB 0x200227
|
#define APILIB 0x200227
|
||||||
#define APIRECEIVER 0x200227
|
#define APIRECEIVER 0x200227
|
||||||
#define APIGUI 0x200227
|
#define APIGUI 0x200227
|
||||||
#define APIMYTHEN3 0x200305
|
#define APICTB 0x200310
|
||||||
#define APIGOTTHARD2 0x200305
|
#define APIGOTTHARD 0x200310
|
||||||
#define APIJUNGFRAU 0x200306
|
#define APIGOTTHARD2 0x200310
|
||||||
#define APIGOTTHARD 0x200309
|
#define APIJUNGFRAU 0x200310
|
||||||
#define APIEIGER 0x200309
|
#define APIMYTHEN3 0x200310
|
||||||
#define APIMOENCH 0x200309
|
#define APIMOENCH 0x200310
|
||||||
#define APICTB 0x200309
|
#define APIEIGER 0x200310
|
||||||
|
Loading…
x
Reference in New Issue
Block a user