This commit is contained in:
Dhanya Maliakal
2016-11-01 09:12:58 +01:00
parent 5b4528925d
commit 2a7a11b80f
5 changed files with 18 additions and 14 deletions

View File

@ -65,6 +65,7 @@ typedef struct ip_header_struct {
struct timeval tss,tse,tsss; //for timing struct timeval tss,tse,tsss; //for timing
int gpiopinsdefined = 0;
@ -1058,6 +1059,7 @@ int64_t setPeriod(int64_t value){
printf("\nSetting period to %lld\n",(long long int)value); printf("\nSetting period to %lld\n",(long long int)value);
value*=(1E-3*clockdivider); value*=(1E-3*clockdivider);
} }
return set64BitReg(value,SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/(1E-3*clockdivider);//(1E-9*CLK_FREQ); return set64BitReg(value,SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/(1E-3*clockdivider);//(1E-9*CLK_FREQ);
} }
@ -1434,12 +1436,16 @@ int writeGbeReg(int ivar, uint32_t val, int addr, int interface) {
int configureInterface(uint32_t destip,uint64_t destmac,uint64_t sourcemac,int sourceip,int ival,uint32_t destport, uint32_t sourceport, int interface) { int configureInterface(uint32_t destip,uint64_t destmac,uint64_t sourcemac,int sourceip,int ival,uint32_t destport, uint32_t sourceport, int interface) {
//int configureMAC(int ipad,long long int macad,long long int detectormacad, int detipad, int ival, int udpport){ //int configureMAC(int ipad,long long int macad,long long int detectormacad, int detipad, int ival, int udpport){
/*
if(!gpiopinsdefined){
defineGPIOpins();
gpiopinsdefined = 1;
}
//tell FPGA to not touch flash //tell FPGA to not touch flash
system("echo 0 > /sys/class/gpio/gpio9/value"); system("echo 0 > /sys/class/gpio/gpio9/value");
//tell FPGA to touch flash to program itself //tell FPGA to touch flash to program itself
system("echo 1 > /sys/class/gpio/gpio9/value"); system("echo 1 > /sys/class/gpio/gpio9/value");
*/
volatile u_int32_t conf= bus_r(CONFIG_REG); volatile u_int32_t conf= bus_r(CONFIG_REG);

View File

@ -97,9 +97,6 @@ int init_detector(int b) {
); );
defineGPIOpins();
printf("Resetting PLL\n"); printf("Resetting PLL\n");
resetPLL(); resetPLL();
bus_w16(CONTROL_REG, SYNC_RESET); bus_w16(CONTROL_REG, SYNC_RESET);
@ -172,6 +169,7 @@ int init_detector(int b) {
setDelay(0); setDelay(0);
setGates(0); setGates(0);
setTiming(GET_EXTERNAL_COMMUNICATION_MODE); setTiming(GET_EXTERNAL_COMMUNICATION_MODE);
setMaster(GET_MASTER); setMaster(GET_MASTER);
setSynchronization(GET_SYNCHRONIZATION_MODE); setSynchronization(GET_SYNCHRONIZATION_MODE);
@ -2461,6 +2459,7 @@ int send_update(int file_des) {
retval=setExposureTime(tns); retval=setExposureTime(tns);
n = sendDataOnly(file_des,&retval,sizeof(int64_t)); n = sendDataOnly(file_des,&retval,sizeof(int64_t));
retval=setPeriod(tns); retval=setPeriod(tns);
cprintf(RED,"updated frame period from %lld tns:%d\n", (long long int)retval, tns);
n = sendDataOnly(file_des,&retval,sizeof(int64_t)); n = sendDataOnly(file_des,&retval,sizeof(int64_t));
retval=setDelay(tns); retval=setDelay(tns);
n = sendDataOnly(file_des,&retval,sizeof(int64_t)); n = sendDataOnly(file_des,&retval,sizeof(int64_t));

View File

@ -3560,7 +3560,6 @@ int slsDetector::updateDetectorNoWait() {
//retval=setPeriod(tns); //retval=setPeriod(tns);
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
thisDetector->timerValue[FRAME_PERIOD]=retval; thisDetector->timerValue[FRAME_PERIOD]=retval;
cprintf(RED,"updated frame period to %lld\n", (long long int)thisDetector->timerValue[FRAME_PERIOD]);
//retval=setDelay(tns); //retval=setDelay(tns);
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t)); n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval; thisDetector->timerValue[DELAY_AFTER_TRIGGER]=retval;
@ -3986,9 +3985,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
if (index!=MEASUREMENTS_NUMBER) { if (index!=MEASUREMENTS_NUMBER) {
//#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Setting timer "<< index << " to " << t << "ns/value" << std::endl; std::cout<< "Setting timer "<< index << " to " << t << "ns/value" << std::endl;
//#endif #endif
if (thisDetector->onlineFlag==ONLINE_FLAG) { if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){ if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum)); controlSocket->SendDataOnly(&fnum,sizeof(fnum));
@ -4026,9 +4025,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
if (t>=0) if (t>=0)
thisDetector->timerValue[index]=t; thisDetector->timerValue[index]=t;
} }
//#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl; std::cout<< "Timer " << index << " set to "<< thisDetector->timerValue[index] << "ns" << std::endl;
//#endif #endif
if ((thisDetector->myDetectorType==MYTHEN)&&(index==PROBES_NUMBER)) { if ((thisDetector->myDetectorType==MYTHEN)&&(index==PROBES_NUMBER)) {
setDynamicRange(); setDynamicRange();
@ -4078,9 +4077,9 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
} }
//set period //set period
else{ else{
//#ifdef VERBOSE #ifdef VERBOSE
std::cout << "Setting/Getting acquisition period " << index << " to/from receiver " << args[1] << std::endl; std::cout << "Setting/Getting acquisition period " << index << " to/from receiver " << args[1] << std::endl;
//#endif #endif
//if acquisition period is zero, then #frames/buffer depends on exposure time and not acq period //if acquisition period is zero, then #frames/buffer depends on exposure time and not acq period
if(!args[1]) if(!args[1])
args[1] = timerValue[ACQUISITION_TIME]; args[1] = timerValue[ACQUISITION_TIME];
@ -5547,7 +5546,7 @@ char* slsDetector::setReceiver(string receiverIP){
strcpy(thisDetector->receiver_hostname,receiverIP.c_str()); strcpy(thisDetector->receiver_hostname,receiverIP.c_str());
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){ if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
//#ifdef VERBOSE #ifdef VERBOSE
std::cout << "Setting up receiver with" << endl; std::cout << "Setting up receiver with" << endl;
std::cout << "detector type:" << slsDetectorBase::getDetectorType(thisDetector->myDetectorType) << endl; std::cout << "detector type:" << slsDetectorBase::getDetectorType(thisDetector->myDetectorType) << endl;
std::cout << "detector hostname:" << thisDetector->hostname << endl; std::cout << "detector hostname:" << thisDetector->hostname << endl;
@ -5565,7 +5564,7 @@ char* slsDetector::setReceiver(string receiverIP){
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl << endl; std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl << endl;
//std::cout << "dataStreaming:" << enableDataStreamingFromReceiver(-1) << endl << endl; //std::cout << "dataStreaming:" << enableDataStreamingFromReceiver(-1) << endl << endl;
/** enable compresison, */ /** enable compresison, */
//#endif #endif
if(setDetectorType()!= GENERIC){ if(setDetectorType()!= GENERIC){
setDetectorHostname(); setDetectorHostname();
setFilePath(fileIO::getFilePath()); setFilePath(fileIO::getFilePath());