mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
some changes for jctb
This commit is contained in:
1
slsDetectorSoftware/jungfrauDetectorServer/.gitignore
vendored
Normal file
1
slsDetectorSoftware/jungfrauDetectorServer/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.gdb
|
@ -6,17 +6,17 @@
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
CFLAGS += -Wall -DMOENCHD -DMCB_FUNCS -DDACS_INT -DDEBUG -DV1 #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
|
||||
CFLAGS += -Wall -DJUNGFRAUD -DMCB_FUNCS -DDACS_INT -DDEBUG -DV1 #-DVERBOSE #-DVERYVERBOSE #-DVIRTUAL
|
||||
|
||||
|
||||
PROGS= jungfrauDetectorServerTest
|
||||
PROGS= jungfrauDetectorServer
|
||||
INSTDIR= /tftpboot
|
||||
INSTMODE= 0777
|
||||
|
||||
|
||||
|
||||
BINS = testlib_sharedlibc
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c sharedmemory.c
|
||||
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c
|
||||
OBJS = $(SRCS:%.c=%.o)
|
||||
|
||||
|
||||
@ -27,15 +27,11 @@ test: clean jungfrauADCTEst
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
jungfrauDetectorServerTest: $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
||||
|
||||
jungfrauDetectorServer: $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
|
||||
|
||||
|
||||
jungfrauADCTEst: $(OBJS)
|
||||
echo $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@) -DTESTADC
|
||||
|
11
slsDetectorSoftware/jungfrauDetectorServer/README.txt
Normal file
11
slsDetectorSoftware/jungfrauDetectorServer/README.txt
Normal file
@ -0,0 +1,11 @@
|
||||
add the following to /etc/rc before using programfpga command before cat motd
|
||||
|
||||
|
||||
#registering 7th and 9th pin to linux kernel
|
||||
echo 7 > /sys/class/gpio/export
|
||||
echo 9 > /sys/class/gpio/export
|
||||
#define direction for the linux kernel
|
||||
echo in > /sys/class/gpio/gpio7/direction
|
||||
echo out > /sys/class/gpio/gpio9/direction
|
||||
#needed, else all write errors when server starts up, because linux tries to take control fof gpio
|
||||
echo 1 > /sys/class/gpio/gpio9/value
|
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,12 @@
|
||||
|
||||
|
||||
int mapCSP0(void);
|
||||
void defineGPIOpins();
|
||||
void resetFPGA();
|
||||
void FPGAdontTouchFlash();
|
||||
void FPGATouchFlash();
|
||||
int powerChip (int on);
|
||||
void initializeDetector();
|
||||
|
||||
u_int16_t bus_r16(u_int32_t offset);
|
||||
u_int16_t bus_w16(u_int32_t offset, u_int16_t data);//aldos function
|
||||
@ -29,15 +35,15 @@ u_int32_t bus_w(u_int32_t offset, u_int32_t data);
|
||||
u_int32_t bus_r(u_int32_t offset);
|
||||
|
||||
int setPhaseShiftOnce();
|
||||
int phaseStep(int st);
|
||||
int adcPhase(int st);
|
||||
int getPhase();
|
||||
int cleanFifo();
|
||||
int setDAQRegister();
|
||||
|
||||
u_int32_t putout(char *s, int modnum);
|
||||
u_int32_t readin(int modnum);
|
||||
u_int32_t setClockDivider(int d, int ic);
|
||||
u_int32_t getClockDivider(int ic);
|
||||
u_int32_t setClockDivider(int d);
|
||||
u_int32_t getClockDivider();
|
||||
|
||||
void resetPLL();
|
||||
u_int32_t setPllReconfigReg(u_int32_t reg, u_int32_t val, int trig);
|
||||
@ -53,6 +59,7 @@ u_int32_t setTotDutyCycle(int d);
|
||||
u_int32_t getTotDutyCycle();
|
||||
u_int32_t setOversampling(int d);
|
||||
u_int32_t adcPipeline(int d);
|
||||
u_int32_t dbitPipeline(int d);
|
||||
|
||||
u_int32_t setExtSignal(int d, enum externalSignalFlag mode);
|
||||
int getExtSignal(int d);
|
||||
@ -66,7 +73,6 @@ int setTiming(int t);
|
||||
int setConfigurationRegister(int d);
|
||||
int setToT(int d);
|
||||
int setContinousReadOut(int d);
|
||||
int startReceiver(int d);
|
||||
|
||||
int setDACRegister(int idac, int val, int imod);
|
||||
int getDacRegister(int dacnum);
|
||||
@ -75,6 +81,7 @@ int getDacRegister(int dacnum);
|
||||
int getTemperature(int tempSensor,int imod);
|
||||
int initHighVoltage(int val,int imod);
|
||||
int initConfGain(int isettings,int val,int imod);
|
||||
int initSpeedConfGain(int val);
|
||||
|
||||
int setADC(int adc);
|
||||
//int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int ival, int udpport);
|
||||
@ -143,9 +150,7 @@ u_int32_t fifoReadStatus();
|
||||
u_int32_t fifo_full(void);
|
||||
|
||||
|
||||
|
||||
u_int16_t* fifo_read_event(int ns);
|
||||
u_int16_t* fifo_read_frame();
|
||||
void waitForAcquisitionEnd();
|
||||
u_int32_t* decode_data(int* datain);
|
||||
//u_int32_t move_data(u_int64_t* datain, u_int64_t* dataout);
|
||||
int setDynamicRange(int dr);
|
||||
@ -188,6 +193,11 @@ int setDac(int dacnum,int dacvalue);
|
||||
ROI *setROI(int nroi,ROI* arg,int *retvalsize, int *ret);
|
||||
int getChannels();
|
||||
|
||||
void eraseFlash();
|
||||
int startWritingFPGAprogram(FILE** filefp);
|
||||
int stopWritingFPGAprogram(FILE* filefp);
|
||||
int writeFPGAProgram(char* fpgasrc, size_t fsize, FILE* filefp);
|
||||
|
||||
/*
|
||||
|
||||
u_int32_t setNBits(u_int32_t);
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
|
||||
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer
|
||||
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||
Repsitory UUID: 046a469b1e6582c4c55bd6eaeb4818b618d0a9a9
|
||||
Revision: 55
|
||||
Branch: separate_receiver
|
||||
Last Changed Author: Maliakal_Dhanya
|
||||
Last Changed Rev: 14
|
||||
Last Changed Date: 2014-06-03 12:26:45 +0200
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git/jungfrauDetectorServer
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: 69e9e77d6b5517bc932f2ff4d54386d886ef6c39
|
||||
Revision: 53
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 1296
|
||||
Last Changed Date: 2016-11-08 15:25:16 +0100
|
||||
|
11
slsDetectorSoftware/jungfrauDetectorServer/gitInfoJungfrau.h
Normal file
11
slsDetectorSoftware/jungfrauDetectorServer/gitInfoJungfrau.h
Normal file
@ -0,0 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git/jungfrauDetectorServer"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "69e9e77d6b5517bc932f2ff4d54386d886ef6c39"
|
||||
//#define SVNREV 0x1296
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x1296
|
||||
#define SVNDATE 0x20161108
|
||||
//
|
@ -1,11 +0,0 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "046a469b1e6582c4c55bd6eaeb4818b618d0a9a9"
|
||||
//#define SVNREV 0x14
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Maliakal_Dhanya"
|
||||
#define SVNREV 0x14
|
||||
#define SVNDATE 0x20140603
|
||||
//
|
Binary file not shown.
Binary file not shown.
BIN
slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.0
Executable file
BIN
slsDetectorSoftware/jungfrauDetectorServer/jungfrauDetectorServerv2.2.0
Executable file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -10,6 +10,15 @@
|
||||
#define MEM_SIZE 0x100000
|
||||
|
||||
|
||||
//Constants
|
||||
#define HALFSPEED_DBIT_PIPELINE 0x7f7c
|
||||
#define QUARTERSPEED_DBIT_PIPELINE 0x8981
|
||||
#define HALFSPEED_ADC_PIPELINE 0x20
|
||||
#define QUARTERSPEED_ADC_PIPELINE 0x10
|
||||
#define HALFSPEED_CONF 0x0
|
||||
#define QUARTERSPEED_CONF 0xf
|
||||
#define HALFSPEED_ADC_PHASE 65
|
||||
#define QUARTERSPEED_ADC_PHASE 25
|
||||
|
||||
/* values defined for FPGA */
|
||||
#define MCSNUM 0x0
|
||||
@ -21,23 +30,23 @@
|
||||
|
||||
//#ifdef JUNGFRAU_DHANYA
|
||||
#define POWER_ON_REG 0x5e<<11
|
||||
#define ADCREG1 8 //same as PLL_BANDWIDTH_REG
|
||||
#define ADCREG2 20 //0x14
|
||||
#define ADCREG3 4 //same as PLL_M_COUNTER_REG
|
||||
#define ADCREG4 5 //same as PLL_C_COUNTER_REG
|
||||
#define ADCREG_VREFS 24 //0x18
|
||||
#define DBIT_PIPELINE_REG 89<<11 //0x59 same PATTERN_N_LOOP2_REG
|
||||
#define MEM_MACHINE_FIFOS_REG 79<<11 //0x4f same as CONTROL_REG
|
||||
#define CONFGAIN_REG 93<<11 //0x5d same as DAQ_REG
|
||||
#define ADC_PIPELINE_REG 66<<11 //0x42 same as ADC_OFFSET_REG
|
||||
#define ADCREG1 0x8 //same as PLL_BANDWIDTH_REG
|
||||
#define ADCREG2 0x14
|
||||
#define ADCREG3 0x4 //same as PLL_M_COUNTER_REG
|
||||
#define ADCREG4 0x5 //same as PLL_C_COUNTER_REG
|
||||
#define ADCREG_VREFS 0x18
|
||||
#define DBIT_PIPELINE_REG 0x59<<11 //same PATTERN_N_LOOP2_REG
|
||||
#define MEM_MACHINE_FIFOS_REG 0x4f<<11 //same as CONTROL_REG
|
||||
#define CONFGAIN_REG 0x5d<<11 //same as DAQ_REG
|
||||
#define ADC_PIPELINE_REG 0x42<<11 //same as ADC_OFFSET_REG
|
||||
//#endif
|
||||
|
||||
#define ADC_OFFSET_REG 66<<11 //same as ADC_PIPELINE_REG
|
||||
#define ADC_INVERSION_REG 67<<11
|
||||
//#define ADC_OFFSET_REG 66<<11 //same as CONFGAIN_REG
|
||||
#define ADC_INVERSION_REG 0x43<<11
|
||||
|
||||
#define DAC_REG 64<<11//0x17<<11// control the dacs
|
||||
#define DAC_REG 64<<11//0x17<<11// control the dacs
|
||||
//ADC
|
||||
#define ADC_WRITE_REG 65<<11//0x18<<11
|
||||
#define ADC_WRITE_REG 65<<11//0x18<<11
|
||||
//#define ADC_SYNC_REG 66<<11//0x19<<11
|
||||
//#define HV_REG 67<<11//0x20<<11
|
||||
|
||||
@ -55,7 +64,7 @@
|
||||
//HV
|
||||
|
||||
|
||||
#define DUMMY_REG 68<<11//0x21<<11
|
||||
#define DUMMY_REG 0x44<<11
|
||||
#define FPGA_VERSION_REG 0<<11 //0x22<<11
|
||||
#define PCB_REV_REG 0<<11
|
||||
#define FIX_PATT_REG 1<<11 //0x23<<11
|
||||
@ -182,7 +191,7 @@
|
||||
|
||||
|
||||
|
||||
#define DAQ_REG 93<<11
|
||||
//#define DAQ_REG 0x5d<<11 //same as CONFGAIN_REG
|
||||
#define ADC_LATCH_DISABLE_REG 94<<11
|
||||
|
||||
#define HV_REG 95<<11
|
||||
@ -303,7 +312,7 @@
|
||||
#define RUNSTATE_0_BIT 0x00001000
|
||||
#define RUNSTATE_1_BIT 0x00002000
|
||||
#define RUNSTATE_2_BIT 0x00004000
|
||||
#define STOPPED_BIT 0x00008000 // error!
|
||||
#define STOPPED_BIT 0x00008000 // stopped!
|
||||
#define ALL_FIFO_EMPTY_BIT 0x00010000 // data ready
|
||||
#define RUNMACHINE_BUSY_BIT 0x00020000
|
||||
#define READMACHINE_BUSY_BIT 0x00040000
|
||||
@ -409,10 +418,11 @@
|
||||
|
||||
|
||||
/* settings/conf gain register */
|
||||
#define GAIN_MASK 0x0000000f
|
||||
#define GAIN_MASK 0x0000ffff
|
||||
#define GAIN_OFFSET 0
|
||||
#define SETTINGS_MASK 0x000000f0
|
||||
#define SETTINGS_OFFSET 4
|
||||
#define SPEED_GAIN_MASK 0xf0000000
|
||||
#define SPEED_GAIN_OFFSET 28
|
||||
|
||||
|
||||
|
||||
/* CHIP_OF_INTRST_REG */
|
||||
|
@ -27,7 +27,6 @@ int main(int argc, char *argv[])
|
||||
int retval=OK;
|
||||
int sd, fd;
|
||||
int iarg;
|
||||
int checkType = 1;
|
||||
|
||||
|
||||
for(iarg=1; iarg<argc; iarg++){
|
||||
@ -48,13 +47,6 @@ int main(int argc, char *argv[])
|
||||
printf("No test condition given. Exiting.\n");
|
||||
return 1;
|
||||
}
|
||||
if(!strcasecmp(argv[iarg+1],"with_gotthard")){
|
||||
checkType = 0;
|
||||
}else{
|
||||
printf("could not decode test condition. Possible arguments: with_gotthard. Exiting\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,31 +60,21 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
b=0;
|
||||
printf("\n\nStop Server\nOpening stop server on port %d\n",portno);
|
||||
checkType=0;
|
||||
|
||||
}
|
||||
|
||||
//control server
|
||||
else {
|
||||
portno = DEFAULT_PORTNO;
|
||||
if(checkType)
|
||||
sprintf(cmd,"%s %d stopserver &",argv[0],DEFAULT_PORTNO+1);
|
||||
else
|
||||
sprintf(cmd,"%s %d stopserver -test with_gotthard &",argv[0],DEFAULT_PORTNO+1);
|
||||
sprintf(cmd,"%s %d stopserver &",argv[0],DEFAULT_PORTNO+1);
|
||||
printf("\n\nControl Server\nOpening control server on port %d\n",portno );
|
||||
|
||||
//printf("\n\ncmd:%s\n",cmd);
|
||||
system(cmd);
|
||||
b=1;
|
||||
checkType=1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
init_detector(b, checkType);
|
||||
init_detector(b);
|
||||
|
||||
|
||||
sd=bindSocket(portno);
|
||||
|
@ -7,23 +7,15 @@
|
||||
|
||||
|
||||
// Hardware definitions
|
||||
#define NMAXMODY 1
|
||||
#define NMAXMOD (NMAXMODX*NMAXMODY)
|
||||
|
||||
#define NCHAN 32
|
||||
#define NCHIP 1
|
||||
#define NADC 1
|
||||
#define NDAC 16
|
||||
#define NMAXMODX 1
|
||||
#define NCHANS (NCHAN*NCHIP*NMAXMOD)
|
||||
#define NDACS (NDAC*NMAXMOD)
|
||||
|
||||
#define JUNGFRAU_NCHAN (256*256)
|
||||
#define JUNGFRAU_NCHIP 8
|
||||
#define JUNGFRAU_NADC 0
|
||||
#define JUNGFRAU_NDAC 16
|
||||
#define JUNGFRAU_NCHANS (JUNGFRAU_NCHAN*JUNGFRAU_NCHIP*NMAXMOD)
|
||||
|
||||
#define NMAXMODY 1
|
||||
#define NMAXMODX 1
|
||||
#define NMAXMOD (NMAXMODX*NMAXMODY)
|
||||
#define NCHAN (256*256)
|
||||
#define NCHIP 8
|
||||
#define NADC 0
|
||||
#define NDAC 16
|
||||
#define NCHANS (NCHAN*NCHIP*NMAXMOD)
|
||||
#define NDACS (NDAC*NMAXMOD)
|
||||
|
||||
|
||||
/**when moench readout tested with gotthard module*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,7 +23,7 @@ int sockfd;
|
||||
int function_table();
|
||||
|
||||
int decode_function(int);
|
||||
int init_detector(int,int);
|
||||
int init_detector(int);
|
||||
|
||||
int M_nofunc(int);
|
||||
int exit_server(int);
|
||||
@ -95,4 +95,8 @@ int set_roi(int);
|
||||
int set_ctb_pattern(int);
|
||||
|
||||
int write_adc_register(int);;
|
||||
|
||||
int program_fpga(int);
|
||||
int reset_fpga(int);
|
||||
int power_chip(int);
|
||||
#endif
|
||||
|
@ -1,39 +0,0 @@
|
||||
#include "sharedmemory.h"
|
||||
|
||||
struct statusdata *stdata;
|
||||
|
||||
int inism(int clsv) {
|
||||
|
||||
static int scansmid;
|
||||
|
||||
if (clsv==SMSV) {
|
||||
if ( (scansmid=shmget(SMKEY,1024,IPC_CREAT | 0666 ))==-1 ) {
|
||||
return -1;
|
||||
}
|
||||
if ( (stdata=shmat(scansmid,NULL,0))==(void*)-1) {
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
if (clsv==SMCL) {
|
||||
if ( (scansmid=shmget(SMKEY,0,0) )==-1 ) {
|
||||
return -3;
|
||||
}
|
||||
if ( (stdata=shmat(scansmid,NULL,0))==(void*)-1) {
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void write_status_sm(char *status) {
|
||||
strcpy(stdata->status,status);
|
||||
}
|
||||
|
||||
void write_stop_sm(int v) {
|
||||
stdata->stop=v;
|
||||
}
|
||||
|
||||
void write_runnumber_sm(int v) {
|
||||
stdata->runnumber=v;
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
#ifndef SM
|
||||
#define SM
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
//#include <asm/page.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#include <sys/shm.h>
|
||||
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
/* key for shared memory */
|
||||
#define SMKEY 10001
|
||||
|
||||
#define SMSV 1
|
||||
#define SMCL 2
|
||||
|
||||
|
||||
struct statusdata {
|
||||
int runnumber;
|
||||
int stop;
|
||||
char status[20];
|
||||
} ;
|
||||
|
||||
|
||||
/* for shared memory */
|
||||
|
||||
int inism(int clsv);
|
||||
void write_status_sm(char *status);
|
||||
void write_stop_sm(int v);
|
||||
void write_runnumber_sm(int v);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user