Merge branch 'master' of gitorious.psi.ch:sls_det_software/sls_detector_software

This commit is contained in:
bergamaschi 2015-08-28 10:55:22 +02:00
commit 84ad2912c6
37 changed files with 858 additions and 449 deletions

View File

@ -420,9 +420,9 @@ enum readOutFlags {
BACKGROUND_CORRECTIONS=0x1000, /**<background corrections */
TOT_MODE=0x2000,/**<pump-probe mode */
CONTINOUS_RO=0x4000,/**<pump-probe mode */
PARALLEL=0x10,/** <eiger parallel mode */
NONPARALLEL=0x20,/** <eiger serial mode */
SAFE=0x40/** <eiger safe mode */
PARALLEL=0x10000,/** <eiger parallel mode */
NONPARALLEL=0x20000,/** <eiger serial mode */
SAFE=0x40000/** <eiger safe mode */
};
/**
trimming modes

View File

@ -15,8 +15,12 @@
#include <string.h>
#include <unistd.h>
#include "xfs_types.h"
#include "xparameters.h"
#include "FebRegisterDefs.h"
#include "Beb.h"
@ -26,7 +30,6 @@
int bebInfoSize = 0;
struct LocalLinkInterface ll_beb_local,* ll_beb;
struct LocalLinkInterface ll_beb_new_memory_local,* ll_beb_new_memory;
struct udp_header_type udp_header;
@ -146,27 +149,59 @@ void Beb_GetModuleCopnfiguration(int* master, int* top){
*top = 0;
*master = 0;
//mapping new memory to read master top module configuration
ll_beb_new_memory = &ll_beb_new_memory_local;
Local_LocalLinkInterface(ll_beb_new_memory);
int ret = Local_GetModuleConfiguration(ll_beb_new_memory,XPAR_PLB_GPIO_SYS_BASEADDR, MODULE_CONFIGURATION);
if(!ret)
printf("Module Configuration FAIL\n");
else{
u_int32_t baseaddr;
int ret;
//open file pointer
int fd = Beb_open(XPAR_PLB_GPIO_SYS_BASEADDR,&baseaddr);
if(fd < 0){
cprintf(RED,"Module Configuration FAIL\n");
}else{
//read data
ret = Beb_Read32(baseaddr, MODULE_CONFIGURATION_MASK);
printf("Module Configuration OK\n");
printf("Beb: value =0x%x\n",ret);
if(ret&0xf){
if(ret&TOP_BIT_MASK)
*top = 1;
// printf("Beb.c: TOP\n\n\n\n");
}//else printf("Beb.c: BOTTOM\n\n\n\n");
if(ret&0x200){
if(ret&MASTER_BIT_MASK)
*master = 1;
// printf("Beb.c: MASTER\n\n\n\n");
}//else printf("Beb.c: SLAVE\n\n\n\n");
//close file pointer
Beb_close(fd);
}
}
u_int32_t Beb_GetFirmwareRevision(){
//mapping new memory
u_int32_t baseaddr, value = 0;
//open file pointer
int fd = Beb_open(XPAR_VERSION,&baseaddr);
if(fd < 0)
cprintf(RED,"Firmware Revision Read FAIL\n");
else{
//read revision existing bit
value = Beb_Read32(baseaddr, REVISION_EXISTING_OFFSET);
printf("Firmware Revision Read OK\n");
//error reading
if(!(value&REVISION_EXISTING_BIT)){
cprintf(RED,"Firmware Revision Number does not exist in this version\n");
value = 0;
}else{
//read revision number
value = Beb_Read32(baseaddr, 0);
printf("Firmware Revision Number Read OK\n");
printf("Rev: 0x%x.%x\n\n",value & REVISION_MASK,value & SUB_REVISION_MASK);
value &= REVISION_MASK;
}
}
//close file pointer
if(fd > 0)
Beb_close(fd);
return value;
}
void Beb_ClearBebInfos(){
//unsigned int i;
@ -542,32 +577,29 @@ int Beb_SetUpTransferParameters(short the_bit_mode){
int Beb_StopAcquisition()
{
volatile u_int32_t* ptrl;
volatile u_int32_t* ptrr;
// Mapping
int fd;
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
if (fd == -1)
{
printf("\nCan't find /dev/mem!\n");
u_int32_t baseaddr;
volatile u_int32_t valuel,valuer;
//open file pointer
int fd = Beb_open(XPAR_CMD_GENERATOR,&baseaddr);
if(fd < 0){
cprintf(RED,"Beb Stop Acquisition FAIL\n");
return 0;
}
u_int32_t CSP0BASE = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, 0xC5000000 );
if (CSP0BASE == (u_int32_t)MAP_FAILED)
{
printf("\nCan't map memmory area!!\n");
return 0;
}
}else{
//find value
valuel = Beb_Read32(baseaddr, (LEFT_OFFSET+STOP_ACQ_OFFSET));
valuer = Beb_Read32(baseaddr, (RIGHT_OFFSET+STOP_ACQ_OFFSET));
//high
Beb_Write32(baseaddr, (LEFT_OFFSET + STOP_ACQ_OFFSET),(valuel|STOP_ACQ_BIT));
Beb_Write32(baseaddr, (RIGHT_OFFSET + STOP_ACQ_OFFSET),(valuer|STOP_ACQ_BIT));
//low
Beb_Write32(baseaddr, (LEFT_OFFSET + STOP_ACQ_OFFSET),(valuel&(~STOP_ACQ_BIT)));
Beb_Write32(baseaddr, (RIGHT_OFFSET + STOP_ACQ_OFFSET),(valuer&(~STOP_ACQ_BIT)));
ptrl = (u_int32_t*)(CSP0BASE);
ptrr = (u_int32_t*)(CSP0BASE+0x100);
*(ptrl+7) = (1 << 30);
*(ptrr+7) = (1 << 30);
*(ptrl+7) = 0;
*(ptrr+7) = 0;
close(fd);
printf("Beb Stop Acquisition OK\n");
//close file pointer
Beb_close(fd);
}
return 1;
}
int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait){
@ -578,8 +610,8 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
unsigned int npackets = ten_gig ? Beb_bit_mode*4 : Beb_bit_mode*16;
int in_two_requests = (!ten_gig&&Beb_bit_mode==32);
volatile u_int32_t* ptrl;
volatile u_int32_t* ptrr;
// volatile u_int32_t* ptrl;
// volatile u_int32_t* ptrr;
u_int32_t send_header_command;
u_int32_t send_frame_command;
@ -605,12 +637,12 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
// base+10 1st 32bits of 2nd command
// base+14 2nd 32bits of 2nd command
//
// base+1c command counter (sends n commands)
// base+18 command counter (sends n commands)
// <32 Bit mode : 2 commands for 1 frame neccessary (header + frame) (10 frames = 20 commands)
// 32 Bit mode : 3 commands for 1 frame neccessary (header + 1st halfframe + 2nd halfframe) (10 frames = 30 commands)
// if > 0 core starts operation
//
// base+20 command mode (for 32 bit mode)
// base+1c command mode (for 32 bit mode)
// 0 for 2 command mode (send 1st command and 2nd command) (header + frame)
// 1 on bit 31 for 3 command mode (send 1st command, 2nd command, and 2nd command) (header + 1st halfframe + 2nd halfframe)
//
@ -619,75 +651,67 @@ int Beb_RequestNImages(unsigned int beb_number, int ten_gig, unsigned int dst_nu
//
// Mapping
int fd;
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
if (fd == -1)
{
printf("\nCan't find /dev/mem!\n");
u_int32_t right_port_value = 0x2000;
u_int32_t baseaddr;
volatile u_int32_t value;
//open file pointer
int fd = Beb_open(XPAR_CMD_GENERATOR,&baseaddr);
if(fd < 0){
cprintf(RED,"Beb Request N Images FAIL\n");
return 0;
}
u_int32_t CSP0BASE = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, 0xC5000000 );
if (CSP0BASE == (u_int32_t)MAP_FAILED)
{
printf("\nCan't map memmory area!!\n");
return 0;
}
ptrl = (u_int32_t*)(CSP0BASE);
ptrr = (u_int32_t*)(CSP0BASE+0x100);
int i;
}else{
#ifdef MARTIN
int i;
for (i=0; i < 10; i++)
printf("%X\n",*(ptrl+i));
printf("%X\n",Beb_Read32(baseaddr, (LEFT_OFFSET + i*4)));
#endif
// Generating commands
send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0;
send_frame_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | packet_size << 14 | (npackets-1);
#ifdef MARTIN
for (i=0; i < 10; i++)
printf("%X\n",*(ptrl+i));
printf("%X\n",Beb_Read32(baseaddr, (LEFT_OFFSET + i*4)));
printf("%d\n",in_two_requests);
#endif
// Wait until last command was send successfully
// while (*(ptrl+6) != 0);
// while (*(ptrr+6) != 0);
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
//Left
*(ptrl+2) = 0;
*(ptrl+3) = send_header_command;
*(ptrl+4) = 0;
*(ptrl+5) = send_frame_command;
*(ptrl+7) = in_two_requests << 31;
Beb_Write32(baseaddr, (LEFT_OFFSET + FIRST_CMD_PART1_OFFSET),0);
Beb_Write32(baseaddr, (LEFT_OFFSET + FIRST_CMD_PART2_OFFSET),send_header_command);
Beb_Write32(baseaddr, (LEFT_OFFSET + SECOND_CMD_PART1_OFFSET),0);
Beb_Write32(baseaddr, (LEFT_OFFSET + SECOND_CMD_PART2_OFFSET),send_frame_command);
value = Beb_Read32(baseaddr,(LEFT_OFFSET + TWO_REQUESTS_OFFSET));
if(in_two_requests) Beb_Write32(baseaddr, (LEFT_OFFSET + TWO_REQUESTS_OFFSET),(value | TWO_REQUESTS_BIT));
else Beb_Write32(baseaddr, (LEFT_OFFSET + TWO_REQUESTS_OFFSET),(value &~(TWO_REQUESTS_BIT)));
// Right
*(ptrr+2) = 0;
*(ptrr+3) = send_header_command | 0x2000;
*(ptrr+4) = 0;
*(ptrr+5) = send_frame_command | 0x2000;
*(ptrr+7) = in_two_requests | (in_two_requests << 31);
Beb_Write32(baseaddr, (RIGHT_OFFSET + FIRST_CMD_PART1_OFFSET),0);
Beb_Write32(baseaddr, (RIGHT_OFFSET + FIRST_CMD_PART2_OFFSET),send_header_command | right_port_value);
Beb_Write32(baseaddr, (RIGHT_OFFSET + SECOND_CMD_PART1_OFFSET),0);
Beb_Write32(baseaddr, (RIGHT_OFFSET + SECOND_CMD_PART2_OFFSET),send_frame_command | right_port_value);
value = Beb_Read32(baseaddr,(RIGHT_OFFSET + TWO_REQUESTS_OFFSET));
if(in_two_requests) Beb_Write32(baseaddr, (RIGHT_OFFSET + TWO_REQUESTS_OFFSET),(value | TWO_REQUESTS_BIT));
else Beb_Write32(baseaddr, (RIGHT_OFFSET + TWO_REQUESTS_OFFSET),(value &~(TWO_REQUESTS_BIT)));
// Set number of frames
*(ptrl+6) = nimages*(2+in_two_requests);
*(ptrr+6) = nimages*(2+in_two_requests);
Beb_Write32(baseaddr, (LEFT_OFFSET + COMMAND_COUNTER_OFFSET), nimages*(2+in_two_requests));
Beb_Write32(baseaddr, (RIGHT_OFFSET + COMMAND_COUNTER_OFFSET), nimages*(2+in_two_requests));
#ifdef MARTIN
for (i=0; i < 10; i++)
printf("%X\n",*(ptrl+i));
printf("%X\n",Beb_Read32(baseaddr, (LEFT_OFFSET + i*4))); //*(ptrl+i));
printf("%d\n",in_two_requests);
#endif
close(fd);
Beb_close(fd);
#ifdef MARTIN
cprintf(RED, "----Beb_RequestNImages----\n");
printf("----Beb_RequestNImages----\n");
#endif
}
return 1;
}
@ -758,3 +782,46 @@ int Beb_GetBebFPGATemp()
return temperature;
}
int Beb_open(u_int32_t baseaddr, u_int32_t* csp0base){
int fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
if (fd == -1)
cprintf(RED,"\nCan't find /dev/mem!\n");
else{
#ifdef VERBOSE
printf("/dev/mem opened\n");
#endif
*csp0base = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, baseaddr);
if (*csp0base == (u_int32_t)MAP_FAILED) {
cprintf(RED,"\nCan't map memmory area!!\n");
fd = -1;
}
#ifdef VERBOSE
else printf("CSP0 mapped\n");
#endif
}
return fd;
}
u_int32_t Beb_Read32 (u_int32_t baseaddr, u_int32_t offset){
volatile u_int32_t *ptr1;
ptr1=(u_int32_t*)(baseaddr + offset);
return *ptr1;
}
u_int32_t Beb_Write32 (u_int32_t baseaddr, u_int32_t offset, u_int32_t data){
volatile u_int32_t *ptr1;
ptr1=(u_int32_t*)(baseaddr + offset);
*ptr1 = data;
return *ptr1;
}
void Beb_close(int fd){
if(fd >= 0)
close(fd);
}

View File

@ -48,8 +48,7 @@ struct BebInfo{
void Beb_GetModuleCopnfiguration(int* master, int* top);
u_int32_t Beb_GetFirmwareRevision();
int Beb_WriteTo(unsigned int index);
@ -83,6 +82,10 @@ struct BebInfo{
int Beb_GetBebFPGATemp();
int Beb_open(u_int32_t baseaddr, u_int32_t* csp0base);
u_int32_t Beb_Read32 (u_int32_t baseaddr, u_int32_t offset);
u_int32_t Beb_Write32 (u_int32_t baseaddr, u_int32_t offset, u_int32_t data);
void Beb_close(int fd);
#endif

View File

@ -109,3 +109,8 @@
#define CHIP_DATA_OUT_DELAY_REG3 3
#define CHIP_DATA_OUT_DELAY_REG4 4
#define CHIP_DATA_OUT_DELAY_SET 0x20000000
//module configuration
#define TOP_BIT_MASK 0x00f
#define MASTER_BIT_MASK 0x200

View File

@ -1028,8 +1028,8 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
} //end row loop
if(Module_TopAddressIsValid(&modules[1])){
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_l)||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_l)||
!Feb_Interface_WriteMemoryInLoops(Module_GetTopRightAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
// !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
@ -1037,8 +1037,8 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
return 0;
}
}else{
if(!Feb_Interface_WriteMemoryInLoops(Module_GetBottomLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
!Feb_Interface_WriteMemoryInLoops(Module_GetBottomRightAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_l)||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetBottomLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_l)||
!Feb_Interface_WriteMemoryInLoops(Module_GetBottomRightAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
//if(!Feb_Interface_WriteMemory(Module_GetTopLeftAddress(&modules[0]),0,0,1023,trimbits_to_load_r)||
// !Feb_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){

View File

@ -109,3 +109,30 @@
#define CHIP_DATA_OUT_DELAY_REG3 3
#define CHIP_DATA_OUT_DELAY_REG4 4
#define CHIP_DATA_OUT_DELAY_SET 0x20000000
//module configuration
#define TOP_BIT_MASK 0x00f
#define MASTER_BIT_MASK 0x200
// Master Slave Top Bottom Definition
#define MODULE_CONFIGURATION_MASK 0x84
//command memory
#define LEFT_OFFSET 0x0
#define RIGHT_OFFSET 0x100
#define FIRST_CMD_PART1_OFFSET 0x8
#define FIRST_CMD_PART2_OFFSET 0xc
#define SECOND_CMD_PART1_OFFSET 0x10
#define SECOND_CMD_PART2_OFFSET 0x14
#define COMMAND_COUNTER_OFFSET 0x18
#define STOP_ACQ_OFFSET 0x1c
#define STOP_ACQ_BIT 0x40000000
#define TWO_REQUESTS_OFFSET 0x1c
#define TWO_REQUESTS_BIT 0x80000000
//firmware version
#define REVISION_EXISTING_OFFSET 8
#define REVISION_EXISTING_BIT 0x80000000
#define REVISION_MASK 0x0FFFFFFF
#define SUB_REVISION_MASK 0xF0000000

View File

@ -32,29 +32,6 @@ void Local_LocalLinkInterface(struct LocalLinkInterface* ll){
printf("Initializing new memory\n");
}
int Local_GetModuleConfiguration (struct LocalLinkInterface* ll, u_int32_t baseaddr, u_int32_t offset){
int fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
if (fd == -1) {
printf("\nCan't find /dev/mem!\n");
return 0;
}
printf("/dev/mem opened\n");
u_int32_t CSP0BASE = (u_int32_t)mmap(0, 0x100000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, baseaddr);
if (CSP0BASE == (u_int32_t)MAP_FAILED) {
printf("\nCan't map memmory area!!\n");
return 0;
}
printf("CSP0 mapped\n");
volatile u_int32_t *ptr1;
ptr1=(u_int32_t*)(CSP0BASE + offset);
//printf("LocalLinkInterface:: value:%d\n",*ptr1);
close(fd);
return *ptr1;
}
int Local_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr){

View File

@ -40,7 +40,6 @@ struct LocalLinkInterface{
int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer);
void Local_LocalLinkInterface(struct LocalLinkInterface* ll);
int Local_GetModuleConfiguration (struct LocalLinkInterface* ll, u_int32_t baseaddr, u_int32_t offset);
/*
int FiFoReset(unsigned int numb);

View File

@ -1,6 +1,6 @@
CC = powerpc-4xx-softfloat-gcc
CCX = powerpc-4xx-softfloat-g++
CFLAGS += -Wall -DDACS_INT -DMARTIN -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE -DMARTIN
LDLIBS += -lm -lstdc++
PROGS = eigerDetectorServer

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
Revision: 107
Branch: gemma
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 288
Last Changed Date: 2014-12-08 10:16:31 +0100
URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
Revision: 141
Branch: master
Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 300
Last Changed Date: 2015-06-22 17:09:47 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer"
#define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer"
//#define SVNREPPATH ""
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
//#define SVNREV 0x288
#define SVNREPUUID "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
//#define SVNREV 0x300
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya"
#define SVNREV 0x288
#define SVNDATE 0x20141208
#define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x300
#define SVNDATE 0x20150622
//

View File

@ -9,8 +9,6 @@
#include "slsDetectorFunctionList.h"
#include "gitInfoEiger.h"
/*#include "EigerHighLevelFunctions.c"
#include "EigerBackEndFunctions.c"*/
#include "FebControl.h"
#include "Beb.h"
@ -19,6 +17,8 @@
enum detectorSettings thisSettings;
const char* dac_names[16] = {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"};
enum{E_PARALLEL, E_NON_PARALLEL, E_SAFE};
//static const string dacNames[16] = {"Svp","Svn","Vtr","Vrf","Vrs","Vtgstv","Vcmp_ll","Vcmp_lr","Cal","Vcmp_rl","Vcmp_rr","Rxb_rb","Rxb_lb","Vcp","Vcn","Vis"};
sls_detector_module *detectorModules=NULL;
@ -33,6 +33,7 @@ int eiger_iodelay = 0;
int eiger_photonenergy = 0;
int eiger_dynamicrange = 0;
int eiger_readoutmode = 0;
int eiger_storeinmem = 0;
int eiger_readoutspeed = 0;
int eiger_triggermode = 0;
int eiger_extgating = 0;
@ -61,6 +62,9 @@ int top = 0;
int master = 0;
#define TEN_GIGA_BUFFER_SIZE 4112
#define ONE_GIGA_BUFFER_SIZE 1040
int initDetector(){
int imod,i,n;
n = getNModBoard(1);
@ -130,9 +134,9 @@ int initDetector(){
setTimer(FRAME_PERIOD,1E9);
setDynamicRange(16);
setThresholdEnergy(8000,0);
setReadOutFlags(PARALLEL);
setReadOutFlags(NONPARALLEL);
setSpeed(0,1);//clk_devider,half speed
setHighVolage(150,0);
setHighVolage(0,0);
setIODelay(675,0);
setTiming(AUTO_TIMING);
//SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
@ -209,7 +213,7 @@ int64_t getDetectorId(enum idMode arg){
retval = getDetectorNumber();/** to be implemented with mac? */
break;
case DETECTOR_FIRMWARE_VERSION:
return FIRMWAREREV;/** to be implemented */
return (int64_t)Beb_GetFirmwareRevision();
case DETECTOR_SOFTWARE_VERSION:
retval= SVNREV;
retval= (retval <<32) | SVNDATE;
@ -233,23 +237,6 @@ int getDetectorNumber(){
perror("gethostname");
sscanf(hostname,"%x",&res);
return res;
/*
char output[255]="";
int res=0;
FILE* sysFile = popen("hostname", "r");
fgets(output, sizeof(output), sysFile);
pclose(sysFile);
sscanf(output,"%x",&res);
return res;
*/
/*
int res=0;
char hostname[100] = "beb000";
sscanf(hostname,"%x",&res);
return res;
*/
}
@ -502,15 +489,17 @@ int startReceiver(int d){
int startStateMachine(){
int ret,prev_flag;
int ret = OK,prev_flag;
//get the DAQ toggle bit
prev_flag = Feb_Control_AcquisitionStartedBit();
printf("Going to start acquisition\n");
Feb_Control_StartAcquisition();
printf("requesting images\n");
if(!eiger_storeinmem){
printf("requesting images right after start\n");
ret = startReadOut();
}
//wait for acquisition start
if(ret == OK){
@ -520,6 +509,7 @@ int startStateMachine(){
}
cprintf(GREEN,"***Acquisition started\n");
}
/*while(getRunStatus() == IDLE){printf("waiting for being not idle anymore\n");}*/
return ret;
@ -530,6 +520,7 @@ int stopStateMachine(){
printf("Going to stop acquisition\n");
if(Feb_Control_StopAcquisition() & Beb_StopAcquisition())
return OK;
printf("failed to stop acquisition\n");
return FAIL;
}
@ -537,7 +528,7 @@ int stopStateMachine(){
int startReadOut(){
//RequestImages();
int ret_val = 0, i;
int ret_val = 0;
dst_requested[0] = 1;
while(dst_requested[on_dst]){
//waits on data
@ -584,6 +575,15 @@ char *readFrame(int *ret, char *mess){
if(!Feb_Control_WaitForFinishedFlag(5000))
cprintf(RED,"Error: Waiting for finished flag\n");
cprintf(GREEN,"Acquisition finished***\n");
if(eiger_storeinmem){
printf("requesting images after storing in memory\n");
if(startReadOut() == FAIL){
cprintf(RED, "Could not read out images\n");
*ret = (int)FAIL;
return NULL;
}
}
//usleep(0);
usleep(1000000);
printf("*****Done Waiting...\n");
@ -692,26 +692,53 @@ int setDynamicRange(int dr){
enum readOutFlags setReadOutFlags(enum readOutFlags val){
int ret;
enum readOutFlags retval;
if(val!=GET_READOUT_FLAGS){
if(val&0xF0000){
switch(val){
case PARALLEL: val=0; break;
case NONPARALLEL: val=1; break;
case SAFE: val=2; break;
default: val=0; break;
case PARALLEL: val=E_PARALLEL; printf(" Setting Read out Flag: Parallel\n"); break;
case NONPARALLEL: val=E_NON_PARALLEL; printf(" Setting Read out Flag: Non Parallel\n"); break;
case SAFE: val=E_SAFE; printf(" Setting Read out Flag: Safe\n"); break;
default:
cprintf(RED,"Cannot set unknown readout flag. 0x%x\n", val);
return -1;
}
printf(" Setting Read out Flag: %d\n",val);
if(Feb_Control_SetReadoutMode(val))
eiger_readoutmode = val;
else return -1;
}else{
switch(val){
case STORE_IN_RAM: val=1; printf(" Setting Read out Flag: Store in Ram\n"); break;
case CONTINOUS_RO: val=0; printf(" Setting Read out Flag: Continuous Readout\n"); break;
default:
cprintf(RED,"Cannot set unknown readout flag. 0x%x\n", val);
return -1;
}
printf(" Setting store in ram variable: %d\n",val);
eiger_storeinmem = val;
}
switch(eiger_readoutmode){
case 0: ret=PARALLEL; break;
case 1: ret=NONPARALLEL; break;
case 2: ret=SAFE; break;
default:ret=-1; break;
}
return ret;
switch(eiger_readoutmode){
case E_PARALLEL: retval=PARALLEL; break;
case E_NON_PARALLEL: retval=NONPARALLEL; break;
case E_SAFE: retval=SAFE; break;
}
switch(eiger_storeinmem){
case 0: retval|=CONTINOUS_RO; break;
case 1: retval|=STORE_IN_RAM; break;
}
printf("Read out Flag: 0x%x\n",retval);
return retval;
}
@ -740,13 +767,14 @@ int executeTrimming(enum trimMode mode, int par1, int par2, int imod){
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int udpport2, int ival){
if(detectormacadd != getDetectorMAC()){
//only for 1Gbe
if((!send_to_ten_gig) && (detectormacadd != getDetectorMAC())){
printf("*************************************************\n");
printf("WARNING: actual detector mac address %llx does not match the one from client %llx\n",getDetectorMAC(),detectormacadd);
detectormacadd = getDetectorMAC();
printf("WARNING: Matched detectormac to the hardware mac now\n");
printf("*************************************************\n");
}
detectormacadd = getDetectorMAC();
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
int src_port = 0xE185;
@ -807,7 +835,10 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
int calculateDataBytes(){
return setDynamicRange(-1)*16*1040;
if(send_to_ten_gig)
return setDynamicRange(-1)*16*TEN_GIGA_BUFFER_SIZE;
else
return setDynamicRange(-1)*16*ONE_GIGA_BUFFER_SIZE;
}

View File

@ -49,8 +49,12 @@ XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_LEFT_BASEADDR
#define XPAR_PLB_GPIO_SYS_BASEADDR 0xD1000000
#define XPAR_PLB_GPIO_SYS_HIGHADDR 0xD100FFFF
/* Master Slave Top Bottom Definition */
#define MODULE_CONFIGURATION 0x84
/** Command Generator */
#define XPAR_CMD_GENERATOR 0xC5000000
/** Version Numbers */
#define XPAR_VERSION 0xc6000000
/* Definitions for peripheral PLB_GPIO_TEST */
#define XPAR_PLB_GPIO_TEST_BASEADDR 0xD1010000

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
Revision: 882
Branch: gemma
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 882
Last Changed Date: 2014-12-08 10:16:31 +0100
URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
Revision: 945
Branch: master
Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 945
Last Changed Date: 2015-06-22 17:09:47 +0200

View File

@ -0,0 +1,48 @@
# $Id: Makefile,v 1.1.1.1 2006/02/04 03:35:01 freza Exp $
# first compile
# make cris-axis-linux-gnu
CROSS = bfin-uclinux-
CC = $(CROSS)gcc
CFLAGS += -Wall -DGOTTHARDD -DPROPIXD -DMCB_FUNCS -DDACS_INT -DDEBUG # -DVERBOSE #-DVERYVERBOSE #-DVIRTUAL #-DDACS_INT_CSERVER
PROGS= propixDetectorServer
INSTDIR= /tftpboot
INSTMODE= 0777
BINS = testlib_sharedlibc
SRCS = server.c server_funcs.c communication_funcs.c firmware_funcs.c mcb_funcs.c trimming_funcs.c sharedmemory.c
OBJS = $(SRCS:%.c=%.o)
all: clean $(PROGS)
boot: $(OBJS)
$(PROGS): $(OBJS)
echo $(OBJS)
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS_$@) $(LDFLAGS_$@)
install: $(PROGS)
$(INSTALL) -d $(INSTDIR)
$(INSTALL) -m $(INSTMODE) $(PROGS) $(INSTDIR)
romfs:
$(ROMFSINST) /bin/$(PROGS)
clean:
rm -rf $(PROGS) *.o *.gdb

View File

@ -0,0 +1 @@
../../slsReceiverSoftware/include/ansi.h

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
Revision: 177
Branch: gemma
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 288
Last Changed Date: 2014-12-08 10:16:31 +0100
URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
Revision: 179
Branch: master
Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 300
Last Changed Date: 2015-06-22 17:09:47 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer"
#define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer"
//#define SVNREPPATH ""
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
//#define SVNREV 0x288
#define SVNREPUUID "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
//#define SVNREV 0x300
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya"
#define SVNREV 0x288
#define SVNDATE 0x20141208
#define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x300
#define SVNDATE 0x20150622
//

View File

@ -20,6 +20,8 @@ int (*flist[256])(int);
//defined in the detector specific file
#ifdef MYTHEND
const enum detectorType myDetectorType=MYTHEN;
#elif PROPIXD
const enum detectorType myDetectorType=PROPIX;
#elif GOTTHARDD
const enum detectorType myDetectorType=GOTTHARD;
#elif EIGERD
@ -67,7 +69,11 @@ int init_detector( int b) {
}
if (b) {
#ifdef PROPIXD
printf("***This is a PROPIX detector***\n");
#else
printf("***This is a GOTTHARD detector with %d chips per module***\n", NCHIP);
#endif
printf("\nBoard Revision:0x%x\n",(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK));
#ifdef MCB_FUNCS
initDetector();
@ -1582,7 +1588,12 @@ int get_threshold_energy(int file_des) {
int n;
int imod;
#ifdef PROPIXD
strcpy(mess,"cannot get threshold for propix");
#else
strcpy(mess,"cannot get threshold for gotthard");
#endif
n = receiveDataOnly(file_des,&imod,sizeof(imod));
if (n < 0)
@ -1603,7 +1614,12 @@ int set_threshold_energy(int file_des) {
int arg[3];
int n;
#ifdef PROPIXD
strcpy(mess,"cannot set threshold for propix");
#else
strcpy(mess,"cannot set threshold for gotthard");
#endif
n = receiveDataOnly(file_des,&arg,sizeof(arg));
if (n < 0)
@ -2066,7 +2082,12 @@ int set_timer(int file_des) {
retval=setGates(tns);
break;
case PROBES_NUMBER:
#ifdef PROPIXD
sprintf(mess,"can't set/get number of probes for propix\n");
#else
sprintf(mess,"can't set/get number of probes for gotthard\n");
#endif
ret=FAIL;
break;
case CYCLES_NUMBER:
@ -2268,6 +2289,11 @@ int set_roi(int file_des) {
ret=FAIL;
}
#ifdef PROPIXD
sprintf(mess,"can't set roi for propix\n");
ret = FAIL;
#endif
if(ret != FAIL){
if(nroi!=-1){
n = receiveDataOnly(file_des,arg,nroi*sizeof(ROI));
if (n != (nroi*sizeof(ROI))) {
@ -2281,6 +2307,7 @@ int set_roi(int file_des) {
//#endif
}
/* execute action if the arguments correctly arrived*/
#ifdef MCB_FUNCS
if (lockStatus==1 && differentClients==1){//necessary???
sprintf(mess,"Detector locked by %s\n", lastClientIP);
@ -2296,7 +2323,7 @@ int set_roi(int file_des) {
}
#endif
}
if(ret==OK && differentClients){
printf("Force update\n");
@ -2330,7 +2357,12 @@ int set_speed(int file_des) {
receiveDataOnly(file_des,&arg,sizeof(arg));
receiveDataOnly(file_des,&val,sizeof(val));
#ifdef PROPIXD
sprintf(mess,"can't set speed variable for propix\n");
#else
sprintf(mess,"can't set speed variable for gotthard\n");
#endif
sendDataOnly(file_des,&ret,sizeof(ret));
@ -2350,7 +2382,11 @@ int set_readout_flags(int file_des) {
receiveDataOnly(file_des,&arg,sizeof(arg));
#ifdef PROPIXD
sprintf(mess,"can't set readout flags for propix\n");
#else
sprintf(mess,"can't set readout flags for gotthard\n");
#endif
sendDataOnly(file_des,&ret,sizeof(ret));
sendDataOnly(file_des,mess,sizeof(mess));
@ -2368,7 +2404,12 @@ int execute_trimming(int file_des) {
int ret=FAIL;
enum trimMode mode;
#ifdef PROPIXD
sprintf(mess,"can't set execute trimming for propix\n");
#else
sprintf(mess,"can't set execute trimming for gotthard\n");
#endif
receiveDataOnly(file_des,&mode,sizeof(mode));
receiveDataOnly(file_des,arg,sizeof(arg));
@ -2655,6 +2696,11 @@ int load_image(int file_des) {
ret=FAIL;
}
#ifdef PROPIXD
sprintf(mess,"can't load image for propix\n");
ret = FAIL;
#endif
switch (index) {
case DARK_IMAGE :
#ifdef VERBOSE
@ -2814,6 +2860,12 @@ int read_counter_block(int file_des) {
ret=FAIL;
}
#ifdef PROPIXD
sprintf(mess,"can't read counter block for propix\n");
ret = FAIL;
#endif
if (ret==OK) {
if (differentClients==1 && lockStatus==1) {
ret=FAIL;

View File

@ -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: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
Revision: 64
Branch: gemma
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 288
Last Changed Date: 2014-12-08 10:16:31 +0100
URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
Revision: 66
Branch: master
Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 300
Last Changed Date: 2015-06-22 17:09:47 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer"
#define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer"
//#define SVNREPPATH ""
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
//#define SVNREV 0x288
#define SVNREPUUID "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
//#define SVNREV 0x300
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya"
#define SVNREV 0x288
#define SVNDATE 0x20141208
#define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x300
#define SVNDATE 0x20150622
//

View File

@ -380,18 +380,18 @@ void multiSlsDetector::updateOffsets(){
for (int i=1; i<thisMultiDetector->numberOfDetectors; i++) {
if (detectors[i]) {
//incrementing in y direction
if ((maxChanY == -1) || ((maxChanY > 0) && ((offsetY + numY) < maxChanY))){
if ((maxChanY == -1) || ((maxChanY > 0) && ((offsetY + detectors[i]->getMaxNumberOfChannels(Y)) < maxChanY))){
offsetY += detectors[i]->getMaxNumberOfChannels(Y);
maxY += detectors[i]->getMaxNumberOfChannels(Y);
numY += detectors[i]->getTotalNumberOfChannels(Y);
}
//incrementing in y direction
//incrementing in x direction
else{
offsetY = 0;
numY = 0;
maxY = 0;
thisMultiDetector->maxNumberOfChannel[Y] = 0;
if ((maxChanX == -1) || ((maxChanX > 0) && (offsetX <= maxChanX))){
if ((maxChanX == -1) || ((maxChanX > 0) && ((offsetX + detectors[i]->getMaxNumberOfChannels(X)) < maxChanX))){
offsetX += detectors[i]->getMaxNumberOfChannels(X);
numX += detectors[i]->getTotalNumberOfChannels(X);
maxX += detectors[i]->getMaxNumberOfChannels(X);
@ -4598,6 +4598,8 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
int *retdet = NULL, *p=retval;
string fullFName="";
string ext="";
int index=-1,f_index=-1,p_index=-1,det_index=-1;
double sv0=-1,sv1=-1;
if(getDetectorsType() == EIGER){
maxX = thisMultiDetector->numberOfChannel[X];
@ -4637,6 +4639,7 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
delete [] retdet;
//concatenate filenames
if(!fullFName.length()){
//assign file prefix
fullFName.assign(fileIO::getFileName());
if (strrchr(fName,'.')!=NULL){
ext.assign(fName);
@ -4645,9 +4648,17 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
ext = ext.erase(0,dot);
else
ext = "";
//get variables
fileIOStatic::getVariablesFromFileName(fName,index, f_index, p_index, sv0, sv1, det_index);
//append scan and det variables
fullFName.append(fileIOStatic::getReceiverFileNameToConcatenate(fName));
}
}
fullFName.append(getReceiverFileNameToConcatenate(fName));
//append only if scan variables are different
if(!fileIOStatic::verifySameFrame(fName,index,f_index, p_index, sv0, sv1, det_index)){
fullFName.append(fileIOStatic::getReceiverFileNameToConcatenate(fName));
}
}
}else {
#ifdef VERBOSE
@ -4658,6 +4669,7 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
}
}
}
//append extension
fullFName.append(ext);
strcpy(fName,fullFName.c_str());
//if some of the receivers did not give data, dont count it

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/mythenDetectorServer
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
Revision: 93
Branch: gemma
Last Changed Author: Maliakal_Dhanya
Last Changed Rev: 288
Last Changed Date: 2014-12-08 10:16:31 +0100
URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
Revision: 95
Branch: master
Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 300
Last Changed Date: 2015-06-22 17:09:47 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURL "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer"
#define SVNURL "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer"
//#define SVNREPPATH ""
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
//#define SVNREV 0x288
#define SVNREPUUID "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
//#define SVNREV 0x300
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "Maliakal_Dhanya"
#define SVNREV 0x288
#define SVNDATE 0x20141208
#define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x300
#define SVNDATE 0x20150622
//

View File

@ -1,11 +1,11 @@
//#define SVNPATH ""
#define SVNURLLIB "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git"
#define SVNURLLIB "maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git"
//#define SVNREPPATH ""
#define SVNREPUUIDLIB "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
//#define SVNREV 0x882
#define SVNREPUUIDLIB "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
//#define SVNREV 0x945
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTHLIB "Maliakal_Dhanya"
#define SVNREVLIB 0x882
#define SVNDATELIB 0x20141208
#define SVNAUTHLIB "Dhanya_Maliakal"
#define SVNREVLIB 0x945
#define SVNDATELIB 0x20150622
//

View File

@ -44,6 +44,12 @@ int slsDetector::initSharedMemory(detectorType type, int id) {
nc=10;
nd=13; // dacs+adcs
break;
case PROPIX:
nch=22*22;
nm=1;
nc=1;
nd=13; // dacs+adcs
break;
case EIGER:
nch=256*256; // one EIGER half module
nm=1; //modules/detector
@ -553,6 +559,17 @@ int slsDetector::initializeDetectorSize(detectorType type) {
thisDetector->nModMax[Y]=1;
thisDetector->dynamicRange=16;
break;
case PROPIX:
thisDetector->nChan[X]=22;
thisDetector->nChan[Y]=22;
thisDetector->nChip[X]=1;
thisDetector->nChip[Y]=1;
thisDetector->nDacs=8;
thisDetector->nAdcs=5;
thisDetector->nModMax[X]=1;
thisDetector->nModMax[Y]=1;
thisDetector->dynamicRange=16;
break;
case MOENCH:
thisDetector->nChan[X]=160;
thisDetector->nChan[Y]=160;
@ -775,7 +792,7 @@ int slsDetector::initializeDetectorSize(detectorType type) {
fileName=parentDet->fileName;
fileIndex=parentDet->fileIndex;
framesPerFile=parentDet->framesPerFile;
if(thisDetector->myDetectorType==GOTTHARD)
if((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==PROPIX))
setFramesPerFile(MAX_FRAMES_PER_FILE);
if (thisDetector->myDetectorType==MOENCH)
setFramesPerFile(MOENCH_MAX_FRAMES_PER_FILE);
@ -881,6 +898,13 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
nd=8; // dacs+adcs
na=5;
break;
case PROPIX:
nch=22*22;
nm=1;
nc=1;
nd=8; // dacs+adcs
na=5;
break;
case EIGER:
nch=256*256; // one EIGER half module
nm=1; //modules/detector
@ -2133,7 +2157,7 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod){
std::cout<< "Dac set to "<< retval[0] << " dac units (" << retval[1] << "mV)" << std::endl;
#endif
if (ret==FAIL) {
std::cout<< "Set dac failed " << std::endl;
std::cout<< "Set dac " << index << " of module " << imod << " to " << val << " failed." << std::endl;
}
if(mV)
return retval[1];
@ -2951,6 +2975,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
case HIGHGAIN:
if ( (thisDetector->myDetectorType == MYTHEN) ||
(thisDetector->myDetectorType == GOTTHARD) ||
(thisDetector->myDetectorType == PROPIX) ||
(thisDetector->myDetectorType == MOENCH) ||
(thisDetector->myDetectorType == EIGER)) {
ssettings="/highgain";
@ -2959,6 +2984,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
break;
case DYNAMICGAIN:
if ((thisDetector->myDetectorType == GOTTHARD) ||
(thisDetector->myDetectorType == PROPIX) ||
(thisDetector->myDetectorType == MOENCH)) {
ssettings="/dynamicgain";
thisDetector->currentSettings=DYNAMICGAIN;
@ -2966,6 +2992,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
break;
case LOWGAIN:
if ((thisDetector->myDetectorType == GOTTHARD) ||
(thisDetector->myDetectorType == PROPIX) ||
(thisDetector->myDetectorType == MOENCH)) {
ssettings="/lowgain";
thisDetector->currentSettings=LOWGAIN;
@ -2973,6 +3000,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
break;
case MEDIUMGAIN:
if ((thisDetector->myDetectorType == GOTTHARD) ||
(thisDetector->myDetectorType == PROPIX) ||
(thisDetector->myDetectorType == MOENCH)) {
ssettings="/mediumgain";
thisDetector->currentSettings=MEDIUMGAIN;
@ -2980,6 +3008,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
break;
case VERYHIGHGAIN:
if ((thisDetector->myDetectorType == GOTTHARD) ||
(thisDetector->myDetectorType == PROPIX) ||
(thisDetector->myDetectorType == MOENCH)) {
ssettings="/veryhighgain";
thisDetector->currentSettings=VERYHIGHGAIN;
@ -3024,6 +3053,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
break;
case MOENCH:
case GOTTHARD:
case PROPIX:
case JUNGFRAUCTB:
//settings is saved in myMod.reg
myMod->reg=thisDetector->currentSettings;
@ -3054,6 +3084,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
switch(thisDetector->myDetectorType){
case MOENCH:
case GOTTHARD:
case PROPIX:
case JUNGFRAUCTB:
ostfn << thisDetector->settingsDir << ssettings << ssettings << ".settings";
break;
@ -3167,7 +3198,9 @@ int slsDetector::updateDetectorNoWait() {
n = controlSocket->ReceiveDataOnly( &t,sizeof(t));
thisDetector->currentSettings=t;
if((thisDetector->myDetectorType!= GOTTHARD)&&(thisDetector->myDetectorType!= MOENCH)){
if((thisDetector->myDetectorType!= GOTTHARD)&&
(thisDetector->myDetectorType!= PROPIX)&&
(thisDetector->myDetectorType!= MOENCH)){
//thr=getThresholdEnergy();
n = controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
thisDetector->currentThresholdEV=thr;
@ -3639,7 +3672,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
//std::cout<< "offline " << std::endl;
if (t>=0)
thisDetector->timerValue[index]=t;
if((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==MOENCH))
if((thisDetector->myDetectorType==GOTTHARD)||
(thisDetector->myDetectorType==PROPIX)||
(thisDetector->myDetectorType==MOENCH))
thisDetector->timerValue[PROBES_NUMBER]=0;
}
} else {
@ -4199,10 +4234,10 @@ int slsDetector::setDynamicRange(int n){
thisDetector->dynamicRange=retval;
//#ifdef VERBOSE
#ifdef VERBOSE
std::cout<< "Dynamic range set to "<< thisDetector->dynamicRange << std::endl;
std::cout<< "Data bytes "<< thisDetector->dataBytes << std::endl;
//#endif
#endif
}
@ -4210,11 +4245,11 @@ int slsDetector::setDynamicRange(int n){
if(ret != FAIL){
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
#ifdef VERBOSE
std::cout << "Sending/Getting dynamic range to/from receiver " << retval << std::endl;
std::cout << "Sending/Getting dynamic range to/from receiver " << n << std::endl;
#endif
if (connectData() == OK)
ret=thisReceiver->sendInt(fnum2,retval1,retval);
if((retval1 != retval)|| (ret==FAIL)){
ret=thisReceiver->sendInt(fnum2,retval1,n);
if ((ret==FAIL) || (retval1 != retval)){
ret = FAIL;
cout << "ERROR:Dynamic range in receiver set incorrectly to " << retval1 << " instead of " << retval << endl;
setErrorMask((getErrorMask())|(RECEIVER_DYNAMIC_RANGE));
@ -5721,7 +5756,9 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
// "trimen",
// "receiverTCPPort",
if ((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==MOENCH)) {
if ((thisDetector->myDetectorType==GOTTHARD)||
(thisDetector->myDetectorType==PROPIX)||
(thisDetector->myDetectorType==MOENCH)) {
names[0]= "hostname";
names[1]= "port";
names[2]= "stopport";

View File

@ -534,6 +534,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
case MOENCH: return string("Moench"); \
case JUNGFRAU: return string("Jungfrau"); \
case JUNGFRAUCTB: return string("JungfrauCTB"); \
case PROPIX: return string("Propix"); \
default: return string("Unknown"); \
}};
@ -550,6 +551,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
if (type=="Moench") return MOENCH; \
if (type=="Jungfrau") return JUNGFRAU; \
if (type=="JungfrauCTB") return JUNGFRAUCTB; \
if (type=="Propix") return PROPIX; \
return GENERIC;};

View File

@ -884,6 +884,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++;
descrToFuncMap[i].m_pFuncName="resetframescaught";
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++;
descrToFuncMap[i].m_pFuncName="frameindex";
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++;
@ -4058,7 +4062,8 @@ string slsDetectorCommand::helpSpeed(int narg, char *args[], int action) {
string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
int retval;
char answer[1000]="";
if (action==HELP_ACTION)
return helpAdvanced(narg, args, action);
@ -4090,24 +4095,27 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
myDet->setOnline(ONLINE_FLAG);
switch (myDet->setReadOutFlags(flag)) {
case NORMAL_READOUT:
retval = myDet->setReadOutFlags(flag);
if(retval == NORMAL_READOUT)
return string("none");
case STORE_IN_RAM:
return string("storeinram");
case TOT_MODE:
return string("tot");
case CONTINOUS_RO:
return string("continous");
case PARALLEL:
return string("parallel");
case NONPARALLEL:
return string("nonparallel");
case SAFE:
return string("safe");
default:
if(retval & STORE_IN_RAM)
strcat(answer,"storeinram ");
if(retval & TOT_MODE)
strcat(answer,"tot ");
if(retval & CONTINOUS_RO)
strcat(answer,"continous ");
if(retval & PARALLEL)
strcat(answer,"parallel ");
if(retval & NONPARALLEL)
strcat(answer,"nonparallel ");
if(retval & SAFE)
strcat(answer,"safe ");
if(strlen(answer))
return string(answer);
return string("unknown");
}
} else if (cmd=="extsig") {
externalSignalFlag flag=GET_EXTERNAL_SIGNAL_FLAG;
@ -4282,6 +4290,18 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
}
}
else if(cmd=="resetframescaught"){
if (action==GET_ACTION)
return string("cannot get");
else{
if(myDet->resetFramesCaught() == FAIL)
strcpy(answer,"failed");
else
strcpy(answer,"successful");
return string(answer);
}
}
else if(cmd=="frameindex"){
if (action==PUT_ACTION)
return string("cannot put");
@ -4336,6 +4356,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
ostringstream os;
if (action==PUT_ACTION || action==HELP_ACTION) {
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start or stop" << std::endl;
os << "resetframescaught [any value] \t resets frames caught by receiver" << std::endl;
os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl;
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
}

View File

@ -53,6 +53,14 @@ void slsDetectorUtils::acquire(int delflag){
int multiframe = nc*nf;
//
if(setDynamicRange() == 32) subframe = 1;
else subframe = 0;
pthread_mutex_lock(&mg);
acquiringDone = 0;
pthread_mutex_unlock(&mg);
// setTotalProgress();
//moved these 2 here for measurement change
progressIndex=0;
@ -462,8 +470,11 @@ void slsDetectorUtils::acquire(int delflag){
pthread_mutex_unlock(&mg);
if (measurement_finished)
if (measurement_finished){
pthread_mutex_lock(&mg);
measurement_finished(im,*fileIndex,measFinished_p);
pthread_mutex_unlock(&mg);
}
if (*stoppedFlag) {
break;
@ -806,6 +817,7 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
names[nvar++]="ratecorr";
break;
case GOTTHARD:
case PROPIX:
names[nvar++]="flags";
names[nvar++]="delay";
names[nvar++]="gates";
@ -889,6 +901,7 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
case EIGER:
case MYTHEN:
case GOTTHARD:
case PROPIX:
names[nvar++]="flatfield";
names[nvar++]="badchannels";
break;

View File

@ -111,6 +111,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
names[id++]="Vdac7";
break;
case GOTTHARD:
case PROPIX:
names[id++]="Vref";
names[id++]="VcascN";
names[id++]="VcascP";
@ -265,6 +266,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
case MOENCH:
case GOTTHARD:
case PROPIX:
//---------------dacs---------------
infile.open(myfname.c_str(), ios_base::in);
if (infile.is_open()) {
@ -352,6 +354,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
names[id++]="Vdac7";
break;
case GOTTHARD:
case PROPIX:
names[id++]="Vref";
names[id++]="VcascN";
names[id++]="VcascP";

View File

@ -59,10 +59,10 @@ class fileIOStatic {
static string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \
ostringstream osfn; \
osfn << filepath << "/" << filename; \
if(detindex>=0) osfn << "_d"<< detindex; \
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
if(detindex>=0) osfn << "_d"<< detindex; \
if(frameindex>=0) osfn << "_f" << frameindex; \
osfn << "_" << findex; \
return osfn.str(); \
@ -89,10 +89,10 @@ class fileIOStatic {
static string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \
ostringstream osfn; \
osfn << filename; \
if(detindex!=-1) osfn << "_d"<< detindex; \
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
if(detindex!=-1) osfn << "_d"<< detindex; \
return osfn.str(); \
};
@ -161,26 +161,32 @@ class fileIOStatic {
index=i; \
s=fname.substr(0,uscore); \
} \
/*else cout << "******************************** cannot parse file index" << endl; \*/
/* else cout << "Warning: ******************************** cannot parse file index from " << s << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) \
s=fname.substr(0,uscore); \
/*else cout << "Warning: ******************************** cannot parse frame index from " << s << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
s=fname.substr(0,uscore); \
/* else cout << "Warning: ******************************** cannot parse detector index from " << s << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
p_index=i; \
s=fname.substr(0,uscore); \
} \
else cout << "******************************** cannot parse position index" << endl; \
/* else cout << "Warning: ******************************** cannot parse position index from " << s << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
sv1=f; \
s=fname.substr(0,uscore); \
} \
else cout << "******************************** cannot parse scan varable 1" << endl; \
/* else cout << "Warning: ******************************** cannot parse scan varable 1 from " << s << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
sv0=f; \
} \
else cout << "******************************** cannot parse scan varable 0" << endl; \
/* else cout << "Warning: ******************************** cannot parse scan varable 0 from " << s << endl; \*/
return index; \
};
@ -210,40 +216,68 @@ class fileIOStatic {
index=i; \
s=fname.substr(0,uscore); \
} \
else cout << "******************************** cannot parse file index" << endl; \
/*else cout << "Warning: ******************************** cannot parse file index" << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) { \
f_index=i; \
s=fname.substr(0,uscore); \
} \
else cout << "******************************** cannot parse frame index" << endl; \
/*else cout << "Warning: ******************************** cannot parse frame index" << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) { \
detindex=i; \
s=fname.substr(0,uscore); \
} \
/* else cout << "Warning: ******************************** cannot parse detector id" << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
p_index=i; \
s=fname.substr(0,uscore); \
} \
else cout << "******************************** cannot parse position index" << endl; \
/*else cout << "Warning: ******************************** cannot parse position index" << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
sv1=f; \
s=fname.substr(0,uscore); \
} \
else cout << "******************************** cannot parse scan varable 1" << endl; \
/*else cout << "Warning: ******************************** cannot parse scan varable 1" << endl; \*/
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
sv0=f; \
s=fname.substr(0,uscore); \
} \
else cout << "******************************** cannot parse scan varable 0" << endl; \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) { \
detindex=i; \
} \
else cout << "******************************** cannot parse detector id" << endl; \
/*else cout << "Warning: ******************************** cannot parse scan varable 0" << endl; \*/
return index; \
};
/** static function that verifies if the new file name containing new parameters matches all the given parameters
\param fname new complete file name prefix
\param index reference to index
\param f_index reference to frame index
\param p_index reference to position index
\param sv0 reference to scan variable 0
\param sv1 reference to scan variable 1
\param detindex reference to detector id
\returns file name
*/
static int verifySameFrame(string fname, int index, int f_index, int p_index, double sv0, double sv1, int detindex) { \
int new_index=-1;
int new_f_index=-1;
int new_p_index=-1;
int new_det_index=-1;
double new_sv0=-1;
double new_sv1=-1;
getVariablesFromFileName(fname,new_index, new_f_index, new_p_index, new_sv0, new_sv1, new_det_index);
if(index!=new_index) return 0;
if(f_index!=new_f_index) return 0;
if(p_index!=new_p_index) return 0;
if(sv0!=new_sv0) return 0;
if(sv1!=new_sv1) return 0;
return 1;
}
/** static function that returns the name variable from the receiver complete file name prefix
\param fname complete file name prefix
@ -255,6 +289,9 @@ class fileIOStatic {
string s; \
s=fname; \
size_t uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) \
s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
@ -263,9 +300,8 @@ class fileIOStatic {
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) \
s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
s=fname.substr(0,uscore); \
return s; \
};
@ -278,20 +314,32 @@ class fileIOStatic {
\returns file name without file name prefix, detector index or extension
*/
static string getReceiverFileNameToConcatenate(string fname) { \
//int i;
int i;double f; \
string s=fname; \
if(fname.empty()) return fname; \
size_t slash=s.rfind("/"); \
if (slash!= string::npos) \
s=s.substr(slash,s.size()-slash); \
size_t dot=s.find("."); \
size_t uscore=s.find("_"); \
if ((dot!= string::npos)&&(uscore!= string::npos)) \
s=s.substr(uscore,dot-uscore); \
// uscore=s.find("_",1);
//if ((uscore!= string::npos) && (sscanf( s.substr(1,uscore-1).c_str(),"d%d",&i)))
//s=s.substr(uscore,s.size()-uscore);
return s; \
size_t dot=s.find(".");
size_t uscore=s.rfind("_"); \
if (uscore==string::npos) return "??"; \
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) \
s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) \
s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) \
s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) \
s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) \
s=fname.substr(0,uscore); \
return(fname.substr(s.size(),dot-s.size()));\
\
};

View File

@ -495,12 +495,15 @@ void* postProcessing::processData(int delflag) {
*/
int progress = -1;
int progress = 0;
char currentfName[MAX_STR_LENGTH]="";
int caught = -1;
int currentAcquisitionIndex = -1;
int currentFrameIndex = -1;
bool newData = false;
int nthframe = setReadReceiverFrequency(0);
#ifdef VERBOSE
std::cout << "receiver read freq:" << nthframe << std::endl;
#endif
@ -527,14 +530,23 @@ void* postProcessing::processData(int delflag) {
//get progress
pthread_mutex_lock(&mg);
if(setReceiverOnline() == ONLINE_FLAG)
currentAcquisitionIndex = getReceiverCurrentFrameIndex();
caught = getFramesCaughtByReceiver();//getReceiverCurrentFrameIndex();
pthread_mutex_unlock(&mg);
//updating progress
if(currentAcquisitionIndex != -1)
if(currentAcquisitionIndex != -1){
setCurrentProgress(caught);
/*
if(subframe){
pthread_mutex_lock(&mg);
setCurrentProgress(getFramesCaughtByReceiver());
pthread_mutex_unlock(&mg);
}else
setCurrentProgress(currentAcquisitionIndex+1);
*/
}
#ifdef VERY_VERY_DEBUG
cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << endl;
cout << "caught:" << caught << endl;
#endif
@ -555,7 +567,7 @@ void* postProcessing::processData(int delflag) {
#endif
pthread_mutex_unlock(&mg);
//go through once more to get last nth frame data
if (acquiringDone >= 2){
if (acquiringDone >= 5){cout<<"acquiringdone:"<<acquiringDone<<endl;
if((!nthframe) ||(!newData)){
#ifdef VERY_VERY_DEBUG
cout << "gonna post for it to end" << endl;
@ -577,11 +589,23 @@ void* postProcessing::processData(int delflag) {
if (dataReady){
//for random reads, ask only if it has new data
if(!newData){
if(currentAcquisitionIndex > progress)
if(caught > progress){
newData = true;
/*
// keeping acquiringdone at 1 to get more time to get data
if(acquiringDone > 0){cout<<"going to maintain acquiidne"<<endl;
pthread_mutex_lock(&mg);
acquiringDone = 1;
//#ifdef VERY_VERY_DEBUG
cout << "Keeping acquiringDone at 1 " << endl;
//#endif
pthread_mutex_unlock(&mg);
}*/
}
#ifdef VERY_VERY_DEBUG
cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << " progress:" << progress << endl;
#endif
@ -591,6 +615,19 @@ void* postProcessing::processData(int delflag) {
#ifdef VERY_VERY_DEBUG
cout << "new data" << endl;
#endif
//no gui
if (!dataReady){
progress = caught;
#ifdef VERY_VERY_DEBUG
cout << "progress:" << progress << endl;
#endif
newData = false;
#ifdef VERY_VERY_DEBUG
cout << "newData set to false" << endl;
#endif
}
//gui
else{
if(setReceiverOnline()==ONLINE_FLAG){
//get data
strcpy(currentfName,"");
@ -609,14 +646,16 @@ void* postProcessing::processData(int delflag) {
cout<<"****Detector Data returned is NULL***"<<endl;
}
//not garbage frame
// garbage frame
if(currentAcquisitionIndex < 0){
#ifdef VERY_VERY_DEBUG
cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
#endif
if(receiverData)
delete [] receiverData;
}else if (currentAcquisitionIndex > progress){
}
//not garbage frame
else{// if (currentAcquisitionIndex > progress){
#ifdef VERY_VERY_DEBUG
cout << "GOT data" << endl;
#endif
@ -628,7 +667,7 @@ void* postProcessing::processData(int delflag) {
dataReady(thisData, currentFrameIndex, pCallbackArg);
delete thisData;
fdata = NULL;
progress = currentAcquisitionIndex;
progress = caught;
#ifdef VERY_VERY_DEBUG
cout << "progress:" << progress << endl;
#endif
@ -641,6 +680,7 @@ void* postProcessing::processData(int delflag) {
}
}
}
}
}

View File

@ -302,6 +302,8 @@ s
/** set when detector finishes acquiring */
int acquiringDone;
/**sub frame*/
int subframe;
/**

View File

@ -85,7 +85,7 @@ int decode_function(int file_des) {
fnum=255;
ret=(*flist[fnum])(file_des);
if (ret==FAIL)
printf( "Error executing the function = %d \n",fnum);
cprintf( RED, "Error executing the function = %d \n",fnum);
return ret;
}
@ -2197,9 +2197,9 @@ int stop_acquisition(int file_des) {
sprintf(mess,"can't stop acquisition\n");
#ifdef VERBOSE
//#ifdef VERBOSE
printf("Stopping acquisition\n");
#endif
//#endif
#ifdef SLS_DETECTOR_FUNCTION_LIST
if (differentClients==1 && lockStatus==1) {
ret=FAIL;
@ -2603,7 +2603,7 @@ int set_dynamic_range(int file_des) {
ret=FORCE_UPDATE;
#ifdef SLS_DETECTOR_FUNCTION_LIST
dataBytes=calculateDataBytes();
if (dr>=0) dataBytes=calculateDataBytes();
#endif
//ret could be swapped during sendData
@ -2637,9 +2637,19 @@ int set_readout_flags(int file_des) {
ret=FAIL;
}
#if !defined(MYTHEND) && !defined(EIGERD)
sprintf(mess,"Read out flags not implemented for this detector\n");
cprintf(RED, "%s",mess);
ret=FAIL;
#else
#ifdef VERBOSE
printf("setting readout flags to %d\n",arg);
#endif
#ifdef SLS_DETECTOR_FUNCTION_LIST
if (differentClients==1 && lockStatus==1 && arg!=GET_READOUT_FLAGS) {
ret=FAIL;
@ -2648,30 +2658,37 @@ int set_readout_flags(int file_des) {
switch(arg) {
case GET_READOUT_FLAGS:
#ifdef MYTHEND
case STORE_IN_RAM:
case TOT_MODE:
case CONTINOUS_RO:
case NORMAL_READOUT:
retval=setReadOutFlags(arg);
break;
#elif EIGERD
#endif
#if defined(MYTHEND) || defined(EIGERD)
case STORE_IN_RAM:
case CONTINOUS_RO:
#endif
#ifdef EIGERD
case PARALLEL:
case NONPARALLEL:
case SAFE:
#endif
retval=setReadOutFlags(arg);
break;
#endif
default:
sprintf(mess,"Unknown readout flag %d for this detector\n", arg);
cprintf(RED, "%s",mess);
ret=FAIL;
break;
}
}
#endif
#endif
if (ret==OK) {
if (arg!=GET_READOUT_FLAGS && arg!=retval) {
if (retval == -1) {
ret=FAIL;
sprintf(mess,"Could not change readout flag: should be %d but is %d\n", arg, retval);
cprintf(RED, "%s",mess);
}else if (differentClients)
ret=FORCE_UPDATE;
}