mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
merge from 4.0.1
This commit is contained in:
@ -887,7 +887,7 @@ int64_t get64BitReg(int aLSB, int aMSB){
|
||||
return v64;
|
||||
}
|
||||
|
||||
int64_t setFrames(int64_t value){
|
||||
int64_t setFrames(int64_t value){printf("setting frames to %lld\n", (long long int)value);
|
||||
return set64BitReg(value, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
@ -895,7 +895,7 @@ int64_t getFrames(){
|
||||
return get64BitReg(GET_FRAMES_LSB_REG, GET_FRAMES_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t setExposureTime(int64_t value){
|
||||
int64_t setExposureTime(int64_t value){printf("setting exptime to %lld ns\n", (long long int)value);
|
||||
/* time is in ns */
|
||||
if (value!=-1) {
|
||||
value = (value * 1E-3 * CLK_FREQ ) + 0.5;
|
||||
@ -909,7 +909,7 @@ int64_t getExposureTime(){
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
}
|
||||
|
||||
int64_t setGates(int64_t value){
|
||||
int64_t setGates(int64_t value){printf("setting gates to %lld\n", (long long int)value);
|
||||
return set64BitReg(value, SET_GATES_LSB_REG, SET_GATES_MSB_REG);
|
||||
}
|
||||
|
||||
@ -917,7 +917,7 @@ int64_t getGates(){
|
||||
return get64BitReg(GET_GATES_LSB_REG, GET_GATES_MSB_REG);
|
||||
}
|
||||
|
||||
int64_t setPeriod(int64_t value){
|
||||
int64_t setPeriod(int64_t value){printf("setting period to %lld ns\n", (long long int)value);
|
||||
/* time is in ns */
|
||||
if (value!=-1) {
|
||||
value = (value * 1E-3 * CLK_FREQ ) + 0.5;
|
||||
@ -931,7 +931,7 @@ int64_t getPeriod(){
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
}
|
||||
|
||||
int64_t setDelay(int64_t value){
|
||||
int64_t setDelay(int64_t value){printf("setting delay to %lld ns\n", (long long int)value);
|
||||
/* time is in ns */
|
||||
if (value!=-1) {
|
||||
if (masterflags == IS_MASTER) {
|
||||
@ -955,7 +955,7 @@ int64_t getDelay(){
|
||||
(1E-3 * CLK_FREQ)) + 0.5;
|
||||
}
|
||||
|
||||
int64_t setTrains(int64_t value){
|
||||
int64_t setTrains(int64_t value){printf("setting cycles to %lld\n", (long long int)value);
|
||||
return set64BitReg(value, SET_TRAINS_LSB_REG, SET_TRAINS_MSB_REG);
|
||||
}
|
||||
|
||||
@ -1438,6 +1438,56 @@ int configureMAC(int ipad,long long int macad,long long int detectormacad, int d
|
||||
|
||||
usleep(1000 * 1000);
|
||||
|
||||
/** send out first image as first packet does not give 0xcacacaca (needed to know if first image
|
||||
* when switching back and forth between roi and no roi
|
||||
*/
|
||||
// remember old parameters
|
||||
int oldtiming = setTiming(-1);
|
||||
uint64_t oldframes = setFrames(-1);
|
||||
uint64_t oldcycles = setTrains(-1);
|
||||
uint64_t oldPeriod = setPeriod(-1);
|
||||
uint64_t oldExptime = setExposureTime(-1);
|
||||
|
||||
// set to basic parameters
|
||||
cprintf(BLUE,"Setting basic parameters\n"
|
||||
"\tTiming: auto, frames: 1, cycles: 1, period: 1s, exptime: 900ms\n");
|
||||
setTiming(AUTO_TIMING);
|
||||
setFrames(1);
|
||||
setTrains(1);
|
||||
setPeriod(1e9); // important to keep this until we have to wait for acquisition to start
|
||||
setExposureTime(900 * 1000);
|
||||
|
||||
// take an image
|
||||
if (masterflags == IS_MASTER)
|
||||
usleep(1 * 1000 * 1000); // required to ensure master starts acquisition only after slave has changed to basic parameters and is waiting
|
||||
|
||||
int loop = 0;
|
||||
startStateMachine();
|
||||
// wait for acquisition to start (trigger from master)
|
||||
printf(" Waiting for acquisition to start\n");
|
||||
while(!runBusy()) {
|
||||
usleep(0);
|
||||
++loop;
|
||||
}
|
||||
|
||||
cprintf(MAGENTA, "waited %d loops to start\n", loop);
|
||||
cprintf(BLUE, " Waiting for acquisition to end (frames left: %lld)\n", (long long int)getFrames());
|
||||
waitForAcquisitionFinish();
|
||||
|
||||
// set to previous parameters
|
||||
cprintf(BLUE,"Setting previous parameters:\n"
|
||||
"\tTiming: %d, "
|
||||
"frames: %lld, "
|
||||
"cycles: %lld, "
|
||||
"period: %lld ns, "
|
||||
"exptime:%lld ns\n",
|
||||
oldtiming, oldframes, oldcycles, oldPeriod, oldExptime);
|
||||
setTiming(oldtiming);
|
||||
setFrames(oldframes);
|
||||
setTrains(oldcycles);
|
||||
setPeriod(oldPeriod);
|
||||
setExposureTime(oldExptime);
|
||||
|
||||
return adcConfigured;
|
||||
}
|
||||
|
||||
@ -1448,6 +1498,7 @@ int getAdcConfigured(){
|
||||
|
||||
u_int32_t runBusy(void) {
|
||||
u_int32_t s = bus_r(STATUS_REG) & RUN_BUSY_BIT;
|
||||
//printf("runBusy: 0x%08x\n", s);
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -1478,7 +1529,8 @@ u_int32_t runState(void) {
|
||||
int startStateMachine(){
|
||||
|
||||
//#ifdef VERBOSE
|
||||
printf("*******Starting State Machine*******\n");
|
||||
cprintf(GREEN,"*******Starting State Machine*******\n");
|
||||
cprintf(GREEN,"Number of frames to acquire:%lld\n", (long long int)setFrames(-1));
|
||||
//#endif
|
||||
cleanFifo();
|
||||
// fifoReset();
|
||||
@ -1559,28 +1611,29 @@ u_int32_t fifo_full(void)
|
||||
|
||||
|
||||
void waitForAcquisitionFinish(){
|
||||
volatile u_int32_t t = bus_r(LOOK_AT_ME_REG);
|
||||
volatile u_int32_t t = bus_r(LOOK_AT_ME_REG);
|
||||
#ifdef VERBOSE
|
||||
printf("lookatmereg=x%x\n",t);
|
||||
printf("lookatmereg=x%x\n",t);
|
||||
#endif
|
||||
while((t&0x1)==0) {
|
||||
if (runBusy()==0) {
|
||||
t = bus_r(LOOK_AT_ME_REG);
|
||||
if ((t&0x1)==0) {
|
||||
while((t&0x1)==0) {
|
||||
if (runBusy() == 0) {
|
||||
t = bus_r(LOOK_AT_ME_REG);
|
||||
if ((t&0x1)==0) {
|
||||
#ifdef VERBOSE
|
||||
printf("no frame found - exiting ");
|
||||
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
printf("no frame found - exiting ");
|
||||
printf("%08x %08x\n", runState(), bus_r(LOOK_AT_ME_REG));
|
||||
#endif
|
||||
return;
|
||||
} else {
|
||||
return;
|
||||
} else {
|
||||
#ifdef VERBOSE
|
||||
printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState());
|
||||
printf("no frame found %x status %x\n", bus_r(LOOK_AT_ME_REG),runState());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
t = bus_r(LOOK_AT_ME_REG);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
t = bus_r(LOOK_AT_ME_REG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/gotthardDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: c52025dd7c4b44b93e64353a22997d971996ab18
|
||||
Revision: 237
|
||||
Repsitory UUID: def79807f6f40ed1797b8154240adbc0e35c95e0
|
||||
Revision: 244
|
||||
Branch: developer
|
||||
Last Changed Author: Gemma_Tinti
|
||||
Last Changed Rev: 3999
|
||||
Last Changed Date: 2018-09-28 16:10:41.000000002 +0200 ./server_funcs.c
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4039
|
||||
Last Changed Date: 2019-02-11 11:53:14.000000002 +0100 ./server_funcs.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "c52025dd7c4b44b93e64353a22997d971996ab18"
|
||||
#define GITAUTH "Gemma_Tinti"
|
||||
#define GITREV 0x3999
|
||||
#define GITDATE 0x20180928
|
||||
#define GITREPUUID "def79807f6f40ed1797b8154240adbc0e35c95e0"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4039
|
||||
#define GITDATE 0x20190211
|
||||
#define GITBRANCH "developer"
|
||||
|
Binary file not shown.
Binary file not shown.
@ -42,7 +42,7 @@
|
||||
#define TOKEN_RESTART_DELAY 0x88000000
|
||||
#define TOKEN_RESTART_DELAY_ROI 0x1b000000
|
||||
#define TOKEN_TIMING_REV1 0x1f16
|
||||
#define TOKEN_TIMING_REV2 0x1f0f
|
||||
#define TOKEN_TIMING_REV2 0x1f10
|
||||
|
||||
#define DEFAULT_PHASE_SHIFT 120
|
||||
#define DEFAULT_IP_PACKETSIZE 0x0522
|
||||
|
@ -1829,7 +1829,7 @@ int get_run_status(int file_des) {
|
||||
#endif
|
||||
|
||||
retval= runState();
|
||||
printf("\n\nSTATUS=%08x\n",retval);
|
||||
printf("STATUS=%08x\n",retval);
|
||||
|
||||
|
||||
//stopped (external stop, also maybe fifo full)
|
||||
@ -2046,9 +2046,9 @@ int set_timer(int file_des) {
|
||||
printf(mess);
|
||||
}
|
||||
|
||||
//#ifdef VERBOSE
|
||||
#ifdef VERBOSE
|
||||
printf("setting timer %d to %lld ns\n",ind,tns);
|
||||
//#endif
|
||||
#endif
|
||||
if (ret==OK) {
|
||||
|
||||
if (differentClients==1 && lockStatus==1 && tns!=-1) {
|
||||
@ -2593,7 +2593,7 @@ int configure_mac(int file_des) {
|
||||
sscanf(arg[3], "%llx", &idetectormacadd);
|
||||
sscanf(arg[4], "%x", &detipad);
|
||||
//arg[5] is udpport2 for eiger
|
||||
#ifdef VERBOSE
|
||||
//#ifdef VERBOSE
|
||||
int i;
|
||||
printf("\ndigital_test_bit in server %d\t",digitalTestBit);
|
||||
printf("\nipadd %x\t",ipad);
|
||||
@ -2606,8 +2606,9 @@ int configure_mac(int file_des) {
|
||||
for (i=0;i<6;i++)
|
||||
printf("detector mac adress %d is 0x%x \n",6-i,(unsigned int)(((idetectormacadd>>(8*i))&0xFF)));
|
||||
printf("detipad %x\n",detipad);
|
||||
printf("destination ip is %d.%d.%d.%d = 0x%x \n",(detipad>>24)&0xff,(detipad>>16)&0xff,(detipad>>8)&0xff,(detipad)&0xff,detipad);
|
||||
printf("\n");
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user