mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
gotthard2: inejct channel done
This commit is contained in:
Binary file not shown.
@ -1074,17 +1074,18 @@ int setInjectChannel(int offset, int increment) {
|
||||
int startCh = 4; // 4 due to padding
|
||||
int ich = 0;
|
||||
for (ich = startCh + offset; ich < startCh + NCHAN; ich = ich + increment) {
|
||||
buffer[ich] = 1;
|
||||
int byteIndex = ich / 8;
|
||||
int bitIndex = ich % 8;
|
||||
buffer[byteIndex] |= (1 << (8 - 1 - bitIndex));
|
||||
}
|
||||
|
||||
for (ich = 0; ich < sizeof(buffer); ++ich) {
|
||||
printf("%d : 0x%02hhx\n", ich, buffer[ich]);
|
||||
}
|
||||
// address at the end
|
||||
buffer[16] |= (ASIC_CURRENT_INJECT_ADDR);
|
||||
|
||||
//int chipIndex = -1; // for all chips
|
||||
//if (ASIC_Driver_Set(chipIndex, sizeof(buffer), buffer) == FAIL) {
|
||||
// return FAIL;
|
||||
//}
|
||||
int chipIndex = -1; // for all chips
|
||||
if (ASIC_Driver_Set(chipIndex, sizeof(buffer), buffer) == FAIL) {
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
injectedChannelsOffset = offset;
|
||||
injectedChannelsIncrement = increment;
|
||||
|
@ -78,6 +78,11 @@ enum CLKINDEX {READOUT_C0, READOUT_C1, SYSTEM_C0, SYSTEM_C
|
||||
|
||||
enum PLLINDEX {READOUT_PLL, SYSTEM_PLL};
|
||||
|
||||
|
||||
/** Chip Definitions */
|
||||
#define ASIC_CURRENT_INJECT_ADDR (0x9)
|
||||
|
||||
|
||||
/* Struct Definitions */
|
||||
typedef struct udp_header_struct {
|
||||
uint32_t udp_destmac_msb;
|
||||
|
@ -30,22 +30,12 @@ int ASIC_Driver_Set (int index, int length, char* buffer) {
|
||||
sprintf(fname, "%s%d", ASIC_Driver_DriverFileName, index + 1);
|
||||
FILE_LOG(logDEBUG1, ("\t[chip index: %d, length: %d, fname: %s]\n", index, length, fname));
|
||||
{
|
||||
char printbuffer[2 * length + 15];
|
||||
memset(printbuffer, 0, 2 * length);
|
||||
strcpy(printbuffer, "\t[values: ");
|
||||
FILE_LOG(logDEBUG1, ("\t[values: \n"));
|
||||
int i;
|
||||
for (i = 0; i < length; ++i) {
|
||||
char bytes[10]="";
|
||||
sprintf(bytes, "0x%02hhx", buffer[i]);
|
||||
strcat(printbuffer, bytes);
|
||||
if (i < length - 1) {
|
||||
strcat(printbuffer, "\t");
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("\t%d: 0x%02hhx\n", i, buffer[i]));
|
||||
}
|
||||
int len = strlen(printbuffer);
|
||||
printbuffer[len - 1] = ']';
|
||||
printbuffer[len] = '\0';
|
||||
FILE_LOG(logDEBUG1, ("%s\n", printbuffer));
|
||||
FILE_LOG(logDEBUG1, ("\t]\n"));
|
||||
}
|
||||
|
||||
int fd=open(fname, O_RDWR);
|
||||
|
@ -6177,7 +6177,7 @@ int set_inject_channel(int file_des) {
|
||||
ret = setInjectChannel(offset, increment);
|
||||
if (ret == FAIL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not inject channel\n", offset, increment);
|
||||
strcpy(mess, "Could not inject channel\n");
|
||||
FILE_LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
|
@ -925,6 +925,7 @@ class CmdProxy {
|
||||
std::string ROI(int action);
|
||||
std::string ClearROI(int action);
|
||||
/* Gotthard2 Specific */
|
||||
std::string InjectChannel(int action);
|
||||
/* CTB Specific */
|
||||
std::string Samples(int action);
|
||||
std::string Dbitphase(int action);
|
||||
|
@ -9,6 +9,26 @@
|
||||
auto GET = slsDetectorDefs::GET_ACTION;
|
||||
auto PUT = slsDetectorDefs::PUT_ACTION;
|
||||
|
||||
TEST_CASE("inj_ch", "[.cmd][.gotthard2]") {
|
||||
if (test::type == slsDetectorDefs::GOTTHARD2) {
|
||||
{
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(multiSlsDetectorClient("inj_ch 0 1", PUT, nullptr, oss));
|
||||
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
REQUIRE_NOTHROW(multiSlsDetectorClient("inj_ch", GET, nullptr, oss));
|
||||
REQUIRE(oss.str() == "inj_ch [0, 1]\n");
|
||||
}
|
||||
REQUIRE_THROWS(multiSlsDetectorClient("inj_ch -1 1", PUT));
|
||||
REQUIRE_THROWS(multiSlsDetectorClient("inj_ch 0 1", PUT));
|
||||
} else {
|
||||
REQUIRE_THROWS(multiSlsDetectorClient("inj_ch", GET));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("vchip", "[.cmd]") {
|
||||
int prev_val = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user