mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-04 20:00:04 +02:00
Mofifications to jungfrau server and pattern generator
This commit is contained in:
parent
5fe8c6e457
commit
8eea6f1d83
@ -1927,7 +1927,7 @@ u_int16_t* fifo_read_event()
|
||||
#endif
|
||||
|
||||
dma_memcpy(now_ptr,values ,dataBytes);
|
||||
|
||||
printf("-");
|
||||
//memcpy(now_ptr,values ,dataBytes); //this reads the fifo twice...
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
@ -1958,6 +1958,7 @@ u_int16_t* fifo_read_event()
|
||||
printf("lookatmereg=x%x\n",t);
|
||||
#endif
|
||||
return ram_values;
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
@ -2740,12 +2741,16 @@ uint64_t writePatternWord(int addr, uint64_t word) {
|
||||
return readPatternWord(addr);
|
||||
}
|
||||
uint64_t writePatternIOControl(uint64_t word) {
|
||||
if (word>=0)set64BitReg(word,PATTERN_IOCTRL_REG_LSB,PATTERN_IOCTRL_REG_MSB);
|
||||
if (word!=0xffffffffffffffff) {
|
||||
// printf("%llx %llx %lld",get64BitReg(PATTERN_IOCTRL_REG_LSB,PATTERN_IOCTRL_REG_MSB),word);
|
||||
set64BitReg(word,PATTERN_IOCTRL_REG_LSB,PATTERN_IOCTRL_REG_MSB);
|
||||
// printf("************ write IOCTRL (%x)\n",PATTERN_IOCTRL_REG_MSB);
|
||||
}
|
||||
return get64BitReg(PATTERN_IOCTRL_REG_LSB,PATTERN_IOCTRL_REG_MSB);
|
||||
|
||||
}
|
||||
uint64_t writePatternClkControl(uint64_t word) {
|
||||
if (word>=0)set64BitReg(word,PATTERN_IOCLKCTRL_REG_LSB,PATTERN_IOCLKCTRL_REG_MSB);
|
||||
if (word!=0xffffffffffffffff) set64BitReg(word,PATTERN_IOCLKCTRL_REG_LSB,PATTERN_IOCLKCTRL_REG_MSB);
|
||||
return get64BitReg(PATTERN_IOCLKCTRL_REG_LSB,PATTERN_IOCLKCTRL_REG_MSB);
|
||||
|
||||
}
|
||||
@ -2789,14 +2794,24 @@ int setPatternLoop(int level, int *start, int *stop, int *n) {
|
||||
|
||||
printf("level %d start %x stop %x nl %d\n",level, *start, *stop, *n);
|
||||
lval=bus_r(areg);
|
||||
/* printf("l=%x\n",bus_r16(areg)); */
|
||||
/* printf("m=%x\n",bus_r16_m(areg)); */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
printf("lval %x\n",lval);
|
||||
if (*start==-1) *start=(lval>> ASTART_OFFSET) & APATTERN_MASK;
|
||||
printf("start %x\n",*start);
|
||||
|
||||
|
||||
if (*stop==-1) *stop=(lval>> ASTOP_OFFSET) & APATTERN_MASK;
|
||||
printf("stop %x\n",*start);
|
||||
printf("stop %x\n",*stop);
|
||||
|
||||
lval= ((*start & APATTERN_MASK) << ASTART_OFFSET) | ((*stop & APATTERN_MASK) << ASTOP_OFFSET);
|
||||
printf("lval %x\n",lval);
|
||||
|
||||
bus_w(areg,lval);
|
||||
printf("lval %x\n",lval);
|
||||
|
||||
@ -2822,9 +2837,14 @@ int setPatternWaitAddress(int level, int addr) {
|
||||
default:
|
||||
return -1;
|
||||
};
|
||||
printf ("%d addr %x\n",level,addr);
|
||||
// printf("BEFORE *********PATTERN IOCTRL IS %llx (%x)\n",writePatternIOControl(-1), PATTERN_IOCTRL_REG_MSB);
|
||||
|
||||
// printf ("%d addr %x (%x)\n",level,addr,reg);
|
||||
if (addr>=0) bus_w(reg, addr);
|
||||
printf ("%d addr %x %x\n",level,addr, bus_r(reg));
|
||||
// printf ("%d addr %x %x (%x) \n",level,addr, bus_r(reg), reg);
|
||||
|
||||
// printf("AFTER *********PATTERN IOCTRL IS %llx (%x)\n",writePatternIOControl(-1), PATTERN_IOCTRL_REG_MSB);
|
||||
|
||||
return bus_r(reg);
|
||||
}
|
||||
|
||||
@ -2920,8 +2940,8 @@ int setDacRegister(int dacnum,int dacvalue) {
|
||||
|
||||
}
|
||||
|
||||
printf("Dac register %x wrote %08x\n",(128+dacnum/2)<<11,val);
|
||||
bus_w((128+dacnum/2)<<11, val);
|
||||
printf("Dac register %x wrote %08x\n",(DAC_REG_OFF+dacnum/2)<<11,val);
|
||||
bus_w((DAC_REG_OFF+dacnum/2)<<11, val);
|
||||
|
||||
return getDacRegister(dacnum);
|
||||
|
||||
@ -2931,8 +2951,8 @@ int getDacRegister(int dacnum) {
|
||||
|
||||
int retval;
|
||||
|
||||
retval=bus_r((128+dacnum/2)<<11);
|
||||
printf("Dac register %x read %08x\n",(128+dacnum/2)<<11,retval);
|
||||
retval=bus_r((DAC_REG_OFF+dacnum/2)<<11);
|
||||
printf("Dac register %x read %08x\n",(DAC_REG_OFF+dacnum/2)<<11,retval);
|
||||
if (dacnum%2)
|
||||
return (retval>>16)&0xffff;
|
||||
else
|
||||
|
Binary file not shown.
Binary file not shown.
@ -113,7 +113,12 @@
|
||||
#define DAC_REG 64<<11//0x17<<11// control the dacs
|
||||
//ADC
|
||||
#define ADC_WRITE_REG 65<<11//0x18<<11
|
||||
#define ADC_SYNC_REG 66<<11//0x19<<11
|
||||
//#define ADC_SYNC_REG 66<<11//0x19<<11
|
||||
//#define HV_REG 67<<11//0x20<<11
|
||||
|
||||
#define ADCCLK_MASK_REG 66<<11
|
||||
#define ADC_INVERSION_REG 66<<11
|
||||
|
||||
//#define MUTIME_REG 0x1a<<11
|
||||
//temperature
|
||||
#define TEMP_IN_REG 0x1b<<11
|
||||
@ -123,7 +128,6 @@
|
||||
#define ENET_CONF_REG 0x1e<<11
|
||||
//#define WRTSE_SHAD_REG 0x1f<<11
|
||||
//HV
|
||||
#define HV_REG 67<<11//0x20<<11
|
||||
|
||||
|
||||
#define DUMMY_REG 68<<11//0x21<<11
|
||||
@ -251,7 +255,8 @@
|
||||
|
||||
|
||||
#define PATTERN_IOCTRL_REG_LSB 108<<11
|
||||
#define PATTERN_IOCTRL_REG_MSB 109<<12
|
||||
#define PATTERN_IOCTRL_REG_MSB 109<<11
|
||||
|
||||
#define PATTERN_IOCLKCTRL_REG_LSB 110<<11
|
||||
#define PATTERN_IOCLKCTRL_REG_MSB 111<<11
|
||||
#define PATTERN_IN_REG_LSB 112<<11
|
||||
@ -263,15 +268,15 @@
|
||||
#define PATTERN_WAIT2_TIME_REG_LSB 118<<11
|
||||
#define PATTERN_WAIT2_TIME_REG_MSB 119<<11
|
||||
|
||||
|
||||
#define DAC_0_1_VAL_REG 128<<11
|
||||
#define DAC_2_3_VAL_REG 129<<11
|
||||
#define DAC_4_5_VAL_REG 130<<11
|
||||
#define DAC_6_7_VAL_REG 131<<11
|
||||
#define DAC_8_9_VAL_REG 132<<11
|
||||
#define DAC_10_11_VAL_REG 133<<11
|
||||
#define DAC_12_13_VAL_REG 134<<11
|
||||
#define DAC_14_15_VAL_REG 135<<11
|
||||
#define DAC_REG_OFF 120
|
||||
#define DAC_0_1_VAL_REG 120<<11
|
||||
#define DAC_2_3_VAL_REG 121<<11
|
||||
#define DAC_4_5_VAL_REG 122<<11
|
||||
#define DAC_6_7_VAL_REG 123<<11
|
||||
#define DAC_8_9_VAL_REG 124<<11
|
||||
#define DAC_10_11_VAL_REG 125<<11
|
||||
#define DAC_12_13_VAL_REG 126<<11
|
||||
#define DAC_14_15_VAL_REG 127<<11
|
||||
|
||||
|
||||
|
||||
|
@ -947,7 +947,7 @@ int read_register(int file_des) {
|
||||
|
||||
int set_dac(int file_des) {
|
||||
//default:all mods
|
||||
int retval;
|
||||
int retval, retval1;
|
||||
int ret=OK;
|
||||
int arg[3];
|
||||
enum dacIndex ind;
|
||||
@ -1032,8 +1032,10 @@ int set_dac(int file_des) {
|
||||
if (mV) {
|
||||
if (val>2500)
|
||||
val=-1;
|
||||
printf("%d mV is ",val);
|
||||
if (val>0)
|
||||
val=16535*val/2500;
|
||||
printf("%d DACu\n", val);
|
||||
} else if (val>16535)
|
||||
val=-1;
|
||||
|
||||
@ -1057,9 +1059,13 @@ int set_dac(int file_des) {
|
||||
/* else if ((retval-val)<=3 || val==-1) */
|
||||
/* ret=OK; */
|
||||
|
||||
if (mV)
|
||||
retval=2500*val/16535;
|
||||
if (mV) {
|
||||
|
||||
printf("%d DACu is ",retval);
|
||||
retval1=2500*retval/16535;
|
||||
printf("%d mV \n",retval1);
|
||||
} else
|
||||
retval1=retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1081,6 +1087,7 @@ int set_dac(int file_des) {
|
||||
if (ret!=FAIL) {
|
||||
/* send return argument */
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
n += sendDataOnly(file_des,&retval1,sizeof(retval1));
|
||||
} else {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
}
|
||||
|
@ -9,13 +9,22 @@ if [ "$#" -ge 2 ]; then
|
||||
outfile=$2
|
||||
fi
|
||||
exe=$infile"exe"
|
||||
if [ "$#" -ge 4 ]; then
|
||||
exe=$4
|
||||
fi
|
||||
|
||||
if [ "$#" -ge 3 ]; then
|
||||
exe=$3
|
||||
outfilebin=$3
|
||||
fi
|
||||
|
||||
if [ -f "$infile" ]
|
||||
then
|
||||
gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ; ./$exe ; rm $exe
|
||||
gcc -DINFILE="\"$infile\"" -DOUTFILE="\"$outfile\"" -DOUTFILEBIN="\"$outfilebin\"" -o $exe generator.c ;
|
||||
echo compiling
|
||||
$exe ;
|
||||
echo cleaning
|
||||
rm $exe
|
||||
echo done
|
||||
else
|
||||
echo "$infile not found."
|
||||
fi
|
||||
|
@ -6,12 +6,12 @@ gcc -DINFILE="\"test.p\"" -DOUTFILE="\"test.pat\"" -o test.exe generator.c ; ./t
|
||||
|
||||
*************************************************************************/
|
||||
|
||||
#include <stdlib.h> /* exit() */
|
||||
#include <stdint.h> /* exit() */
|
||||
#include <string.h> /* memset(), memcpy() */
|
||||
#include <sys/utsname.h> /* uname() */
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h> /* fork(), write(), close() */
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
@ -21,7 +21,6 @@ gcc -DINFILE="\"test.p\"" -DOUTFILE="\"test.pat\"" -o test.exe generator.c ; ./t
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
//#include <asm/page.h>
|
||||
|
||||
#define MAXLOOPS 3
|
||||
#define MAXTIMERS 3
|
||||
@ -48,8 +47,6 @@ uint64_t PAT[MAXWORDS];
|
||||
|
||||
|
||||
int i,ii,iii,j,jj,jjj,pixx,pixy,memx,memy,muxout,memclk,colclk,rowclk,muxclk,memcol,memrow,loopcounter;
|
||||
//int W[33];
|
||||
//u_int32_t W;
|
||||
|
||||
void setstart() {
|
||||
start=iaddr;
|
||||
@ -81,16 +78,12 @@ void setclk(int bit) {
|
||||
void clearbit(int bit){
|
||||
uint64_t mask=1;
|
||||
mask=mask<<bit;
|
||||
// printf("CB %d %016llx %016llx ",bit, pat, mask);
|
||||
pat &= ~mask;
|
||||
// printf("%016llx\n", pat);
|
||||
}
|
||||
void setbit(int bit){
|
||||
uint64_t mask=1;
|
||||
mask=mask<<bit;
|
||||
// printf("SB %d %016llx %016llx ",bit, pat, mask);
|
||||
pat |= mask;
|
||||
// printf("%016llx\n", pat);
|
||||
}
|
||||
|
||||
int checkbit(int bit) {
|
||||
|
12
slsDetectorSoftware/patternGenerator/test.p
Normal file → Executable file
12
slsDetectorSoftware/patternGenerator/test.p
Normal file → Executable file
@ -151,11 +151,15 @@ CB(bottom_din);PW;
|
||||
}
|
||||
//END of FUNCTIONS
|
||||
////////////////////////////////////////////////////////
|
||||
//LET'S BYPASS PREAMP AND CDS and write on preamp out.//
|
||||
//LET BYPASS PREAMP AND CDS and write on preamp out.//
|
||||
//THIS ALLOWS CHECKING SOURCE FOLLOWERS //
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
PW;
|
||||
|
||||
SB(5); PW;
|
||||
|
||||
CB(5); PW;
|
||||
|
||||
START; //pattern starts from here
|
||||
@ -164,13 +168,13 @@ setwaitpoint(0); //set wait points
|
||||
PW;
|
||||
setwaittime(0,20); //wait time - can be changed dynamically
|
||||
SB(adc_ena);PW;
|
||||
SB(adc_sync);
|
||||
printf("ADC sync %x %d %llx\n",iaddr,adc_sync, pat);
|
||||
SB(adc_sync);PW;
|
||||
printf("ADC sync %x %d %llx\n",iaddr, adc_sync, pat);
|
||||
CB(gHG);
|
||||
setwaitpoint(1); //set wait points
|
||||
setwaittime(1,16); //wait time - can be changed dynamically
|
||||
CB(adc_sync);PW;
|
||||
//NB: We have to SELECT A PIXEL to enable column out.
|
||||
//SELECT PIXEL 1,1 for readout
|
||||
load_pix(10, 20);
|
||||
|
||||
CB(res);
|
||||
|
@ -2041,6 +2041,7 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod){
|
||||
arg[1]=imod;
|
||||
arg[2]=mV;
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< std::endl;
|
||||
std::cout<< "Setting DAC "<< index << " of module " << imod << " to " << val << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user