mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
added the dark and gain image funcitions
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@120 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
23aea6007b
commit
a7e9cc1091
@ -6,7 +6,7 @@
|
||||
CROSS = bfin-uclinux-
|
||||
CC = $(CROSS)gcc
|
||||
|
||||
CFLAGS += -Wall -DMCB_FUNCS -DVERBOSE #-DVERYVERBOSE #-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
|
||||
|
@ -880,6 +880,24 @@ int64_t getMeasurementTime(){
|
||||
|
||||
|
||||
|
||||
|
||||
int loadImage(int index, short int ImageVals[]){
|
||||
u_int32_t address;
|
||||
switch (index) {
|
||||
case DARK_IMAGE :
|
||||
address = DARK_IMAGE_REG;
|
||||
break;
|
||||
case GAIN_IMAGE :
|
||||
address = GAIN_IMAGE_REG;
|
||||
break;
|
||||
}
|
||||
int *ptr=(u_int16_t*)(CSP0BASE+address*2);
|
||||
dma_memcpy(ptr,ImageVals ,2560);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int64_t getProbes(){
|
||||
u_int32_t shiftin=bus_r(GET_SHIFT_IN_REG);
|
||||
u_int32_t np=(shiftin >>PROBES_OFF) & PROBES_MASK;
|
||||
@ -1185,9 +1203,9 @@ int configureMAC(int ipad,long long int macad,long long int servermacad,int ival
|
||||
while (sum>>16) sum = (sum & 0xffff) + (sum >> 16);// Fold 32-bit sum to 16 bits
|
||||
checksum = (~sum)&0xffff;
|
||||
mac_conf_regs->ip.ip_chksum = checksum;
|
||||
#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
printf("IP header checksum is 0x%x s\n",checksum);
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
mac_conf_regs->udp.udp_srcport = 0xE185;
|
||||
mac_conf_regs->udp.udp_destport = 0xC351;
|
||||
|
@ -91,6 +91,8 @@ int64_t setProgress();
|
||||
int64_t getActualTime();
|
||||
int64_t getMeasurementTime();
|
||||
|
||||
int loadImage(int index, short int ImageVals[]);
|
||||
|
||||
u_int32_t runBusy(void);
|
||||
u_int32_t runState(void);
|
||||
u_int32_t dataPresent(void);
|
||||
|
@ -94,6 +94,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
//image
|
||||
#define DARK_IMAGE_REG 0x81<<11
|
||||
#define GAIN_IMAGE_REG 0x82<<11
|
||||
|
||||
|
||||
|
||||
//not used so far
|
||||
#define SPEED_REG 0x006000
|
||||
#define SET_NBITS_REG 0x008000
|
||||
|
@ -69,9 +69,9 @@ int main(int argc, char *argv[])
|
||||
printf("Conenction accepted\n");
|
||||
#endif
|
||||
retval=decode_function(fd);
|
||||
//#ifdef VERY_VERBOSE
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("function executed\n");
|
||||
//#endif
|
||||
#endif
|
||||
closeConnection(fd);
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("connection closed\n");
|
||||
|
@ -160,6 +160,7 @@ int function_table() {
|
||||
flist[F_GET_LAST_CLIENT_IP]=&get_last_client_ip;
|
||||
flist[F_UPDATE_CLIENT]=&update_client;
|
||||
flist[F_CONFIGURE_MAC]=&configure_mac;
|
||||
flist[F_LOAD_IMAGE]=&load_image;
|
||||
#ifdef VERBOSE
|
||||
/* for (i=0;i<256;i++){
|
||||
printf("function %d located at %x\n",i,flist[i]);
|
||||
@ -933,7 +934,7 @@ int set_dac(int file_des) {
|
||||
}
|
||||
|
||||
if (ret==OK) {
|
||||
if (differentClients==1 && lockStatus==1 && val!=-1) {
|
||||
if (differentClients==1 && lockStatus==1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else{
|
||||
@ -2781,3 +2782,77 @@ int configure_mac(int file_des) {
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int load_image(int file_des) {
|
||||
int retval;
|
||||
int ret=OK;
|
||||
int n;
|
||||
int index;
|
||||
short int ImageVals[1280];
|
||||
|
||||
sprintf(mess,"Can't load image\n");
|
||||
|
||||
n = receiveDataOnly(file_des,index,sizeof(index));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
n = receiveDataOnly(file_des,ImageVals,sizeof(ImageVals));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
switch (index) {
|
||||
case DARK_IMAGE :
|
||||
#ifdef VERBOSE
|
||||
printf(" Loading Dark image\n");
|
||||
#endif
|
||||
break;
|
||||
case GAIN_IMAGE :
|
||||
#ifdef VERBOSE
|
||||
printf(" Loading Dark image\n");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
printf("Unknown index %d\n",index);
|
||||
sprintf(mess,"Unknown index %d\n",index);
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
printf("%d\n%d\n",ImageVals[0],ImageVals[1]);
|
||||
|
||||
if (ret==OK) {
|
||||
if (differentClients==1 && lockStatus==1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else{
|
||||
retval=loadImage(index,ImageVals);
|
||||
if (retval= -1)
|
||||
ret = FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
if(ret==FAIL)
|
||||
printf("Loading image failed\n");
|
||||
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));
|
||||
}
|
||||
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
}
|
||||
|
@ -75,4 +75,6 @@ int update_client(int);
|
||||
int send_update(int);
|
||||
int configure_mac(int);
|
||||
|
||||
int load_image(int);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user