mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 04:47:14 +02:00
fixed gui getting stuck (wrong datathreadmask more than 64 bits cuz of 72 sockets)
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
//for memory mapping
|
||||
u_int64_t CSP0BASE;
|
||||
|
||||
@ -171,8 +172,8 @@ int mapCSP0(void) {
|
||||
return FAIL;
|
||||
}
|
||||
#endif
|
||||
printf("CSPObase is 0x%x \n",CSP0BASE);
|
||||
printf("CSPOBASE=from %08x to %x\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||
printf("CSPObase is 0x%llx \n",CSP0BASE);
|
||||
printf("CSPOBASE=from %llx to %llx\n",CSP0BASE,CSP0BASE+MEM_SIZE);
|
||||
|
||||
u_int32_t address;
|
||||
address = FIFO_DATA_REG_OFF;
|
||||
@ -827,7 +828,7 @@ u_int32_t testRAM(void) {
|
||||
int i=0;
|
||||
allocateRAM();
|
||||
// while(i<100000) {
|
||||
memcpy(ram_values, values, dataBytes);
|
||||
memcpy((char*)ram_values, (char*)values, dataBytes);
|
||||
printf ("Testing RAM:\t%d: copied fifo %x to memory %x size %d\n",i++, (unsigned int)(values), (unsigned int)(ram_values), dataBytes);
|
||||
// }
|
||||
return result;
|
||||
@ -970,7 +971,7 @@ int64_t getActualTime(){
|
||||
|
||||
int64_t getMeasurementTime(){
|
||||
int64_t v=get64BitReg(GET_MEASUREMENT_TIME_LSB_REG, GET_MEASUREMENT_TIME_MSB_REG);
|
||||
int64_t mask=0x8000000000000000;
|
||||
u_int64_t mask=0x8000000000000000;
|
||||
if (v & mask ) {
|
||||
#ifdef VERBOSE
|
||||
printf("no measurement time left\n");
|
||||
@ -1000,7 +1001,7 @@ int loadImage(int index, short int ImageVals[]){
|
||||
for(i=0;i<6;i++)
|
||||
printf("%d:%d\t",i,ImageVals[i]);
|
||||
#endif
|
||||
memcpy(ptr,ImageVals ,dataBytes);
|
||||
memcpy((char*)ptr,(char*)ImageVals ,dataBytes);
|
||||
#ifdef VERBOSE
|
||||
printf("\nLoaded x%08x address with image of index %d\n",(unsigned int)(ptr),index);
|
||||
#endif
|
||||
@ -1816,7 +1817,7 @@ int allocateRAM() {
|
||||
int prepareADC(){
|
||||
printf("Preparing ADC\n");
|
||||
u_int32_t valw,codata,csmask;
|
||||
int i,j,cdx,ddx,value;
|
||||
int i,j,cdx,ddx;
|
||||
cdx=0; ddx=1;
|
||||
csmask=0x7c; // 1111100
|
||||
|
||||
@ -2208,7 +2209,7 @@ int readCounterBlock(int startACQ, short int CounterVals[]){
|
||||
printf("Value of multipurpose reg:%d\n",bus_r(MULTI_PURPOSE_REG));
|
||||
#endif
|
||||
|
||||
memcpy(CounterVals,ptr,dataBytes);
|
||||
memcpy((char*)CounterVals,(char*)ptr,dataBytes);
|
||||
#ifdef VERBOSE
|
||||
int i;
|
||||
printf("Copied counter memory block with size of %d bytes..\n",dataBytes);
|
||||
@ -2278,7 +2279,7 @@ int resetCounterBlock(int startACQ){
|
||||
#endif
|
||||
|
||||
|
||||
memcpy(counterVals,ptr,dataBytes);
|
||||
memcpy((char*)counterVals,(char*)ptr,dataBytes);
|
||||
#ifdef VERBOSE
|
||||
int i;
|
||||
printf("Copied counter memory block with size of %d bytes..\n",(int)sizeof(counterVals));
|
||||
@ -2350,7 +2351,7 @@ int calibratePedestal(int frames){
|
||||
|
||||
int a;
|
||||
for (a=0;a<1280; a++){
|
||||
unsigned short v = (frame[a] << 8) + (frame[a] >> 8);
|
||||
//unsigned short v = (frame[a] << 8) + (frame[a] >> 8);
|
||||
// printf("%i: %i %i\n",a, frame[a],v);
|
||||
avg[a] += ((double)frame[a])/(double)frames;
|
||||
//if(frame[a] == 8191)
|
||||
@ -2377,7 +2378,7 @@ int calibratePedestal(int frames){
|
||||
|
||||
|
||||
|
||||
double nf = (double)numberFrames;
|
||||
//double nf = (double)numberFrames;
|
||||
for(i =0; i < 1280; i++){
|
||||
adc = i / 256;
|
||||
adcCh = (i - adc * 256) / 32;
|
||||
|
@ -72,6 +72,7 @@ int getAdcConfigured();
|
||||
|
||||
u_int64_t getDetectorNumber();
|
||||
u_int32_t getFirmwareVersion();
|
||||
u_int32_t getFirmwareSVNVersion();
|
||||
int testFifos(void);
|
||||
u_int32_t testFpga(void);
|
||||
u_int32_t testRAM(void);
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "communication_funcs.h"
|
||||
#include "server_funcs.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
extern int sockfd;
|
||||
|
@ -2376,7 +2376,6 @@ int set_speed(int file_des) {
|
||||
int set_readout_flags(int file_des) {
|
||||
|
||||
enum readOutFlags arg;
|
||||
int n;
|
||||
int ret=FAIL;
|
||||
|
||||
|
||||
|
@ -164,8 +164,8 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
|
||||
double vthreshmean, vthreshSTDev;
|
||||
int *thrmi, *thrma;
|
||||
double c;
|
||||
double b=BVTRIM;
|
||||
double a=AVTRIM;
|
||||
//double b=BVTRIM;
|
||||
//double a=AVTRIM;
|
||||
int *trim;
|
||||
int ich, imod, ichan;
|
||||
int nvalid=0;
|
||||
@ -236,7 +236,7 @@ int choose_vthresh_and_vtrim(int countlim, int nsigma, int im) {
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
fifodata=fifo_read_event();
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichan=0; ichan<nChans*nChips; ichan++){
|
||||
@ -377,7 +377,7 @@ int trim_with_level(int countlim, int im) {
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=fifo_read_event();
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
for (ichan=0; ichan<nChans*nChips; ichan++) {
|
||||
@ -515,7 +515,7 @@ int choose_vthresh() {
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=fifo_read_event();
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
//
|
||||
scan1=decode_data(fifodata);
|
||||
@ -523,7 +523,7 @@ int choose_vthresh() {
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
//
|
||||
med[imod]=median(scan1+imod*nChans*nChips,nChans*nChips);
|
||||
med[imod]=(int)median((int*)scan1+imod*nChans*nChips,nChans*nChips);
|
||||
med1[imod]=med[imod];
|
||||
//commented out by dhanya vthreshmean=vthreshmean+getDACbyIndexDACU(VTHRESH,imod);
|
||||
olddiff[imod]=0xffffff;
|
||||
@ -553,7 +553,7 @@ int choose_vthresh() {
|
||||
}
|
||||
usleep(500);
|
||||
|
||||
fifodata=fifo_read_event();
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
//
|
||||
scan1=decode_data(fifodata);
|
||||
@ -561,7 +561,7 @@ int choose_vthresh() {
|
||||
change_flag=0;
|
||||
printf("Vthresh iteration %3d 0f %3d\n",iteration, maxiterations);
|
||||
for (ichan=modmi; ichan<modma; ichan++) {
|
||||
med[ichan]=median(scan1+ichan*nChans*nChips,nChans*nChips);
|
||||
med[ichan]=(int)median((int*)scan1+ichan*nChans*nChips,nChans*nChips);
|
||||
med1[imod]=med[imod];
|
||||
media=median(med1+modmi,nm);
|
||||
|
||||
@ -680,7 +680,7 @@ int trim_with_median(int stop, int im) {
|
||||
while (runBusy()) {
|
||||
}
|
||||
usleep(500);
|
||||
fifodata=fifo_read_event();
|
||||
fifodata=(int*)fifo_read_event();
|
||||
scan=decode_data(fifodata);
|
||||
scan1=decode_data(fifodata);
|
||||
|
||||
@ -689,7 +689,7 @@ int trim_with_median(int stop, int im) {
|
||||
/********* calculates median every time ***********/
|
||||
|
||||
for (imod=modmi; imod<modma; imod++) {
|
||||
me[imod]=median(scan1+imod*nChans*nChips,nChans*nChips);
|
||||
me[imod]=median((int*)scan1+imod*nChans*nChips,nChans*nChips);
|
||||
me1[imod]=me[imod];
|
||||
printf("Median of module %d=%d\n",imod,me[imod]);
|
||||
}
|
||||
|
Reference in New Issue
Block a user