mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 09:10:01 +02:00
eiger server compiles, client side of interface to do
This commit is contained in:
parent
dfad145e14
commit
261849d69c
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
/**
|
|
||||||
* @author Ian Johnson
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef BEB_H
|
|
||||||
#define BEB_H
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "LocalLinkInterface.h"
|
#include "LocalLinkInterface.h"
|
||||||
@ -15,89 +6,79 @@
|
|||||||
|
|
||||||
|
|
||||||
struct BebInfo{
|
struct BebInfo{
|
||||||
unsigned int beb_number;
|
unsigned int beb_number;
|
||||||
unsigned int serial_address;
|
unsigned int serial_address;
|
||||||
char src_mac_1GbE[50];
|
char src_mac_1GbE[50];
|
||||||
char src_mac_10GbE[50];
|
char src_mac_10GbE[50];
|
||||||
char src_ip_1GbE[50];
|
char src_ip_1GbE[50];
|
||||||
char src_ip_10GbE[50];
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num);
|
void BebInfo_BebInfo(struct BebInfo* bebInfo, unsigned int beb_num);
|
||||||
void BebInfo_BebDstInfo(struct BebInfo* bebInfo, unsigned int beb_num);
|
void BebInfo_BebDstInfo(struct BebInfo* bebInfo, unsigned int beb_num);
|
||||||
int BebInfo_SetSerialAddress(struct BebInfo* bebInfo, unsigned int add);
|
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);
|
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);
|
||||||
unsigned int BebInfo_GetBebNumber(struct BebInfo* bebInfo);
|
unsigned int BebInfo_GetBebNumber(struct BebInfo* bebInfo);
|
||||||
unsigned int BebInfo_GetSerialAddress(struct BebInfo* bebInfo);
|
unsigned int BebInfo_GetSerialAddress(struct BebInfo* bebInfo);
|
||||||
char* BebInfo_GetSrcMAC(struct BebInfo* bebInfo, int ten_gig);
|
char* BebInfo_GetSrcMAC(struct BebInfo* bebInfo, int ten_gig);
|
||||||
char* BebInfo_GetSrcIP(struct BebInfo* bebInfo, int ten_gig);
|
char* BebInfo_GetSrcIP(struct BebInfo* bebInfo, int ten_gig);
|
||||||
unsigned int BebInfo_GetSrcPort(struct BebInfo* bebInfo, int ten_gig);
|
unsigned int BebInfo_GetSrcPort(struct BebInfo* bebInfo, int ten_gig);
|
||||||
void BebInfo_Print(struct BebInfo* bebInfo);
|
void BebInfo_Print(struct BebInfo* bebInfo);
|
||||||
|
void Beb_ClearBebInfos();
|
||||||
|
int Beb_InitBebInfos();
|
||||||
|
int Beb_CheckSourceStuffBebInfo();
|
||||||
|
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb);
|
||||||
|
|
||||||
|
|
||||||
|
void Beb_GetModuleConfiguration(int* master, int* top, int* normal);
|
||||||
|
void Beb_EndofDataSend(int tengiga);
|
||||||
|
|
||||||
void Beb_ClearBebInfos();
|
int Beb_SetMasterViaSoftware();
|
||||||
int Beb_InitBebInfos();
|
int Beb_SetSlaveViaSoftware();
|
||||||
int Beb_CheckSourceStuffBebInfo();
|
int Beb_Activate(int enable);
|
||||||
unsigned int Beb_GetBebInfoIndex(unsigned int beb_numb);
|
int Beb_Set32bitOverflow(int val);
|
||||||
|
int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val);
|
||||||
|
int Beb_ResetToHardwareSettings();
|
||||||
|
u_int32_t Beb_GetFirmwareRevision();
|
||||||
|
u_int32_t Beb_GetFirmwareSoftwareAPIVersion();
|
||||||
|
void Beb_ResetFrameNumber();
|
||||||
|
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 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_StopAcquisition();
|
||||||
|
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, 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);
|
||||||
|
|
||||||
|
int Beb_GetBebFPGATemp();
|
||||||
|
|
||||||
|
void Beb_SetDetectorNumber(uint32_t detid);
|
||||||
|
int Beb_SetDetectorPosition(int pos[]);
|
||||||
|
|
||||||
|
uint16_t Beb_swap_uint16( uint16_t val);
|
||||||
|
int Beb_open(u_int32_t** csp0base, u_int32_t offset);
|
||||||
|
u_int32_t Beb_Read32 (u_int32_t* baseaddr, u_int32_t offset);
|
||||||
|
u_int32_t Beb_Write32 (u_int32_t* baseaddr, u_int32_t offset, u_int32_t data);
|
||||||
|
void Beb_close(int fd,u_int32_t* csp0base);
|
||||||
|
|
||||||
|
|
||||||
void Beb_GetModuleConfiguration(int* master, int* top, int* normal);
|
|
||||||
void Beb_EndofDataSend(int tengiga);
|
|
||||||
|
|
||||||
int Beb_SetMasterViaSoftware();
|
|
||||||
int Beb_SetSlaveViaSoftware();
|
|
||||||
int Beb_Activate(int enable);
|
|
||||||
int Beb_Set32bitOverflow(int val);
|
|
||||||
int Beb_SetNetworkParameter(enum NETWORKINDEX mode, int val);
|
|
||||||
int Beb_ResetToHardwareSettings();
|
|
||||||
u_int32_t Beb_GetFirmwareRevision();
|
|
||||||
u_int32_t Beb_GetFirmwareSoftwareAPIVersion();
|
|
||||||
void Beb_ResetFrameNumber();
|
|
||||||
|
|
||||||
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 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_StopAcquisition();
|
|
||||||
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, 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);
|
|
||||||
|
|
||||||
int Beb_GetBebFPGATemp();
|
|
||||||
|
|
||||||
void Beb_SetDetectorNumber(uint32_t detid);
|
|
||||||
int Beb_SetDetectorPosition(int pos[]);
|
|
||||||
|
|
||||||
uint16_t Beb_swap_uint16( uint16_t val);
|
|
||||||
int Beb_open(u_int32_t** csp0base, u_int32_t offset);
|
|
||||||
u_int32_t Beb_Read32 (u_int32_t* baseaddr, u_int32_t offset);
|
|
||||||
u_int32_t Beb_Write32 (u_int32_t* baseaddr, u_int32_t offset, u_int32_t data);
|
|
||||||
void Beb_close(int fd,u_int32_t* csp0base);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,36 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
/**
|
#include "FebInterface.h"
|
||||||
* @author Ian Johnson
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef FEBCONTROL_H
|
|
||||||
#define FEBCONTROL_H
|
|
||||||
|
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
//#include <string>
|
|
||||||
//#include <vector>
|
|
||||||
|
|
||||||
|
|
||||||
#include "FebInterface.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct Module{
|
struct Module{
|
||||||
unsigned int module_number;
|
unsigned int module_number;
|
||||||
int 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;
|
||||||
int 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;
|
||||||
|
|
||||||
unsigned int idelay_top[4]; //ll,lr,rl,ll
|
unsigned int idelay_top[4]; //ll,lr,rl,ll
|
||||||
unsigned int idelay_bottom[4]; //ll,lr,rl,ll
|
unsigned int idelay_bottom[4]; //ll,lr,rl,ll
|
||||||
float high_voltage;
|
float high_voltage;
|
||||||
int* top_dac;
|
int* top_dac;
|
||||||
int* bottom_dac;
|
int* bottom_dac;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -38,12 +26,12 @@ void Module_Module(struct Module* mod,unsigned int number, unsigned int address_
|
|||||||
void Module_ModuleBottom(struct Module* mod,unsigned int number, unsigned int address_bottom);
|
void Module_ModuleBottom(struct Module* mod,unsigned int number, unsigned int address_bottom);
|
||||||
void Module_Module1(struct Module* mod,unsigned int number, unsigned int address_top, unsigned int address_bottom);
|
void Module_Module1(struct Module* mod,unsigned int number, unsigned int address_top, unsigned int address_bottom);
|
||||||
unsigned int Module_GetModuleNumber(struct Module* mod);
|
unsigned int Module_GetModuleNumber(struct Module* mod);
|
||||||
int Module_TopAddressIsValid(struct Module* mod);
|
int Module_TopAddressIsValid(struct Module* mod);
|
||||||
unsigned int Module_GetTopBaseAddress(struct Module* mod);
|
unsigned int Module_GetTopBaseAddress(struct Module* mod);
|
||||||
unsigned int Module_GetTopLeftAddress(struct Module* mod) ;
|
unsigned int Module_GetTopLeftAddress(struct Module* mod) ;
|
||||||
unsigned int Module_GetTopRightAddress(struct Module* mod);
|
unsigned int Module_GetTopRightAddress(struct Module* mod);
|
||||||
unsigned int Module_GetBottomBaseAddress(struct Module* mod);
|
unsigned int Module_GetBottomBaseAddress(struct Module* mod);
|
||||||
int Module_BottomAddressIsValid(struct Module* mod);
|
int Module_BottomAddressIsValid(struct Module* mod);
|
||||||
unsigned int Module_GetBottomLeftAddress(struct Module* mod);
|
unsigned int Module_GetBottomLeftAddress(struct Module* mod);
|
||||||
unsigned int Module_GetBottomRightAddress(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_SetTopIDelay(struct Module* mod,unsigned int chip,unsigned int value);
|
||||||
@ -51,17 +39,13 @@ 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_SetBottomIDelay(struct Module* mod,unsigned int chip,unsigned int value);
|
||||||
unsigned int Module_GetBottomIDelay(struct Module* mod,unsigned int chip);
|
unsigned int Module_GetBottomIDelay(struct Module* mod,unsigned int chip);
|
||||||
|
|
||||||
float Module_SetHighVoltage(struct Module* mod,float value);
|
float Module_SetHighVoltage(struct Module* mod,float value);
|
||||||
float Module_GetHighVoltage(struct Module* mod);
|
float Module_GetHighVoltage(struct Module* mod);
|
||||||
|
|
||||||
int Module_SetTopDACValue(struct Module* mod,unsigned int i, int value);
|
|
||||||
int Module_GetTopDACValue(struct Module* mod,unsigned int i);
|
|
||||||
int Module_SetBottomDACValue(struct Module* mod,unsigned int i, int value);
|
|
||||||
int Module_GetBottomDACValue(struct Module* mod,unsigned int i);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int Module_SetTopDACValue(struct Module* mod,unsigned int i, int value);
|
||||||
|
int Module_GetTopDACValue(struct Module* mod,unsigned int i);
|
||||||
|
int Module_SetBottomDACValue(struct Module* mod,unsigned int i, int value);
|
||||||
|
int Module_GetBottomDACValue(struct Module* mod,unsigned int i);
|
||||||
|
|
||||||
|
|
||||||
void Feb_Control_activate(int activate);
|
void Feb_Control_activate(int activate);
|
||||||
@ -69,142 +53,107 @@ void Feb_Control_activate(int activate);
|
|||||||
int Feb_Control_IsBottomModule();
|
int Feb_Control_IsBottomModule();
|
||||||
int Feb_Control_GetModuleNumber();
|
int Feb_Control_GetModuleNumber();
|
||||||
|
|
||||||
|
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_AddModule1(unsigned int module_number, int top_enable, 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_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);
|
||||||
|
int Feb_Control_ResetChipCompletely();
|
||||||
|
int Feb_Control_ResetChipPartially();
|
||||||
|
void Feb_Control_FebControl();
|
||||||
|
int Feb_Control_Init(int master, int top, int normal, int module_num);
|
||||||
|
int Feb_Control_OpenSerialCommunication();
|
||||||
|
void Feb_Control_CloseSerialCommunication();
|
||||||
|
int Feb_Control_CheckSetup();
|
||||||
|
unsigned int Feb_Control_GetNModules();
|
||||||
|
unsigned int Feb_Control_GetNHalfModules();
|
||||||
|
|
||||||
|
int Feb_Control_SetHighVoltage(int value);
|
||||||
|
int Feb_Control_GetHighVoltage(int* value);
|
||||||
|
|
||||||
|
int Feb_Control_SendHighVoltage(int dacvalue);
|
||||||
|
int Feb_Control_ReceiveHighVoltage(unsigned int* value);
|
||||||
|
|
||||||
void Feb_Control_PrintModuleList();
|
int Feb_Control_SetIDelays(unsigned int module_num, unsigned int ndelay_units);
|
||||||
int Feb_Control_GetModuleIndex(unsigned int module_number, unsigned int* module_index);
|
int Feb_Control_SetIDelays1(unsigned int module_num, unsigned int chip_pos, unsigned int ndelay_units);
|
||||||
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, int top_enable, unsigned int top_address, unsigned int bottom_address, int half_module);
|
|
||||||
|
|
||||||
int Feb_Control_GetDACNumber(char* s, unsigned int* n);
|
int Feb_Control_DecodeDACString(char* dac_str, unsigned int* module_index, int* top, int* bottom, unsigned int* dac_ch);
|
||||||
int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch, unsigned int* value);
|
int Feb_Control_SetDAC(char* s, int value, int is_a_voltage_mv);
|
||||||
int Feb_Control_VoltageToDAC(float value, unsigned int* digital, unsigned int nsteps, float vmin, float vmax);
|
int Feb_Control_GetDAC(char* s, int* ret_value, int voltage_mv);
|
||||||
float Feb_Control_DACToVoltage(unsigned int digital,unsigned int nsteps,float vmin,float vmax);
|
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();
|
||||||
|
int Feb_Control_SaveAllTrimbitsTo(int value);
|
||||||
|
int Feb_Control_Reset();
|
||||||
|
int Feb_Control_PrepareForAcquisition();
|
||||||
|
|
||||||
int Feb_Control_SendIDelays(unsigned int dst_num, int chip_lr, unsigned int channels, unsigned int ndelay_units);
|
int Feb_Control_StartAcquisition();
|
||||||
|
int Feb_Control_StopAcquisition();
|
||||||
|
int Feb_Control_AcquisitionInProgress();
|
||||||
|
int Feb_Control_AcquisitionStartedBit();
|
||||||
|
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
|
||||||
|
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
||||||
|
void Feb_Control_PrintAcquisitionSetup();
|
||||||
|
int Feb_Control_SetNExposures(unsigned int n_images);
|
||||||
|
unsigned int Feb_Control_GetNExposures();
|
||||||
|
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
||||||
|
double Feb_Control_GetExposureTime();
|
||||||
|
int64_t Feb_Control_GetExposureTime_in_nsec();
|
||||||
|
int Feb_Control_SetSubFrameExposureTime(int64_t the_subframe_exposure_time_in_10nsec);
|
||||||
|
int64_t Feb_Control_GetSubFrameExposureTime();
|
||||||
|
int Feb_Control_SetSubFramePeriod(int64_t the_subframe_period_in_10nsec);
|
||||||
|
int64_t Feb_Control_GetSubFramePeriod();
|
||||||
|
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
||||||
|
double Feb_Control_GetExposurePeriod();
|
||||||
|
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
||||||
|
unsigned int Feb_Control_GetDynamicRange();
|
||||||
|
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); //0 was default, 0->full,1->half,2->quarter or 3->super_slow
|
||||||
|
int Feb_Control_SetReadoutMode(unsigned int readout_mode); ///0 was default,0->parallel,1->non-parallel,2-> safe_mode
|
||||||
|
int Feb_Control_SetTriggerMode(unsigned int trigger_mode, int polarity);//0 and 1 was default,
|
||||||
|
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);//0 and 1 was default,
|
||||||
|
|
||||||
int Feb_Control_SetStaticBits();
|
int Feb_Control_SetInTestModeVariable(int on);
|
||||||
int Feb_Control_SetStaticBits1(unsigned int the_static_bits);
|
int Feb_Control_GetTestModeVariable();
|
||||||
|
|
||||||
int Feb_Control_SendBitModeToBebServer();
|
void Feb_Control_Set_Counter_Bit(int value);
|
||||||
|
int Feb_Control_Get_Counter_Bit();
|
||||||
|
int Feb_Control_Pulse_Pixel(int npulses,int x, int y);
|
||||||
|
int Feb_Control_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos);
|
||||||
|
int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in);
|
||||||
|
int Feb_Control_SendTokenIn();
|
||||||
|
int Feb_Control_ClockRowClock(unsigned int ntimes);
|
||||||
|
int Feb_Control_PulseChip(int npulses);
|
||||||
|
|
||||||
unsigned int Feb_Control_ConvertTimeToRegister(float time_in_sec);
|
int64_t Feb_Control_Get_RateTable_Tau_in_nsec();
|
||||||
|
int64_t Feb_Control_Get_RateTable_Period_in_nsec();
|
||||||
|
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec);
|
||||||
|
int Feb_Control_SetRateCorrectionTable(unsigned int *table);
|
||||||
|
int Feb_Control_GetRateCorrectionVariable();
|
||||||
|
void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction);
|
||||||
|
int Feb_Control_PrintCorrectedValues();
|
||||||
|
|
||||||
unsigned int Feb_Control_AddressToAll();
|
int Feb_Control_GetLeftFPGATemp();
|
||||||
int Feb_Control_SetCommandRegister(unsigned int cmd);
|
int Feb_Control_GetRightFPGATemp();
|
||||||
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();
|
int64_t Feb_Control_GetMeasuredPeriod();
|
||||||
int Feb_Control_ResetChipPartially();
|
int64_t Feb_Control_GetSubMeasuredPeriod();
|
||||||
|
|
||||||
//struct sockaddr_in Feb_Control_serv_addr;
|
int Feb_Control_SoftwareTrigger();
|
||||||
/*
|
|
||||||
int Feb_Control_SetupSendToSocket(const char* ip_address_hostname, unsigned short int port);
|
|
||||||
int Feb_Control_WriteNRead(char* message, int length, int max_length);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
||||||
|
uint32_t Feb_Control_ReadRegister(uint32_t offset);
|
||||||
|
|
||||||
void Feb_Control_FebControl();
|
|
||||||
int Feb_Control_Init(int master, int top, int normal, int module_num);
|
|
||||||
int Feb_Control_OpenSerialCommunication();
|
|
||||||
void Feb_Control_CloseSerialCommunication();
|
|
||||||
int Feb_Control_CheckSetup();
|
|
||||||
|
|
||||||
unsigned int Feb_Control_GetNModules();
|
|
||||||
unsigned int Feb_Control_GetNHalfModules();
|
|
||||||
|
|
||||||
int Feb_Control_SetHighVoltage(int value);
|
|
||||||
int Feb_Control_GetHighVoltage(int* value);
|
|
||||||
|
|
||||||
int Feb_Control_SendHighVoltage(int dacvalue);
|
|
||||||
int Feb_Control_ReceiveHighVoltage(unsigned int* value);
|
|
||||||
|
|
||||||
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 */
|
|
||||||
int Feb_Control_SaveAllTrimbitsTo(int value);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Feb_Control_Reset();
|
|
||||||
int Feb_Control_PrepareForAcquisition();
|
|
||||||
|
|
||||||
int Feb_Control_StartAcquisition();
|
|
||||||
int Feb_Control_StopAcquisition();
|
|
||||||
int Feb_Control_AcquisitionInProgress();
|
|
||||||
int Feb_Control_AcquisitionStartedBit();
|
|
||||||
/*int Feb_Control_WaitForFinishedFlag(int sleep_time_us=5000);*/
|
|
||||||
int Feb_Control_WaitForFinishedFlag(int sleep_time_us);
|
|
||||||
int Feb_Control_WaitForStartedFlag(int sleep_time_us, int prev_flag);
|
|
||||||
|
|
||||||
//functions for setting up exposure
|
|
||||||
void Feb_Control_PrintAcquisitionSetup();
|
|
||||||
int Feb_Control_SetNExposures(unsigned int n_images);
|
|
||||||
unsigned int Feb_Control_GetNExposures();
|
|
||||||
int Feb_Control_SetExposureTime(double the_exposure_time_in_sec);
|
|
||||||
double Feb_Control_GetExposureTime();
|
|
||||||
int64_t Feb_Control_GetExposureTime_in_nsec();
|
|
||||||
int Feb_Control_SetSubFrameExposureTime(int64_t the_subframe_exposure_time_in_10nsec);
|
|
||||||
int64_t Feb_Control_GetSubFrameExposureTime();
|
|
||||||
int Feb_Control_SetSubFramePeriod(int64_t the_subframe_period_in_10nsec);
|
|
||||||
int64_t Feb_Control_GetSubFramePeriod();
|
|
||||||
int Feb_Control_SetExposurePeriod(double the_exposure_period_in_sec);
|
|
||||||
double Feb_Control_GetExposurePeriod();
|
|
||||||
int Feb_Control_SetDynamicRange(unsigned int four_eight_sixteen_or_thirtytwo);
|
|
||||||
unsigned int Feb_Control_GetDynamicRange();
|
|
||||||
int Feb_Control_SetReadoutSpeed(unsigned int readout_speed); //0 was default, 0->full,1->half,2->quarter or 3->super_slow
|
|
||||||
int Feb_Control_SetReadoutMode(unsigned int readout_mode); ///0 was default,0->parallel,1->non-parallel,2-> safe_mode
|
|
||||||
int Feb_Control_SetTriggerMode(unsigned int trigger_mode, int polarity);//0 and 1 was default,
|
|
||||||
int Feb_Control_SetExternalEnableMode(int use_external_enable, int polarity);//0 and 1 was default,
|
|
||||||
|
|
||||||
//functions for testing
|
|
||||||
/*int Feb_Control_SetTestModeVariable(int on=1);*/
|
|
||||||
int Feb_Control_SetInTestModeVariable(int on);
|
|
||||||
int Feb_Control_GetTestModeVariable();
|
|
||||||
|
|
||||||
void Feb_Control_Set_Counter_Bit(int value);
|
|
||||||
int Feb_Control_Get_Counter_Bit();
|
|
||||||
int Feb_Control_Pulse_Pixel(int npulses,int x, int y);
|
|
||||||
int Feb_Control_PulsePixelNMove(int npulses, int inc_x_pos, int inc_y_pos);
|
|
||||||
int Feb_Control_Shift32InSerialIn(unsigned int value_to_shift_in);
|
|
||||||
int Feb_Control_SendTokenIn();
|
|
||||||
int Feb_Control_ClockRowClock(unsigned int ntimes);
|
|
||||||
int Feb_Control_PulseChip(int npulses);
|
|
||||||
|
|
||||||
int64_t Feb_Control_Get_RateTable_Tau_in_nsec();
|
|
||||||
int64_t Feb_Control_Get_RateTable_Period_in_nsec();
|
|
||||||
int Feb_Control_SetRateCorrectionTau(int64_t tau_in_Nsec);
|
|
||||||
int Feb_Control_SetRateCorrectionTable(unsigned int *table);
|
|
||||||
int Feb_Control_GetRateCorrectionVariable();
|
|
||||||
void Feb_Control_SetRateCorrectionVariable(int activate_rate_correction);
|
|
||||||
int Feb_Control_PrintCorrectedValues();
|
|
||||||
|
|
||||||
int Feb_Control_GetLeftFPGATemp();
|
|
||||||
int Feb_Control_GetRightFPGATemp();
|
|
||||||
|
|
||||||
int64_t Feb_Control_GetMeasuredPeriod();
|
|
||||||
int64_t Feb_Control_GetSubMeasuredPeriod();
|
|
||||||
|
|
||||||
int Feb_Control_SoftwareTrigger();
|
|
||||||
|
|
||||||
uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data);
|
|
||||||
uint32_t Feb_Control_ReadRegister(uint32_t offset);
|
|
||||||
#endif
|
|
||||||
|
@ -1,45 +1,31 @@
|
|||||||
|
#include "FebInterface.h"
|
||||||
/**
|
#include "LocalLinkInterface.h"
|
||||||
* @author Ian Johnson
|
#include "xparameters.h"
|
||||||
* @version 1.0
|
#include "logger.h"
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//#include <iostream>
|
|
||||||
//#include <iomanip>
|
|
||||||
//#include <unistd.h>
|
|
||||||
//#include <string.h>
|
|
||||||
//#include <sys/mman.h>
|
|
||||||
//#include <fcntl.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "xparameters.h"
|
|
||||||
|
|
||||||
#include "FebInterface.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
struct LocalLinkInterface ll_local,* ll;
|
||||||
|
|
||||||
struct LocalLinkInterface ll_local,* ll;
|
unsigned int Feb_Interface_nfebs;
|
||||||
|
unsigned int* Feb_Interface_feb_numb;
|
||||||
|
|
||||||
unsigned int Feb_Interface_nfebs;
|
int Feb_Interface_send_ndata;
|
||||||
unsigned int* Feb_Interface_feb_numb;
|
unsigned int Feb_Interface_send_buffer_size;
|
||||||
|
unsigned int* Feb_Interface_send_data_raw;
|
||||||
|
unsigned int* Feb_Interface_send_data;
|
||||||
|
|
||||||
int Feb_Interface_send_ndata;
|
int Feb_Interface_recv_ndata;
|
||||||
unsigned int Feb_Interface_send_buffer_size;
|
unsigned int Feb_Interface_recv_buffer_size;
|
||||||
unsigned int* Feb_Interface_send_data_raw;
|
unsigned int* Feb_Interface_recv_data_raw;
|
||||||
unsigned int* Feb_Interface_send_data;
|
unsigned int* Feb_Interface_recv_data;
|
||||||
|
|
||||||
int Feb_Interface_recv_ndata;
|
|
||||||
unsigned int Feb_Interface_recv_buffer_size;
|
|
||||||
unsigned int* Feb_Interface_recv_data_raw;
|
|
||||||
unsigned int* Feb_Interface_recv_data;
|
|
||||||
|
|
||||||
|
|
||||||
void Feb_Interface_FebInterface(){
|
void Feb_Interface_FebInterface() {
|
||||||
ll = &ll_local;
|
ll = &ll_local;
|
||||||
Feb_Interface_nfebs = 0;
|
Feb_Interface_nfebs = 0;
|
||||||
Feb_Interface_feb_numb = 0;
|
Feb_Interface_feb_numb = 0;
|
||||||
@ -54,131 +40,129 @@ void Feb_Interface_FebInterface(){
|
|||||||
Feb_Interface_recv_data_raw = malloc((Feb_Interface_recv_buffer_size+1) * sizeof(unsigned int));
|
Feb_Interface_recv_data_raw = malloc((Feb_Interface_recv_buffer_size+1) * sizeof(unsigned int));
|
||||||
Feb_Interface_recv_data = &Feb_Interface_recv_data_raw[1];
|
Feb_Interface_recv_data = &Feb_Interface_recv_data_raw[1];
|
||||||
|
|
||||||
Local_LocalLinkInterface1(ll,XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
|
Local_LocalLinkInterface1(ll,XPAR_PLB_LL_FIFO_AURORA_DUAL_CTRL_FEB_RIGHT_BASEADDR);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Feb_Interface_SendCompleteList(unsigned int n,unsigned int* list){
|
void Feb_Interface_SendCompleteList(unsigned int n,unsigned int* list) {
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
if(Feb_Interface_feb_numb) free(Feb_Interface_feb_numb);
|
if (Feb_Interface_feb_numb) free(Feb_Interface_feb_numb);
|
||||||
Feb_Interface_nfebs = n;
|
Feb_Interface_nfebs = n;
|
||||||
Feb_Interface_feb_numb = malloc(n * sizeof(unsigned int));
|
Feb_Interface_feb_numb = malloc(n * sizeof(unsigned int));
|
||||||
for(i=0;i<n;i++) Feb_Interface_feb_numb[i] = list[i];
|
for(i=0;i<n;i++) Feb_Interface_feb_numb[i] = list[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Interface_WriteTo(unsigned int ch){
|
int Feb_Interface_WriteTo(unsigned int ch) {
|
||||||
if(ch>0xfff) return 0;
|
if (ch>0xfff) return 0;
|
||||||
|
|
||||||
#ifdef MARTIN
|
FILE_LOG(logDEBUG5, ("FIW ch %d\n", ch));
|
||||||
cprintf(YELLOW, "FIW ch %d\n", ch);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Feb_Interface_send_data_raw[0] = 0x8fff0000;
|
Feb_Interface_send_data_raw[0] = 0x8fff0000;
|
||||||
if(Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
|
if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
|
||||||
|
|
||||||
Feb_Interface_send_data_raw[0] = 0x90000000 | (ch<<16);
|
Feb_Interface_send_data_raw[0] = 0x90000000 | (ch<<16);
|
||||||
if(Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
|
if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
|
||||||
|
|
||||||
Feb_Interface_send_data_raw[0] = 0xc0000000;
|
Feb_Interface_send_data_raw[0] = 0xc0000000;
|
||||||
return ((Feb_Interface_send_ndata+1)*4==Local_Write(ll,(Feb_Interface_send_ndata+1)*4,Feb_Interface_send_data_raw));
|
return ((Feb_Interface_send_ndata+1)*4==Local_Write(ll,(Feb_Interface_send_ndata+1)*4,Feb_Interface_send_data_raw));
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys){
|
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys) {
|
||||||
unsigned int t;
|
unsigned int t;
|
||||||
if(ch>=0xfff) return 0;
|
if (ch>=0xfff) return 0;
|
||||||
|
|
||||||
Feb_Interface_recv_data_raw[0] = 0xa0000000 | (ch<<16);
|
Feb_Interface_recv_data_raw[0] = 0xa0000000 | (ch<<16);
|
||||||
Local_Write(ll,4,Feb_Interface_recv_data_raw);
|
Local_Write(ll,4,Feb_Interface_recv_data_raw);
|
||||||
usleep(20);
|
usleep(20);
|
||||||
|
|
||||||
Feb_Interface_recv_ndata=-1;
|
Feb_Interface_recv_ndata=-1;
|
||||||
for(t=0;t<ntrys;t++){
|
for(t=0;t<ntrys;t++) {
|
||||||
if((Feb_Interface_recv_ndata=Local_Read(ll,Feb_Interface_recv_buffer_size*4,Feb_Interface_recv_data_raw)/4)>0){
|
if ((Feb_Interface_recv_ndata=Local_Read(ll,Feb_Interface_recv_buffer_size*4,Feb_Interface_recv_data_raw)/4)>0) {
|
||||||
Feb_Interface_recv_ndata--;
|
Feb_Interface_recv_ndata--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Feb_Interface_recv_ndata>=0);
|
return (Feb_Interface_recv_ndata>=0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Feb_Interface_SetByteOrder(){
|
int Feb_Interface_SetByteOrder() {
|
||||||
Feb_Interface_send_data_raw[0] = 0x8fff0000;
|
Feb_Interface_send_data_raw[0] = 0x8fff0000;
|
||||||
if(Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
|
if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0;
|
||||||
Feb_Interface_send_ndata = 2;
|
Feb_Interface_send_ndata = 2;
|
||||||
Feb_Interface_send_data[0] = 0;
|
Feb_Interface_send_data[0] = 0;
|
||||||
Feb_Interface_send_data[1] = 0;
|
Feb_Interface_send_data[1] = 0;
|
||||||
unsigned int i;
|
|
||||||
unsigned int dst = 0xff;
|
|
||||||
for(i=0;i<Feb_Interface_nfebs;i++) dst = (dst | Feb_Interface_feb_numb[i]);
|
|
||||||
int passed = Feb_Interface_WriteTo(dst);
|
|
||||||
|
|
||||||
return passed;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int* value_read){
|
|
||||||
return Feb_Interface_ReadRegisters(sub_num,1,®_num,value_read);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Feb_Interface_ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read){
|
|
||||||
//here cout<<"Reading Register ...."<<endl;
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
nreads &= 0x3ff;
|
unsigned int dst = 0xff;
|
||||||
if(!nreads||nreads>Feb_Interface_send_buffer_size-2) return 0;
|
for(i=0;i<Feb_Interface_nfebs;i++) dst = (dst | Feb_Interface_feb_numb[i]);
|
||||||
|
int passed = Feb_Interface_WriteTo(dst);
|
||||||
|
|
||||||
Feb_Interface_send_ndata = nreads+2;
|
return passed;
|
||||||
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
|
|
||||||
|
|
||||||
for(i=0;i<nreads;i++) Feb_Interface_send_data[i+1]=reg_nums[i];
|
|
||||||
Feb_Interface_send_data[nreads+1] = 0;
|
|
||||||
|
|
||||||
if(!Feb_Interface_WriteTo(sub_num)||!Feb_Interface_ReadFrom(sub_num,20)||Feb_Interface_recv_ndata!=(int)(nreads+2)) return 0;
|
|
||||||
|
|
||||||
for(i=0;i<nreads;i++) values_read[i] = Feb_Interface_recv_data[i+1];
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Interface_WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, int wait_on, unsigned int wait_on_address){
|
|
||||||
return Feb_Interface_WriteRegisters(sub_num,1,®_num,&value,&wait_on,&wait_on_address);
|
int Feb_Interface_ReadRegister(unsigned int sub_num, unsigned int reg_num,unsigned int* value_read) {
|
||||||
|
return Feb_Interface_ReadRegisters(sub_num,1,®_num,value_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
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_ReadRegisters(unsigned int sub_num, unsigned int nreads, unsigned int* reg_nums,unsigned int* values_read) {
|
||||||
|
//here cout<<"Reading Register ...."<<endl;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
nwrites &= 0x3ff; //10 bits
|
nreads &= 0x3ff;
|
||||||
if(!nwrites||2*nwrites>Feb_Interface_send_buffer_size-2) return 0;
|
if (!nreads||nreads>Feb_Interface_send_buffer_size-2) return 0;
|
||||||
|
|
||||||
//cout<<"Write register : "<<this<<" "<<s_num<<" "<<nwrites<<" "<<reg_nums<<" "<<values<<" "<<wait_ons<<" "<<wait_on_addresses<<endl;
|
Feb_Interface_send_ndata = nreads+2;
|
||||||
Feb_Interface_send_ndata = 2*nwrites+2;
|
Feb_Interface_send_data[0] = 0x20000000 | nreads << 14;
|
||||||
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
|
|
||||||
Feb_Interface_send_data[2*nwrites+1] = 0;
|
|
||||||
|
|
||||||
for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+1] = 0x3fff®_nums[i];
|
for(i=0;i<nreads;i++) Feb_Interface_send_data[i+1]=reg_nums[i];
|
||||||
for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+2] = values[i];
|
Feb_Interface_send_data[nreads+1] = 0;
|
||||||
// wait on busy data(28), address of busy flag data(27 downto 14)
|
|
||||||
if(wait_ons&&wait_on_addresses) for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+1] |= (wait_ons[i]<<28 | (0x3fff&wait_on_addresses[i])<<14);
|
|
||||||
|
|
||||||
if(!Feb_Interface_WriteTo(sub_num)) return 0;
|
if (!Feb_Interface_WriteTo(sub_num)||!Feb_Interface_ReadFrom(sub_num,20)||Feb_Interface_recv_ndata!=(int)(nreads+2)) return 0;
|
||||||
|
|
||||||
return 1;
|
for(i=0;i<nreads;i++) values_read[i] = Feb_Interface_recv_data[i+1];
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values){
|
int Feb_Interface_WriteRegister(unsigned int sub_num, unsigned int reg_num,unsigned int value, int wait_on, unsigned int wait_on_address) {
|
||||||
|
return Feb_Interface_WriteRegisters(sub_num,1,®_num,&value,&wait_on,&wait_on_address);
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
unsigned int i;
|
||||||
|
nwrites &= 0x3ff; //10 bits
|
||||||
|
if (!nwrites||2*nwrites>Feb_Interface_send_buffer_size-2) return 0;
|
||||||
|
|
||||||
|
//cout<<"Write register : "<<this<<" "<<s_num<<" "<<nwrites<<" "<<reg_nums<<" "<<values<<" "<<wait_ons<<" "<<wait_on_addresses<<endl;
|
||||||
|
Feb_Interface_send_ndata = 2*nwrites+2;
|
||||||
|
Feb_Interface_send_data[0] = 0x80000000 | nwrites << 14;
|
||||||
|
Feb_Interface_send_data[2*nwrites+1] = 0;
|
||||||
|
|
||||||
|
for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+1] = 0x3fff®_nums[i];
|
||||||
|
for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+2] = values[i];
|
||||||
|
// wait on busy data(28), address of busy flag data(27 downto 14)
|
||||||
|
if (wait_ons&&wait_on_addresses) for(i=0;i<nwrites;i++) Feb_Interface_send_data[2*i+1] |= (wait_ons[i]<<28 | (0x3fff&wait_on_addresses[i])<<14);
|
||||||
|
|
||||||
|
if (!Feb_Interface_WriteTo(sub_num)) return 0;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values) {
|
||||||
unsigned int max_single_packet_size = 352;
|
unsigned int max_single_packet_size = 352;
|
||||||
int passed=1;
|
int passed=1;
|
||||||
unsigned int n_to_send = max_single_packet_size;
|
unsigned int n_to_send = max_single_packet_size;
|
||||||
unsigned int ndata_sent = 0;
|
unsigned int ndata_sent = 0;
|
||||||
unsigned int ndata_countdown = nwrites;
|
unsigned int ndata_countdown = nwrites;
|
||||||
while(ndata_countdown>0){
|
while(ndata_countdown>0) {
|
||||||
n_to_send = ndata_countdown<max_single_packet_size ? ndata_countdown:max_single_packet_size;
|
n_to_send = ndata_countdown<max_single_packet_size ? ndata_countdown:max_single_packet_size;
|
||||||
if(!Feb_Interface_WriteMemory(sub_num,mem_num,start_address,n_to_send,&(values[ndata_sent]))){passed=0; break;}
|
if (!Feb_Interface_WriteMemory(sub_num,mem_num,start_address,n_to_send,&(values[ndata_sent]))) {passed=0; break;}
|
||||||
ndata_countdown-=n_to_send;
|
ndata_countdown-=n_to_send;
|
||||||
ndata_sent +=n_to_send;
|
ndata_sent +=n_to_send;
|
||||||
start_address +=n_to_send;
|
start_address +=n_to_send;
|
||||||
@ -187,23 +171,26 @@ int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num,
|
|||||||
return passed;
|
return passed;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values){
|
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values) {
|
||||||
// -1 means write to all
|
// -1 means write to all
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
mem_num &= 0x3f;
|
mem_num &= 0x3f;
|
||||||
start_address &= 0x3fff;
|
start_address &= 0x3fff;
|
||||||
nwrites &= 0x3ff;
|
nwrites &= 0x3ff;
|
||||||
if(!nwrites||nwrites>Feb_Interface_send_buffer_size-2) {printf("error herer: nwrites:%d\n",nwrites);return 0;}//*d-1026
|
if (!nwrites||nwrites>Feb_Interface_send_buffer_size-2) {
|
||||||
|
FILE_LOG(logERROR, ("invalid nwrites:%d\n",nwrites));
|
||||||
|
return 0;
|
||||||
|
}//*d-1026
|
||||||
|
|
||||||
Feb_Interface_send_ndata = nwrites+2;//*d-1026
|
Feb_Interface_send_ndata = nwrites+2;//*d-1026
|
||||||
Feb_Interface_send_data[0] = 0xc0000000 | mem_num << 24 | nwrites << 14 | start_address; //cmd -> write to memory, nwrites, mem number, start address
|
Feb_Interface_send_data[0] = 0xc0000000 | mem_num << 24 | nwrites << 14 | start_address; //cmd -> write to memory, nwrites, mem number, start address
|
||||||
Feb_Interface_send_data[nwrites+1] = 0;
|
Feb_Interface_send_data[nwrites+1] = 0;
|
||||||
for(i=0;i<nwrites;i++) Feb_Interface_send_data[i+1] = values[i];
|
for(i=0;i<nwrites;i++) Feb_Interface_send_data[i+1] = values[i];
|
||||||
|
|
||||||
|
|
||||||
if(!Feb_Interface_WriteTo(sub_num)) return 0;
|
if (!Feb_Interface_WriteTo(sub_num)) return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,43 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
/**
|
int Feb_Interface_WriteTo(unsigned int ch);
|
||||||
* @author Ian Johnson
|
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
|
||||||
* @version 1.0
|
void Feb_Interface_FebInterface();
|
||||||
*/
|
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, 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, unsigned int* wait_on_addresses);
|
||||||
|
int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
|
||||||
|
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
|
||||||
|
|
||||||
|
|
||||||
#ifndef FEBINTERFACE_H
|
|
||||||
#define FEBINTERFACE_H
|
|
||||||
|
|
||||||
#include "LocalLinkInterface.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Feb_Interface_WriteTo(unsigned int ch);
|
|
||||||
/*int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys=20);*/
|
|
||||||
int Feb_Interface_ReadFrom(unsigned int ch, unsigned int ntrys);
|
|
||||||
|
|
||||||
void Feb_Interface_FebInterface();
|
|
||||||
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
//mem_num is 0 for trimbit BRAM and 1 for rate correction BRAM
|
|
||||||
int Feb_Interface_WriteMemoryInLoops(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
|
|
||||||
|
|
||||||
int Feb_Interface_WriteMemory(unsigned int sub_num, unsigned int mem_num, unsigned int start_address, unsigned int nwrites, unsigned int *values);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,14 +1,3 @@
|
|||||||
|
|
||||||
//Class initially from Gerd and was called mmap_test.c
|
|
||||||
//return reversed 1 means good, 0 means failed
|
|
||||||
|
|
||||||
|
|
||||||
//#include <stdio.h>
|
|
||||||
//#include <unistd.h>
|
|
||||||
//#include <string.h>
|
|
||||||
//#include <sys/mman.h>
|
|
||||||
//#include <fcntl.h>
|
|
||||||
|
|
||||||
#include "HardwareIO.h"
|
#include "HardwareIO.h"
|
||||||
|
|
||||||
xfs_u8 HWIO_xfs_in8(xfs_u32 InAddress)
|
xfs_u8 HWIO_xfs_in8(xfs_u32 InAddress)
|
||||||
|
@ -1,44 +1,36 @@
|
|||||||
|
#include "LocalLinkInterface.h"
|
||||||
//Class initially from Gerd and was called mmap_test.c
|
#include "HardwareMMappingDefs.h"
|
||||||
//return reversed 1 means good, 0 means failed
|
#include "logger.h"
|
||||||
|
#include "ansi.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
//#include <string.h>
|
#include <sys/mman.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
|
||||||
#include "HardwareMMappingDefs.h"
|
void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr) {
|
||||||
|
FILE_LOG(logDEBUG5, ("Initialize PLB LL FIFOs\n"));
|
||||||
#include "LocalLinkInterface.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr){
|
|
||||||
// printf("\n v 1 \n");
|
|
||||||
printf("Initialize PLB LL FIFOs\n");
|
|
||||||
ll->ll_fifo_base=0;
|
ll->ll_fifo_base=0;
|
||||||
ll->ll_fifo_ctrl_reg=0;
|
ll->ll_fifo_ctrl_reg=0;
|
||||||
if(Local_Init(ll,ll_fifo_badr)){
|
if (Local_Init(ll,ll_fifo_badr)) {
|
||||||
Local_Reset(ll);
|
Local_Reset(ll);
|
||||||
printf("\tFIFO Status : 0x%08x\n",Local_StatusVector(ll));
|
FILE_LOG(logDEBUG5, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll)));
|
||||||
}else printf("\tError LocalLink Mappping : 0x%08x\n",ll_fifo_badr);
|
} else FILE_LOG(logERROR, ("\tCould not map LocalLink : 0x%08x\n\n\n", ll_fifo_badr));
|
||||||
printf("\n\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*~LocalLinkInterface(){};*/
|
|
||||||
|
|
||||||
void Local_LocalLinkInterface(struct LocalLinkInterface* ll){
|
void Local_LocalLinkInterface(struct LocalLinkInterface* ll) {
|
||||||
printf("Initializing new memory\n");
|
FILE_LOG(logDEBUG5, ("Initializing new memory\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Local_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr){
|
int Local_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr) {
|
||||||
int fd;
|
int fd;
|
||||||
void *plb_ll_fifo_ptr;
|
void *plb_ll_fifo_ptr;
|
||||||
|
|
||||||
if ((fd=open("/dev/mem", O_RDWR)) < 0){
|
if ((fd=open("/dev/mem", O_RDWR)) < 0) {
|
||||||
fprintf(stderr, "Could not open /dev/mem\n");
|
fprintf(stderr, "Could not open /dev/mem\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -46,7 +38,7 @@ int Local_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr){
|
|||||||
plb_ll_fifo_ptr = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, ll_fifo_badr);
|
plb_ll_fifo_ptr = mmap(0, getpagesize(), PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, ll_fifo_badr);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
if (plb_ll_fifo_ptr == MAP_FAILED){
|
if (plb_ll_fifo_ptr == MAP_FAILED) {
|
||||||
perror ("mmap");
|
perror ("mmap");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -59,13 +51,13 @@ int Local_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Local_Reset(struct LocalLinkInterface* ll){
|
int Local_Reset(struct LocalLinkInterface* ll) {
|
||||||
return Local_Reset1(ll,PLB_LL_FIFO_CTRL_RESET_STD);
|
return Local_Reset1(ll,PLB_LL_FIFO_CTRL_RESET_STD);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask){
|
int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask) {
|
||||||
ll->ll_fifo_ctrl_reg |= rst_mask;
|
ll->ll_fifo_ctrl_reg |= rst_mask;
|
||||||
printf("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg);
|
FILE_LOG(logDEBUG5, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg));
|
||||||
|
|
||||||
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
||||||
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
||||||
@ -75,17 +67,16 @@ int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask){
|
|||||||
ll->ll_fifo_ctrl_reg &= (~rst_mask);
|
ll->ll_fifo_ctrl_reg &= (~rst_mask);
|
||||||
|
|
||||||
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
||||||
// printf("FIFO CTRL Address: 0x%08x\n FIFO CTRL Register: 0x%08x\n",PLB_LL_FIFO_REG_CTRL,plb_ll_fifo[PLB_LL_FIFO_REG_CTRL]);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int Local_StatusVector(struct LocalLinkInterface* ll){
|
unsigned int Local_StatusVector(struct LocalLinkInterface* ll) {
|
||||||
return HWIO_xfs_in32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS);
|
return HWIO_xfs_in32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer){
|
int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer) {
|
||||||
// note: buffer must be word (4 byte) aligned
|
// note: buffer must be word (4 byte) aligned
|
||||||
// frame_len in byte
|
// frame_len in byte
|
||||||
int vacancy=0;
|
int vacancy=0;
|
||||||
@ -101,22 +92,19 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf
|
|||||||
last_word = (buffer_len-1)/4;
|
last_word = (buffer_len-1)/4;
|
||||||
word_ptr = (unsigned int *)buffer;
|
word_ptr = (unsigned int *)buffer;
|
||||||
|
|
||||||
#ifdef MARTIN
|
FILE_LOG(logDEBUG5, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base));
|
||||||
cprintf(BLUE, "LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base);
|
|
||||||
for (i=0; i < buffer_len/4; i++)
|
for (i=0; i < buffer_len/4; i++)
|
||||||
cprintf(BLUE, "%.8X ",*(((unsigned *) buffer)+i));
|
FILE_LOG(logDEBUG5, ("%.8X ",*(((unsigned *) buffer)+i)));
|
||||||
printf("\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (words_send <= last_word)
|
while (words_send <= last_word)
|
||||||
{
|
{
|
||||||
while (!vacancy)//wait for Fifo to be empty again
|
while (!vacancy)//wait for Fifo to be empty again
|
||||||
{
|
{
|
||||||
status = HWIO_xfs_in32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS);
|
status = HWIO_xfs_in32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_STATUS);
|
||||||
if((status & PLB_LL_FIFO_STATUS_ALMOSTFULL) == 0) vacancy = 1;
|
if ((status & PLB_LL_FIFO_STATUS_ALMOSTFULL) == 0) vacancy = 1;
|
||||||
#ifdef MARTIN
|
if (vacancy == 0) {
|
||||||
if (vacancy == 0) cprintf(RED, "Fifo full!\n");
|
FILE_LOG(logERROR, ("Fifo full!\n"));
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Just to know: #define PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS 100
|
//Just to know: #define PLB_LL_FIFO_ALMOST_FULL_THRESHOLD_WORDS 100
|
||||||
@ -140,7 +128,7 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer){
|
int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer) {
|
||||||
static unsigned int buffer_ptr = 0;
|
static unsigned int buffer_ptr = 0;
|
||||||
// note: buffer must be word (4 byte) aligned
|
// note: buffer must be word (4 byte) aligned
|
||||||
// frame_len in byte
|
// frame_len in byte
|
||||||
@ -150,9 +138,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
|||||||
volatile unsigned int fifo_val;
|
volatile unsigned int fifo_val;
|
||||||
int sof = 0;
|
int sof = 0;
|
||||||
|
|
||||||
#ifdef MARTIN
|
FILE_LOG(logDEBUG5, ("LL Read - If: %X - Data: ",ll->ll_fifo_base));
|
||||||
cprintf(CYAN, "LL Read - If: %X - Data: ",ll->ll_fifo_base);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
word_ptr = (unsigned int *)buffer;
|
word_ptr = (unsigned int *)buffer;
|
||||||
do
|
do
|
||||||
@ -168,7 +154,6 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
|||||||
buffer_ptr = 0;
|
buffer_ptr = 0;
|
||||||
return -1; // buffer overflow
|
return -1; // buffer overflow
|
||||||
}
|
}
|
||||||
// printf(">>>> SOF\n\r");
|
|
||||||
buffer_ptr = 0;
|
buffer_ptr = 0;
|
||||||
sof = 1;
|
sof = 1;
|
||||||
}
|
}
|
||||||
@ -179,9 +164,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
|||||||
{
|
{
|
||||||
if ( (buffer_len >> 2) > buffer_ptr)
|
if ( (buffer_len >> 2) > buffer_ptr)
|
||||||
{
|
{
|
||||||
#ifdef MARTIN
|
FILE_LOG(logDEBUG5, ("%.8X ", fifo_val));
|
||||||
cprintf(CYAN, "%.8X ", fifo_val);
|
|
||||||
#endif
|
|
||||||
word_ptr[buffer_ptr++] = fifo_val; //write to buffer
|
word_ptr[buffer_ptr++] = fifo_val; //write to buffer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -193,10 +176,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
|||||||
if (status & PLB_LL_FIFO_STATUS_LL_EOF)
|
if (status & PLB_LL_FIFO_STATUS_LL_EOF)
|
||||||
{
|
{
|
||||||
len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT );
|
len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT );
|
||||||
#ifdef MARTIN
|
FILE_LOG(logDEBUG5, ("Len: %d\n",len));
|
||||||
cprintf(CYAN, "Len: %d\n",len);
|
|
||||||
#endif
|
|
||||||
// printf(">>>>status=0x%08x EOF len = %d \n\r\n\r",status, len);
|
|
||||||
buffer_ptr = 0;
|
buffer_ptr = 0;
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@ -209,19 +189,15 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Local_ctrl_reg_write_mask(struct LocalLinkInterface* ll,unsigned int mask, unsigned int val){
|
int Local_ctrl_reg_write_mask(struct LocalLinkInterface* ll,unsigned int mask, unsigned int val) {
|
||||||
// printf("Fifo CTRL Reg(1): 0x%08x\n",plb_ll_fifo_ctrl_reg);
|
|
||||||
ll->ll_fifo_ctrl_reg &= (~mask);
|
ll->ll_fifo_ctrl_reg &= (~mask);
|
||||||
//printf("Fifo CTRL Reg(2): 0x%08x\n",plb_ll_fifo_ctrl_reg);
|
|
||||||
ll->ll_fifo_ctrl_reg |= ( mask & val);
|
ll->ll_fifo_ctrl_reg |= ( mask & val);
|
||||||
// printf("Fifo CTRL Reg: 0x%08x\n",plb_ll_fifo_ctrl_reg);
|
|
||||||
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg);
|
||||||
// printf("Fifo STAT Reg: 0x%08x\n", plb_ll_fifo[PLB_LL_FIFO_REG_STATUS]);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer){
|
int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buffer) {
|
||||||
|
|
||||||
int len;
|
int len;
|
||||||
unsigned int rec_buff_len = 4096;
|
unsigned int rec_buff_len = 4096;
|
||||||
@ -233,28 +209,14 @@ int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff
|
|||||||
|
|
||||||
do{
|
do{
|
||||||
len = Local_Read(ll,rec_buff_len,rec_buffer);
|
len = Local_Read(ll,rec_buff_len,rec_buffer);
|
||||||
printf("receive length: %i\n",len);
|
FILE_LOG(logDEBUG5, ("receive length: %i\n",len));
|
||||||
|
|
||||||
if (len > 0){
|
if (len > 0) {
|
||||||
rec_buffer[len]=0;
|
rec_buffer[len]=0;
|
||||||
printf((char*) rec_buffer);
|
FILE_LOG(logINFO, ("%s\n", (char*) rec_buffer));
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
} while(len > 0);
|
} while(len > 0);
|
||||||
|
|
||||||
printf("\n\n\n\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Local_llfifo_print_frame(struct LocalLinkInterface* ll,unsigned char* fbuff, int len){
|
|
||||||
int i;
|
|
||||||
printf("\n\r----Frame of len : %d Byte\n\r",len);
|
|
||||||
for(i=0;i<len;i++){
|
|
||||||
printf("0x%02x ",fbuff[i] );
|
|
||||||
if ((i&0xf) == 0x7) printf(" ");
|
|
||||||
if ((i&0xf) == 0xf) printf("\n\r");
|
|
||||||
}
|
|
||||||
printf("\n\r");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,54 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
//Class initially from Gerd and was called mmap_test.c
|
|
||||||
|
|
||||||
#ifndef LOCALLINKINTERFACE_H
|
|
||||||
#define LOCALLINKINTERFACE_H
|
|
||||||
|
|
||||||
#include "xfs_types.h"
|
|
||||||
#include "HardwareIO.h"
|
#include "HardwareIO.h"
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "ansi.h"
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
/*class LocalLinkInterface: public HardwareIO{ //*/
|
|
||||||
|
|
||||||
|
|
||||||
struct LocalLinkInterface{
|
struct LocalLinkInterface{
|
||||||
xfs_u32 ll_fifo_base;
|
xfs_u32 ll_fifo_base;
|
||||||
unsigned int ll_fifo_ctrl_reg;
|
unsigned int ll_fifo_ctrl_reg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int Local_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr);
|
||||||
|
int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask);
|
||||||
|
int Local_ctrl_reg_write_mask(struct LocalLinkInterface* ll,unsigned int mask, unsigned int val);
|
||||||
|
void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr);
|
||||||
|
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_Init(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr);
|
|
||||||
int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask);
|
|
||||||
|
|
||||||
int Local_ctrl_reg_write_mask(struct LocalLinkInterface* ll,unsigned int mask, unsigned int val);
|
|
||||||
void Local_llfifo_print_frame(struct LocalLinkInterface* ll,unsigned char* fbuff, int len);
|
|
||||||
|
|
||||||
|
|
||||||
void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr);
|
|
||||||
/* 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 FiFoReset(unsigned int numb);
|
|
||||||
int FifoSend(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);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorPackage/slsDetectorServers/eigerDetectorServer
|
Path: slsDetectorPackage/slsDetectorServers/eigerDetectorServer
|
||||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||||
Repsitory UUID: 178b83222380f7b7294cde66e66719c5d1c1363c
|
Repsitory UUID: dfad145e1492e961c95063aa5b2f54e5e1b418a0
|
||||||
Revision: 2
|
Revision: 3
|
||||||
Branch: refactor
|
Branch: refactor
|
||||||
Last Changed Author: Dhanya_Thattil
|
Last Changed Author: Dhanya_Thattil
|
||||||
Last Changed Rev: 4125
|
Last Changed Rev: 4127
|
||||||
Last Changed Date: 2018-10-16 09:02:45.000000002 +0200 ./Makefile
|
Last Changed Date: 2018-10-23 12:30:26.000000002 +0200 ./Beb.c
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||||
#define GITREPUUID "178b83222380f7b7294cde66e66719c5d1c1363c"
|
#define GITREPUUID "dfad145e1492e961c95063aa5b2f54e5e1b418a0"
|
||||||
#define GITAUTH "Dhanya_Thattil"
|
#define GITAUTH "Dhanya_Thattil"
|
||||||
#define GITREV 0x4125
|
#define GITREV 0x4127
|
||||||
#define GITDATE 0x20181016
|
#define GITDATE 0x20181023
|
||||||
#define GITBRANCH "refactor"
|
#define GITBRANCH "refactor"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -42,7 +42,7 @@ enum DACINDEX {SVP,VTR,VRF,VRS,SVN,VTGSTV,VCMP_LL,VCMP_LR,CAL,VCMP_RL,RX
|
|||||||
};
|
};
|
||||||
enum ADCINDEX {TEMP_FPGAEXT, TEMP_10GE, TEMP_DCDC, TEMP_SODL, TEMP_SODR, TEMP_FPGA, TEMP_FPGAFEBL, TEMP_FPGAFEBR};
|
enum ADCINDEX {TEMP_FPGAEXT, TEMP_10GE, TEMP_DCDC, TEMP_SODL, TEMP_SODR, TEMP_FPGA, TEMP_FPGAFEBL, TEMP_FPGAFEBR};
|
||||||
enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
|
enum NETWORKINDEX {TXN_LEFT, TXN_RIGHT, TXN_FRAME,FLOWCTRL_10G};
|
||||||
|
enum {E_PARALLEL, E_NON_PARALLEL, E_SAFE};
|
||||||
|
|
||||||
/* Hardware Definitions */
|
/* Hardware Definitions */
|
||||||
#define NCHAN (256 * 256)
|
#define NCHAN (256 * 256)
|
||||||
|
@ -448,7 +448,7 @@ void setupDetector() {
|
|||||||
|
|
||||||
bus_w(DAQ_REG, 0x0); /* Only once at server startup */
|
bus_w(DAQ_REG, 0x0); /* Only once at server startup */
|
||||||
|
|
||||||
setSpeed(CLOCK_DIVIDER, HALF_SPEED);
|
setSpeed(HALF_SPEED);
|
||||||
cleanFifos();
|
cleanFifos();
|
||||||
resetCore();
|
resetCore();
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ void setupDetector() {
|
|||||||
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
setTimer(DELAY_AFTER_TRIGGER, DEFAULT_DELAY);
|
||||||
setTimer(STORAGE_CELL_NUMBER, DEFAULT_NUM_STRG_CLLS);
|
setTimer(STORAGE_CELL_NUMBER, DEFAULT_NUM_STRG_CLLS);
|
||||||
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
|
selectStoragecellStart(DEFAULT_STRG_CLL_STRT);
|
||||||
/*setSpeed(CLOCK_DIVIDER, HALF_SPEED); depends if all the previous stuff works*/
|
/*setSpeed(HALF_SPEED); depends if all the previous stuff works*/
|
||||||
setTiming(DEFAULT_TIMING_MODE);
|
setTiming(DEFAULT_TIMING_MODE);
|
||||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||||
|
|
||||||
@ -611,10 +611,7 @@ int setDynamicRange(int dr){
|
|||||||
|
|
||||||
/* parameters - readout */
|
/* parameters - readout */
|
||||||
|
|
||||||
int setSpeed(enum speedVariable arg, int val) {
|
enum speedVariable setSpeed(int val) {
|
||||||
|
|
||||||
if (arg != CLOCK_DIVIDER)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
// setting
|
// setting
|
||||||
if(val >= 0) {
|
if(val >= 0) {
|
||||||
@ -1620,7 +1617,7 @@ void readFrame(int *ret, char *mess){
|
|||||||
} else {
|
} else {
|
||||||
*ret = (int)FINISHED;
|
*ret = (int)FINISHED;
|
||||||
sprintf(mess,"acquisition successfully finished\n");
|
sprintf(mess,"acquisition successfully finished\n");
|
||||||
printf("%s",mess);
|
cprintf(GREEN, "%s",mess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServer/AD9257.h
|
|
@ -1,33 +0,0 @@
|
|||||||
CROSS = bfin-uclinux-
|
|
||||||
CC = $(CROSS)gcc
|
|
||||||
#CC = gcc
|
|
||||||
CLAGS += -Wall -DMYTHEN3D -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
|
|
||||||
LDLIBS += -lm -lstdc++
|
|
||||||
|
|
||||||
|
|
||||||
PROGS = mythen3DetectorServer
|
|
||||||
DESTDIR ?= bin
|
|
||||||
INSTMODE = 0777
|
|
||||||
|
|
||||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
|
||||||
OBJS = $(SRC_CLNT:.c=.o)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
all: clean versioning $(PROGS)
|
|
||||||
|
|
||||||
boot: $(OBJS)
|
|
||||||
|
|
||||||
versioning:
|
|
||||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
|
||||||
# echo $(OBJS)
|
|
||||||
mkdir -p $(DESTDIR)
|
|
||||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
|
||||||
mv $(PROGS) $(DESTDIR)
|
|
||||||
rm *.gdb
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(DESTDIR)/$(PROGS) *.o
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
CC = gcc
|
|
||||||
CFLAGS += -Wall -DVIRTUAL -DMYTHEN3D -DSLS_DETECTOR_FUNCTION_LIST -DDACS_INT -DSTOP_SERVER #-DVERBOSEI #-DVERBOSE
|
|
||||||
LDLIBS += -lm -lstdc++
|
|
||||||
|
|
||||||
PROGS = virtualMythen3DetectorServer
|
|
||||||
DESTDIR ?= bin
|
|
||||||
INSTMODE = 0777
|
|
||||||
|
|
||||||
SRC_CLNT = communication_funcs.c slsDetectorServer.c slsDetectorServer_funcs.c slsDetectorFunctionList.c
|
|
||||||
OBJS = $(SRC_CLNT:.c=.o)
|
|
||||||
|
|
||||||
all: clean $(PROGS)
|
|
||||||
|
|
||||||
boot: $(OBJS)
|
|
||||||
|
|
||||||
$(PROGS): $(OBJS)
|
|
||||||
echo $(OBJS)
|
|
||||||
mkdir -p $(DESTDIR)
|
|
||||||
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
|
|
||||||
mv $(PROGS) $(DESTDIR)
|
|
||||||
rm *.gdb
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -rf $(DESTDIR)/$(PROGS) *.o
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
|||||||
#ifndef REGISTERS_G_H
|
|
||||||
#define REGISTERS_G_H
|
|
||||||
|
|
||||||
/* Definitions for FPGA*/
|
|
||||||
|
|
||||||
/* FPGA Version register */
|
|
||||||
#define FPGA_VERSION_REG (0x00 << 11)
|
|
||||||
|
|
||||||
#define BOARD_REVISION_OFST (0)
|
|
||||||
#define BOARD_REVISION_MSK (0x00FFFFFF << BOARD_REVISION_OFST)
|
|
||||||
#define DETECTOR_TYPE_OFST (24)
|
|
||||||
#define DETECTOR_TYPE_MSK (0x000000FF << DETECTOR_TYPE_OFST)
|
|
||||||
|
|
||||||
/* Fix pattern register */
|
|
||||||
#define FIX_PATT_REG (0x01 << 11)
|
|
||||||
|
|
||||||
|
|
||||||
/* Timer 64 bit Regiser */
|
|
||||||
#define SET_DELAY_LSB_REG (0x60 << 11) //96<<11 //0x68<<11
|
|
||||||
#define SET_DELAY_MSB_REG (0x61 << 11) //97<<11 //0x69<<11
|
|
||||||
#define SET_CYCLES_LSB_REG (0x62 << 11) //98<<11//0x6c<<11
|
|
||||||
#define SET_CYCLES_MSB_REG (0x63 << 11) //99<<11//0x6d<<11
|
|
||||||
#define SET_FRAMES_LSB_REG (0x64 << 11) //(100<<11)/** to hex */
|
|
||||||
#define SET_FRAMES_MSB_REG (0x65 << 11) //101<<11//0x71<<11
|
|
||||||
#define SET_PERIOD_LSB_REG (0x66 << 11) //102<<11//0x74<<11
|
|
||||||
#define SET_PERIOD_MSB_REG (0x67 << 11) //103<<11//0x75<<11
|
|
||||||
#define SET_GATES_LSB_REG (0x6A << 11) /*check in firmware*///106<<11//0x7c<<11
|
|
||||||
#define SET_GATES_MSB_REG (0x6B << 11) //107<<11//0x7d<<11
|
|
||||||
#define SET_EXPTIME_LSB_REG (0x72 << 11) /** check in firmware *///114<<11//0x78<<11
|
|
||||||
#define SET_EXPTIME_MSB_REG (0x73 << 11) //115<<11//0x79<<11
|
|
||||||
|
|
||||||
#define GET_ACTUAL_TIME_LSB_REG (0x10 << 11) //16<<11
|
|
||||||
#define GET_ACTUAL_TIME_MSB_REG (0x11 << 11) //17<<11
|
|
||||||
#define GET_DELAY_LSB_REG (0x12 << 11) //18<<11//0x6a<<11
|
|
||||||
#define GET_DELAY_MSB_REG (0x13 << 11) //19<<11//0x6b<<11
|
|
||||||
#define GET_CYCLES_LSB_REG (0x14 << 11) //20<<11//0x6e<<11
|
|
||||||
#define GET_CYCLES_MSB_REG (0x15 << 11) //21<<11//0x6f<<11
|
|
||||||
#define GET_FRAMES_LSB_REG (0x16 << 11) //22<<11//0x72<<11
|
|
||||||
#define GET_FRAMES_MSB_REG (0x17 << 11) //23<<11//0x73<<11
|
|
||||||
#define GET_PERIOD_LSB_REG (0x18 << 11) //24<<11//0x76<<11
|
|
||||||
#define GET_PERIOD_MSB_REG (0x19 << 11) //25<<11//0x77<<11
|
|
||||||
#define GET_EXPTIME_LSB_REG (0x1A << 11) //26<<11//0x7a<<11
|
|
||||||
#define GET_EXPTIME_MSB_REG (0x1B << 11) //27<<11//0x7b<<11
|
|
||||||
#define GET_GATES_LSB_REG (0x1C << 11) //28<<11//0x7e<<11
|
|
||||||
#define GET_GATES_MSB_REG (0x1D << 11) //29<<11//0x7f<<11
|
|
||||||
|
|
||||||
#define FRAMES_FROM_START_LSB_REG (0x22 << 11) //34<<11
|
|
||||||
#define FRAMES_FROM_START_MSB_REG (0x23 << 11) //35<<11
|
|
||||||
#define FRAMES_FROM_START_PG_LSB_REG (0x24 << 11) //36<<11
|
|
||||||
#define FRAMES_FROM_START_PG_MSB_REG (0x25 << 11) //37<<11
|
|
||||||
#define GET_MEASUREMENT_TIME_LSB_REG (0x26 << 11) //38<<11
|
|
||||||
#define GET_MEASUREMENT_TIME_MSB_REG (0x27 << 11) //39<<11
|
|
||||||
|
|
||||||
|
|
||||||
/* SPI (Serial Peripheral Interface) Register */
|
|
||||||
#define SPI_REG (0x40 << 11)
|
|
||||||
|
|
||||||
#define DAC_SERIAL_DIGITAL_OUT_OFST (0)
|
|
||||||
#define DAC_SERIAL_DIGITAL_OUT_MSK (0x00000001 << DAC_SERIAL_DIGITAL_OUT_OFST)
|
|
||||||
#define DAC_SERIAL_CLK_OUT_OFST (1)
|
|
||||||
#define DAC_SERIAL_CLK_OUT_MSK (0x00000001 << DAC_SERIAL_CLK_OUT_OFST)
|
|
||||||
#define DAC_SERIAL_CS_OUT_OFST (2)
|
|
||||||
#define DAC_SERIAL_CS_OUT_MSK (0x00000001 << DAC_SERIAL_CS_OUT_OFST)
|
|
||||||
#define HV_SERIAL_DIGITAL_OUT_OFST (8)
|
|
||||||
#define HV_SERIAL_DIGITAL_OUT_MSK (0x00000001 << HV_SERIAL_DIGITAL_OUT_OFST)
|
|
||||||
#define HV_SERIAL_CLK_OUT_OFST (9)
|
|
||||||
#define HV_SERIAL_CLK_OUT_MSK (0x00000001 << HV_SERIAL_CLK_OUT_OFST)
|
|
||||||
#define HV_SERIAL_CS_OUT_OFST (10)
|
|
||||||
#define HV_SERIAL_CS_OUT_MSK (0x00000001 << HV_SERIAL_CS_OUT_OFST)
|
|
||||||
|
|
||||||
/* Control Register */
|
|
||||||
#define CONTROL_REG (0x4F << 11) //(79 << 11) /** to hex */
|
|
||||||
|
|
||||||
|
|
||||||
/* Reconfiguratble PLL Control Regiser */
|
|
||||||
#define PLL_CONTROL_REG (0x51 << 11) //(81 << 11)/** to hex */
|
|
||||||
|
|
||||||
//#define PLL_CTRL_RECONFIG_RST_OFST (0) //parameter reset
|
|
||||||
//#define PLL_CTRL_RECONFIG_RST_MSK (0x00000001 << PLL_CTRL_RECONFIG_RST_OFST) //parameter reset
|
|
||||||
//#define PLL_CTRL_WR_PARAMETER_OFST (2)
|
|
||||||
//#define PLL_CTRL_WR_PARAMETER_MSK (0x00000001 << PLL_CTRL_WR_PARAMETER_OFST)
|
|
||||||
#define PLL_CTRL_RST_OFST (3)
|
|
||||||
#define PLL_CTRL_RST_MSK (0x00000001 << PLL_CTRL_RST_OFST)
|
|
||||||
//#define PLL_CTRL_ADDR_OFST (16)
|
|
||||||
//#define PLL_CTRL_ADDR_MSK (0x0000003F << PLL_CTRL_ADDR_OFST)
|
|
||||||
|
|
||||||
/* Samples Register */
|
|
||||||
#define NSAMPLES_REG (0x5D << 11) //93<<11
|
|
||||||
|
|
||||||
/* Power On Register */
|
|
||||||
#define POWER_ON_REG (0x5e<<11)
|
|
||||||
|
|
||||||
#define POWER_ENABLE_OFST (16)
|
|
||||||
|
|
||||||
/* Dac Registers */
|
|
||||||
#define DAC_VAL_REG (0x79 << 11) //121<<11
|
|
||||||
#define DAC_NUM_REG (0x80 << 11) //122<<11
|
|
||||||
#define DAC_VAL_OUT_REG (0x2A << 11) //42<<11
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/ansi.h
|
|
@ -1 +0,0 @@
|
|||||||
/afs/psi.ch/project/mythen/marie_a/MythenServer/slsDetectorPackage/slsDetectorSoftware/slsDetectorServer/blackfin.h
|
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServer/commonServerFunctions.h
|
|
@ -1 +0,0 @@
|
|||||||
../commonFiles/communication_funcs.c
|
|
@ -1 +0,0 @@
|
|||||||
../commonFiles/communication_funcs.h
|
|
@ -1,9 +0,0 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware/jungfrauDetectorServer
|
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git
|
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git
|
|
||||||
Repsitory UUID: 2f3dc8d109de8607f3217cf429619073dc9cc60e
|
|
||||||
Revision: 103
|
|
||||||
Branch: developer
|
|
||||||
Last Changed Author: Dhanya_Maliakal
|
|
||||||
Last Changed Rev: 3397
|
|
||||||
Last Changed Date: 2017-12-04 18:23:05.000000002 +0100 ./RegisterDefs.h
|
|
@ -1,6 +0,0 @@
|
|||||||
#define GITURL "git@git.psi.ch:sls_detectors_software/slsDetectorPackage.git"
|
|
||||||
#define GITREPUUID "2f3dc8d109de8607f3217cf429619073dc9cc60e"
|
|
||||||
#define GITAUTH "Dhanya_Maliakal"
|
|
||||||
#define GITREV 0x3397
|
|
||||||
#define GITDATE 0x20171204
|
|
||||||
#define GITBRANCH "developer"
|
|
@ -1,6 +0,0 @@
|
|||||||
#define GITURL ""
|
|
||||||
#define GITREPUUID ""
|
|
||||||
#define GITAUTH ""
|
|
||||||
#define GITREV ""
|
|
||||||
#define GITDATE ""
|
|
||||||
#define GITBRANCH ""
|
|
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
|||||||
../slsDetectorServer/programfpga.h
|
|
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
|||||||
../slsDetectorServer/slsDetectorFunctionList.h
|
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServer/slsDetectorServer.c
|
|
@ -1,167 +0,0 @@
|
|||||||
/*
|
|
||||||
* mythen3Server_defs.h
|
|
||||||
*
|
|
||||||
* Created on: Jan 24, 2013
|
|
||||||
* Author: l_maliakal_d, changed my Marie A.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef SLSDETECTORSERVER_DEFS_H_
|
|
||||||
#define SLSDETECTORSERVER_DEFS_H_
|
|
||||||
|
|
||||||
#include "sls_detector_defs.h"
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/** This is only an example file!!! */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define GOODBYE (-200)
|
|
||||||
enum DACINDEX {vIpre, vIbias, Vrf, VrfSh, vIinSh, VdcSh, Vth2, VPL, Vth1, Vth3, Vtrim, casSh, cas, vIbiasSh, vIcin, VPH, NC, vIpreOut, V_D, V_CHIP, V_C, V_B, V_A, V_IO, V_LIM}; // Mythen 3.01
|
|
||||||
enum PWRINDEX {PWR_IO, PWR_A, PWR_B, PWR_C, PWR_D, PWR_CHIP=-1, PWR_LIMIT=-1};
|
|
||||||
enum CLKINDEX {RUN_CLK_C, ADC_CLK_C, SYNC_CLK_C, DBIT_CLK_C};
|
|
||||||
|
|
||||||
#define DEFAULT_DAC_VALS { 2150, /* vIpre */ \
|
|
||||||
1200, /* vIbias */ \
|
|
||||||
900, /* Vrf */ \
|
|
||||||
1050, /* VrfSh */ \
|
|
||||||
1400, /* vIinSh */ \
|
|
||||||
655, /* VdcSh */ \
|
|
||||||
850, /* Vth2 */ \
|
|
||||||
1400, /* VPL */ \
|
|
||||||
850, /* Vth1 */ \
|
|
||||||
850, /* Vth3 */ \
|
|
||||||
2294, /* Vtrim */ \
|
|
||||||
983, /* casSh */ \
|
|
||||||
1474, /* cas */ \
|
|
||||||
1200, /* vIbiasSh */ \
|
|
||||||
1600, /* vIcin */ \
|
|
||||||
1520, /* VPH */ \
|
|
||||||
0, /* NC */ \
|
|
||||||
1000 /* vIpreOut */ \
|
|
||||||
0 /* V_D */ \
|
|
||||||
0 /* V_CHIP */ \
|
|
||||||
0 /* V_C */ \
|
|
||||||
1335 /* V_B */ \
|
|
||||||
1335 /* V_A */ \
|
|
||||||
1350 /* V_IO */ \
|
|
||||||
};
|
|
||||||
|
|
||||||
#define DEFAULT_DAC_NAMES { "vIpre", \
|
|
||||||
"vIbias", \
|
|
||||||
"Vrf", \
|
|
||||||
"VrfSh", \
|
|
||||||
"vIinSh", \
|
|
||||||
"VdcSh", \
|
|
||||||
"Vth2", \
|
|
||||||
"VPL", \
|
|
||||||
"Vth1", \
|
|
||||||
"Vth3", \
|
|
||||||
"Vtrim", \
|
|
||||||
"casSh", \
|
|
||||||
"cas", \
|
|
||||||
"vIbiasSh", \
|
|
||||||
"vIcin", \
|
|
||||||
"VPH", \
|
|
||||||
"NC", \
|
|
||||||
"vIpreOut" \
|
|
||||||
"v_d" \
|
|
||||||
"v_chip" \
|
|
||||||
"v_c" \
|
|
||||||
"v_b" \
|
|
||||||
"v_a" \
|
|
||||||
"v_io" \
|
|
||||||
};
|
|
||||||
|
|
||||||
/*Hardware Definitions */
|
|
||||||
#define NMAXMOD (1)
|
|
||||||
#define NMOD (1)
|
|
||||||
#define NCHAN (32)
|
|
||||||
#define NCHIP (1)
|
|
||||||
#define NADC (0)
|
|
||||||
#define NDAC (24)
|
|
||||||
#define NDAC_PER_SET (8)
|
|
||||||
|
|
||||||
|
|
||||||
#define NPWR (5)
|
|
||||||
#define MAX_DACVOLTVAL (2500) //mV
|
|
||||||
#define MAX_DACVAL (4096) // dac val
|
|
||||||
#define MAX_VCHIPVAL (2700) //mV /** name ???? */
|
|
||||||
#define MIN_VCHIP_OFSTVAL (200) //mV /** name ???? */
|
|
||||||
#define MIN_VCHIP_VAL (600) //mV /** name ???? */
|
|
||||||
|
|
||||||
|
|
||||||
/** Default Parameters */
|
|
||||||
#define DEFAULT_NUM_FRAMES (1)
|
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
|
||||||
#define DEFAULT_EXPTIME (200*1000) //ns
|
|
||||||
#define DEFAULT_PERIOD (1*1000*1000) //ns
|
|
||||||
#define DEFAULT_DELAY (0)
|
|
||||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
|
||||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
|
||||||
|
|
||||||
|
|
||||||
/* Defines in the Firmware */
|
|
||||||
#define FIX_PATT_VAL (0xACDC1980)
|
|
||||||
|
|
||||||
/* LTC2620 DAC DEFINES */
|
|
||||||
#define LTC2620_DAC_CMD_OFST (20)
|
|
||||||
#define LTC2620_DAC_CMD_MSK (0x0000000F << LTC2620_DAC_CMD_OFST)
|
|
||||||
#define LTC2620_DAC_ADDR_OFST (16)
|
|
||||||
#define LTC2620_DAC_ADDR_MSK (0x0000000F << LTC2620_DAC_ADDR_OFST)
|
|
||||||
#define LTC2620_DAC_DATA_OFST (4)
|
|
||||||
#define LTC2620_DAC_DATA_MSK (0x00000FFF << LTC2620_DAC_DATA_OFST)
|
|
||||||
|
|
||||||
#define LTC2620_DAC_CMD_WRITE (0x00000000 << LTC2620_DAC_CMD_OFST)
|
|
||||||
#define LTC2620_DAC_CMD_SET (0x00000003 << LTC2620_DAC_CMD_OFST)
|
|
||||||
#define LTC2620_DAC_CMD_POWER_DOWN (0x00000004 << LTC2620_DAC_CMD_OFST)
|
|
||||||
#define LTC2620_DAC_NUMBITS (24)
|
|
||||||
|
|
||||||
/** PLL Reconfiguration Registers */
|
|
||||||
//https://www.altera.com/documentation/mcn1424769382940.html
|
|
||||||
#define PLL_MODE_REG (0x00)
|
|
||||||
#define PLL_STATUS_REG (0x01)
|
|
||||||
#define PLL_START_REG (0x02)
|
|
||||||
#define PLL_N_COUNTER_REG (0x03)
|
|
||||||
#define PLL_M_COUNTER_REG (0x04)
|
|
||||||
#define PLL_C_COUNTER_REG (0x05)
|
|
||||||
#define PLL_PHASE_SHIFT_REG (0x06)
|
|
||||||
|
|
||||||
#define PLL_SHIFT_NUM_SHIFTS_OFST (0)
|
|
||||||
#define PLL_SHIFT_NUM_SHIFTS_MSK (0x0000FFFF << PLL_SHIFT_NUM_SHIFTS_OFST)
|
|
||||||
|
|
||||||
#define PLL_SHIFT_CNT_SELECT_OFST (16)
|
|
||||||
#define PLL_SHIFT_CNT_SELECT_MSK (0x0000001F << PLL_SHIFT_CNT_SELECT_OFST)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C0_VAL ((0x0 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C1_VAL ((0x1 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C2_VAL ((0x2 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C3_VAL ((0x3 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C4_VAL ((0x4 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C5_VAL ((0x5 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C6_VAL ((0x6 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C7_VAL ((0x7 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C8_VAL ((0x8 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C9_VAL ((0x9 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C10_VAL ((0x10 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C11_VAL ((0x11 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C12_VAL ((0x12 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C13_VAL ((0x13 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C14_VAL ((0x14 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C15_VAL ((0x15 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C16_VAL ((0x16 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
#define PLL_SHIFT_CNT_SLCT_C17_VAL ((0x17 << PLL_SHIFT_CNT_SELECT_OFST) & PLL_SHIFT_CNT_SELECT_MSK)
|
|
||||||
|
|
||||||
#define PLL_SHIFT_UP_DOWN_OFST (21)
|
|
||||||
#define PLL_SHIFT_UP_DOWN_MSK (0x00000001 << PLL_SHIFT_UP_DOWN_OFST)
|
|
||||||
#define PLL_SHIFT_UP_DOWN_NEG_VAL ((0x0 << PLL_SHIFT_UP_DOWN_OFST) & PLL_SHIFT_UP_DOWN_MSK)
|
|
||||||
#define PLL_SHIFT_UP_DOWN_POS_VAL ((0x1 << PLL_SHIFT_UP_DOWN_OFST) & PLL_SHIFT_UP_DOWN_MSK)
|
|
||||||
|
|
||||||
#define PLL_K_COUNTER_REG (0x07)
|
|
||||||
#define PLL_BANDWIDTH_REG (0x08)
|
|
||||||
#define PLL_CHARGEPUMP_REG (0x09)
|
|
||||||
#define PLL_VCO_DIV_REG (0x1c)
|
|
||||||
#define PLL_MIF_REG (0x1f)
|
|
||||||
|
|
||||||
#define PLL_VCO_FREQ_MHZ 400
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServer/slsDetectorServer_funcs.c
|
|
@ -1 +0,0 @@
|
|||||||
../slsDetectorServer/slsDetectorServer_funcs.h
|
|
@ -1 +0,0 @@
|
|||||||
../commonFiles/sls_detector_defs.h
|
|
@ -1 +0,0 @@
|
|||||||
../commonFiles/sls_detector_funcs.h
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/sls_receiver_defs.h
|
|
@ -1 +0,0 @@
|
|||||||
../../slsReceiverSoftware/include/sls_receiver_funcs.h
|
|
@ -1,31 +0,0 @@
|
|||||||
SERVER=jungfrauDetectorServer
|
|
||||||
MAINDIR=slsDetectorsPackage
|
|
||||||
SPECDIR=slsDetectorSoftware/$SERVER
|
|
||||||
TMPFILE=gitInfoJungfrauTmp.h
|
|
||||||
INCLFILE=gitInfoJungfrau.h
|
|
||||||
|
|
||||||
|
|
||||||
#evaluate the variables
|
|
||||||
EVALFILE=../../evalVersionVariables.sh
|
|
||||||
source $EVALFILE
|
|
||||||
|
|
||||||
|
|
||||||
#get modified date
|
|
||||||
#RDATE1='git log --pretty=format:"%ci" -1'
|
|
||||||
RDATE1="find ../slsDetectorServer . -type f -exec stat --format '%Y :%y %n' '{}' \; | sort -nr | cut -d: -f2- | egrep -v 'gitInfo|bin|.git|updateGitVersion|.o' | head -n 1"
|
|
||||||
RDATE=`eval $RDATE1`
|
|
||||||
NEWDATE=$(sed "s/-//g" <<< $RDATE | awk '{print $1;}')
|
|
||||||
NEWDATE=${NEWDATE/#/0x}
|
|
||||||
|
|
||||||
|
|
||||||
#get old date from INCLFILE
|
|
||||||
OLDDATE=$(more $INCLFILE | grep '#define GITDATE' | awk '{print $3}')
|
|
||||||
|
|
||||||
|
|
||||||
#update INCLFILE if changes
|
|
||||||
if [ "$OLDDATE" != "$NEWDATE" ]; then
|
|
||||||
echo Path: ${MAINDIR}/${SPECDIR} $'\n'URL: ${GITREPO} $'\n'Repository Root: ${GITREPO} $'\n'Repsitory UUID: ${REPUID} $'\n'Revision: ${FOLDERREV} $'\n'Branch: ${BRANCH} $'\n'Last Changed Author: ${AUTH1}_${AUTH2} $'\n'Last Changed Rev: ${REV} $'\n'Last Changed Date: ${RDATE} > gitInfo.txt
|
|
||||||
cd ../../
|
|
||||||
./genVersionHeader.sh $SPECDIR/gitInfo.txt $SPECDIR/$TMPFILE $SPECDIR/$INCLFILE
|
|
||||||
cd $WD
|
|
||||||
fi
|
|
@ -95,7 +95,7 @@ int bindSocket(unsigned short int port_number) {
|
|||||||
// success
|
// success
|
||||||
myport = port_number;
|
myport = port_number;
|
||||||
ret = OK;
|
ret = OK;
|
||||||
FILE_LOG(logINFO, (" %s socket bound: isock=%d port=%d fd=%d\n",
|
FILE_LOG(logDEBUG5, ("%s socket bound: isock=%d, port=%d, fd=%d\n",
|
||||||
(isControlServer ? "Control":"Stop"), isock, port_number, socketDescriptor));
|
(isControlServer ? "Control":"Stop"), isock, port_number, socketDescriptor));
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -356,25 +356,34 @@ int sendModule(int file_des, sls_detector_module *myMod) {
|
|||||||
|
|
||||||
|
|
||||||
int sendModuleGeneral(int file_des, sls_detector_module *myMod, int sendAll) {
|
int sendModuleGeneral(int file_des, sls_detector_module *myMod, int sendAll) {
|
||||||
int ts = 0;
|
int ts = 0, n = 0;
|
||||||
int nChips = myMod->nchip;
|
int nChips = myMod->nchip;
|
||||||
int nChans = myMod->nchan;
|
int nChans = myMod->nchan;
|
||||||
int nAdcs = myMod->nadc;
|
int nAdcs = myMod->nadc;
|
||||||
int nDacs = myMod->ndac;
|
int nDacs = myMod->ndac;
|
||||||
|
|
||||||
// send module structure
|
// send module structure
|
||||||
ts += sendData(file_des,&(myMod->serialnumber),sizeof(myMod->serialnumber),INT32);
|
n = sendData(file_des,&(myMod->serialnumber),sizeof(myMod->serialnumber),INT32);
|
||||||
ts += sendData(file_des,&(myMod->nchan),sizeof(myMod->nchan),INT32);
|
if (!n) return -1; ts += n;
|
||||||
ts += sendData(file_des,&(myMod->nchip),sizeof(myMod->nchip),INT32);
|
n = sendData(file_des,&(myMod->nchan),sizeof(myMod->nchan),INT32);
|
||||||
ts += sendData(file_des,&(myMod->ndac),sizeof(myMod->ndac),INT32);
|
if (!n) return -1; ts += n;
|
||||||
ts += sendData(file_des,&(myMod->nadc),sizeof(myMod->nadc),INT32);
|
n = sendData(file_des,&(myMod->nchip),sizeof(myMod->nchip),INT32);
|
||||||
ts += sendData(file_des,&(myMod->reg),sizeof(myMod->reg),INT32);
|
if (!n) return -1; ts += n;
|
||||||
ts += sendData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
n = sendData(file_des,&(myMod->ndac),sizeof(myMod->ndac),INT32);
|
||||||
ts += sendData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
if (!n) return -1; ts += n;
|
||||||
|
n = sendData(file_des,&(myMod->nadc),sizeof(myMod->nadc),INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
|
n = sendData(file_des,&(myMod->reg),sizeof(myMod->reg),INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
|
n = sendData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
|
n = sendData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
FILE_LOG(logDEBUG5, ("module of size %d sent\n",ts));
|
FILE_LOG(logDEBUG5, ("module of size %d sent\n",ts));
|
||||||
|
|
||||||
// send dac
|
// send dac
|
||||||
ts += sendData(file_des,myMod->dacs,sizeof(int)*nDacs,INT32);
|
n = sendData(file_des,myMod->dacs,sizeof(int)*nDacs,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
FILE_LOG(logDEBUG5, ("dacs of size %d sent\n",ts));
|
FILE_LOG(logDEBUG5, ("dacs of size %d sent\n",ts));
|
||||||
{
|
{
|
||||||
int idac;
|
int idac;
|
||||||
@ -383,18 +392,21 @@ int sendModuleGeneral(int file_des, sls_detector_module *myMod, int sendAll) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// send adc
|
// send adc
|
||||||
ts += sendData(file_des,myMod->adcs,sizeof(int)*nAdcs,INT32);
|
n = sendData(file_des,myMod->adcs,sizeof(int)*nAdcs,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
FILE_LOG(logDEBUG5, ("adcs of size %d sent\n", ts));
|
FILE_LOG(logDEBUG5, ("adcs of size %d sent\n", ts));
|
||||||
|
|
||||||
// some detectors dont require sending all trimbits etc.
|
// some detectors dont require sending all trimbits etc.
|
||||||
if(sendAll) {
|
if(sendAll) {
|
||||||
// chips
|
// chips
|
||||||
ts += sendData(file_des,myMod->chipregs,sizeof(int)*nChips,INT32);
|
n = sendData(file_des,myMod->chipregs,sizeof(int)*nChips,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
FILE_LOG(logDEBUG5, ("chips of size %d sent\n", ts));
|
FILE_LOG(logDEBUG5, ("chips of size %d sent\n", ts));
|
||||||
|
|
||||||
// channels
|
// channels
|
||||||
ts += sendData(file_des,myMod->chanregs,sizeof(int)*nChans,INT32);
|
n = sendData(file_des,myMod->chanregs,sizeof(int)*nChans,INT32);
|
||||||
FILE_LOG(logDEBUG5, ("chans of size %d sent - %d\n", ts, myMod->nchan));
|
FILE_LOG(logDEBUG5, ("chans of size %d sent - %d\n", ts, myMod->nchan));
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logDEBUG5, ("module of size %d sent register %x\n", ts, myMod->reg));
|
FILE_LOG(logDEBUG5, ("module of size %d sent register %x\n", ts, myMod->reg));
|
||||||
@ -408,7 +420,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveAll) {
|
int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveAll) {
|
||||||
int ts = 0;
|
int ts = 0, n = 0;
|
||||||
int *dacptr = myMod->dacs;
|
int *dacptr = myMod->dacs;
|
||||||
int *adcptr = myMod->adcs;
|
int *adcptr = myMod->adcs;
|
||||||
int *chipptr = myMod->chipregs, *chanptr = myMod->chanregs;
|
int *chipptr = myMod->chipregs, *chanptr = myMod->chanregs;
|
||||||
@ -416,14 +428,22 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
|||||||
int nChans, nchanold = myMod->nchan, nchandiff;
|
int nChans, nchanold = myMod->nchan, nchandiff;
|
||||||
int nDacs, ndold = myMod->ndac, ndacdiff;
|
int nDacs, ndold = myMod->ndac, ndacdiff;
|
||||||
int nAdcs, naold = myMod->nadc, nadcdiff;
|
int nAdcs, naold = myMod->nadc, nadcdiff;
|
||||||
ts += receiveData(file_des,&(myMod->serialnumber),sizeof(myMod->serialnumber),INT32);
|
n = receiveData(file_des,&(myMod->serialnumber),sizeof(myMod->serialnumber),INT32);
|
||||||
ts += receiveData(file_des,&(myMod->nchan),sizeof(myMod->nchan),INT32);
|
if (!n) return -1; ts += n;
|
||||||
ts += receiveData(file_des,&(myMod->nchip),sizeof(myMod->nchip),INT32);
|
n = receiveData(file_des,&(myMod->nchan),sizeof(myMod->nchan),INT32);
|
||||||
ts += receiveData(file_des,&(myMod->ndac),sizeof(myMod->ndac),INT32);
|
if (!n) return -1; ts += n;
|
||||||
ts += receiveData(file_des,&(myMod->nadc),sizeof(myMod->nadc),INT32);
|
n = receiveData(file_des,&(myMod->nchip),sizeof(myMod->nchip),INT32);
|
||||||
ts += receiveData(file_des,&(myMod->reg),sizeof(myMod->reg),INT32);
|
if (!n) return -1; ts += n;
|
||||||
ts += receiveData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
n = receiveData(file_des,&(myMod->ndac),sizeof(myMod->ndac),INT32);
|
||||||
ts += receiveData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
if (!n) return -1; ts += n;
|
||||||
|
n = receiveData(file_des,&(myMod->nadc),sizeof(myMod->nadc),INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
|
n = receiveData(file_des,&(myMod->reg),sizeof(myMod->reg),INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
|
n = receiveData(file_des,&(myMod->gain), sizeof(myMod->gain),OTHER);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
|
n = receiveData(file_des,&(myMod->offset), sizeof(myMod->offset),OTHER);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
|
|
||||||
myMod->dacs = dacptr;
|
myMod->dacs = dacptr;
|
||||||
myMod->adcs = adcptr;
|
myMod->adcs = adcptr;
|
||||||
@ -473,7 +493,8 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
|||||||
else
|
else
|
||||||
FILE_LOG(logDEBUG5, ("received %d adcs\n",nAdcs));
|
FILE_LOG(logDEBUG5, ("received %d adcs\n",nAdcs));
|
||||||
if (ndacdiff <= 0) {
|
if (ndacdiff <= 0) {
|
||||||
ts += receiveData(file_des,myMod->dacs, sizeof(int)*nDacs,INT32);
|
n = receiveData(file_des,myMod->dacs, sizeof(int)*nDacs,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
FILE_LOG(logDEBUG5, ("dacs received\n"));
|
FILE_LOG(logDEBUG5, ("dacs received\n"));
|
||||||
int id;
|
int id;
|
||||||
for (id = 0; id<nDacs; id++)
|
for (id = 0; id<nDacs; id++)
|
||||||
@ -481,20 +502,25 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
|||||||
} else {
|
} else {
|
||||||
dacptr = (int*)malloc(ndacdiff*sizeof(int));
|
dacptr = (int*)malloc(ndacdiff*sizeof(int));
|
||||||
myMod->ndac = ndold;
|
myMod->ndac = ndold;
|
||||||
ts += receiveData(file_des,myMod->dacs, sizeof(int)*ndold,INT32);
|
n = receiveData(file_des,myMod->dacs, sizeof(int)*ndold,INT32);
|
||||||
ts += receiveData(file_des,dacptr, sizeof(int)*ndacdiff,INT32);
|
if (!n) return -1; ts += n;
|
||||||
|
n = receiveData(file_des,dacptr, sizeof(int)*ndacdiff,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
free(dacptr);
|
free(dacptr);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nadcdiff <= 0) {
|
if (nadcdiff <= 0) {
|
||||||
ts += receiveData(file_des,myMod->adcs, sizeof(int)*nAdcs,INT32);
|
n = receiveData(file_des,myMod->adcs, sizeof(int)*nAdcs,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
FILE_LOG(logDEBUG5, ("adcs received\n"));
|
FILE_LOG(logDEBUG5, ("adcs received\n"));
|
||||||
} else {
|
} else {
|
||||||
adcptr = (int*)malloc(nadcdiff*sizeof(int));
|
adcptr = (int*)malloc(nadcdiff*sizeof(int));
|
||||||
myMod->nadc = naold;
|
myMod->nadc = naold;
|
||||||
ts += receiveData(file_des,myMod->adcs, sizeof(int)*naold,INT32);
|
n = receiveData(file_des,myMod->adcs, sizeof(int)*naold,INT32);
|
||||||
ts += receiveData(file_des,adcptr, sizeof(int)*nadcdiff,INT32);
|
if (!n) return -1; ts += n;
|
||||||
|
n = receiveData(file_des,adcptr, sizeof(int)*nadcdiff,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
free(adcptr);
|
free(adcptr);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -504,25 +530,31 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
|
|||||||
if(receiveAll){
|
if(receiveAll){
|
||||||
|
|
||||||
if (nchipdiff <= 0) {
|
if (nchipdiff <= 0) {
|
||||||
ts += receiveData(file_des,myMod->chipregs, sizeof(int)*nChips,INT32);
|
n = receiveData(file_des,myMod->chipregs, sizeof(int)*nChips,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
FILE_LOG(logDEBUG5, ("chips received\n"));
|
FILE_LOG(logDEBUG5, ("chips received\n"));
|
||||||
} else {
|
} else {
|
||||||
chipptr = (int*)malloc(nchipdiff*sizeof(int));
|
chipptr = (int*)malloc(nchipdiff*sizeof(int));
|
||||||
myMod->nchip = nchipold;
|
myMod->nchip = nchipold;
|
||||||
ts += receiveData(file_des,myMod->chipregs, sizeof(int)*nchipold,INT32);
|
n = receiveData(file_des,myMod->chipregs, sizeof(int)*nchipold,INT32);
|
||||||
ts += receiveData(file_des,chipptr, sizeof(int)*nchipdiff,INT32);
|
if (!n) return -1; ts += n;
|
||||||
|
n = receiveData(file_des,chipptr, sizeof(int)*nchipdiff,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
free(chipptr);
|
free(chipptr);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nchandiff <= 0) {
|
if (nchandiff <= 0) {
|
||||||
ts += receiveData(file_des,myMod->chanregs, sizeof(int)*nChans,INT32);
|
n = receiveData(file_des,myMod->chanregs, sizeof(int)*nChans,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
FILE_LOG(logDEBUG5, ("chans received\n"));
|
FILE_LOG(logDEBUG5, ("chans received\n"));
|
||||||
} else {
|
} else {
|
||||||
chanptr = (int*)malloc(nchandiff*sizeof(int));
|
chanptr = (int*)malloc(nchandiff*sizeof(int));
|
||||||
myMod->nchan = nchanold;
|
myMod->nchan = nchanold;
|
||||||
ts += receiveData(file_des,myMod->chanregs, sizeof(int)*nchanold,INT32);
|
n = receiveData(file_des,myMod->chanregs, sizeof(int)*nchanold,INT32);
|
||||||
ts += receiveData(file_des,chanptr, sizeof(int)*nchandiff,INT32);
|
if (!n) return -1; ts += n;
|
||||||
|
n = receiveData(file_des,chanptr, sizeof(int)*nchandiff,INT32);
|
||||||
|
if (!n) return -1; ts += n;
|
||||||
free(chanptr);
|
free(chanptr);
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -546,7 +578,7 @@ int Server_VerifyLock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize) {
|
int Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize) {
|
||||||
|
|
||||||
// update if different clients (ret can be ok or acquisition finished), not fail to not overwrite e message
|
// update if different clients (ret can be ok or acquisition finished), not fail to not overwrite e message
|
||||||
if (update && ret != FAIL && differentClients)
|
if (update && ret != FAIL && differentClients)
|
||||||
@ -554,7 +586,7 @@ void Server_SendResult(int fileDes, intType itype, int update, void* retval, int
|
|||||||
|
|
||||||
// send success of operation
|
// send success of operation
|
||||||
int ret1 = ret;
|
int ret1 = ret;
|
||||||
sendData(fileDes, &ret1,sizeof(ret1), INT32);/* if < 0, return , socket crash*/
|
sendData(fileDes, &ret1,sizeof(ret1), INT32);
|
||||||
if(ret == FAIL) {
|
if(ret == FAIL) {
|
||||||
// send error message
|
// send error message
|
||||||
if (strlen(mess))
|
if (strlen(mess))
|
||||||
@ -567,4 +599,6 @@ void Server_SendResult(int fileDes, intType itype, int update, void* retval, int
|
|||||||
}
|
}
|
||||||
// send return value
|
// send return value
|
||||||
sendData(fileDes, retval, retvalSize, itype);
|
sendData(fileDes, retval, retvalSize, itype);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,8 @@ int Server_VerifyLock();
|
|||||||
* @param update 1 if one must update if different clients, else 0
|
* @param update 1 if one must update if different clients, else 0
|
||||||
* @param retval pointer to result
|
* @param retval pointer to result
|
||||||
* @param retvalSize size of result
|
* @param retvalSize size of result
|
||||||
|
* @returns result of operation
|
||||||
*/
|
*/
|
||||||
void Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize);
|
int Server_SendResult(int fileDes, intType itype, int update, void* retval, int retvalSize);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
logERROR, logWARNING, logINFO, logINFOBLUE,
|
logERROR, logWARNING, logINFO, logINFOBLUE, logGREEN,
|
||||||
logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5
|
logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5
|
||||||
}TLogLevel;
|
}TLogLevel;
|
||||||
|
|
||||||
@ -35,6 +35,7 @@ static inline void FILELOG_PrintLog(TLogLevel level, char* m) {
|
|||||||
case logERROR: cprintf(RED BOLD, "ERROR: %s", m); break;
|
case logERROR: cprintf(RED BOLD, "ERROR: %s", m); break;
|
||||||
case logWARNING: cprintf(YELLOW BOLD, "WARNING: %s", m); break;
|
case logWARNING: cprintf(YELLOW BOLD, "WARNING: %s", m); break;
|
||||||
case logINFOBLUE: cprintf(BLUE, "INFO: %s", m); break;
|
case logINFOBLUE: cprintf(BLUE, "INFO: %s", m); break;
|
||||||
|
case logGREEN: cprintf(GREEN, "INFO: %s", m); break;
|
||||||
case logINFO: cprintf(RESET, "INFO: %s", m); break;
|
case logINFO: cprintf(RESET, "INFO: %s", m); break;
|
||||||
case logDEBUG: cprintf(MAGENTA, "DEBUG: %s", m); break;
|
case logDEBUG: cprintf(MAGENTA, "DEBUG: %s", m); break;
|
||||||
case logDEBUG1: cprintf(MAGENTA, "DEBUG1: %s", m); break;
|
case logDEBUG1: cprintf(MAGENTA, "DEBUG1: %s", m); break;
|
||||||
|
@ -19,15 +19,12 @@ int getFirmwareCheckResult(char** mess);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
void checkFirmwareCompatibility();
|
void checkFirmwareCompatibility();
|
||||||
#if defined(MYTHEN3D) || defined(JUNGFRAUD)
|
#ifdef JUNGFRAUD
|
||||||
int checkType();
|
int checkType();
|
||||||
u_int32_t testFpga(void);
|
u_int32_t testFpga(void);
|
||||||
int testBus(void);
|
int testBus(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MYTHEN3D
|
|
||||||
int moduleTest( enum digitalTestMode arg);
|
|
||||||
#endif
|
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
int detectorTest( enum digitalTestMode arg);
|
int detectorTest( enum digitalTestMode arg);
|
||||||
#endif
|
#endif
|
||||||
@ -40,7 +37,7 @@ u_int64_t getFirmwareAPIVersion();
|
|||||||
u_int16_t getHardwareVersionNumber();
|
u_int16_t getHardwareVersionNumber();
|
||||||
u_int16_t getHardwareSerialNumber();
|
u_int16_t getHardwareSerialNumber();
|
||||||
#endif
|
#endif
|
||||||
#if !defined(MYTHEN3D) || !defined(EIGERD)
|
#ifdef EIGERD
|
||||||
u_int32_t getDetectorNumber();
|
u_int32_t getDetectorNumber();
|
||||||
#endif
|
#endif
|
||||||
u_int64_t getDetectorMAC();
|
u_int64_t getDetectorMAC();
|
||||||
@ -73,17 +70,11 @@ uint32_t readRegister(uint32_t offset);
|
|||||||
|
|
||||||
|
|
||||||
// firmware functions (resets)
|
// firmware functions (resets)
|
||||||
#if defined(MYTHEN3D) || defined(JUNGFRAUD)
|
#ifdef JUNGFRAUD
|
||||||
int powerChip (int on);
|
int powerChip (int on);
|
||||||
void cleanFifos();
|
void cleanFifos();
|
||||||
void resetCore();
|
void resetCore();
|
||||||
void resetPeripheral();
|
void resetPeripheral();
|
||||||
#endif
|
|
||||||
#ifdef MYTHEN3D
|
|
||||||
int getPhase(int i);
|
|
||||||
int configurePhase(int val, enum CLKINDEX i);
|
|
||||||
int configureFrequency(int val, int i);
|
|
||||||
#elif JUNGFRAUD
|
|
||||||
int autoCompDisable(int on);
|
int autoCompDisable(int on);
|
||||||
int adcPhase(int st);
|
int adcPhase(int st);
|
||||||
int getPhase();
|
int getPhase();
|
||||||
@ -97,7 +88,7 @@ int setROI(int n, ROI arg[], int *retvalsize, int *ret);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// parameters - readout
|
// parameters - readout
|
||||||
int setSpeed(enum speedVariable arg, int val);
|
enum speedVariable setSpeed(int val);
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
enum readOutFlags setReadOutFlags(enum readOutFlags val);
|
||||||
#endif
|
#endif
|
||||||
@ -129,35 +120,21 @@ int setThresholdEnergy(int ev);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// parameters - dac, adc, hv
|
// parameters - dac, adc, hv
|
||||||
#if defined(MYTHEN3D) || defined(JUNGFRAUD)
|
#ifdef JUNGFRAUD
|
||||||
void serializeToSPI(u_int32_t addr, u_int32_t val, u_int32_t csmask, int numbitstosend, u_int32_t clkmask, u_int32_t digoutmask, int digofset);
|
void serializeToSPI(u_int32_t addr, u_int32_t val, u_int32_t csmask, int numbitstosend, u_int32_t clkmask, u_int32_t digoutmask, int digofset);
|
||||||
void initDac(int dacnum);
|
void initDac(int dacnum);
|
||||||
int voltageToDac(int value);
|
int voltageToDac(int value);
|
||||||
int dacToVoltage(unsigned int digital);
|
int dacToVoltage(unsigned int digital);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MYTHEN3D
|
|
||||||
int setPower(enum DACINDEX ind, int val);
|
|
||||||
int powerToDac(int value, int chip);
|
|
||||||
int dacToPower(int value, int chip);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
extern void setAdc(int addr, int val); // AD9257.h
|
extern void setAdc(int addr, int val); // AD9257.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void setDAC(enum DACINDEX ind, int val, int mV, int retval[]);
|
void setDAC(enum DACINDEX ind, int val, int mV, int retval[]);
|
||||||
#ifdef MYTHEN3D
|
|
||||||
int getVLimit();
|
|
||||||
void setDacRegister(int dacnum,int dacvalue);
|
|
||||||
int getDacRegister(int dacnum);
|
|
||||||
#endif
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
int getADC(enum ADCINDEX ind);
|
int getADC(enum ADCINDEX ind);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MYTHEN3D
|
|
||||||
int setHighVoltage(int val);
|
int setHighVoltage(int val);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -169,8 +146,10 @@ enum externalCommunicationMode getTiming();
|
|||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
long int calcChecksum(int sourceip, int destip);
|
long int calcChecksum(int sourceip, int destip);
|
||||||
#endif
|
#endif
|
||||||
#ifndef MYTHEN3D
|
#ifdef GOTTHARDD
|
||||||
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival);
|
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2, int ival);
|
||||||
|
#else
|
||||||
|
int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t sourceip, uint32_t udpport, uint32_t udpport2);
|
||||||
#endif
|
#endif
|
||||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||||
int setDetectorPosition(int pos[]);
|
int setDetectorPosition(int pos[]);
|
||||||
@ -187,7 +166,7 @@ int resetCounterBlock(int startACQ);
|
|||||||
int calibratePedestal(int frames);
|
int calibratePedestal(int frames);
|
||||||
|
|
||||||
// jungfrau specific - pll, flashing firmware
|
// jungfrau specific - pll, flashing firmware
|
||||||
#elif defined(JUNGFRAUD) || defined(MYTHEN3D)
|
#elif JUNGFRAUD
|
||||||
void resetPLL();
|
void resetPLL();
|
||||||
u_int32_t setPllReconfigReg(u_int32_t reg, u_int32_t val);
|
u_int32_t setPllReconfigReg(u_int32_t reg, u_int32_t val);
|
||||||
void configurePll();
|
void configurePll();
|
||||||
|
@ -33,6 +33,7 @@ int main(int argc, char *argv[]){
|
|||||||
// subsequent read/write to socket gives error - must handle locally
|
// subsequent read/write to socket gives error - must handle locally
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
|
|
||||||
// circumvent the basic tests
|
// circumvent the basic tests
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -64,28 +65,20 @@ int main(int argc, char *argv[]){
|
|||||||
#endif
|
#endif
|
||||||
if (isControlServer) {
|
if (isControlServer) {
|
||||||
portno = DEFAULT_PORTNO;
|
portno = DEFAULT_PORTNO;
|
||||||
FILE_LOG(logINFOBLUE,
|
FILE_LOG(logINFO, ("Opening control server on port %d \n", portno));
|
||||||
("***************************************************\n"
|
|
||||||
"********* opening control server on port %d **********\n"
|
|
||||||
"********************************************************\n\n"
|
|
||||||
, portno));
|
|
||||||
#ifdef STOP_SERVER
|
#ifdef STOP_SERVER
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < argc; ++i)
|
for (i = 0; i < argc; ++i)
|
||||||
sprintf(cmd, "%s %s", cmd, argv[i]);
|
sprintf(cmd, "%s %s", cmd, argv[i]);
|
||||||
sprintf(cmd,"%s -stopserver&", cmd);
|
sprintf(cmd,"%s -stopserver&", cmd);
|
||||||
FILE_LOG(logINFO, ("Command to start stop server:%s\n", cmd));
|
FILE_LOG(logDEBUG5, ("Command to start stop server:%s\n", cmd));
|
||||||
system(cmd);
|
system(cmd);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
portno = DEFAULT_PORTNO + 1;
|
portno = DEFAULT_PORTNO + 1;
|
||||||
FILE_LOG(logINFOBLUE,
|
FILE_LOG(logINFO,("Opening stop server on port %d \n", portno));
|
||||||
("***************************************************\n"
|
|
||||||
"*********** opening stop server on port %d ***********\n"
|
|
||||||
"********************************************************\n\n"
|
|
||||||
, portno));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_detector();
|
init_detector();
|
||||||
@ -100,7 +93,7 @@ int main(int argc, char *argv[]){
|
|||||||
function_table();
|
function_table();
|
||||||
|
|
||||||
if (isControlServer) {
|
if (isControlServer) {
|
||||||
FILE_LOG(logINFO, ("Control Server Ready...\n\n"));
|
FILE_LOG(logINFOBLUE, ("Control Server Ready...\n\n"));
|
||||||
} else {
|
} else {
|
||||||
FILE_LOG(logINFO, ("Stop Server Ready...\n\n"));
|
FILE_LOG(logINFO, ("Stop Server Ready...\n\n"));
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,4 @@
|
|||||||
#ifndef SERVER_FUNCS_H
|
#pragma once
|
||||||
#define SERVER_FUNCS_H
|
|
||||||
|
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
@ -14,6 +12,7 @@ void function_table();
|
|||||||
void functionNotImplemented();
|
void functionNotImplemented();
|
||||||
void modeNotImplemented(char* modename, int mode);
|
void modeNotImplemented(char* modename, int mode);
|
||||||
void validate(int arg, int retval, char* modename, int hex);
|
void validate(int arg, int retval, char* modename, int hex);
|
||||||
|
void validate64(int64_t arg, int64_t retval, char* modename, int hex);
|
||||||
int M_nofunc(int);
|
int M_nofunc(int);
|
||||||
int M_nofuncMode(int);
|
int M_nofuncMode(int);
|
||||||
|
|
||||||
@ -79,4 +78,3 @@ int storage_cell_start(int);
|
|||||||
int check_version(int);
|
int check_version(int);
|
||||||
int software_trigger(int);
|
int software_trigger(int);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -2867,27 +2867,21 @@ int slsDetector::setDynamicRange(int n) {
|
|||||||
if (connectControl() == OK){
|
if (connectControl() == OK){
|
||||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||||
controlSocket->SendDataOnly(&n,sizeof(n));
|
controlSocket->SendDataOnly(&n,sizeof(n));
|
||||||
//rate correction is switched off if not 32 bit mode
|
|
||||||
if(thisDetector->myDetectorType == EIGER){
|
|
||||||
controlSocket->ReceiveDataOnly(&rateret,sizeof(rateret));
|
|
||||||
if (rateret==FAIL) {
|
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
|
||||||
if(strstr(mess,"Rate Correction")!=NULL){
|
|
||||||
if(strstr(mess,"32")!=NULL)
|
|
||||||
setErrorMask((getErrorMask())|(RATE_CORRECTION_NOT_32or16BIT));
|
|
||||||
else
|
|
||||||
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
if (ret==FAIL) {
|
if (ret==FAIL) {
|
||||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||||
} else {
|
if(strstr(mess,"Rate Correction")!=NULL){
|
||||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
// rate correction is switched off if not 32 bit mode
|
||||||
|
if(strstr(mess,"32")!=NULL)
|
||||||
|
setErrorMask((getErrorMask())|(RATE_CORRECTION_NOT_32or16BIT));
|
||||||
|
else
|
||||||
|
setErrorMask((getErrorMask())|(COULD_NOT_SET_RATE_CORRECTION));
|
||||||
|
}
|
||||||
|
else ret = OK;
|
||||||
}
|
}
|
||||||
|
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||||
|
|
||||||
disconnectControl();
|
disconnectControl();
|
||||||
if (ret==FORCE_UPDATE)
|
if (ret==FORCE_UPDATE)
|
||||||
updateDetector();
|
updateDetector();
|
||||||
@ -4268,13 +4262,24 @@ int slsDetector::sendROI(int n,ROI roiLimits[]) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Sending ROI of size " << arg << " to detector" << std::endl;
|
std::cout << "Sending ROI of size " << arg << " to detector" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
controlSocket->SendDataOnly(roiLimits,arg*sizeof(ROI));
|
for(int i = 0; i < n; ++i){
|
||||||
|
controlSocket->SendDataOnly(&roiLimits[i].xmin, sizeof(int));
|
||||||
|
controlSocket->SendDataOnly(&roiLimits[i].xmax, sizeof(int));
|
||||||
|
controlSocket->SendDataOnly(&roiLimits[i].ymin, sizeof(int));
|
||||||
|
controlSocket->SendDataOnly(&roiLimits[i].ymax, sizeof(int));
|
||||||
|
}
|
||||||
|
//controlSocket->SendDataOnly(roiLimits,arg*sizeof(ROI));
|
||||||
}
|
}
|
||||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||||
|
|
||||||
if (ret!=FAIL){
|
if (ret!=FAIL){
|
||||||
controlSocket->ReceiveDataOnly(&retvalsize,sizeof(retvalsize));
|
controlSocket->ReceiveDataOnly(&retvalsize,sizeof(retvalsize));
|
||||||
nrec = controlSocket->ReceiveDataOnly(retval,retvalsize*sizeof(ROI));
|
nrec = 0;
|
||||||
|
nrec += controlSocket->ReceiveDataOnly(&retval[i].xmin, sizeof(int));
|
||||||
|
nrec += controlSocket->ReceiveDataOnly(&retval[i].xmax, sizeof(int));
|
||||||
|
nrec += controlSocket->ReceiveDataOnly(&retval[i].ymin, sizeof(int));
|
||||||
|
nrec += controlSocket->ReceiveDataOnly(&retval[i].ymax, sizeof(int));
|
||||||
|
//nrec = controlSocket->ReceiveDataOnly(retval,retvalsize*sizeof(ROI));
|
||||||
if(nrec!=(retvalsize*(int)sizeof(ROI))){
|
if(nrec!=(retvalsize*(int)sizeof(ROI))){
|
||||||
ret=FAIL;
|
ret=FAIL;
|
||||||
std::cout << " wrong size received: received " << nrec <<
|
std::cout << " wrong size received: received " << nrec <<
|
||||||
|
@ -290,9 +290,7 @@ int slsReceiverTCPIPInterface::M_nofunc(){
|
|||||||
strcpy(mess,"Unrecognized Function. Please do not proceed.\n");
|
strcpy(mess,"Unrecognized Function. Please do not proceed.\n");
|
||||||
FILE_LOG(logERROR) << mess;
|
FILE_LOG(logERROR) << mess;
|
||||||
|
|
||||||
interface->Server_SendResult(false, ret, NULL, 0, mess);
|
return interface->Server_SendResult(false, ret, NULL, 0, mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -329,21 +327,17 @@ int slsReceiverTCPIPInterface::exec_command() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(false, ret, retval, MAX_STR_LENGTH, mess);
|
return interface->Server_SendResult(false, ret, retval, MAX_STR_LENGTH, mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::exit_server() {
|
int slsReceiverTCPIPInterface::exit_server() {
|
||||||
cprintf(RED,"Closing receiver server\n");
|
cprintf(RED,"Closing server\n");
|
||||||
|
|
||||||
ret = OK;
|
ret = OK;
|
||||||
interface->Server_SendResult(false, ret, NULL, 0);
|
interface->Server_SendResult(false, ret, NULL, 0);
|
||||||
|
return GOODBYE;
|
||||||
ret = GOODBYE;
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -361,7 +355,7 @@ int slsReceiverTCPIPInterface::lock_receiver() {
|
|||||||
if (lock >= 0) {
|
if (lock >= 0) {
|
||||||
if (!lockStatus || // if it was unlocked, anyone can lock
|
if (!lockStatus || // if it was unlocked, anyone can lock
|
||||||
(!strcmp(mySock->lastClientIP,mySock->thisClientIP)) || // if it was locked, need same ip
|
(!strcmp(mySock->lastClientIP,mySock->thisClientIP)) || // if it was locked, need same ip
|
||||||
(!strcmp(mySock->lastClientIP,"none"))) //if it was locked, must be by "none"
|
(!strcmp(mySock->lastClientIP,"none"))) // if it was locked, must be by "none"
|
||||||
{
|
{
|
||||||
lockStatus = lock;
|
lockStatus = lock;
|
||||||
strcpy(mySock->lastClientIP,mySock->thisClientIP);
|
strcpy(mySock->lastClientIP,mySock->thisClientIP);
|
||||||
@ -369,18 +363,14 @@ int slsReceiverTCPIPInterface::lock_receiver() {
|
|||||||
interface->Server_LockedError(ret, mess);
|
interface->Server_LockedError(ret, mess);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &lockStatus,sizeof(lockStatus), mess);
|
return interface->Server_SendResult(true, ret, &lockStatus,sizeof(lockStatus), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::get_last_client_ip() {
|
int slsReceiverTCPIPInterface::get_last_client_ip() {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
interface->Server_SendResult(true, ret,mySock->lastClientIP, sizeof(mySock->lastClientIP));
|
return interface->Server_SendResult(true, ret,mySock->lastClientIP, sizeof(mySock->lastClientIP));
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -560,9 +550,7 @@ int slsReceiverTCPIPInterface::get_id(){
|
|||||||
ret = OK;
|
ret = OK;
|
||||||
int64_t retval = getReceiverVersion();
|
int64_t retval = getReceiverVersion();
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval));
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval));
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -622,9 +610,7 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
|||||||
//get
|
//get
|
||||||
retval = myDetectorType;
|
retval = myDetectorType;
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -679,7 +665,13 @@ int slsReceiverTCPIPInterface::set_roi() {
|
|||||||
int iloop = 0;
|
int iloop = 0;
|
||||||
for (iloop = 0; iloop < nroi; iloop++) {
|
for (iloop = 0; iloop < nroi; iloop++) {
|
||||||
ROI temp;
|
ROI temp;
|
||||||
if ( mySock->ReceiveDataOnly(&temp,sizeof(ROI)) < 0 )
|
if ( mySock->ReceiveDataOnly(&temp.xmin,sizeof(int)) < 0 )
|
||||||
|
return interface->Server_SocketCrash();
|
||||||
|
if ( mySock->ReceiveDataOnly(&temp.xmax,sizeof(int)) < 0 )
|
||||||
|
return interface->Server_SocketCrash();
|
||||||
|
if ( mySock->ReceiveDataOnly(&temp.ymin,sizeof(int)) < 0 )
|
||||||
|
return interface->Server_SocketCrash();
|
||||||
|
if ( mySock->ReceiveDataOnly(&temp.ymax,sizeof(int)) < 0 )
|
||||||
return interface->Server_SocketCrash();
|
return interface->Server_SocketCrash();
|
||||||
roiLimits.push_back(temp);
|
roiLimits.push_back(temp);
|
||||||
}
|
}
|
||||||
@ -766,9 +758,7 @@ int slsReceiverTCPIPInterface::setup_udp(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -865,9 +855,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
|||||||
FILE_LOG(logDEBUG1) << slsDetectorDefs::getTimerType((timerIndex)(index[0])) << ":" << retval;
|
FILE_LOG(logDEBUG1) << slsDetectorDefs::getTimerType((timerIndex)(index[0])) << ":" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -927,9 +915,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
|
|||||||
FILE_LOG(logDEBUG1) << "dynamic range: " << retval;
|
FILE_LOG(logDEBUG1) << "dynamic range: " << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -966,9 +952,7 @@ int slsReceiverTCPIPInterface::set_streaming_frequency(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -984,9 +968,7 @@ int slsReceiverTCPIPInterface::get_status(){
|
|||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
retval = receiver->getStatus();
|
retval = receiver->getStatus();
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1017,11 +999,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, NULL, 0, mess);
|
return interface->Server_SendResult(true, ret, NULL, 0, mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1050,9 +1028,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, NULL, 0, mess);
|
return interface->Server_SendResult(true, ret, NULL, 0, mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1162,9 +1138,7 @@ int slsReceiverTCPIPInterface::set_file_index() {
|
|||||||
FILE_LOG(logDEBUG1) << "file index:" << retval;
|
FILE_LOG(logDEBUG1) << "file index:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1182,9 +1156,7 @@ int slsReceiverTCPIPInterface::get_frame_index(){
|
|||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
retval=receiver->getAcquisitionIndex();
|
retval=receiver->getAcquisitionIndex();
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1199,9 +1171,7 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
|
|||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
retval=receiver->getTotalFramesCaught();
|
retval=receiver->getTotalFramesCaught();
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1221,9 +1191,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, NULL, 0, mess);
|
return interface->Server_SendResult(true, ret, NULL, 0, mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1256,9 +1224,7 @@ int slsReceiverTCPIPInterface::enable_file_write(){
|
|||||||
FILE_LOG(logDEBUG1) << "file write enable:" << retval;
|
FILE_LOG(logDEBUG1) << "file write enable:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1293,9 +1259,7 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
|
|||||||
FILE_LOG(logDEBUG1) << "file overwrite enable:" << retval;
|
FILE_LOG(logDEBUG1) << "file overwrite enable:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1331,9 +1295,7 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
|
|||||||
FILE_LOG(logDEBUG1) << "10Gbe:" << retval;
|
FILE_LOG(logDEBUG1) << "10Gbe:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1371,9 +1333,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
|
|||||||
FILE_LOG(logDEBUG1) << "fifo depth:" << retval;
|
FILE_LOG(logDEBUG1) << "fifo depth:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1409,9 +1369,7 @@ int slsReceiverTCPIPInterface::set_activate() {
|
|||||||
FILE_LOG(logDEBUG1) << "Activate: " << retval;
|
FILE_LOG(logDEBUG1) << "Activate: " << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1444,9 +1402,7 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){
|
|||||||
FILE_LOG(logDEBUG1) << "data streaming enable:" << retval;
|
FILE_LOG(logDEBUG1) << "data streaming enable:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1479,9 +1435,7 @@ int slsReceiverTCPIPInterface::set_streaming_timer(){
|
|||||||
FILE_LOG(logDEBUG1) << "Streaming timer:" << retval;
|
FILE_LOG(logDEBUG1) << "Streaming timer:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1517,9 +1471,7 @@ int slsReceiverTCPIPInterface::set_flipped_data(){
|
|||||||
FILE_LOG(logDEBUG1) << "Flipped Data:" << retval;
|
FILE_LOG(logDEBUG1) << "Flipped Data:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1554,9 +1506,7 @@ int slsReceiverTCPIPInterface::set_file_format() {
|
|||||||
FILE_LOG(logDEBUG1) << "File Format: " << retval;
|
FILE_LOG(logDEBUG1) << "File Format: " << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1589,9 +1539,7 @@ int slsReceiverTCPIPInterface::set_detector_posid() {
|
|||||||
FILE_LOG(logDEBUG1) << "Position Id:" << retval;
|
FILE_LOG(logDEBUG1) << "Position Id:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1628,9 +1576,7 @@ int slsReceiverTCPIPInterface::set_multi_detector_size() {
|
|||||||
FILE_LOG(logDEBUG1) << "Multi Detector Size:" << retval;
|
FILE_LOG(logDEBUG1) << "Multi Detector Size:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1659,9 +1605,7 @@ int slsReceiverTCPIPInterface::set_streaming_port() {
|
|||||||
FILE_LOG(logDEBUG1) << "streaming port:" << retval;
|
FILE_LOG(logDEBUG1) << "streaming port:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1727,9 +1671,7 @@ int slsReceiverTCPIPInterface::set_silent_mode() {
|
|||||||
FILE_LOG(logDEBUG1) << "silent mode:" << retval;
|
FILE_LOG(logDEBUG1) << "silent mode:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1768,9 +1710,7 @@ int slsReceiverTCPIPInterface::enable_gap_pixels() {
|
|||||||
FILE_LOG(logDEBUG1) << "Gap Pixels Enable: " << retval;
|
FILE_LOG(logDEBUG1) << "Gap Pixels Enable: " << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1801,9 +1741,7 @@ int slsReceiverTCPIPInterface::restream_stop(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, NULL, 0, mess);
|
return interface->Server_SendResult(true, ret, NULL, 0, mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1871,9 +1809,7 @@ int slsReceiverTCPIPInterface::set_udp_socket_buffer_size() {
|
|||||||
FILE_LOG(logDEBUG1) << "UDP Socket Buffer Size:" << retval;
|
FILE_LOG(logDEBUG1) << "UDP Socket Buffer Size:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1888,9 +1824,7 @@ int slsReceiverTCPIPInterface::get_real_udp_socket_buffer_size(){
|
|||||||
if (ret == OK)
|
if (ret == OK)
|
||||||
retval = receiver->getActualUDPSocketBufferSize();
|
retval = receiver->getActualUDPSocketBufferSize();
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1924,9 +1858,7 @@ int slsReceiverTCPIPInterface::set_frames_per_file() {
|
|||||||
FILE_LOG(logDEBUG1) << "frames per file:" << retval;
|
FILE_LOG(logDEBUG1) << "frames per file:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1971,9 +1903,7 @@ int slsReceiverTCPIPInterface::check_version_compatibility() {
|
|||||||
}
|
}
|
||||||
else FILE_LOG(logINFO) << "Compatibility with Client: Successful";
|
else FILE_LOG(logINFO) << "Compatibility with Client: Successful";
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, NULL, 0, mess);
|
return interface->Server_SendResult(true, ret, NULL, 0, mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2007,9 +1937,7 @@ int slsReceiverTCPIPInterface::set_discard_policy() {
|
|||||||
FILE_LOG(logDEBUG1) << "frame discard policy:" << retval;
|
FILE_LOG(logDEBUG1) << "frame discard policy:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2045,9 +1973,7 @@ int slsReceiverTCPIPInterface::set_padding_enable() {
|
|||||||
FILE_LOG(logDEBUG1) << "Frame Padding Enable:" << retval;
|
FILE_LOG(logDEBUG1) << "Frame Padding Enable:" << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2084,7 +2010,5 @@ int slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable() {
|
|||||||
FILE_LOG(logDEBUG1) << "Deactivated Padding Enable: " << retval;
|
FILE_LOG(logDEBUG1) << "Deactivated Padding Enable: " << retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ int ClientInterface::Client_Send(int fnum,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ClientInterface::Server_SendResult(bool update, int ret,
|
int ClientInterface::Server_SendResult(bool update, int ret,
|
||||||
void* retval, int retvalSize, char* mess) {
|
void* retval, int retvalSize, char* mess) {
|
||||||
|
|
||||||
// update if different clients
|
// update if different clients
|
||||||
@ -72,6 +72,8 @@ void ClientInterface::Server_SendResult(bool update, int ret,
|
|||||||
}
|
}
|
||||||
// send return value
|
// send return value
|
||||||
mySocket->SendDataOnly(retval, retvalSize);
|
mySocket->SendDataOnly(retval, retvalSize);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,8 +65,9 @@ public:
|
|||||||
* @param retval pointer to result
|
* @param retval pointer to result
|
||||||
* @param retvalSize size of result
|
* @param retvalSize size of result
|
||||||
* @param mess message
|
* @param mess message
|
||||||
|
* @returns success of operation
|
||||||
*/
|
*/
|
||||||
void Server_SendResult(bool update, int ret, void* retval, int retvalSize, char* mess = 0);
|
int Server_SendResult(bool update, int ret, void* retval, int retvalSize, char* mess = 0);
|
||||||
|
|
||||||
/** only Receiver
|
/** only Receiver
|
||||||
* Server receives arguments and checks if base object is null (if checkbase is true)
|
* Server receives arguments and checks if base object is null (if checkbase is true)
|
||||||
|
@ -82,9 +82,7 @@ public:
|
|||||||
EIGER, /**< eiger */
|
EIGER, /**< eiger */
|
||||||
GOTTHARD, /**< gotthard */
|
GOTTHARD, /**< gotthard */
|
||||||
JUNGFRAU, /**< jungfrau */
|
JUNGFRAU, /**< jungfrau */
|
||||||
JUNGFRAUCTB, /**< jungfrauCTBversion */
|
JUNGFRAUCTB /**< jungfrauCTBversion */
|
||||||
MYTHEN3, /**< mythen 3 */
|
|
||||||
MOENCH /**< moench */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user