mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
got rid of extra servers for eiger, converted to c and it works
This commit is contained in:
parent
10ca7c10e8
commit
c5a4f357bf
@ -8,98 +8,81 @@
|
|||||||
#ifndef BEB_H
|
#ifndef BEB_H
|
||||||
#define BEB_H
|
#define BEB_H
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "LocalLinkInterface.h"
|
#include "LocalLinkInterface.h"
|
||||||
|
|
||||||
|
|
||||||
class BebInfo{
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
struct BebInfo{
|
||||||
unsigned int beb_number;
|
unsigned int beb_number;
|
||||||
unsigned int serial_address;
|
unsigned int serial_address;
|
||||||
std::string src_mac_1GbE;
|
char src_mac_1GbE[50];
|
||||||
std::string src_mac_10GbE;
|
char src_mac_10GbE[50];
|
||||||
std::string src_ip_1GbE;
|
char src_ip_1GbE[50];
|
||||||
std::string src_ip_10GbE;
|
char src_ip_10GbE[50];
|
||||||
unsigned int src_port_1GbE;
|
unsigned int src_port_1GbE;
|
||||||
unsigned int src_port_10GbE;
|
unsigned int src_port_10GbE;
|
||||||
|
|
||||||
public:
|
|
||||||
BebInfo(unsigned int beb_num);
|
|
||||||
~BebInfo(){};
|
|
||||||
|
|
||||||
bool SetSerialAddress(unsigned int add);
|
|
||||||
bool SetHeaderInfo(bool ten_gig, std::string src_mac, std::string src_ip, unsigned int src_port);//src_port fixed 42000+beb_number or 52000 + beb_number);
|
|
||||||
unsigned int GetBebNumber() {return beb_number;}
|
|
||||||
unsigned int GetSerialAddress() {return serial_address;}
|
|
||||||
std::string GetSrcMAC(bool ten_gig) {return ten_gig ? src_mac_10GbE : src_mac_1GbE;}
|
|
||||||
std::string GetSrcIP(bool ten_gig) {return ten_gig ? src_ip_10GbE : src_ip_1GbE;}
|
|
||||||
unsigned int GetSrcPort(bool ten_gig) {return ten_gig ? src_port_10GbE : src_port_1GbE;}
|
|
||||||
|
|
||||||
void Print();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num);
|
||||||
class Beb{ //
|
int BebInfo_SetSerialAddress(struct BebInfo* bebInfo, unsigned int add);
|
||||||
|
int BebInfo_SetHeaderInfo(struct BebInfo* bebInfo, int ten_gig, char* src_mac, char* src_ip, unsigned int src_port);//src_port fixed 42000+beb_number or 52000 + beb_number);
|
||||||
private:
|
unsigned int BebInfo_GetBebNumber(struct BebInfo* bebInfo);
|
||||||
std::vector<BebInfo*> beb_infos;
|
unsigned int BebInfo_GetSerialAddress(struct BebInfo* bebInfo);
|
||||||
void ClearBebInfos();
|
char* BebInfo_GetSrcMAC(struct BebInfo* bebInfo, int ten_gig);
|
||||||
bool InitBebInfos();
|
char* BebInfo_GetSrcIP(struct BebInfo* bebInfo, int ten_gig);
|
||||||
bool ReadSetUpFromFile(std::string file_name);
|
unsigned int BebInfo_GetSrcPort(struct BebInfo* bebInfo, int ten_gig);
|
||||||
bool CheckSourceStuffBebInfo();
|
void BebInfo_Print(struct BebInfo* bebInfo);
|
||||||
unsigned int GetBebInfoIndex(unsigned int beb_numb);
|
|
||||||
|
|
||||||
LocalLinkInterface* ll;
|
|
||||||
LocalLinkInterface* new_memory;
|
|
||||||
|
|
||||||
|
|
||||||
int send_ndata;
|
|
||||||
unsigned int send_buffer_size;
|
|
||||||
unsigned int* send_data_raw;
|
|
||||||
unsigned int* send_data;
|
|
||||||
|
|
||||||
int recv_ndata;
|
|
||||||
unsigned int recv_buffer_size;
|
|
||||||
unsigned int* recv_data_raw;
|
|
||||||
unsigned int* recv_data;
|
|
||||||
|
|
||||||
bool WriteTo(unsigned int index);
|
|
||||||
|
|
||||||
bool SetMAC(std::string mac, unsigned char* dst_ptr);
|
|
||||||
bool SetIP(std::string ip, unsigned char* dst_ptr);
|
|
||||||
bool SetPortNumber(unsigned int port_number, unsigned char* dst_ptr);
|
|
||||||
void AdjustIPChecksum(udp_header_type *ip);
|
|
||||||
|
|
||||||
bool SetHeaderData(unsigned int beb_number, bool ten_gig, std::string dst_mac, std::string dst_ip, unsigned int dst_port);
|
|
||||||
bool SetHeaderData(std::string src_mac, std::string src_ip, unsigned int src_port, std::string dst_mac, std::string dst_ip, unsigned int dst_port);
|
|
||||||
|
|
||||||
void SwapDataFun(bool little_endian, unsigned int n, unsigned int *d);
|
|
||||||
bool SetByteOrder();
|
|
||||||
|
|
||||||
short bit_mode;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Beb(int arg1);
|
|
||||||
virtual ~Beb();
|
|
||||||
|
|
||||||
bool SetBebSrcHeaderInfos(unsigned int beb_number, bool ten_gig, std::string src_mac, std::string src_ip, unsigned int src_port);
|
|
||||||
bool SetUpUDPHeader(unsigned int beb_number, bool ten_gig, unsigned int header_number, std::string dst_mac, std::string dst_ip, unsigned int dst_port);
|
|
||||||
|
|
||||||
bool SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, bool ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, bool stop_read_when_fifo_empty=1);
|
|
||||||
|
|
||||||
|
|
||||||
bool SetUpTransferParameters(short the_bit_mode);
|
|
||||||
bool RequestNImages(unsigned int beb_number, unsigned int left_right, bool ten_gig, unsigned int dst_number, unsigned int nimages, bool test_just_send_out_packets_no_wait=0); //all images go to the same destination!
|
void Beb_ClearBebInfos();
|
||||||
|
int Beb_InitBebInfos();
|
||||||
|
int Beb_ReadSetUpFromFile(char* file_name);
|
||||||
|
int Beb_CheckSourceStuffBebInfo();
|
||||||
|
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb);
|
||||||
|
|
||||||
|
|
||||||
bool Test(unsigned int beb_number);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
int Beb_WriteTo(unsigned int index);
|
||||||
|
|
||||||
|
int Beb_SetMAC(char* mac, uint8_t* dst_ptr);
|
||||||
|
int Beb_SetIP(char* ip, uint8_t* dst_ptr);
|
||||||
|
int Beb_SetPortNumber(unsigned int port_number, uint8_t* dst_ptr);
|
||||||
|
void Beb_AdjustIPChecksum(struct udp_header_type *ip);
|
||||||
|
|
||||||
|
int Beb_SetHeaderData(unsigned int beb_number, int ten_gig, char* dst_mac, char* dst_ip, unsigned int dst_port);
|
||||||
|
int Beb_SetHeaderData1(char* src_mac, char* src_ip, unsigned int src_port, char* dst_mac, char* dst_ip, unsigned int dst_port);
|
||||||
|
|
||||||
|
void Beb_SwapDataFun(int little_endian, unsigned int n, unsigned int *d);
|
||||||
|
int Beb_SetByteOrder();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Beb_Beb(int arg1);
|
||||||
|
|
||||||
|
|
||||||
|
int Beb_SetBebSrcHeaderInfos(unsigned int beb_number, int ten_gig, char* src_mac, char* src_ip, unsigned int src_port);
|
||||||
|
int Beb_SetUpUDPHeader(unsigned int beb_number, int ten_gig, unsigned int header_number, char* dst_mac, char* dst_ip, unsigned int dst_port);
|
||||||
|
|
||||||
|
/*int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, int stop_read_when_fifo_empty=1);*/
|
||||||
|
int Beb_SendMultiReadRequest(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int npackets, unsigned int packet_size, int stop_read_when_fifo_empty);
|
||||||
|
|
||||||
|
int Beb_SetUpTransferParameters(short the_bit_mode);
|
||||||
|
/*int Beb_RequestNImages(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait=0); //all images go to the same destination!*/
|
||||||
|
int Beb_RequestNImages(unsigned int beb_number, unsigned int left_right, int ten_gig, unsigned int dst_number, unsigned int nimages, int test_just_send_out_packets_no_wait);
|
||||||
|
|
||||||
|
int Beb_Test(unsigned int beb_number);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,11 +11,7 @@
|
|||||||
|
|
||||||
#include "slsDetectorServer_defs.h" //include port number
|
#include "slsDetectorServer_defs.h" //include port number
|
||||||
|
|
||||||
struct sockaddr_in eiger_socket_addr;
|
|
||||||
int eiger_max_message_length = 270000;//263681
|
|
||||||
char eiger_message[270000];//263681
|
|
||||||
int eiger_message_length = 0;
|
|
||||||
int eiger_ret_val=0;
|
|
||||||
|
|
||||||
int eiger_nexposures = 1;
|
int eiger_nexposures = 1;
|
||||||
float eiger_exposuretime = 0;
|
float eiger_exposuretime = 0;
|
||||||
@ -56,25 +52,7 @@ int EigerGetExternalGatingPolarity(){return eiger_extgatingpolarity;}
|
|||||||
int EigerInit(){
|
int EigerInit(){
|
||||||
saved_trimbits[0] = -1;
|
saved_trimbits[0] = -1;
|
||||||
|
|
||||||
static int passed = 0;
|
|
||||||
|
|
||||||
if(!passed){
|
|
||||||
struct hostent *dst_host;
|
|
||||||
if((dst_host = gethostbyname("localhost")) == NULL){ //or look into getaddrinfo(3)
|
|
||||||
fprintf(stderr,"ERROR, no such host\n");
|
|
||||||
return 0;
|
|
||||||
}else{
|
|
||||||
//struct sockaddr_in eiger_socket_addr;
|
|
||||||
int port = FEB_PORT;
|
|
||||||
bzero((char *) &eiger_socket_addr, sizeof(eiger_socket_addr));
|
|
||||||
eiger_socket_addr.sin_family = AF_INET;
|
|
||||||
bcopy((char *)dst_host->h_addr,(char *)&eiger_socket_addr.sin_addr.s_addr,dst_host->h_length);
|
|
||||||
eiger_socket_addr.sin_port = htons(port);
|
|
||||||
passed = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return passed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,53 +10,50 @@
|
|||||||
|
|
||||||
#include "LocalLinkInterface.h"
|
#include "LocalLinkInterface.h"
|
||||||
|
|
||||||
class Feb{ //
|
|
||||||
|
|
||||||
private:
|
struct LocalLinkInterface* ll;
|
||||||
LocalLinkInterface* ll;
|
|
||||||
|
|
||||||
unsigned int nfebs;
|
unsigned int Feb_nfebs;
|
||||||
unsigned int* feb_numb;
|
unsigned int* Feb_feb_numb;
|
||||||
|
|
||||||
int send_ndata;
|
int Feb_send_ndata;
|
||||||
unsigned int send_buffer_size;
|
unsigned int Feb_send_buffer_size;
|
||||||
unsigned int* send_data_raw;
|
unsigned int* Feb_send_data_raw;
|
||||||
unsigned int* send_data;
|
unsigned int* Feb_send_data;
|
||||||
|
|
||||||
int recv_ndata;
|
int Feb_recv_ndata;
|
||||||
unsigned int recv_buffer_size;
|
unsigned int Feb_recv_buffer_size;
|
||||||
unsigned int* recv_data_raw;
|
unsigned int* Feb_recv_data_raw;
|
||||||
unsigned int* recv_data;
|
unsigned int* Feb_recv_data;
|
||||||
|
|
||||||
bool WriteTo(unsigned int ch);
|
int Feb_WriteTo(unsigned int ch);
|
||||||
bool ReadFrom(unsigned int ch, unsigned int ntrys=20);
|
/*int Feb_ReadFrom(unsigned int Feb_ch, unsigned int Feb_ntrys=20);*/
|
||||||
bool CheckHeader(unsigned int valid_bit_mask=0xffffffff, bool print_error_info=1);
|
int Feb_ReadFrom(unsigned int ch, unsigned int ntrys);
|
||||||
bool CheckTail(unsigned int valid_bit_mask=0xffffffff);
|
/* int Feb_CheckHeader(unsigned int Feb_valid_bit_mask=0xffffffff, int Feb_print_error_info=1);*/
|
||||||
|
int Feb_CheckHeader(unsigned int valid_bit_mask, int print_error_info);
|
||||||
|
/*int Feb_CheckTail(unsigned int Feb_valid_bit_mask=0xffffffff);*/
|
||||||
|
int Feb_CheckTail(unsigned int valid_bit_mask);
|
||||||
|
|
||||||
|
int Feb_SetByteOrder();
|
||||||
|
//int Feb_CheckSubNumber(unsigned int Feb_sub_num);
|
||||||
|
//int Feb_SetStartOnEndOnFebs(int Feb_sub_num_s, unsigned int& Feb_start_on, unsigned int& Feb_end_on);
|
||||||
|
void Feb_PrintData();
|
||||||
|
|
||||||
|
|
||||||
bool SetByteOrder();
|
Feb_Feb();
|
||||||
//bool CheckSubNumber(unsigned int sub_num);
|
/*virtual ~Feb();*/
|
||||||
//bool SetStartOnEndOnFebs(int sub_num_s, unsigned int& start_on, unsigned int& end_on);
|
void Feb_SendCompleteFebList(unsigned int n,unsigned int* list);
|
||||||
void PrintData();
|
int Feb_CheckCommunication();
|
||||||
|
/*int Feb_ReadRegister(unsigned int Feb_sub_num, unsigned int Feb_reg_num,unsigned int& Feb_value_read);*/
|
||||||
|
int Feb_ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int* value_read);
|
||||||
|
int Feb_ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read);
|
||||||
|
/*int WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, int wait_on=0, unsigned int wait_on_address=0);*/
|
||||||
|
int Feb_WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, int wait_on, unsigned int wait_on_address);
|
||||||
|
/*int WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, int* wait_ons=0, unsigned int* wait_on_addresses=0);*/
|
||||||
|
int Feb_WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, int* wait_ons, unsigned int* wait_on_addresses);
|
||||||
|
int Feb_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
|
||||||
|
int Feb_Test();
|
||||||
|
|
||||||
public:
|
|
||||||
Feb();
|
|
||||||
virtual ~Feb();
|
|
||||||
|
|
||||||
void SendCompleteFebList(unsigned int n,unsigned int* list);
|
|
||||||
bool CheckCommunication();
|
|
||||||
|
|
||||||
bool ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int& value_read);
|
|
||||||
bool ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read);
|
|
||||||
|
|
||||||
bool WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, bool wait_on=0, unsigned int wait_on_address=0);
|
|
||||||
bool WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, bool* wait_ons=0, unsigned int* wait_on_addresses=0);
|
|
||||||
|
|
||||||
bool WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
|
|
||||||
|
|
||||||
bool Test();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -9,21 +9,20 @@
|
|||||||
#define FEBCONTROL_H
|
#define FEBCONTROL_H
|
||||||
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <string>
|
#include <stdlib.h>
|
||||||
#include <vector>
|
//#include <string>
|
||||||
|
//#include <vector>
|
||||||
|
|
||||||
|
|
||||||
#include "FebInterface.h"
|
#include "FebInterface.h"
|
||||||
|
|
||||||
|
|
||||||
class Module{
|
struct Module{
|
||||||
|
|
||||||
private:
|
|
||||||
unsigned int module_number;
|
unsigned int module_number;
|
||||||
bool top_address_valid;
|
int top_address_valid;
|
||||||
unsigned int top_left_address;
|
unsigned int top_left_address;
|
||||||
unsigned int top_right_address;
|
unsigned int top_right_address;
|
||||||
bool bottom_address_valid;
|
int bottom_address_valid;
|
||||||
unsigned int bottom_left_address;
|
unsigned int bottom_left_address;
|
||||||
unsigned int bottom_right_address;
|
unsigned int bottom_right_address;
|
||||||
|
|
||||||
@ -32,163 +31,154 @@ class Module{
|
|||||||
float high_voltage;
|
float high_voltage;
|
||||||
int* top_dac;
|
int* top_dac;
|
||||||
int* bottom_dac;
|
int* bottom_dac;
|
||||||
|
|
||||||
public:
|
|
||||||
Module(unsigned int number, unsigned int address_top); //for half module()
|
|
||||||
Module(unsigned int number, unsigned int address_top, unsigned int address_bottom);
|
|
||||||
~Module();
|
|
||||||
|
|
||||||
static const unsigned int ndacs;
|
|
||||||
static const std::string dac_names[16];
|
|
||||||
|
|
||||||
unsigned int GetModuleNumber() {return module_number;}
|
|
||||||
bool TopAddressIsValid() {return top_address_valid;}
|
|
||||||
unsigned int GetTopBaseAddress() {return (top_left_address&0xff);}
|
|
||||||
unsigned int GetTopLeftAddress() {return top_left_address;}
|
|
||||||
unsigned int GetTopRightAddress() {return top_right_address;}
|
|
||||||
unsigned int GetBottomBaseAddress() {return (bottom_left_address&0xff);}
|
|
||||||
bool BottomAddressIsValid() {return bottom_address_valid;}
|
|
||||||
unsigned int GetBottomLeftAddress() {return bottom_left_address;}
|
|
||||||
unsigned int GetBottomRightAddress() {return bottom_right_address;}
|
|
||||||
|
|
||||||
unsigned int SetTopIDelay(unsigned int chip,unsigned int value) { return TopAddressIsValid() &&chip<4 ? (idelay_top[chip]=value) : 0;} //chip 0=ll,1=lr,0=rl,1=rr
|
|
||||||
unsigned int GetTopIDelay(unsigned int chip) { return chip<4 ? idelay_top[chip] : 0;} //chip 0=ll,1=lr,0=rl,1=rr
|
|
||||||
unsigned int SetBottomIDelay(unsigned int chip,unsigned int value) { return BottomAddressIsValid() &&chip<4 ? (idelay_bottom[chip]=value) : 0;} //chip 0=ll,1=lr,0=rl,1=rr
|
|
||||||
unsigned int GetBottomIDelay(unsigned int chip) { return chip<4 ? idelay_bottom[chip] : 0;} //chip 0=ll,1=lr,0=rl,1=rr
|
|
||||||
|
|
||||||
float SetHighVoltage(float value) { return TopAddressIsValid() ? (high_voltage=value) : -1;}
|
|
||||||
float GetHighVoltage() { return high_voltage;}
|
|
||||||
|
|
||||||
int SetTopDACValue(unsigned int i, int value) { return (i<ndacs && TopAddressIsValid()) ? (top_dac[i]=value) : -1;}
|
|
||||||
int GetTopDACValue(unsigned int i) { return (i<ndacs) ? top_dac[i]:-1;}
|
|
||||||
int SetBottomDACValue(unsigned int i, int value) { return (i<ndacs && BottomAddressIsValid()) ? (bottom_dac[i]=value) : -1;}
|
|
||||||
int GetBottomDACValue(unsigned int i) { return (i<ndacs) ? bottom_dac[i]:-1;}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void Module_Module(struct Module* mod,unsigned int number, unsigned int address_top);
|
||||||
|
void Module_Module1(struct Module* mod,unsigned int number, unsigned int address_top, unsigned int address_bottom);
|
||||||
|
unsigned int Module_GetModuleNumber(struct Module* mod);
|
||||||
|
int Module_TopAddressIsValid(struct Module* mod);
|
||||||
|
unsigned int Module_GetTopBaseAddress(struct Module* mod);
|
||||||
|
unsigned int Module_GetTopLeftAddress(struct Module* mod) ;
|
||||||
|
unsigned int Module_GetTopRightAddress(struct Module* mod);
|
||||||
|
unsigned int Module_GetBottomBaseAddress(struct Module* mod);
|
||||||
|
int Module_BottomAddressIsValid(struct Module* mod);
|
||||||
|
unsigned int Module_GetBottomLeftAddress(struct Module* mod);
|
||||||
|
unsigned int Module_GetBottomRightAddress(struct Module* mod);
|
||||||
|
unsigned int Module_SetTopIDelay(struct Module* mod,unsigned int chip,unsigned int value);
|
||||||
|
unsigned int Module_GetTopIDelay(struct Module* mod,unsigned int chip) ;
|
||||||
|
unsigned int Module_SetBottomIDelay(struct Module* mod,unsigned int chip,unsigned int value);
|
||||||
|
unsigned int Module_GetBottomIDelay(struct Module* mod,unsigned int chip);
|
||||||
|
|
||||||
class FebControl:private FebInterface{
|
float Module_SetHighVoltage(struct Module* mod,float value);
|
||||||
|
float Module_GetHighVoltage(struct Module* mod);
|
||||||
|
|
||||||
private:
|
int Module_SetTopDACValue(struct Module* mod,unsigned int i, int value);
|
||||||
|
int Module_GetTopDACValue(struct Module* mod,unsigned int i);
|
||||||
std::vector<Module*> modules;
|
int Module_SetBottomDACValue(struct Module* mod,unsigned int i, int value);
|
||||||
void ClearModules();
|
int Module_GetBottomDACValue(struct Module* mod,unsigned int i);
|
||||||
|
|
||||||
unsigned int staticBits; //program=1,m4=2,m8=4,test=8,rotest=16,cs_bar_left=32,cs_bar_right=64
|
|
||||||
unsigned int acquireNReadoutMode; //safe or parallel, half or full speed
|
|
||||||
unsigned int triggerMode; //internal timer, external start, external window, signal polarity (external trigger and enable)
|
|
||||||
unsigned int externalEnableMode; //external enabling engaged and it's polarity
|
|
||||||
unsigned int subFrameMode;
|
|
||||||
|
|
||||||
unsigned int photon_energy_eV;
|
|
||||||
|
|
||||||
unsigned int nimages;
|
|
||||||
float exposure_time_in_sec;
|
|
||||||
float exposure_period_in_sec;
|
|
||||||
|
|
||||||
unsigned int trimbit_size;
|
|
||||||
unsigned int* last_downloaded_trimbits;
|
|
||||||
|
|
||||||
void PrintModuleList();
|
|
||||||
bool GetModuleIndex(unsigned int module_number, unsigned int& module_index);
|
|
||||||
bool CheckModuleAddresses(Module* m);
|
|
||||||
bool AddModule(unsigned int module_number, unsigned int top_address);
|
|
||||||
bool AddModule(unsigned int module_number, unsigned int top_address, unsigned int bottom_address, bool half_module=0);
|
|
||||||
|
|
||||||
bool GetDACNumber(std::string s, unsigned int& n);
|
|
||||||
bool SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int& value);
|
|
||||||
bool VoltageToDAC(float value, unsigned int& digital, unsigned int nsteps, float vmin, float vmax);
|
|
||||||
float DACToVoltage(unsigned int digital,unsigned int nsteps,float vmin,float vmax);
|
|
||||||
|
|
||||||
bool SendHighVoltage(unsigned int module_index, float& value);
|
|
||||||
|
|
||||||
bool SendIDelays(unsigned int dst_num, bool chip_lr, unsigned int channels, unsigned int ndelay_units);
|
|
||||||
|
|
||||||
bool SetStaticBits();
|
|
||||||
bool SetStaticBits(unsigned int the_static_bits);
|
|
||||||
|
|
||||||
bool SendBitModeToBebServer();
|
|
||||||
|
|
||||||
unsigned int ConvertTimeToRegister(float time_in_sec);
|
|
||||||
|
|
||||||
unsigned int AddressToAll();
|
|
||||||
bool SetCommandRegister(unsigned int cmd);
|
|
||||||
bool GetDAQStatusRegister(unsigned int dst_address, unsigned int &ret_status);
|
|
||||||
bool StartDAQOnlyNWaitForFinish(int sleep_time_us=5000);
|
|
||||||
|
|
||||||
bool ResetChipCompletely();
|
|
||||||
|
|
||||||
struct sockaddr_in serv_addr;
|
|
||||||
bool SetupSendToSocket(const char* ip_address_hostname, unsigned short int port);
|
|
||||||
int WriteNRead(char* message, int length, int max_length);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
FebControl();
|
|
||||||
virtual ~FebControl();
|
|
||||||
|
|
||||||
bool Init();
|
|
||||||
bool ReadSetUpFileToAddModules(std::string file_name);
|
|
||||||
bool ReadSetUpFile(unsigned int module_num, std::string file_name);
|
|
||||||
bool CheckSetup();
|
|
||||||
|
|
||||||
unsigned int GetNModules();
|
|
||||||
unsigned int GetNHalfModules();
|
|
||||||
|
|
||||||
bool SetHighVoltage(float value);
|
|
||||||
bool SetHighVoltage(unsigned int module_num,float value);
|
|
||||||
|
|
||||||
bool SetPhotonEnergy(unsigned int full_energy_eV);
|
|
||||||
unsigned int GetPhotonEnergy(){return photon_energy_eV;}
|
|
||||||
|
|
||||||
bool SetIDelays(unsigned int module_num, unsigned int ndelay_units);
|
|
||||||
bool SetIDelays(unsigned int module_num, unsigned int chip_pos, unsigned int ndelay_units);
|
|
||||||
|
|
||||||
bool DecodeDACString(std::string dac_str, unsigned int& module_index, bool& top, bool& bottom, unsigned int& dac_ch);
|
|
||||||
bool SetDAC(std::string s, int value, bool is_a_voltage_mv=0);
|
|
||||||
bool GetDAC(std::string s, int& ret_value, bool voltage_mv=0);
|
|
||||||
bool GetDACName(unsigned int dac_num, std::string &s);
|
|
||||||
|
|
||||||
bool SetTrimbits(unsigned int module_num, unsigned int* trimbits);
|
|
||||||
unsigned int* GetTrimbits();
|
void Feb_Control_ClearModules();
|
||||||
|
|
||||||
|
|
||||||
|
void Feb_Control_PrintModuleList();
|
||||||
|
int Feb_Control_GetModuleIndex(unsigned int module_number, unsigned int* module_index);
|
||||||
|
int Feb_Control_CheckModuleAddresses(struct Module* m);
|
||||||
|
int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address);
|
||||||
|
/*int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address, unsigned int bottom_address, int half_module=0);*/
|
||||||
|
int Feb_Control_AddModule1(unsigned int module_number, unsigned int top_address, unsigned int bottom_address, int half_module);
|
||||||
|
|
||||||
|
int Feb_Control_GetDACNumber(char* s, unsigned int* n);
|
||||||
|
int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int* value);
|
||||||
|
int Feb_Control_VoltageToDAC(float value, unsigned int* digital, unsigned int nsteps, float vmin, float vmax);
|
||||||
|
float Feb_Control_DACToVoltage(unsigned int digital,unsigned int nsteps,float vmin,float vmax);
|
||||||
|
|
||||||
|
int Feb_Control_SendHighVoltage(unsigned int module_index, float* value);
|
||||||
|
|
||||||
|
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr, unsigned int channels, unsigned int ndelay_units);
|
||||||
|
|
||||||
|
int Feb_Control_SetStaticBits();
|
||||||
|
int Feb_Control_SetStaticBits1(unsigned int the_static_bits);
|
||||||
|
|
||||||
|
int Feb_Control_SendBitModeToBebServer();
|
||||||
|
|
||||||
|
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
|
||||||
|
|
||||||
|
unsigned int Feb_Control_AddressToAll();
|
||||||
|
int Feb_Control_SetCommandRegister(unsigned int cmd);
|
||||||
|
int Feb_Control_GetDAQStatusRegister(unsigned int dst_address, unsigned int* ret_status);
|
||||||
|
/*int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us=5000);*/
|
||||||
|
int Feb_Control_StartDAQOnlyNWaitForFinish(int sleep_time_us);
|
||||||
|
|
||||||
|
int Feb_Control_ResetChipCompletely();
|
||||||
|
|
||||||
|
struct sockaddr_in Feb_Control_serv_addr;
|
||||||
|
/*
|
||||||
|
int Feb_Control_SetupSendToSocket(const char* ip_address_hostname, unsigned short int port);
|
||||||
|
int Feb_Control_WriteNRead(char* message, int length, int max_length);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void Feb_Control_FebControl();
|
||||||
|
|
||||||
|
|
||||||
|
int Feb_Control_Init();
|
||||||
|
int Feb_Control_ReadSetUpFileToAddModules(char* file_name);
|
||||||
|
int Feb_Control_ReadSetUpFile(unsigned int module_num, char* file_name);
|
||||||
|
int Feb_Control_CheckSetup();
|
||||||
|
|
||||||
|
unsigned int Feb_Control_GetNModules();
|
||||||
|
unsigned int Feb_Control_GetNHalfModules();
|
||||||
|
|
||||||
|
int Feb_Control_SetHighVoltage(float value);
|
||||||
|
int Feb_Control_SetHighVoltage1(unsigned int module_num,float value);
|
||||||
|
|
||||||
|
int Feb_Control_SetPhotonEnergy(unsigned int full_energy_eV);
|
||||||
|
unsigned int Feb_Control_GetPhotonEnergy();
|
||||||
|
|
||||||
|
int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units);
|
||||||
|
int Feb_Control_SetIDelays1(unsigned int module_num, unsigned int chip_pos, unsigned int ndelay_units);
|
||||||
|
|
||||||
|
int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int* top, int* bottom, unsigned int* dac_ch);
|
||||||
|
/*int Feb_Control_SetDAC(string s, int value, int is_a_voltage_mv=0);*/
|
||||||
|
int Feb_Control_SetDAC(char* s, int value, int is_a_voltage_mv);
|
||||||
|
/* int Feb_Control_GetDAC(string s, int* ret_value, int voltage_mv=0);*/
|
||||||
|
int Feb_Control_GetDAC(char* s, int* ret_value, int voltage_mv);
|
||||||
|
int Feb_Control_GetDACName(unsigned int dac_num,char* s);
|
||||||
|
|
||||||
|
int Feb_Control_SetTrimbits(unsigned int module_num, unsigned int* trimbits);
|
||||||
|
unsigned int* Feb_Control_GetTrimbits();
|
||||||
|
|
||||||
|
|
||||||
/**Added by Dhanya */
|
/**Added by Dhanya */
|
||||||
bool LoadTrimbitFile();
|
int Feb_Control_LoadTrimbitFile();
|
||||||
bool SaveTrimbitFile();
|
int Feb_Control_SaveTrimbitFile();
|
||||||
bool SaveAllTrimbitsTo(int value);
|
int Feb_Control_SaveAllTrimbitsTo(int value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Reset();
|
int Feb_Control_Reset();
|
||||||
bool StartAcquisition();
|
int Feb_Control_StartAcquisition();
|
||||||
bool StopAcquisition();
|
int Feb_Control_StopAcquisition();
|
||||||
bool AcquisitionInProgress();
|
int Feb_Control_AcquisitionInProgress();
|
||||||
bool WaitForFinishedFlag(int sleep_time_us=5000);
|
/*int Feb_Control_WaitForFinishedFlag(int sleep_time_us=5000);*/
|
||||||
|
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
|
||||||
|
|
||||||
//functions for setting up exposure
|
//functions for setting up exposure
|
||||||
void PrintAcquisitionSetup();
|
void Feb_Control_PrintAcquisitionSetup();
|
||||||
bool SetNExposures(unsigned int n_images);
|
int Feb_Control_SetNExposures(unsigned int n_images);
|
||||||
unsigned int GetNExposures();
|
unsigned int Feb_Control_GetNExposures();
|
||||||
bool SetExposureTime(float the_exposure_time_in_sec);
|
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
||||||
float GetExposureTime();
|
double Feb_Control_GetExposureTime();
|
||||||
bool SetExposurePeriod(float the_exposure_period_in_sec);
|
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
||||||
float GetExposurePeriod();
|
double Feb_Control_GetExposurePeriod();
|
||||||
bool SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||||
unsigned int GetDynamicRange();
|
unsigned int Feb_Control_GetDynamicRange();
|
||||||
bool SetReadoutSpeed(unsigned int readout_speed=0); //0->full,1->half,2->quarter or 3->super_slow
|
/*int Feb_Control_SetReadoutSpeed(unsigned int readout_speed=0); //0->full,1->half,2->quarter or 3->super_slow*/
|
||||||
bool SetReadoutMode(unsigned int readout_mode=0); //0->parallel,1->non-parallel,2-> safe_mode
|
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); //0->full,1->half,2->quarter or 3->super_slow
|
||||||
bool SetTriggerMode(unsigned int trigger_mode=0, bool polarity=1);
|
/* int Feb_Control_SetReadoutMode(unsigned int readout_mode=0); //0->parallel,1->non-parallel,2-> safe_mode*/
|
||||||
bool SetExternalEnableMode(bool use_external_enable=0, bool polarity=1);
|
int Feb_Control_SetReadoutMode(unsigned int readout_mode); //0->parallel,1->non-parallel,2-> safe_mode
|
||||||
|
/* int Feb_Control_SetTriggerMode(unsigned int trigger_mode=0, int polarity=1);*/
|
||||||
|
int Feb_Control_SetTriggerMode(unsigned int trigger_mode, int polarity);
|
||||||
|
/*int Feb_Control_SetExternalEnableMode(int use_external_enable=0, int polarity=1);*/
|
||||||
|
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);
|
||||||
|
|
||||||
//functions for testing
|
//functions for testing
|
||||||
bool SetTestModeVariable(bool on=1);
|
/*int Feb_Control_SetTestModeVariable(int on=1);*/
|
||||||
bool GetTestModeVariable();
|
int Feb_Control_SetTestModeVariable(int on);
|
||||||
|
int Feb_Control_GetTestModeVariable();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,44 +10,31 @@
|
|||||||
|
|
||||||
#include "LocalLinkInterface.h"
|
#include "LocalLinkInterface.h"
|
||||||
|
|
||||||
class FebInterface{ //
|
|
||||||
|
|
||||||
private:
|
|
||||||
LocalLinkInterface* ll;
|
|
||||||
|
|
||||||
unsigned int nfebs;
|
|
||||||
unsigned int* feb_numb;
|
|
||||||
|
|
||||||
int send_ndata;
|
|
||||||
unsigned int send_buffer_size;
|
|
||||||
unsigned int* send_data_raw;
|
|
||||||
unsigned int* send_data;
|
|
||||||
|
|
||||||
int recv_ndata;
|
|
||||||
unsigned int recv_buffer_size;
|
|
||||||
unsigned int* recv_data_raw;
|
|
||||||
unsigned int* recv_data;
|
|
||||||
|
|
||||||
bool WriteTo(unsigned int ch);
|
|
||||||
bool ReadFrom(unsigned int ch, unsigned int ntrys=20);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
FebInterface();
|
|
||||||
virtual ~FebInterface();
|
|
||||||
|
|
||||||
void SendCompleteList(unsigned int n,unsigned int* list);
|
|
||||||
bool SetByteOrder();
|
|
||||||
|
|
||||||
bool ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int& value_read);
|
|
||||||
bool ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read);
|
|
||||||
|
|
||||||
bool WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, bool wait_on=0, unsigned int wait_on_address=0);
|
int Feb_Interface_WriteTo(unsigned int ch);
|
||||||
bool WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, bool* wait_ons=0, unsigned int* wait_on_addresses=0);
|
/*int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys=20);*/
|
||||||
|
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Feb_Interface_SendCompleteList(unsigned int n,unsigned int* list);
|
||||||
|
int Feb_Interface_SetByteOrder();
|
||||||
|
|
||||||
|
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int* value_read);
|
||||||
|
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read);
|
||||||
|
/*int Feb_Interface_WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, int wait_on=0, unsigned int wait_on_address=0);*/
|
||||||
|
int Feb_Interface_WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, int wait_on, unsigned int wait_on_address);
|
||||||
|
/*int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, int* wait_ons=0, unsigned int* wait_on_addresses=0);*/
|
||||||
|
int Feb_Interface_WriteRegisters(unsigned int sub_num, unsigned int nwrites, unsigned int* reg_nums, unsigned int* values, int* wait_ons, unsigned int* wait_on_addresses);
|
||||||
|
|
||||||
|
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
|
||||||
|
|
||||||
bool WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,24 +7,20 @@
|
|||||||
|
|
||||||
#include "xfs_types.h"
|
#include "xfs_types.h"
|
||||||
|
|
||||||
class HardwareIO{ //
|
|
||||||
|
|
||||||
protected:
|
|
||||||
xfs_u8 xfs_in8(xfs_u32 InAddress);
|
|
||||||
xfs_u16 xfs_in16(xfs_u32 InAddress);
|
|
||||||
xfs_u32 xfs_in32(xfs_u32 InAddress);
|
|
||||||
|
|
||||||
void xfs_out8(xfs_u32 OutAddress, xfs_u8 Value);
|
|
||||||
void xfs_out16(xfs_u32 OutAddress, xfs_u16 Value);
|
|
||||||
void xfs_out32(xfs_u32 OutAddress, xfs_u32 Value);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
xfs_u8 HWIO_xfs_in8(xfs_u32 InAddress);
|
||||||
HardwareIO(){};
|
xfs_u16 HWIO_xfs_in16(xfs_u32 InAddress);
|
||||||
virtual ~HardwareIO(){};
|
xfs_u32 HWIO_xfs_in32(xfs_u32 InAddress);
|
||||||
|
|
||||||
|
void HWIO_xfs_out8(xfs_u32 OutAddress, xfs_u8 Value);
|
||||||
|
void HWIO_xfs_out16(xfs_u32 OutAddress, xfs_u16 Value);
|
||||||
|
void HWIO_xfs_out32(xfs_u32 OutAddress, xfs_u32 Value);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,41 +7,44 @@
|
|||||||
#include "xfs_types.h"
|
#include "xfs_types.h"
|
||||||
#include "HardwareIO.h"
|
#include "HardwareIO.h"
|
||||||
|
|
||||||
class LocalLinkInterface: public HardwareIO{ //
|
/*class LocalLinkInterface: public HardwareIO{ //*/
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
|
struct LocalLinkInterface{
|
||||||
xfs_u32 ll_fifo_base;
|
xfs_u32 ll_fifo_base;
|
||||||
unsigned int ll_fifo_ctrl_reg;
|
unsigned int ll_fifo_ctrl_reg;
|
||||||
|
};
|
||||||
|
|
||||||
bool Init(unsigned int ll_fifo_badr);
|
|
||||||
bool Reset(unsigned int rst_mask);
|
|
||||||
|
|
||||||
bool ctrl_reg_write_mask(unsigned int mask, unsigned int val);
|
|
||||||
void llfifo_print_frame(unsigned char* fbuff, int len);
|
|
||||||
|
|
||||||
public:
|
int Local_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr);
|
||||||
LocalLinkInterface(unsigned int ll_fifo_badr);
|
int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask);
|
||||||
virtual ~LocalLinkInterface();
|
|
||||||
|
|
||||||
unsigned int StatusVector();
|
int Local_ctrl_reg_write_mask(struct LocalLinkInterface* ll,unsigned int mask, unsigned int val);
|
||||||
bool Reset();
|
void Local_llfifo_print_frame(struct LocalLinkInterface* ll,unsigned char* fbuff, int len);
|
||||||
int Write(unsigned int buffer_len, void *buffer);
|
|
||||||
int Read(unsigned int buffer_len, void *buffer);
|
|
||||||
|
|
||||||
int Test(unsigned int buffer_len, void *buffer);
|
|
||||||
|
|
||||||
LocalLinkInterface();
|
void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr);
|
||||||
int InitNewMemory (unsigned int addr, int ifg);
|
/* virtual ~LocalLinkInterface();*/
|
||||||
|
|
||||||
|
unsigned int Local_StatusVector(struct LocalLinkInterface* ll);
|
||||||
|
int Local_Reset(struct LocalLinkInterface* ll);
|
||||||
|
int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer);
|
||||||
|
int Local_Read(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);
|
||||||
|
int Local_InitNewMemory (struct LocalLinkInterface* ll,unsigned int addr, int ifg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
bool FiFoReset(unsigned int numb);
|
int FiFoReset(unsigned int numb);
|
||||||
int FifoSend(unsigned int numb, unsigned int frame_len, void *buffer);
|
int FifoSend(unsigned int numb, unsigned int frame_len, void *buffer);
|
||||||
int FifoReceive(unsigned int numb, unsigned int frame_len, void *buffer);
|
int FifoReceive(unsigned int numb, unsigned int frame_len, void *buffer);
|
||||||
int FifoTest(unsigned int numb,unsigned int send_len, char *send_str);
|
int FifoTest(unsigned int numb,unsigned int send_len, char *send_str);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
10
slsDetectorSoftware/eigerDetectorServer/Makefile
Normal file → Executable file
10
slsDetectorSoftware/eigerDetectorServer/Makefile
Normal file → Executable file
@ -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 -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE
|
CFLAGS += -Wall -DDACS_INT -DEIGERD -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT #-DSTOP_SERVER #-DVERBOSE #-DVIRTUAL -DPCCOMPILE
|
||||||
LDLIBS += -lm -lstdc++
|
LDLIBS += -lm -lstdc++
|
||||||
|
|
||||||
PROGS = eigerDetectorServer
|
PROGS = eigerDetectorServer
|
||||||
@ -8,14 +8,14 @@ DESTDIR ?= bin
|
|||||||
INSTMODE = 0777
|
INSTMODE = 0777
|
||||||
|
|
||||||
|
|
||||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c FebControl.c Beb.c HardwareIO.c LocalLinkInterface.c Feb.c FebInterface.c
|
||||||
SRC_CLNT2 = FebServer.cxx FebControl.cxx FebInterface.cxx LocalLinkInterface.cxx HardwareIO.cxx
|
#SRC_CLNT2 = FebServer.cxx FebControl.cxx FebInterface.cxx LocalLinkInterface.cxx HardwareIO.cxx
|
||||||
SRC_CLNT3 = BebServer.cxx Beb.cxx LocalLinkInterface.cxx HardwareIO.cxx
|
#SRC_CLNT3 = BebServer.cxx Beb.cxx LocalLinkInterface.cxx HardwareIO.cxx
|
||||||
|
|
||||||
OBJS = $(SRC_CLNT:.c=.o)
|
OBJS = $(SRC_CLNT:.c=.o)
|
||||||
|
|
||||||
|
|
||||||
all: clean $(PROGS) feb_debug beb_debug
|
all: clean $(PROGS) #feb_debug beb_debug
|
||||||
|
|
||||||
|
|
||||||
boot: $(OBJS)
|
boot: $(OBJS)
|
||||||
|
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 git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer
|
||||||
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: 046a469b1e6582c4c55bd6eaeb4818b618d0a9a9
|
Repsitory UUID: 8c994ea0d538628b36a9497508960388816749fa
|
||||||
Revision: 75
|
Revision: 87
|
||||||
Branch: separate_receiver
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Maliakal_Dhanya
|
||||||
Last Changed Rev: 14
|
Last Changed Rev: 278
|
||||||
Last Changed Date: 2014-06-03 12:26:45 +0200
|
Last Changed Date: 2014-08-08 14:03:30 +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 "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/eigerDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "046a469b1e6582c4c55bd6eaeb4818b618d0a9a9"
|
#define SVNREPUUID "8c994ea0d538628b36a9497508960388816749fa"
|
||||||
//#define SVNREV 0x14
|
//#define SVNREV 0x278
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Maliakal_Dhanya"
|
#define SVNAUTH "Maliakal_Dhanya"
|
||||||
#define SVNREV 0x14
|
#define SVNREV 0x278
|
||||||
#define SVNDATE 0x20140603
|
#define SVNDATE 0x20140808
|
||||||
//
|
//
|
||||||
|
@ -8,11 +8,15 @@
|
|||||||
|
|
||||||
#include "slsDetectorFunctionList.h"
|
#include "slsDetectorFunctionList.h"
|
||||||
#include "gitInfoEiger.h"
|
#include "gitInfoEiger.h"
|
||||||
#include "EigerHighLevelFunctions.c"
|
/*#include "EigerHighLevelFunctions.c"
|
||||||
#include "EigerBackEndFunctions.c"
|
#include "EigerBackEndFunctions.c"*/
|
||||||
|
#include "FebControl.h"
|
||||||
|
#include "Beb.h"
|
||||||
|
|
||||||
|
|
||||||
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"};
|
||||||
|
|
||||||
//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;
|
||||||
@ -22,6 +26,29 @@ dacs_t *detectorDacs=NULL;
|
|||||||
dacs_t *detectorAdcs=NULL;
|
dacs_t *detectorAdcs=NULL;
|
||||||
|
|
||||||
|
|
||||||
|
int eiger_highvoltage = 0;
|
||||||
|
int eiger_iodelay = 0;
|
||||||
|
int eiger_photonenergy = 0;
|
||||||
|
int eiger_dynamicrange = 0;
|
||||||
|
int eiger_readoutmode = 0;
|
||||||
|
int eiger_readoutspeed = 0;
|
||||||
|
int eiger_triggermode = 0;
|
||||||
|
int eiger_extgating = 0;
|
||||||
|
int eiger_extgatingpolarity = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int eiger_nexposures = 1;
|
||||||
|
int eiger_ncycles = 1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int send_to_ten_gig = 0;
|
||||||
|
int ndsts_in_use=32;
|
||||||
|
unsigned int nimages_per_request=1;
|
||||||
|
int on_dst=0;
|
||||||
|
int dst_requested[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
|
|
||||||
int initDetector(){
|
int initDetector(){
|
||||||
int imod,i,n;
|
int imod,i,n;
|
||||||
@ -70,6 +97,12 @@ int initDetector(){
|
|||||||
sAdc=noneSelected;
|
sAdc=noneSelected;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
Feb_Interface_FebInterface();
|
||||||
|
Feb_Control_FebControl();
|
||||||
|
printf("FEb control constructor done\n");
|
||||||
|
Beb_Beb(-1);
|
||||||
|
printf("BEB constructor done\n");
|
||||||
|
|
||||||
//get dac values
|
//get dac values
|
||||||
int retval[2];
|
int retval[2];
|
||||||
for(i=0;i<(detectorModules)->ndac;i++){
|
for(i=0;i<(detectorModules)->ndac;i++){
|
||||||
@ -83,7 +116,7 @@ int initDetector(){
|
|||||||
//set number of frames to 1
|
//set number of frames to 1
|
||||||
setTimer(FRAME_NUMBER,1);
|
setTimer(FRAME_NUMBER,1);
|
||||||
setTimer(ACQUISITION_TIME,1E9);
|
setTimer(ACQUISITION_TIME,1E9);
|
||||||
setTimer(ACQUISITION_TIME,1E9);
|
setTimer(FRAME_PERIOD,1E9);
|
||||||
setDynamicRange(16);
|
setDynamicRange(16);
|
||||||
setThresholdEnergy(8000,0);
|
setThresholdEnergy(8000,0);
|
||||||
setReadOutFlags(PARALLEL);
|
setReadOutFlags(PARALLEL);
|
||||||
@ -227,7 +260,13 @@ int detectorTest( enum digitalTestMode arg){
|
|||||||
|
|
||||||
void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){
|
void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){
|
||||||
char iname[10];
|
char iname[10];
|
||||||
strcpy(iname,EigerGetDACName((int)ind));
|
|
||||||
|
if(((int)ind>=0)&&((int)ind<NDAC))
|
||||||
|
strcpy(iname,dac_names[(int)ind]);
|
||||||
|
else{
|
||||||
|
printf("dac value outside range:%d\n",(int)ind);
|
||||||
|
strcpy(iname,dac_names[0]);
|
||||||
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(val >= 0)
|
if(val >= 0)
|
||||||
printf("Setting dac %d: %s to %d ",ind, iname,val);
|
printf("Setting dac %d: %s to %d ",ind, iname,val);
|
||||||
@ -239,9 +278,12 @@ void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){
|
|||||||
printf("in dac units\n");
|
printf("in dac units\n");
|
||||||
#endif
|
#endif
|
||||||
if(val >= 0)
|
if(val >= 0)
|
||||||
EigerSetDAC(iname,val,mV);
|
Feb_Control_SetDAC(iname,val,mV);
|
||||||
retval[0] = EigerGetDAC(iname);
|
int k;
|
||||||
retval[1] = EigerGetDACmV(iname);
|
Feb_Control_GetDAC(iname, &k,0);
|
||||||
|
retval[0] = k;
|
||||||
|
Feb_Control_GetDAC(iname,&k,1);
|
||||||
|
retval[1] = k;
|
||||||
|
|
||||||
(detectorModules)->dacs[ind] = retval[0];
|
(detectorModules)->dacs[ind] = retval[0];
|
||||||
|
|
||||||
@ -251,9 +293,10 @@ void setDAC(enum detDacIndex ind, int val, int imod, int mV, int retval[]){
|
|||||||
int setHighVolage(int val, int imod){
|
int setHighVolage(int val, int imod){
|
||||||
if(val!=-1){
|
if(val!=-1){
|
||||||
printf(" Setting High Voltage: %d\n",val);
|
printf(" Setting High Voltage: %d\n",val);
|
||||||
EigerSetHighVoltage(val);
|
if(Feb_Control_SetHighVoltage(val))
|
||||||
|
eiger_highvoltage = val;
|
||||||
}
|
}
|
||||||
return EigerGetHighVoltage();
|
return eiger_highvoltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -266,21 +309,25 @@ int getADC(enum detDacIndex ind, int imod){
|
|||||||
int setIODelay(int val, int imod){
|
int setIODelay(int val, int imod){
|
||||||
if(val!=-1){
|
if(val!=-1){
|
||||||
printf(" Setting IO Delay: %d\n",val);
|
printf(" Setting IO Delay: %d\n",val);
|
||||||
EigerSetIODelay(val);
|
if(Feb_Control_SetIDelays(0,val))
|
||||||
|
eiger_iodelay = val;
|
||||||
}
|
}
|
||||||
return EigerGetIODelay();
|
return eiger_iodelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int enableTenGigabitEthernet(int val){
|
int enableTenGigabitEthernet(int val){
|
||||||
if(val!=-1){
|
if(val!=-1){
|
||||||
if(val>0)
|
if(val>0)
|
||||||
SetTenGigbaBitEthernet(1);
|
send_to_ten_gig = 1;
|
||||||
else
|
else
|
||||||
SetTenGigbaBitEthernet(0);
|
send_to_ten_gig = 0;
|
||||||
//configuremac called from client
|
//configuremac called from client
|
||||||
}
|
}
|
||||||
return GetTenGigbaBitEthernet();
|
//#ifdef VERBOSE
|
||||||
|
printf("10Gbe:%d\n",send_to_ten_gig);
|
||||||
|
//#endif
|
||||||
|
return send_to_ten_gig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -297,11 +344,13 @@ int setModule(sls_detector_module myMod){
|
|||||||
// thisSettings = (enum detectorSettings)myMod.reg;
|
// thisSettings = (enum detectorSettings)myMod.reg;
|
||||||
// thisSettings = 0;
|
// thisSettings = 0;
|
||||||
|
|
||||||
setSettings( (enum detectorSettings)myMod.reg,-1); // put the settings in the module register?!?!?
|
|
||||||
EigerSetTrimbits(myMod.chanregs);
|
|
||||||
|
|
||||||
if (detectorModules)
|
if (detectorModules)
|
||||||
copyModule(detectorModules,&myMod);
|
copyModule(detectorModules,&myMod);
|
||||||
|
|
||||||
|
setSettings( (enum detectorSettings)myMod.reg,-1); // put the settings in the module register?!?!?
|
||||||
|
Feb_Control_SetTrimbits(0,myMod.chanregs);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,10 +361,10 @@ int retval[2];
|
|||||||
for(i=0;i<NDAC;i++)
|
for(i=0;i<NDAC;i++)
|
||||||
setDAC((enum detDacIndex)i,-1,-1,0,retval);
|
setDAC((enum detDacIndex)i,-1,-1,0,retval);
|
||||||
|
|
||||||
EigerGetTrimbits(myMod->chanregs);
|
myMod->chanregs = Feb_Control_GetTrimbits();
|
||||||
|
|
||||||
if (detectorModules)
|
if (detectorModules)
|
||||||
copyModule(myMod,detectorModules);/*copyModule(myMod,detectorModules+iMod);*/
|
copyModule(myMod,detectorModules);
|
||||||
else
|
else
|
||||||
return FAIL;
|
return FAIL;
|
||||||
return OK;
|
return OK;
|
||||||
@ -328,14 +377,15 @@ int retval[2];
|
|||||||
|
|
||||||
int getThresholdEnergy(int imod){
|
int getThresholdEnergy(int imod){
|
||||||
printf(" Getting Threshold energy\n");
|
printf(" Getting Threshold energy\n");
|
||||||
return EigerGetPhotonEnergy();
|
return eiger_photonenergy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int setThresholdEnergy(int thr, int imod){
|
int setThresholdEnergy(int thr, int imod){
|
||||||
printf(" Setting threshold energy:%d\n",thr);
|
printf(" Setting threshold energy:%d\n",thr);
|
||||||
EigerSetPhotonEnergy(thr);
|
if(Feb_Control_SetPhotonEnergy(thr))
|
||||||
return EigerGetPhotonEnergy();
|
eiger_photonenergy = thr;
|
||||||
|
return getThresholdEnergy(imod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -352,27 +402,61 @@ enum detectorSettings setSettings(enum detectorSettings sett, int imod){
|
|||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
printf("Going to start acquisition\n");
|
printf("Going to start acquisition\n");
|
||||||
EigerStartAcquisition();
|
if(Feb_Control_StartAcquisition()){
|
||||||
RequestImages();
|
|
||||||
|
//RequestImages();
|
||||||
|
int ret_val = 0;
|
||||||
|
dst_requested[0] = 1;
|
||||||
|
while(dst_requested[on_dst]){
|
||||||
|
//waits on data
|
||||||
|
if((ret_val = (!Beb_RequestNImages(0,1,send_to_ten_gig,on_dst,nimages_per_request,0)||
|
||||||
|
!Beb_RequestNImages(0,2,send_to_ten_gig,0x20|on_dst,nimages_per_request,0))))
|
||||||
|
break;
|
||||||
|
dst_requested[on_dst++]=0;
|
||||||
|
on_dst%=ndsts_in_use;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret_val)
|
||||||
|
return FAIL;
|
||||||
|
else
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int stopStateMachine(){
|
int stopStateMachine(){
|
||||||
printf("Going to stop acquisition\n");
|
printf("Going to stop acquisition\n");
|
||||||
EigerStopAcquisition();
|
if(Feb_Control_StopAcquisition())
|
||||||
return OK;
|
return OK;
|
||||||
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int startReadOut(){
|
int startReadOut(){
|
||||||
RequestImages();
|
//RequestImages();
|
||||||
|
int ret_val = 0;
|
||||||
|
dst_requested[0] = 1;
|
||||||
|
while(dst_requested[on_dst]){
|
||||||
|
//waits on data
|
||||||
|
if((ret_val = (!Beb_RequestNImages(0,1,send_to_ten_gig,on_dst,nimages_per_request,0)||
|
||||||
|
!Beb_RequestNImages(0,2,send_to_ten_gig,0x20|on_dst,nimages_per_request,0))))
|
||||||
|
break;
|
||||||
|
dst_requested[on_dst++]=0;
|
||||||
|
on_dst%=ndsts_in_use;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret_val)
|
||||||
|
return FAIL;
|
||||||
|
else
|
||||||
|
return OK;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
enum runStatus getRunStatus(){
|
enum runStatus getRunStatus(){
|
||||||
int i = EigerRunStatus();
|
int i = Feb_Control_AcquisitionInProgress();
|
||||||
if(i== 0){
|
if(i== 0){
|
||||||
printf("IDLE\n");
|
printf("IDLE\n");
|
||||||
return IDLE;
|
return IDLE;
|
||||||
@ -385,13 +469,8 @@ enum runStatus getRunStatus(){
|
|||||||
|
|
||||||
|
|
||||||
char *readFrame(int *ret, char *mess){
|
char *readFrame(int *ret, char *mess){
|
||||||
EigerWaitForAcquisitionFinish();
|
if(!Feb_Control_WaitForFinishedFlag(5000))
|
||||||
/*
|
printf("error in waiting for finished flag\n");
|
||||||
int i = EigerRunStatus();
|
|
||||||
while(i){
|
|
||||||
i = EigerRunStatus();
|
|
||||||
usleep(1000);
|
|
||||||
}*/
|
|
||||||
*ret = (int)FINISHED;
|
*ret = (int)FINISHED;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -408,19 +487,27 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
|||||||
case FRAME_NUMBER:
|
case FRAME_NUMBER:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting number of frames: %d\n",(unsigned int)val);
|
printf(" Setting number of frames: %d\n",(unsigned int)val);
|
||||||
EigerSetNumberOfExposures((unsigned int)val);
|
if(Feb_Control_SetNExposures((unsigned int)val)*eiger_ncycles){
|
||||||
SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
eiger_nexposures = val;
|
||||||
}return EigerGetNumberOfExposures();
|
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||||
|
on_dst = 0;
|
||||||
|
int i;
|
||||||
|
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||||
|
ndsts_in_use = 1;
|
||||||
|
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||||
|
}
|
||||||
|
}return eiger_nexposures;
|
||||||
case ACQUISITION_TIME:
|
case ACQUISITION_TIME:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting exp time: %fs\n",val/(1E9));
|
printf(" Setting exp time: %fs\n",val/(1E9));
|
||||||
EigerSetExposureTime(val/(1E9));
|
Feb_Control_SetExposureTime(val/(1E9));
|
||||||
}return (EigerGetExposureTime()*(1E9));
|
}
|
||||||
|
return (Feb_Control_GetExposureTime()*(1E9));
|
||||||
case FRAME_PERIOD:
|
case FRAME_PERIOD:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting acq period: %fs\n",val/(1E9));
|
printf(" Setting acq period: %fs\n",val/(1E9));
|
||||||
EigerSetExposurePeriod(val/(1E9));
|
Feb_Control_SetExposurePeriod(val/(1E9));
|
||||||
}return (EigerGetExposurePeriod()*(1E9));
|
}return (Feb_Control_GetExposurePeriod()*(1E9));
|
||||||
/* case DELAY_AFTER_TRIGGER:
|
/* case DELAY_AFTER_TRIGGER:
|
||||||
if(val >= 0)
|
if(val >= 0)
|
||||||
EigerSetNumberOfExposures((unsigned int)val);
|
EigerSetNumberOfExposures((unsigned int)val);
|
||||||
@ -438,9 +525,15 @@ int64_t setTimer(enum timerIndex ind, int64_t val){
|
|||||||
case CYCLES_NUMBER:
|
case CYCLES_NUMBER:
|
||||||
if(val >= 0){
|
if(val >= 0){
|
||||||
printf(" Setting number of triggers: %d\n",(unsigned int)val);
|
printf(" Setting number of triggers: %d\n",(unsigned int)val);
|
||||||
EigerSetNumberOfCycles((unsigned int)val);
|
if(Feb_Control_SetNExposures((unsigned int)val*eiger_nexposures)){
|
||||||
SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
eiger_ncycles = val;
|
||||||
}return EigerGetNumberOfCycles();
|
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||||
|
on_dst = 0;
|
||||||
|
int i;
|
||||||
|
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||||
|
nimages_per_request = eiger_nexposures * eiger_ncycles;
|
||||||
|
}
|
||||||
|
}return eiger_ncycles;
|
||||||
default:
|
default:
|
||||||
printf("unknown timer index: %d\n",ind);
|
printf("unknown timer index: %d\n",ind);
|
||||||
break;
|
break;
|
||||||
@ -460,18 +553,22 @@ int64_t getTimeLeft(enum timerIndex ind){
|
|||||||
|
|
||||||
|
|
||||||
int setDynamicRange(int dr){
|
int setDynamicRange(int dr){
|
||||||
int r;
|
|
||||||
if(dr > 0){
|
if(dr > 0){
|
||||||
printf(" Setting dynamic range: %d\n",dr);
|
printf(" Setting dynamic range: %d\n",dr);
|
||||||
EigerSetDynamicRange(dr);
|
if(Feb_Control_SetDynamicRange(dr)){
|
||||||
EigerSetBitMode(dr);
|
|
||||||
|
//EigerSetBitMode(dr);
|
||||||
|
on_dst = 0;
|
||||||
|
int i;
|
||||||
|
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||||
|
if(Beb_SetUpTransferParameters(dr))
|
||||||
|
eiger_dynamicrange = dr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//make sure back end and front end have the same bit mode
|
//make sure back end and front end have the same bit mode
|
||||||
r= EigerGetDynamicRange();
|
dr= Feb_Control_GetDynamicRange();
|
||||||
if(r != EigerGetBitMode())
|
|
||||||
EigerSetBitMode(r);
|
|
||||||
|
|
||||||
return r;
|
return dr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -486,9 +583,10 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val){
|
|||||||
default: val=0; break;
|
default: val=0; break;
|
||||||
}
|
}
|
||||||
printf(" Setting Read out Flag: %d\n",val);
|
printf(" Setting Read out Flag: %d\n",val);
|
||||||
EigerSetReadoutMode(val);
|
if(Feb_Control_SetReadoutMode(val))
|
||||||
|
eiger_readoutmode = val;
|
||||||
}
|
}
|
||||||
switch(EigerGetReadoutMode()){
|
switch(eiger_readoutmode){
|
||||||
case 0: ret=PARALLEL; break;
|
case 0: ret=PARALLEL; break;
|
||||||
case 1: ret=NONPARALLEL; break;
|
case 1: ret=NONPARALLEL; break;
|
||||||
case 2: ret=SAFE; break;
|
case 2: ret=SAFE; break;
|
||||||
@ -510,9 +608,10 @@ int setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
|||||||
int setSpeed(enum speedVariable arg, int val){
|
int setSpeed(enum speedVariable arg, int val){
|
||||||
if(val != -1){
|
if(val != -1){
|
||||||
printf(" Setting Read out Speed: %d\n",val);
|
printf(" Setting Read out Speed: %d\n",val);
|
||||||
EigerSetReadoutSpeed(val);
|
if(Feb_Control_SetReadoutSpeed(val))
|
||||||
|
eiger_readoutspeed = val;
|
||||||
}
|
}
|
||||||
return EigerGetReadoutSpeed();
|
return eiger_readoutspeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -523,9 +622,58 @@ 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 ival){
|
int configureMAC(int ipad, long long int macad, long long int detectormacadd, int detipad, int udpport, int ival){
|
||||||
EigerSetupTableEntryLeft(ipad, macad, detectormacadd, detipad, udpport);
|
char src_mac[50], src_ip[50],dst_mac[50], dst_ip[50];
|
||||||
EigerSetupTableEntryRight(ipad, macad, detectormacadd, detipad, udpport);
|
int src_port = 0xE185;
|
||||||
SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
int dst_port = udpport;
|
||||||
|
sprintf(src_ip,"%d.%d.%d.%d",(detipad>>24)&0xff,(detipad>>16)&0xff,(detipad>>8)&0xff,(detipad)&0xff);
|
||||||
|
sprintf(dst_ip,"%d.%d.%d.%d",(ipad>>24)&0xff,(ipad>>16)&0xff,(ipad>>8)&0xff,(ipad)&0xff);
|
||||||
|
sprintf(src_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((detectormacadd>>40)&0xFF),
|
||||||
|
(unsigned int)((detectormacadd>>32)&0xFF),
|
||||||
|
(unsigned int)((detectormacadd>>24)&0xFF),
|
||||||
|
(unsigned int)((detectormacadd>>16)&0xFF),
|
||||||
|
(unsigned int)((detectormacadd>>8)&0xFF),
|
||||||
|
(unsigned int)((detectormacadd>>0)&0xFF));
|
||||||
|
sprintf(dst_mac,"%02x:%02x:%02x:%02x:%02x:%02x",(unsigned int)((macad>>40)&0xFF),
|
||||||
|
(unsigned int)((macad>>32)&0xFF),
|
||||||
|
(unsigned int)((macad>>24)&0xFF),
|
||||||
|
(unsigned int)((macad>>16)&0xFF),
|
||||||
|
(unsigned int)((macad>>8)&0xFF),
|
||||||
|
(unsigned int)((macad>>0)&0xFF));
|
||||||
|
|
||||||
|
printf("Seting up Table Entry Left:\n");
|
||||||
|
printf("src_port:%d\n",src_port);
|
||||||
|
printf("dst_port:%d\n",dst_port);
|
||||||
|
printf("src_ip:%s\n",src_ip);
|
||||||
|
printf("dst_ip:%s\n",dst_ip);
|
||||||
|
printf("src_mac:%s\n",src_mac);
|
||||||
|
printf("dst_mac:%s\n\n",dst_mac);
|
||||||
|
|
||||||
|
int beb_num = 34;
|
||||||
|
int header_number = 0;
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
//EigerSetupTableEntryLeft(ipad, macad, detectormacadd, detipad, udpport);
|
||||||
|
/* for(i=0;i<32;i++){/** modified for Aldo*/
|
||||||
|
if(Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
||||||
|
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port))
|
||||||
|
printf("set up left ok\n");
|
||||||
|
else return -1;
|
||||||
|
/*}*/
|
||||||
|
//EigerSetupTableEntryRight(ipad, macad, detectormacadd, detipad, udpport);
|
||||||
|
header_number = 32;
|
||||||
|
dst_port = udpport +1;
|
||||||
|
/*for(i=0;i<32;i++){*//** modified for Aldo*/
|
||||||
|
if(Beb_SetBebSrcHeaderInfos(beb_num,send_to_ten_gig,src_mac,src_ip,src_port) &&
|
||||||
|
Beb_SetUpUDPHeader(beb_num,send_to_ten_gig,header_number+i,dst_mac,dst_ip, dst_port))
|
||||||
|
printf("set up right ok\n");
|
||||||
|
else return -1;
|
||||||
|
/*}*/
|
||||||
|
//SetDestinationParameters(EigerGetNumberOfExposures()*EigerGetNumberOfCycles());
|
||||||
|
on_dst = 0;
|
||||||
|
|
||||||
|
for(i=0;i<32;i++) dst_requested[i] = 0; //clear dst requested
|
||||||
|
nimages_per_request=eiger_nexposures * eiger_ncycles;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,10 +803,11 @@ enum externalCommunicationMode setTiming( enum externalCommunicationMode arg){
|
|||||||
case GATE_FIX_NUMBER: ret = 3; break;
|
case GATE_FIX_NUMBER: ret = 3; break;
|
||||||
}
|
}
|
||||||
printf(" Setting Triggering Mode: %d\n",(int)ret);
|
printf(" Setting Triggering Mode: %d\n",(int)ret);
|
||||||
EigerSetTriggerMode(ret);
|
if(Feb_Control_SetTriggerMode(ret,1))
|
||||||
|
eiger_triggermode = ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = EigerGetTriggerMode();
|
ret = eiger_triggermode;
|
||||||
switch((int)ret){
|
switch((int)ret){
|
||||||
case 0: ret = AUTO_TIMING; break;
|
case 0: ret = AUTO_TIMING; break;
|
||||||
case 2: ret = TRIGGER_EXPOSURE; break;
|
case 2: ret = TRIGGER_EXPOSURE; break;
|
||||||
@ -673,10 +822,13 @@ enum externalCommunicationMode setTiming( enum externalCommunicationMode arg){
|
|||||||
|
|
||||||
|
|
||||||
void setExternalGating(int enable[]){
|
void setExternalGating(int enable[]){
|
||||||
if(enable>=0)
|
if(enable>=0){
|
||||||
EigerSetExternalGating(enable[0], enable[1]);//enable = 0 or 1, polarity = 0 or 1 , where 1 is positive
|
Feb_Control_SetExternalEnableMode(enable[0], enable[1]);//enable = 0 or 1, polarity = 0 or 1 , where 1 is positive
|
||||||
enable[0] = EigerGetExternalGatingPolarity();
|
eiger_extgating = enable[0];
|
||||||
enable[1] = EigerGetExternalGating();
|
eiger_extgatingpolarity = enable[1];
|
||||||
|
}
|
||||||
|
enable[0] = eiger_extgating;
|
||||||
|
enable[1] = eiger_extgatingpolarity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -692,7 +844,7 @@ enum synchronizationMode setSynchronization(enum synchronizationMode arg){
|
|||||||
|
|
||||||
void setAllTrimbits(int val){
|
void setAllTrimbits(int val){
|
||||||
int ichan;
|
int ichan;
|
||||||
EigerSetAllTrimbits(val);
|
if(Feb_Control_SaveAllTrimbitsTo(val)){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Copying register %x value %d\n",destMod->reg,val);
|
printf("Copying register %x value %d\n",destMod->reg,val);
|
||||||
#endif
|
#endif
|
||||||
@ -701,6 +853,7 @@ void setAllTrimbits(int val){
|
|||||||
*((detectorModules->chanregs)+ichan)=val;
|
*((detectorModules->chanregs)+ichan)=val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else printf("error in setting all trimbits to value\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
int getAllTrimbits(){
|
int getAllTrimbits(){
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef __XFS_TYPES_H__
|
#ifndef __XFS_TYPES_H__
|
||||||
#define __XFS_TYPES_H__
|
#define __XFS_TYPES_H__
|
||||||
|
|
||||||
|
//#include "types.h"
|
||||||
|
#include <stdint.h>
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/* types */
|
/* types */
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
@ -15,33 +17,33 @@ typedef signed char xfs_i8;
|
|||||||
|
|
||||||
|
|
||||||
// UDP Header
|
// UDP Header
|
||||||
typedef struct
|
struct udp_header_type
|
||||||
{
|
{
|
||||||
// ethternet frame (14 byte)
|
// ethternet frame (14 byte)
|
||||||
unsigned char dst_mac[6];
|
uint8_t dst_mac[6];
|
||||||
unsigned char src_mac[6];
|
uint8_t src_mac[6];
|
||||||
unsigned char len_type[2];
|
uint8_t len_type[2];
|
||||||
|
|
||||||
// ip header (20 byte)
|
// ip header (20 byte)
|
||||||
unsigned char ver_headerlen[1];
|
uint8_t ver_headerlen[1];
|
||||||
unsigned char service_type[1];
|
uint8_t service_type[1];
|
||||||
unsigned char total_length[2];
|
uint8_t total_length[2];
|
||||||
unsigned char identification[2];
|
uint8_t identification[2];
|
||||||
unsigned char flags[1];
|
uint8_t flags[1];
|
||||||
unsigned char frag_offset[1];
|
uint8_t frag_offset[1];
|
||||||
unsigned char time_to_live[1];
|
uint8_t time_to_live[1];
|
||||||
unsigned char protocol[1];
|
uint8_t protocol[1];
|
||||||
unsigned char ip_header_checksum[2];
|
uint8_t ip_header_checksum[2];
|
||||||
unsigned char src_ip[4];
|
uint8_t src_ip[4];
|
||||||
unsigned char dst_ip[4];
|
uint8_t dst_ip[4];
|
||||||
|
|
||||||
// udp header (8 byte)
|
// udp header (8 byte)
|
||||||
unsigned char src_port[2];
|
uint8_t src_port[2];
|
||||||
unsigned char dst_port[2];
|
uint8_t dst_port[2];
|
||||||
unsigned char udp_message_len[2];
|
uint8_t udp_message_len[2];
|
||||||
unsigned char udp_checksum[2];
|
uint8_t udp_checksum[2];
|
||||||
|
|
||||||
} udp_header_type;
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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 git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: 046a469b1e6582c4c55bd6eaeb4818b618d0a9a9
|
Repsitory UUID: 8c994ea0d538628b36a9497508960388816749fa
|
||||||
Revision: 833
|
Revision: 848
|
||||||
Branch: separate_receiver
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Maliakal_Dhanya
|
||||||
Last Changed Rev: 833
|
Last Changed Rev: 848
|
||||||
Last Changed Date: 2014-06-03 12:26:45 +0200
|
Last Changed Date: 2014-08-08 14:03:30 +0200
|
||||||
|
@ -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 git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer
|
||||||
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: 046a469b1e6582c4c55bd6eaeb4818b618d0a9a9
|
Repsitory UUID: 8c994ea0d538628b36a9497508960388816749fa
|
||||||
Revision: 169
|
Revision: 172
|
||||||
Branch: separate_receiver
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Maliakal_Dhanya
|
||||||
Last Changed Rev: 14
|
Last Changed Rev: 278
|
||||||
Last Changed Date: 2014-06-03 12:26:45 +0200
|
Last Changed Date: 2014-08-08 14:03:30 +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 "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/gotthardDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "046a469b1e6582c4c55bd6eaeb4818b618d0a9a9"
|
#define SVNREPUUID "8c994ea0d538628b36a9497508960388816749fa"
|
||||||
//#define SVNREV 0x14
|
//#define SVNREV 0x278
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Maliakal_Dhanya"
|
#define SVNAUTH "Maliakal_Dhanya"
|
||||||
#define SVNREV 0x14
|
#define SVNREV 0x278
|
||||||
#define SVNDATE 0x20140603
|
#define SVNDATE 0x20140808
|
||||||
//
|
//
|
||||||
|
@ -1012,7 +1012,7 @@ int set_dac(int file_des) {
|
|||||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
/* send return argument */
|
/* send return argument */
|
||||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
n += sendDataOnly(file_des,retval,sizeof(retval));
|
||||||
} else {
|
} else {
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@ int masterMode=NO_MASTER, syncMode=NO_SYNCHRONIZATION, timingMode=AUTO_TIMING;
|
|||||||
|
|
||||||
enum externalSignalFlag signals[4]={EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF};
|
enum externalSignalFlag signals[4]={EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF, EXT_SIG_OFF};
|
||||||
|
|
||||||
int withGotthard = 0;
|
|
||||||
|
|
||||||
#ifdef MCB_FUNCS
|
#ifdef MCB_FUNCS
|
||||||
extern const int nChans;
|
extern const int nChans;
|
||||||
@ -286,9 +285,6 @@ int cleanFifo(){
|
|||||||
printf("Cleaning FIFO\n");
|
printf("Cleaning FIFO\n");
|
||||||
addr=ADC_SYNC_REG;
|
addr=ADC_SYNC_REG;
|
||||||
|
|
||||||
if(withGotthard)
|
|
||||||
adc_sync = GOTTHARD_ADCSYNC_VAL;
|
|
||||||
else
|
|
||||||
adc_sync = ADCSYNC_VAL;
|
adc_sync = ADCSYNC_VAL;
|
||||||
|
|
||||||
|
|
||||||
@ -1404,19 +1400,7 @@ int setADC(int adc){
|
|||||||
setDAQRegister();//token timing
|
setDAQRegister();//token timing
|
||||||
cleanFifo();//adc sync
|
cleanFifo();//adc sync
|
||||||
|
|
||||||
//with gotthard module
|
/* if(adc==-1){*/
|
||||||
if(withGotthard){
|
|
||||||
//set packet size
|
|
||||||
ipPacketSize= DEFAULT_IP_PACKETSIZE;
|
|
||||||
udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
|
||||||
//set channel mask
|
|
||||||
nchips = GOTTHARDNCHIP;
|
|
||||||
nchans = GOTTHARDNCHAN;
|
|
||||||
mask = ACTIVE_ADC_MASK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//with moench module all adc
|
|
||||||
else{/* if(adc==-1){*/
|
|
||||||
//set packet size
|
//set packet size
|
||||||
ipPacketSize= DEFAULT_IP_PACKETSIZE;
|
ipPacketSize= DEFAULT_IP_PACKETSIZE;
|
||||||
udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
udpPacketSize=DEFAULT_UDP_PACKETSIZE;
|
||||||
@ -1424,7 +1408,7 @@ int setADC(int adc){
|
|||||||
nchips = NCHIP;
|
nchips = NCHIP;
|
||||||
nchans = NCHANS;
|
nchans = NCHANS;
|
||||||
mask = ACTIVE_ADC_MASK;
|
mask = ACTIVE_ADC_MASK;
|
||||||
}/*
|
/*
|
||||||
//with moench module 1 adc -- NOT IMPLEMENTED
|
//with moench module 1 adc -- NOT IMPLEMENTED
|
||||||
else{
|
else{
|
||||||
ipPacketSize= ADC1_IP_PACKETSIZE;
|
ipPacketSize= ADC1_IP_PACKETSIZE;
|
||||||
|
@ -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 git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer
|
||||||
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: 046a469b1e6582c4c55bd6eaeb4818b618d0a9a9
|
Repsitory UUID: 8c994ea0d538628b36a9497508960388816749fa
|
||||||
Revision: 55
|
Revision: 57
|
||||||
Branch: separate_receiver
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Maliakal_Dhanya
|
||||||
Last Changed Rev: 14
|
Last Changed Rev: 278
|
||||||
Last Changed Date: 2014-06-03 12:26:45 +0200
|
Last Changed Date: 2014-08-08 14:03:30 +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 "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/moenchDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "046a469b1e6582c4c55bd6eaeb4818b618d0a9a9"
|
#define SVNREPUUID "8c994ea0d538628b36a9497508960388816749fa"
|
||||||
//#define SVNREV 0x14
|
//#define SVNREV 0x278
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Maliakal_Dhanya"
|
#define SVNAUTH "Maliakal_Dhanya"
|
||||||
#define SVNREV 0x14
|
#define SVNREV 0x278
|
||||||
#define SVNDATE 0x20140603
|
#define SVNDATE 0x20140808
|
||||||
//
|
//
|
||||||
|
@ -513,7 +513,6 @@ int set_one_dac(int imod) {
|
|||||||
bit=value & (1<<(15-ibit));
|
bit=value & (1<<(15-ibit));
|
||||||
if (bit) {
|
if (bit) {
|
||||||
putout("0000010001000000",imod);
|
putout("0000010001000000",imod);
|
||||||
putout("0000011001000000",imod);
|
|
||||||
putout("0000010001000000",imod);
|
putout("0000010001000000",imod);
|
||||||
#ifdef DEBUGOUT
|
#ifdef DEBUGOUT
|
||||||
fprintf(stdout,"1");
|
fprintf(stdout,"1");
|
||||||
@ -551,15 +550,15 @@ int initDACbyIndex(int ind,int val, int imod) {
|
|||||||
int ref=partref[ind];
|
int ref=partref[ind];
|
||||||
int r1=partr1[ind];
|
int r1=partr1[ind];
|
||||||
int r2=partr2[ind];
|
int r2=partr2[ind];
|
||||||
|
int retval[2];
|
||||||
|
|
||||||
v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX;
|
v=(val+(val-ref)*r1/r2)*DAC_DR/DAC_MAX;
|
||||||
v=initDACbyIndexDACU(ind,v,imod);
|
v=initDACbyIndexDACU(ind,v,imod,0,retval);
|
||||||
|
|
||||||
return (v*DAC_MAX/DAC_DR+ref*r1/r2)/(1+r1/r2);
|
return (v*DAC_MAX/DAC_DR+ref*r1/r2)/(1+r1/r2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int initDACbyIndexDACU(int ind, int val, int imod) {
|
int initDACbyIndexDACU(int ind, int val, int imod, int mV, int retval[]) {
|
||||||
|
|
||||||
// const double daccs[NDAC]=DACCS;
|
// const double daccs[NDAC]=DACCS;
|
||||||
// const double dacaddr[NDAC]=DACADDR;
|
// const double dacaddr[NDAC]=DACADDR;
|
||||||
@ -568,6 +567,8 @@ int initDACbyIndexDACU(int ind, int val, int imod) {
|
|||||||
// int addr=dacaddr[ind];
|
// int addr=dacaddr[ind];
|
||||||
// int iv;
|
// int iv;
|
||||||
int im;
|
int im;
|
||||||
|
if(mV)
|
||||||
|
val = (val*4096)/2500;
|
||||||
|
|
||||||
if (val>=0)
|
if (val>=0)
|
||||||
initDAC(ind,val, imod);
|
initDAC(ind,val, imod);
|
||||||
@ -598,124 +599,12 @@ int initDACbyIndexDACU(int ind, int val, int imod) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("returning %d\n",setDACRegister(ind, -1, 0));
|
printf("returning %d\n",setDACRegister(ind, -1, 0));
|
||||||
#endif
|
#endif
|
||||||
return setDACRegister(ind, -1, 0);
|
retval[0] = setDACRegister(ind, -1, 0);
|
||||||
|
retval[1] = (retval[0]*2500)/4096;
|
||||||
|
return retval[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int getThresholdEnergy() {
|
|
||||||
double g[3]=DEFAULTGAIN;
|
|
||||||
double o[3]=DEFAULTOFFSET;
|
|
||||||
double myg=-1, myo=-1;
|
|
||||||
// int dacu;
|
|
||||||
int imod;
|
|
||||||
int ethr=-1;
|
|
||||||
int ret=FAIL;
|
|
||||||
|
|
||||||
if (detectorModules) {
|
|
||||||
// for (imod=0; imod<getNModBoard(); imod++) {
|
|
||||||
for (imod=0; imod<nModX; imod++) {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("module=%d settings=%d, gain=%f, offset=%f\n",imod,thisSettings, (detectorModules+imod)->gain,(detectorModules+imod)->offset);
|
|
||||||
#endif
|
|
||||||
if ((detectorModules+imod)->gain>0)
|
|
||||||
myg=(detectorModules+imod)->gain;
|
|
||||||
else {
|
|
||||||
if (thisSettings>=0 && thisSettings<3)
|
|
||||||
myg=g[thisSettings];
|
|
||||||
// else
|
|
||||||
//myg=-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((detectorModules+imod)->offset>0)
|
|
||||||
myo=(detectorModules+imod)->offset;
|
|
||||||
else {
|
|
||||||
if (thisSettings>=0 && thisSettings<3)
|
|
||||||
myo=o[thisSettings];
|
|
||||||
// else
|
|
||||||
//myo=-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (myg>0 && myo>0) {
|
|
||||||
//ethr=(myo-detectorDacs[VTHRESH+imod*NDAC])*1000/myg;
|
|
||||||
|
|
||||||
ethr=(myo-setDACRegister(VDAC0,-1,imod))*1000/myg;//edited by dhanya
|
|
||||||
// else
|
|
||||||
// ethr=-1;
|
|
||||||
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
|
||||||
//printf("module=%d gain=%f, offset=%f, dacu=%f\n",imod, myg, myo, detectorDacs[VTHRESH+imod*NDAC]);
|
|
||||||
printf("module=%d gain=%f, offset=%f, dacu=%d\n",imod, myg, myo,(int)(setDACRegister(VDAC0,-1,imod)));//edited by dhanya
|
|
||||||
printf("Threshold energy of module %d is %d eV\n", imod, ethr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (imod==0)
|
|
||||||
ret=ethr;
|
|
||||||
else {
|
|
||||||
if (ethr>(ret+100) || ethr<(ret-100))
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int setThresholdEnergy(int ethr) {
|
|
||||||
double g[3]=DEFAULTGAIN;
|
|
||||||
double o[3]=DEFAULTOFFSET;
|
|
||||||
double myg=-1, myo=-1;
|
|
||||||
int dacu;
|
|
||||||
int imod;
|
|
||||||
int ret=ethr;
|
|
||||||
|
|
||||||
setSettings(GET_SETTINGS,-1);//-1 added by dhanya
|
|
||||||
if (thisSettings>=0 || thisSettings<3){
|
|
||||||
myg=g[thisSettings];
|
|
||||||
myo=o[thisSettings];
|
|
||||||
}
|
|
||||||
for (imod=0; imod<nModX; imod++) {
|
|
||||||
if (detectorModules) {
|
|
||||||
if ((detectorModules+imod)->gain>0)
|
|
||||||
myg=(detectorModules+imod)->gain;
|
|
||||||
else
|
|
||||||
if (thisSettings>=0 && thisSettings<3)
|
|
||||||
myg=g[thisSettings];
|
|
||||||
else
|
|
||||||
myg=-1;
|
|
||||||
if ((detectorModules+imod)->offset>0)
|
|
||||||
myo=(detectorModules+imod)->offset;
|
|
||||||
else
|
|
||||||
if (thisSettings>=0 && thisSettings<3)
|
|
||||||
myo=o[thisSettings];
|
|
||||||
else
|
|
||||||
myo=-1;
|
|
||||||
} else {
|
|
||||||
if (thisSettings>=0 && thisSettings<3)
|
|
||||||
myo=o[thisSettings];
|
|
||||||
else
|
|
||||||
myo=-1;
|
|
||||||
if (thisSettings>=0 && thisSettings<3)
|
|
||||||
myg=g[thisSettings];
|
|
||||||
else
|
|
||||||
myg=-1;
|
|
||||||
}
|
|
||||||
if (myg>0 && myo>0) {
|
|
||||||
dacu=myo-myg*((double)ethr)/1000.;
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("module %d (%x): gain %f, off %f, energy %d eV, dac %d\n",imod,(unsigned int)((detectorModules+imod)),(detectorModules+imod)->gain,(detectorModules+imod)->offset, ethr,dacu);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
dacu=ethr;
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("could not set threshold energy for module %d, settings %d (offset is %f; gain is %f)\n",imod,thisSettings,myo,myg);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
initDACbyIndexDACU(VDAC0, dacu, imod); ///needs to be fixed dhanya
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getDACbyIndexDACU(int ind, int imod) {
|
int getDACbyIndexDACU(int ind, int imod) {
|
||||||
/*
|
/*
|
||||||
@ -2585,19 +2474,9 @@ ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
|||||||
|
|
||||||
int i,adc;
|
int i,adc;
|
||||||
ROI temp;
|
ROI temp;
|
||||||
|
/*
|
||||||
if(n>=0){
|
if(n>=0){
|
||||||
|
|
||||||
//clear rois
|
|
||||||
for(i=0;i<MAX_ROIS;i++)
|
|
||||||
rois[i]=temp;
|
|
||||||
|
|
||||||
/*ideal way to set roi
|
|
||||||
for(i=0;i<n;i++)
|
|
||||||
rois[i]=arg[i];
|
|
||||||
nROI = n;
|
|
||||||
*/
|
|
||||||
|
|
||||||
if(n==0)
|
if(n==0)
|
||||||
adc=-1;
|
adc=-1;
|
||||||
else{
|
else{
|
||||||
@ -2633,7 +2512,7 @@ ROI* setROI(int n, ROI arg[], int *retvalsize, int *ret){
|
|||||||
|
|
||||||
//set adc of interest
|
//set adc of interest
|
||||||
setADC(adc);
|
setADC(adc);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("Rois:\n");
|
printf("Rois:\n");
|
||||||
|
@ -109,10 +109,9 @@ int initDAC(int dac_addr, int value,int imod );
|
|||||||
int initDACs(int* v,int imod );
|
int initDACs(int* v,int imod );
|
||||||
int setSettings(int i,int imod);
|
int setSettings(int i,int imod);
|
||||||
int initDACbyIndex(int ind,int val, int imod);
|
int initDACbyIndex(int ind,int val, int imod);
|
||||||
int initDACbyIndexDACU(int ind,int val, int imod);
|
int initDACbyIndexDACU(int ind,int val, int imod, int mV, int retval[]);
|
||||||
int getDACbyIndexDACU(int ind, int imod);
|
int getDACbyIndexDACU(int ind, int imod);
|
||||||
int getThresholdEnergy();
|
|
||||||
int setThresholdEnergy(int ethr);
|
|
||||||
|
|
||||||
/* Other DAC index routines*/
|
/* Other DAC index routines*/
|
||||||
int getTemperatureByModule(int tempSensor, int imod);
|
int getTemperatureByModule(int tempSensor, int imod);
|
||||||
|
@ -25,7 +25,6 @@ int main(int argc, char *argv[])
|
|||||||
int retval=OK;
|
int retval=OK;
|
||||||
int sd, fd;
|
int sd, fd;
|
||||||
int iarg;
|
int iarg;
|
||||||
int checkType = 1;
|
|
||||||
|
|
||||||
|
|
||||||
for(iarg=1; iarg<argc; iarg++){
|
for(iarg=1; iarg<argc; iarg++){
|
||||||
@ -40,20 +39,6 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(!strcasecmp(argv[iarg],"-test")){
|
|
||||||
if(argc==iarg+1){
|
|
||||||
printf("No test condition given. Exiting.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if(!strcasecmp(argv[iarg+1],"with_gotthard")){
|
|
||||||
checkType = 0;
|
|
||||||
}else{
|
|
||||||
printf("could not decode test condition. Possible arguments: with_gotthard. Exiting\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -71,10 +56,7 @@ int main(int argc, char *argv[])
|
|||||||
//control server
|
//control server
|
||||||
else {
|
else {
|
||||||
portno = DEFAULT_PORTNO;
|
portno = DEFAULT_PORTNO;
|
||||||
if(checkType)
|
|
||||||
sprintf(cmd,"%s %d stopserver &",argv[0],DEFAULT_PORTNO+1);
|
sprintf(cmd,"%s %d stopserver &",argv[0],DEFAULT_PORTNO+1);
|
||||||
else
|
|
||||||
sprintf(cmd,"%s %d stopserver -test with_gotthard &",argv[0],DEFAULT_PORTNO+1);
|
|
||||||
printf("\n\nControl Server\nOpening control server on port %d\n",portno );
|
printf("\n\nControl Server\nOpening control server on port %d\n",portno );
|
||||||
|
|
||||||
//printf("\n\ncmd:%s\n",cmd);
|
//printf("\n\ncmd:%s\n",cmd);
|
||||||
@ -83,7 +65,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init_detector(b, checkType);
|
init_detector(b);
|
||||||
|
|
||||||
|
|
||||||
sd=bindSocket(portno);
|
sd=bindSocket(portno);
|
||||||
|
@ -16,9 +16,7 @@
|
|||||||
#define NDAC 8
|
#define NDAC 8
|
||||||
#define NADC 1
|
#define NADC 1
|
||||||
|
|
||||||
/**when moench readout tested with gotthard module*/
|
|
||||||
#define GOTTHARDNCHAN 128
|
|
||||||
#define GOTTHARDNCHIP 10
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,10 +54,8 @@ char mess[1000];
|
|||||||
|
|
||||||
int digitalTestBit = 0;
|
int digitalTestBit = 0;
|
||||||
|
|
||||||
extern int withGotthard;
|
|
||||||
|
|
||||||
|
int init_detector(int b) {
|
||||||
int init_detector(int b, int checkType) {
|
|
||||||
if (mapCSP0()==FAIL) { printf("Could not map memory\n");
|
if (mapCSP0()==FAIL) { printf("Could not map memory\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@ -69,21 +67,13 @@ int init_detector(int b, int checkType) {
|
|||||||
|
|
||||||
//confirm if it is really moench
|
//confirm if it is really moench
|
||||||
if(((bus_r(PCB_REV_REG) & DETECTOR_TYPE_MASK)>>DETECTOR_TYPE_OFFSET) != MOENCH_MODULE ){
|
if(((bus_r(PCB_REV_REG) & DETECTOR_TYPE_MASK)>>DETECTOR_TYPE_OFFSET) != MOENCH_MODULE ){
|
||||||
if(checkType){
|
|
||||||
printf("This is a Gotthard detector. Exiting Moench Server.\n\n");
|
printf("This is a Gotthard detector. Exiting Moench Server.\n\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
//no check required as specified in command line arguments
|
|
||||||
else if(b){
|
|
||||||
printf("***This is a GOTTHARD detector with %d chips per module***\n",GOTTHARDNCHIP);
|
|
||||||
printf("***Assuming this to be a MOENCH detector***\n");
|
|
||||||
}
|
|
||||||
withGotthard = 1;
|
|
||||||
} else if(b){
|
|
||||||
printf("***This is a MOENCH detector with %d chips per module***\n",NCHIP);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (b) {
|
if (b) {
|
||||||
|
printf("***This is a MOENCH detector with %d chips per module***\n",NCHIP);
|
||||||
|
|
||||||
#ifdef MCB_FUNCS
|
#ifdef MCB_FUNCS
|
||||||
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));
|
||||||
initDetector();
|
initDetector();
|
||||||
@ -914,13 +904,15 @@ int read_register(int file_des) {
|
|||||||
|
|
||||||
int set_dac(int file_des) {
|
int set_dac(int file_des) {
|
||||||
//default:all mods
|
//default:all mods
|
||||||
int retval;
|
int retval[2];retval[1]=-1;
|
||||||
|
int temp;
|
||||||
int ret=OK;
|
int ret=OK;
|
||||||
int arg[3];
|
int arg[3];
|
||||||
enum dacIndex ind;
|
enum dacIndex ind;
|
||||||
int imod;
|
int imod;
|
||||||
int n;
|
int n;
|
||||||
int val;
|
int val;
|
||||||
|
int mV;
|
||||||
int idac=0;
|
int idac=0;
|
||||||
|
|
||||||
sprintf(mess,"Can't set DAC\n");
|
sprintf(mess,"Can't set DAC\n");
|
||||||
@ -932,6 +924,7 @@ int set_dac(int file_des) {
|
|||||||
}
|
}
|
||||||
ind=arg[0];
|
ind=arg[0];
|
||||||
imod=arg[1];
|
imod=arg[1];
|
||||||
|
mV=arg[2];
|
||||||
|
|
||||||
n = receiveDataOnly(file_des,&val,sizeof(val));
|
n = receiveDataOnly(file_des,&val,sizeof(val));
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
@ -990,45 +983,50 @@ int set_dac(int file_des) {
|
|||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||||
} else{
|
} else{
|
||||||
if(idac==HIGH_VOLTAGE)
|
|
||||||
retval=initHighVoltageByModule(val,imod);
|
|
||||||
else
|
|
||||||
retval=initDACbyIndexDACU(idac,val,imod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(ret==OK){
|
|
||||||
ret=FAIL;
|
|
||||||
if(idac==HIGH_VOLTAGE){
|
if(idac==HIGH_VOLTAGE){
|
||||||
if(retval==-2)
|
retval[0]=initHighVoltageByModule(val,imod);
|
||||||
|
ret=FAIL;
|
||||||
|
if(retval[0]==-2)
|
||||||
strcpy(mess,"Invalid Voltage.Valid values are 0,90,110,120,150,180,200");
|
strcpy(mess,"Invalid Voltage.Valid values are 0,90,110,120,150,180,200");
|
||||||
else if(retval==-3)
|
else if(retval[0]==-3)
|
||||||
strcpy(mess,"Weird value read back or it has not been set yet\n");
|
strcpy(mess,"Weird value read back or it has not been set yet\n");
|
||||||
else
|
else
|
||||||
ret=OK;
|
ret=OK;
|
||||||
}//since v r saving only msb
|
}else{
|
||||||
else if ((retval-val)<=3 || val==-1)
|
initDACbyIndexDACU(idac,val,imod,mV,retval);
|
||||||
|
ret=FAIL;
|
||||||
|
if(mV)
|
||||||
|
temp = retval[1];
|
||||||
|
else
|
||||||
|
temp = retval[0];
|
||||||
|
if ((abs(temp-val)<=3) || val==-1) {
|
||||||
ret=OK;
|
ret=OK;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
printf("DAC set to %d in dac units and %d mV\n", retval[0],retval[1]);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
printf("DAC set to %d V\n", retval);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(ret==FAIL)
|
if(ret==FAIL)
|
||||||
printf("Setting dac %d of module %d: wrote %d but read %d\n", ind, imod, val, retval);
|
printf("Setting dac %d of module %d: wrote %d but read %d\n", ind, imod, val, temp);
|
||||||
else{
|
else{
|
||||||
if (differentClients)
|
if (differentClients)
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* send answer */
|
/* send answer */
|
||||||
/* send OK/failed */
|
/* send OK/failed */
|
||||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||||
if (ret!=FAIL) {
|
if (ret!=FAIL) {
|
||||||
/* send return argument */
|
/* send return argument */
|
||||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
n += sendDataOnly(file_des,retval,sizeof(retval));
|
||||||
} else {
|
} else {
|
||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
}
|
}
|
||||||
@ -1610,7 +1608,7 @@ int get_threshold_energy(int file_des) {
|
|||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
|
|
||||||
/*return ok/fail*/
|
/*return ok/fail*/
|
||||||
return OK;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1631,7 +1629,7 @@ int set_threshold_energy(int file_des) {
|
|||||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||||
|
|
||||||
/*return ok/fail*/
|
/*return ok/fail*/
|
||||||
return OK;
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ int sockfd;
|
|||||||
int function_table();
|
int function_table();
|
||||||
|
|
||||||
int decode_function(int);
|
int decode_function(int);
|
||||||
int init_detector(int,int);
|
int init_detector(int);
|
||||||
|
|
||||||
int M_nofunc(int);
|
int M_nofunc(int);
|
||||||
int exit_server(int);
|
int exit_server(int);
|
||||||
|
@ -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 git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer
|
||||||
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_detector_software.git
|
||||||
Repsitory UUID: 046a469b1e6582c4c55bd6eaeb4818b618d0a9a9
|
Repsitory UUID: 8c994ea0d538628b36a9497508960388816749fa
|
||||||
Revision: 87
|
Revision: 89
|
||||||
Branch: separate_receiver
|
Branch: master
|
||||||
Last Changed Author: Maliakal_Dhanya
|
Last Changed Author: Maliakal_Dhanya
|
||||||
Last Changed Rev: 14
|
Last Changed Rev: 278
|
||||||
Last Changed Date: 2014-06-03 12:26:45 +0200
|
Last Changed Date: 2014-08-08 14:03:30 +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 "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git/mythenDetectorServer"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUID "046a469b1e6582c4c55bd6eaeb4818b618d0a9a9"
|
#define SVNREPUUID "8c994ea0d538628b36a9497508960388816749fa"
|
||||||
//#define SVNREV 0x14
|
//#define SVNREV 0x278
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTH "Maliakal_Dhanya"
|
#define SVNAUTH "Maliakal_Dhanya"
|
||||||
#define SVNREV 0x14
|
#define SVNREV 0x278
|
||||||
#define SVNDATE 0x20140603
|
#define SVNDATE 0x20140808
|
||||||
//
|
//
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURLLIB "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git"
|
#define SVNURLLIB "git@gitorious.psi.ch:sls_det_software/sls_detector_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUIDLIB "046a469b1e6582c4c55bd6eaeb4818b618d0a9a9"
|
#define SVNREPUUIDLIB "8c994ea0d538628b36a9497508960388816749fa"
|
||||||
//#define SVNREV 0x833
|
//#define SVNREV 0x848
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "Maliakal_Dhanya"
|
#define SVNAUTHLIB "Maliakal_Dhanya"
|
||||||
#define SVNREVLIB 0x833
|
#define SVNREVLIB 0x848
|
||||||
#define SVNDATELIB 0x20140603
|
#define SVNDATELIB 0x20140808
|
||||||
//
|
//
|
||||||
|
@ -24,14 +24,16 @@ int main(int argc, char *argv[]){
|
|||||||
int sd, fd;
|
int sd, fd;
|
||||||
#ifdef STOP_SERVER
|
#ifdef STOP_SERVER
|
||||||
char cmd[100];
|
char cmd[100];
|
||||||
if (argc==1) {
|
|
||||||
#endif
|
#endif
|
||||||
|
if (argc==1) {
|
||||||
|
//#endif
|
||||||
portno = DEFAULT_PORTNO;
|
portno = DEFAULT_PORTNO;
|
||||||
printf("opening control server on port %d\n",portno );
|
printf("opening control server on port %d\n",portno );
|
||||||
b=1;
|
b=1;
|
||||||
#ifdef STOP_SERVER
|
#ifdef STOP_SERVER
|
||||||
sprintf(cmd,"%s %d &",argv[0],DEFAULT_PORTNO+1);
|
sprintf(cmd,"%s %d &",argv[0],DEFAULT_PORTNO+1);
|
||||||
system(cmd);
|
system(cmd);
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
portno = DEFAULT_PORTNO+1;
|
portno = DEFAULT_PORTNO+1;
|
||||||
if ( sscanf(argv[1],"%d",&portno) ==0) {
|
if ( sscanf(argv[1],"%d",&portno) ==0) {
|
||||||
@ -41,7 +43,7 @@ int main(int argc, char *argv[]){
|
|||||||
printf("opening stop server on port %d\n",portno);
|
printf("opening stop server on port %d\n",portno);
|
||||||
b=0;
|
b=0;
|
||||||
}
|
}
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
init_detector(b); //defined in slsDetectorServer_funcs
|
init_detector(b); //defined in slsDetectorServer_funcs
|
||||||
|
@ -52,6 +52,12 @@ int init_detector(int b) {
|
|||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
initDetector();
|
initDetector();
|
||||||
#endif
|
#endif
|
||||||
|
}else{
|
||||||
|
Feb_Interface_FebInterface();
|
||||||
|
Feb_Control_FebControl();
|
||||||
|
printf("FEb control constructor done\n");
|
||||||
|
/* Beb_Beb(-1);
|
||||||
|
printf("BEB constructor done\n");*/
|
||||||
}
|
}
|
||||||
strcpy(mess,"dummy message");
|
strcpy(mess,"dummy message");
|
||||||
strcpy(lastClientIP,"none");
|
strcpy(lastClientIP,"none");
|
||||||
@ -1970,8 +1976,9 @@ int set_settings(int file_des) {
|
|||||||
}
|
}
|
||||||
imod=arg[1];
|
imod=arg[1];
|
||||||
isett=arg[0];
|
isett=arg[0];
|
||||||
printf("isett:%d, imod =%d\n",isett,imod);
|
#ifdef VERBOSE
|
||||||
|
printf("In set_settings, isett:%d, imod =%d\n",isett,imod);
|
||||||
|
#endif
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (imod>=getTotalNumberOfModules()) {
|
if (imod>=getTotalNumberOfModules()) {
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
@ -2262,11 +2269,11 @@ int get_run_status(int file_des) {
|
|||||||
enum runStatus s;
|
enum runStatus s;
|
||||||
sprintf(mess,"getting run status\n");
|
sprintf(mess,"getting run status\n");
|
||||||
|
|
||||||
#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
printf("Getting status\n");
|
printf("Getting status\n");
|
||||||
#endif
|
//#endif
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
s= getRunStatus();
|
s= getRunStatus();printf("status:%d\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ret!=OK) {
|
if (ret!=OK) {
|
||||||
@ -2452,6 +2459,7 @@ int set_timer(int file_des) {
|
|||||||
sprintf(mess, "could not allocate RAM for %lld frames\n", tns);
|
sprintf(mess, "could not allocate RAM for %lld frames\n", tns);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (differentClients)
|
if (differentClients)
|
||||||
ret=FORCE_UPDATE;
|
ret=FORCE_UPDATE;
|
||||||
}
|
}
|
||||||
@ -2709,6 +2717,7 @@ int set_roi(int file_des) {
|
|||||||
#ifndef GOTTHARDD
|
#ifndef GOTTHARDD
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess,"Not applicable/implemented for this detector\n");
|
strcpy(mess,"Not applicable/implemented for this detector\n");
|
||||||
|
printf("Error:Set ROI-%s",mess);
|
||||||
#else
|
#else
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Setting ROI to:");
|
printf("Setting ROI to:");
|
||||||
@ -3007,11 +3016,13 @@ int configure_mac(int file_des) {
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
printf("Configuring MAC of module %d at port %x\n", imod, udpport);
|
printf("Configuring MAC of module %d at port %x\n", imod, udpport);
|
||||||
#endif
|
#endif
|
||||||
printf("ret:%d\n",ret);
|
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
if (ret==OK) {
|
if (ret==OK) {
|
||||||
if(getRunStatus() == RUNNING)
|
if(getRunStatus() == RUNNING){
|
||||||
stopStateMachine();
|
stopStateMachine();
|
||||||
|
}
|
||||||
|
|
||||||
retval=configureMAC(ipad,imacadd,idetectormacadd,detipad,udpport,0); /*digitalTestBit);*/
|
retval=configureMAC(ipad,imacadd,idetectormacadd,detipad,udpport,0); /*digitalTestBit);*/
|
||||||
if(retval==-1) ret=FAIL;
|
if(retval==-1) ret=FAIL;
|
||||||
}
|
}
|
||||||
@ -3396,9 +3407,9 @@ int enable_ten_giga(int file_des) {
|
|||||||
}
|
}
|
||||||
/* execute action */
|
/* execute action */
|
||||||
if(ret != FAIL){
|
if(ret != FAIL){
|
||||||
//#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
printf("Enabling 10Gbe :%d \n",arg);
|
printf("Enabling 10Gbe :%d \n",arg);
|
||||||
//#endif
|
#endif
|
||||||
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
#ifdef SLS_DETECTOR_FUNCTION_LIST
|
||||||
retval=enableTenGigabitEthernet(arg);
|
retval=enableTenGigabitEthernet(arg);
|
||||||
if((arg != -1) && (retval != arg))
|
if((arg != -1) && (retval != arg))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user