mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 00:00:02 +02:00
read_frame works and moved get temp to the getadc function
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@116 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
2e15e9c2db
commit
ee2652f864
@ -6,7 +6,7 @@
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
CFLAGS += -Wall -DMCB_FUNCS -DVERBOSE #-DVERY_VERBOSE #-DVIRTUAL
|
||||
CFLAGS += -Wall -DMCB_FUNCS -DVERBOSE #-DVERYVERBOSE #-DVIRTUAL
|
||||
|
||||
#INCLUDES= /usr/src/kernels/2.6.18-238.12.1.el5-i686/include
|
||||
#/home/l_maliakal_d/bfin/blackfin-linux-dist/linux-2.6.x/include
|
||||
|
@ -174,8 +174,8 @@ int mapCSP0(void) {
|
||||
|
||||
u_int32_t address;
|
||||
address = FIFO_DATA_REG_OFF;
|
||||
values=(u_int32_t*)(CSP0BASE+address*2);
|
||||
printf("values=%08x\n",values);
|
||||
values=(u_int16_t*)(CSP0BASE+address*2);
|
||||
//printf("values=%04x\n",values);
|
||||
//printf("values=%08x\n",((u_int32_t*)(CSP0BASE+FIFO_DATA_REG_OFF*2)));
|
||||
|
||||
/* must b uncommentedlater////////////////////////////////////////////////////////
|
||||
@ -1396,109 +1396,51 @@ u_int32_t fifo_full(void)
|
||||
|
||||
u_int32_t* fifo_read_event()
|
||||
{
|
||||
|
||||
#ifdef VERBOSE
|
||||
int ichip;
|
||||
int ichan;
|
||||
#endif
|
||||
#ifdef VIRTUAL
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("before looping\n");
|
||||
#ifdef VERYVERBOSE
|
||||
printf("before looping\n");
|
||||
for (ichip=0; ichip<nModBoard*NCHIP; ichip++) {
|
||||
if ((fifoReadCounter(ichip)&FIFO_COUNTER_MASK)%128)
|
||||
printf("FIFO %d contains %d words\n",ichip,(fifoReadCounter(ichip)&FIFO_COUNTER_MASK));
|
||||
}
|
||||
#endif
|
||||
while(bus_r(LOOK_AT_ME_REG)==0) {
|
||||
//#ifdef VERYVERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("Waiting for data status %x\n",runState());
|
||||
//#endif
|
||||
#endif
|
||||
if (runBusy()==0) {
|
||||
if (bus_r(LOOK_AT_ME_REG)==0) {
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("no frame found - exiting ");
|
||||
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
|
||||
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
/* for (ichip=0; ichip<nModBoard*NCHIP; ichip++) {
|
||||
if ((fifoReadCounter(ichip)&FIFO_COUNTER_MASK)%128)
|
||||
printf("FIFO %d contains %d words\n",ichip,(fifoReadCounter(ichip)&FIFO_COUNTER_MASK));
|
||||
}
|
||||
*/
|
||||
//#endif
|
||||
#endif
|
||||
return NULL;
|
||||
} else {
|
||||
//#ifdef VERYVERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState());
|
||||
//#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("before readout %08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
#ifdef VERYVERBOSE
|
||||
printf("before readout %08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
for (ichip=0; ichip<nModBoard*NCHIP; ichip++) {
|
||||
if ((fifoReadCounter(ichip)&FIFO_COUNTER_MASK)%128)
|
||||
printf("FIFO %d contains %d words\n",ichip,(fifoReadCounter(ichip)&FIFO_COUNTER_MASK));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//unsigned long flags;
|
||||
|
||||
// register int ihalf;
|
||||
|
||||
// save_flags(flags);
|
||||
// cli(); /* This code runs with interrupts disabled */
|
||||
|
||||
|
||||
/* for (ihalf=0;ihalf<dataBytes/sizeof(int); ihalf++){
|
||||
ram_values[ihalf]=*values;
|
||||
}*/
|
||||
|
||||
|
||||
// restore_flags(flags);
|
||||
|
||||
/*
|
||||
for (ihalf=0;ihalf<dataBytes/sizeof(int); ihalf++)
|
||||
printf("\n%d: 0x%0x 0x%0x",ihalf,ram_values[ihalf]&0xffff,(ram_values[ihalf]>>16)&0xffff);
|
||||
*/
|
||||
|
||||
/* for (ichip=0;ichip<dataBytes/2; ichip++)
|
||||
printf("\n%d: %08x",ichip,*values);*/
|
||||
|
||||
|
||||
//sram_free(now_ptr);
|
||||
memcpy(now_ptr, values, dataBytes);
|
||||
|
||||
/*
|
||||
#ifdef VERBOSE
|
||||
for (ichip=0;ichip<dataBytes/4; ichip++) {
|
||||
now_ptr[ichip*4]=values[ichip];
|
||||
#ifdef VERBOSE
|
||||
if (((fifoReadCounter(ichip/128)&FIFO_COUNTER_MASK)+(ichip%128))>128)
|
||||
printf("chip %d ch %d %d\n",ichip/128, ichip%128, (fifoReadCounter(ichip/128)&FIFO_COUNTER_MASK));
|
||||
#endif
|
||||
}
|
||||
printf("before readout %08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
#endif
|
||||
*/
|
||||
dma_memcpy(now_ptr,values ,dataBytes);
|
||||
|
||||
|
||||
|
||||
//#ifdef VERYVERBOSE
|
||||
printf("Copying to ptr %x %d\n",now_ptr, dataBytes);
|
||||
//#endif
|
||||
printf("after readout %08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
#ifdef VERYVERBOSE
|
||||
printf("after readout %08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
for (ichip=0; ichip<nModBoard*NCHIP; ichip++) {
|
||||
if ((fifoReadCounter(ichip)&FIFO_COUNTER_MASK)%128)
|
||||
printf("FIFO %d contains %d words\n",ichip,(fifoReadCounter(ichip)&FIFO_COUNTER_MASK));
|
||||
}
|
||||
printf("\n x%08x\n",now_ptr);
|
||||
int a;
|
||||
for (a=0;a<10; a=a+2)
|
||||
printf("\n%d: x%04x",a,now_ptr[a]);
|
||||
printf("\n");
|
||||
//memcpy(now_ptr, values, dataBytes);
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
printf("Copying to ptr %08x %d\n",now_ptr, dataBytes);
|
||||
printf("after readout %08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
#endif
|
||||
|
||||
if (storeInRAM>0) {
|
||||
now_ptr+=dataBytes;
|
||||
}
|
||||
@ -1735,7 +1677,8 @@ int allocateRAM() {
|
||||
#endif
|
||||
// clearRAM();
|
||||
// ram_values=malloc(size);
|
||||
ram_values=realloc(ram_values,size);
|
||||
//+2 was added since dma_memcpy would switch the 16 bit values and the mem is 32 bit
|
||||
ram_values=realloc(ram_values,size)+2;
|
||||
|
||||
if (ram_values) {
|
||||
now_ptr=(char*)ram_values;
|
||||
@ -1750,7 +1693,7 @@ int allocateRAM() {
|
||||
printf("retrying\n");
|
||||
storeInRAM=0;
|
||||
size=dataBytes;
|
||||
ram_values=realloc(ram_values,size);
|
||||
ram_values=realloc(ram_values,size)+2;
|
||||
if (ram_values==NULL)
|
||||
printf("Fatal error: there must be a memory leak somewhere! You can't allocate even one frame!\n");
|
||||
else {
|
||||
|
@ -19,14 +19,14 @@
|
||||
|
||||
|
||||
// DAC definitions
|
||||
enum dacsVal{VREF_DS, VCASCN_PB, VCASCP_PB, VOUT_CM, VCASC_OUT, VIN_CM, VREF_COMP, IB_TESTC};
|
||||
enum dacsVal{VREF_DS, VCASCN_PB, VCASCP_PB, VOUT_CM, VCASC_OUT, VIN_CM, VREF_COMP, IB_TESTC,HIGH_VOLTAGE, CONFGAIN};
|
||||
|
||||
/* DAC adresses */
|
||||
#define DACCS {0,0,1,1,2,2,3,3,4,4,5,5,6,6}
|
||||
#define DACADDR {0,1,0,1,0,1,0,1,0,1,0,1,0,1}
|
||||
|
||||
//Register Definitions for temp,hv,dac gain
|
||||
enum RegVals{TEMP_FPGA, TEMP_ADC, HIGH_VOLTAGE, CONFGAIN};
|
||||
enum adcVals{TEMP_FPGA, TEMP_ADC};
|
||||
|
||||
//dynamic range
|
||||
#define MAX5523
|
||||
|
@ -821,16 +821,16 @@ int read_register(int file_des) {
|
||||
|
||||
|
||||
|
||||
//#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
printf("reading register 0x%x\n", addr);
|
||||
//#endif
|
||||
//#endif
|
||||
|
||||
if(ret!=FAIL){
|
||||
address=(addr<<11);
|
||||
if((addr==0x29)||(addr==0x80))
|
||||
retval=bus_r16(address);
|
||||
else
|
||||
retval=bus_r(address);
|
||||
address=(addr<<11);
|
||||
if(addr==0x80)
|
||||
retval=bus_r16(address);
|
||||
else
|
||||
retval=bus_r(address);
|
||||
}
|
||||
|
||||
|
||||
@ -861,232 +861,201 @@ int read_register(int file_des) {
|
||||
}
|
||||
|
||||
int set_dac(int file_des) {
|
||||
//everything in here does for all mods
|
||||
float retval;
|
||||
int ret=OK;
|
||||
int arg[2];
|
||||
enum dacIndex ind;
|
||||
int imod;
|
||||
int n;
|
||||
float val;
|
||||
int idac=0;
|
||||
int ireg=-1;
|
||||
//default:all mods
|
||||
float retval;
|
||||
int ret=OK;
|
||||
int arg[2];
|
||||
enum dacIndex ind;
|
||||
int imod;
|
||||
int n;
|
||||
float val;
|
||||
int idac=0;
|
||||
|
||||
sprintf(mess,"Can't set DAC/TEMP/HV\n");
|
||||
sprintf(mess,"Can't set DAC\n");
|
||||
|
||||
n = receiveDataOnly(file_des,arg,sizeof(arg));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
ind=arg[0];
|
||||
imod=arg[1];
|
||||
n = receiveDataOnly(file_des,arg,sizeof(arg));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
ind=arg[0];
|
||||
imod=arg[1];
|
||||
|
||||
n = receiveDataOnly(file_des,&val,sizeof(val));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
n = receiveDataOnly(file_des,&val,sizeof(val));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Setting DAC/TEMP/HV %d of module %d to %f V\n", ind, imod, val);
|
||||
printf("Setting DAC %d of module %d to %f V\n", ind, imod, val);
|
||||
#endif
|
||||
|
||||
if (imod>=getNModBoard())
|
||||
ret=FAIL;
|
||||
if (imod<0)
|
||||
imod=ALLMOD;
|
||||
if (imod>=getNModBoard())
|
||||
ret=FAIL;
|
||||
if (imod<0)
|
||||
imod=ALLMOD;
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
switch (ind) {
|
||||
case G_VREF_DS :
|
||||
idac=VREF_DS;
|
||||
break;
|
||||
case G_VCASCN_PB:
|
||||
idac=VCASCN_PB;
|
||||
break;
|
||||
case G_VCASCP_PB:
|
||||
idac=VCASCP_PB;
|
||||
break;
|
||||
case G_VOUT_CM:
|
||||
idac=VOUT_CM;
|
||||
break;
|
||||
case G_VCASC_OUT:
|
||||
idac=VCASC_OUT;
|
||||
break;
|
||||
case G_VIN_CM:
|
||||
idac=VIN_CM;
|
||||
break;
|
||||
case G_VREF_COMP:
|
||||
idac=VREF_COMP;
|
||||
break;
|
||||
case G_IB_TESTC:
|
||||
idac=IB_TESTC;
|
||||
break;
|
||||
case TEMPERATURE_FPGA:
|
||||
ireg=TEMP_FPGA;
|
||||
break;
|
||||
case TEMPERATURE_ADC:
|
||||
ireg=TEMP_ADC;
|
||||
break;
|
||||
case HV_POT:
|
||||
ireg=HIGH_VOLTAGE;
|
||||
break;
|
||||
switch (ind) {
|
||||
case G_VREF_DS :
|
||||
idac=VREF_DS;
|
||||
break;
|
||||
case G_VCASCN_PB:
|
||||
idac=VCASCN_PB;
|
||||
break;
|
||||
case G_VCASCP_PB:
|
||||
idac=VCASCP_PB;
|
||||
break;
|
||||
case G_VOUT_CM:
|
||||
idac=VOUT_CM;
|
||||
break;
|
||||
case G_VCASC_OUT:
|
||||
idac=VCASC_OUT;
|
||||
break;
|
||||
case G_VIN_CM:
|
||||
idac=VIN_CM;
|
||||
break;
|
||||
case G_VREF_COMP:
|
||||
idac=VREF_COMP;
|
||||
break;
|
||||
case G_IB_TESTC:
|
||||
idac=IB_TESTC;
|
||||
break;
|
||||
case HV_POT:
|
||||
idac=HIGH_VOLTAGE;
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Unknown DAC/TEMP/HV index %d\n",ind);
|
||||
sprintf(mess,"Unknown DAC/TEMP/HV index %d\n",ind);
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
if (ret==OK) {
|
||||
if (differentClients==1 && lockStatus==1 && val!=-1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else{
|
||||
//dac
|
||||
if(ireg==-1)
|
||||
retval=initDACbyIndexDACU(idac,val,imod);
|
||||
else
|
||||
{ //HV
|
||||
if(ireg==HIGH_VOLTAGE)
|
||||
retval=initHighVoltageByModule(val,imod);
|
||||
//Temp
|
||||
else
|
||||
retval=getTemperatureByModule(ireg,imod);
|
||||
default:
|
||||
printf("Unknown DAC index %d\n",ind);
|
||||
sprintf(mess,"Unknown DAC index %d\n",ind);
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
if (ret==OK) {
|
||||
if (differentClients==1 && lockStatus==1 && val!=-1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else{
|
||||
if(idac==HIGH_VOLTAGE)
|
||||
retval=initHighVoltageByModule(val,imod);
|
||||
else
|
||||
retval=initDACbyIndexDACU(idac,val,imod);
|
||||
}
|
||||
}
|
||||
if(ret==OK){
|
||||
ret=FAIL;
|
||||
if(idac==HIGH_VOLTAGE){
|
||||
if(retval==-2)
|
||||
strcpy(mess,"Invalid Voltage.Valid values are 0,90,110,120,150,180,200");
|
||||
else if(retval==-3)
|
||||
strcpy(mess,"Weird value read back or it has not been set yet\n");
|
||||
else
|
||||
ret=OK;
|
||||
}
|
||||
else if (retval==val || val==-1)
|
||||
ret=OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("DAC/TEMP/HV set to %f V\n", retval);
|
||||
printf("DAC set to %f V\n", retval);
|
||||
#endif
|
||||
ret=FAIL;
|
||||
if(ireg==HIGH_VOLTAGE){
|
||||
if(retval==-2)
|
||||
strcpy(mess,"Invalid Voltage.Valid values are 0,90,110,120,150,180,200");
|
||||
else if(retval==-3)
|
||||
strcpy(mess,"Weird value read back\n");
|
||||
else
|
||||
ret=OK;
|
||||
}
|
||||
else if (retval==val || val==-1)
|
||||
ret=OK;
|
||||
if(ret==FAIL)
|
||||
printf("Setting dac/hv %d of module %d: wrote %f but read %f\n", ind, imod, val, retval);
|
||||
else{
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
if(ret==FAIL)
|
||||
printf("Setting dac %d of module %d: wrote %f but read %f\n", ind, imod, val, retval);
|
||||
else{
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret!=FAIL) {
|
||||
/* send return argument */
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
} else {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
}
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret!=FAIL) {
|
||||
/* send return argument */
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
} else {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
}
|
||||
|
||||
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int get_adc(int file_des) {
|
||||
//default: mod 0
|
||||
float retval;
|
||||
int ret=OK;
|
||||
int arg[2];
|
||||
enum dacIndex ind;
|
||||
int imod;
|
||||
int n;
|
||||
int idac=0;
|
||||
|
||||
float retval;
|
||||
int ret=OK;
|
||||
int arg[2];
|
||||
enum dacIndex ind;
|
||||
int imod;
|
||||
int n;
|
||||
int idac=0;
|
||||
|
||||
sprintf(mess,"Can't read ADC\n");
|
||||
sprintf(mess,"Can't read ADC\n");
|
||||
|
||||
|
||||
n = receiveDataOnly(file_des,arg,sizeof(arg));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
ind=arg[0];
|
||||
imod=arg[1];
|
||||
n = receiveDataOnly(file_des,arg,sizeof(arg));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
ind=arg[0];
|
||||
imod=arg[1];
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Getting ADC %d of module %d\n", ind, imod);
|
||||
#endif
|
||||
|
||||
if (imod>=getNModBoard() || imod<0)
|
||||
ret=FAIL;
|
||||
if (imod>=getNModBoard() || imod<0)
|
||||
ret=FAIL;
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
switch (ind) {
|
||||
case G_VREF_DS :
|
||||
idac=VREF_DS;
|
||||
break;
|
||||
case G_VCASCN_PB:
|
||||
idac=VCASCN_PB;
|
||||
break;
|
||||
case G_VCASCP_PB:
|
||||
idac=VCASCP_PB;
|
||||
break;
|
||||
case G_VOUT_CM:
|
||||
idac=VOUT_CM;
|
||||
break;
|
||||
case G_VCASC_OUT:
|
||||
idac=VCASC_OUT;
|
||||
break;
|
||||
case G_VIN_CM:
|
||||
idac=VIN_CM;
|
||||
break;
|
||||
case G_VREF_COMP:
|
||||
idac=VREF_COMP;
|
||||
break;
|
||||
case G_IB_TESTC:
|
||||
idac=IB_TESTC;
|
||||
break;
|
||||
default:
|
||||
printf("Unknown DAC index %d\n",ind);
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Unknown DAC index %d\n",ind);
|
||||
}
|
||||
|
||||
if (ret==OK) {
|
||||
retval=getDACbyIndexDACU(idac,imod);
|
||||
}
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
printf("Getting ADC %d of module %d\n", ind, imod);
|
||||
#endif
|
||||
switch (ind) {
|
||||
case TEMPERATURE_FPGA:
|
||||
idac=TEMP_FPGA;
|
||||
break;
|
||||
case TEMPERATURE_ADC:
|
||||
idac=TEMP_ADC;
|
||||
break;
|
||||
default:
|
||||
printf("Unknown DAC index %d\n",ind);
|
||||
sprintf(mess,"Unknown DAC index %d\n",ind);
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
if (ret==OK)
|
||||
retval=getTemperatureByModule(idac,imod);
|
||||
#endif
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("ADC is %f V\n", retval);
|
||||
printf("ADC is %f V\n", retval);
|
||||
#endif
|
||||
if (ret==FAIL) {
|
||||
printf("Getting adc %d of module %d failed\n", ind, imod);
|
||||
}
|
||||
if (ret==FAIL) {
|
||||
printf("Getting adc %d of module %d failed\n", ind, imod);
|
||||
}
|
||||
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret!=FAIL) {
|
||||
/* send return argument */
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
} else {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
}
|
||||
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret!=FAIL) {
|
||||
/* send return argument */
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
} else {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
}
|
||||
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@ -1852,7 +1821,7 @@ int get_run_status(int file_des) {
|
||||
#endif
|
||||
|
||||
retval= runState();
|
||||
printf("\n\nSTATUS=%x\n",retval);
|
||||
printf("\n\nSTATUS=%08x\n",retval);
|
||||
|
||||
if (retval&0x00000001){
|
||||
printf("-----------------------------------RUNNING-----------------------------------\n");
|
||||
@ -1898,12 +1867,7 @@ int get_run_status(int file_des) {
|
||||
}
|
||||
|
||||
int read_frame(int file_des) {
|
||||
/*
|
||||
int *retval=NULL;
|
||||
char *ptr=NULL;
|
||||
int ret=OK;
|
||||
int f=0, i;
|
||||
*/
|
||||
|
||||
#ifdef VERBOSE
|
||||
int n;
|
||||
#endif
|
||||
@ -1921,14 +1885,14 @@ int read_frame(int file_des) {
|
||||
if (storeInRAM==0) {
|
||||
if ((dataretval=(char*)fifo_read_event())) {
|
||||
dataret=OK;
|
||||
//#ifdef VERYVERBOSE
|
||||
#ifdef VERYVERBOSE
|
||||
printf("Sending ptr %x %d\n",dataretval, dataBytes);
|
||||
//#endif
|
||||
#endif
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,dataretval,dataBytes);
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("sent %d bytes\n",dataBytes);
|
||||
//#endif
|
||||
#endif
|
||||
printf("dataret OK\n");
|
||||
return OK;
|
||||
} else {
|
||||
@ -1946,7 +1910,7 @@ int read_frame(int file_des) {
|
||||
printf("%d %d %x %s\n",sizeof(mess),strlen(mess), mess,mess);
|
||||
#endif
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));//sizeof(mess));//sizeof(mess));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));
|
||||
#ifdef VERYVERBOSE
|
||||
printf("message sent\n",mess);
|
||||
#endif
|
||||
@ -1960,14 +1924,14 @@ int read_frame(int file_des) {
|
||||
}
|
||||
dataretval=(char*)ram_values;
|
||||
dataret=OK;
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("sending data of %d frames\n",nframes);
|
||||
//#endif
|
||||
#endif
|
||||
for (iframes=0; iframes<nframes; iframes++) {
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
//#ifdef VERYVERBOSE
|
||||
#ifdef VERYVERBOSE
|
||||
printf("sending pointer %x of size %d\n",dataretval,dataBytes);
|
||||
//#endif
|
||||
#endif
|
||||
sendDataOnly(file_des,dataretval,dataBytes);
|
||||
dataretval+=dataBytes;
|
||||
}
|
||||
@ -1982,9 +1946,9 @@ int read_frame(int file_des) {
|
||||
if (differentClients)
|
||||
dataret=FORCE_UPDATE;
|
||||
}
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("Frames left %d\n",getFrames());
|
||||
//#endif
|
||||
#endif
|
||||
sendDataOnly(file_des,&dataret,sizeof(dataret));
|
||||
sendDataOnly(file_des,mess,sizeof(mess));
|
||||
printf("dataret %d\n",dataret);
|
||||
|
Loading…
x
Reference in New Issue
Block a user