mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 23:10:02 +02:00
commit
5a7451e29e
@ -8,7 +8,6 @@ if [ $# -eq 0 ]; then
|
||||
)
|
||||
else
|
||||
declare -a det=("${1}")
|
||||
echo "got something"
|
||||
fi
|
||||
|
||||
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")
|
||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DCHIPTESTBOARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = ctbDetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
Binary file not shown.
@ -237,8 +237,7 @@ int testFpga() {
|
||||
|
||||
volatile uint32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val = 0x5A5A5A5A - i;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -302,9 +301,8 @@ int testBus() {
|
||||
|
||||
volatile uint32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val += 0xbbbbb;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -463,15 +461,14 @@ void setupDetector() {
|
||||
analogDataPtr = 0;
|
||||
digitalDataPtr = 0;
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK;
|
||||
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK;
|
||||
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK;
|
||||
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK;
|
||||
for (i = 0; i < NDAC; ++i)
|
||||
for (int i = 0; i < NDAC; ++i)
|
||||
dacValues[i] = -1;
|
||||
}
|
||||
vLimit = DEFAULT_VLIMIT;
|
||||
@ -528,12 +525,9 @@ void setupDetector() {
|
||||
// switch off dacs (power regulators most likely only sets to minimum (if
|
||||
// power enable on))
|
||||
LOG(logINFOBLUE, ("Powering down all dacs\n"));
|
||||
{
|
||||
int idac = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
setDAC(idac, LTC2620_GetPowerDownValue(),
|
||||
0); // has to be before setvchip
|
||||
}
|
||||
for (int idac = 0; idac < NDAC; ++idac) {
|
||||
setDAC(idac, LTC2620_GetPowerDownValue(),
|
||||
0); // has to be before setvchip
|
||||
}
|
||||
|
||||
// power regulators
|
||||
@ -649,8 +643,7 @@ void updateDataBytes() {
|
||||
if (adcEnableMask_1g == BIT32_MSK)
|
||||
nachans = 32;
|
||||
else {
|
||||
int ichan = 0;
|
||||
for (ichan = 0; ichan < NCHAN_ANALOG; ++ichan) {
|
||||
for (int ichan = 0; ichan < NCHAN_ANALOG; ++ichan) {
|
||||
if (adcEnableMask_1g & (1 << ichan))
|
||||
++nachans;
|
||||
}
|
||||
@ -735,8 +728,7 @@ void setADCEnableMask_10G(uint32_t mask) {
|
||||
uint8_t actualMask = 0;
|
||||
if (mask != 0) {
|
||||
int ival = 0;
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
|
||||
for (int ich = 0; ich < NCHAN_ANALOG; ich = ich + 4) {
|
||||
if ((1 << ich) & mask) {
|
||||
actualMask |= (1 << ival);
|
||||
}
|
||||
@ -766,13 +758,11 @@ uint32_t getADCEnableMask_10G() {
|
||||
// convert 8 bit mask to 32 bit mask
|
||||
uint32_t retval = 0;
|
||||
if (adcEnableMask_10g) {
|
||||
int ival = 0;
|
||||
int iloop = 0;
|
||||
for (ival = 0; ival < 8; ++ival) {
|
||||
for (int ival = 0; ival < 8; ++ival) {
|
||||
// if bit in 8 bit mask set
|
||||
if ((1 << ival) & adcEnableMask_10g) {
|
||||
// set it for 4 bits in 32 bit mask
|
||||
for (iloop = 0; iloop < 4; ++iloop) {
|
||||
for (int iloop = 0; iloop < 4; ++iloop) {
|
||||
retval |= (1 << (ival * 4 + iloop));
|
||||
}
|
||||
}
|
||||
@ -1196,9 +1186,8 @@ int getVChipToSet(enum DACINDEX ind, int val) {
|
||||
// get maximum value of the adc values (minimum is 0)
|
||||
int max = 0;
|
||||
|
||||
int ipwr = 0;
|
||||
// loop through the adcs
|
||||
for (ipwr = 0; ipwr < NPWR - 1; ++ipwr) {
|
||||
for (int ipwr = 0; ipwr < NPWR - 1; ++ipwr) {
|
||||
|
||||
// get the dac values for each adc
|
||||
int dacmV = getPower(getDACIndexFromADCIndex(ipwr));
|
||||
@ -2310,18 +2299,14 @@ void *start_timer(void *arg) {
|
||||
// Generate Data
|
||||
char imageData[imageSize];
|
||||
memset(imageData, 0, imageSize);
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = i;
|
||||
}
|
||||
for (int i = 0; i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = i;
|
||||
}
|
||||
|
||||
// Send data
|
||||
{
|
||||
int frameNr = 0;
|
||||
// loop over number of frames
|
||||
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
@ -2337,30 +2322,27 @@ void *start_timer(void *arg) {
|
||||
|
||||
int srcOffset = 0;
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != packetsPerFrame; ++i) {
|
||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
||||
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
// set header
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
// set header
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
@ -2555,11 +2537,8 @@ void readSample(int ns) {
|
||||
bus_w(addr, bus_r(addr) & (~DUMMY_ANLG_FIFO_RD_STRBE_MSK));
|
||||
|
||||
// wait for 1 us to latch different clocks of read and read strobe
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
}
|
||||
for (int i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
|
||||
if (!(ns % 1000)) {
|
||||
LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x "
|
||||
@ -2569,8 +2548,7 @@ void readSample(int ns) {
|
||||
}
|
||||
|
||||
// loop through all channels
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
for (int ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
|
||||
// if channel is in enable mask
|
||||
if ((1 << ich) & (adcEnableMask_1g)) {
|
||||
@ -2604,11 +2582,8 @@ void readSample(int ns) {
|
||||
bus_w(addr, bus_r(addr) & (~DUMMY_DGTL_FIFO_RD_STRBE_MSK));
|
||||
|
||||
// wait for 1 us to latch different clocks of read and read strobe
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
}
|
||||
for (int i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
|
||||
// wait as it is connected directly to fifo running on a different clock
|
||||
if (!(ns % 1000)) {
|
||||
@ -2735,8 +2710,7 @@ void getNumberOfChannels(int *nchanx, int *nchany) {
|
||||
if (mask == BIT32_MASK) {
|
||||
nachans = NCHAN_ANALOG;
|
||||
} else {
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
for (int ich = 0; ich < NCHAN_ANALOG; ++ich) {
|
||||
if ((mask & (1 << ich)) != 0U)
|
||||
++nachans;
|
||||
}
|
||||
|
@ -141,8 +141,7 @@ void Beb_Beb(int id) {
|
||||
exit(1);
|
||||
|
||||
LOG(logDEBUG1, ("Printing Beb infos:\n"));
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++)
|
||||
for (unsigned int i = 1; i < bebInfoSize; i++)
|
||||
BebInfo_Print(&beb_infos[i]);
|
||||
|
||||
Beb_bit_mode = 4;
|
||||
@ -749,11 +748,7 @@ void Beb_ResetFrameNumber() {
|
||||
}
|
||||
}
|
||||
|
||||
void Beb_ClearBebInfos() {
|
||||
// unsigned int i;
|
||||
// for(i=0;i<bebInfoSize;i++) free(beb_infos[i]);
|
||||
bebInfoSize = 0;
|
||||
}
|
||||
void Beb_ClearBebInfos() { bebInfoSize = 0; }
|
||||
|
||||
int Beb_InitBebInfos() { // file name at some point
|
||||
Beb_ClearBebInfos();
|
||||
@ -817,8 +812,8 @@ int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig,
|
||||
}
|
||||
|
||||
int Beb_CheckSourceStuffBebInfo() {
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++) { // header stuff always starts from 1
|
||||
for (unsigned int i = 1; i < bebInfoSize;
|
||||
i++) { // header stuff always starts from 1
|
||||
if (!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]), 0,
|
||||
"00:00:00:00:00:00", "10.0.0.1", 20000) ||
|
||||
!Beb_SetHeaderData(BebInfo_GetBebNumber(&beb_infos[i]), 1,
|
||||
@ -833,10 +828,7 @@ int Beb_CheckSourceStuffBebInfo() {
|
||||
}
|
||||
|
||||
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb) {
|
||||
/******************** if (!beb_numb) return
|
||||
* 0;******************************/
|
||||
unsigned int i;
|
||||
for (i = 1; i < bebInfoSize; i++)
|
||||
for (unsigned int i = 1; i < bebInfoSize; i++)
|
||||
if (beb_numb == BebInfo_GetBebNumber(&beb_infos[i])) {
|
||||
LOG(logDEBUG1,
|
||||
("*****found beb index:%d, for beb number:%d\n", i, beb_numb));
|
||||
@ -870,14 +862,13 @@ int Beb_WriteTo(unsigned int index) {
|
||||
}
|
||||
|
||||
void Beb_SwapDataFun(int little_endian, unsigned int n, unsigned int *d) {
|
||||
unsigned int i;
|
||||
if (little_endian)
|
||||
for (i = 0; i < n; i++)
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
d[i] = (((d[i] & 0xff) << 24) | ((d[i] & 0xff00) << 8) |
|
||||
((d[i] & 0xff0000) >> 8) |
|
||||
((d[i] & 0xff000000) >> 24)); // little_endian
|
||||
else
|
||||
for (i = 0; i < n; i++)
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
d[i] = (((d[i] & 0xffff) << 16) | ((d[i] & 0xffff0000) >> 16));
|
||||
}
|
||||
|
||||
@ -976,13 +967,9 @@ udp_header_type udp_header = {
|
||||
|
||||
unsigned int *base_ptr = (unsigned int *)&udp_header;
|
||||
unsigned int num_words = (sizeof(struct udp_header_type) + 3) / 4;
|
||||
// for(unsigned int i=0; i<num_words; i++) word_ptr[i] = base_ptr[i];
|
||||
// for(unsigned int i=num_words; i<16; i++) word_ptr[i] = 0;
|
||||
// return word_ptr;
|
||||
unsigned int i;
|
||||
for (i = 0; i < num_words; i++)
|
||||
for (unsigned int i = 0; i < num_words; i++)
|
||||
Beb_send_data[i + 2] = base_ptr[i];
|
||||
for (i = num_words; i < 16; i++)
|
||||
for (unsigned int i = num_words; i < 16; i++)
|
||||
Beb_send_data[i + 2] = 0;
|
||||
|
||||
return 1;
|
||||
@ -1046,8 +1033,7 @@ void Beb_AdjustIPChecksum(struct udp_header_type *ip) {
|
||||
|
||||
// calc ip checksum
|
||||
unsigned int ip_checksum = 0;
|
||||
unsigned int i;
|
||||
for (i = 0; i < 10; i++) {
|
||||
for (unsigned int i = 0; i < 10; i++) {
|
||||
ip_checksum += ((cptr[2 * i] << 8) + (cptr[2 * i + 1]));
|
||||
if (ip_checksum & 0x00010000)
|
||||
ip_checksum = (ip_checksum + 1) & 0x0000ffff;
|
||||
@ -1190,11 +1176,9 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
LOG(logERROR, ("Beb Request N Images FAIL\n"));
|
||||
return 0;
|
||||
} else {
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
}
|
||||
// Generating commands
|
||||
u_int32_t send_header_command =
|
||||
@ -1203,13 +1187,11 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
u_int32_t send_frame_command =
|
||||
0x62000000 | (!test_just_send_out_packets_no_wait) << 27 |
|
||||
(ten_gig == 1) << 24 | packet_size << 14 | (npackets - 1);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base, (LEFT_OFFSET + i * 4))));
|
||||
}
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
|
||||
// Left
|
||||
Beb_Write32(csp0base, (LEFT_OFFSET + FIRST_CMD_PART1_OFFSET), 0);
|
||||
@ -1246,14 +1228,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig,
|
||||
nimages * (2 + in_two_requests));
|
||||
Beb_Write32(csp0base, (RIGHT_OFFSET + COMMAND_COUNTER_OFFSET),
|
||||
nimages * (2 + in_two_requests));
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 10; i++)
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base,
|
||||
(LEFT_OFFSET + i * 4)))); //*(ptrl+i));
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
for (int i = 0; i < 10; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("%X\n", Beb_Read32(csp0base,
|
||||
(LEFT_OFFSET + i * 4)))); //*(ptrl+i));
|
||||
}
|
||||
LOG(logDEBUG1, ("%d\n", in_two_requests));
|
||||
Beb_close(fd, csp0base);
|
||||
|
||||
LOG(logDEBUG1, ("----Beb_RequestNImages----\n"));
|
||||
@ -1275,8 +1255,7 @@ int Beb_Test(unsigned int beb_number) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (unsigned int i = 0; i < 64; i++) {
|
||||
if (!Beb_SetUpUDPHeader(beb_number, 0, i, "60:fb:42:f4:e3:d2",
|
||||
"129.129.205.186", 22000 + i)) {
|
||||
LOG(logERROR, ("Error setting up header table....\n"));
|
||||
@ -1288,7 +1267,7 @@ int Beb_Test(unsigned int beb_number) {
|
||||
// left_right, int ten_gig, unsigned int dst_number, unsigned int
|
||||
// npackets, unsigned int packet_size, int
|
||||
// stop_read_when_fifo_empty=1);
|
||||
for (i = 0; i < 64; i++) {
|
||||
for (unsigned int i = 0; i < 64; i++) {
|
||||
if (!Beb_SendMultiReadRequest(beb_number, i % 3 + 1, 0, i, 1, 0, 1)) {
|
||||
LOG(logERROR, ("Error requesting data....\n"));
|
||||
return 0;
|
||||
|
@ -63,7 +63,6 @@ int Feb_Control_hv_fd = -1;
|
||||
|
||||
void Module_Module(struct Module *mod, unsigned int number,
|
||||
unsigned int address_top) {
|
||||
unsigned int i;
|
||||
mod->module_number = number;
|
||||
mod->top_address_valid = 1;
|
||||
mod->top_left_address = 0x100 | (0xff & address_top);
|
||||
@ -75,15 +74,14 @@ void Module_Module(struct Module *mod, unsigned int number,
|
||||
mod->high_voltage = -1;
|
||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
||||
}
|
||||
|
||||
void Module_ModuleBottom(struct Module *mod, unsigned int number,
|
||||
unsigned int address_bottom) {
|
||||
unsigned int i;
|
||||
mod->module_number = number;
|
||||
mod->top_address_valid = 0;
|
||||
mod->top_left_address = 0;
|
||||
@ -94,20 +92,19 @@ void Module_ModuleBottom(struct Module *mod, unsigned int number,
|
||||
|
||||
mod->high_voltage = -1;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
mod->idelay_top[i] = mod->idelay_bottom[i] = 0;
|
||||
|
||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
||||
}
|
||||
|
||||
void Module_Module1(struct Module *mod, unsigned int number,
|
||||
unsigned int address_top, unsigned int address_bottom) {
|
||||
unsigned int i;
|
||||
mod->module_number = number;
|
||||
mod->top_address_valid = 1;
|
||||
mod->top_left_address = 0x100 | (0xff & address_top);
|
||||
@ -118,14 +115,14 @@ void Module_Module1(struct Module *mod, unsigned int number,
|
||||
|
||||
mod->high_voltage = -1;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
mod->idelay_top[i] = mod->idelay_bottom[i] = 0;
|
||||
|
||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
||||
for (i = 0; i < Module_ndacs; i++)
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
||||
}
|
||||
|
||||
@ -219,7 +216,6 @@ void Feb_Control_FebControl() {
|
||||
}
|
||||
|
||||
int Feb_Control_Init(int master, int top, int normal, int module_num) {
|
||||
unsigned int i;
|
||||
Feb_Control_module_number = 0;
|
||||
Feb_Control_current_index = 0;
|
||||
Feb_control_master = master;
|
||||
@ -241,7 +237,7 @@ int Feb_Control_Init(int master, int top, int normal, int module_num) {
|
||||
|
||||
unsigned int nfebs = 0;
|
||||
unsigned int *feb_list = malloc(moduleSize * 4 * sizeof(unsigned int));
|
||||
for (i = 1; i < moduleSize; i++) {
|
||||
for (unsigned int i = 1; i < moduleSize; i++) {
|
||||
if (Module_TopAddressIsValid(&modules[i])) {
|
||||
feb_list[nfebs++] = Module_GetTopRightAddress(&modules[i]);
|
||||
feb_list[nfebs++] = Module_GetTopLeftAddress(&modules[i]);
|
||||
@ -321,9 +317,8 @@ void Feb_Control_CloseSerialCommunication() {
|
||||
}
|
||||
|
||||
void Feb_Control_PrintModuleList() {
|
||||
unsigned int i;
|
||||
LOG(logDEBUG1, ("Module list:\n"));
|
||||
for (i = 0; i < moduleSize; i++) {
|
||||
for (unsigned int i = 0; i < moduleSize; i++) {
|
||||
LOG(logDEBUG1,
|
||||
("\t%d) %s modules: %d 0x%x %s\n", i,
|
||||
((i == 0) ? "All " : ((i == 1) ? "Master" : " ")),
|
||||
@ -338,8 +333,7 @@ void Feb_Control_PrintModuleList() {
|
||||
|
||||
int Feb_Control_GetModuleIndex(unsigned int module_number,
|
||||
unsigned int *module_index) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < moduleSize; i++) {
|
||||
for (unsigned int i = 0; i < moduleSize; i++) {
|
||||
if (Module_GetModuleNumber(&modules[i]) == module_number) {
|
||||
*module_index = i;
|
||||
return 1;
|
||||
@ -350,10 +344,9 @@ int Feb_Control_GetModuleIndex(unsigned int module_number,
|
||||
}
|
||||
|
||||
int Feb_Control_CheckModuleAddresses(struct Module *m) {
|
||||
unsigned int i;
|
||||
int found_t = 0;
|
||||
int found_b = 0;
|
||||
for (i = 0; i < moduleSize; i++) {
|
||||
for (unsigned int i = 0; i < moduleSize; i++) {
|
||||
if ((Module_TopAddressIsValid(m) &&
|
||||
Module_GetTopBaseAddress(&modules[i]) &&
|
||||
Module_GetTopBaseAddress(m) ==
|
||||
@ -408,8 +401,7 @@ int Feb_Control_AddModule1(unsigned int module_number, int top_enable,
|
||||
LOG(logINFO, ("\tRemoving previous assignment of module number %d.\n",
|
||||
module_number));
|
||||
// free(modules[pre_module_index]);
|
||||
int i;
|
||||
for (i = pre_module_index; i < moduleSize - 1; i++)
|
||||
for (int i = pre_module_index; i < moduleSize - 1; i++)
|
||||
modules[i] = modules[i + 1];
|
||||
moduleSize--;
|
||||
parameters_ok = 0;
|
||||
@ -460,13 +452,12 @@ Module_ModuleBottom(m,module_number,top_address);*/
|
||||
|
||||
int Feb_Control_CheckSetup(int master) {
|
||||
LOG(logDEBUG1, ("Checking Set up\n"));
|
||||
unsigned int i, j;
|
||||
unsigned int i;
|
||||
int ok = 1;
|
||||
|
||||
/*for(i=0;i<moduleSize;i++) {*/
|
||||
i = Feb_Control_current_index;
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (unsigned int j = 0; j < 4; j++) {
|
||||
if (Module_GetTopIDelay(&modules[i], j) < 0) {
|
||||
LOG(logERROR, ("module %d's idelay top number %d not set.\n",
|
||||
Module_GetModuleNumber(&modules[i]), j));
|
||||
@ -484,7 +475,7 @@ int Feb_Control_CheckSetup(int master) {
|
||||
Module_GetModuleNumber(&modules[i])));
|
||||
ok = 0;
|
||||
}
|
||||
for (j = 0; j < Module_ndacs; j++) {
|
||||
for (unsigned int j = 0; j < Module_ndacs; j++) {
|
||||
if (Module_GetTopDACValue(&modules[i], j) < 0) {
|
||||
LOG(logERROR,
|
||||
("module %d's top \"%s\" dac is not set.\n",
|
||||
@ -511,8 +502,7 @@ unsigned int Feb_Control_GetNModules() {
|
||||
|
||||
unsigned int Feb_Control_GetNHalfModules() {
|
||||
unsigned int n_half_modules = 0;
|
||||
unsigned int i;
|
||||
for (i = 1; i < moduleSize; i++) {
|
||||
for (unsigned int i = 1; i < moduleSize; i++) {
|
||||
if (Module_TopAddressIsValid(&modules[i]))
|
||||
n_half_modules++;
|
||||
if (Module_BottomAddressIsValid(&modules[i]))
|
||||
@ -536,7 +526,6 @@ int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units) {
|
||||
int Feb_Control_SetIDelays1(
|
||||
unsigned int module_num, unsigned int chip_pos,
|
||||
unsigned int ndelay_units) { // chip_pos 0=ll,1=lr,0=rl,1=rr
|
||||
unsigned int i;
|
||||
// currently set same for top and bottom
|
||||
if (chip_pos > 3) {
|
||||
LOG(logERROR, ("SetIDelay chip_pos %d doesn't exist.\n", chip_pos));
|
||||
@ -560,10 +549,10 @@ int Feb_Control_SetIDelays1(
|
||||
Module_SetTopIDelay(&modules[module_index], chip_pos,
|
||||
ndelay_units);
|
||||
else {
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetTopIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetBottomIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
}
|
||||
@ -582,10 +571,10 @@ int Feb_Control_SetIDelays1(
|
||||
Module_SetBottomIDelay(&modules[module_index], chip_pos,
|
||||
ndelay_units);
|
||||
else {
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetTopIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetBottomIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
}
|
||||
@ -605,7 +594,7 @@ int Feb_Control_SetIDelays1(
|
||||
Module_SetTopIDelay(&modules[module_index], chip_pos,
|
||||
ndelay_units);
|
||||
else
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetTopIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
} else {
|
||||
@ -623,7 +612,7 @@ int Feb_Control_SetIDelays1(
|
||||
Module_SetBottomIDelay(&modules[module_index], chip_pos,
|
||||
ndelay_units);
|
||||
else
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetBottomIDelay(&modules[i], chip_pos,
|
||||
ndelay_units);
|
||||
} else {
|
||||
@ -930,7 +919,6 @@ int Feb_Control_DecodeDACString(char *dac_str, unsigned int *module_index,
|
||||
}
|
||||
|
||||
int Feb_Control_SetDAC(char *dac_str, int value, int is_a_voltage_mv) {
|
||||
unsigned int i;
|
||||
unsigned int module_index, dac_ch;
|
||||
int top, bottom;
|
||||
if (!Feb_Control_DecodeDACString(dac_str, &module_index, &top, &bottom,
|
||||
@ -958,7 +946,7 @@ int Feb_Control_SetDAC(char *dac_str, int value, int is_a_voltage_mv) {
|
||||
if (module_index != 0)
|
||||
Module_SetTopDACValue(&modules[module_index], dac_ch, v);
|
||||
else
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetTopDACValue(&modules[i], dac_ch, v);
|
||||
}
|
||||
|
||||
@ -970,7 +958,7 @@ int Feb_Control_SetDAC(char *dac_str, int value, int is_a_voltage_mv) {
|
||||
if (module_index != 0)
|
||||
Module_SetBottomDACValue(&modules[module_index], dac_ch, v);
|
||||
else
|
||||
for (i = 0; i < moduleSize; i++)
|
||||
for (unsigned int i = 0; i < moduleSize; i++)
|
||||
Module_SetBottomDACValue(&modules[i], dac_ch, v);
|
||||
}
|
||||
|
||||
@ -1004,8 +992,7 @@ int Feb_Control_GetDACName(unsigned int dac_num, char *s) {
|
||||
}
|
||||
|
||||
int Feb_Control_GetDACNumber(char *s, unsigned int *n) {
|
||||
unsigned int i;
|
||||
for (i = 0; i < Module_ndacs; i++) {
|
||||
for (unsigned int i = 0; i < Module_ndacs; i++) {
|
||||
if (!strcmp(Module_dac_names[i], s)) {
|
||||
*n = i;
|
||||
return 1;
|
||||
@ -1051,10 +1038,6 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
int top) {
|
||||
LOG(logINFO, ("Setting Trimbits\n"));
|
||||
|
||||
// for (int iy=10000;iy<20020;++iy)//263681
|
||||
// for (int iy=263670;iy<263680;++iy)//263681
|
||||
// LOG(logINFO, ("%d:%c\t\t",iy,trimbits[iy]));
|
||||
|
||||
unsigned int trimbits_to_load_l[1024];
|
||||
unsigned int trimbits_to_load_r[1024];
|
||||
|
||||
@ -1067,8 +1050,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
if (Feb_Control_Reset() == STATUS_ERROR) {
|
||||
LOG(logERROR, ("could not reset DAQ.\n"));
|
||||
}
|
||||
int l_r;
|
||||
for (l_r = 0; l_r < 2; l_r++) { // l_r loop
|
||||
for (int l_r = 0; l_r < 2; l_r++) { // l_r loop
|
||||
unsigned int disable_chip_mask =
|
||||
l_r ? DAQ_CS_BAR_LEFT : DAQ_CS_BAR_RIGHT;
|
||||
if (Feb_Control_activated) {
|
||||
@ -1085,8 +1067,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
}
|
||||
}
|
||||
|
||||
int row_set;
|
||||
for (row_set = 0; row_set < 16; row_set++) { // 16 rows at a time
|
||||
for (int row_set = 0; row_set < 16; row_set++) { // 16 rows at a time
|
||||
if (row_set == 0) {
|
||||
if (!Feb_Control_SetCommandRegister(
|
||||
DAQ_RESET_COMPLETELY | DAQ_SEND_A_TOKEN_IN |
|
||||
@ -1104,11 +1085,9 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
}
|
||||
}
|
||||
|
||||
int row;
|
||||
for (row = 0; row < 16; row++) { // row loop
|
||||
for (int row = 0; row < 16; row++) { // row loop
|
||||
int offset = 2 * 32 * row;
|
||||
int sc;
|
||||
for (sc = 0; sc < 32; sc++) { // supercolumn loop sc
|
||||
for (int sc = 0; sc < 32; sc++) { // supercolumn loop sc
|
||||
int super_column_start_position_l =
|
||||
1030 * row + l_r * 258 + sc * 8;
|
||||
int super_column_start_position_r =
|
||||
@ -1125,8 +1104,7 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits,
|
||||
trimbits_to_load_r[offset + chip_sc] = 0;
|
||||
trimbits_to_load_l[offset + chip_sc + 32] = 0;
|
||||
trimbits_to_load_r[offset + chip_sc + 32] = 0;
|
||||
int i;
|
||||
for (i = 0; i < 8; i++) { // column loop i
|
||||
for (int i = 0; i < 8; i++) { // column loop i
|
||||
|
||||
if (top == 1) {
|
||||
trimbits_to_load_l[offset + chip_sc] |=
|
||||
@ -1865,8 +1843,7 @@ int Feb_Control_StartAcquisition() {
|
||||
static unsigned int reg_nums[20];
|
||||
static unsigned int reg_vals[20];
|
||||
|
||||
int i;
|
||||
for (i = 0; i < 14; i++) {
|
||||
for (int i = 0; i < 14; i++) {
|
||||
reg_nums[i] = DAQ_REG_CTRL;
|
||||
reg_vals[i] = 0;
|
||||
}
|
||||
@ -1888,8 +1865,7 @@ int Feb_Control_StopAcquisition() { return Feb_Control_Reset(); }
|
||||
|
||||
int Feb_Control_SaveAllTrimbitsTo(int value, int top) {
|
||||
unsigned int chanregs[Feb_Control_trimbit_size];
|
||||
int i;
|
||||
for (i = 0; i < Feb_Control_trimbit_size; i++)
|
||||
for (int i = 0; i < Feb_Control_trimbit_size; i++)
|
||||
chanregs[i] = value;
|
||||
return Feb_Control_SetTrimbits(0, chanregs, top);
|
||||
}
|
||||
@ -1902,7 +1878,6 @@ int Feb_Control_Pulse_Pixel(int npulses, int x, int y) {
|
||||
// this function is not designed for speed
|
||||
|
||||
int pulse_multiple = 0; // has to be 0 or 1
|
||||
int i;
|
||||
|
||||
if (x < 0) {
|
||||
x = -x;
|
||||
@ -1939,7 +1914,7 @@ int Feb_Control_Pulse_Pixel(int npulses, int x, int y) {
|
||||
|
||||
if (!pulse_multiple)
|
||||
serial_in = 0;
|
||||
for (i = 0; i < x / 8; i++)
|
||||
for (int i = 0; i < x / 8; i++)
|
||||
Feb_Control_Shift32InSerialIn(serial_in);
|
||||
|
||||
Feb_Control_SendTokenIn();
|
||||
@ -2015,7 +1990,6 @@ int Feb_Control_ClockRowClock(unsigned int ntimes) {
|
||||
}
|
||||
|
||||
int Feb_Control_PulseChip(int npulses) {
|
||||
int i;
|
||||
int on = 1;
|
||||
|
||||
if (npulses == -1) {
|
||||
@ -2030,7 +2004,7 @@ int Feb_Control_PulseChip(int npulses) {
|
||||
Feb_Control_SetStaticBits(); // toggle the enable 2x times
|
||||
Feb_Control_ResetChipCompletely();
|
||||
|
||||
for (i = 0; i < npulses; i++) {
|
||||
for (int i = 0; i < npulses; i++) {
|
||||
if (!Feb_Control_SetCommandRegister(
|
||||
DAQ_CHIP_CONTROLLER_SUPER_SLOW_SPEED | DAQ_RESET_PERIPHERY |
|
||||
DAQ_RESET_COLUMN_SELECT)) {
|
||||
@ -2092,8 +2066,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||
tau_in_sec, period_in_sec));
|
||||
|
||||
LOG(logINFO, ("\tCalculating table for tau of %lld ns.\n", tau_in_Nsec));
|
||||
int i;
|
||||
for (i = 0; i < np; i++) {
|
||||
for (int i = 0; i < np; i++) {
|
||||
Feb_Control_rate_meas[i] = i * exp(-i / period_in_sec * tau_in_sec);
|
||||
if (Feb_Control_rate_meas[i] > ratemax)
|
||||
ratemax = Feb_Control_rate_meas[i];
|
||||
@ -2123,8 +2096,7 @@ int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec) {
|
||||
Feb_Control_rate_correction_table[0] =
|
||||
(((int)(m[0] + 0.5) & 0xf) << 14) | ((int)(b0[0] + 0.5) & 0x3fff);
|
||||
|
||||
int b = 0;
|
||||
for (b = 1; b < 1024; b++) {
|
||||
for (int b = 1; b < 1024; b++) {
|
||||
if (m[b - 1] < 15) {
|
||||
double s = 0, sx = 0, sy = 0, sxx = 0, sxy = 0;
|
||||
for (;; next_i++) {
|
||||
@ -2278,9 +2250,8 @@ void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction) {
|
||||
}
|
||||
|
||||
int Feb_Control_PrintCorrectedValues() {
|
||||
int i;
|
||||
int delta, slope, base, lsb, corr;
|
||||
for (i = 0; i < 4096; i++) {
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
lsb = i & 3;
|
||||
base = Feb_Control_rate_correction_table[i >> 2] & 0x3fff;
|
||||
slope = ((Feb_Control_rate_correction_table[i >> 2] & 0x3c000) >> 14);
|
||||
@ -2400,8 +2371,7 @@ int Feb_Control_SetInterruptSubframe(int val) {
|
||||
? Module_GetTopLeftAddress(&modules[1])
|
||||
: Module_GetBottomLeftAddress(&modules[1]);
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 2; ++iloop) {
|
||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||
// get previous value to keep it
|
||||
if (!Feb_Interface_ReadRegister(addr[iloop], offset, ®Val)) {
|
||||
LOG(logERROR, ("Could not read %s %s interrupt subframe\n", isTop,
|
||||
@ -2438,8 +2408,7 @@ int Feb_Control_GetInterruptSubframe() {
|
||||
: Module_GetBottomLeftAddress(&modules[1]);
|
||||
uint32_t value[2] = {0, 0};
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 2; ++iloop) {
|
||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||
if (!Feb_Interface_ReadRegister(addr[iloop], offset, ®Val)) {
|
||||
LOG(logERROR, ("Could not read back %s %s interrupt subframe\n",
|
||||
isTop, side[iloop]));
|
||||
@ -2469,8 +2438,7 @@ int Feb_Control_SetTop(enum TOPINDEX ind, int left, int right) {
|
||||
addr[1] = Module_GetTopRightAddress(&modules[1]);
|
||||
}
|
||||
char *top_names[] = {TOP_NAMES};
|
||||
int i = 0;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (addr[i] == 0) {
|
||||
continue;
|
||||
}
|
||||
@ -2518,8 +2486,7 @@ int Feb_Control_SetMaster(enum MASTERINDEX ind) {
|
||||
addr[0] = Module_GetTopLeftAddress(&modules[1]);
|
||||
addr[1] = Module_GetTopRightAddress(&modules[1]);
|
||||
char *master_names[] = {MASTER_NAMES};
|
||||
int i = 0;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
uint32_t value = 0;
|
||||
if (!Feb_Interface_ReadRegister(addr[i], offset, &value)) {
|
||||
LOG(logERROR, ("Could not read %s Feb reg to set Master flag\n",
|
||||
@ -2617,8 +2584,7 @@ int Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
|
||||
actualOffset = offset - 0x100;
|
||||
}
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 2; ++iloop) {
|
||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||
if (run[iloop]) {
|
||||
LOG(logINFO, ("Writing 0x%x to %s %s 0x%x\n", data, isTop,
|
||||
side[iloop], actualOffset));
|
||||
@ -2666,8 +2632,7 @@ int Feb_Control_ReadRegister(uint32_t offset, uint32_t *retval) {
|
||||
actualOffset = offset - 0x100;
|
||||
}
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 2; ++iloop) {
|
||||
for (int iloop = 0; iloop < 2; ++iloop) {
|
||||
if (run[iloop]) {
|
||||
if (!Feb_Interface_ReadRegister(addr[iloop], actualOffset,
|
||||
&value[iloop])) {
|
||||
|
@ -42,12 +42,11 @@ void Feb_Interface_FebInterface() {
|
||||
}
|
||||
|
||||
void Feb_Interface_SendCompleteList(unsigned int n, unsigned int *list) {
|
||||
unsigned int i;
|
||||
if (Feb_Interface_feb_numb)
|
||||
free(Feb_Interface_feb_numb);
|
||||
Feb_Interface_nfebs = n;
|
||||
Feb_Interface_feb_numb = malloc(n * sizeof(unsigned int));
|
||||
for (i = 0; i < n; i++)
|
||||
for (unsigned int i = 0; i < n; i++)
|
||||
Feb_Interface_feb_numb[i] = list[i];
|
||||
}
|
||||
|
||||
@ -72,7 +71,6 @@ int Feb_Interface_WriteTo(unsigned int ch) {
|
||||
}
|
||||
|
||||
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
|
||||
unsigned int t;
|
||||
if (ch >= 0xfff)
|
||||
return 0;
|
||||
|
||||
@ -81,7 +79,7 @@ int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
|
||||
usleep(20);
|
||||
|
||||
Feb_Interface_recv_ndata = -1;
|
||||
for (t = 0; t < ntrys; t++) {
|
||||
for (unsigned int t = 0; t < ntrys; t++) {
|
||||
if ((Feb_Interface_recv_ndata =
|
||||
Local_Read(ll, Feb_Interface_recv_buffer_size * 4,
|
||||
Feb_Interface_recv_data_raw) /
|
||||
@ -102,9 +100,8 @@ int Feb_Interface_SetByteOrder() {
|
||||
Feb_Interface_send_ndata = 2;
|
||||
Feb_Interface_send_data[0] = 0;
|
||||
Feb_Interface_send_data[1] = 0;
|
||||
unsigned int i;
|
||||
unsigned int dst = 0xff;
|
||||
for (i = 0; i < Feb_Interface_nfebs; i++)
|
||||
for (unsigned int i = 0; i < Feb_Interface_nfebs; i++)
|
||||
dst = (dst | Feb_Interface_feb_numb[i]);
|
||||
int passed = Feb_Interface_WriteTo(dst);
|
||||
|
||||
@ -119,8 +116,6 @@ int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,
|
||||
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
|
||||
unsigned int *reg_nums,
|
||||
unsigned int *values_read) {
|
||||
// here cout<<"Reading Register ...."<<endl;
|
||||
unsigned int i;
|
||||
nreads &= 0x3ff;
|
||||
if (!nreads || nreads > Feb_Interface_send_buffer_size - 2)
|
||||
return 0;
|
||||
@ -128,7 +123,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
|
||||
Feb_Interface_send_ndata = nreads + 2;
|
||||
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
|
||||
|
||||
for (i = 0; i < nreads; i++)
|
||||
for (unsigned int i = 0; i < nreads; i++)
|
||||
Feb_Interface_send_data[i + 1] = reg_nums[i];
|
||||
Feb_Interface_send_data[nreads + 1] = 0;
|
||||
|
||||
@ -137,7 +132,7 @@ int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads,
|
||||
Feb_Interface_recv_ndata != (int)(nreads + 2))
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < nreads; i++)
|
||||
for (unsigned int i = 0; i < nreads; i++)
|
||||
values_read[i] = Feb_Interface_recv_data[i + 1];
|
||||
|
||||
return 1;
|
||||
@ -154,7 +149,6 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
|
||||
unsigned int *reg_nums, unsigned int *values,
|
||||
int *wait_ons,
|
||||
unsigned int *wait_on_addresses) {
|
||||
unsigned int i;
|
||||
nwrites &= 0x3ff; // 10 bits
|
||||
if (!nwrites || 2 * nwrites > Feb_Interface_send_buffer_size - 2)
|
||||
return 0;
|
||||
@ -165,13 +159,13 @@ int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites,
|
||||
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
|
||||
Feb_Interface_send_data[2 * nwrites + 1] = 0;
|
||||
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[2 * i + 1] = 0x3fff & reg_nums[i];
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[2 * i + 2] = values[i];
|
||||
// wait on busy data(28), address of busy flag data(27 downto 14)
|
||||
if (wait_ons && wait_on_addresses)
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[2 * i + 1] |=
|
||||
(wait_ons[i] << 28 | (0x3fff & wait_on_addresses[i]) << 14);
|
||||
|
||||
@ -211,7 +205,6 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
|
||||
unsigned int start_address, unsigned int nwrites,
|
||||
unsigned int *values) {
|
||||
// -1 means write to all
|
||||
unsigned int i;
|
||||
mem_num &= 0x3f;
|
||||
start_address &= 0x3fff;
|
||||
nwrites &= 0x3ff;
|
||||
@ -226,7 +219,7 @@ int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num,
|
||||
start_address; // cmd -> write to memory, nwrites, mem number, start
|
||||
// address
|
||||
Feb_Interface_send_data[nwrites + 1] = 0;
|
||||
for (i = 0; i < nwrites; i++)
|
||||
for (unsigned int i = 0; i < nwrites; i++)
|
||||
Feb_Interface_send_data[i + 1] = values[i];
|
||||
|
||||
if (!Feb_Interface_WriteTo(sub_num))
|
||||
|
@ -81,7 +81,6 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
// note: buffer must be word (4 byte) aligned
|
||||
// frame_len in byte
|
||||
int vacancy = 0;
|
||||
int i;
|
||||
int words_send = 0;
|
||||
int last_word;
|
||||
unsigned int *word_ptr;
|
||||
@ -96,7 +95,7 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
|
||||
LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ", buffer_len,
|
||||
ll->ll_fifo_base));
|
||||
for (i = 0; i < buffer_len / 4; i++)
|
||||
for (int i = 0; i < buffer_len / 4; i++)
|
||||
LOG(logDEBUG1, ("%.8X ", *(((unsigned *)buffer) + i)));
|
||||
|
||||
while (words_send <= last_word) {
|
||||
@ -112,8 +111,8 @@ int Local_Write(struct LocalLinkInterface *ll, unsigned int buffer_len,
|
||||
}
|
||||
|
||||
// Just to know: #define PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS 100
|
||||
for (i = 0; ((i < PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) &&
|
||||
(words_send <= last_word));
|
||||
for (int i = 0; ((i < PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS) &&
|
||||
(words_send <= last_word));
|
||||
i++) {
|
||||
fifo_ctrl = 0;
|
||||
if (words_send == 0) {
|
||||
|
@ -6,7 +6,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
BLACKFIN_CC = bfin-uclinux-gcc
|
||||
CROSS = powerpc-4xx-softfloat-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DEIGERD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = eigerDetectorServer
|
||||
DESTDIR = bin
|
||||
|
Binary file not shown.
@ -639,8 +639,7 @@ void allocateDetectorStructureMemory() {
|
||||
thisSettings = UNINITIALIZED;
|
||||
|
||||
// if trimval requested, should return -1 to acknowledge unknown
|
||||
int ichan = 0;
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
*((detectorModules->chanregs) + ichan) = -1;
|
||||
}
|
||||
}
|
||||
@ -651,9 +650,8 @@ void setupDetector() {
|
||||
// set dacs
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
if ((detectorModules)->dacs[i] != defaultvals[i]) {
|
||||
LOG(logERROR, ("Setting dac %d failed, wrote %d, read %d\n", i,
|
||||
@ -748,8 +746,7 @@ int setDynamicRange(int dr) {
|
||||
#ifndef VIRTUAL
|
||||
if (Feb_Control_SetDynamicRange(dr)) {
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
if (!Beb_SetUpTransferParameters(dr)) {
|
||||
LOG(logERROR, ("Could not set bit mode in the back end\n"));
|
||||
@ -829,8 +826,7 @@ void setNumFrames(int64_t val) {
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_ntriggers)) {
|
||||
eiger_nexposures = val;
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
ndsts_in_use = 1;
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
@ -851,8 +847,7 @@ void setNumTriggers(int64_t val) {
|
||||
if (Feb_Control_SetNExposures((unsigned int)val * eiger_nexposures)) {
|
||||
eiger_ntriggers = val;
|
||||
on_dst = 0;
|
||||
int i;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
}
|
||||
@ -1021,18 +1016,14 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
}
|
||||
|
||||
// dacs
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
if (myMod.dacs[i] != (detectorModules)->dacs[i]) {
|
||||
sprintf(mess, "Could not set module. Could not set dac %d\n",
|
||||
i);
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
if (myMod.dacs[i] != (detectorModules)->dacs[i]) {
|
||||
sprintf(mess, "Could not set module. Could not set dac %d\n", i);
|
||||
LOG(logERROR, (mess));
|
||||
setSettings(UNDEFINED);
|
||||
LOG(logERROR, ("Settings has been changed to undefined\n"));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1044,10 +1035,10 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
LOG(logINFO, ("Setting module with trimbits\n"));
|
||||
// includ gap pixels
|
||||
unsigned int tt[263680];
|
||||
int iy, ichip, ix, ip = 0, ich = 0;
|
||||
for (iy = 0; iy < 256; ++iy) {
|
||||
for (ichip = 0; ichip < 4; ++ichip) {
|
||||
for (ix = 0; ix < 256; ++ix) {
|
||||
int ip = 0, ich = 0;
|
||||
for (int iy = 0; iy < 256; ++iy) {
|
||||
for (int ichip = 0; ichip < 4; ++ichip) {
|
||||
for (int ix = 0; ix < 256; ++ix) {
|
||||
tt[ip++] = myMod.chanregs[ich++];
|
||||
}
|
||||
if (ichip < 3) {
|
||||
@ -1121,10 +1112,10 @@ int getModule(sls_detector_module *myMod) {
|
||||
tt = Feb_Control_GetTrimbits();
|
||||
|
||||
// exclude gap pixels
|
||||
int iy, ichip, ix, ip = 0, ich = 0;
|
||||
for (iy = 0; iy < 256; ++iy) {
|
||||
for (ichip = 0; ichip < 4; ++ichip) {
|
||||
for (ix = 0; ix < 256; ++iy) {
|
||||
int ip = 0, ich = 0;
|
||||
for (int iy = 0; iy < 256; ++iy) {
|
||||
for (int ichip = 0; ichip < 4; ++ichip) {
|
||||
for (int ix = 0; ix < 256; ++iy) {
|
||||
myMod->chanregs[ich++] = tt[ip++];
|
||||
}
|
||||
if (ichip < 3) {
|
||||
@ -1432,37 +1423,32 @@ int configureMAC() {
|
||||
if (!top)
|
||||
dst_port = dstport2;
|
||||
|
||||
int i = 0;
|
||||
/* for(i=0;i<32;i++) { modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num, send_to_ten_gig, src_mac, src_ip,
|
||||
srcport) &&
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number + i, dst_mac,
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number, dst_mac,
|
||||
dst_ip, dst_port)) {
|
||||
LOG(logDEBUG1, ("\tset up left ok\n"));
|
||||
} else {
|
||||
return FAIL;
|
||||
}
|
||||
/*}*/
|
||||
|
||||
header_number = 32;
|
||||
dst_port = dstport2;
|
||||
if (!top)
|
||||
dst_port = dstport;
|
||||
|
||||
/*for(i=0;i<32;i++) {*/ /** modified for Aldo*/
|
||||
if (Beb_SetBebSrcHeaderInfos(beb_num, send_to_ten_gig, src_mac, src_ip,
|
||||
srcport) &&
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number + i, dst_mac,
|
||||
Beb_SetUpUDPHeader(beb_num, send_to_ten_gig, header_number, dst_mac,
|
||||
dst_ip, dst_port)) {
|
||||
LOG(logDEBUG1, (" set up right ok\n"));
|
||||
} else {
|
||||
return FAIL;
|
||||
}
|
||||
/*}*/
|
||||
|
||||
on_dst = 0;
|
||||
|
||||
for (i = 0; i < 32; i++)
|
||||
for (int i = 0; i < 32; ++i)
|
||||
dst_requested[i] = 0; // clear dst requested
|
||||
nimages_per_request = eiger_nexposures * eiger_ntriggers;
|
||||
#endif
|
||||
@ -1849,8 +1835,7 @@ int setAllTrimbits(int val) {
|
||||
}
|
||||
#endif
|
||||
if (detectorModules) {
|
||||
int ichan;
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
*((detectorModules->chanregs) + ichan) = val;
|
||||
}
|
||||
}
|
||||
@ -1860,10 +1845,9 @@ int setAllTrimbits(int val) {
|
||||
}
|
||||
|
||||
int getAllTrimbits() {
|
||||
int ichan = 0;
|
||||
int value = *((detectorModules->chanregs));
|
||||
if (detectorModules) {
|
||||
for (ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (detectorModules->nchan); ichan++) {
|
||||
if (*((detectorModules->chanregs) + ichan) != value) {
|
||||
value = -1;
|
||||
break;
|
||||
@ -2094,10 +2078,9 @@ void *start_timer(void *arg) {
|
||||
char imageData[databytes * 2];
|
||||
memset(imageData, 0, databytes * 2);
|
||||
{
|
||||
int i = 0;
|
||||
switch (dr) {
|
||||
case 4:
|
||||
for (i = 0; i < ntotpixels / 2; ++i) {
|
||||
for (int i = 0; i < ntotpixels / 2; ++i) {
|
||||
*((uint8_t *)(imageData + i)) =
|
||||
eiger_virtual_test_mode
|
||||
? 0xEE
|
||||
@ -2105,19 +2088,19 @@ void *start_timer(void *arg) {
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint8_t *)(imageData + i)) =
|
||||
eiger_virtual_test_mode ? 0xFE : (uint8_t)i;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
eiger_virtual_test_mode ? 0xFFE : (uint16_t)i;
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
for (i = 0; i < ntotpixels; ++i) {
|
||||
for (int i = 0; i < ntotpixels; ++i) {
|
||||
*((uint32_t *)(imageData + i * sizeof(uint32_t))) =
|
||||
eiger_virtual_test_mode ? 0xFFFFFE : (uint32_t)i;
|
||||
}
|
||||
@ -2132,8 +2115,7 @@ void *start_timer(void *arg) {
|
||||
uint64_t frameNr = 0;
|
||||
getStartingFrameNumber(&frameNr);
|
||||
// loop over number of frames
|
||||
int iframes = 0;
|
||||
for (iframes = 0; iframes != numFrames; ++iframes) {
|
||||
for (int iframes = 0; iframes != numFrames; ++iframes) {
|
||||
|
||||
usleep(eiger_virtual_transmission_delay_frame);
|
||||
|
||||
@ -2154,76 +2136,72 @@ void *start_timer(void *arg) {
|
||||
int srcOffset2 = npixelsx;
|
||||
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != numPacketsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->row = row;
|
||||
header->column = colLeft;
|
||||
for (int i = 0; i != numPacketsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->row = row;
|
||||
header->column = colLeft;
|
||||
|
||||
char packetData2[packetsize];
|
||||
memset(packetData2, 0, packetsize);
|
||||
header = (sls_detector_header *)(packetData2);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->row = row;
|
||||
header->column = colRight;
|
||||
if (eiger_virtual_quad_mode) {
|
||||
header->row = 1; // right is next row
|
||||
header->column = 0; // right same first column
|
||||
}
|
||||
char packetData2[packetsize];
|
||||
memset(packetData2, 0, packetsize);
|
||||
header = (sls_detector_header *)(packetData2);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->row = row;
|
||||
header->column = colRight;
|
||||
if (eiger_virtual_quad_mode) {
|
||||
header->row = 1; // right is next row
|
||||
header->column = 0; // right same first column
|
||||
}
|
||||
|
||||
// fill data
|
||||
int dstOffset = sizeof(sls_detector_header);
|
||||
int dstOffset2 = sizeof(sls_detector_header);
|
||||
{
|
||||
int psize = 0;
|
||||
for (psize = 0; psize < datasize; psize += npixelsx) {
|
||||
// fill data
|
||||
int dstOffset = sizeof(sls_detector_header);
|
||||
int dstOffset2 = sizeof(sls_detector_header);
|
||||
{
|
||||
for (int psize = 0; psize < datasize; psize += npixelsx) {
|
||||
|
||||
if (dr == 32 && tgEnable == 0) {
|
||||
memcpy(packetData + dstOffset,
|
||||
imageData + srcOffset, npixelsx / 2);
|
||||
memcpy(packetData2 + dstOffset2,
|
||||
imageData + srcOffset2, npixelsx / 2);
|
||||
if (srcOffset % npixelsx == 0) {
|
||||
srcOffset += npixelsx / 2;
|
||||
srcOffset2 += npixelsx / 2;
|
||||
}
|
||||
// skip the other half (2 packets in 1 line for
|
||||
// 32 bit)
|
||||
else {
|
||||
srcOffset += npixelsx;
|
||||
srcOffset2 += npixelsx;
|
||||
}
|
||||
dstOffset += npixelsx / 2;
|
||||
dstOffset2 += npixelsx / 2;
|
||||
} else {
|
||||
memcpy(packetData + dstOffset,
|
||||
imageData + srcOffset, npixelsx);
|
||||
memcpy(packetData2 + dstOffset2,
|
||||
imageData + srcOffset2, npixelsx);
|
||||
srcOffset += 2 * npixelsx;
|
||||
srcOffset2 += 2 * npixelsx;
|
||||
dstOffset += npixelsx;
|
||||
dstOffset2 += npixelsx;
|
||||
if (dr == 32 && tgEnable == 0) {
|
||||
memcpy(packetData + dstOffset,
|
||||
imageData + srcOffset, npixelsx / 2);
|
||||
memcpy(packetData2 + dstOffset2,
|
||||
imageData + srcOffset2, npixelsx / 2);
|
||||
if (srcOffset % npixelsx == 0) {
|
||||
srcOffset += npixelsx / 2;
|
||||
srcOffset2 += npixelsx / 2;
|
||||
}
|
||||
// skip the other half (2 packets in 1 line for
|
||||
// 32 bit)
|
||||
else {
|
||||
srcOffset += npixelsx;
|
||||
srcOffset2 += npixelsx;
|
||||
}
|
||||
dstOffset += npixelsx / 2;
|
||||
dstOffset2 += npixelsx / 2;
|
||||
} else {
|
||||
memcpy(packetData + dstOffset,
|
||||
imageData + srcOffset, npixelsx);
|
||||
memcpy(packetData2 + dstOffset2,
|
||||
imageData + srcOffset2, npixelsx);
|
||||
srcOffset += 2 * npixelsx;
|
||||
srcOffset2 += 2 * npixelsx;
|
||||
dstOffset += npixelsx;
|
||||
dstOffset2 += npixelsx;
|
||||
}
|
||||
}
|
||||
usleep(eiger_virtual_transmission_delay_left);
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
usleep(eiger_virtual_transmission_delay_right);
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
usleep(eiger_virtual_transmission_delay_left);
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
usleep(eiger_virtual_transmission_delay_right);
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", iframes));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
@ -2309,10 +2287,6 @@ int startReadOut() {
|
||||
if ((ret_val = (!Beb_RequestNImages(beb_num, send_to_ten_gig, on_dst,
|
||||
nimages_per_request, 0))))
|
||||
break;
|
||||
// for(i=0;i<nimages_per_request;i++)
|
||||
// if ((ret_val =
|
||||
//(!Beb_RequestNImages(beb_num,send_to_ten_gig,on_dst,1,0))))
|
||||
// break;
|
||||
|
||||
dst_requested[on_dst++] = 0;
|
||||
on_dst %= ndsts_in_use;
|
||||
@ -2407,10 +2381,6 @@ void readFrame(int *ret, char *mess) {
|
||||
/* common */
|
||||
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
|
||||
int idac, ichan;
|
||||
int ret = OK;
|
||||
|
||||
LOG(logDEBUG1, ("Copying module\n"));
|
||||
|
||||
if (srcMod->serialnumber >= 0) {
|
||||
@ -2445,19 +2415,19 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
LOG(logDEBUG1, ("Copying register %x (%x)\n", destMod->reg, srcMod->reg));
|
||||
|
||||
if (destMod->nchan != 0) {
|
||||
for (ichan = 0; ichan < (srcMod->nchan); ichan++) {
|
||||
for (int ichan = 0; ichan < (srcMod->nchan); ichan++) {
|
||||
if (*((srcMod->chanregs) + ichan) >= 0)
|
||||
*((destMod->chanregs) + ichan) = *((srcMod->chanregs) + ichan);
|
||||
}
|
||||
} else
|
||||
LOG(logINFO, ("Not Copying trimbits\n"));
|
||||
|
||||
for (idac = 0; idac < (srcMod->ndac); idac++) {
|
||||
for (int idac = 0; idac < (srcMod->ndac); idac++) {
|
||||
if (*((srcMod->dacs) + idac) >= 0) {
|
||||
*((destMod->dacs) + idac) = *((srcMod->dacs) + idac);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int calculateDataBytes() {
|
||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = nios2-buildroot-linux-gnu-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = gotthard2DetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
Binary file not shown.
@ -1848,8 +1848,7 @@ int setVetoPhoton(int chipIndex, int gainIndex, int *values) {
|
||||
int offset = padding; // bit offset for commandbytes
|
||||
for (int ich = 0; ich < NCHAN; ++ich) {
|
||||
// loop through all bits in a value
|
||||
int iBit = 0;
|
||||
for (iBit = 0; iBit < lenDataBitsPerchannel; ++iBit) {
|
||||
for (int iBit = 0; iBit < lenDataBitsPerchannel; ++iBit) {
|
||||
commandBytes[offset++] =
|
||||
((values[ich] >> (lenDataBitsPerchannel - 1 - iBit)) & 0x1);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DGOTTHARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DGOTTHARDD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = gotthardDetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
Binary file not shown.
@ -167,8 +167,7 @@ int testFpga() {
|
||||
u_int32_t addr = DUMMY_REG;
|
||||
volatile u_int32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val = 0x5A5A5A5A - i;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -226,9 +225,8 @@ int testBus() {
|
||||
u_int32_t addr = DUMMY_REG;
|
||||
volatile u_int32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val += 0xbbbbb;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -436,14 +434,11 @@ void setupDetector() {
|
||||
int setDefaultDacs() {
|
||||
int ret = OK;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -477,8 +472,7 @@ void setPhaseShiftOnce() {
|
||||
detectorFirstServer = 1;
|
||||
LOG(logINFO,
|
||||
("Implementing the first phase shift of %d\n", phaseShift));
|
||||
int times = 0;
|
||||
for (times = 1; times < phaseShift; ++times) {
|
||||
for (int times = 1; times < phaseShift; ++times) {
|
||||
bus_w(addr, (INT_RSTN_MSK | ENT_RSTN_MSK | SW1_MSK |
|
||||
PHS_STP_MSK)); // 0x1821
|
||||
bus_w(addr, (INT_RSTN_MSK | ENT_RSTN_MSK |
|
||||
@ -495,8 +489,7 @@ void setPhaseShift(int numphaseshift) {
|
||||
|
||||
volatile u_int32_t val = bus_r(addr);
|
||||
LOG(logDEBUG1, ("Multipurpose reg: 0x%x\n", val));
|
||||
int times = 0;
|
||||
for (times = 1; times < numphaseshift; ++times) {
|
||||
for (int times = 1; times < numphaseshift; ++times) {
|
||||
bus_w(addr, val | PHS_STP_MSK);
|
||||
bus_w(addr, val & (~PHS_STP_MSK));
|
||||
}
|
||||
@ -947,23 +940,19 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
setSettings((enum detectorSettings)myMod.reg);
|
||||
|
||||
// set dac values
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NDAC; ++i)
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
}
|
||||
for (int i = 0; i < NDAC; ++i)
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getModule(sls_detector_module *myMod) {
|
||||
int idac = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
for (int idac = 0; idac < NDAC; ++idac) {
|
||||
if (dacValues[idac] >= 0)
|
||||
*((myMod->dacs) + idac) = dacValues[idac];
|
||||
}
|
||||
// check if all of them are not initialized
|
||||
int initialized = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
for (int idac = 0; idac < NDAC; ++idac) {
|
||||
if (dacValues[idac] >= 0)
|
||||
initialized = 1;
|
||||
}
|
||||
@ -1112,27 +1101,23 @@ int getADC(enum ADCINDEX ind) {
|
||||
// high clk low cs
|
||||
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
|
||||
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < reads; ++i) {
|
||||
for (int i = 0; i < reads; ++i) {
|
||||
|
||||
int j = 0;
|
||||
// low clk low cs
|
||||
for (j = 0; j < repeats; ++j)
|
||||
bus_w(addr, 0x0);
|
||||
// high clk low cs
|
||||
for (j = 0; j < repeats; ++j)
|
||||
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
|
||||
// low clk low cs
|
||||
for (int j = 0; j < repeats; ++j)
|
||||
bus_w(addr, 0x0);
|
||||
// high clk low cs
|
||||
for (int j = 0; j < repeats; ++j)
|
||||
bus_w(addr, (TEMP_SPI_IN_T1_CLK_MSK | TEMP_SPI_IN_T2_CLK_MSK));
|
||||
|
||||
// only the first time
|
||||
if (i <= 10) {
|
||||
if (ind == TEMP_ADC)
|
||||
value = (value << 1) +
|
||||
(bus_r(addrout) & TEMP_SPI_OUT_T1_DT_MSK);
|
||||
else
|
||||
value = (value << 1) +
|
||||
(bus_r(addrout) & TEMP_SPI_OUT_T2_DT_MSK);
|
||||
}
|
||||
// only the first time
|
||||
if (i <= 10) {
|
||||
if (ind == TEMP_ADC)
|
||||
value =
|
||||
(value << 1) + (bus_r(addrout) & TEMP_SPI_OUT_T1_DT_MSK);
|
||||
else
|
||||
value =
|
||||
(value << 1) + (bus_r(addrout) & TEMP_SPI_OUT_T2_DT_MSK);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1603,22 +1588,18 @@ void *start_timer(void *arg) {
|
||||
// Generate Data
|
||||
char imageData[imageSize];
|
||||
memset(imageData, 0, imageSize);
|
||||
{
|
||||
int i = 0;
|
||||
if (adcConfigured == -1) {
|
||||
*((uint32_t *)(imageData)) = 0xCACACACA;
|
||||
}
|
||||
for (i = sizeof(uint32_t); i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = (uint16_t)i;
|
||||
}
|
||||
if (adcConfigured == -1) {
|
||||
*((uint32_t *)(imageData)) = 0xCACACACA;
|
||||
}
|
||||
for (int i = sizeof(uint32_t); i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = (uint16_t)i;
|
||||
}
|
||||
|
||||
// Send data
|
||||
{
|
||||
int frameNr = 0;
|
||||
uint16_t frameHeaderNr = 2;
|
||||
// loop over number of frames
|
||||
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
@ -1634,22 +1615,19 @@ void *start_timer(void *arg) {
|
||||
|
||||
int srcOffset = 0;
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != packetsPerFrame; ++i) {
|
||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
||||
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
// set header
|
||||
*((uint16_t *)(packetData)) = frameHeaderNr;
|
||||
++frameHeaderNr;
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
// set header
|
||||
*((uint16_t *)(packetData)) = frameHeaderNr;
|
||||
++frameHeaderNr;
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + 4, imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
// fill data
|
||||
memcpy(packetData + 4, imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
@ -1768,8 +1746,7 @@ enum runStatus getRunStatus() {
|
||||
} else {
|
||||
LOG(logINFORED,
|
||||
("Status: Unknown Status: 0x%x. Trying again.\n", retval));
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < 10; ++iloop) {
|
||||
for (int iloop = 0; iloop < 10; ++iloop) {
|
||||
usleep(1000 * 1000);
|
||||
if (runState(logDEBUG1) != retval)
|
||||
return getRunStatus();
|
||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DJUNGFRAUD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DJUNGFRAUD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = jungfrauDetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
Binary file not shown.
@ -210,9 +210,8 @@ int testBus() {
|
||||
int ret = OK;
|
||||
u_int32_t addr = SET_TRIGGER_DELAY_LSB_REG;
|
||||
u_int32_t times = 1000 * 1000;
|
||||
u_int32_t i = 0;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (u_int32_t i = 0; i < times; ++i) {
|
||||
bus_w(addr, i * 100);
|
||||
if (i * 100 != bus_r(addr)) {
|
||||
LOG(logERROR,
|
||||
@ -376,11 +375,8 @@ void initStopServer() {
|
||||
void setupDetector() {
|
||||
LOG(logINFO, ("This Server is for 1 Jungfrau module (500k)\n"));
|
||||
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
#ifdef VIRTUAL
|
||||
virtual_status = 0;
|
||||
@ -462,14 +458,11 @@ void setupDetector() {
|
||||
int setDefaultDacs() {
|
||||
int ret = OK;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -747,23 +740,19 @@ int setModule(sls_detector_module myMod, char *mess) {
|
||||
setSettings((enum detectorSettings)myMod.reg);
|
||||
|
||||
// set dac values
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NDAC; ++i)
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
}
|
||||
for (int i = 0; i < NDAC; ++i)
|
||||
setDAC((enum DACINDEX)i, myMod.dacs[i], 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int getModule(sls_detector_module *myMod) {
|
||||
int idac = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
for (int idac = 0; idac < NDAC; ++idac) {
|
||||
if (dacValues[idac] >= 0)
|
||||
*((myMod->dacs) + idac) = dacValues[idac];
|
||||
}
|
||||
// check if all of them are not initialized
|
||||
int initialized = 0;
|
||||
for (idac = 0; idac < NDAC; ++idac) {
|
||||
for (int idac = 0; idac < NDAC; ++idac) {
|
||||
if (dacValues[idac] >= 0)
|
||||
initialized = 1;
|
||||
}
|
||||
@ -1753,22 +1742,18 @@ void *start_timer(void *arg) {
|
||||
// Generate data
|
||||
char imageData[DATA_BYTES];
|
||||
memset(imageData, 0, DATA_BYTES);
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < npixels; ++i) {
|
||||
// avoiding gain also being divided when gappixels enabled in call
|
||||
// back
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)i;
|
||||
}
|
||||
for (int i = 0; i < npixels; ++i) {
|
||||
// avoiding gain also being divided when gappixels enabled in call
|
||||
// back
|
||||
*((uint16_t *)(imageData + i * sizeof(uint16_t))) =
|
||||
virtual_image_test_mode ? 0x0FFE : (uint16_t)i;
|
||||
}
|
||||
|
||||
// Send data
|
||||
{
|
||||
uint64_t frameNr = 0;
|
||||
getStartingFrameNumber(&frameNr);
|
||||
int iframes = 0;
|
||||
for (iframes = 0; iframes != numFrames; ++iframes) {
|
||||
for (int iframes = 0; iframes != numFrames; ++iframes) {
|
||||
|
||||
usleep(transmissionDelayUs);
|
||||
|
||||
@ -1788,49 +1773,46 @@ void *start_timer(void *arg) {
|
||||
int srcOffset = 0;
|
||||
int srcOffset2 = DATA_BYTES / 2;
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != packetsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetsize];
|
||||
memset(packetData, 0, packetsize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[2];
|
||||
header->column = detPos[3];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
|
||||
// second interface
|
||||
char packetData2[packetsize];
|
||||
memset(packetData2, 0, packetsize);
|
||||
if (numInterfaces == 2) {
|
||||
header = (sls_detector_header *)(packetData2);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[2];
|
||||
header->column = detPos[3];
|
||||
header->row = detPos[0];
|
||||
header->column = detPos[1];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||
imageData + srcOffset2, dataSize);
|
||||
srcOffset2 += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetsize);
|
||||
|
||||
// second interface
|
||||
char packetData2[packetsize];
|
||||
memset(packetData2, 0, packetsize);
|
||||
if (numInterfaces == 2) {
|
||||
header = (sls_detector_header *)(packetData2);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr + iframes;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[0];
|
||||
header->column = detPos[1];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData2 + sizeof(sls_detector_header),
|
||||
imageData + srcOffset2, dataSize);
|
||||
srcOffset2 += dataSize;
|
||||
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
sendUDPPacket(1, packetData2, packetsize);
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", iframes));
|
||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DMOENCHD -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir)#-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = moenchDetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
Binary file not shown.
@ -233,8 +233,7 @@ int testFpga() {
|
||||
|
||||
volatile uint32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val = 0x5A5A5A5A - i;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -298,9 +297,8 @@ int testBus() {
|
||||
|
||||
volatile uint32_t val = 0, readval = 0;
|
||||
int times = 1000 * 1000;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
for (int i = 0; i < times; ++i) {
|
||||
val += 0xbbbbb;
|
||||
bus_w(addr, val);
|
||||
readval = bus_r(addr);
|
||||
@ -458,33 +456,30 @@ void setupDetector() {
|
||||
}
|
||||
analogDataPtr = 0;
|
||||
digitalDataPtr = 0;
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK_AT_STARTUP;
|
||||
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK_AT_STARTUP;
|
||||
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK_AT_STARTUP;
|
||||
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK_AT_STARTUP;
|
||||
// default adc phase in deg
|
||||
/*
|
||||
{
|
||||
int phase_shifts = 0;
|
||||
ConvertToDifferentRange(0, 359, 0, getMaxPhase(ADC_CLK) - 1,
|
||||
DEFAULT_ADC_PHASE_DEG, &phase_shifts); clkPhase[ADC_CLK] =
|
||||
phase_shifts;
|
||||
}
|
||||
LOG(logINFO, ("Default Run clk: %d MHz\n",
|
||||
clkFrequency[RUN_CLK])); LOG(logINFO, ("Default Adc clk: %d MHz\n",
|
||||
clkFrequency[ADC_CLK])); LOG(logINFO, ("Default Sync clk: %d MHz\n",
|
||||
clkFrequency[SYNC_CLK])); LOG(logINFO, ("Default Dbit clk: %d MHz\n",
|
||||
clkFrequency[DBIT_CLK])); LOG(logINFO, ("Default Adc Phase: %d (%d
|
||||
deg)\n", clkPhase[ADC_CLK], getPhase(ADC_CLK, 1)));
|
||||
*/
|
||||
for (i = 0; i < NDAC; ++i)
|
||||
dacValues[i] = -1;
|
||||
for (int i = 0; i < NUM_CLOCKS; ++i) {
|
||||
clkPhase[i] = 0;
|
||||
}
|
||||
clkFrequency[RUN_CLK] = DEFAULT_RUN_CLK_AT_STARTUP;
|
||||
clkFrequency[ADC_CLK] = DEFAULT_ADC_CLK_AT_STARTUP;
|
||||
clkFrequency[SYNC_CLK] = DEFAULT_SYNC_CLK_AT_STARTUP;
|
||||
clkFrequency[DBIT_CLK] = DEFAULT_DBIT_CLK_AT_STARTUP;
|
||||
// default adc phase in deg
|
||||
/*
|
||||
{
|
||||
int phase_shifts = 0;
|
||||
ConvertToDifferentRange(0, 359, 0, getMaxPhase(ADC_CLK) - 1,
|
||||
DEFAULT_ADC_PHASE_DEG, &phase_shifts); clkPhase[ADC_CLK] =
|
||||
phase_shifts;
|
||||
}
|
||||
LOG(logINFO, ("Default Run clk: %d MHz\n",
|
||||
clkFrequency[RUN_CLK])); LOG(logINFO, ("Default Adc clk: %d MHz\n",
|
||||
clkFrequency[ADC_CLK])); LOG(logINFO, ("Default Sync clk: %d MHz\n",
|
||||
clkFrequency[SYNC_CLK])); LOG(logINFO, ("Default Dbit clk: %d MHz\n",
|
||||
clkFrequency[DBIT_CLK])); LOG(logINFO, ("Default Adc Phase: %d (%d
|
||||
deg)\n", clkPhase[ADC_CLK], getPhase(ADC_CLK, 1)));
|
||||
*/
|
||||
for (int i = 0; i < NDAC; ++i)
|
||||
dacValues[i] = -1;
|
||||
vLimit = DEFAULT_VLIMIT;
|
||||
highvoltage = 0;
|
||||
adcEnableMask_1g = 0;
|
||||
@ -610,8 +605,7 @@ void updateDataBytes() {
|
||||
if (adcEnableMask_1g == BIT32_MSK)
|
||||
nchans = 32;
|
||||
else {
|
||||
int ichan = 0;
|
||||
for (ichan = 0; ichan < NCHAN; ++ichan) {
|
||||
for (int ichan = 0; ichan < NCHAN; ++ichan) {
|
||||
if (adcEnableMask_1g & (1 << ichan))
|
||||
++nchans;
|
||||
}
|
||||
@ -625,14 +619,11 @@ void updateDataBytes() {
|
||||
int setDefaultDacs() {
|
||||
int ret = OK;
|
||||
LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
||||
{
|
||||
int i = 0;
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
const int defaultvals[NDAC] = DEFAULT_DAC_VALS;
|
||||
for (int i = 0; i < NDAC; ++i) {
|
||||
// if not already default, set it to default
|
||||
if (dacValues[i] != defaultvals[i]) {
|
||||
setDAC((enum DACINDEX)i, defaultvals[i], 0);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
@ -712,8 +703,7 @@ void setADCEnableMask_10G(uint32_t mask) {
|
||||
uint8_t actualMask = 0;
|
||||
if (mask != 0) {
|
||||
int ival = 0;
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN; ich = ich + 4) {
|
||||
for (int ich = 0; ich < NCHAN; ich = ich + 4) {
|
||||
if ((1 << ich) & mask) {
|
||||
actualMask |= (1 << ival);
|
||||
}
|
||||
@ -739,13 +729,11 @@ uint32_t getADCEnableMask_10G() {
|
||||
// convert 8 bit mask to 32 bit mask
|
||||
uint32_t retval = 0;
|
||||
if (adcEnableMask_10g) {
|
||||
int ival = 0;
|
||||
int iloop = 0;
|
||||
for (ival = 0; ival < 8; ++ival) {
|
||||
for (int ival = 0; ival < 8; ++ival) {
|
||||
// if bit in 8 bit mask set
|
||||
if ((1 << ival) & adcEnableMask_10g) {
|
||||
// set it for 4 bits in 32 bit mask
|
||||
for (iloop = 0; iloop < 4; ++iloop) {
|
||||
for (int iloop = 0; iloop < 4; ++iloop) {
|
||||
retval |= (1 << (ival * 4 + iloop));
|
||||
}
|
||||
}
|
||||
@ -1948,67 +1936,57 @@ void *start_timer(void *arg) {
|
||||
// Generate Data
|
||||
char imageData[imageSize];
|
||||
memset(imageData, 0, imageSize);
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = i;
|
||||
}
|
||||
for (int i = 0; i < imageSize; i += sizeof(uint16_t)) {
|
||||
*((uint16_t *)(imageData + i)) = i;
|
||||
}
|
||||
|
||||
// Send data
|
||||
{
|
||||
int frameNr = 0;
|
||||
// loop over number of frames
|
||||
for (frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
// loop over number of frames
|
||||
for (int frameNr = 0; frameNr != numFrames; ++frameNr) {
|
||||
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
// check if virtual_stop is high
|
||||
if (virtual_stop == 1) {
|
||||
break;
|
||||
}
|
||||
// update the virtual stop from stop server
|
||||
virtual_stop = ComVirtual_getStop();
|
||||
// check if virtual_stop is high
|
||||
if (virtual_stop == 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(expNs / 1000);
|
||||
// sleep for exposure time
|
||||
struct timespec begin, end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
usleep(expNs / 1000);
|
||||
|
||||
int srcOffset = 0;
|
||||
// loop packet
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i != packetsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
sls_detector_header *header =
|
||||
(sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
int srcOffset = 0;
|
||||
// loop packet
|
||||
for (int i = 0; i != packetsPerFrame; ++i) {
|
||||
// set header
|
||||
char packetData[packetSize];
|
||||
memset(packetData, 0, packetSize);
|
||||
sls_detector_header *header = (sls_detector_header *)(packetData);
|
||||
header->detType = (uint16_t)myDetectorType;
|
||||
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||
header->frameNumber = frameNr;
|
||||
header->packetNumber = i;
|
||||
header->modId = 0;
|
||||
header->row = detPos[X];
|
||||
header->column = detPos[Y];
|
||||
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
// fill data
|
||||
memcpy(packetData + sizeof(sls_detector_header),
|
||||
imageData + srcOffset, dataSize);
|
||||
srcOffset += dataSize;
|
||||
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t timeNs = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||
(end.tv_nsec - begin.tv_nsec));
|
||||
sendUDPPacket(0, packetData, packetSize);
|
||||
}
|
||||
LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
int64_t timeNs =
|
||||
((end.tv_sec - begin.tv_sec) * 1E9 + (end.tv_nsec - begin.tv_nsec));
|
||||
|
||||
// sleep for (period - exptime)
|
||||
if (frameNr < numFrames) { // if there is a next frame
|
||||
if (periodNs > timeNs) {
|
||||
usleep((periodNs - timeNs) / 1000);
|
||||
}
|
||||
// sleep for (period - exptime)
|
||||
if (frameNr < numFrames) { // if there is a next frame
|
||||
if (periodNs > timeNs) {
|
||||
usleep((periodNs - timeNs) / 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2192,11 +2170,8 @@ void readSample(int ns) {
|
||||
bus_w(addr, bus_r(addr) & (~DUMMY_ANLG_FIFO_RD_STRBE_MSK));
|
||||
|
||||
// wait for 1 us to latch different clocks of read and read strobe
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
}
|
||||
for (int i = 0; i < WAIT_TIME_1US_FOR_LOOP_CNT; ++i)
|
||||
;
|
||||
|
||||
if (!(ns % 1000)) {
|
||||
LOG(logDEBUG1, ("Reading sample ns:%d of %d AEmtpy:0x%x AFull:0x%x "
|
||||
@ -2206,8 +2181,7 @@ void readSample(int ns) {
|
||||
}
|
||||
|
||||
// loop through all channels
|
||||
int ich = 0;
|
||||
for (ich = 0; ich < NCHAN; ++ich) {
|
||||
for (int ich = 0; ich < NCHAN; ++ich) {
|
||||
|
||||
// if channel is in enable mask
|
||||
if ((1 << ich) & (adcEnableMask_1g)) {
|
||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
||||
|
||||
CROSS = nios2-buildroot-linux-gnu-
|
||||
CC = $(CROSS)gcc
|
||||
CFLAGS += -Wall -DMYTHEN3D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
CFLAGS += -Wall -std=gnu99 -DMYTHEN3D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||
LDLIBS += -lm
|
||||
PROGS = mythen3DetectorServer
|
||||
DESTDIR ?= bin
|
||||
|
Binary file not shown.
@ -219,8 +219,7 @@ void AD7689_Configure() {
|
||||
LOG(logINFO,
|
||||
("\tConfiguring %d x due to invalid conversions from power up\n",
|
||||
AD7689_NUM_INVALID_CONVERSIONS));
|
||||
int i = 0;
|
||||
for (i = 0; i < AD7689_NUM_INVALID_CONVERSIONS; ++i) {
|
||||
for (int i = 0; i < AD7689_NUM_INVALID_CONVERSIONS; ++i) {
|
||||
AD7689_Set(
|
||||
// read back
|
||||
AD7689_CFG_RB_MSK |
|
||||
|
@ -35,8 +35,7 @@ int ASIC_Driver_Set(int index, int length, char *buffer) {
|
||||
("\t[chip index: %d, length: %d, fname: %s]\n", index, length, fname));
|
||||
{
|
||||
LOG(logDEBUG2, ("\t[values: \n"));
|
||||
int i;
|
||||
for (i = 0; i < length; ++i) {
|
||||
for (int i = 0; i < length; ++i) {
|
||||
LOG(logDEBUG2, ("\t%d: 0x%02hhx\n", i, buffer[i]));
|
||||
}
|
||||
LOG(logDEBUG2, ("\t]\n"));
|
||||
|
@ -234,10 +234,8 @@ uint32_t I2C_Read(uint32_t devId, uint32_t addr) {
|
||||
int level = bus_r(I2C_Rx_Data_Fifo_Level_Reg);
|
||||
LOG(logDEBUG2, (" level:%d\n", level));
|
||||
|
||||
int iloop = level - 1;
|
||||
|
||||
// level bytes to read, read 1 byte at a time
|
||||
for (iloop = level - 1; iloop >= 0; --iloop) {
|
||||
for (int iloop = level - 1; iloop >= 0; --iloop) {
|
||||
u_int16_t byte =
|
||||
bus_r(I2C_Rx_Data_Fifo_Reg) & I2C_RX_DATA_FIFO_RXDATA_MSK;
|
||||
LOG(logDEBUG2, (" byte nr %d:0x%x\n", iloop, byte));
|
||||
|
@ -116,7 +116,6 @@ void LTC2620_SetDaisy(int cmd, int data, int dacaddr, int chipIndex) {
|
||||
|
||||
int nchip = LTC2620_Ndac / LTC2620_NUMCHANNELS;
|
||||
uint32_t valw = 0;
|
||||
int ichip = 0;
|
||||
|
||||
LOG(logDEBUG2, ("(Daisy) desired chip index:%d, nchip:%d, dac ch:%d, "
|
||||
"val:%d, cmd:0x%x \n",
|
||||
@ -136,7 +135,7 @@ void LTC2620_SetDaisy(int cmd, int data, int dacaddr, int chipIndex) {
|
||||
// send same data to all
|
||||
if (chipIndex < 0) {
|
||||
LOG(logDEBUG2, ("Send same data to all\n"));
|
||||
for (ichip = 0; ichip < nchip; ++ichip) {
|
||||
for (int ichip = 0; ichip < nchip; ++ichip) {
|
||||
LOG(logDEBUG2, ("Send data (0x%x) to ichip %d\n", codata, ichip));
|
||||
LTC2620_SendDaisyData(&valw, codata);
|
||||
}
|
||||
@ -146,7 +145,7 @@ void LTC2620_SetDaisy(int cmd, int data, int dacaddr, int chipIndex) {
|
||||
else {
|
||||
// send nothing to subsequent ichips (daisy chain) (if any chips after
|
||||
// desired chip)
|
||||
for (ichip = chipIndex + 1; ichip < nchip; ++ichip) {
|
||||
for (int ichip = chipIndex + 1; ichip < nchip; ++ichip) {
|
||||
LOG(logDEBUG2, ("Send nothing to ichip %d\n", ichip));
|
||||
LTC2620_SendDaisyData(&valw, LTC2620_DAC_CMD_NO_OPRTN_VAL);
|
||||
}
|
||||
@ -157,7 +156,7 @@ void LTC2620_SetDaisy(int cmd, int data, int dacaddr, int chipIndex) {
|
||||
|
||||
// send nothing to preceding ichips (daisy chain) (if any chips in front
|
||||
// of desired chip)
|
||||
for (ichip = 0; ichip < chipIndex; ++ichip) {
|
||||
for (int ichip = 0; ichip < chipIndex; ++ichip) {
|
||||
LOG(logDEBUG2, ("Send nothing to ichip %d\n", ichip));
|
||||
LTC2620_SendDaisyData(&valw, LTC2620_DAC_CMD_NO_OPRTN_VAL);
|
||||
}
|
||||
|
@ -83,8 +83,7 @@ void sendDataToSPI(uint32_t *valw, uint32_t addr, uint32_t val,
|
||||
"clkmask:0x%x digmask:0x%x digofst:%d\n",
|
||||
*valw, addr, val, numbitstosend, clkmask, digoutmask, digofset));
|
||||
|
||||
int i = 0;
|
||||
for (i = 0; i < numbitstosend; ++i) {
|
||||
for (int i = 0; i < numbitstosend; ++i) {
|
||||
|
||||
// clk down
|
||||
(*valw) &= ~clkmask;
|
||||
@ -112,9 +111,7 @@ uint32_t receiveDataFromSPI(uint32_t *valw, uint32_t addr, int numbitstoreceive,
|
||||
*valw, addr, numbitstoreceive, clkmask, readaddr));
|
||||
|
||||
uint32_t retval = 0;
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < numbitstoreceive; ++i) {
|
||||
for (int i = 0; i < numbitstoreceive; ++i) {
|
||||
|
||||
// clk down
|
||||
(*valw) &= ~clkmask;
|
||||
|
@ -121,7 +121,6 @@ int bindSocket(unsigned short int port_number) {
|
||||
}
|
||||
|
||||
int acceptConnection(int socketDescriptor) {
|
||||
int j;
|
||||
struct sockaddr_in addressC;
|
||||
int file_des = -1;
|
||||
struct timeval tv;
|
||||
@ -159,7 +158,7 @@ int acceptConnection(int socketDescriptor) {
|
||||
("%s select returned!\n", (isControlServer ? "control" : "stop")));
|
||||
|
||||
// loop through the file descriptor set
|
||||
for (j = 0; j < maxfd + 1; ++j) {
|
||||
for (int j = 0; j < maxfd + 1; ++j) {
|
||||
|
||||
// checks if file descriptor part of set
|
||||
if (FD_ISSET(j, &tempset)) {
|
||||
@ -264,11 +263,10 @@ void exitServer(int socketDescriptor) {
|
||||
}
|
||||
|
||||
void swapData(void *val, int length, intType itype) {
|
||||
int i;
|
||||
int16_t *c = (int16_t *)val;
|
||||
int32_t *a = (int32_t *)val;
|
||||
int64_t *b = (int64_t *)val;
|
||||
for (i = 0; length > 0; i++) {
|
||||
for (int i = 0; length > 0; i++) {
|
||||
switch (itype) {
|
||||
case INT16:
|
||||
c[i] = ((c[i] & 0x00FF) << 8) | ((c[i] & 0xFF00) >> 8);
|
||||
|
@ -89,8 +89,7 @@ int mapCSP0(void) {
|
||||
u_int32_t **cspbases[2] = {&csp0base, &csp1base};
|
||||
char names[2][10] = {"csp0base", "csp1base"};
|
||||
|
||||
int i = 0;
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
// if not mapped
|
||||
if (*cspbases[i] == 0) {
|
||||
LOG(logINFO, ("Mapping memory for %s\n", names[i]));
|
||||
|
@ -60,46 +60,42 @@ int main(int argc, char *argv[]) {
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
// circumvent the basic tests
|
||||
{
|
||||
int i;
|
||||
for (i = 1; i < argc; ++i) {
|
||||
if (!strcasecmp(argv[i], "-stopserver")) {
|
||||
LOG(logINFO, ("Detected stop server\n"));
|
||||
isControlServer = 0;
|
||||
} else if (!strcasecmp(argv[i], "-devel")) {
|
||||
LOG(logINFO, ("Detected developer mode\n"));
|
||||
debugflag = 1;
|
||||
} else if (!strcasecmp(argv[i], "-nomodule")) {
|
||||
LOG(logINFO, ("Detected No Module mode\n"));
|
||||
checkModuleFlag = 0;
|
||||
} else if (!strcasecmp(argv[i], "-port")) {
|
||||
if ((i + 1) >= argc) {
|
||||
LOG(logERROR, ("no port value given. Exiting.\n"));
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[i + 1], "%d", &portno) == 0) {
|
||||
LOG(logERROR, ("cannot decode port value %s. Exiting.\n",
|
||||
argv[i + 1]));
|
||||
return -1;
|
||||
}
|
||||
LOG(logINFO, ("Detected port: %d\n", portno));
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (!strcasecmp(argv[i], "-stopserver")) {
|
||||
LOG(logINFO, ("Detected stop server\n"));
|
||||
isControlServer = 0;
|
||||
} else if (!strcasecmp(argv[i], "-devel")) {
|
||||
LOG(logINFO, ("Detected developer mode\n"));
|
||||
debugflag = 1;
|
||||
} else if (!strcasecmp(argv[i], "-nomodule")) {
|
||||
LOG(logINFO, ("Detected No Module mode\n"));
|
||||
checkModuleFlag = 0;
|
||||
} else if (!strcasecmp(argv[i], "-port")) {
|
||||
if ((i + 1) >= argc) {
|
||||
LOG(logERROR, ("no port value given. Exiting.\n"));
|
||||
return -1;
|
||||
}
|
||||
#ifdef GOTTHARDD
|
||||
else if (!strcasecmp(argv[i], "-phaseshift")) {
|
||||
if ((i + 1) >= argc) {
|
||||
LOG(logERROR, ("no phase shift value given. Exiting.\n"));
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[i + 1], "%d", &phaseShift) == 0) {
|
||||
LOG(logERROR,
|
||||
("cannot decode phase shift value %s. Exiting.\n",
|
||||
argv[i + 1]));
|
||||
return -1;
|
||||
}
|
||||
LOG(logINFO, ("Detected phase shift of %d\n", phaseShift));
|
||||
if (sscanf(argv[i + 1], "%d", &portno) == 0) {
|
||||
LOG(logERROR,
|
||||
("cannot decode port value %s. Exiting.\n", argv[i + 1]));
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
LOG(logINFO, ("Detected port: %d\n", portno));
|
||||
}
|
||||
#ifdef GOTTHARDD
|
||||
else if (!strcasecmp(argv[i], "-phaseshift")) {
|
||||
if ((i + 1) >= argc) {
|
||||
LOG(logERROR, ("no phase shift value given. Exiting.\n"));
|
||||
return -1;
|
||||
}
|
||||
if (sscanf(argv[i + 1], "%d", &phaseShift) == 0) {
|
||||
LOG(logERROR, ("cannot decode phase shift value %s. Exiting.\n",
|
||||
argv[i + 1]));
|
||||
return -1;
|
||||
}
|
||||
LOG(logINFO, ("Detected phase shift of %d\n", phaseShift));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// control server
|
||||
@ -108,26 +104,23 @@ int main(int argc, char *argv[]) {
|
||||
// start stop server process
|
||||
char cmd[MAX_STR_LENGTH];
|
||||
memset(cmd, 0, MAX_STR_LENGTH);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < argc; ++i) {
|
||||
if (!strcasecmp(argv[i], "-port")) {
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
if (i > 0) {
|
||||
strcat(cmd, " ");
|
||||
}
|
||||
strcat(cmd, argv[i]);
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
if (!strcasecmp(argv[i], "-port")) {
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
char temp[50];
|
||||
memset(temp, 0, sizeof(temp));
|
||||
sprintf(temp, " -stopserver -port %d &", portno + 1);
|
||||
strcat(cmd, temp);
|
||||
|
||||
LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd));
|
||||
system(cmd);
|
||||
if (i > 0) {
|
||||
strcat(cmd, " ");
|
||||
}
|
||||
strcat(cmd, argv[i]);
|
||||
}
|
||||
char temp[50];
|
||||
memset(temp, 0, sizeof(temp));
|
||||
sprintf(temp, " -stopserver -port %d &", portno + 1);
|
||||
strcat(cmd, temp);
|
||||
|
||||
LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd));
|
||||
system(cmd);
|
||||
LOG(logINFOBLUE, ("Control Server [%d]\n", portno));
|
||||
#ifdef VIRTUAL
|
||||
// creating files for virtual servers to communicate with each other
|
||||
|
@ -346,8 +346,7 @@ void function_table() {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
int iloop = 0;
|
||||
for (iloop = 0; iloop < NUM_DET_FUNCTIONS; ++iloop) {
|
||||
for (int iloop = 0; iloop < NUM_DET_FUNCTIONS; ++iloop) {
|
||||
LOG(logDEBUG3, ("function fnum=%d, (%s)\n", iloop,
|
||||
getFunctionNameFromEnum((enum detFuncs)iloop)));
|
||||
}
|
||||
@ -4861,8 +4860,7 @@ void calculate_and_set_position() {
|
||||
sscanf(dmac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1], &a[2],
|
||||
&a[3], &a[4], &a[5]);
|
||||
udpDetails.srcmac = 0;
|
||||
int i;
|
||||
for (i = 0; i < 6; ++i) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
udpDetails.srcmac = (udpDetails.srcmac << 8) + a[i];
|
||||
}
|
||||
}
|
||||
@ -4878,8 +4876,7 @@ void calculate_and_set_position() {
|
||||
sscanf(dmac2, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &a[0], &a[1],
|
||||
&a[2], &a[3], &a[4], &a[5]);
|
||||
udpDetails.srcmac2 = 0;
|
||||
int i;
|
||||
for (i = 0; i < 6; ++i) {
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
udpDetails.srcmac2 = (udpDetails.srcmac2 << 8) + a[i];
|
||||
}
|
||||
}
|
||||
@ -6460,8 +6457,7 @@ int set_veto_photon(int file_des) {
|
||||
numChannels, NCHAN);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
int i = 0;
|
||||
for (i = 0; i < NCHAN; ++i) {
|
||||
for (int i = 0; i < NCHAN; ++i) {
|
||||
if (values[i] > ADU_MAX_VAL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
@ -6515,8 +6511,7 @@ int get_veto_photon(int file_des) {
|
||||
"same for all chips.\n");
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
int i = 0;
|
||||
for (i = 0; i < NCHAN; ++i) {
|
||||
for (int i = 0; i < NCHAN; ++i) {
|
||||
LOG(logDEBUG1, ("%d:0x%x\n", i, retvals[i]));
|
||||
}
|
||||
}
|
||||
|
@ -1,197 +1,184 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define UART_DEVICE "/dev/ttyAL0"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DEBUG_PRINT(fmt, args...) fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, \
|
||||
__FILE__, __LINE__, __func__, ##args)
|
||||
#define DEBUG_PRINT(fmt, args...) \
|
||||
fprintf(stderr, "DEBUG: %s:%d:%s(): " fmt, __FILE__, __LINE__, __func__, \
|
||||
##args)
|
||||
#else
|
||||
#define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */
|
||||
#define DEBUG_PRINT(fmt, args...) /* Don't do anything in release builds */
|
||||
#endif
|
||||
|
||||
struct termios oldtio;
|
||||
int uart;
|
||||
int update_files = 1;
|
||||
|
||||
void intHandler(int signo)
|
||||
{
|
||||
DEBUG_PRINT("signo %d received\n", signo);
|
||||
if (signo == SIGINT)
|
||||
{
|
||||
DEBUG_PRINT("SIGINT handling\n");
|
||||
tcsetattr(uart,TCSANOW,&oldtio);
|
||||
close(uart);
|
||||
exit(0);
|
||||
}
|
||||
if (signo == SIGUSR1)
|
||||
{
|
||||
DEBUG_PRINT("SIGUSR1 handling\n");
|
||||
update_files = 1;
|
||||
}
|
||||
void intHandler(int signo) {
|
||||
DEBUG_PRINT("signo %d received\n", signo);
|
||||
if (signo == SIGINT) {
|
||||
DEBUG_PRINT("SIGINT handling\n");
|
||||
tcsetattr(uart, TCSANOW, &oldtio);
|
||||
close(uart);
|
||||
exit(0);
|
||||
}
|
||||
if (signo == SIGUSR1) {
|
||||
DEBUG_PRINT("SIGUSR1 handling\n");
|
||||
update_files = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void kill_servers()
|
||||
{
|
||||
system("killall gotthard2DetectorServer mythen3DetectorServer gotthard2DetectorServer_developer mythen3DetectorServer_developer");
|
||||
void kill_servers() {
|
||||
system("killall gotthard2DetectorServer mythen3DetectorServer "
|
||||
"gotthard2DetectorServer_developer mythen3DetectorServer_developer");
|
||||
}
|
||||
|
||||
void set_hv_zero()
|
||||
{
|
||||
FILE* hv;
|
||||
hv = fopen("/etc/devlinks/hvdac", "w");
|
||||
if (hv == NULL)
|
||||
fprintf(stderr, "Could not open hvdac file.\n");
|
||||
else
|
||||
{
|
||||
fputc('0', hv);
|
||||
fclose(hv);
|
||||
}
|
||||
void set_hv_zero() {
|
||||
FILE *hv;
|
||||
hv = fopen("/etc/devlinks/hvdac", "w");
|
||||
if (hv == NULL)
|
||||
fprintf(stderr, "Could not open hvdac file.\n");
|
||||
else {
|
||||
fputc('0', hv);
|
||||
fclose(hv);
|
||||
}
|
||||
}
|
||||
|
||||
void disable_chip_power()
|
||||
{
|
||||
unsigned* mem_ptr;
|
||||
unsigned mem_val;
|
||||
unsigned mem_address = 0x18040000;
|
||||
int mem_desc;
|
||||
mem_desc = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
||||
if (mem_desc == -1)
|
||||
fprintf(stderr, "Cannot open /dev/mem\n");
|
||||
else
|
||||
{
|
||||
mem_ptr = (unsigned *) mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, mem_desc, mem_address);
|
||||
if (mem_ptr == MAP_FAILED)
|
||||
fprintf(stderr, "Cannot map memory area\n");
|
||||
else
|
||||
{
|
||||
mem_val = mem_ptr[0x84/4];
|
||||
mem_val = mem_val & 0x7FFFFFFF; // Removes top bit
|
||||
mem_ptr[0x84/4] = mem_val;
|
||||
munmap((unsigned*) mem_address, 0x1000);
|
||||
}
|
||||
close(mem_desc);
|
||||
}
|
||||
void disable_chip_power() {
|
||||
unsigned *mem_ptr;
|
||||
unsigned mem_val;
|
||||
unsigned mem_address = 0x18040000;
|
||||
int mem_desc;
|
||||
mem_desc = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
||||
if (mem_desc == -1)
|
||||
fprintf(stderr, "Cannot open /dev/mem\n");
|
||||
else {
|
||||
mem_ptr =
|
||||
(unsigned *)mmap(0, 0x1000, PROT_READ | PROT_WRITE,
|
||||
MAP_FILE | MAP_SHARED, mem_desc, mem_address);
|
||||
if (mem_ptr == MAP_FAILED)
|
||||
fprintf(stderr, "Cannot map memory area\n");
|
||||
else {
|
||||
mem_val = mem_ptr[0x84 / 4];
|
||||
mem_val = mem_val & 0x7FFFFFFF; // Removes top bit
|
||||
mem_ptr[0x84 / 4] = mem_val;
|
||||
munmap((unsigned *)mem_address, 0x1000);
|
||||
}
|
||||
close(mem_desc);
|
||||
}
|
||||
}
|
||||
|
||||
void prepare_for_shutdown()
|
||||
{
|
||||
kill_servers();
|
||||
set_hv_zero();
|
||||
disable_chip_power();
|
||||
system("sync");
|
||||
return;
|
||||
void prepare_for_shutdown() {
|
||||
kill_servers();
|
||||
set_hv_zero();
|
||||
disable_chip_power();
|
||||
system("sync");
|
||||
return;
|
||||
}
|
||||
|
||||
int uart_setup(struct termios* old_settings)
|
||||
{
|
||||
int desc;
|
||||
struct termios newtio;
|
||||
desc = open(UART_DEVICE, O_RDWR | O_NOCTTY);
|
||||
if (desc < 0) { perror(UART_DEVICE); exit(-1); }
|
||||
tcgetattr(desc, old_settings);
|
||||
newtio.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
|
||||
newtio.c_iflag = IGNPAR | IGNCR | IXANY;
|
||||
newtio.c_oflag = 0;
|
||||
newtio.c_lflag = ICANON;
|
||||
tcflush(desc, TCIFLUSH);
|
||||
tcsetattr(desc,TCSANOW,&newtio);
|
||||
return desc;
|
||||
int uart_setup(struct termios *old_settings) {
|
||||
int desc;
|
||||
struct termios newtio;
|
||||
desc = open(UART_DEVICE, O_RDWR | O_NOCTTY);
|
||||
if (desc < 0) {
|
||||
perror(UART_DEVICE);
|
||||
exit(-1);
|
||||
}
|
||||
tcgetattr(desc, old_settings);
|
||||
newtio.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
|
||||
newtio.c_iflag = IGNPAR | IGNCR | IXANY;
|
||||
newtio.c_oflag = 0;
|
||||
newtio.c_lflag = ICANON;
|
||||
tcflush(desc, TCIFLUSH);
|
||||
tcsetattr(desc, TCSANOW, &newtio);
|
||||
return desc;
|
||||
}
|
||||
|
||||
int get_boot_condition()
|
||||
{
|
||||
FILE* ru_trig_cond;
|
||||
char ru_trig_cond_content[10];
|
||||
int bytes_read;
|
||||
int get_boot_condition() {
|
||||
FILE *ru_trig_cond;
|
||||
char ru_trig_cond_content[10];
|
||||
int bytes_read;
|
||||
|
||||
ru_trig_cond = fopen("/sys/devices/platform/sopc@0/18000000.bridge/180000c0.remoteupdate/remote_update/trig_cond","r");
|
||||
if (ru_trig_cond == NULL)
|
||||
fprintf(stderr, "Cannot read remote update status\n");
|
||||
bytes_read = fread(ru_trig_cond_content, 1, 10, ru_trig_cond);
|
||||
if (bytes_read < 4)
|
||||
fprintf(stderr, "Invalid file content\n");
|
||||
return strtoul(ru_trig_cond_content, NULL, 0);
|
||||
ru_trig_cond = fopen("/sys/devices/platform/sopc@0/18000000.bridge/"
|
||||
"180000c0.remoteupdate/remote_update/trig_cond",
|
||||
"r");
|
||||
if (ru_trig_cond == NULL)
|
||||
fprintf(stderr, "Cannot read remote update status\n");
|
||||
bytes_read = fread(ru_trig_cond_content, 1, 10, ru_trig_cond);
|
||||
if (bytes_read < 4)
|
||||
fprintf(stderr, "Invalid file content\n");
|
||||
return strtoul(ru_trig_cond_content, NULL, 0);
|
||||
}
|
||||
|
||||
void write_cmd_in_file(char* cmd, char* filename, int lines)
|
||||
{
|
||||
int res,i;
|
||||
char buf[255];
|
||||
FILE* cmd_file;
|
||||
cmd_file = fopen(filename, "w");
|
||||
write(uart, cmd, 1);
|
||||
for (i=0; i < lines; i++)
|
||||
{
|
||||
res = read(uart, buf, 255);
|
||||
fwrite(buf, 1, res, cmd_file);
|
||||
}
|
||||
fclose(cmd_file);
|
||||
void write_cmd_in_file(char *cmd, char *filename, int lines) {
|
||||
int res, i;
|
||||
char buf[255];
|
||||
FILE *cmd_file;
|
||||
cmd_file = fopen(filename, "w");
|
||||
write(uart, cmd, 1);
|
||||
for (i = 0; i < lines; i++) {
|
||||
res = read(uart, buf, 255);
|
||||
fwrite(buf, 1, res, cmd_file);
|
||||
}
|
||||
fclose(cmd_file);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
char buf[255];
|
||||
fd_set readfs;
|
||||
int maxfd;
|
||||
int res;
|
||||
char factory_image_detected_cmd = 'f';
|
||||
char get_voltage_cmd = 'u';
|
||||
char get_versions_cmd = 'v';
|
||||
char get_eventlog_cmd = 'e';
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
char buf[255];
|
||||
fd_set readfs;
|
||||
int maxfd;
|
||||
int res;
|
||||
char factory_image_detected_cmd = 'f';
|
||||
char get_voltage_cmd = 'u';
|
||||
char get_versions_cmd = 'v';
|
||||
char get_eventlog_cmd = 'e';
|
||||
uart = uart_setup(&oldtio);
|
||||
signal(SIGINT, intHandler);
|
||||
signal(SIGUSR1, intHandler);
|
||||
|
||||
uart = uart_setup(&oldtio);
|
||||
signal(SIGINT, intHandler);
|
||||
signal(SIGUSR1, intHandler);
|
||||
maxfd = uart + 1;
|
||||
|
||||
maxfd = uart+1;
|
||||
if (get_boot_condition() != 4)
|
||||
write(uart, &factory_image_detected_cmd, 1);
|
||||
|
||||
if (get_boot_condition() != 4)
|
||||
write(uart, &factory_image_detected_cmd, 1);
|
||||
while (1) {
|
||||
if (update_files == 1) {
|
||||
DEBUG_PRINT("Updating files...\n");
|
||||
write_cmd_in_file(&get_voltage_cmd, "/tmp/uc_voltage", 1);
|
||||
write_cmd_in_file(&get_versions_cmd, "/tmp/uc_versions", 2);
|
||||
write_cmd_in_file(&get_eventlog_cmd, "/tmp/uc_eventlog", 16);
|
||||
update_files = 0;
|
||||
}
|
||||
FD_SET(uart, &readfs);
|
||||
res = select(maxfd, &readfs, NULL, NULL, NULL);
|
||||
if ((res == -1) && (errno == EINTR)) // If SIGUSR1 occured
|
||||
continue;
|
||||
|
||||
if (FD_ISSET(uart, &readfs)) {
|
||||
res = read(uart, buf, 255);
|
||||
buf[res] = 0;
|
||||
DEBUG_PRINT("-->%s:%d<--", buf, res);
|
||||
if ((buf[0] == 'S') && (res < 5)) {
|
||||
prepare_for_shutdown();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
usleep(1000);
|
||||
}
|
||||
|
||||
// Should never get here
|
||||
tcsetattr(uart, TCSANOW, &oldtio);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (update_files == 1)
|
||||
{
|
||||
DEBUG_PRINT("Updating files...\n");
|
||||
write_cmd_in_file(&get_voltage_cmd, "/tmp/uc_voltage", 1);
|
||||
write_cmd_in_file(&get_versions_cmd, "/tmp/uc_versions", 2);
|
||||
write_cmd_in_file(&get_eventlog_cmd, "/tmp/uc_eventlog", 16);
|
||||
update_files = 0;
|
||||
}
|
||||
FD_SET(uart, &readfs);
|
||||
res = select(maxfd, &readfs, NULL, NULL, NULL);
|
||||
if ((res == -1) && (errno == EINTR)) // If SIGUSR1 occured
|
||||
continue;
|
||||
|
||||
if (FD_ISSET(uart,&readfs))
|
||||
{
|
||||
res = read(uart, buf, 255);
|
||||
buf[res] = 0;
|
||||
DEBUG_PRINT("-->%s:%d<--", buf, res);
|
||||
if ((buf[0] == 'S') && (res < 5))
|
||||
{
|
||||
prepare_for_shutdown();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
usleep(1000);
|
||||
}
|
||||
|
||||
// Should never get here
|
||||
tcsetattr(uart,TCSANOW,&oldtio);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ void DetectorImpl::readFrameFromReceiver() {
|
||||
|
||||
// free resources
|
||||
delete[] image;
|
||||
delete[] multiframe;
|
||||
delete[] multiframe;
|
||||
delete[] multigappixels;
|
||||
}
|
||||
|
||||
|
@ -153,15 +153,16 @@ void BinaryFile::CreateMasterFile(bool masterFileWriteEnable,
|
||||
|
||||
// create master file
|
||||
if (!(*overWriteEnable)) {
|
||||
if (nullptr == (masterfd = fopen((const char *)masterFileName.c_str(),
|
||||
"wx"))) {
|
||||
if (nullptr == (masterfd = fopen(
|
||||
(const char *)masterFileName.c_str(), "wx"))) {
|
||||
masterfd = nullptr;
|
||||
throw sls::RuntimeError("Could not create binary master file "
|
||||
"(without overwrite enable) " +
|
||||
masterFileName);
|
||||
}
|
||||
} else if (nullptr == (masterfd = fopen(
|
||||
(const char *)masterFileName.c_str(), "w"))) {
|
||||
} else if (nullptr ==
|
||||
(masterfd =
|
||||
fopen((const char *)masterFileName.c_str(), "w"))) {
|
||||
masterfd = nullptr;
|
||||
throw sls::RuntimeError("Could not create binary master file "
|
||||
"(with overwrite enable) " +
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "TypeTraits.h"
|
||||
#include "ToString.h"
|
||||
#include "TypeTraits.h"
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
@ -189,7 +189,4 @@ std::ostream &operator<<(std::ostream &os,
|
||||
return os << ToString(c);
|
||||
}
|
||||
|
||||
|
||||
} // namespace sls
|
||||
|
||||
|
||||
|
@ -264,10 +264,10 @@ ToString(const T &obj) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::vector<T> StringTo(const std::vector<std::string>& strings){
|
||||
std::vector<T> StringTo(const std::vector<std::string> &strings) {
|
||||
std::vector<T> result;
|
||||
result.reserve(strings.size());
|
||||
for (const auto& s : strings)
|
||||
for (const auto &s : strings)
|
||||
result.push_back(StringTo<T>(s));
|
||||
return result;
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
#define APILIB 0x200409
|
||||
#define APIRECEIVER 0x200409
|
||||
#define APIGUI 0x200409
|
||||
#define APICTB 0x200609
|
||||
#define APIGOTTHARD 0x200609
|
||||
#define APIGOTTHARD2 0x200609
|
||||
#define APIJUNGFRAU 0x200609
|
||||
#define APIMYTHEN3 0x200609
|
||||
#define APIMOENCH 0x200608
|
||||
#define APIEIGER 0x200609
|
||||
#define APICTB 0x200610
|
||||
#define APIGOTTHARD 0x200610
|
||||
#define APIJUNGFRAU 0x200610
|
||||
#define APIMYTHEN3 0x200610
|
||||
#define APIMOENCH 0x200610
|
||||
#define APIGOTTHARD2 0x200610
|
||||
#define APIEIGER 0x200615
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
using sls::StaticVector;
|
||||
|
||||
TEST_CASE("StaticVector is a container") {
|
||||
|
@ -31,7 +31,6 @@ TEST_CASE("copy a long string") {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
TEST_CASE("split a string with end delimiter") {
|
||||
std::string s("abra+kadabra+");
|
||||
auto r = sls::split(s, '+');
|
||||
@ -49,7 +48,6 @@ TEST_CASE("split a string without end delimiter") {
|
||||
REQUIRE(r[2] == "filibom");
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Remove char from string") {
|
||||
char str[] = "sometest";
|
||||
sls::removeChar(str, 'e');
|
||||
|
Loading…
x
Reference in New Issue
Block a user