Skip to content

Commit

Permalink
Merge branch 'alpha' into mdsip-zombies
Browse files Browse the repository at this point in the history
  • Loading branch information
santorofer authored Dec 8, 2023
2 parents b6e9575 + 41fe68c commit e98a66c
Show file tree
Hide file tree
Showing 18 changed files with 2,285 additions and 345 deletions.
2 changes: 1 addition & 1 deletion deploy/packaging/debian/idl.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
./usr/local/mdsplus/idl/cw_wvedit.pro
./usr/local/mdsplus/idl/dsql.pro
./usr/local/mdsplus/idl/evaluate.pro
./usr/local/mdsplus/idl/mds_keyword_set.pro
./usr/local/mdsplus/idl/mdscheckarg.pro
./usr/local/mdsplus/idl/mdsclose.pro
./usr/local/mdsplus/idl/mdsconnect.pro
Expand All @@ -36,7 +37,6 @@
./usr/local/mdsplus/idl/mdsevent.pro
./usr/local/mdsplus/idl/mdsgetmsg.pro
./usr/local/mdsplus/idl/mdsidlimage.pro
./usr/local/mdsplus/idl/mds_keyword_set.pro
./usr/local/mdsplus/idl/mdsisclient.pro
./usr/local/mdsplus/idl/mdslogin.pro
./usr/local/mdsplus/idl/mdsopen.pro
Expand Down
1 change: 1 addition & 0 deletions deploy/packaging/debian/rfxdevices.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
./usr/local/mdsplus/pydevices/RfxDevices/RFX_RPADC.py
./usr/local/mdsplus/pydevices/RfxDevices/RFX_RPADC_SERIAL.py
./usr/local/mdsplus/pydevices/RfxDevices/RFX_RPDAC.py
./usr/local/mdsplus/pydevices/RfxDevices/RFX_TRIGUART.py
./usr/local/mdsplus/pydevices/RfxDevices/RGA.py
./usr/local/mdsplus/pydevices/RfxDevices/SIG_SNAPSHOT.py
./usr/local/mdsplus/pydevices/RfxDevices/SIS3820.py
Expand Down
2 changes: 1 addition & 1 deletion deploy/packaging/redhat/idl.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
./usr/local/mdsplus/idl/cw_wvedit.pro
./usr/local/mdsplus/idl/dsql.pro
./usr/local/mdsplus/idl/evaluate.pro
./usr/local/mdsplus/idl/mds_keyword_set.pro
./usr/local/mdsplus/idl/mdscheckarg.pro
./usr/local/mdsplus/idl/mdsclose.pro
./usr/local/mdsplus/idl/mdsconnect.pro
Expand All @@ -40,7 +41,6 @@
./usr/local/mdsplus/idl/mdsgetmsg.pro
./usr/local/mdsplus/idl/mdsidlimage.pro
./usr/local/mdsplus/idl/mdsisclient.pro
./usr/local/mdsplus/idl/mds_keyword_set.pro
./usr/local/mdsplus/idl/mdslogin.pro
./usr/local/mdsplus/idl/mdsopen.pro
./usr/local/mdsplus/idl/mdsput.pro
Expand Down
1 change: 1 addition & 0 deletions deploy/packaging/redhat/rfxdevices.noarch
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
./usr/local/mdsplus/pydevices/RfxDevices/RFX_RPADC.py
./usr/local/mdsplus/pydevices/RfxDevices/RFX_RPADC_SERIAL.py
./usr/local/mdsplus/pydevices/RfxDevices/RFX_RPDAC.py
./usr/local/mdsplus/pydevices/RfxDevices/RFX_TRIGUART.py
./usr/local/mdsplus/pydevices/RfxDevices/RGA.py
./usr/local/mdsplus/pydevices/RfxDevices/SIG_SNAPSHOT.py
./usr/local/mdsplus/pydevices/RfxDevices/SIS3820.py
Expand Down
40 changes: 34 additions & 6 deletions device_support/redpitaya/AsyncStoreManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
pthread_mutex_t globalMutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t segmentMutex = PTHREAD_MUTEX_INITIALIZER;

SaveItem::SaveItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNode,
SaveItem::SaveItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNode,MDSplus::TreeNode *trigRecvNode,
MDSplus::Data *triggerTime, void *treePtr,
double *startTimes, double *endTimes, double freq, int blocksInSegment,
MDSplus::TreeNode *resampledNode)
char *trigReceived, MDSplus::TreeNode *resampledNode)
{
this->buffer = buffer;
this->segmentSamples = segmentSamples;
Expand All @@ -23,11 +23,14 @@ SaveItem::SaveItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNod
}
this->freq = freq;
this->resampledNode = resampledNode;
this->trigReceived = trigReceived;
this->trigRecvNode = trigRecvNode;
nxt = 0;
}

void SaveItem::save()
{

MDSplus::Array *chanData =
new MDSplus::Int16Array(buffer, segmentSamples);

Expand Down Expand Up @@ -63,10 +66,28 @@ void SaveItem::save()
std::cout << "MAKE SEGMENT SAMPLES:" << segmentSamples << std::endl;
dataNode->makeSegment(startSegData, endSegData, timebase, chanData);
}
catch (const MDSplus::MdsException &exc)
catch (MDSplus::MdsException &exc)
{
std::cout << "Error writing segment: " << exc.what() << std::endl;
}


if(trigRecvNode)
{
MDSplus::Float64Array *trigFlagTimes = new MDSplus::Float64Array(startTimes, blocksInSegment);
MDSplus::Int8Array *trigFlags = new MDSplus::Int8Array(trigReceived, blocksInSegment);

std::cout << "MAKE SEGMENT FLAGS:" << std::endl;

trigRecvNode->makeSegment(startSegData, endSegData, trigFlagTimes, trigFlags);
MDSplus::deleteData(trigFlagTimes);
MDSplus::deleteData(trigFlags);
}





MDSplus::deleteData(chanData);
MDSplus::deleteData(timebase);
MDSplus::deleteData(startData);
Expand All @@ -76,8 +97,15 @@ void SaveItem::save()
delete[] buffer;
delete[] startTimes;
delete[] endTimes;


}






SaveList::SaveList()
{
int status = pthread_mutex_init(&mutex, NULL);
Expand All @@ -87,14 +115,14 @@ SaveList::SaveList()
threadCreated = false;
}

void SaveList::addItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNode,
void SaveList::addItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNode,MDSplus::TreeNode *trigRecvNode,
MDSplus::Data *triggerTime, void *treePtr,
double *startTimes, double *endTimes, double freq, int blocksInSegment,
MDSplus::TreeNode *resampledNode)
char *trigReceived, MDSplus::TreeNode *resampledNode)

{
SaveItem *newItem = new SaveItem(
buffer, segmentSamples, dataNode, triggerTime, treePtr, startTimes, endTimes, freq, blocksInSegment, resampledNode);
buffer, segmentSamples, dataNode, trigRecvNode, triggerTime, treePtr, startTimes, endTimes, freq, blocksInSegment, trigReceived, resampledNode);
pthread_mutex_lock(&mutex);

if (saveHead == NULL)
Expand Down
10 changes: 6 additions & 4 deletions device_support/redpitaya/AsyncStoreManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ class SaveItem
SaveItem *nxt;
MDSplus::Data *triggerTime;
MDSplus::TreeNode *dataNode;
MDSplus::TreeNode *trigRecvNode;
MDSplus::TreeNode *resampledNode;
double *startTimes, *endTimes;
double freq;
int blocksInSegment;
char *trigReceived;

public:

SaveItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNode,
SaveItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNode, MDSplus::TreeNode *trigRecvNode,
MDSplus::Data *triggerTime, void *treePtr,
double *startTimes, double *endTimes, double freq, int blocksInSegment,
double *startTimes, double *endTimes, double freq, int blocksInSegment, char *trigReceived,
MDSplus::TreeNode *resampledNode = NULL);

void setNext(SaveItem *itm) { nxt = itm; }
Expand Down Expand Up @@ -69,9 +71,9 @@ class SaveList
public:
SaveList();

void addItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNode,
void addItem(short *buffer, int segmentSamples, MDSplus::TreeNode *dataNode, MDSplus::TreeNode *trigRecvNode,
MDSplus::Data *triggerTime, void *treePtr,
double *startTimes, double *endTimes, double freq, int blocksInSegment,
double *startTimes, double *endTimes, double freq, int blocksInSegment, char *trigReceived,
MDSplus::TreeNode *resampledNode = NULL);

void executeItems();
Expand Down
2 changes: 1 addition & 1 deletion device_support/redpitaya/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

CC=g++

CFLAGS = -fPIC -o2 -Wall -DLINUX -I${MDSPLUS_DIR}/include -I. -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function
CFLAGS = -std=c++11 -fPIC -o2 -Wall -DLINUX -I${MDSPLUS_DIR}/include -I. -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-function
LDFLAGS = -L${MDSPLUS_DIR}/lib -lpthread -lMdsObjectsCppShr


Expand Down
Loading

0 comments on commit e98a66c

Please sign in to comment.