untangled moench from jungfrau, quite a few changes

This commit is contained in:
Dhanya Maliakal 2016-10-27 07:26:47 +02:00
parent 7eda5f9de5
commit 3c646c3545
16 changed files with 3222 additions and 5319 deletions

View File

@ -137,7 +137,7 @@ int acceptConnection(int socketDescriptor) {
//socklen_t address_length;
size_t address_length=sizeof(struct sockaddr_in);
socklen_t address_length=sizeof(struct sockaddr_in);
if (socketDescriptor<0)
return -1;

View File

@ -0,0 +1 @@
*.gdb

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@ 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();
@ -37,8 +36,8 @@ 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);
@ -68,7 +67,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);
@ -142,9 +140,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);

File diff suppressed because it is too large Load Diff

View File

@ -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
@ -409,14 +418,10 @@
/* 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 JUNGFRAU_GAIN_MASK 0x0000ffff
#define JUNGFRAU_SPEED_GAIN_MASK 0xf0000000
#define JUNGFRAU_SPEED_GAIN_OFFSET 28
#define SPEED_GAIN_MASK 0xf0000000
#define SPEED_GAIN_OFFSET 28

View File

@ -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);
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);

View File

@ -8,23 +8,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 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)
#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)
/**when moench readout tested with gotthard module*/
#define GOTTHARDNCHAN 128

File diff suppressed because it is too large Load Diff

View File

@ -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);

View File

@ -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;
}

View File

@ -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