mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 07:20:01 +02:00
reset fpga implemented, changed receiver configuration warning prints, powerchip implemented
This commit is contained in:
parent
0aecad6644
commit
4b99ff7fbe
@ -70,7 +70,8 @@ using namespace std;
|
||||
#define PROGRAMMING_ERROR 0x0000000002000000ULL
|
||||
#define RECEIVER_ACTIVATE 0x0000000004000000ULL
|
||||
#define DATA_STREAMING 0x0000000008000000ULL
|
||||
|
||||
#define RESET_ERROR 0x0000000010000000ULL
|
||||
#define POWER_CHIP 0x0000000020000000ULL
|
||||
// 0x00000000FFFFFFFFULL
|
||||
/** @short class returning all error messages for error mask */
|
||||
class errorDefs {
|
||||
@ -218,7 +219,11 @@ public:
|
||||
if(slsErrorMask&DATA_STREAMING)
|
||||
retval.append("Could not set/reset Data Streaming\n");
|
||||
|
||||
if(slsErrorMask&RESET_ERROR)
|
||||
retval.append("Could not reset the FPGA\n");
|
||||
|
||||
if(slsErrorMask&POWER_CHIP)
|
||||
retval.append("Could not power on/off/get the chip\n");
|
||||
|
||||
//------------------------------------------------------ length of message
|
||||
|
||||
|
@ -25,6 +25,9 @@
|
||||
/** maximum rois */
|
||||
#define MAX_ROIS 100
|
||||
|
||||
/** maximum unit size of program sent to detector */
|
||||
#define MAX_FPGAPROGRAMSIZE (2 * 1024 *1024)
|
||||
|
||||
|
||||
typedef char mystring[MAX_STR_LENGTH];
|
||||
typedef double mysteps[MAX_SCAN_STEPS];
|
||||
|
@ -106,9 +106,9 @@ enum {
|
||||
|
||||
F_SET_NETWORK_PARAMETER, /**< set network parameters such as transmission delay, flow control */
|
||||
|
||||
F_PROGRAM_FPGA /**< program FPGA */
|
||||
|
||||
|
||||
F_PROGRAM_FPGA, /**< program FPGA */
|
||||
F_RESET_FPGA, /**< reset FPGA */
|
||||
F_POWER_CHIP /**< power chip */
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
};
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "firmware_funcs.h"
|
||||
#include "mcb_funcs.h"
|
||||
#include "registers_m.h"
|
||||
#include "gitInfoJungfrau.h"
|
||||
|
||||
//#define VERBOSE
|
||||
//#define VERYVERBOSE
|
||||
@ -116,7 +117,7 @@ char mtdvalue[10];
|
||||
|
||||
|
||||
int mapCSP0(void) {
|
||||
//printf("Mapping memory\n");
|
||||
printf("Mapping memory\n");
|
||||
#ifndef VIRTUAL
|
||||
int fd;
|
||||
fd = open("/dev/mem", O_RDWR | O_SYNC, 0);
|
||||
@ -163,6 +164,7 @@ void defineGPIOpins(){
|
||||
}
|
||||
|
||||
void resetFPGA(){
|
||||
cprintf(BLUE,"\n*** Reseting FPGA ***\n");
|
||||
FPGAdontTouchFlash();
|
||||
FPGATouchFlash();
|
||||
}
|
||||
@ -177,7 +179,8 @@ void FPGATouchFlash(){
|
||||
system("echo 1 > /sys/class/gpio/gpio9/value");
|
||||
}
|
||||
|
||||
void powerChip (int on){
|
||||
int powerChip (int on){
|
||||
if(on != -1){
|
||||
if(on){
|
||||
printf("\nPowering on the chip\n");
|
||||
bus_w(POWER_ON_REG,0x1);
|
||||
@ -186,9 +189,133 @@ void powerChip (int on){
|
||||
printf("\nPowering off the chip\n");
|
||||
bus_w(POWER_ON_REG,0x0);
|
||||
}
|
||||
}
|
||||
|
||||
return bus_r(POWER_ON_REG);
|
||||
}
|
||||
|
||||
|
||||
void initializeDetector(){
|
||||
printf("Initializing Detector\n");
|
||||
|
||||
int i;
|
||||
//printf("Bus test... ");
|
||||
for (i=0; i<1000000; i++) {
|
||||
bus_w(SET_DELAY_LSB_REG, i*100);
|
||||
bus_r(FPGA_VERSION_REG);
|
||||
if (i*100!=bus_r(SET_DELAY_LSB_REG))
|
||||
cprintf(RED,"Bus Test ERROR: wrote 0x%x, read 0x%x\n",i*100,bus_r(SET_DELAY_LSB_REG));
|
||||
}
|
||||
//printf("Finished\n");
|
||||
|
||||
//confirm the detector type
|
||||
if (((bus_r(PCB_REV_REG) & DETECTOR_TYPE_MASK)>>DETECTOR_TYPE_OFFSET) != JUNGFRAU_MODULE_ID){
|
||||
cprintf(BG_RED,"This is not a Jungfrau Server (enum:%d)\n",myDetectorType);
|
||||
exit(-1);
|
||||
}
|
||||
cprintf(BLUE,"\n\n********************************************************\n"
|
||||
"*********************Jungfrau Server********************\n"
|
||||
"********************************************************\n");
|
||||
|
||||
//print version
|
||||
cprintf(BLUE,"\n"
|
||||
"Firmware Version:\t 0x%x\n"
|
||||
"Software Version:\t %llx\n"
|
||||
//"F/w-S/w API Version:\t\t %lld\n"
|
||||
//"Required Firmware Version:\t %d\n"
|
||||
"Fixed Pattern:\t\t 0x%x\n"
|
||||
"Board Revision:\t\t 0x%x\n"
|
||||
"\n********************************************************\n",
|
||||
bus_r(FPGA_VERSION_REG),(long long unsigned int)(((int64_t)SVNREV <<32) | (int64_t)SVNDATE)
|
||||
//,sw_fw_apiversion, REQUIRED_FIRMWARE_VERSION
|
||||
,bus_r(FIX_PATT_REG),(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK)
|
||||
);
|
||||
|
||||
|
||||
printf("Resetting PLL\n");
|
||||
resetPLL();
|
||||
bus_w16(CONTROL_REG, SYNC_RESET);
|
||||
bus_w16(CONTROL_REG, 0);
|
||||
bus_w16(CONTROL_REG, GB10_RESET_BIT);
|
||||
bus_w16(CONTROL_REG, 0);
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
initDetector();
|
||||
#endif
|
||||
/*some registers set, which is in common with jungfrau, please check */
|
||||
prepareADC();
|
||||
/*some registers set, which is in common with jungfrau, please check */
|
||||
initDac(0); initDac(8); //initializes the two dacs
|
||||
|
||||
|
||||
//set dacs
|
||||
printf("Setting Default Dac values\n");
|
||||
enum dacNames{VB_COMP,VDD_PROT,VIN_COM,VREF_PRECH,VB_PIXBUF,VB_DS,VREF_DS,VREF_COMP};
|
||||
int retval = -1;
|
||||
int dacvalues[8][2]={
|
||||
{VB_COMP, 1220},
|
||||
{VDD_PROT, 3000},
|
||||
{VIN_COM, 1053},
|
||||
{VREF_PRECH,1450},
|
||||
{VB_PIXBUF, 750},
|
||||
{VB_DS, 1000},
|
||||
{VREF_DS, 480},
|
||||
{VREF_COMP, 420},
|
||||
};
|
||||
for(i=0;i<8;++i){
|
||||
retval=setDac(dacvalues[i][0], dacvalues[i][1]);
|
||||
if(retval!=dacvalues[i][1])
|
||||
printf("Error: Setting dac %d failed, wrote %d, read %d\n",dacvalues[i][0],dacvalues[i][1],retval);
|
||||
}
|
||||
|
||||
|
||||
//done from config file
|
||||
//printf("\nPowering on the chip\n");
|
||||
//bus_w(POWER_ON_REG,0x1);
|
||||
|
||||
/* Only once */
|
||||
bus_w(CONFGAIN_REG,0x0);
|
||||
|
||||
printf("Resetting ADC\n");
|
||||
writeADC(ADCREG1,0x3); writeADC(ADCREG1,0x0);
|
||||
writeADC(ADCREG2,0x40);
|
||||
writeADC(ADCREG3,0xf);
|
||||
writeADC(ADCREG4,0x3f);
|
||||
printf("Configuring Vrefs\n");
|
||||
writeADC(ADCREG_VREFS,0x2);
|
||||
printf("Setting ADC Inversion\n");// (by trial and error)
|
||||
bus_w(ADC_INVERSION_REG,0x453b2a9c);
|
||||
|
||||
adcPipeline(HALFSPEED_ADC_PIPELINE);
|
||||
dbitPipeline(HALFSPEED_DBIT_PIPELINE);
|
||||
adcPhase(HALFSPEED_ADC_PHASE); //set adc_clock_phase in unit of 1/(52) clock period (by trial and error)
|
||||
|
||||
printf("Reset mem machine fifos\n");
|
||||
bus_w(MEM_MACHINE_FIFOS_REG,0x4000);
|
||||
bus_w(MEM_MACHINE_FIFOS_REG,0x0);
|
||||
printf("Reset run control\n");
|
||||
bus_w(MEM_MACHINE_FIFOS_REG,0x0400);
|
||||
bus_w(MEM_MACHINE_FIFOS_REG,0x0);
|
||||
initSpeedConfGain(HALFSPEED_CONF);
|
||||
setSettings(DYNAMICGAIN,-1);
|
||||
|
||||
|
||||
|
||||
//Initialization of acquistion parameters
|
||||
setFrames(1*1000*1000);
|
||||
setTrains(-1);
|
||||
setExposureTime(10*1000);
|
||||
setPeriod(2*1000*1000);
|
||||
setDelay(0);
|
||||
setGates(0);
|
||||
|
||||
|
||||
setTiming(GET_EXTERNAL_COMMUNICATION_MODE);
|
||||
setMaster(GET_MASTER);
|
||||
setSynchronization(GET_SYNCHRONIZATION_MODE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
u_int16_t bus_r16(u_int32_t offset){
|
||||
volatile u_int16_t *ptr1;
|
||||
|
@ -24,7 +24,10 @@
|
||||
int mapCSP0(void);
|
||||
void defineGPIOpins();
|
||||
void resetFPGA();
|
||||
void powerChip (int on);
|
||||
void FPGAdontTouchFlash();
|
||||
void FPGATouchFlash();
|
||||
int powerChip (int on);
|
||||
void initializeDetector();
|
||||
|
||||
u_int16_t bus_r16(u_int32_t offset);
|
||||
u_int16_t bus_w16(u_int32_t offset, u_int16_t data);//aldos function
|
||||
|
Binary file not shown.
@ -55,147 +55,25 @@ int adcvpp=0x4;
|
||||
|
||||
|
||||
int init_detector(int b) {
|
||||
|
||||
if(b){
|
||||
defineGPIOpins();
|
||||
resetFPGA();
|
||||
usleep(250*1000);
|
||||
}
|
||||
|
||||
int i;
|
||||
if (mapCSP0()==FAIL) {
|
||||
printf("Could not map memory\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//------control server -------
|
||||
if (b) {
|
||||
//printf("Bus test... ");
|
||||
for (i=0; i<1000000; i++) {
|
||||
bus_w(SET_DELAY_LSB_REG, i*100);
|
||||
bus_r(FPGA_VERSION_REG);
|
||||
if (i*100!=bus_r(SET_DELAY_LSB_REG))
|
||||
cprintf(RED,"Bus Test ERROR: wrote 0x%x, read 0x%x\n",i*100,bus_r(SET_DELAY_LSB_REG));
|
||||
}
|
||||
//printf("Finished\n");
|
||||
|
||||
//confirm the detector type
|
||||
if (((bus_r(PCB_REV_REG) & DETECTOR_TYPE_MASK)>>DETECTOR_TYPE_OFFSET) != JUNGFRAU_MODULE_ID){
|
||||
cprintf(BG_RED,"This is not a Jungfrau Server (enum:%d)\n",myDetectorType);
|
||||
exit(-1);
|
||||
}
|
||||
cprintf(BLUE,"\n\n********************************************************\n"
|
||||
"*********************Jungfrau Server********************\n"
|
||||
"********************************************************\n");
|
||||
|
||||
//print version
|
||||
cprintf(BLUE,"\n"
|
||||
"Firmware Version:\t 0x%x\n"
|
||||
"Software Version:\t %llx\n"
|
||||
//"F/w-S/w API Version:\t\t %lld\n"
|
||||
//"Required Firmware Version:\t %d\n"
|
||||
"Fixed Pattern:\t\t 0x%x\n"
|
||||
"Board Revision:\t\t 0x%x\n"
|
||||
"\n********************************************************\n",
|
||||
bus_r(FPGA_VERSION_REG),(long long unsigned int)(((int64_t)SVNREV <<32) | (int64_t)SVNDATE)
|
||||
//,sw_fw_apiversion, REQUIRED_FIRMWARE_VERSION
|
||||
,bus_r(FIX_PATT_REG),(bus_r(PCB_REV_REG)&BOARD_REVISION_MASK)
|
||||
);
|
||||
|
||||
|
||||
printf("Resetting PLL\n");
|
||||
resetPLL();
|
||||
bus_w16(CONTROL_REG, SYNC_RESET);
|
||||
bus_w16(CONTROL_REG, 0);
|
||||
bus_w16(CONTROL_REG, GB10_RESET_BIT);
|
||||
bus_w16(CONTROL_REG, 0);
|
||||
|
||||
#ifdef MCB_FUNCS
|
||||
initDetector();
|
||||
#endif
|
||||
printf("Initializing Detector\n");
|
||||
/*some registers set, which is in common with jungfrau, please check */
|
||||
prepareADC();
|
||||
/*some registers set, which is in common with jungfrau, please check */
|
||||
initDac(0); initDac(8); //initializes the two dacs
|
||||
|
||||
|
||||
//set dacs
|
||||
printf("Setting Default Dac values\n");
|
||||
enum dacNames{VB_COMP,VDD_PROT,VIN_COM,VREF_PRECH,VB_PIXBUF,VB_DS,VREF_DS,VREF_COMP};
|
||||
int retval = -1;
|
||||
int dacvalues[8][2]={
|
||||
{VB_COMP, 1220},
|
||||
{VDD_PROT, 3000},
|
||||
{VIN_COM, 1053},
|
||||
{VREF_PRECH,1450},
|
||||
{VB_PIXBUF, 750},
|
||||
{VB_DS, 1000},
|
||||
{VREF_DS, 480},
|
||||
{VREF_COMP, 420},
|
||||
};
|
||||
for(i=0;i<8;++i){
|
||||
retval=setDac(dacvalues[i][0], dacvalues[i][1]);
|
||||
if(retval!=dacvalues[i][1])
|
||||
printf("Error: Setting dac %d failed, wrote %d, read %d\n",dacvalues[i][0],dacvalues[i][1],retval);
|
||||
}
|
||||
|
||||
|
||||
printf("\nPowering on the chip\n");
|
||||
bus_w(POWER_ON_REG,0x1);
|
||||
|
||||
/* Only once */
|
||||
bus_w(CONFGAIN_REG,0x0);
|
||||
|
||||
printf("Resetting ADC\n");
|
||||
writeADC(ADCREG1,0x3); writeADC(ADCREG1,0x0);
|
||||
writeADC(ADCREG2,0x40);
|
||||
writeADC(ADCREG3,0xf);
|
||||
writeADC(ADCREG4,0x3f);
|
||||
printf("Configuring Vrefs\n");
|
||||
writeADC(ADCREG_VREFS,0x2);
|
||||
printf("Setting ADC Inversion\n");// (by trial and error)
|
||||
bus_w(ADC_INVERSION_REG,0x453b2a9c);
|
||||
|
||||
adcPipeline(HALFSPEED_ADC_PIPELINE);
|
||||
dbitPipeline(HALFSPEED_DBIT_PIPELINE);
|
||||
adcPhase(HALFSPEED_ADC_PHASE); //set adc_clock_phase in unit of 1/(52) clock period (by trial and error)
|
||||
|
||||
printf("Reset mem machine fifos\n");
|
||||
bus_w(MEM_MACHINE_FIFOS_REG,0x4000);
|
||||
bus_w(MEM_MACHINE_FIFOS_REG,0x0);
|
||||
printf("Reset run control\n");
|
||||
bus_w(MEM_MACHINE_FIFOS_REG,0x0400);
|
||||
bus_w(MEM_MACHINE_FIFOS_REG,0x0);
|
||||
initSpeedConfGain(HALFSPEED_CONF);
|
||||
setSettings(DYNAMICGAIN,-1);
|
||||
|
||||
|
||||
|
||||
//Initialization of acquistion parameters
|
||||
setFrames(1*1000*1000);
|
||||
setTrains(-1);
|
||||
setExposureTime(10*1000);
|
||||
setPeriod(2*1000*1000);
|
||||
setDelay(0);
|
||||
setGates(0);
|
||||
|
||||
|
||||
setTiming(GET_EXTERNAL_COMMUNICATION_MODE);
|
||||
setMaster(GET_MASTER);
|
||||
setSynchronization(GET_SYNCHRONIZATION_MODE);
|
||||
}
|
||||
//------ end of control server ------
|
||||
|
||||
if (b)
|
||||
initializeDetector();
|
||||
|
||||
//common for both control and stop server
|
||||
strcpy(mess,"dummy message");
|
||||
strcpy(lastClientIP,"none");
|
||||
strcpy(thisClientIP,"none1");
|
||||
lockStatus=0;
|
||||
|
||||
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -287,6 +165,9 @@ int function_table() {
|
||||
flist[F_SET_CTB_PATTERN]=&set_ctb_pattern;
|
||||
flist[F_WRITE_ADC_REG]=&write_adc_register;
|
||||
flist[F_PROGRAM_FPGA]=&program_fpga;
|
||||
flist[F_RESET_FPGA]=&reset_fpga;
|
||||
flist[F_POWER_CHIP]=&power_chip;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -3154,15 +3035,13 @@ int write_adc_register(int file_des) {
|
||||
int program_fpga(int file_des) {
|
||||
int ret=OK;
|
||||
int n;
|
||||
const size_t maxprogramsize = 2 * 1024 *1024;
|
||||
size_t unitprogramsize = 0;
|
||||
char* fpgasrc = (char*)malloc(maxprogramsize);
|
||||
sprintf(mess,"Program FPGA unsuccessful\n");
|
||||
char* fpgasrc = NULL;
|
||||
FILE* fp = NULL;
|
||||
size_t filesize = 0;
|
||||
size_t unitprogramsize = 0;
|
||||
size_t totalsize = 0;
|
||||
|
||||
FILE* fp = NULL;
|
||||
|
||||
sprintf(mess,"Program FPGA\n");
|
||||
|
||||
//filesize
|
||||
n = receiveDataOnly(file_des,&filesize,sizeof(filesize));
|
||||
@ -3175,33 +3054,48 @@ int program_fpga(int file_des) {
|
||||
printf("\n\n Total size is:%d\n",totalsize);
|
||||
#endif
|
||||
|
||||
//lock
|
||||
if (ret==OK && differentClients==1 && lockStatus==1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
filesize = 0;
|
||||
}
|
||||
|
||||
//opening file pointer to flash and telling FPGA to not touch flash
|
||||
if(startWritingFPGAprogram(&fp) != OK){
|
||||
if(ret == OK && startWritingFPGAprogram(&fp) != OK){
|
||||
sprintf(mess,"Could not write to flash. Error at startup.\n");
|
||||
cprintf(RED,"%s",mess);
|
||||
ret=FAIL;
|
||||
filesize = 0;
|
||||
}
|
||||
|
||||
//---------------- first ret ----------------
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret==FAIL)
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
//---------------- first ret ----------------
|
||||
|
||||
|
||||
//erasing flash
|
||||
if(ret != FAIL)
|
||||
if(ret != FAIL){
|
||||
eraseFlash();
|
||||
fpgasrc = (char*)malloc(MAX_FPGAPROGRAMSIZE);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//writing to flash part by part
|
||||
while(filesize){
|
||||
while(ret != FAIL && filesize){
|
||||
|
||||
unitprogramsize = maxprogramsize; //2mb
|
||||
unitprogramsize = MAX_FPGAPROGRAMSIZE; //2mb
|
||||
if(unitprogramsize > filesize) //less than 2mb
|
||||
unitprogramsize = filesize;
|
||||
#ifdef VERY_VERBOSE
|
||||
printf("unit size to receive is:%d\n",unitprogramsize);
|
||||
printf("filesize:%d currentpointer:%d\n",filesize,currentPointer);
|
||||
#endif
|
||||
|
||||
|
||||
//receive
|
||||
n = receiveDataOnly(file_des,fpgasrc,unitprogramsize);
|
||||
if (n < 0) {
|
||||
@ -3210,6 +3104,7 @@ int program_fpga(int file_des) {
|
||||
}
|
||||
|
||||
|
||||
if (ret==OK) {
|
||||
if(!(unitprogramsize - filesize)){
|
||||
fpgasrc[unitprogramsize]='\0';
|
||||
filesize-=unitprogramsize;
|
||||
@ -3217,35 +3112,29 @@ int program_fpga(int file_des) {
|
||||
}else
|
||||
filesize-=unitprogramsize;
|
||||
|
||||
|
||||
if (ret==OK) {
|
||||
if (differentClients==1 && lockStatus==1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else{
|
||||
ret = writeFPGAProgram(fpgasrc,unitprogramsize,fp);
|
||||
}
|
||||
}
|
||||
|
||||
if(ret!=FAIL){
|
||||
if (differentClients)
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
/* send answer */
|
||||
/* send OK/failed */
|
||||
//---------------- middle rets ----------------
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
cprintf(RED,"Failure: Breaking out of program receiving\n");
|
||||
break;
|
||||
}
|
||||
//---------------- middle rets ----------------
|
||||
|
||||
|
||||
if(ret != FAIL){
|
||||
//print progress
|
||||
printf("Writing to Flash:%d%%\r",(int) (((double)(totalsize-filesize)/totalsize)*100) );
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
printf("\n");
|
||||
|
||||
//closing file pointer to flash and informing FPGA
|
||||
@ -3255,12 +3144,20 @@ int program_fpga(int file_des) {
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
if(ret!=FAIL){
|
||||
ret=FORCE_UPDATE;
|
||||
}
|
||||
|
||||
|
||||
//---------------- last ret ----------------
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret==FAIL)
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
//---------------- last ret ----------------
|
||||
|
||||
|
||||
//free resources
|
||||
if(fpgasrc != NULL)
|
||||
free(fpgasrc);
|
||||
if(fp!=NULL)
|
||||
fclose(fp);
|
||||
@ -3270,3 +3167,73 @@ int program_fpga(int file_des) {
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int reset_fpga(int file_des) {
|
||||
int ret=OK;
|
||||
int n;
|
||||
sprintf(mess,"Reset FPGA unsuccessful\n");
|
||||
|
||||
resetFPGA();
|
||||
usleep(250*1000);
|
||||
initializeDetector();
|
||||
|
||||
ret = FORCE_UPDATE;
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret==FAIL)
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
|
||||
/*return ok/fail*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int power_chip(int file_des) {
|
||||
|
||||
int retval=-1;
|
||||
int ret=OK;
|
||||
int arg=-1;
|
||||
int n;
|
||||
|
||||
n = receiveDataOnly(file_des,&arg,sizeof(arg));
|
||||
if (n < 0) {
|
||||
sprintf(mess,"Error reading from socket\n");
|
||||
ret=FAIL;
|
||||
}
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("Power chip to %d\n", arg);
|
||||
#endif
|
||||
|
||||
if (differentClients==1 && lockStatus==1 && arg!=-1) {
|
||||
ret=FAIL;
|
||||
sprintf(mess,"Detector locked by %s\n",lastClientIP);
|
||||
} else {
|
||||
retval=powerChip(arg);
|
||||
#ifdef VERBOSE
|
||||
printf("Chip powered: %d\n",retval);
|
||||
#endif
|
||||
|
||||
if (retval==arg || arg<0) {
|
||||
ret=OK;
|
||||
} else {
|
||||
ret=FAIL;
|
||||
printf("Powering chip failed, wrote %d but read %d\n", arg, retval);
|
||||
}
|
||||
|
||||
}
|
||||
if (ret==OK && differentClients==1)
|
||||
ret=FORCE_UPDATE;
|
||||
|
||||
/* send answer */
|
||||
n = sendDataOnly(file_des,&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
n += sendDataOnly(file_des,mess,sizeof(mess));
|
||||
} else
|
||||
n += sendDataOnly(file_des,&retval,sizeof(retval));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -97,4 +97,6 @@ int set_ctb_pattern(int);
|
||||
int write_adc_register(int);;
|
||||
|
||||
int program_fpga(int);
|
||||
int reset_fpga(int);
|
||||
int power_chip(int);
|
||||
#endif
|
||||
|
@ -3965,7 +3965,7 @@ int multiSlsDetector::programFPGA(string fname){
|
||||
ret=detectors[i]->programFPGA(fname);
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret!=OK)
|
||||
if (ret==FAIL)
|
||||
ret1=FAIL;
|
||||
}
|
||||
}
|
||||
@ -3974,6 +3974,39 @@ int multiSlsDetector::programFPGA(string fname){
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::resetFPGA(){
|
||||
int ret=OK, ret1=OK;
|
||||
|
||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||
if (detectors[i]) {
|
||||
ret=detectors[i]->resetFPGA();
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret==FAIL)
|
||||
ret1=FAIL;
|
||||
}
|
||||
}
|
||||
return ret1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::powerChip(int ival){
|
||||
int ret=OK, ret1=OK;
|
||||
|
||||
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
|
||||
if (detectors[i]) {
|
||||
ret=detectors[i]->powerChip(ival);
|
||||
if(detectors[i]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<i));
|
||||
if (ret==FAIL)
|
||||
ret1=FAIL;
|
||||
}
|
||||
}
|
||||
return ret1;
|
||||
}
|
||||
|
||||
|
||||
int multiSlsDetector::loadSettingsFile(string fname, int imod) {
|
||||
int id, im, ret=OK;
|
||||
|
||||
|
@ -494,6 +494,17 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
*/
|
||||
int programFPGA(string fname);
|
||||
|
||||
/** resets FPGA
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int resetFPGA();
|
||||
|
||||
/** power on/off the chip
|
||||
\param ival on is 1, off is 0, -1 to get
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int powerChip(int ival= -1);
|
||||
|
||||
/** loads the modules settings/trimbits reading from a file - file name extension is automatically generated! */
|
||||
int loadSettingsFile(string fname, int nmod=0);
|
||||
|
||||
|
@ -5499,7 +5499,7 @@ char* slsDetector::setDetectorMAC(string detectorMAC){
|
||||
(detectorMAC[11]==':')&&(detectorMAC[14]==':')){
|
||||
strcpy(thisDetector->detectorMAC,detectorMAC.c_str());
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||
std::cout << "Warning: UDP Set up failed. Receiver hostname not set." << endl;
|
||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||
else if(setUDPConnection()==FAIL)
|
||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||
}else{
|
||||
@ -5526,7 +5526,7 @@ char* slsDetector::setDetectorIP(string detectorIP){
|
||||
if(result!=0){
|
||||
strcpy(thisDetector->detectorIP,detectorIP.c_str());
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||
std::cout << "Warning: UDP Set up failed. Receiver hostname not set." << endl;
|
||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||
else if(setUDPConnection()==FAIL)
|
||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||
}else{
|
||||
@ -5618,7 +5618,7 @@ char* slsDetector::setReceiverUDPIP(string udpip){
|
||||
}else{
|
||||
strcpy(thisDetector->receiverUDPIP,udpip.c_str());
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||
std::cout << "Warning: UDP Set up failed. Receiver hostname not set." << endl;
|
||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||
else if(setUDPConnection()==FAIL){
|
||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||
}
|
||||
@ -5641,7 +5641,7 @@ char* slsDetector::setReceiverUDPMAC(string udpmac){
|
||||
(udpmac[11]==':')&&(udpmac[14]==':')){
|
||||
strcpy(thisDetector->receiverUDPMAC,udpmac.c_str());
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||
std::cout << "Warning: UDP Set up failed. Receiver hostname not set." << endl;
|
||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||
else if(setUDPConnection()==FAIL){
|
||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||
}
|
||||
@ -5660,7 +5660,7 @@ char* slsDetector::setReceiverUDPMAC(string udpmac){
|
||||
int slsDetector::setReceiverUDPPort(int udpport){
|
||||
thisDetector->receiverUDPPort = udpport;
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||
std::cout << "Warning: UDP Set up failed. Receiver hostname not set." << endl;
|
||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||
else if(setUDPConnection()==FAIL){
|
||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||
}
|
||||
@ -5670,7 +5670,7 @@ int slsDetector::setReceiverUDPPort(int udpport){
|
||||
int slsDetector::setReceiverUDPPort2(int udpport){
|
||||
thisDetector->receiverUDPPort2 = udpport;
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none"))
|
||||
std::cout << "Warning: UDP Set up failed. Receiver hostname not set." << endl;
|
||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||
else if(setUDPConnection()==FAIL){
|
||||
std::cout<< "Warning: UDP connection set up failed" << std::endl;
|
||||
}
|
||||
@ -5724,7 +5724,7 @@ int slsDetector::setUDPConnection(){
|
||||
|
||||
//called before set up
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none")){
|
||||
std::cout << "Warning: UDP Set up failed. Receiver hostname not set." << endl;
|
||||
std::cout << "Warning: Receiver hostname not set yet." << endl;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -6430,12 +6430,18 @@ int slsDetector::writeSettingsFile(string fname, int imod, int* iodelay){
|
||||
|
||||
int slsDetector::programFPGA(string fname){
|
||||
int ret=FAIL;
|
||||
int fnum=F_PROGRAM_FPGA;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int64_t retval = -1;
|
||||
size_t filesize=0;
|
||||
char* fpgasrc = NULL;
|
||||
|
||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||
std::cout << "Not implemented for this detector" << std::endl;
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
|
||||
//check if it exists
|
||||
struct stat st;
|
||||
if(stat(fname.c_str(),&st)){
|
||||
@ -6443,7 +6449,6 @@ int slsDetector::programFPGA(string fname){
|
||||
setErrorMask((getErrorMask())|(PROGRAMMING_ERROR));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
//create destination file name,replaces original filename with Jungfrau.rawbin
|
||||
string destfname;
|
||||
size_t found = fname.find_last_of("/\\");
|
||||
@ -6452,8 +6457,6 @@ int slsDetector::programFPGA(string fname){
|
||||
else
|
||||
destfname = fname.substr(0,found+1);
|
||||
destfname.append("Jungfrau_MCB.rawbin");
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Converting " << fname << " to " << destfname << std::endl;
|
||||
#endif
|
||||
@ -6470,11 +6473,9 @@ int slsDetector::programFPGA(string fname){
|
||||
for (filepos=0x80; filepos < 0x1000000; filepos++) {
|
||||
x = fgetc(src);
|
||||
if (x < 0) break;
|
||||
|
||||
y=0;
|
||||
for (i=0; i < 8; i++)
|
||||
y=y| ( (( x & (1<<i) ) >> i) << (7-i) ); // This swaps the bits
|
||||
|
||||
fputc(y,dst);
|
||||
}
|
||||
if (filepos < 0x1000000){
|
||||
@ -6485,7 +6486,6 @@ int slsDetector::programFPGA(string fname){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "File has been converted to " << destfname << std::endl;
|
||||
#endif
|
||||
|
||||
//loading file to memory
|
||||
FILE* fp = fopen(destfname.c_str(),"r");
|
||||
if(fp == NULL){
|
||||
@ -6498,14 +6498,14 @@ int slsDetector::programFPGA(string fname){
|
||||
setErrorMask((getErrorMask())|(PROGRAMMING_ERROR));
|
||||
return FAIL;
|
||||
}
|
||||
size_t filesize = ftell(fp);
|
||||
if(filesize == -1){
|
||||
filesize = ftell(fp);
|
||||
if(filesize <= 0){
|
||||
std::cout << "Could not get length of rawbin file" << std::endl;
|
||||
setErrorMask((getErrorMask())|(PROGRAMMING_ERROR));
|
||||
return FAIL;
|
||||
}
|
||||
rewind(fp);
|
||||
char* fpgasrc = (char*)malloc(filesize+1);
|
||||
fpgasrc = (char*)malloc(filesize+1);
|
||||
if(fpgasrc == NULL){
|
||||
std::cout << "Could not allocate size of program" << std::endl;
|
||||
setErrorMask((getErrorMask())|(PROGRAMMING_ERROR));
|
||||
@ -6526,14 +6526,8 @@ int slsDetector::programFPGA(string fname){
|
||||
std::cout << "Successfully loaded the rawbin file to program memory" << std::endl;
|
||||
#endif
|
||||
|
||||
const size_t maxprogramsize = 2 * 1024 *1024;
|
||||
size_t unitprogramsize = 0;
|
||||
int currentPointer = 0;
|
||||
size_t totalsize = filesize;
|
||||
|
||||
int fnum=F_PROGRAM_FPGA;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int64_t retval = -1;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending programming binary to detector " << endl;
|
||||
#endif
|
||||
@ -6541,7 +6535,6 @@ int slsDetector::programFPGA(string fname){
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&filesize,sizeof(filesize));
|
||||
|
||||
//check opening error
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
@ -6551,6 +6544,8 @@ int slsDetector::programFPGA(string fname){
|
||||
filesize = 0;
|
||||
}
|
||||
|
||||
|
||||
//erasing flash
|
||||
if(ret!=FAIL){
|
||||
std::cout<< "This can take awhile. Please be patient..." << endl;
|
||||
printf("Erasing Flash:%d%%\r",0);
|
||||
@ -6568,10 +6563,14 @@ int slsDetector::programFPGA(string fname){
|
||||
std::cout << flush;
|
||||
}
|
||||
|
||||
//sending program in parts of 2mb each
|
||||
while(filesize > 0){
|
||||
|
||||
unitprogramsize = maxprogramsize; //2mb
|
||||
//sending program in parts of 2mb each
|
||||
size_t unitprogramsize = 0;
|
||||
int currentPointer = 0;
|
||||
size_t totalsize= filesize;
|
||||
while(ret != FAIL && (filesize > 0)){
|
||||
|
||||
unitprogramsize = MAX_FPGAPROGRAMSIZE; //2mb
|
||||
if(unitprogramsize > filesize) //less than 2mb
|
||||
unitprogramsize = filesize;
|
||||
#ifdef VERBOSE
|
||||
@ -6579,20 +6578,18 @@ int slsDetector::programFPGA(string fname){
|
||||
#endif
|
||||
controlSocket->SendDataOnly(fpgasrc+currentPointer,unitprogramsize);
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(PROGRAMMING_ERROR));
|
||||
//stops writing
|
||||
break;
|
||||
}
|
||||
if (ret!=FAIL) {
|
||||
filesize-=unitprogramsize;
|
||||
currentPointer+=unitprogramsize;
|
||||
|
||||
//print progress
|
||||
printf("Writing to Flash:%d%%\r",(int) (((double)(totalsize-filesize)/totalsize)*100));
|
||||
std::cout << flush;
|
||||
|
||||
}else{
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(PROGRAMMING_ERROR));
|
||||
}
|
||||
}
|
||||
std::cout<<std::endl;
|
||||
|
||||
@ -6603,8 +6600,6 @@ int slsDetector::programFPGA(string fname){
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(PROGRAMMING_ERROR));
|
||||
}
|
||||
|
||||
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
@ -6612,13 +6607,81 @@ int slsDetector::programFPGA(string fname){
|
||||
}
|
||||
|
||||
//free resources
|
||||
if(fpgasrc != NULL)
|
||||
free(fpgasrc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::resetFPGA(){
|
||||
int ret=FAIL;
|
||||
int fnum=F_RESET_FPGA;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
|
||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||
std::cout << "Not implemented for this detector" << std::endl;
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending reset to FPGA " << endl;
|
||||
#endif
|
||||
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
|
||||
//check opening error
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(RESET_ERROR));
|
||||
}
|
||||
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
int slsDetector::powerChip(int ival){
|
||||
int ret=FAIL;
|
||||
int fnum=F_POWER_CHIP;
|
||||
char mess[MAX_STR_LENGTH]="";
|
||||
int retval=-1;
|
||||
|
||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||
std::cout << "Not implemented for this detector" << std::endl;
|
||||
return FAIL;
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Sending power on/off/get to the chip " << endl;
|
||||
#endif
|
||||
if (setOnline(ONLINE_FLAG)==ONLINE_FLAG) {
|
||||
if (connectControl() == OK){
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&ival,sizeof(ival));
|
||||
//check opening error
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret==FAIL) {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
setErrorMask((getErrorMask())|(POWER_CHIP));
|
||||
}else
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
disconnectControl();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
|
||||
}
|
||||
int slsDetector::loadSettingsFile(string fname, int imod) {
|
||||
|
||||
sls_detector_module *myMod=NULL;
|
||||
|
@ -528,6 +528,18 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int programFPGA(string fname);
|
||||
|
||||
/** resets FPGA
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int resetFPGA();
|
||||
|
||||
/** power on/off the chip
|
||||
\param ival on is 1, off is 0, -1 to get
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
int powerChip(int ival= -1);
|
||||
|
||||
|
||||
/** loads the modules settings/trimbits reading from a file
|
||||
\param fname file name . If not specified, extension is automatically generated!
|
||||
\param imod module number, -1 means all modules
|
||||
|
@ -441,10 +441,23 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
|
||||
i++;
|
||||
|
||||
|
||||
/* fpga */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="programfpga";
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="resetfpga";
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
|
||||
i++;
|
||||
|
||||
|
||||
/* chip */
|
||||
descrToFuncMap[i].m_pFuncName="powerchip";
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdAdvanced;
|
||||
i++;
|
||||
|
||||
/* versions/ serial numbers getId */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="moduleversion"; //
|
||||
@ -4352,25 +4365,52 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
|
||||
|
||||
return myDet->externalSignalType(myDet->setExternalSignalFlags(flag,is));
|
||||
|
||||
} else if (cmd=="programfpga") {
|
||||
}
|
||||
|
||||
|
||||
else if (cmd=="programfpga") {
|
||||
if (action==GET_ACTION)
|
||||
return string("cannot get");
|
||||
|
||||
if (narg<2)
|
||||
return string("wrong usage: should specify programming file");
|
||||
if(strstr(args[1],".pof")==NULL)
|
||||
return string("wrong usage: should specify programming file with .pof extension");
|
||||
|
||||
return string("wrong usage: programming file should have .pof extension");
|
||||
string sval=string(args[1]);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< " programming file " << sval << std::endl;
|
||||
#endif
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if(myDet->programFPGA(sval) == OK)
|
||||
return string("programming successful");
|
||||
return string("programming unsuccessful");
|
||||
return string("successful");
|
||||
return string("unsuccessful");
|
||||
}
|
||||
|
||||
|
||||
else if (cmd=="resetfpga") {
|
||||
if (action==GET_ACTION)
|
||||
return string("cannot get");
|
||||
#ifdef VERBOSE
|
||||
std::cout<< " resetting fpga " << sval << std::endl;
|
||||
#endif
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if(myDet->resetFPGA() == OK)
|
||||
return string("successful");
|
||||
return string("unsuccessful");
|
||||
}
|
||||
|
||||
|
||||
else if (cmd=="powerchip") {
|
||||
char ans[100];
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION){
|
||||
int ival = -1;
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string("could not scan powerchip parameter " + string(args[1]));
|
||||
myDet->powerChip(ival);
|
||||
}
|
||||
sprintf(ans,"%d",myDet->powerChip());
|
||||
return string(ans);
|
||||
}
|
||||
else
|
||||
return string("could not decode flag ")+cmd;
|
||||
return string("unknown command ")+cmd;
|
||||
|
||||
}
|
||||
|
||||
@ -4382,8 +4422,8 @@ string slsDetectorCommand::helpAdvanced(int narg, char *args[], int action) {
|
||||
|
||||
os << "extsig:i mode \t sets the mode of the external signal i. can be \n \t \t \t off, \n \t \t \t gate_in_active_high, \n \t \t \t gate_in_active_low, \n \t \t \t trigger_in_rising_edge, \n \t \t \t trigger_in_falling_edge, \n \t \t \t ro_trigger_in_rising_edge, \n \t \t \t ro_trigger_in_falling_edge, \n \t \t \t gate_out_active_high, \n \t \t \t gate_out_active_low, \n \t \t \t trigger_out_rising_edge, \n \t \t \t trigger_out_falling_edge, \n \t \t \t ro_trigger_out_rising_edge, \n \t \t \t ro_trigger_out_falling_edge" << std::endl;
|
||||
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, safe, unknown" << std::endl;
|
||||
os << "programfpga f \t programs the fpga with file f with .pof" << std::endl;
|
||||
|
||||
os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl;
|
||||
os << "resetfpga f \t resets fpga, f can be any value" << std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
|
||||
|
@ -497,7 +497,16 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
*/
|
||||
virtual int programFPGA(string fname)=0;
|
||||
|
||||
/** resets FPGA
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
virtual int resetFPGA()=0;
|
||||
|
||||
/** power on/off the chip
|
||||
\param ival on is 1, off is 0, -1 to get
|
||||
\returns OK or FAIL
|
||||
*/
|
||||
virtual int powerChip(int ival= -1)=0;
|
||||
|
||||
/** saves the modules settings/trimbits writing to a file
|
||||
\param fname file name . Axtension is automatically generated!
|
||||
|
Loading…
x
Reference in New Issue
Block a user