gotthard2: inejct channel done

This commit is contained in:
2019-11-13 16:49:35 +01:00
parent 28a5aa8342
commit 21d23be522
7 changed files with 39 additions and 22 deletions

View File

@ -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;

View File

@ -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;