changes for new chipterboard -now works with reduced dynamic range and analog/digital readout

This commit is contained in:
2016-11-09 11:36:59 +01:00
parent 988426dc96
commit cb879c61ca
22 changed files with 896 additions and 341 deletions

View File

@ -1028,12 +1028,12 @@ int setContinousReadOut(int d) {
int startReceiver(int start) {
u_int32_t addr=CONFIG_REG;
#ifdef VERBOSE
//#ifdef VERBOSE
if(start)
printf("Setting up detector to send to Receiver\n");
else
printf("Setting up detector to send to CPU\n");
#endif
//#endif
int reg=bus_r(addr);
//for start recever, write 0 and for stop, write 1
if (!start)
@ -1048,9 +1048,9 @@ int startReceiver(int start) {
int d =reg&GB10_NOT_CPU_BIT;
if(d!=0) d=1;
if(d!=start)
return OK;
return OK;
else
return FAIL;
return FAIL;
}
@ -1301,6 +1301,17 @@ int64_t getTrains(){
}
int64_t setSamples(int64_t value){
if (value>=0)
bus_w(NSAMPLES_REG,value);
return bus_r(NSAMPLES_REG);
}
int64_t getSamples(){
return bus_r(NSAMPLES_REG);//get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
}
int64_t setProbes(int64_t value){
return 0;
}
@ -2089,7 +2100,7 @@ u_int16_t* fifo_read_event(int ns)
// bus_w16(DUMMY_REG,0); //
for (i=0; i<16; i++) {
for (i=0; i<32; i++) {
// bus_w16(DUMMY_REG,i);
@ -2121,7 +2132,7 @@ u_int16_t* fifo_read_event(int ns)
/* } */
// if (((adcDisableMask&(3<<((i+1)*2)))>>((i+1)*2))!=3) {
printf("sample %d fifo %d status %08x\n",ns,i,bus_r16(FIFO_STATUS_REG));
bus_w16(DUMMY_REG,i+1);
// }
// *(((u_int16_t*)(now_ptr))+i)=bus_r16(FIFO_DATA_REG);
@ -2259,8 +2270,8 @@ u_int32_t* decode_data(int *datain)
int setDynamicRange(int dr) {
if (dr%16==0 && dr>0) {
dynamicRange=16;
nSamples=dr/16;
bus_w(NSAMPLES_REG,nSamples);
// nSamples=dr/16;
// bus_w(NSAMPLES_REG,nSamples);
}
getDynamicRange();
allocateRAM();
@ -2281,8 +2292,8 @@ int getDynamicRange() {
nSamples=bus_r(NSAMPLES_REG);
getChannels();
dataBytes=nModX*N_CHIP*getChannels()*2;
return dynamicRange*bus_r(NSAMPLES_REG);//nSamples;
dataBytes=nModX*N_CHIP*getChannels()*2*nSamples;
return dynamicRange;//*bus_r(NSAMPLES_REG);//nSamples;
}
int testBus() {

View File

@ -113,9 +113,13 @@ int64_t getPeriod();
int64_t setTrains(int64_t value);
int64_t getTrains();
int64_t setProbes(int64_t value);
int64_t getProbes();
int64_t setSamples(int64_t value);
int64_t getSamples();
int64_t getProgress();
int64_t setProgress();

View File

@ -62,7 +62,7 @@
#define CONTROL_REG 79<<11//0x24<<11
#define STATUS_REG 2<<11 //0x25<<11
#define CONFIG_REG 77<<11//0x26<<11
#define EXT_SIGNAL_REG 78<<11// 0x27<<11
#define EXT_SIGNAL_REG 78<<11// 0x4E<<11
#define FPGA_SVN_REG 0x29<<11

View File

@ -2180,6 +2180,7 @@ int set_timer(int file_des) {
int ret=OK;
printf("set\n");
sprintf(mess,"can't set timer\n");
n = receiveDataOnly(file_des,&ind,sizeof(ind));
@ -2224,15 +2225,18 @@ int set_timer(int file_des) {
retval=setGates(tns);
break;
case PROBES_NUMBER:
sprintf(mess,"can't set timer for moench\n");
ret=FAIL;
sprintf(mess,"can't set timer for moench\n");
ret=FAIL;
break;
case CYCLES_NUMBER:
retval=setTrains(tns);
break;
case SAMPLES_JCTB:
retval=setSamples(tns);
break;
default:
ret=FAIL;
sprintf(mess,"timer index unknown %d\n",ind);
sprintf(mess,"t timer index unknown %d\n",ind);
break;
}
}
@ -2246,10 +2250,10 @@ int set_timer(int file_des) {
if (ret!=OK) {
printf(mess);
printf("set timer failed\n");
} else if (ind==FRAME_NUMBER) {
// ret=allocateRAM();
// if (ret!=OK)
// sprintf(mess, "could not allocate RAM for %lld frames\n", tns);
} else if (ind==SAMPLES_JCTB) {
ret=allocateRAM();
if (ret!=OK)
sprintf(mess, "could not allocate RAM for %lld frames\n", tns);
}
n = sendDataOnly(file_des,&ret,sizeof(ret));
@ -2280,7 +2284,7 @@ int get_time_left(int file_des) {
int n;
int64_t retval;
int ret=OK;
printf("get\n");
sprintf(mess,"can't get timer\n");
n = receiveDataOnly(file_des,&ind,sizeof(ind));
if (n < 0) {
@ -2331,9 +2335,12 @@ int get_time_left(int file_des) {
case FRAMES_FROM_START_PG:
retval=getFramesFromStart();
break;
case SAMPLES_JCTB:
retval=getSamples();
break;
default:
ret=FAIL;
sprintf(mess,"timer index unknown %d\n",ind);
sprintf(mess,"tl timer index unknown %d\n",ind);
break;
}
}