mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
Merge branch 'master' of gitorious.psi.ch:sls_det_software/sls_detector_software
This commit is contained in:
commit
84ad2912c6
@ -420,9 +420,9 @@ enum readOutFlags {
|
|||||||
BACKGROUND_CORRECTIONS=0x1000, /**<background corrections */
|
BACKGROUND_CORRECTIONS=0x1000, /**<background corrections */
|
||||||
TOT_MODE=0x2000,/**<pump-probe mode */
|
TOT_MODE=0x2000,/**<pump-probe mode */
|
||||||
CONTINOUS_RO=0x4000,/**<pump-probe mode */
|
CONTINOUS_RO=0x4000,/**<pump-probe mode */
|
||||||
PARALLEL=0x10,/** <eiger parallel mode */
|
PARALLEL=0x10000,/** <eiger parallel mode */
|
||||||
NONPARALLEL=0x20,/** <eiger serial mode */
|
NONPARALLEL=0x20000,/** <eiger serial mode */
|
||||||
SAFE=0x40/** <eiger safe mode */
|
SAFE=0x40000/** <eiger safe mode */
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
trimming modes
|
trimming modes
|
||||||
|
@ -15,8 +15,12 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "xfs_types.h"
|
#include "xfs_types.h"
|
||||||
#include "xparameters.h"
|
#include "xparameters.h"
|
||||||
|
#include "FebRegisterDefs.h"
|
||||||
|
|
||||||
#include "Beb.h"
|
#include "Beb.h"
|
||||||
|
|
||||||
@ -26,7 +30,6 @@
|
|||||||
int bebInfoSize = 0;
|
int bebInfoSize = 0;
|
||||||
|
|
||||||
struct LocalLinkInterface ll_beb_local,* ll_beb;
|
struct LocalLinkInterface ll_beb_local,* ll_beb;
|
||||||
struct LocalLinkInterface ll_beb_new_memory_local,* ll_beb_new_memory;
|
|
||||||
|
|
||||||
struct udp_header_type udp_header;
|
struct udp_header_type udp_header;
|
||||||
|
|
||||||
@ -146,27 +149,59 @@ void Beb_GetModuleCopnfiguration(int* master, int* top){
|
|||||||
*top = 0;
|
*top = 0;
|
||||||
*master = 0;
|
*master = 0;
|
||||||
//mapping new memory to read master top module configuration
|
//mapping new memory to read master top module configuration
|
||||||
ll_beb_new_memory = &ll_beb_new_memory_local;
|
u_int32_t baseaddr;
|
||||||
Local_LocalLinkInterface(ll_beb_new_memory);
|
int ret;
|
||||||
int ret = Local_GetModuleConfiguration(ll_beb_new_memory,XPAR_PLB_GPIO_SYS_BASEADDR, MODULE_CONFIGURATION);
|
//open file pointer
|
||||||
if(!ret)
|
int fd = Beb_open(XPAR_PLB_GPIO_SYS_BASEADDR,&baseaddr);
|
||||||
printf("Module Configuration FAIL\n");
|
if(fd < 0){
|
||||||
else{
|
cprintf(RED,"Module Configuration FAIL\n");
|
||||||
|
}else{
|
||||||
|
//read data
|
||||||
|
ret = Beb_Read32(baseaddr, MODULE_CONFIGURATION_MASK);
|
||||||
printf("Module Configuration OK\n");
|
printf("Module Configuration OK\n");
|
||||||
printf("Beb: value =0x%x\n",ret);
|
printf("Beb: value =0x%x\n",ret);
|
||||||
if(ret&0xf){
|
if(ret&TOP_BIT_MASK)
|
||||||
*top = 1;
|
*top = 1;
|
||||||
// printf("Beb.c: TOP\n\n\n\n");
|
if(ret&MASTER_BIT_MASK)
|
||||||
}//else printf("Beb.c: BOTTOM\n\n\n\n");
|
|
||||||
|
|
||||||
if(ret&0x200){
|
|
||||||
*master = 1;
|
*master = 1;
|
||||||
// printf("Beb.c: MASTER\n\n\n\n");
|
//close file pointer
|
||||||
}//else printf("Beb.c: SLAVE\n\n\n\n");
|
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(){
|
void Beb_ClearBebInfos(){
|
||||||
//unsigned int i;
|
//unsigned int i;
|
||||||
@ -542,32 +577,29 @@ int Beb_SetUpTransferParameters(short the_bit_mode){
|
|||||||
|
|
||||||
int Beb_StopAcquisition()
|
int Beb_StopAcquisition()
|
||||||
{
|
{
|
||||||
|
u_int32_t baseaddr;
|
||||||
volatile u_int32_t* ptrl;
|
volatile u_int32_t valuel,valuer;
|
||||||
volatile u_int32_t* ptrr;
|
//open file pointer
|
||||||
// Mapping
|
int fd = Beb_open(XPAR_CMD_GENERATOR,&baseaddr);
|
||||||
int fd;
|
if(fd < 0){
|
||||||
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
cprintf(RED,"Beb Stop Acquisition FAIL\n");
|
||||||
if (fd == -1)
|
|
||||||
{
|
|
||||||
printf("\nCan't find /dev/mem!\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}else{
|
||||||
u_int32_t CSP0BASE = (u_int32_t)mmap(0, 0x1000, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, 0xC5000000 );
|
//find value
|
||||||
if (CSP0BASE == (u_int32_t)MAP_FAILED)
|
valuel = Beb_Read32(baseaddr, (LEFT_OFFSET+STOP_ACQ_OFFSET));
|
||||||
{
|
valuer = Beb_Read32(baseaddr, (RIGHT_OFFSET+STOP_ACQ_OFFSET));
|
||||||
printf("\nCan't map memmory area!!\n");
|
//high
|
||||||
return 0;
|
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);
|
printf("Beb Stop Acquisition OK\n");
|
||||||
ptrr = (u_int32_t*)(CSP0BASE+0x100);
|
//close file pointer
|
||||||
|
Beb_close(fd);
|
||||||
*(ptrl+7) = (1 << 30);
|
}
|
||||||
*(ptrr+7) = (1 << 30);
|
return 1;
|
||||||
*(ptrl+7) = 0;
|
|
||||||
*(ptrr+7) = 0;
|
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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){
|
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;
|
unsigned int npackets = ten_gig ? Beb_bit_mode*4 : Beb_bit_mode*16;
|
||||||
int in_two_requests = (!ten_gig&&Beb_bit_mode==32);
|
int in_two_requests = (!ten_gig&&Beb_bit_mode==32);
|
||||||
|
|
||||||
volatile u_int32_t* ptrl;
|
// volatile u_int32_t* ptrl;
|
||||||
volatile u_int32_t* ptrr;
|
// volatile u_int32_t* ptrr;
|
||||||
u_int32_t send_header_command;
|
u_int32_t send_header_command;
|
||||||
u_int32_t send_frame_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+10 1st 32bits of 2nd command
|
||||||
// base+14 2nd 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 : 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)
|
// 32 Bit mode : 3 commands for 1 frame neccessary (header + 1st halfframe + 2nd halfframe) (10 frames = 30 commands)
|
||||||
// if > 0 core starts operation
|
// 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)
|
// 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)
|
// 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
|
u_int32_t right_port_value = 0x2000;
|
||||||
int fd;
|
u_int32_t baseaddr;
|
||||||
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
volatile u_int32_t value;
|
||||||
if (fd == -1)
|
//open file pointer
|
||||||
{
|
int fd = Beb_open(XPAR_CMD_GENERATOR,&baseaddr);
|
||||||
printf("\nCan't find /dev/mem!\n");
|
if(fd < 0){
|
||||||
|
cprintf(RED,"Beb Request N Images FAIL\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}else{
|
||||||
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;
|
|
||||||
|
|
||||||
#ifdef MARTIN
|
#ifdef MARTIN
|
||||||
|
int i;
|
||||||
for (i=0; i < 10; i++)
|
for (i=0; i < 10; i++)
|
||||||
printf("%X\n",*(ptrl+i));
|
printf("%X\n",Beb_Read32(baseaddr, (LEFT_OFFSET + i*4)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Generating commands
|
// Generating commands
|
||||||
send_header_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | header_size << 14 | 0;
|
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);
|
send_frame_command = 0x62000000 | (!test_just_send_out_packets_no_wait) << 27 | (ten_gig==1) << 24 | packet_size << 14 | (npackets-1);
|
||||||
|
|
||||||
#ifdef MARTIN
|
#ifdef MARTIN
|
||||||
for (i=0; i < 10; i++)
|
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);
|
printf("%d\n",in_two_requests);
|
||||||
#endif
|
#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)
|
//"0x20 << 8" is dst_number (0x00 for left, 0x20 for right)
|
||||||
//Left
|
//Left
|
||||||
*(ptrl+2) = 0;
|
Beb_Write32(baseaddr, (LEFT_OFFSET + FIRST_CMD_PART1_OFFSET),0);
|
||||||
*(ptrl+3) = send_header_command;
|
Beb_Write32(baseaddr, (LEFT_OFFSET + FIRST_CMD_PART2_OFFSET),send_header_command);
|
||||||
*(ptrl+4) = 0;
|
Beb_Write32(baseaddr, (LEFT_OFFSET + SECOND_CMD_PART1_OFFSET),0);
|
||||||
*(ptrl+5) = send_frame_command;
|
Beb_Write32(baseaddr, (LEFT_OFFSET + SECOND_CMD_PART2_OFFSET),send_frame_command);
|
||||||
*(ptrl+7) = in_two_requests << 31;
|
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
|
// Right
|
||||||
*(ptrr+2) = 0;
|
Beb_Write32(baseaddr, (RIGHT_OFFSET + FIRST_CMD_PART1_OFFSET),0);
|
||||||
*(ptrr+3) = send_header_command | 0x2000;
|
Beb_Write32(baseaddr, (RIGHT_OFFSET + FIRST_CMD_PART2_OFFSET),send_header_command | right_port_value);
|
||||||
*(ptrr+4) = 0;
|
Beb_Write32(baseaddr, (RIGHT_OFFSET + SECOND_CMD_PART1_OFFSET),0);
|
||||||
*(ptrr+5) = send_frame_command | 0x2000;
|
Beb_Write32(baseaddr, (RIGHT_OFFSET + SECOND_CMD_PART2_OFFSET),send_frame_command | right_port_value);
|
||||||
*(ptrr+7) = in_two_requests | (in_two_requests << 31);
|
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
|
// Set number of frames
|
||||||
*(ptrl+6) = nimages*(2+in_two_requests);
|
Beb_Write32(baseaddr, (LEFT_OFFSET + COMMAND_COUNTER_OFFSET), nimages*(2+in_two_requests));
|
||||||
*(ptrr+6) = nimages*(2+in_two_requests);
|
Beb_Write32(baseaddr, (RIGHT_OFFSET + COMMAND_COUNTER_OFFSET), nimages*(2+in_two_requests));
|
||||||
|
|
||||||
#ifdef MARTIN
|
#ifdef MARTIN
|
||||||
for (i=0; i < 10; i++)
|
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);
|
printf("%d\n",in_two_requests);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
close(fd);
|
Beb_close(fd);
|
||||||
|
|
||||||
#ifdef MARTIN
|
#ifdef MARTIN
|
||||||
cprintf(RED, "----Beb_RequestNImages----\n");
|
printf("----Beb_RequestNImages----\n");
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -758,3 +782,46 @@ int Beb_GetBebFPGATemp()
|
|||||||
return temperature;
|
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);
|
||||||
|
}
|
||||||
|
@ -48,8 +48,7 @@ struct BebInfo{
|
|||||||
|
|
||||||
|
|
||||||
void Beb_GetModuleCopnfiguration(int* master, int* top);
|
void Beb_GetModuleCopnfiguration(int* master, int* top);
|
||||||
|
u_int32_t Beb_GetFirmwareRevision();
|
||||||
|
|
||||||
|
|
||||||
int Beb_WriteTo(unsigned int index);
|
int Beb_WriteTo(unsigned int index);
|
||||||
|
|
||||||
@ -83,6 +82,10 @@ struct BebInfo{
|
|||||||
|
|
||||||
int Beb_GetBebFPGATemp();
|
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
|
#endif
|
||||||
|
|
||||||
|
@ -109,3 +109,8 @@
|
|||||||
#define CHIP_DATA_OUT_DELAY_REG3 3
|
#define CHIP_DATA_OUT_DELAY_REG3 3
|
||||||
#define CHIP_DATA_OUT_DELAY_REG4 4
|
#define CHIP_DATA_OUT_DELAY_REG4 4
|
||||||
#define CHIP_DATA_OUT_DELAY_SET 0x20000000
|
#define CHIP_DATA_OUT_DELAY_SET 0x20000000
|
||||||
|
|
||||||
|
|
||||||
|
//module configuration
|
||||||
|
#define TOP_BIT_MASK 0x00f
|
||||||
|
#define MASTER_BIT_MASK 0x200
|
||||||
|
@ -1028,8 +1028,8 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
|
|||||||
} //end row loop
|
} //end row loop
|
||||||
|
|
||||||
if(Module_TopAddressIsValid(&modules[1])){
|
if(Module_TopAddressIsValid(&modules[1])){
|
||||||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetTopLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
|
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_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)||
|
//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_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
|
||||||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
|
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
|
||||||
@ -1037,8 +1037,8 @@ int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int *trimbits){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(!Feb_Interface_WriteMemoryInLoops(Module_GetBottomLeftAddress(&modules[Feb_Control_current_index]),0,0,1024,trimbits_to_load_r)||
|
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_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)||
|
//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_Interface_WriteMemory(Module_GetTopRightAddress(&modules[0]),0,0,1023,trimbits_to_load_l)||
|
||||||
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
|
!Feb_Control_StartDAQOnlyNWaitForFinish(5000)){
|
||||||
|
@ -109,3 +109,30 @@
|
|||||||
#define CHIP_DATA_OUT_DELAY_REG3 3
|
#define CHIP_DATA_OUT_DELAY_REG3 3
|
||||||
#define CHIP_DATA_OUT_DELAY_REG4 4
|
#define CHIP_DATA_OUT_DELAY_REG4 4
|
||||||
#define CHIP_DATA_OUT_DELAY_SET 0x20000000
|
#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
|
||||||
|
|
||||||
|
@ -32,29 +32,6 @@ void Local_LocalLinkInterface(struct LocalLinkInterface* ll){
|
|||||||
printf("Initializing new memory\n");
|
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){
|
int Local_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr){
|
||||||
|
@ -40,7 +40,6 @@ struct LocalLinkInterface{
|
|||||||
int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer);
|
int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer);
|
||||||
|
|
||||||
void Local_LocalLinkInterface(struct LocalLinkInterface* ll);
|
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);
|
int FiFoReset(unsigned int numb);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
CC = powerpc-4xx-softfloat-gcc
|
CC = powerpc-4xx-softfloat-gcc
|
||||||
CCX = powerpc-4xx-softfloat-g++
|
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++
|
LDLIBS += -lm -lstdc++
|
||||||
|
|
||||||
PROGS = eigerDetectorServer
|
PROGS = eigerDetectorServer
|
||||||
|
Binary file not shown.
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||||
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer
|
URL: origin maliakal_d@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
|
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
|
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
|
||||||
Revision: 107
|
Revision: 141
|
||||||
Branch: gemma
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 288
|
Last Changed Rev: 300
|
||||||
Last Changed Date: 2014-12-08 10:16:31 +0100
|
Last Changed Date: 2015-06-22 17:09:47 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#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 SVNREPPATH ""
|
||||||
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
|
#define SVNREPUUID "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
|
||||||
//#define SVNREV 0x288
|
//#define SVNREV 0x300
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Maliakal_Dhanya"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x288
|
#define SVNREV 0x300
|
||||||
#define SVNDATE 0x20141208
|
#define SVNDATE 0x20150622
|
||||||
//
|
//
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
#include "slsDetectorFunctionList.h"
|
#include "slsDetectorFunctionList.h"
|
||||||
#include "gitInfoEiger.h"
|
#include "gitInfoEiger.h"
|
||||||
/*#include "EigerHighLevelFunctions.c"
|
|
||||||
#include "EigerBackEndFunctions.c"*/
|
|
||||||
#include "FebControl.h"
|
#include "FebControl.h"
|
||||||
#include "Beb.h"
|
#include "Beb.h"
|
||||||
|
|
||||||
@ -19,6 +17,8 @@
|
|||||||
enum detectorSettings thisSettings;
|
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"};
|
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"};
|
//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;
|
sls_detector_module *detectorModules=NULL;
|
||||||
@ -33,6 +33,7 @@ int eiger_iodelay = 0;
|
|||||||
int eiger_photonenergy = 0;
|
int eiger_photonenergy = 0;
|
||||||
int eiger_dynamicrange = 0;
|
int eiger_dynamicrange = 0;
|
||||||
int eiger_readoutmode = 0;
|
int eiger_readoutmode = 0;
|
||||||
|
int eiger_storeinmem = 0;
|
||||||
int eiger_readoutspeed = 0;
|
int eiger_readoutspeed = 0;
|
||||||
int eiger_triggermode = 0;
|
int eiger_triggermode = 0;
|
||||||
int eiger_extgating = 0;
|
int eiger_extgating = 0;
|
||||||
@ -61,6 +62,9 @@ int top = 0;
|
|||||||
int master = 0;
|
int master = 0;
|
||||||
|
|
||||||
|
|
||||||
|
#define TEN_GIGA_BUFFER_SIZE 4112
|
||||||
|
#define ONE_GIGA_BUFFER_SIZE 1040
|
||||||
|
|
||||||
int initDetector(){
|
int initDetector(){
|
||||||
int imod,i,n;
|
int imod,i,n;
|
||||||
n = getNModBoard(1);
|
n = getNModBoard(1);
|
||||||
@ -130,9 +134,9 @@ int initDetector(){
|
|||||||
setTimer(FRAME_PERIOD,1E9);
|
setTimer(FRAME_PERIOD,1E9);
|
||||||
setDynamicRange(16);
|
setDynamicRange(16);
|
||||||
setThresholdEnergy(8000,0);
|
setThresholdEnergy(8000,0);
|
||||||
setReadOutFlags(PARALLEL);
|
setReadOutFlags(NONPARALLEL);
|
||||||
setSpeed(0,1);//clk_devider,half speed
|
setSpeed(0,1);//clk_devider,half speed
|
||||||
setHighVolage(150,0);
|
setHighVolage(0,0);
|
||||||
setIODelay(675,0);
|
setIODelay(675,0);
|
||||||
setTiming(AUTO_TIMING);
|
setTiming(AUTO_TIMING);
|
||||||
//SetPhotonEnergyCalibrationParameters(-5.8381e-5,1.838515,5.09948e-7,-4.32390e-11,1.32527e-15);
|
//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? */
|
retval = getDetectorNumber();/** to be implemented with mac? */
|
||||||
break;
|
break;
|
||||||
case DETECTOR_FIRMWARE_VERSION:
|
case DETECTOR_FIRMWARE_VERSION:
|
||||||
return FIRMWAREREV;/** to be implemented */
|
return (int64_t)Beb_GetFirmwareRevision();
|
||||||
case DETECTOR_SOFTWARE_VERSION:
|
case DETECTOR_SOFTWARE_VERSION:
|
||||||
retval= SVNREV;
|
retval= SVNREV;
|
||||||
retval= (retval <<32) | SVNDATE;
|
retval= (retval <<32) | SVNDATE;
|
||||||
@ -233,23 +237,6 @@ int getDetectorNumber(){
|
|||||||
perror("gethostname");
|
perror("gethostname");
|
||||||
sscanf(hostname,"%x",&res);
|
sscanf(hostname,"%x",&res);
|
||||||
return 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 startStateMachine(){
|
||||||
int ret,prev_flag;
|
int ret = OK,prev_flag;
|
||||||
//get the DAQ toggle bit
|
//get the DAQ toggle bit
|
||||||
prev_flag = Feb_Control_AcquisitionStartedBit();
|
prev_flag = Feb_Control_AcquisitionStartedBit();
|
||||||
|
|
||||||
printf("Going to start acquisition\n");
|
printf("Going to start acquisition\n");
|
||||||
Feb_Control_StartAcquisition();
|
Feb_Control_StartAcquisition();
|
||||||
|
|
||||||
printf("requesting images\n");
|
if(!eiger_storeinmem){
|
||||||
|
printf("requesting images right after start\n");
|
||||||
ret = startReadOut();
|
ret = startReadOut();
|
||||||
|
}
|
||||||
|
|
||||||
//wait for acquisition start
|
//wait for acquisition start
|
||||||
if(ret == OK){
|
if(ret == OK){
|
||||||
@ -520,6 +509,7 @@ int startStateMachine(){
|
|||||||
}
|
}
|
||||||
cprintf(GREEN,"***Acquisition started\n");
|
cprintf(GREEN,"***Acquisition started\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*while(getRunStatus() == IDLE){printf("waiting for being not idle anymore\n");}*/
|
/*while(getRunStatus() == IDLE){printf("waiting for being not idle anymore\n");}*/
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -530,6 +520,7 @@ int stopStateMachine(){
|
|||||||
printf("Going to stop acquisition\n");
|
printf("Going to stop acquisition\n");
|
||||||
if(Feb_Control_StopAcquisition() & Beb_StopAcquisition())
|
if(Feb_Control_StopAcquisition() & Beb_StopAcquisition())
|
||||||
return OK;
|
return OK;
|
||||||
|
printf("failed to stop acquisition\n");
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -537,7 +528,7 @@ int stopStateMachine(){
|
|||||||
int startReadOut(){
|
int startReadOut(){
|
||||||
|
|
||||||
//RequestImages();
|
//RequestImages();
|
||||||
int ret_val = 0, i;
|
int ret_val = 0;
|
||||||
dst_requested[0] = 1;
|
dst_requested[0] = 1;
|
||||||
while(dst_requested[on_dst]){
|
while(dst_requested[on_dst]){
|
||||||
//waits on data
|
//waits on data
|
||||||
@ -584,6 +575,15 @@ char *readFrame(int *ret, char *mess){
|
|||||||
if(!Feb_Control_WaitForFinishedFlag(5000))
|
if(!Feb_Control_WaitForFinishedFlag(5000))
|
||||||
cprintf(RED,"Error: Waiting for finished flag\n");
|
cprintf(RED,"Error: Waiting for finished flag\n");
|
||||||
cprintf(GREEN,"Acquisition finished***\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(0);
|
||||||
usleep(1000000);
|
usleep(1000000);
|
||||||
printf("*****Done Waiting...\n");
|
printf("*****Done Waiting...\n");
|
||||||
@ -692,26 +692,53 @@ int setDynamicRange(int dr){
|
|||||||
|
|
||||||
|
|
||||||
enum readOutFlags setReadOutFlags(enum readOutFlags val){
|
enum readOutFlags setReadOutFlags(enum readOutFlags val){
|
||||||
int ret;
|
|
||||||
|
enum readOutFlags retval;
|
||||||
if(val!=GET_READOUT_FLAGS){
|
if(val!=GET_READOUT_FLAGS){
|
||||||
|
|
||||||
|
|
||||||
|
if(val&0xF0000){
|
||||||
switch(val){
|
switch(val){
|
||||||
case PARALLEL: val=0; break;
|
case PARALLEL: val=E_PARALLEL; printf(" Setting Read out Flag: Parallel\n"); break;
|
||||||
case NONPARALLEL: val=1; break;
|
case NONPARALLEL: val=E_NON_PARALLEL; printf(" Setting Read out Flag: Non Parallel\n"); break;
|
||||||
case SAFE: val=2; break;
|
case SAFE: val=E_SAFE; printf(" Setting Read out Flag: Safe\n"); break;
|
||||||
default: val=0; break;
|
|
||||||
|
default:
|
||||||
|
cprintf(RED,"Cannot set unknown readout flag. 0x%x\n", val);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
printf(" Setting Read out Flag: %d\n",val);
|
printf(" Setting Read out Flag: %d\n",val);
|
||||||
if(Feb_Control_SetReadoutMode(val))
|
if(Feb_Control_SetReadoutMode(val))
|
||||||
eiger_readoutmode = 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){
|
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int udpport2, int ival){
|
||||||
|
//only for 1Gbe
|
||||||
if(detectormacadd != getDetectorMAC()){
|
if((!send_to_ten_gig) && (detectormacadd != getDetectorMAC())){
|
||||||
printf("*************************************************\n");
|
printf("*************************************************\n");
|
||||||
printf("WARNING: actual detector mac address %llx does not match the one from client %llx\n",getDetectorMAC(),detectormacadd);
|
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");
|
printf("*************************************************\n");
|
||||||
}
|
}
|
||||||
detectormacadd = getDetectorMAC();
|
|
||||||
|
|
||||||
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
||||||
int src_port = 0xE185;
|
int src_port = 0xE185;
|
||||||
@ -807,7 +835,10 @@ int configureMAC(int ipad, long long int macad, long long int detectormacadd, in
|
|||||||
|
|
||||||
|
|
||||||
int calculateDataBytes(){
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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_BASEADDR 0xD1000000
|
||||||
#define XPAR_PLB_GPIO_SYS_HIGHADDR 0xD100FFFF
|
#define XPAR_PLB_GPIO_SYS_HIGHADDR 0xD100FFFF
|
||||||
|
|
||||||
/* Master Slave Top Bottom Definition */
|
/** Command Generator */
|
||||||
#define MODULE_CONFIGURATION 0x84
|
#define XPAR_CMD_GENERATOR 0xC5000000
|
||||||
|
|
||||||
|
|
||||||
|
/** Version Numbers */
|
||||||
|
#define XPAR_VERSION 0xc6000000
|
||||||
|
|
||||||
/* Definitions for peripheral PLB_GPIO_TEST */
|
/* Definitions for peripheral PLB_GPIO_TEST */
|
||||||
#define XPAR_PLB_GPIO_TEST_BASEADDR 0xD1010000
|
#define XPAR_PLB_GPIO_TEST_BASEADDR 0xD1010000
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||||
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
URL: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repository Root: origin git@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: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
|
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
|
||||||
Revision: 882
|
Revision: 945
|
||||||
Branch: gemma
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 882
|
Last Changed Rev: 945
|
||||||
Last Changed Date: 2014-12-08 10:16:31 +0100
|
Last Changed Date: 2015-06-22 17:09:47 +0200
|
||||||
|
48
slsDetectorSoftware/gotthardDetectorServer/Makefile.propix
Executable file
48
slsDetectorSoftware/gotthardDetectorServer/Makefile.propix
Executable 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
1
slsDetectorSoftware/gotthardDetectorServer/ansi.h
Symbolic link
1
slsDetectorSoftware/gotthardDetectorServer/ansi.h
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../../slsReceiverSoftware/include/ansi.h
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
||||||
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer
|
URL: origin maliakal_d@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
|
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
|
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
|
||||||
Revision: 177
|
Revision: 179
|
||||||
Branch: gemma
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 288
|
Last Changed Rev: 300
|
||||||
Last Changed Date: 2014-12-08 10:16:31 +0100
|
Last Changed Date: 2015-06-22 17:09:47 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#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 SVNREPPATH ""
|
||||||
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
|
#define SVNREPUUID "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
|
||||||
//#define SVNREV 0x288
|
//#define SVNREV 0x300
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Maliakal_Dhanya"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x288
|
#define SVNREV 0x300
|
||||||
#define SVNDATE 0x20141208
|
#define SVNDATE 0x20150622
|
||||||
//
|
//
|
||||||
|
Binary file not shown.
@ -20,6 +20,8 @@ int (*flist[256])(int);
|
|||||||
//defined in the detector specific file
|
//defined in the detector specific file
|
||||||
#ifdef MYTHEND
|
#ifdef MYTHEND
|
||||||
const enum detectorType myDetectorType=MYTHEN;
|
const enum detectorType myDetectorType=MYTHEN;
|
||||||
|
#elif PROPIXD
|
||||||
|
const enum detectorType myDetectorType=PROPIX;
|
||||||
#elif GOTTHARDD
|
#elif GOTTHARDD
|
||||||
const enum detectorType myDetectorType=GOTTHARD;
|
const enum detectorType myDetectorType=GOTTHARD;
|
||||||
#elif EIGERD
|
#elif EIGERD
|
||||||
@ -67,7 +69,11 @@ int init_detector( int b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (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);
|
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));
|
printf("\nBoard Revision:0x%x\n",(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK));
|
||||||
#ifdef MCB_FUNCS
|
#ifdef MCB_FUNCS
|
||||||
initDetector();
|
initDetector();
|
||||||
@ -1582,7 +1588,12 @@ int get_threshold_energy(int file_des) {
|
|||||||
int n;
|
int n;
|
||||||
int imod;
|
int imod;
|
||||||
|
|
||||||
|
#ifdef PROPIXD
|
||||||
|
strcpy(mess,"cannot get threshold for propix");
|
||||||
|
#else
|
||||||
strcpy(mess,"cannot get threshold for gotthard");
|
strcpy(mess,"cannot get threshold for gotthard");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
n = receiveDataOnly(file_des,&imod,sizeof(imod));
|
n = receiveDataOnly(file_des,&imod,sizeof(imod));
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
@ -1603,7 +1614,12 @@ int set_threshold_energy(int file_des) {
|
|||||||
int arg[3];
|
int arg[3];
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
#ifdef PROPIXD
|
||||||
|
strcpy(mess,"cannot set threshold for propix");
|
||||||
|
#else
|
||||||
strcpy(mess,"cannot set threshold for gotthard");
|
strcpy(mess,"cannot set threshold for gotthard");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
@ -2066,7 +2082,12 @@ int set_timer(int file_des) {
|
|||||||
retval=setGates(tns);
|
retval=setGates(tns);
|
||||||
break;
|
break;
|
||||||
case PROBES_NUMBER:
|
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");
|
sprintf(mess,"can't set/get number of probes for gotthard\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
break;
|
break;
|
||||||
case CYCLES_NUMBER:
|
case CYCLES_NUMBER:
|
||||||
@ -2268,6 +2289,11 @@ int set_roi(int file_des) {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PROPIXD
|
||||||
|
sprintf(mess,"can't set roi for propix\n");
|
||||||
|
ret = FAIL;
|
||||||
|
#endif
|
||||||
|
if(ret != FAIL){
|
||||||
if(nroi!=-1){
|
if(nroi!=-1){
|
||||||
n = receiveDataOnly(file_des,arg,nroi*sizeof(ROI));
|
n = receiveDataOnly(file_des,arg,nroi*sizeof(ROI));
|
||||||
if (n != (nroi*sizeof(ROI))) {
|
if (n != (nroi*sizeof(ROI))) {
|
||||||
@ -2281,6 +2307,7 @@ int set_roi(int file_des) {
|
|||||||
//#endif
|
//#endif
|
||||||
}
|
}
|
||||||
/* execute action if the arguments correctly arrived*/
|
/* execute action if the arguments correctly arrived*/
|
||||||
|
|
||||||
#ifdef MCB_FUNCS
|
#ifdef MCB_FUNCS
|
||||||
if (lockStatus==1 && differentClients==1){//necessary???
|
if (lockStatus==1 && differentClients==1){//necessary???
|
||||||
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
sprintf(mess,"Detector locked by %s\n", lastClientIP);
|
||||||
@ -2296,7 +2323,7 @@ int set_roi(int file_des) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if(ret==OK && differentClients){
|
if(ret==OK && differentClients){
|
||||||
printf("Force update\n");
|
printf("Force update\n");
|
||||||
@ -2330,7 +2357,12 @@ int set_speed(int file_des) {
|
|||||||
receiveDataOnly(file_des,&arg,sizeof(arg));
|
receiveDataOnly(file_des,&arg,sizeof(arg));
|
||||||
receiveDataOnly(file_des,&val,sizeof(val));
|
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");
|
sprintf(mess,"can't set speed variable for gotthard\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sendDataOnly(file_des,&ret,sizeof(ret));
|
sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
@ -2350,7 +2382,11 @@ int set_readout_flags(int file_des) {
|
|||||||
|
|
||||||
receiveDataOnly(file_des,&arg,sizeof(arg));
|
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");
|
sprintf(mess,"can't set readout flags for gotthard\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
sendDataOnly(file_des,&ret,sizeof(ret));
|
sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
sendDataOnly(file_des,mess,sizeof(mess));
|
sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
@ -2368,7 +2404,12 @@ int execute_trimming(int file_des) {
|
|||||||
int ret=FAIL;
|
int ret=FAIL;
|
||||||
enum trimMode mode;
|
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");
|
sprintf(mess,"can't set execute trimming for gotthard\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
receiveDataOnly(file_des,&mode,sizeof(mode));
|
receiveDataOnly(file_des,&mode,sizeof(mode));
|
||||||
receiveDataOnly(file_des,arg,sizeof(arg));
|
receiveDataOnly(file_des,arg,sizeof(arg));
|
||||||
@ -2655,6 +2696,11 @@ int load_image(int file_des) {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PROPIXD
|
||||||
|
sprintf(mess,"can't load image for propix\n");
|
||||||
|
ret = FAIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case DARK_IMAGE :
|
case DARK_IMAGE :
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -2814,6 +2860,12 @@ int read_counter_block(int file_des) {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PROPIXD
|
||||||
|
sprintf(mess,"can't read counter block for propix\n");
|
||||||
|
ret = FAIL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
if (differentClients==1 && lockStatus==1) {
|
if (differentClients==1 && lockStatus==1) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/moenchDetectorServer
|
||||||
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer
|
URL: origin maliakal_d@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
|
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
|
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
|
||||||
Revision: 64
|
Revision: 66
|
||||||
Branch: gemma
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 288
|
Last Changed Rev: 300
|
||||||
Last Changed Date: 2014-12-08 10:16:31 +0100
|
Last Changed Date: 2015-06-22 17:09:47 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#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 SVNREPPATH ""
|
||||||
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
|
#define SVNREPUUID "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
|
||||||
//#define SVNREV 0x288
|
//#define SVNREV 0x300
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Maliakal_Dhanya"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x288
|
#define SVNREV 0x300
|
||||||
#define SVNDATE 0x20141208
|
#define SVNDATE 0x20150622
|
||||||
//
|
//
|
||||||
|
@ -380,18 +380,18 @@ void multiSlsDetector::updateOffsets(){
|
|||||||
for (int i=1; i<thisMultiDetector->numberOfDetectors; i++) {
|
for (int i=1; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||||
if (detectors[i]) {
|
if (detectors[i]) {
|
||||||
//incrementing in y direction
|
//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);
|
offsetY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
maxY += detectors[i]->getMaxNumberOfChannels(Y);
|
||||||
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
numY += detectors[i]->getTotalNumberOfChannels(Y);
|
||||||
}
|
}
|
||||||
//incrementing in y direction
|
//incrementing in x direction
|
||||||
else{
|
else{
|
||||||
offsetY = 0;
|
offsetY = 0;
|
||||||
numY = 0;
|
numY = 0;
|
||||||
maxY = 0;
|
maxY = 0;
|
||||||
thisMultiDetector->maxNumberOfChannel[Y] = 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);
|
offsetX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
numX += detectors[i]->getTotalNumberOfChannels(X);
|
numX += detectors[i]->getTotalNumberOfChannels(X);
|
||||||
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
maxX += detectors[i]->getMaxNumberOfChannels(X);
|
||||||
@ -4598,6 +4598,8 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
int *retdet = NULL, *p=retval;
|
int *retdet = NULL, *p=retval;
|
||||||
string fullFName="";
|
string fullFName="";
|
||||||
string ext="";
|
string ext="";
|
||||||
|
int index=-1,f_index=-1,p_index=-1,det_index=-1;
|
||||||
|
double sv0=-1,sv1=-1;
|
||||||
|
|
||||||
if(getDetectorsType() == EIGER){
|
if(getDetectorsType() == EIGER){
|
||||||
maxX = thisMultiDetector->numberOfChannel[X];
|
maxX = thisMultiDetector->numberOfChannel[X];
|
||||||
@ -4637,6 +4639,7 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
delete [] retdet;
|
delete [] retdet;
|
||||||
//concatenate filenames
|
//concatenate filenames
|
||||||
if(!fullFName.length()){
|
if(!fullFName.length()){
|
||||||
|
//assign file prefix
|
||||||
fullFName.assign(fileIO::getFileName());
|
fullFName.assign(fileIO::getFileName());
|
||||||
if (strrchr(fName,'.')!=NULL){
|
if (strrchr(fName,'.')!=NULL){
|
||||||
ext.assign(fName);
|
ext.assign(fName);
|
||||||
@ -4645,9 +4648,17 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
ext = ext.erase(0,dot);
|
ext = ext.erase(0,dot);
|
||||||
else
|
else
|
||||||
ext = "";
|
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 {
|
}else {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -4658,6 +4669,7 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//append extension
|
||||||
fullFName.append(ext);
|
fullFName.append(ext);
|
||||||
strcpy(fName,fullFName.c_str());
|
strcpy(fName,fullFName.c_str());
|
||||||
//if some of the receivers did not give data, dont count it
|
//if some of the receivers did not give data, dont count it
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/mythenDetectorServer
|
Path: slsDetectorsPackage/slsDetectorSoftware/mythenDetectorServer
|
||||||
URL: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer
|
URL: origin maliakal_d@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
|
Repository Root: origin maliakal_d@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3
|
Repsitory UUID: 3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3
|
||||||
Revision: 93
|
Revision: 95
|
||||||
Branch: gemma
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 288
|
Last Changed Rev: 300
|
||||||
Last Changed Date: 2014-12-08 10:16:31 +0100
|
Last Changed Date: 2015-06-22 17:09:47 +0200
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#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 SVNREPPATH ""
|
||||||
#define SVNREPUUID "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
|
#define SVNREPUUID "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
|
||||||
//#define SVNREV 0x288
|
//#define SVNREV 0x300
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Maliakal_Dhanya"
|
#define SVNAUTH "Dhanya_Maliakal"
|
||||||
#define SVNREV 0x288
|
#define SVNREV 0x300
|
||||||
#define SVNDATE 0x20141208
|
#define SVNDATE 0x20150622
|
||||||
//
|
//
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#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 SVNREPPATH ""
|
||||||
#define SVNREPUUIDLIB "eff6ffc4c32edd46844d2cd1670cd4d4e7d05ca3"
|
#define SVNREPUUIDLIB "3b5e43dfbd7f3819ace58ad8cd0aefd0ba0034c3"
|
||||||
//#define SVNREV 0x882
|
//#define SVNREV 0x945
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "Maliakal_Dhanya"
|
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||||
#define SVNREVLIB 0x882
|
#define SVNREVLIB 0x945
|
||||||
#define SVNDATELIB 0x20141208
|
#define SVNDATELIB 0x20150622
|
||||||
//
|
//
|
||||||
|
@ -44,6 +44,12 @@ int slsDetector::initSharedMemory(detectorType type, int id) {
|
|||||||
nc=10;
|
nc=10;
|
||||||
nd=13; // dacs+adcs
|
nd=13; // dacs+adcs
|
||||||
break;
|
break;
|
||||||
|
case PROPIX:
|
||||||
|
nch=22*22;
|
||||||
|
nm=1;
|
||||||
|
nc=1;
|
||||||
|
nd=13; // dacs+adcs
|
||||||
|
break;
|
||||||
case EIGER:
|
case EIGER:
|
||||||
nch=256*256; // one EIGER half module
|
nch=256*256; // one EIGER half module
|
||||||
nm=1; //modules/detector
|
nm=1; //modules/detector
|
||||||
@ -553,6 +559,17 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
thisDetector->nModMax[Y]=1;
|
thisDetector->nModMax[Y]=1;
|
||||||
thisDetector->dynamicRange=16;
|
thisDetector->dynamicRange=16;
|
||||||
break;
|
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:
|
case MOENCH:
|
||||||
thisDetector->nChan[X]=160;
|
thisDetector->nChan[X]=160;
|
||||||
thisDetector->nChan[Y]=160;
|
thisDetector->nChan[Y]=160;
|
||||||
@ -775,7 +792,7 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
fileName=parentDet->fileName;
|
fileName=parentDet->fileName;
|
||||||
fileIndex=parentDet->fileIndex;
|
fileIndex=parentDet->fileIndex;
|
||||||
framesPerFile=parentDet->framesPerFile;
|
framesPerFile=parentDet->framesPerFile;
|
||||||
if(thisDetector->myDetectorType==GOTTHARD)
|
if((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==PROPIX))
|
||||||
setFramesPerFile(MAX_FRAMES_PER_FILE);
|
setFramesPerFile(MAX_FRAMES_PER_FILE);
|
||||||
if (thisDetector->myDetectorType==MOENCH)
|
if (thisDetector->myDetectorType==MOENCH)
|
||||||
setFramesPerFile(MOENCH_MAX_FRAMES_PER_FILE);
|
setFramesPerFile(MOENCH_MAX_FRAMES_PER_FILE);
|
||||||
@ -881,6 +898,13 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
|
|||||||
nd=8; // dacs+adcs
|
nd=8; // dacs+adcs
|
||||||
na=5;
|
na=5;
|
||||||
break;
|
break;
|
||||||
|
case PROPIX:
|
||||||
|
nch=22*22;
|
||||||
|
nm=1;
|
||||||
|
nc=1;
|
||||||
|
nd=8; // dacs+adcs
|
||||||
|
na=5;
|
||||||
|
break;
|
||||||
case EIGER:
|
case EIGER:
|
||||||
nch=256*256; // one EIGER half module
|
nch=256*256; // one EIGER half module
|
||||||
nm=1; //modules/detector
|
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;
|
std::cout<< "Dac set to "<< retval[0] << " dac units (" << retval[1] << "mV)" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (ret==FAIL) {
|
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)
|
if(mV)
|
||||||
return retval[1];
|
return retval[1];
|
||||||
@ -2951,6 +2975,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
case HIGHGAIN:
|
case HIGHGAIN:
|
||||||
if ( (thisDetector->myDetectorType == MYTHEN) ||
|
if ( (thisDetector->myDetectorType == MYTHEN) ||
|
||||||
(thisDetector->myDetectorType == GOTTHARD) ||
|
(thisDetector->myDetectorType == GOTTHARD) ||
|
||||||
|
(thisDetector->myDetectorType == PROPIX) ||
|
||||||
(thisDetector->myDetectorType == MOENCH) ||
|
(thisDetector->myDetectorType == MOENCH) ||
|
||||||
(thisDetector->myDetectorType == EIGER)) {
|
(thisDetector->myDetectorType == EIGER)) {
|
||||||
ssettings="/highgain";
|
ssettings="/highgain";
|
||||||
@ -2959,6 +2984,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
break;
|
break;
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
if ((thisDetector->myDetectorType == GOTTHARD) ||
|
if ((thisDetector->myDetectorType == GOTTHARD) ||
|
||||||
|
(thisDetector->myDetectorType == PROPIX) ||
|
||||||
(thisDetector->myDetectorType == MOENCH)) {
|
(thisDetector->myDetectorType == MOENCH)) {
|
||||||
ssettings="/dynamicgain";
|
ssettings="/dynamicgain";
|
||||||
thisDetector->currentSettings=DYNAMICGAIN;
|
thisDetector->currentSettings=DYNAMICGAIN;
|
||||||
@ -2966,6 +2992,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
break;
|
break;
|
||||||
case LOWGAIN:
|
case LOWGAIN:
|
||||||
if ((thisDetector->myDetectorType == GOTTHARD) ||
|
if ((thisDetector->myDetectorType == GOTTHARD) ||
|
||||||
|
(thisDetector->myDetectorType == PROPIX) ||
|
||||||
(thisDetector->myDetectorType == MOENCH)) {
|
(thisDetector->myDetectorType == MOENCH)) {
|
||||||
ssettings="/lowgain";
|
ssettings="/lowgain";
|
||||||
thisDetector->currentSettings=LOWGAIN;
|
thisDetector->currentSettings=LOWGAIN;
|
||||||
@ -2973,6 +3000,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
break;
|
break;
|
||||||
case MEDIUMGAIN:
|
case MEDIUMGAIN:
|
||||||
if ((thisDetector->myDetectorType == GOTTHARD) ||
|
if ((thisDetector->myDetectorType == GOTTHARD) ||
|
||||||
|
(thisDetector->myDetectorType == PROPIX) ||
|
||||||
(thisDetector->myDetectorType == MOENCH)) {
|
(thisDetector->myDetectorType == MOENCH)) {
|
||||||
ssettings="/mediumgain";
|
ssettings="/mediumgain";
|
||||||
thisDetector->currentSettings=MEDIUMGAIN;
|
thisDetector->currentSettings=MEDIUMGAIN;
|
||||||
@ -2980,6 +3008,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
break;
|
break;
|
||||||
case VERYHIGHGAIN:
|
case VERYHIGHGAIN:
|
||||||
if ((thisDetector->myDetectorType == GOTTHARD) ||
|
if ((thisDetector->myDetectorType == GOTTHARD) ||
|
||||||
|
(thisDetector->myDetectorType == PROPIX) ||
|
||||||
(thisDetector->myDetectorType == MOENCH)) {
|
(thisDetector->myDetectorType == MOENCH)) {
|
||||||
ssettings="/veryhighgain";
|
ssettings="/veryhighgain";
|
||||||
thisDetector->currentSettings=VERYHIGHGAIN;
|
thisDetector->currentSettings=VERYHIGHGAIN;
|
||||||
@ -3024,6 +3053,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
break;
|
break;
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
|
case PROPIX:
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
//settings is saved in myMod.reg
|
//settings is saved in myMod.reg
|
||||||
myMod->reg=thisDetector->currentSettings;
|
myMod->reg=thisDetector->currentSettings;
|
||||||
@ -3054,6 +3084,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
switch(thisDetector->myDetectorType){
|
switch(thisDetector->myDetectorType){
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
|
case PROPIX:
|
||||||
case JUNGFRAUCTB:
|
case JUNGFRAUCTB:
|
||||||
ostfn << thisDetector->settingsDir << ssettings << ssettings << ".settings";
|
ostfn << thisDetector->settingsDir << ssettings << ssettings << ".settings";
|
||||||
break;
|
break;
|
||||||
@ -3167,7 +3198,9 @@ int slsDetector::updateDetectorNoWait() {
|
|||||||
n = controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
n = controlSocket->ReceiveDataOnly( &t,sizeof(t));
|
||||||
thisDetector->currentSettings=t;
|
thisDetector->currentSettings=t;
|
||||||
|
|
||||||
if((thisDetector->myDetectorType!= GOTTHARD)&&(thisDetector->myDetectorType!= MOENCH)){
|
if((thisDetector->myDetectorType!= GOTTHARD)&&
|
||||||
|
(thisDetector->myDetectorType!= PROPIX)&&
|
||||||
|
(thisDetector->myDetectorType!= MOENCH)){
|
||||||
//thr=getThresholdEnergy();
|
//thr=getThresholdEnergy();
|
||||||
n = controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
n = controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
|
||||||
thisDetector->currentThresholdEV=thr;
|
thisDetector->currentThresholdEV=thr;
|
||||||
@ -3639,7 +3672,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
|
|||||||
//std::cout<< "offline " << std::endl;
|
//std::cout<< "offline " << std::endl;
|
||||||
if (t>=0)
|
if (t>=0)
|
||||||
thisDetector->timerValue[index]=t;
|
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;
|
thisDetector->timerValue[PROBES_NUMBER]=0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -4199,10 +4234,10 @@ int slsDetector::setDynamicRange(int n){
|
|||||||
thisDetector->dynamicRange=retval;
|
thisDetector->dynamicRange=retval;
|
||||||
|
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Dynamic range set to "<< thisDetector->dynamicRange << std::endl;
|
std::cout<< "Dynamic range set to "<< thisDetector->dynamicRange << std::endl;
|
||||||
std::cout<< "Data bytes "<< thisDetector->dataBytes << 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(ret != FAIL){
|
||||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||||
#ifdef VERBOSE
|
#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
|
#endif
|
||||||
if (connectData() == OK)
|
if (connectData() == OK)
|
||||||
ret=thisReceiver->sendInt(fnum2,retval1,retval);
|
ret=thisReceiver->sendInt(fnum2,retval1,n);
|
||||||
if((retval1 != retval)|| (ret==FAIL)){
|
if ((ret==FAIL) || (retval1 != retval)){
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
cout << "ERROR:Dynamic range in receiver set incorrectly to " << retval1 << " instead of " << retval << endl;
|
cout << "ERROR:Dynamic range in receiver set incorrectly to " << retval1 << " instead of " << retval << endl;
|
||||||
setErrorMask((getErrorMask())|(RECEIVER_DYNAMIC_RANGE));
|
setErrorMask((getErrorMask())|(RECEIVER_DYNAMIC_RANGE));
|
||||||
@ -5721,7 +5756,9 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
|
|||||||
// "trimen",
|
// "trimen",
|
||||||
// "receiverTCPPort",
|
// "receiverTCPPort",
|
||||||
|
|
||||||
if ((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==MOENCH)) {
|
if ((thisDetector->myDetectorType==GOTTHARD)||
|
||||||
|
(thisDetector->myDetectorType==PROPIX)||
|
||||||
|
(thisDetector->myDetectorType==MOENCH)) {
|
||||||
names[0]= "hostname";
|
names[0]= "hostname";
|
||||||
names[1]= "port";
|
names[1]= "port";
|
||||||
names[2]= "stopport";
|
names[2]= "stopport";
|
||||||
|
@ -534,6 +534,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
case MOENCH: return string("Moench"); \
|
case MOENCH: return string("Moench"); \
|
||||||
case JUNGFRAU: return string("Jungfrau"); \
|
case JUNGFRAU: return string("Jungfrau"); \
|
||||||
case JUNGFRAUCTB: return string("JungfrauCTB"); \
|
case JUNGFRAUCTB: return string("JungfrauCTB"); \
|
||||||
|
case PROPIX: return string("Propix"); \
|
||||||
default: return string("Unknown"); \
|
default: return string("Unknown"); \
|
||||||
}};
|
}};
|
||||||
|
|
||||||
@ -550,6 +551,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
if (type=="Moench") return MOENCH; \
|
if (type=="Moench") return MOENCH; \
|
||||||
if (type=="Jungfrau") return JUNGFRAU; \
|
if (type=="Jungfrau") return JUNGFRAU; \
|
||||||
if (type=="JungfrauCTB") return JUNGFRAUCTB; \
|
if (type=="JungfrauCTB") return JUNGFRAUCTB; \
|
||||||
|
if (type=="Propix") return PROPIX; \
|
||||||
return GENERIC;};
|
return GENERIC;};
|
||||||
|
|
||||||
|
|
||||||
|
@ -884,6 +884,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
descrToFuncMap[i].m_pFuncName="resetframescaught";
|
||||||
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||||
|
i++;
|
||||||
|
|
||||||
descrToFuncMap[i].m_pFuncName="frameindex";
|
descrToFuncMap[i].m_pFuncName="frameindex";
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
|
||||||
i++;
|
i++;
|
||||||
@ -4058,7 +4062,8 @@ string slsDetectorCommand::helpSpeed(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
||||||
|
|
||||||
|
int retval;
|
||||||
|
char answer[1000]="";
|
||||||
|
|
||||||
if (action==HELP_ACTION)
|
if (action==HELP_ACTION)
|
||||||
return helpAdvanced(narg, args, action);
|
return helpAdvanced(narg, args, action);
|
||||||
@ -4090,24 +4095,27 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
|||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG);
|
myDet->setOnline(ONLINE_FLAG);
|
||||||
|
|
||||||
switch (myDet->setReadOutFlags(flag)) {
|
retval = myDet->setReadOutFlags(flag);
|
||||||
case NORMAL_READOUT:
|
|
||||||
|
if(retval == NORMAL_READOUT)
|
||||||
return string("none");
|
return string("none");
|
||||||
case STORE_IN_RAM:
|
|
||||||
return string("storeinram");
|
if(retval & STORE_IN_RAM)
|
||||||
case TOT_MODE:
|
strcat(answer,"storeinram ");
|
||||||
return string("tot");
|
if(retval & TOT_MODE)
|
||||||
case CONTINOUS_RO:
|
strcat(answer,"tot ");
|
||||||
return string("continous");
|
if(retval & CONTINOUS_RO)
|
||||||
case PARALLEL:
|
strcat(answer,"continous ");
|
||||||
return string("parallel");
|
if(retval & PARALLEL)
|
||||||
case NONPARALLEL:
|
strcat(answer,"parallel ");
|
||||||
return string("nonparallel");
|
if(retval & NONPARALLEL)
|
||||||
case SAFE:
|
strcat(answer,"nonparallel ");
|
||||||
return string("safe");
|
if(retval & SAFE)
|
||||||
default:
|
strcat(answer,"safe ");
|
||||||
|
if(strlen(answer))
|
||||||
|
return string(answer);
|
||||||
|
|
||||||
return string("unknown");
|
return string("unknown");
|
||||||
}
|
|
||||||
|
|
||||||
} else if (cmd=="extsig") {
|
} else if (cmd=="extsig") {
|
||||||
externalSignalFlag flag=GET_EXTERNAL_SIGNAL_FLAG;
|
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"){
|
else if(cmd=="frameindex"){
|
||||||
if (action==PUT_ACTION)
|
if (action==PUT_ACTION)
|
||||||
return string("cannot put");
|
return string("cannot put");
|
||||||
@ -4336,6 +4356,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
|
|||||||
ostringstream os;
|
ostringstream os;
|
||||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
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 << "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 << "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;
|
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,14 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
int multiframe = nc*nf;
|
int multiframe = nc*nf;
|
||||||
|
|
||||||
|
//
|
||||||
|
if(setDynamicRange() == 32) subframe = 1;
|
||||||
|
else subframe = 0;
|
||||||
|
|
||||||
|
pthread_mutex_lock(&mg);
|
||||||
|
acquiringDone = 0;
|
||||||
|
pthread_mutex_unlock(&mg);
|
||||||
|
|
||||||
// setTotalProgress();
|
// setTotalProgress();
|
||||||
//moved these 2 here for measurement change
|
//moved these 2 here for measurement change
|
||||||
progressIndex=0;
|
progressIndex=0;
|
||||||
@ -462,8 +470,11 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
|
|
||||||
|
|
||||||
if (measurement_finished)
|
if (measurement_finished){
|
||||||
|
pthread_mutex_lock(&mg);
|
||||||
measurement_finished(im,*fileIndex,measFinished_p);
|
measurement_finished(im,*fileIndex,measFinished_p);
|
||||||
|
pthread_mutex_unlock(&mg);
|
||||||
|
}
|
||||||
|
|
||||||
if (*stoppedFlag) {
|
if (*stoppedFlag) {
|
||||||
break;
|
break;
|
||||||
@ -806,6 +817,7 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
|||||||
names[nvar++]="ratecorr";
|
names[nvar++]="ratecorr";
|
||||||
break;
|
break;
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
|
case PROPIX:
|
||||||
names[nvar++]="flags";
|
names[nvar++]="flags";
|
||||||
names[nvar++]="delay";
|
names[nvar++]="delay";
|
||||||
names[nvar++]="gates";
|
names[nvar++]="gates";
|
||||||
@ -889,6 +901,7 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
|
|||||||
case EIGER:
|
case EIGER:
|
||||||
case MYTHEN:
|
case MYTHEN:
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
|
case PROPIX:
|
||||||
names[nvar++]="flatfield";
|
names[nvar++]="flatfield";
|
||||||
names[nvar++]="badchannels";
|
names[nvar++]="badchannels";
|
||||||
break;
|
break;
|
||||||
|
@ -111,6 +111,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
names[id++]="Vdac7";
|
names[id++]="Vdac7";
|
||||||
break;
|
break;
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
|
case PROPIX:
|
||||||
names[id++]="Vref";
|
names[id++]="Vref";
|
||||||
names[id++]="VcascN";
|
names[id++]="VcascN";
|
||||||
names[id++]="VcascP";
|
names[id++]="VcascP";
|
||||||
@ -265,6 +266,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
|
|||||||
|
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
|
case PROPIX:
|
||||||
//---------------dacs---------------
|
//---------------dacs---------------
|
||||||
infile.open(myfname.c_str(), ios_base::in);
|
infile.open(myfname.c_str(), ios_base::in);
|
||||||
if (infile.is_open()) {
|
if (infile.is_open()) {
|
||||||
@ -352,6 +354,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
|
|||||||
names[id++]="Vdac7";
|
names[id++]="Vdac7";
|
||||||
break;
|
break;
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
|
case PROPIX:
|
||||||
names[id++]="Vref";
|
names[id++]="Vref";
|
||||||
names[id++]="VcascN";
|
names[id++]="VcascN";
|
||||||
names[id++]="VcascP";
|
names[id++]="VcascP";
|
||||||
|
@ -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){ \
|
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; \
|
ostringstream osfn; \
|
||||||
osfn << filepath << "/" << filename; \
|
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))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
|
||||||
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
|
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
|
||||||
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
|
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
|
||||||
|
if(detindex>=0) osfn << "_d"<< detindex; \
|
||||||
if(frameindex>=0) osfn << "_f" << frameindex; \
|
if(frameindex>=0) osfn << "_f" << frameindex; \
|
||||||
osfn << "_" << findex; \
|
osfn << "_" << findex; \
|
||||||
return osfn.str(); \
|
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){ \
|
static string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \
|
||||||
ostringstream osfn; \
|
ostringstream osfn; \
|
||||||
osfn << filename; \
|
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))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
|
||||||
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
|
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
|
||||||
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
|
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
|
||||||
|
if(detindex!=-1) osfn << "_d"<< detindex; \
|
||||||
return osfn.str(); \
|
return osfn.str(); \
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -161,26 +161,32 @@ class fileIOStatic {
|
|||||||
index=i; \
|
index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
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("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) \
|
||||||
s=fname.substr(0,uscore); \
|
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)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
|
||||||
p_index=i; \
|
p_index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
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("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
|
||||||
sv1=f; \
|
sv1=f; \
|
||||||
s=fname.substr(0,uscore); \
|
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("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
|
||||||
sv0=f; \
|
sv0=f; \
|
||||||
} \
|
} \
|
||||||
else cout << "******************************** cannot parse scan varable 0" << endl; \
|
/* else cout << "Warning: ******************************** cannot parse scan varable 0 from " << s << endl; \*/
|
||||||
return index; \
|
return index; \
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -210,40 +216,68 @@ class fileIOStatic {
|
|||||||
index=i; \
|
index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "******************************** cannot parse file index" << endl; \
|
/*else cout << "Warning: ******************************** cannot parse file index" << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) { \
|
||||||
f_index=i; \
|
f_index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
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("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
|
||||||
p_index=i; \
|
p_index=i; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "******************************** cannot parse position index" << endl; \
|
/*else cout << "Warning: ******************************** cannot parse position index" << endl; \*/
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"s%lf",&f)) { \
|
||||||
sv1=f; \
|
sv1=f; \
|
||||||
s=fname.substr(0,uscore); \
|
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("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) { \
|
||||||
sv0=f; \
|
sv0=f; \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
} \
|
} \
|
||||||
else cout << "******************************** cannot parse scan varable 0" << endl; \
|
/*else cout << "Warning: ******************************** 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; \
|
|
||||||
return index; \
|
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
|
/** static function that returns the name variable from the receiver complete file name prefix
|
||||||
\param fname complete file name prefix
|
\param fname complete file name prefix
|
||||||
@ -255,6 +289,9 @@ class fileIOStatic {
|
|||||||
string s; \
|
string s; \
|
||||||
s=fname; \
|
s=fname; \
|
||||||
size_t uscore=s.rfind("_"); \
|
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)) \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) \
|
||||||
s=fname.substr(0,uscore); \
|
s=fname.substr(0,uscore); \
|
||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
@ -263,9 +300,8 @@ class fileIOStatic {
|
|||||||
uscore=s.rfind("_"); \
|
uscore=s.rfind("_"); \
|
||||||
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) \
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) \
|
||||||
s=fname.substr(0,uscore); \
|
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; \
|
return s; \
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -278,20 +314,32 @@ class fileIOStatic {
|
|||||||
\returns file name without file name prefix, detector index or extension
|
\returns file name without file name prefix, detector index or extension
|
||||||
*/
|
*/
|
||||||
static string getReceiverFileNameToConcatenate(string fname) { \
|
static string getReceiverFileNameToConcatenate(string fname) { \
|
||||||
//int i;
|
int i;double f; \
|
||||||
string s=fname; \
|
string s=fname; \
|
||||||
if(fname.empty()) return fname; \
|
if(fname.empty()) return fname; \
|
||||||
size_t slash=s.rfind("/"); \
|
size_t dot=s.find(".");
|
||||||
if (slash!= string::npos) \
|
size_t uscore=s.rfind("_"); \
|
||||||
s=s.substr(slash,s.size()-slash); \
|
|
||||||
size_t dot=s.find("."); \
|
if (uscore==string::npos) return "??"; \
|
||||||
size_t uscore=s.find("_"); \
|
if (sscanf(s.substr(uscore+1,s.size()-uscore-1).c_str(),"%d",&i)) \
|
||||||
if ((dot!= string::npos)&&(uscore!= string::npos)) \
|
s=fname.substr(0,uscore); \
|
||||||
s=s.substr(uscore,dot-uscore); \
|
uscore=s.rfind("_"); \
|
||||||
// uscore=s.find("_",1);
|
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"f%d",&i)) \
|
||||||
//if ((uscore!= string::npos) && (sscanf( s.substr(1,uscore-1).c_str(),"d%d",&i)))
|
s=fname.substr(0,uscore); \
|
||||||
//s=s.substr(uscore,s.size()-uscore);
|
uscore=s.rfind("_"); \
|
||||||
return s; \
|
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()));\
|
||||||
|
\
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -495,12 +495,15 @@ void* postProcessing::processData(int delflag) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
int progress = -1;
|
int progress = 0;
|
||||||
char currentfName[MAX_STR_LENGTH]="";
|
char currentfName[MAX_STR_LENGTH]="";
|
||||||
|
int caught = -1;
|
||||||
int currentAcquisitionIndex = -1;
|
int currentAcquisitionIndex = -1;
|
||||||
int currentFrameIndex = -1;
|
int currentFrameIndex = -1;
|
||||||
bool newData = false;
|
bool newData = false;
|
||||||
int nthframe = setReadReceiverFrequency(0);
|
int nthframe = setReadReceiverFrequency(0);
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "receiver read freq:" << nthframe << std::endl;
|
std::cout << "receiver read freq:" << nthframe << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -527,14 +530,23 @@ void* postProcessing::processData(int delflag) {
|
|||||||
//get progress
|
//get progress
|
||||||
pthread_mutex_lock(&mg);
|
pthread_mutex_lock(&mg);
|
||||||
if(setReceiverOnline() == ONLINE_FLAG)
|
if(setReceiverOnline() == ONLINE_FLAG)
|
||||||
currentAcquisitionIndex = getReceiverCurrentFrameIndex();
|
caught = getFramesCaughtByReceiver();//getReceiverCurrentFrameIndex();
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
|
|
||||||
//updating progress
|
//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);
|
setCurrentProgress(currentAcquisitionIndex+1);
|
||||||
|
*/
|
||||||
|
}
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << endl;
|
cout << "caught:" << caught << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -555,7 +567,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
#endif
|
#endif
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
//go through once more to get last nth frame data
|
//go through once more to get last nth frame data
|
||||||
if (acquiringDone >= 2){
|
if (acquiringDone >= 5){cout<<"acquiringdone:"<<acquiringDone<<endl;
|
||||||
if((!nthframe) ||(!newData)){
|
if((!nthframe) ||(!newData)){
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "gonna post for it to end" << endl;
|
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
|
//for random reads, ask only if it has new data
|
||||||
if(!newData){
|
if(!newData){
|
||||||
if(currentAcquisitionIndex > progress)
|
if(caught > progress){
|
||||||
newData = true;
|
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
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << " progress:" << progress << endl;
|
cout << "currentAcquisitionIndex:" << currentAcquisitionIndex << " progress:" << progress << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -591,6 +615,19 @@ void* postProcessing::processData(int delflag) {
|
|||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "new data" << endl;
|
cout << "new data" << endl;
|
||||||
#endif
|
#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){
|
if(setReceiverOnline()==ONLINE_FLAG){
|
||||||
//get data
|
//get data
|
||||||
strcpy(currentfName,"");
|
strcpy(currentfName,"");
|
||||||
@ -609,14 +646,16 @@ void* postProcessing::processData(int delflag) {
|
|||||||
cout<<"****Detector Data returned is NULL***"<<endl;
|
cout<<"****Detector Data returned is NULL***"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//not garbage frame
|
// garbage frame
|
||||||
if(currentAcquisitionIndex < 0){
|
if(currentAcquisitionIndex < 0){
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
|
cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
|
||||||
#endif
|
#endif
|
||||||
if(receiverData)
|
if(receiverData)
|
||||||
delete [] receiverData;
|
delete [] receiverData;
|
||||||
}else if (currentAcquisitionIndex > progress){
|
}
|
||||||
|
//not garbage frame
|
||||||
|
else{// if (currentAcquisitionIndex > progress){
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "GOT data" << endl;
|
cout << "GOT data" << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -628,7 +667,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
dataReady(thisData, currentFrameIndex, pCallbackArg);
|
dataReady(thisData, currentFrameIndex, pCallbackArg);
|
||||||
delete thisData;
|
delete thisData;
|
||||||
fdata = NULL;
|
fdata = NULL;
|
||||||
progress = currentAcquisitionIndex;
|
progress = caught;
|
||||||
#ifdef VERY_VERY_DEBUG
|
#ifdef VERY_VERY_DEBUG
|
||||||
cout << "progress:" << progress << endl;
|
cout << "progress:" << progress << endl;
|
||||||
#endif
|
#endif
|
||||||
@ -641,6 +680,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,6 +302,8 @@ s
|
|||||||
|
|
||||||
/** set when detector finishes acquiring */
|
/** set when detector finishes acquiring */
|
||||||
int acquiringDone;
|
int acquiringDone;
|
||||||
|
/**sub frame*/
|
||||||
|
int subframe;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +85,7 @@ int decode_function(int file_des) {
|
|||||||
fnum=255;
|
fnum=255;
|
||||||
ret=(*flist[fnum])(file_des);
|
ret=(*flist[fnum])(file_des);
|
||||||
if (ret==FAIL)
|
if (ret==FAIL)
|
||||||
printf( "Error executing the function = %d \n",fnum);
|
cprintf( RED, "Error executing the function = %d \n",fnum);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2197,9 +2197,9 @@ int stop_acquisition(int file_des) {
|
|||||||
|
|
||||||
sprintf(mess,"can't stop acquisition\n");
|
sprintf(mess,"can't stop acquisition\n");
|
||||||
|
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("Stopping acquisition\n");
|
printf("Stopping acquisition\n");
|
||||||
#endif
|
//#endif
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (differentClients==1 && lockStatus==1) {
|
if (differentClients==1 && lockStatus==1) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -2603,7 +2603,7 @@ int set_dynamic_range(int file_des) {
|
|||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
|
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
dataBytes=calculateDataBytes();
|
if (dr>=0) dataBytes=calculateDataBytes();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//ret could be swapped during sendData
|
//ret could be swapped during sendData
|
||||||
@ -2637,9 +2637,19 @@ int set_readout_flags(int file_des) {
|
|||||||
ret=FAIL;
|
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
|
#ifdef VERBOSE
|
||||||
printf("setting readout flags to %d\n",arg);
|
printf("setting readout flags to %d\n",arg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (differentClients==1 && lockStatus==1 && arg!=GET_READOUT_FLAGS) {
|
if (differentClients==1 && lockStatus==1 && arg!=GET_READOUT_FLAGS) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -2648,30 +2658,37 @@ int set_readout_flags(int file_des) {
|
|||||||
switch(arg) {
|
switch(arg) {
|
||||||
case GET_READOUT_FLAGS:
|
case GET_READOUT_FLAGS:
|
||||||
#ifdef MYTHEND
|
#ifdef MYTHEND
|
||||||
case STORE_IN_RAM:
|
|
||||||
case TOT_MODE:
|
case TOT_MODE:
|
||||||
case CONTINOUS_RO:
|
|
||||||
case NORMAL_READOUT:
|
case NORMAL_READOUT:
|
||||||
retval=setReadOutFlags(arg);
|
#endif
|
||||||
break;
|
#if defined(MYTHEND) || defined(EIGERD)
|
||||||
#elif EIGERD
|
case STORE_IN_RAM:
|
||||||
|
case CONTINOUS_RO:
|
||||||
|
#endif
|
||||||
|
#ifdef EIGERD
|
||||||
case PARALLEL:
|
case PARALLEL:
|
||||||
case NONPARALLEL:
|
case NONPARALLEL:
|
||||||
case SAFE:
|
case SAFE:
|
||||||
|
#endif
|
||||||
retval=setReadOutFlags(arg);
|
retval=setReadOutFlags(arg);
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
sprintf(mess,"Unknown readout flag %d for this detector\n", arg);
|
sprintf(mess,"Unknown readout flag %d for this detector\n", arg);
|
||||||
|
cprintf(RED, "%s",mess);
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
if (arg!=GET_READOUT_FLAGS && arg!=retval) {
|
if (retval == -1) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
sprintf(mess,"Could not change readout flag: should be %d but is %d\n", arg, retval);
|
sprintf(mess,"Could not change readout flag: should be %d but is %d\n", arg, retval);
|
||||||
|
cprintf(RED, "%s",mess);
|
||||||
}else if (differentClients)
|
}else if (differentClients)
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user