mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-02 02:40:04 +02:00
Merge branch 'developer' of git.psi.ch:sls_detectors_software/sls_detector_software into developer
This commit is contained in:
commit
5f0575236e
@ -242,7 +242,7 @@ public:
|
||||
retval.append("Could not activate/deactivate receiver\n");
|
||||
|
||||
if(slsErrorMask&DATA_STREAMING)
|
||||
retval.append("Could not set/reset Data Streaming\n");
|
||||
retval.append("Could not enable/disable Data Streaming\n");
|
||||
|
||||
if(slsErrorMask&RESET_ERROR)
|
||||
retval.append("Could not reset the FPGA\n");
|
||||
|
@ -194,7 +194,9 @@ enum networkParameter {
|
||||
FLOW_CONTROL_WR_PTR, /**< memory write pointer for flow control */
|
||||
FLOW_CONTROL_RD_PTR, /**< memory read pointer for flow control */
|
||||
RECEIVER_STREAMING_PORT, /**< receiever streaming TCP(ZMQ) port */
|
||||
RECEIVER_STREAMING_SRC_IP /**< receiever streaming TCP(ZMQ) ip */
|
||||
CLIENT_STREAMING_PORT, /**< client streaming TCP(ZMQ) port */
|
||||
RECEIVER_STREAMING_SRC_IP,/**< receiever streaming TCP(ZMQ) ip */
|
||||
CLIENT_STREAMING_SRC_IP /**< client streaming TCP(ZMQ) ip */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -4044,7 +4044,7 @@ void initializeDetector(){
|
||||
setFrames(-1);
|
||||
setTrains(-1);
|
||||
setExposureTime(-1);
|
||||
setPeriod(-1);
|
||||
setPeriod(1 * 1000 * 1000);//1ms
|
||||
setDelay(-1);
|
||||
setGates(-1);
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/jctbDetectorServer
|
||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||
Repsitory UUID: 2ed351b29db70212973e15b26f604a0a7fef6fcc
|
||||
Revision: 14
|
||||
Repsitory UUID: 9701f00f9e6e9ed5563b6b5c4ace2f4a431b1db7
|
||||
Revision: 16
|
||||
Branch: developer
|
||||
Last Changed Author: Dhanya_Maliakal
|
||||
Last Changed Rev: 1582
|
||||
Last Changed Date: 2017-09-21 16:35:15.000000002 +0200 ./firmware_funcs.c
|
||||
Last Changed Rev: 1669
|
||||
Last Changed Date: 2017-11-20 11:32:02.000000002 +0100 ./firmware_funcs.c
|
||||
|
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUID "2ed351b29db70212973e15b26f604a0a7fef6fcc"
|
||||
//#define SVNREV 0x1582
|
||||
#define SVNREPUUID "9701f00f9e6e9ed5563b6b5c4ace2f4a431b1db7"
|
||||
//#define SVNREV 0x1669
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTH "Dhanya_Maliakal"
|
||||
#define SVNREV 0x1582
|
||||
#define SVNDATE 0x20170921
|
||||
#define SVNREV 0x1669
|
||||
#define SVNDATE 0x20171120
|
||||
//
|
||||
|
Binary file not shown.
Binary file not shown.
@ -216,6 +216,7 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
|
||||
thisMultiDetector->receiver_read_freq = 0;
|
||||
thisMultiDetector->acquiringFlag = false;
|
||||
thisMultiDetector->externalgui = false;
|
||||
thisMultiDetector->receiver_datastream = false;
|
||||
thisMultiDetector->alreadyExisting=1;
|
||||
}
|
||||
|
||||
@ -281,7 +282,7 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
|
||||
|
||||
getNMods();
|
||||
getMaxMods();
|
||||
dataSocketsStarted = false;
|
||||
client_datastream = false;
|
||||
for(int i=0;i<MAXDET;++i)
|
||||
zmqSocket[i] = 0;
|
||||
threadpool = 0;
|
||||
@ -3728,10 +3729,26 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
|
||||
// disable data streaming before changing zmq port (but only if they were on)
|
||||
int prev_streaming = 0;
|
||||
if (p == RECEIVER_STREAMING_PORT || p == RECEIVER_STREAMING_SRC_IP) {
|
||||
prev_streaming = getStreamingSocketsCreatedInClient();
|
||||
enableDataStreamingFromReceiver(0);
|
||||
}
|
||||
switch (p) {
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
prev_streaming = enableDataStreamingFromReceiver();
|
||||
enableDataStreamingFromReceiver(0);
|
||||
break;
|
||||
case CLIENT_STREAMING_PORT:
|
||||
prev_streaming = enableDataStreamingToClient();
|
||||
enableDataStreamingToClient(0);
|
||||
break;
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
prev_streaming = enableDataStreamingFromReceiver();
|
||||
enableDataStreamingFromReceiver(0);
|
||||
break;
|
||||
case CLIENT_STREAMING_SRC_IP:
|
||||
prev_streaming = enableDataStreamingToClient();
|
||||
enableDataStreamingToClient(0);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
if (s.find('+')==string::npos) {
|
||||
|
||||
@ -3742,7 +3759,7 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
string* sret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
||||
if(detectors[idet]){
|
||||
if (p == RECEIVER_STREAMING_PORT)
|
||||
if (p == RECEIVER_STREAMING_PORT || p == CLIENT_STREAMING_PORT)
|
||||
s.append("multi\0");
|
||||
sret[idet]=new string("error");
|
||||
Task* task = new Task(new func2_t<string,networkParameter,string>(&slsDetector::setNetworkParameter,
|
||||
@ -3786,8 +3803,23 @@ string multiSlsDetector::setNetworkParameter(networkParameter p, string s){
|
||||
}
|
||||
|
||||
//enable data streaming if it was on
|
||||
if ((p == RECEIVER_STREAMING_PORT || p == RECEIVER_STREAMING_SRC_IP) && prev_streaming)
|
||||
enableDataStreamingFromReceiver(1);
|
||||
if (prev_streaming) {
|
||||
switch (p) {
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
enableDataStreamingFromReceiver(1);
|
||||
break;
|
||||
case CLIENT_STREAMING_PORT:
|
||||
enableDataStreamingToClient(1);
|
||||
break;
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
enableDataStreamingFromReceiver(1);
|
||||
break;
|
||||
case CLIENT_STREAMING_SRC_IP:
|
||||
enableDataStreamingToClient(1);
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
return getNetworkParameter(p);
|
||||
|
||||
@ -5740,7 +5772,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
|
||||
zmqSocket[i] = 0;
|
||||
}
|
||||
}
|
||||
dataSocketsStarted = false;
|
||||
client_datastream = false;
|
||||
cout << "Destroyed Receiving Data Socket(s)" << endl;
|
||||
return OK;
|
||||
}
|
||||
@ -5748,16 +5780,11 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
|
||||
cprintf(MAGENTA,"Going to create data sockets\n");
|
||||
|
||||
for(int i=0;i<numSockets; ++i){
|
||||
uint32_t portnum;
|
||||
sscanf(detectors[i/numSocketsPerDetector]->getReceiverStreamingPort().c_str(),"%d",&portnum);
|
||||
if (portnum == 0) {
|
||||
portnum = DEFAULT_ZMQ_PORTNO +
|
||||
(i/numSocketsPerDetector)*numSocketsPerDetector + (i%numSocketsPerDetector); // *num and /num is not same cuz its integers
|
||||
}else{
|
||||
portnum += (i%numSocketsPerDetector);
|
||||
}
|
||||
uint32_t portnum = 0;
|
||||
sscanf(detectors[i/numSocketsPerDetector]->getClientStreamingPort().c_str(),"%d",&portnum);
|
||||
portnum += (i%numSocketsPerDetector);
|
||||
|
||||
zmqSocket[i] = new ZmqSocket(detectors[i/numSocketsPerDetector]->getReceiver().c_str(), portnum);
|
||||
zmqSocket[i] = new ZmqSocket(detectors[i/numSocketsPerDetector]->getClientStreamingIP().c_str(), portnum);
|
||||
if (zmqSocket[i]->IsError()) {
|
||||
cprintf(RED, "Error: Could not create Zmq socket on port %d\n", portnum);
|
||||
createReceivingDataSockets(true);
|
||||
@ -5766,7 +5793,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
|
||||
printf("Zmq Client[%d] at %s\n",i, zmqSocket[i]->GetZmqServerAddress());
|
||||
}
|
||||
|
||||
dataSocketsStarted = true;
|
||||
client_datastream = true;
|
||||
cout << "Receiving Data Socket(s) created" << endl;
|
||||
return OK;
|
||||
}
|
||||
@ -5876,8 +5903,6 @@ void multiSlsDetector::readFrameFromReceiver(){
|
||||
if (jungfrau)
|
||||
multiframegain = new char[multidatabytes]();
|
||||
|
||||
int nch;
|
||||
|
||||
bool runningList[numSockets];
|
||||
int numRunning = 0;
|
||||
|
||||
@ -6340,71 +6365,63 @@ int multiSlsDetector::setReceiverReadTimer(int time_in_ms){
|
||||
return ret;
|
||||
}
|
||||
|
||||
int multiSlsDetector::getStreamingSocketsCreatedInClient() {
|
||||
return dataSocketsStarted;
|
||||
int multiSlsDetector::enableDataStreamingToClient(int enable) {
|
||||
if(enable >= 0){
|
||||
|
||||
//destroy data threads
|
||||
if (!enable)
|
||||
createReceivingDataSockets(true);
|
||||
|
||||
//create data threads
|
||||
else {
|
||||
if(createReceivingDataSockets() == FAIL){
|
||||
std::cout << "Could not create data threads in client." << std::endl;
|
||||
//only for the first det as theres no general one
|
||||
setErrorMask(getErrorMask()|(1<<0));
|
||||
detectors[0]->setErrorMask((detectors[0]->getErrorMask())|(DATA_STREAMING));
|
||||
}
|
||||
}
|
||||
}
|
||||
return client_datastream;
|
||||
}
|
||||
|
||||
int multiSlsDetector::enableDataStreamingFromReceiver(int enable){//cannot parrallize due to serReceiver calling parentdet->enabledatastremain
|
||||
|
||||
//create client sockets only if no external gui
|
||||
if (!thisMultiDetector->externalgui) {
|
||||
if(enable >= 0){
|
||||
|
||||
//destroy data threads
|
||||
if(dataSocketsStarted)
|
||||
createReceivingDataSockets(true);
|
||||
|
||||
//create data threads
|
||||
if(enable > 0){
|
||||
if(createReceivingDataSockets() == FAIL){
|
||||
std::cout << "Could not create data threads in client. Aborting creating data sockets in receiver" << std::endl;
|
||||
//only for the first det as theres no general one
|
||||
setErrorMask(getErrorMask()|(1<<0));
|
||||
detectors[0]->setErrorMask((detectors[0]->getErrorMask())|(DATA_STREAMING));
|
||||
return -1;
|
||||
int multiSlsDetector::enableDataStreamingFromReceiver(int enable){
|
||||
if(enable >= 0){
|
||||
int ret=-100;
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}else{
|
||||
//return storage values
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(-1);
|
||||
Task* task = new Task(new func1_t<int,int>(&slsDetector::enableDataStreamingFromReceiver,
|
||||
detectors[idet],enable,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
thisMultiDetector->receiver_datastream = ret;
|
||||
}
|
||||
|
||||
|
||||
int ret=-100;
|
||||
if(!threadpool){
|
||||
cout << "Error in creating threadpool. Exiting" << endl;
|
||||
return -1;
|
||||
}else{
|
||||
//return storage values
|
||||
int* iret[thisMultiDetector->numberOfDetectors];
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
||||
if(detectors[idet]){
|
||||
iret[idet]= new int(-1);
|
||||
Task* task = new Task(new func1_t<int,int>(&slsDetector::enableDataStreamingFromReceiver,
|
||||
detectors[idet],enable,iret[idet]));
|
||||
threadpool->add_task(task);
|
||||
}
|
||||
}
|
||||
threadpool->startExecuting();
|
||||
threadpool->wait_for_tasks_to_complete();
|
||||
for(int idet=0; idet<thisMultiDetector->numberOfDetectors; ++idet){
|
||||
if(detectors[idet]){
|
||||
if(iret[idet] != NULL){
|
||||
if (ret==-100)
|
||||
ret=*iret[idet];
|
||||
else if (ret!=*iret[idet])
|
||||
ret=-1;
|
||||
delete iret[idet];
|
||||
}else ret=-1;
|
||||
if(detectors[idet]->getErrorMask())
|
||||
setErrorMask(getErrorMask()|(1<<idet));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!thisMultiDetector->externalgui) {
|
||||
if (ret != dataSocketsStarted)
|
||||
ret = -1;
|
||||
}
|
||||
return ret;
|
||||
return thisMultiDetector->receiver_datastream;
|
||||
}
|
||||
|
||||
int multiSlsDetector::enableReceiverCompression(int i){
|
||||
|
@ -219,6 +219,9 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
/** receiver online flag - is set if the receiver is connected, unset if socket connection is not possible */
|
||||
int receiverOnlineFlag;
|
||||
|
||||
/** data streaming (up stream) enable in receiver */
|
||||
bool receiver_datastream;
|
||||
|
||||
} sharedMultiSlsDetector;
|
||||
|
||||
|
||||
@ -1367,17 +1370,19 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
|
||||
|
||||
/**
|
||||
* Get Streaming sockets created in client from reciever
|
||||
/returns 1 if sockets created, else 0
|
||||
* Enable data streaming to client
|
||||
* @param enable 0 to disable, 1 to enable, -1 to get the value
|
||||
* @returns data streaming to client enable
|
||||
*/
|
||||
int getStreamingSocketsCreatedInClient();
|
||||
int enableDataStreamingToClient(int enable=-1);
|
||||
|
||||
/** Enable or disable streaming data from receiver to client
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming from receiver enable
|
||||
*/
|
||||
int enableDataStreamingFromReceiver(int enable=-1);
|
||||
|
||||
|
||||
/** updates the multidetector offsets */
|
||||
void updateOffsets();
|
||||
|
||||
@ -1523,8 +1528,8 @@ private:
|
||||
|
||||
|
||||
|
||||
/** Ensures if sockets created successfully */
|
||||
bool dataSocketsStarted;
|
||||
/** data streaming (down stream) enabled in client (zmq sckets created) */
|
||||
bool client_datastream;
|
||||
|
||||
/** ZMQ Socket - Receiver to Client */
|
||||
ZmqSocket* zmqSocket[MAXDET];
|
||||
|
@ -559,8 +559,10 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
/** set detector ip address */
|
||||
memset(thisDetector->detectorIP,0,MAX_STR_LENGTH);
|
||||
strcpy(thisDetector->detectorIP,DEFAULT_DET_IP);
|
||||
/** set zmq tcp src ip address */
|
||||
memset(thisDetector->zmqsrcip,0,MAX_STR_LENGTH);
|
||||
/** set zmq tcp src ip address in client */
|
||||
memset(thisDetector->zmqip,0,MAX_STR_LENGTH);
|
||||
/** set zmq tcp src ip address in receiver*/
|
||||
memset(thisDetector->receiver_zmqip,0,MAX_STR_LENGTH);
|
||||
|
||||
|
||||
/** sets onlineFlag to OFFLINE_FLAG */
|
||||
@ -712,17 +714,23 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
thisDetector->timerValue[CYCLES_NUMBER]=1;
|
||||
thisDetector->timerValue[SAMPLES_JCTB]=1;
|
||||
|
||||
// calculating databytes (special when with gap pixels, jctb, mythen in 24bit mode or using probes)
|
||||
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*thisDetector->dynamicRange/8;
|
||||
thisDetector->dataBytesInclGapPixels = getTotalNumberOfChannelsInclGapPixels(X)*getTotalNumberOfChannelsInclGapPixels(Y) * thisDetector->dynamicRange/8;
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nMod[X] * thisDetector->nChip[X] * thisDetector->nChan[X] + thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nMod[Y] * thisDetector->nChip[Y] * thisDetector->nChan[Y] + thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
thisDetector->dynamicRange/8;
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
getTotalNumberOfChannels();
|
||||
// thisDetector->dataBytes=getTotalNumberOfChannels()*thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB){
|
||||
getTotalNumberOfChannels();
|
||||
}
|
||||
if(thisDetector->myDetectorType==MYTHEN){
|
||||
else if(thisDetector->myDetectorType==MYTHEN){
|
||||
if (thisDetector->dynamicRange==24 || thisDetector->timerValue[PROBES_NUMBER]>0) {
|
||||
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
|
||||
thisDetector->dataBytesInclGapPixels = getTotalNumberOfChannelsInclGapPixels(X)*getTotalNumberOfChannelsInclGapPixels(Y) * thisDetector->nChans*4;
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nMod[X] * thisDetector->nChip[X] * thisDetector->nChan[X] + thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nMod[Y] * thisDetector->nChip[Y] * thisDetector->nChan[Y] + thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -788,6 +796,8 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
thisDetector->flippedData[0] = 0;
|
||||
thisDetector->flippedData[1] = 0;
|
||||
thisDetector->zmqport = 0;
|
||||
thisDetector->receiver_zmqport = 0;
|
||||
thisDetector->receiver_datastream = false;
|
||||
|
||||
for (int ia=0; ia<MAX_ACTIONS; ++ia) {
|
||||
strcpy(thisDetector->actionScript[ia],"none");
|
||||
@ -820,16 +830,8 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
thisDetector->gainoff=thisDetector->chanoff+sizeof(int)*thisDetector->nGain*thisDetector->nModsMax;
|
||||
thisDetector->offsetoff=thisDetector->gainoff+sizeof(int)*thisDetector->nOffset*thisDetector->nModsMax;
|
||||
|
||||
//update?!?!?!?
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
// cout << "here2" << endl;
|
||||
getTotalNumberOfChannels();
|
||||
//thisDetector->nChan[X]=32;
|
||||
//thisDetector->nChans=thisDetector->nChan[X]*thisDetector->nChan[Y];
|
||||
|
||||
//thisDetector->dataBytes=getTotalNumberOfChannels()*thisDetector->dynamicRange/8*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -932,6 +934,14 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
||||
delete thisReceiver;
|
||||
thisReceiver = new receiverInterface(dataSocket);
|
||||
|
||||
// zmq ports
|
||||
if (posId != -1) {
|
||||
if (thisDetector->zmqport == 0)
|
||||
thisDetector->zmqport = DEFAULT_ZMQ_CL_PORTNO + (posId * ((thisDetector->myDetectorType == EIGER) ? 2 : 1));
|
||||
if (thisDetector->receiver_zmqport == 0)
|
||||
thisDetector->receiver_zmqport = DEFAULT_ZMQ_RX_PORTNO + (posId * ((thisDetector->myDetectorType == EIGER) ? 2 : 1));
|
||||
}
|
||||
|
||||
// setAngularConversionPointer(thisDetector->angOff,&thisDetector->nMods, thisDetector->nChans*thisDetector->nChips);
|
||||
|
||||
#ifdef VERBOSE
|
||||
@ -1746,11 +1756,7 @@ int slsDetector::getTotalNumberOfChannels() {
|
||||
}
|
||||
thisDetector->nChans=thisDetector->nChan[X];
|
||||
thisDetector->dataBytes=thisDetector->nChans*thisDetector->nChips*thisDetector->nMods*2*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
// cout << "Total number of channels is "<< thisDetector->nChans*thisDetector->nChips*thisDetector->nMods << " data bytes is " << thisDetector->dataBytes << endl;
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nChan[X]*thisDetector->nChip[X]*thisDetector->nMod[X]) + (thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nChan[Y]*thisDetector->nChip[Y]*thisDetector->nMod[Y]) + (thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
2*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
thisDetector->dataBytesInclGapPixels = thisDetector->dataBytes;
|
||||
} else {
|
||||
#ifdef VERBOSE
|
||||
cout << "det type is "<< thisDetector->myDetectorType << endl;
|
||||
@ -1768,7 +1774,7 @@ int slsDetector::getTotalNumberOfChannels(dimension d) {
|
||||
|
||||
int slsDetector::getTotalNumberOfChannelsInclGapPixels(dimension d) {
|
||||
getTotalNumberOfChannels();
|
||||
return (thisDetector->nChan[d]*thisDetector->nChip[d]*thisDetector->nMod[d]) + (thisDetector->gappixels * thisDetector->nGappixels[d]);
|
||||
return (thisDetector->nChan[d] * thisDetector->nChip[d] + thisDetector->gappixels * thisDetector->nGappixels[d]) * thisDetector->nMod[d];
|
||||
}
|
||||
|
||||
|
||||
@ -1790,7 +1796,7 @@ int slsDetector::getMaxNumberOfChannelsInclGapPixels(dimension d) {
|
||||
if (d==X) return 36*thisDetector->nChip[d]*thisDetector->nModMax[d];
|
||||
else return 1*thisDetector->nChip[d]*thisDetector->nModMax[d];
|
||||
}
|
||||
return (thisDetector->nChan[d]*thisDetector->nChip[d]*thisDetector->nModMax[d]) + (thisDetector->gappixels * thisDetector->nGappixels[d]);
|
||||
return (thisDetector->nChan[d] * thisDetector->nChip[d] + thisDetector->gappixels * thisDetector->nGappixels[d]) * thisDetector->nModMax[d];
|
||||
}
|
||||
|
||||
/* needed to set/get the size of the detector */
|
||||
@ -1873,19 +1879,23 @@ int slsDetector::setNumberOfModules(int n, dimension d){
|
||||
dr=32;
|
||||
|
||||
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*dr/8;
|
||||
thisDetector->dataBytesInclGapPixels = getTotalNumberOfChannelsInclGapPixels(X)*getTotalNumberOfChannelsInclGapPixels(Y) *dr/8;
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nMod[X] * thisDetector->nChip[X] * thisDetector->nChan[X] + thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nMod[Y] * thisDetector->nChip[Y] * thisDetector->nChan[Y] + thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
thisDetector->dynamicRange/8;
|
||||
|
||||
if(thisDetector->myDetectorType==MYTHEN){
|
||||
if (thisDetector->timerValue[PROBES_NUMBER]!=0) {
|
||||
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
|
||||
thisDetector->dataBytesInclGapPixels = getTotalNumberOfChannelsInclGapPixels(X)*getTotalNumberOfChannelsInclGapPixels(Y) *4;
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nMod[X] * thisDetector->nChip[X] * thisDetector->nChan[X] + thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nMod[Y] * thisDetector->nChip[Y] * thisDetector->nChan[Y] + thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
4;
|
||||
}
|
||||
}
|
||||
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB){
|
||||
getTotalNumberOfChannels();
|
||||
//thisDetector->dataBytes=getTotalNumberOfChannels()*thisDetector->nChans*dr/8*thisDetector->nChips*thisDetector->timerValue[SAMPLES_JCTB];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -2042,13 +2052,19 @@ int slsDetector::enableGapPixels(int val) {
|
||||
thisDetector->dataBytesInclGapPixels = 0;
|
||||
|
||||
if (thisDetector->dynamicRange != 4) {
|
||||
thisDetector->dataBytesInclGapPixels = getTotalNumberOfChannelsInclGapPixels(X)*getTotalNumberOfChannelsInclGapPixels(Y) * (thisDetector->dynamicRange/8);
|
||||
// set data bytes for other detector ( for future use)
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nMod[X] * thisDetector->nChip[X] * thisDetector->nChan[X] + thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nMod[Y] * thisDetector->nChip[Y] * thisDetector->nChan[Y] + thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
thisDetector->dynamicRange/8;
|
||||
// set data bytes for other detector ( for future use)
|
||||
if(thisDetector->myDetectorType==JUNGFRAUCTB)
|
||||
getTotalNumberOfChannels();
|
||||
if(thisDetector->myDetectorType==MYTHEN){
|
||||
else if(thisDetector->myDetectorType==MYTHEN){
|
||||
if (thisDetector->dynamicRange==24 || thisDetector->timerValue[PROBES_NUMBER]>0) {
|
||||
thisDetector->dataBytesInclGapPixels = getTotalNumberOfChannelsInclGapPixels(X)*getTotalNumberOfChannelsInclGapPixels(Y) * thisDetector->nChans*4;
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nMod[X] * thisDetector->nChip[X] * thisDetector->nChan[X] + thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nMod[Y] * thisDetector->nChip[Y] * thisDetector->nChan[Y] + thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5136,7 +5152,10 @@ int slsDetector::setDynamicRange(int n){
|
||||
|
||||
|
||||
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*retval/8;
|
||||
thisDetector->dataBytesInclGapPixels = getTotalNumberOfChannelsInclGapPixels(X)*getTotalNumberOfChannelsInclGapPixels(Y)*retval/8;
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nMod[X] * thisDetector->nChip[X] * thisDetector->nChan[X] + thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nMod[Y] * thisDetector->nChip[Y] * thisDetector->nChan[Y] + thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
thisDetector->dynamicRange/8;
|
||||
|
||||
if (thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||
// thisDetector->nChip[X]=retval/16;
|
||||
@ -5149,7 +5168,10 @@ int slsDetector::setDynamicRange(int n){
|
||||
if(thisDetector->myDetectorType==MYTHEN){
|
||||
if (thisDetector->timerValue[PROBES_NUMBER]!=0) {
|
||||
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
|
||||
thisDetector->dataBytesInclGapPixels = getTotalNumberOfChannelsInclGapPixels(X)*getTotalNumberOfChannelsInclGapPixels(Y)*4;
|
||||
thisDetector->dataBytesInclGapPixels =
|
||||
(thisDetector->nMod[X] * thisDetector->nChip[X] * thisDetector->nChan[X] + thisDetector->gappixels * thisDetector->nGappixels[X]) *
|
||||
(thisDetector->nMod[Y] * thisDetector->nChip[Y] * thisDetector->nChan[Y] + thisDetector->gappixels * thisDetector->nGappixels[Y]) *
|
||||
4;
|
||||
}
|
||||
|
||||
if (retval==32)
|
||||
@ -6017,11 +6039,14 @@ string slsDetector::setNetworkParameter(networkParameter index, string value) {
|
||||
case FLOW_CONTROL_10G:
|
||||
sscanf(value.c_str(),"%d",&i);
|
||||
return setDetectorNetworkParameter(index, i);
|
||||
case CLIENT_STREAMING_PORT:
|
||||
return setClientStreamingPort(value);
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
setReceiverStreamingPort(value);
|
||||
return getReceiverStreamingPort();
|
||||
return setReceiverStreamingPort(value);
|
||||
case CLIENT_STREAMING_SRC_IP:
|
||||
return setClientStreamingIP(value);
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
return setReceiverStreamingSourceIP(value);
|
||||
return setReceiverStreamingIP(value);
|
||||
default:
|
||||
return (char*)("unknown network parameter");
|
||||
}
|
||||
@ -6052,10 +6077,14 @@ string slsDetector::getNetworkParameter(networkParameter index) {
|
||||
case DETECTOR_TXN_DELAY_FRAME:
|
||||
case FLOW_CONTROL_10G:
|
||||
return setDetectorNetworkParameter(index, -1);
|
||||
case CLIENT_STREAMING_PORT:
|
||||
return getClientStreamingPort();
|
||||
case RECEIVER_STREAMING_PORT:
|
||||
return getReceiverStreamingPort();
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
return getReceiverStreamingSourceIP();
|
||||
case CLIENT_STREAMING_SRC_IP:
|
||||
return getClientStreamingIP();
|
||||
case RECEIVER_STREAMING_SRC_IP:
|
||||
return getReceiverStreamingIP();
|
||||
default:
|
||||
return (char*)("unknown network parameter");
|
||||
}
|
||||
@ -6155,9 +6184,10 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
std::cout << "dynamic range:" << thisDetector->dynamicRange << endl << endl;
|
||||
std::cout << "flippeddatax:" << thisDetector->flippedData[d] << endl;
|
||||
std::cout << "10GbE:" << thisDetector->tenGigaEnable << endl << endl;
|
||||
std::cout << "streaming port:" << thisDetector->zmqport << endl;
|
||||
std::cout << "streaming source ip:" << thisDetector->zmqsrcip << endl;
|
||||
std::cout << "rx streaming source ip:" << thisDetector->receiver_zmqip << endl;
|
||||
std::cout << "enable gap pixels:" << thisDetector->gappixels << endl;
|
||||
std::cout << "rx streaming port:" << thisDetector->receiver_zmqport << endl;
|
||||
|
||||
//std::cout << "dataStreaming:" << enableDataStreamingFromReceiver(-1) << endl << endl;
|
||||
/** enable compresison, */
|
||||
#endif
|
||||
@ -6200,20 +6230,8 @@ string slsDetector::setReceiver(string receiverIP){
|
||||
|
||||
// data streaming
|
||||
setReceiverStreamingPort(getReceiverStreamingPort());
|
||||
setReceiverStreamingSourceIP(getReceiverStreamingSourceIP());
|
||||
int clientSockets = parentDet->getStreamingSocketsCreatedInClient();
|
||||
int recSockets = enableDataStreamingFromReceiver(-1);
|
||||
if(clientSockets != recSockets) {
|
||||
pthread_mutex_lock(&ms);
|
||||
if(clientSockets)
|
||||
printf("Enabling Data Streaming\n");
|
||||
else
|
||||
printf("Disabling Data Streaming\n");
|
||||
// push client state to receiver
|
||||
/*parentDet->enableDataStreamingFromReceiver(clientSockets);*/
|
||||
enableDataStreamingFromReceiver(clientSockets);
|
||||
pthread_mutex_unlock(&ms);
|
||||
}
|
||||
setReceiverStreamingIP(getReceiverStreamingIP());
|
||||
enableDataStreamingFromReceiver(enableDataStreamingFromReceiver(-1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -6312,7 +6330,29 @@ int slsDetector::setReceiverUDPPort2(int udpport){
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::setReceiverStreamingPort(string port) {
|
||||
string slsDetector::setClientStreamingPort(string port) {
|
||||
int defaultport = 0;
|
||||
int numsockets = (thisDetector->myDetectorType == EIGER) ? 2:1;
|
||||
int arg = 0;
|
||||
|
||||
//multi command, calculate individual ports
|
||||
size_t found = port.find("multi");
|
||||
if(found != string::npos) {
|
||||
port.erase(found,5);
|
||||
sscanf(port.c_str(),"%d",&defaultport);
|
||||
arg = defaultport + (posId * numsockets);
|
||||
}
|
||||
else
|
||||
sscanf(port.c_str(),"%d",&arg);
|
||||
thisDetector->zmqport = arg;
|
||||
|
||||
return getClientStreamingPort();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string slsDetector::setReceiverStreamingPort(string port) {
|
||||
int defaultport = 0;
|
||||
int numsockets = (thisDetector->myDetectorType == EIGER) ? 2:1;
|
||||
int arg = 0;
|
||||
@ -6340,24 +6380,69 @@ int slsDetector::setReceiverStreamingPort(string port) {
|
||||
disconnectData();
|
||||
}
|
||||
if(ret!=FAIL)
|
||||
thisDetector->zmqport = retval;
|
||||
thisDetector->receiver_zmqport = retval;
|
||||
if(ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
}
|
||||
|
||||
return thisDetector->zmqport;
|
||||
return getReceiverStreamingPort();
|
||||
}
|
||||
|
||||
string slsDetector::setReceiverStreamingSourceIP(string sourceIP) {
|
||||
string slsDetector::setClientStreamingIP(string sourceIP) {
|
||||
|
||||
struct addrinfo *result;
|
||||
// on failure to convert to a valid ip
|
||||
if (dataSocket->ConvertHostnameToInternetAddress(sourceIP.c_str(), &result)) {
|
||||
std::cout << "Warning: Could not convert zmqip into a valid IP" << sourceIP << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
||||
return getClientStreamingIP();
|
||||
}
|
||||
// on success put IP as string into arg
|
||||
else {
|
||||
memset(thisDetector->zmqip, 0, MAX_STR_LENGTH);
|
||||
dataSocket->ConvertInternetAddresstoIpString(result, thisDetector->zmqip, MAX_STR_LENGTH);
|
||||
}
|
||||
|
||||
return getClientStreamingIP();
|
||||
}
|
||||
|
||||
|
||||
string slsDetector::setReceiverStreamingIP(string sourceIP) {
|
||||
|
||||
int fnum=F_RECEIVER_STREAMING_SRC_IP;
|
||||
int ret = FAIL;
|
||||
char arg[MAX_STR_LENGTH];
|
||||
memset(arg,0, sizeof(arg));
|
||||
strcpy(arg,sourceIP.c_str());
|
||||
memset(arg,0,sizeof(arg));
|
||||
char retval[MAX_STR_LENGTH];
|
||||
memset(retval,0, sizeof(retval));
|
||||
|
||||
// if empty, give rx_hostname
|
||||
if (sourceIP.empty()) {
|
||||
if(!strcmp(thisDetector->receiver_hostname,"none")) {
|
||||
std::cout << "Receiver hostname not set yet. Cannot create rx_zmqip from none\n" << endl;
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
||||
return getReceiverStreamingIP();
|
||||
}
|
||||
sourceIP.assign(thisDetector->receiver_hostname);
|
||||
}
|
||||
|
||||
// verify the ip
|
||||
{
|
||||
struct addrinfo *result;
|
||||
// on failure to convert to a valid ip
|
||||
if (dataSocket->ConvertHostnameToInternetAddress(sourceIP.c_str(), &result)) {
|
||||
std::cout << "Warning: Could not convert rx_zmqip into a valid IP" << sourceIP << std::endl;
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER));
|
||||
return getReceiverStreamingIP();
|
||||
}
|
||||
// on success put IP as string into arg
|
||||
else {
|
||||
memset(thisDetector->zmqip, 0, MAX_STR_LENGTH);
|
||||
dataSocket->ConvertInternetAddresstoIpString(result, arg, MAX_STR_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Sending receiver streaming source ip to receiver " << arg << std::endl;
|
||||
@ -6367,16 +6452,21 @@ string slsDetector::setReceiverStreamingSourceIP(string sourceIP) {
|
||||
disconnectData();
|
||||
}
|
||||
if(ret!=FAIL) {
|
||||
memset(thisDetector->zmqsrcip, 0, MAX_STR_LENGTH);
|
||||
strcpy(thisDetector->zmqsrcip, retval);
|
||||
memset(thisDetector->receiver_zmqip, 0, MAX_STR_LENGTH);
|
||||
strcpy(thisDetector->receiver_zmqip, retval);
|
||||
// if zmqip is empty, update it
|
||||
if (! strlen(thisDetector->zmqip))
|
||||
strcpy(thisDetector->zmqip, retval);
|
||||
}
|
||||
if(ret==FORCE_UPDATE)
|
||||
updateReceiver();
|
||||
}
|
||||
|
||||
return getReceiverStreamingSourceIP();
|
||||
return getReceiverStreamingIP();
|
||||
}
|
||||
|
||||
|
||||
|
||||
string slsDetector::setDetectorNetworkParameter(networkParameter index, int delay){
|
||||
int fnum = F_SET_NETWORK_PARAMETER;
|
||||
int ret = FAIL;
|
||||
@ -8400,13 +8490,17 @@ int slsDetector::updateReceiverNoWait() {
|
||||
parentDet->enableOverwriteMask(ind);
|
||||
pthread_mutex_unlock(&ms);
|
||||
|
||||
// streaming port
|
||||
// receiver streaming port
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->zmqport = ind;
|
||||
thisDetector->receiver_zmqport = ind;
|
||||
|
||||
// receiver streaming enable
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
thisDetector->receiver_datastream = ind;
|
||||
|
||||
// streaming source ip
|
||||
n += dataSocket->ReceiveDataOnly(path,MAX_STR_LENGTH);
|
||||
strcpy(thisDetector->zmqsrcip, path);
|
||||
strcpy(thisDetector->receiver_zmqip, path);
|
||||
|
||||
// gap pixels
|
||||
n += dataSocket->ReceiveDataOnly(&ind,sizeof(ind));
|
||||
|
@ -269,11 +269,16 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
bool acquiringFlag;
|
||||
/** flipped data across x or y axis */
|
||||
int flippedData[2];
|
||||
/** tcp port between receiver and gui (only data) */
|
||||
/** tcp port from gui/different process to receiver (only data) */
|
||||
int zmqport;
|
||||
/** zmq tcp src ip address between receiver and gui (only data) **/
|
||||
char zmqsrcip[MAX_STR_LENGTH];
|
||||
|
||||
/** tcp port from receiver to gui/different process (only data) */
|
||||
int receiver_zmqport;
|
||||
/** data streaming (up stream) enable in receiver */
|
||||
bool receiver_datastream;
|
||||
/** zmq tcp src ip address in client (only data) **/
|
||||
char zmqip[MAX_STR_LENGTH];
|
||||
/** zmq tcp src ip address in receiver (only data) **/
|
||||
char receiver_zmqip[MAX_STR_LENGTH];
|
||||
/** gap pixels enable */
|
||||
int gappixels;
|
||||
/** gap pixels in each direction */
|
||||
@ -1670,7 +1675,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
/** gets the number of frames caught by any one receiver (to avoid using threadpool)
|
||||
\returns number of frames caught by any one receiver (master receiver if exists)
|
||||
*/
|
||||
int getFramesCaughtByAnyReceiver() {getFramesCaughtByReceiver();};
|
||||
int getFramesCaughtByAnyReceiver() {return getFramesCaughtByReceiver();};
|
||||
|
||||
/** gets the current frame index of receiver
|
||||
\returns current frame index of receiver
|
||||
@ -1757,10 +1762,14 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
string getReceiverUDPPort() {ostringstream ss; ss << thisDetector->receiverUDPPort; string s = ss.str(); return s;};
|
||||
/** returns the receiver UDP2 for Eiger IP address \sa sharedSlsDetector */
|
||||
string getReceiverUDPPort2() {ostringstream ss; ss << thisDetector->receiverUDPPort2; string s = ss.str(); return s;};
|
||||
/** returns the zmq port \sa sharedSlsDetector */
|
||||
string getReceiverStreamingPort() {ostringstream ss; ss << thisDetector->zmqport; string s = ss.str(); return s;};
|
||||
/** gets the zmq source ip in client and receiver, returns "none" if default setting and no custom ip set*/
|
||||
string getReceiverStreamingSourceIP(){return string(thisDetector->zmqsrcip);};
|
||||
/** returns the client zmq port \sa sharedSlsDetector */
|
||||
string getClientStreamingPort() {ostringstream ss; ss << thisDetector->zmqport; string s = ss.str(); return s;};
|
||||
/** returns the receiver zmq port \sa sharedSlsDetector */
|
||||
string getReceiverStreamingPort() {ostringstream ss; ss << thisDetector->receiver_zmqport; string s = ss.str(); return s;};
|
||||
/** gets the zmq source ip in client, returns "none" if default setting and no custom ip set*/
|
||||
string getClientStreamingIP(){return string(thisDetector->zmqip);};
|
||||
/** gets the zmq source ip in receiver, returns "none" if default setting and no custom ip set*/
|
||||
string getReceiverStreamingIP(){return string(thisDetector->receiver_zmqip);};
|
||||
|
||||
/** validates the format of detector MAC address and sets it \sa sharedSlsDetector */
|
||||
string setDetectorMAC(string detectorMAC);
|
||||
@ -1776,10 +1785,15 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
int setReceiverUDPPort(int udpport);
|
||||
/** sets the receiver udp port2 for Eiger \sa sharedSlsDetector */
|
||||
int setReceiverUDPPort2(int udpport);
|
||||
/** sets the zmq port in client and receiver (includes "multi" at the end if it should calculate individual ports \sa sharedSlsDetector */
|
||||
int setReceiverStreamingPort(string port);
|
||||
/** sets the zmq source ip in client and receiver */
|
||||
string setReceiverStreamingSourceIP(string sourceIP);
|
||||
/** sets the zmq port in client (includes "multi" at the end if it should calculate individual ports \sa sharedSlsDetector */
|
||||
string setClientStreamingPort(string port);
|
||||
/** sets the zmq port in receiver (includes "multi" at the end if it should calculate individual ports \sa sharedSlsDetector */
|
||||
string setReceiverStreamingPort(string port);
|
||||
/** sets the zmq source ip in client */
|
||||
string setClientStreamingIP(string sourceIP);
|
||||
/** sets the zmq source ip in receiver. if empty, uses rx_hostname*/
|
||||
string setReceiverStreamingIP(string sourceIP);
|
||||
|
||||
/** sets the transmission delay for left or right port or for an entire frame*/
|
||||
string setDetectorNetworkParameter(networkParameter index, int delay);
|
||||
|
||||
@ -1802,8 +1816,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
int setReceiverReadTimer(int time_in_ms=500);
|
||||
|
||||
/** Enable or disable streaming data from receiver to client
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming from receiver enable
|
||||
*/
|
||||
int enableDataStreamingFromReceiver(int enable=-1);
|
||||
|
||||
|
@ -425,7 +425,6 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
||||
*/
|
||||
int setHighVoltage(int val){return setDAC(val, HV_NEW, 0, -1);} \
|
||||
|
||||
|
||||
/**
|
||||
set dacs value
|
||||
\param val value
|
||||
|
@ -255,13 +255,6 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
commands to configure detector data structure
|
||||
*/
|
||||
|
||||
/*! \page config
|
||||
- <b> externalgui </b>sets/gets external gui flag. 1 sets and enables the 0MQ data stream (0MQ threads created) from receiver to client, while 0 unsets and disables. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="externalgui"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDataStream;
|
||||
++i;
|
||||
|
||||
/*! \page config
|
||||
- \b free Free shared memory on the control PC
|
||||
*/
|
||||
@ -1902,19 +1895,39 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>zmqport [port]</b> sets/gets the 0MQ (TCP) port of the receiver from where data is streamed to the client. Use single-detector command to set individually or multi-detector command to calculate based on \c port for the rest. \c Returns \c (int)
|
||||
- <b>zmqport [port]</b> sets/gets the 0MQ (TCP) port of the client to where final data is streamed to (eg. for GUI). The default already connects with rx_zmqport for the GUI. This command to change from default can be used from command line when sockets are not already open as the command line is not aware/create the 0mq sockets in the client side. Use single-detector command to set individually or multi-detector command to calculate based on \c port for the rest. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="zmqport"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>zmqsrcip [ip]</b> sets/gets the 0MQ (TCP) ip of the receiver from where data is streamed to the client. Default is ip of rx_hostname. Use this only with external gui. \c Returns \c (string)
|
||||
- <b>rx_zmqport [port]</b> sets/gets the 0MQ (TCP) port of the receiver from where data is streamed from (eg. to GUI or another process for further processing). Use single-detector command to set individually or multi-detector command to calculate based on \c port for the rest. \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="zmqsrcip"; //
|
||||
descrToFuncMap[i].m_pFuncName="rx_zmqport"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b> rx_datastream </b>enables/disables data streaming from receiver. 1 enables 0MQ data stream from receiver (creates streamer threads), while 0 disables (destroys streamer threads). Switching to Gui enables data streaming in receiver and switching back to command line acquire will require disabling data streaming in receiver for fast applications \c Returns \c (int)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="rx_datastream"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDataStream;
|
||||
++i;
|
||||
|
||||
/*! \page network
|
||||
- <b>zmqip [ip]</b> sets/gets the 0MQ (TCP) ip of the client to where final data is streamed to (eg. for GUI). For Experts only! Default is ip of rx_hostname and works for GUI. This command to change from default can be used from command line when sockets are not already open as the command line is not aware/create the 0mq sockets in the client side. This is usually used to stream in from an external process. . If no custom ip, empty until first time connect to receiver. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="zmqip"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||
i++;
|
||||
|
||||
/*! \page network
|
||||
- <b>rx_zmqip [ip]</b> sets/gets the 0MQ (TCP) ip of the receiver from where data is streamed from (eg. to GUI or another process for further processing). For Experts only! Default is ip of rx_hostname and works for GUI. This is usually used to stream out to an external process for further processing. . If no custom ip, empty until first time connect to receiver. \c Returns \c (string)
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName="rx_zmqip"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdNetworkParameter;
|
||||
i++;
|
||||
|
||||
/*! \page network
|
||||
- <b>configuremac [i]</b> configures the MAC of the detector with these parameters: detectorip, detectormac, rx_udpip, rx_udpmac, rx_udpport, rx_udpport2 (if applicable). This command is already included in \c rx_hsotname. Only put!. \c Returns \c (int)
|
||||
@ -2318,19 +2331,13 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
||||
#endif
|
||||
|
||||
|
||||
if (action==HELP_ACTION) {
|
||||
return helpAcquire(narg,args,HELP_ACTION);
|
||||
}
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
int r_online = myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if ((!myDet->getExternalGuiFlag()) && (r_online == ONLINE_FLAG)) {
|
||||
// command line: must be off, if receiver on or there was -1, then
|
||||
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
|
||||
//switch it off, if error
|
||||
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
|
||||
return string("could not disable data streaming in receiver\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(myDet->acquire() == FAIL)
|
||||
return string("acquire unsuccessful");
|
||||
if(r_online){
|
||||
@ -2495,18 +2502,11 @@ string slsDetectorCommand::cmdDataStream(int narg, char *args[], int action) {
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string ("cannot scan externalgui mode");
|
||||
myDet->setExternalGuiFlag(ival>0?true:false);
|
||||
return string ("cannot scan rx_datastream mode");
|
||||
myDet->enableDataStreamingFromReceiver(ival);
|
||||
}
|
||||
|
||||
int retval = myDet->getExternalGuiFlag();
|
||||
//if external gui on and datastreaming off
|
||||
if (retval && !myDet->enableDataStreamingFromReceiver()) {
|
||||
retval=-1;
|
||||
printf("Error: data streaming in receiver is switched off while external gui flag in shared memory is off.\n");
|
||||
}
|
||||
sprintf(ans,"%d",myDet->getExternalGuiFlag());
|
||||
sprintf(ans,"%d",myDet->enableDataStreamingFromReceiver());
|
||||
return string(ans);
|
||||
}
|
||||
|
||||
@ -2515,9 +2515,9 @@ string slsDetectorCommand::helpDataStream(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==GET_ACTION || action==HELP_ACTION)
|
||||
os << string("externalgui \t gets external gui flag. 1/0 means the 0MQ data stream (0MQ threads created) from receiver to client is enabled/disabled. -1 for inconsistency. \n");
|
||||
os << string("rx_datastream \t enables/disables data streaming from receiver. 1 is 0MQ data stream from receiver enabled, while 0 is 0MQ disabled. -1 for inconsistency between multiple receivers. \n");
|
||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||
os << string("externalgui i\t sets external gui flag. 1/0 means the 0MQ data stream (0MQ threads created) from receiver to client is enabled/disabled. \n");
|
||||
os << string("rx_datastream i\t enables/disables data streaming from receiver. i is 1 enables 0MQ data stream from receiver (creates streamer threads), while 0 disables (destroys streamer threads). \n");
|
||||
return os.str();
|
||||
}
|
||||
|
||||
@ -3958,13 +3958,21 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
||||
return ("cannot parse argument") + string(args[1]);
|
||||
}
|
||||
}else if (cmd=="zmqport") {
|
||||
t=CLIENT_STREAMING_PORT;
|
||||
if (action==PUT_ACTION){
|
||||
if (!(sscanf(args[1],"%d",&i)))
|
||||
return ("cannot parse argument") + string(args[1]);
|
||||
}
|
||||
}else if (cmd=="rx_zmqport") {
|
||||
t=RECEIVER_STREAMING_PORT;
|
||||
if (action==PUT_ACTION){
|
||||
if (!(sscanf(args[1],"%d",&i)))
|
||||
return ("cannot parse argument") + string(args[1]);
|
||||
}
|
||||
}else if (cmd=="zmqsrcip") {
|
||||
t=RECEIVER_STREAMING_SRC_IP;
|
||||
}else if (cmd=="zmqip") {
|
||||
t=CLIENT_STREAMING_SRC_IP;
|
||||
}else if (cmd=="rx_zmqip") {
|
||||
t=RECEIVER_STREAMING_SRC_IP;
|
||||
}
|
||||
else return ("unknown network parameter")+cmd;
|
||||
|
||||
@ -3991,8 +3999,16 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti
|
||||
os << "txndelay_right port \n sets detector transmission delay of the right port"<< std::endl;
|
||||
os << "txndelay_frame port \n sets detector transmission delay of the entire frame"<< std::endl;
|
||||
os << "flowcontrol_10g port \n sets flow control for 10g for eiger"<< std::endl;
|
||||
os << "zmqport port \n sets zmq port (data from receiver to client); setting via multidetector command calculates port for individual detectors"<< std::endl;
|
||||
os << "zmqsrcip ip \n sets/gets the 0MQ (TCP) ip of the receiver from where data is streamed to the client. Default is ip of rx_hostname. Use this only with external gui." << std::endl;
|
||||
os << "zmqport port \n sets the 0MQ (TCP) port of the client to where final data is streamed to (eg. for GUI). The default already connects with rx_zmqport for the GUI. "
|
||||
"This command to change from default can be used from command line when sockets are not already open as the command line is not aware/create the 0mq sockets in the client side. "
|
||||
"Use single-detector command to set individually or multi-detector command to calculate based on port for the rest."<< std::endl;
|
||||
os << "rx_zmqport port \n sets the 0MQ (TCP) port of the receiver from where data is streamed from (eg. to GUI or another process for further processing). "
|
||||
"Use single-detector command to set individually or multi-detector command to calculate based on port for the rest."<< std::endl;
|
||||
os << "zmqip ip \n sets the 0MQ (TCP) ip of the client to where final data is streamed to (eg. for GUI). Default is ip of rx_hostname and works for GUI. "
|
||||
"This command to change from default can be used from command line when sockets are not already open as the command line is not aware/create the 0mq sockets in the client side. "
|
||||
"This is usually used to stream in from an external process." << std::endl;
|
||||
os << "rx_zmqip ip \n sets/gets the 0MQ (TCP) ip of the receiver from where data is streamed from (eg. to GUI or another process for further processing). "
|
||||
"Default is ip of rx_hostname and works for GUI. This is usually used to stream out to an external process for further processing." << std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "detectormac \n gets detector mac "<< std::endl;
|
||||
@ -4005,8 +4021,10 @@ string slsDetectorCommand::helpNetworkParameter(int narg, char *args[], int acti
|
||||
os << "txndelay_right \n gets detector transmission delay of the right port"<< std::endl;
|
||||
os << "txndelay_frame \n gets detector transmission delay of the entire frame"<< std::endl;
|
||||
os << "flowcontrol_10g \n gets flow control for 10g for eiger"<< std::endl;
|
||||
os << "zmqport \n gets zmq port (data from receiver to client)"<< std::endl;
|
||||
os << "zmqsrcip \n gets zmq source ip (data from receiver to client), none if default setting and no custom ip" << std::endl;
|
||||
os << "zmqport \n gets the 0MQ (TCP) port of the client to where final data is streamed to"<< std::endl;
|
||||
os << "rx_zmqport \n gets the 0MQ (TCP) port of the receiver from where data is streamed from"<< std::endl;
|
||||
os << "zmqip \n gets the 0MQ (TCP) ip of the client to where final data is streamed to.If no custom ip, empty until first time connect to receiver" << std::endl;
|
||||
os << "rx_zmqip \n gets/gets the 0MQ (TCP) ip of the receiver from where data is streamed from. If no custom ip, empty until first time connect to receiver" << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
@ -5916,33 +5934,14 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
int receivers = myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if(cmd=="receiver"){
|
||||
if (action==PUT_ACTION) {
|
||||
if(!strcasecmp(args[1],"start")) {
|
||||
//to ensure data streaming enable is the same across client and receiver
|
||||
if ((!myDet->getExternalGuiFlag()) && (receivers == ONLINE_FLAG)) {
|
||||
//if it was not off
|
||||
if (myDet->enableDataStreamingFromReceiver(-1) != 0){
|
||||
//switch it off, if error
|
||||
if (myDet->enableDataStreamingFromReceiver(0) != 0) {
|
||||
return string("could not disable data streaming in receiver\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!strcasecmp(args[1],"start"))
|
||||
myDet->startReceiver();
|
||||
}
|
||||
else if(!strcasecmp(args[1],"stop")){
|
||||
//myDet->stopReceiver();
|
||||
// myDet->startReceiverReadout();
|
||||
/*runStatus s = myDet->getReceiverStatus();
|
||||
while(s != RUN_FINISHED){
|
||||
usleep(50000);
|
||||
s = myDet->getReceiverStatus();
|
||||
}*/
|
||||
else if(!strcasecmp(args[1],"stop"))
|
||||
myDet->stopReceiver();
|
||||
}
|
||||
else
|
||||
return helpReceiver(narg, args, action);
|
||||
}
|
||||
|
@ -227,6 +227,18 @@ int slsDetectorUsers::enableDataStreamingFromReceiver(int i){
|
||||
return myDetector->enableDataStreamingFromReceiver(i);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::enableDataStreamingToClient(int i){
|
||||
return myDetector->enableDataStreamingToClient(i);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setReceiverDataStreamingOutPort(int i){
|
||||
return myDetector->setReceiverDataStreamingOutPort(i);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setClientDataStreamingInPort(int i){
|
||||
return myDetector->setClientDataStreamingInPort(i);
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::getModuleFirmwareVersion(){
|
||||
return myDetector->getModuleFirmwareVersion();
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ class slsDetectorUsers
|
||||
|
||||
/**
|
||||
@short enable/disable count rate corrections
|
||||
\param i 0 disables, 1 enable, -1 gets
|
||||
\param i 0 disables, 1 enables with default values, -1 gets
|
||||
\returns 0 if count corrections disabled, 1 if enabled
|
||||
*/
|
||||
int enableCountRateCorrection(int i=-1);
|
||||
@ -439,13 +439,34 @@ class slsDetectorUsers
|
||||
virtual void finalizeDataset(double *a, double *v, double *e, int &np);
|
||||
|
||||
|
||||
/**
|
||||
Enable data streaming from receiver (zmq)
|
||||
\param i 1 to set, 0 to reset and -1 to get
|
||||
\returns data streaming enable
|
||||
*/
|
||||
/** Enable or disable streaming data from receiver (creates transmitting sockets)
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming from receiver enable
|
||||
*/
|
||||
int enableDataStreamingFromReceiver(int i=-1);
|
||||
|
||||
/**
|
||||
* Enable data streaming to client (creates receiving sockets)
|
||||
* @param i 0 to disable, 1 to enable, -1 to get the value
|
||||
* @returns data streaming to client enable
|
||||
*/
|
||||
int enableDataStreamingToClient(int i=-1);
|
||||
|
||||
/**
|
||||
* Set/Get receiver streaming out ZMQ port
|
||||
* For multi modules, it calculates (increments) and sets the ports
|
||||
* @param i sets, -1 gets
|
||||
* @returns receiver streaming out ZMQ port ()
|
||||
*/
|
||||
int setReceiverDataStreamingOutPort(int i=-1);
|
||||
|
||||
/**
|
||||
* Set/Get client streaming in ZMQ port
|
||||
* For multi modules, it calculates (increments) and sets the ports
|
||||
* @param i sets, -1 gets
|
||||
* @returns client streaming in ZMQ port
|
||||
*/
|
||||
int setClientDataStreamingInPort(int i=-1);
|
||||
|
||||
/**
|
||||
get get Module Firmware Version
|
||||
|
@ -30,6 +30,7 @@ extern "C" {
|
||||
#include <queue>
|
||||
#include <math.h>
|
||||
#include <semaphore.h>
|
||||
#include <cstdlib>
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -98,8 +99,33 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
|
||||
int enableFlatFieldCorrection(int i=-1) {if (i>0) setFlatFieldCorrectionFile("default"); else if (i==0) setFlatFieldCorrectionFile(""); return getFlatFieldCorrection();};
|
||||
int enablePixelMaskCorrection(int i=-1) {if (i>0) setBadChannelCorrection("default"); else if (i==0) setBadChannelCorrection(""); return getBadChannelCorrection();};
|
||||
int enableCountRateCorrection(int i=-1) {if (i>0) setRateCorrection(i); else if (i==0) setRateCorrection(0); return getRateCorrection();};
|
||||
// string getFilePath(){return fileIO::getFilePath();};;
|
||||
int enableCountRateCorrection(int i=-1) {if (i>0) setRateCorrection(-1); else if (i==0) setRateCorrection(0); return getRateCorrection();};
|
||||
|
||||
|
||||
/**
|
||||
* Set/Get receiver streaming out ZMQ port
|
||||
* For multi modules, it calculates (increments) and sets the ports
|
||||
* @param i sets, -1 gets
|
||||
* @returns receiver streaming out ZMQ port
|
||||
*/
|
||||
int setReceiverDataStreamingOutPort(int i) { \
|
||||
if (i >= 0) { ostringstream ss; ss << i; string s = ss.str(); \
|
||||
setNetworkParameter(RECEIVER_STREAMING_PORT, s);} \
|
||||
return atoi(getNetworkParameter(RECEIVER_STREAMING_PORT).c_str());}; \
|
||||
|
||||
/**
|
||||
* Set/Get client streaming in ZMQ port
|
||||
* For multi modules, it calculates (increments) and sets the ports
|
||||
* @param i sets, -1 gets
|
||||
* @returns client streaming in ZMQ port
|
||||
*/
|
||||
int setClientDataStreamingInPort(int i){ \
|
||||
if (i >= 0) { ostringstream ss; ss << i; string s = ss.str(); \
|
||||
setNetworkParameter(CLIENT_STREAMING_PORT, s);} \
|
||||
return atoi(getNetworkParameter(CLIENT_STREAMING_PORT).c_str());}; \
|
||||
|
||||
|
||||
// string getFilePath(){return fileIO::getFilePath();};;
|
||||
// string setFilePath(string s){return fileIO::setFilePath(s);};
|
||||
|
||||
// string getFileName(){return fileIO::getFileName();};
|
||||
@ -760,9 +786,9 @@ virtual ROI* getROI(int &n)=0;
|
||||
*/
|
||||
virtual int setReadReceiverFrequency(int getFromReceiver, int freq=-1)=0;
|
||||
|
||||
/** Enable or disable streaming of data from receiver to client
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming
|
||||
/** Enable or disable streaming data from receiver to client
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming from receiver enable
|
||||
*/
|
||||
virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
#endif
|
||||
|
||||
/* global variables */
|
||||
void serializeToSPI(u_int32_t addr, u_int32_t val, u_int16_t csmask, int numbitstosend, u_int16_t clkmask, u_int16_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) {
|
||||
#ifdef VERBOSE
|
||||
if (numbitstosend == 16)
|
||||
printf("Writing to SPI Register: 0x%04x\n",val);
|
||||
@ -14,15 +14,15 @@ void serializeToSPI(u_int32_t addr, u_int32_t val, u_int16_t csmask, int numbits
|
||||
printf("Writing to SPI Register: 0x%08x\n", val);
|
||||
#endif
|
||||
|
||||
u_int16_t valw;
|
||||
u_int32_t valw;
|
||||
|
||||
// start point
|
||||
valw = 0xffff; /**todo testwith old board 0xff for adc_spi */ // old board compatibility (not using specific bits)
|
||||
bus_w16 (addr, valw);
|
||||
valw = 0xffffffff; // old board compatibility (not using specific bits)
|
||||
bus_w (addr, valw);
|
||||
|
||||
// chip sel bar down
|
||||
valw &= ~csmask; /* todo with test: done a bit different, not with previous value */
|
||||
bus_w16 (addr, valw);
|
||||
valw &= ~csmask; /* todo with test: done a bit different, not with previous value */
|
||||
bus_w (addr, valw);
|
||||
|
||||
{
|
||||
int i = 0;
|
||||
@ -30,30 +30,30 @@ void serializeToSPI(u_int32_t addr, u_int32_t val, u_int16_t csmask, int numbits
|
||||
|
||||
// clk down
|
||||
valw &= ~clkmask;
|
||||
bus_w16 (addr, valw);
|
||||
bus_w (addr, valw);
|
||||
|
||||
// write data (i)
|
||||
valw = ((valw & ~digoutmask) + // unset bit
|
||||
(((val >> (numbitstosend - 1 - i)) & 0x1) << digofset)); // each bit from val starting from msb
|
||||
bus_w16 (addr, valw);
|
||||
bus_w (addr, valw);
|
||||
|
||||
// clk up
|
||||
valw |= clkmask ;
|
||||
bus_w16 (addr, valw);
|
||||
bus_w (addr, valw);
|
||||
}
|
||||
}
|
||||
|
||||
// chip sel bar up
|
||||
valw |= csmask; /* todo with test: not done for spi */
|
||||
bus_w16 (addr, valw);
|
||||
bus_w (addr, valw);
|
||||
|
||||
//clk down
|
||||
valw &= ~clkmask;
|
||||
bus_w16 (addr, valw);
|
||||
bus_w (addr, valw);
|
||||
|
||||
// stop point = start point of course
|
||||
valw = 0xffff; /**todo testwith old board 0xff for adc_spi */ // old board compatibility (not using specific bits)
|
||||
bus_w16 (addr, valw);
|
||||
valw = 0xffffffff; // old board compatibility (not using specific bits)
|
||||
bus_w (addr, valw);
|
||||
}
|
||||
|
||||
|
||||
|
@ -124,7 +124,7 @@ int setThresholdEnergy(int ev, int imod);
|
||||
|
||||
// parameters - dac, adc, hv
|
||||
#ifdef JUNGFRAUD
|
||||
void serializeToSPI(u_int32_t addr, u_int32_t val, u_int16_t csmask, int numbitstosend, u_int16_t clkmask, u_int16_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);
|
||||
extern void setAdc(int addr, int val); // AD9257.h
|
||||
int voltageToDac(int value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user