implemented setModule, setTrimbits function

This commit is contained in:
Anna Bergamaschi 2014-07-18 09:39:27 +02:00
parent 828a2dbd17
commit 8cee0a7332
5 changed files with 156 additions and 13 deletions

View File

@ -1 +1,3 @@
*.o *.o
*~
#*#

View File

@ -36,7 +36,7 @@ int eiger_extgatingpolarity = 0;
const unsigned int ndacs = 16; const unsigned int ndacs = 16;
const char* dac_names[16] = {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"}; const char* dac_names[16] = {"SvP","Vtr","Vrf","Vrs","SvN","Vtgstv","Vcmp_ll","Vcmp_lr","cal","Vcmp_rl","rxb_rb","rxb_lb","Vcmp_rr","Vcp","Vcn","Vis"};
int saved_trimbits[256*256*4];
int EigerGetNumberOfExposures(){return eiger_nexposures;} int EigerGetNumberOfExposures(){return eiger_nexposures;}
@ -54,7 +54,6 @@ int EigerGetTriggerMode(){return eiger_triggermode;}
int EigerGetExternalGating(){return eiger_extgating;} int EigerGetExternalGating(){return eiger_extgating;}
int EigerGetExternalGatingPolarity(){return eiger_extgatingpolarity;} int EigerGetExternalGatingPolarity(){return eiger_extgatingpolarity;}
int EigerInit(){ int EigerInit(){
static int passed = 0; static int passed = 0;
@ -137,6 +136,52 @@ int EigerSetDAC(const char* iname,int v, int mV){
return EigerSendCMD(); return EigerSendCMD();
} }
int EigerSetTrimbits(const int *data){
eiger_ret_val=0;
char tt[263681];
tt[263680]='\0';
int ip=0, ich=0;
int iy, ix;
int ichip;
// convert the trimbits from int32 to chars and add border pixels.
for(iy=0;iy<256;y++) {
for (ichip=0; ichip<4; ichip++) {
for(ix=0;ix<256;ix++) {
tt[ip++]=(char)(data[ich++]&(0x3f));
}
if (ichip<3) {
tt[ip++]=0;
tt[ip++]=0;
}
}
}
eiger_message_length = sprintf(eiger_message,"settrimbits %s", tt);
memcpy(saved_trimbits,data,256*256*4*sizeof(int));
return EigerSendCMD();
}
/* int EigerGetTrimbits(const int *data){ */
/* eiger_ret_val=0; */
/* char tt[263681]; */
/* tt[263680]='\0'; */
/* int ip=0, ich=0; */
/* int iy, ix; */
/* int ichip; */
/* eiger_message_length = sprintf(eiger_message,"settrimbits %s", tt); */
/* memcpy(data,saved_trimbits,256*256*4*sizeof(int)); */
/* return EigerSendCMD(); */
/* } */
int EigerGetDAC(const char* iname){ int EigerGetDAC(const char* iname){
eiger_ret_val=1; eiger_ret_val=1;
eiger_message_length = sprintf(eiger_message,"getdacvalue %s",iname); eiger_message_length = sprintf(eiger_message,"getdacvalue %s",iname);

View File

@ -707,7 +707,7 @@ bool FebControl::SetTrimbits(unsigned int module_num, unsigned char *trimbits){
if(!Reset()) cout<<"Warning could not reset DAQ."<<endl; if(!Reset()) cout<<"Warning could not reset DAQ."<<endl;
for(int l_r=0;l_r<2;l_r++){ for(int l_r=0;l_r<2;l_r++){ // l_r loop
unsigned int disable_chip_mask = l_r ? DAQ_CS_BAR_LEFT : DAQ_CS_BAR_RIGHT; unsigned int disable_chip_mask = l_r ? DAQ_CS_BAR_LEFT : DAQ_CS_BAR_RIGHT;
if(!(WriteRegister(0xfff,DAQ_REG_STATIC_BITS,disable_chip_mask|DAQ_STATIC_BIT_PROGRAM|DAQ_STATIC_BIT_M8)&&SetCommandRegister(DAQ_SET_STATIC_BIT)&&StartDAQOnlyNWaitForFinish())){ if(!(WriteRegister(0xfff,DAQ_REG_STATIC_BITS,disable_chip_mask|DAQ_STATIC_BIT_PROGRAM|DAQ_STATIC_BIT_M8)&&SetCommandRegister(DAQ_SET_STATIC_BIT)&&StartDAQOnlyNWaitForFinish())){
@ -730,26 +730,26 @@ bool FebControl::SetTrimbits(unsigned int module_num, unsigned char *trimbits){
static unsigned int trimbits_to_load_l[1024]; static unsigned int trimbits_to_load_l[1024];
static unsigned int trimbits_to_load_r[1024]; static unsigned int trimbits_to_load_r[1024];
for(int row=0;row<16;row++){ for(int row=0;row<16;row++){ //row loop
int offset = 2*32*row; int offset = 2*32*row;
for(int sc=0;sc<32;sc++){ for(int sc=0;sc<32;sc++){ //supercolumn loop sc
int super_column_start_position_l = 1030*row + l_r *258 + sc*8; int super_column_start_position_l = 1030*row + l_r *258 + sc*8;
int super_column_start_position_r = 1030*row + 516 + l_r *258 + sc*8; int super_column_start_position_r = 1030*row + 516 + l_r *258 + sc*8;
int chip_sc = 31 - sc; int chip_sc = 31 - sc;
trimbits_to_load_l[offset+chip_sc] = 0; trimbits_to_load_l[offset+chip_sc] = 0;
trimbits_to_load_r[offset+chip_sc] = 0; trimbits_to_load_r[offset+chip_sc] = 0;
for(int i=0;i<8;i++){ for(int i=0;i<8;i++){ // column loop i
trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])<<((7-i)*4);//low trimbits_to_load_l[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])<<((7-i)*4);//low
trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])>>3)<<((7-i)*4);//upper trimbits_to_load_l[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_l+i)])>>3)<<((7-i)*4);//upper
trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])<<((7-i)*4);//low trimbits_to_load_r[offset+chip_sc] |= ( 0x7 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])<<((7-i)*4);//low
trimbits_to_load_r[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])>>3)<<((7-i)*4);//upper trimbits_to_load_r[offset+chip_sc+32] |= ((0x38 & trimbits[263679 - (row_set*16480+super_column_start_position_r+i)])>>3)<<((7-i)*4);//upper
} } // end column loop i
} } //end supercolumn loop sc
} } //end row loop
if(!WriteMemory(modules[0]->GetTopLeftAddress(),0,0,1024,trimbits_to_load_r)||!WriteMemory(modules[0]->GetTopRightAddress(),0,0,1024,trimbits_to_load_l)||!StartDAQOnlyNWaitForFinish()) return 0; if(!WriteMemory(modules[0]->GetTopLeftAddress(),0,0,1024,trimbits_to_load_r)||!WriteMemory(modules[0]->GetTopRightAddress(),0,0,1024,trimbits_to_load_l)||!StartDAQOnlyNWaitForFinish()) return 0;
} } //end row_set loop (groups of 16 rows)
} } // end l_r loop
memcpy(last_downloaded_trimbits,trimbits,trimbit_size*sizeof(unsigned char)); memcpy(last_downloaded_trimbits,trimbits,trimbit_size*sizeof(unsigned char));

View File

@ -0,0 +1,94 @@
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = YES
# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = YES
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespace are hidden.
EXTRACT_ANON_NSPACES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
INTERNAL_DOCS = NO
SHOW_INCLUDE_FILES = NO
SHOW_FILES = NO
SHOW_NAMESPACES = NO
COMPACT_LATEX = YES
PAPER_TYPE = a4
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_HIDE_INDICES = YES
PREDEFINED = __cplusplus
HAVE_DOT = YES
CALL_GRAPH = YES
CALLER_GRAPH = YES
INPUT = Beb.h Eiger.h FebControl.h FebInterface.h gitInfoEiger.h HardwareIO.h LocalLinkInterface.h sls_detector_funcs.h slsDetectorServer_defs.h sls_receiver_defs.h xfs_types.h communication_funcs.h EigerRegisterDefs.h Feb.h FebRegisterDefs.h gitInfoEigerTmp.h HardwareMMappingDefs.h sls_detector_defs.h slsDetectorFunctionList.h slsDetectorServer_funcs.h sls_receiver_funcs.h xparameters.h Beb.cxx BebServer.cxx Eiger.cxx EigerTest.cxx FebControl.cxx Feb.cxx FebInterface.cxx FebServer.cxx HardwareIO.cxx LocalLinkInterface.cxx LocalLinkTest.cxx Test.cxx
OUTPUT_DIRECTORY = docs

View File

@ -288,8 +288,10 @@ int setModule(sls_detector_module myMod){
setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module,0,retval); setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module,0,retval);
thisSettings = (enum detectorSettings)myMod.reg; // thisSettings = (enum detectorSettings)myMod.reg;
thisSettings = 0; // thisSettings = 0;
setSettings( (enum detectorSettings)myMod.reg); // put the settings in the module register?!?!?
/** set trimbits*/ /** set trimbits*/
if (detectorModules) if (detectorModules)
copyModule(detectorModules,&myMod); copyModule(detectorModules,&myMod);