##// END OF EJS Templates
the two bridges, Star Dundee and GRESB are fully functional
leroy -
r10:74729fe49979 default
parent child
Show More
@@ -1,6 +1,6
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2012-12-10T15:32:54. -->
3 <!-- Written by Qt Creator 2.4.1, 2012-12-11T14:32:09. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -1,6 +1,6
1 #############################################################################
1 #############################################################################
2 # Makefile for building: librmapplugin.so.1.0.0
2 # Makefile for building: librmapplugin.so.1.0.0
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 09:02:30 2012
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 16:03:39 2012
4 # Project: rmapplugin.pro
4 # Project: rmapplugin.pro
5 # Template: lib
5 # Template: lib
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
@@ -47,7 +47,6 SOURCES = rmapplugin.cpp \
47 rmappluginui.cpp \
47 rmappluginui.cpp \
48 rmapoperations.cpp \
48 rmapoperations.cpp \
49 ccsds.cpp \
49 ccsds.cpp \
50 spwpacketreceiver.cpp \
51 ../common_PLE/qipdialogbox.cpp \
50 ../common_PLE/qipdialogbox.cpp \
52 ../common_PLE/gresbstatusenquiry.cpp \
51 ../common_PLE/gresbstatusenquiry.cpp \
53 spectralmatricesdmasimulator.cpp \
52 spectralmatricesdmasimulator.cpp \
@@ -57,7 +56,6 SOURCES = rmapplugin.cpp \
57 bridge.cpp \
56 bridge.cpp \
58 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
57 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
59 moc/moc_rmapplugin.cpp \
58 moc/moc_rmapplugin.cpp \
60 moc/moc_spwpacketreceiver.cpp \
61 moc/moc_qipdialogbox.cpp \
59 moc/moc_qipdialogbox.cpp \
62 moc/moc_gresbstatusenquiry.cpp \
60 moc/moc_gresbstatusenquiry.cpp \
63 moc/moc_spectralmatricesdmasimulator.cpp \
61 moc/moc_spectralmatricesdmasimulator.cpp \
@@ -71,7 +69,6 OBJECTS = obj/rmapplugin.o \
71 obj/rmappluginui.o \
69 obj/rmappluginui.o \
72 obj/rmapoperations.o \
70 obj/rmapoperations.o \
73 obj/ccsds.o \
71 obj/ccsds.o \
74 obj/spwpacketreceiver.o \
75 obj/qipdialogbox.o \
72 obj/qipdialogbox.o \
76 obj/gresbstatusenquiry.o \
73 obj/gresbstatusenquiry.o \
77 obj/spectralmatricesdmasimulator.o \
74 obj/spectralmatricesdmasimulator.o \
@@ -82,7 +79,6 OBJECTS = obj/rmapplugin.o \
82 obj/lppmonplugininterface.o \
79 obj/lppmonplugininterface.o \
83 obj/moc_rmappluginui.o \
80 obj/moc_rmappluginui.o \
84 obj/moc_rmapplugin.o \
81 obj/moc_rmapplugin.o \
85 obj/moc_spwpacketreceiver.o \
86 obj/moc_qipdialogbox.o \
82 obj/moc_qipdialogbox.o \
87 obj/moc_gresbstatusenquiry.o \
83 obj/moc_gresbstatusenquiry.o \
88 obj/moc_spectralmatricesdmasimulator.o \
84 obj/moc_spectralmatricesdmasimulator.o \
@@ -237,7 +233,7 qmake: FORCE
237
233
238 dist:
234 dist:
239 @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0
235 @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0
240 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h spwpacketreceiver.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h bridge.h /usr/include/genericPySysdriver.h /usr/include/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp spwpacketreceiver.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp bridge.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0
236 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmappluginui.h rmapplugin.h rmapoperations.h ccsds.h ../common_PLE/qipdialogbox.h ../common_PLE/gresbstatusenquiry.h spectralmatricesdmasimulator.h rmappluginpythonwrapper.h stardundee.h ../spw_usb_driver_v2.61/inc/spw_usb_api.h ../spw_usb_driver_v2.61/inc/spw_config_library.h gresb.h bridge.h /usr/include/genericPySysdriver.h /usr/include/lppmonplugin.h obj/rmapplugin1.0.0/ && $(COPY_FILE) --parents rmapplugin.cpp rmappluginui.cpp rmapoperations.cpp ccsds.cpp ../common_PLE/qipdialogbox.cpp ../common_PLE/gresbstatusenquiry.cpp spectralmatricesdmasimulator.cpp rmappluginpythonwrapper.cpp stardundee.cpp gresb.cpp bridge.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp obj/rmapplugin1.0.0/ && (cd `dirname obj/rmapplugin1.0.0` && $(TAR) rmapplugin1.0.0.tar rmapplugin1.0.0 && $(COMPRESS) rmapplugin1.0.0.tar) && $(MOVE) `dirname obj/rmapplugin1.0.0`/rmapplugin1.0.0.tar.gz . && $(DEL_FILE) -r obj/rmapplugin1.0.0
241
237
242
238
243 clean:compiler_clean
239 clean:compiler_clean
@@ -259,14 +255,13 mocclean: compiler_moc_header_clean comp
259
255
260 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
256 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
261
257
262 compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_spwpacketreceiver.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
258 compiler_moc_header_make_all: moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
263 compiler_moc_header_clean:
259 compiler_moc_header_clean:
264 -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_spwpacketreceiver.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
260 -$(DEL_FILE) moc/moc_rmappluginui.cpp moc/moc_rmapplugin.cpp moc/moc_qipdialogbox.cpp moc/moc_gresbstatusenquiry.cpp moc/moc_spectralmatricesdmasimulator.cpp moc/moc_rmappluginpythonwrapper.cpp moc/moc_stardundee.cpp moc/moc_gresb.cpp moc/moc_bridge.cpp moc/moc_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
265 moc/moc_rmappluginui.cpp: rmapoperations.h \
261 moc/moc_rmappluginui.cpp: rmapoperations.h \
266 spectralmatricesdmasimulator.h \
262 spectralmatricesdmasimulator.h \
267 stardundee.h \
263 stardundee.h \
268 gresb.h \
264 gresb.h \
269 spwpacketreceiver.h \
270 rmappluginui.h
265 rmappluginui.h
271 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
266 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
272
267
@@ -275,14 +270,10 moc/moc_rmapplugin.cpp: rmappluginui.h \
275 spectralmatricesdmasimulator.h \
270 spectralmatricesdmasimulator.h \
276 stardundee.h \
271 stardundee.h \
277 gresb.h \
272 gresb.h \
278 spwpacketreceiver.h \
279 ccsds.h \
273 ccsds.h \
280 rmapplugin.h
274 rmapplugin.h
281 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp
275 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp
282
276
283 moc/moc_spwpacketreceiver.cpp: spwpacketreceiver.h
284 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spwpacketreceiver.h -o moc/moc_spwpacketreceiver.cpp
285
286 moc/moc_qipdialogbox.cpp: ../common_PLE/qipdialogbox.h
277 moc/moc_qipdialogbox.cpp: ../common_PLE/qipdialogbox.h
287 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/qipdialogbox.h -o moc/moc_qipdialogbox.cpp
278 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/qipdialogbox.h -o moc/moc_qipdialogbox.cpp
288
279
@@ -299,12 +290,12 moc/moc_stardundee.cpp: rmapoperations.h
299 stardundee.h
290 stardundee.h
300 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
291 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
301
292
302 moc/moc_gresb.cpp: spwpacketreceiver.h \
293 moc/moc_gresb.cpp: rmapoperations.h \
303 rmapoperations.h \
304 gresb.h
294 gresb.h
305 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp
295 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp
306
296
307 moc/moc_bridge.cpp: bridge.h
297 moc/moc_bridge.cpp: rmapoperations.h \
298 bridge.h
308 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp
299 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp
309
300
310 moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h
301 moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h
@@ -338,7 +329,6 obj/rmapplugin.o: rmapplugin.cpp rmapplu
338 spectralmatricesdmasimulator.h \
329 spectralmatricesdmasimulator.h \
339 stardundee.h \
330 stardundee.h \
340 gresb.h \
331 gresb.h \
341 spwpacketreceiver.h \
342 ccsds.h \
332 ccsds.h \
343 rmappluginpythonwrapper.h
333 rmappluginpythonwrapper.h
344 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp
334 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp
@@ -349,7 +339,6 obj/rmappluginui.o: rmappluginui.cpp rma
349 spectralmatricesdmasimulator.h \
339 spectralmatricesdmasimulator.h \
350 stardundee.h \
340 stardundee.h \
351 gresb.h \
341 gresb.h \
352 spwpacketreceiver.h \
353 ccsds.h
342 ccsds.h
354 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
343 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
355
344
@@ -359,10 +348,6 obj/rmapoperations.o: rmapoperations.cpp
359 obj/ccsds.o: ccsds.cpp ccsds.h
348 obj/ccsds.o: ccsds.cpp ccsds.h
360 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp
349 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp
361
350
362 obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h \
363 rmapoperations.h
364 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp
365
366 obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h
351 obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h
367 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qipdialogbox.o ../common_PLE/qipdialogbox.cpp
352 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qipdialogbox.o ../common_PLE/qipdialogbox.cpp
368
353
@@ -380,11 +365,11 obj/stardundee.o: stardundee.cpp stardun
380 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp
365 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp
381
366
382 obj/gresb.o: gresb.cpp gresb.h \
367 obj/gresb.o: gresb.cpp gresb.h \
383 spwpacketreceiver.h \
384 rmapoperations.h
368 rmapoperations.h
385 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp
369 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp
386
370
387 obj/bridge.o: bridge.cpp bridge.h
371 obj/bridge.o: bridge.cpp bridge.h \
372 rmapoperations.h
388 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp
373 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp
389
374
390 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
375 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
@@ -397,9 +382,6 obj/moc_rmappluginui.o: moc/moc_rmapplug
397 obj/moc_rmapplugin.o: moc/moc_rmapplugin.cpp
382 obj/moc_rmapplugin.o: moc/moc_rmapplugin.cpp
398 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmapplugin.o moc/moc_rmapplugin.cpp
383 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmapplugin.o moc/moc_rmapplugin.cpp
399
384
400 obj/moc_spwpacketreceiver.o: moc/moc_spwpacketreceiver.cpp
401 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_spwpacketreceiver.o moc/moc_spwpacketreceiver.cpp
402
403 obj/moc_qipdialogbox.o: moc/moc_qipdialogbox.cpp
385 obj/moc_qipdialogbox.o: moc/moc_qipdialogbox.cpp
404 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_qipdialogbox.o moc/moc_qipdialogbox.cpp
386 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_qipdialogbox.o moc/moc_qipdialogbox.cpp
405
387
@@ -78,11 +78,9 gresb::gresb(QWidget *parent) :
78 connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState)));
78 connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState)));
79 connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState)));
79 connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState)));
80 connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
80 connect(gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
81 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
81 connect(spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery()));
82 connect(spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery()));
82 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket()));
83 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket()));
83
84 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
85 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this, SLOT(receiveSPWPacket()));
86 }
84 }
87
85
88 gresb::~gresb()
86 gresb::~gresb()
@@ -196,7 +194,7 unsigned int gresb::Read(unsigned int *V
196 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
194 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
197 address = address + READ_WRITE_MAX_COUNTS * 4;
195 address = address + READ_WRITE_MAX_COUNTS * 4;
198 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
196 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
199 acquireRMAPSemaphore();
197 rmapPacketSEMAPHORE->acquire();
200 }
198 }
201
199
202 if (remainingCount > 0)
200 if (remainingCount > 0)
@@ -218,7 +216,7 unsigned int gresb::Read(unsigned int *V
218 Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
216 Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
219 }
217 }
220 }
218 }
221 acquireRMAPSemaphore();
219 rmapPacketSEMAPHORE->acquire();
222 }
220 }
223
221
224 emit appendToLog(QString("*** STOP *** READ "));
222 emit appendToLog(QString("*** STOP *** READ "));
@@ -400,7 +398,7 unsigned int gresb::ReadBLOCK(unsigned i
400 emit appendToLog("WARNING === in function READ of rmapplugin *** number of data received ("
398 emit appendToLog("WARNING === in function READ of rmapplugin *** number of data received ("
401 +QString::number(dataLength)
399 +QString::number(dataLength)
402 +") not equal to number of data requested ("
400 +") not equal to number of data requested ("
403 +QString::number(READ_WRITE_MAX_COUNTS*4)
401 +QString::number(nbBytes)
404 +")");
402 +")");
405 return 0;
403 return 0;
406 }
404 }
@@ -488,7 +486,6 int gresb::receiveSPWPacket(unsigned cha
488 RMAPReceive_SOCKET->read( (char*) &packetLength1, 1);
486 RMAPReceive_SOCKET->read( (char*) &packetLength1, 1);
489 RMAPReceive_SOCKET->read( (char*) &packetLength0, 1);
487 RMAPReceive_SOCKET->read( (char*) &packetLength0, 1);
490 packetLength = (packetLength2<<16) + (packetLength1<<8) + (packetLength0);
488 packetLength = (packetLength2<<16) + (packetLength1<<8) + (packetLength0);
491 spwPacket = (char*) malloc(packetLength);
492
489
493 // READ THE SPW PACKET
490 // READ THE SPW PACKET
494 while(RMAPReceive_SOCKET->bytesAvailable() < packetLength)
491 while(RMAPReceive_SOCKET->bytesAvailable() < packetLength)
@@ -498,6 +495,7 int gresb::receiveSPWPacket(unsigned cha
498 }
495 }
499 RMAPReceive_SOCKET->read( spwPacket, packetLength );
496 RMAPReceive_SOCKET->read( spwPacket, packetLength );
500 RMAPReceive_SOCKET->blockSignals(0);
497 RMAPReceive_SOCKET->blockSignals(0);
498 //emit sendMessage("Packet of size " + QString::number(packetLength) + " received");
501
499
502 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
500 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
503 {
501 {
@@ -506,7 +504,7 int gresb::receiveSPWPacket(unsigned cha
506 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
504 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
507 rmapPacketSize = packetLength;
505 rmapPacketSize = packetLength;
508 rmapPacketSEMAPHORE->release();
506 rmapPacketSEMAPHORE->release();
509 //emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
507 emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
510 return packetLength;
508 return packetLength;
511
509
512 case 2: // 0x02 is the protocole identifier for CCSDS packets
510 case 2: // 0x02 is the protocole identifier for CCSDS packets
@@ -515,6 +513,7 int gresb::receiveSPWPacket(unsigned cha
515 ccsdsPacketSize = packetLength;
513 ccsdsPacketSize = packetLength;
516 ccsdsPacketSEMAPHORE->release();
514 ccsdsPacketSEMAPHORE->release();
517 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
515 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
516 //emit sendMessage("CCSDS packet of size " + QString::number(packetLength) + " received");
518 return packetLength;
517 return packetLength;
519 }
518 }
520 return 0;
519 return 0;
@@ -663,38 +662,6 int gresb::GRESBStatusQueryRequest(Gresb
663 return 0;
662 return 0;
664 }
663 }
665
664
666 void gresb::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT
667 {
668 QString message;
669 unsigned int fine_time_value = 0;
670 fine_time_value = ((unsigned int) ccsdsPacket[7]<<24)
671 + ((unsigned int) ccsdsPacket[6]<<16)
672 + ((unsigned int) ccsdsPacket[5]<<8)
673 + ((unsigned int) ccsdsPacket[4]);
674 message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": ");
675 message.append("size "
676 + QString::number(size)
677 +" *** header "
678 + QString::number(ccsdsPacket[0], 16)
679 + " "
680 + QString::number(ccsdsPacket[1], 16)
681 + " "
682 + QString::number(ccsdsPacket[2], 16)
683 + " "
684 + QString::number(ccsdsPacket[3], 16)
685 + " *** coarse time "
686 + QString::number(fine_time_value));
687 //+ QString::number(ccsdsPacket[4], 16)
688 //+" "
689 //+ QString::number(ccsdsPacket[5], 16)
690 //+" "
691 //+ QString::number(ccsdsPacket[6], 16)
692 //+" "
693 //+ QString::number(ccsdsPacket[7], 16));
694 ccsdsPacketSEMAPHORE->acquire();
695 emit sendMessage(message);
696 }
697
698 void gresb::reTestSPWLink() // SLOT
665 void gresb::reTestSPWLink() // SLOT
699 {
666 {
700 if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 0)
667 if (GRESBStatusQueryRequest(LinkStatus, spwLinkSpinBox->value()) == 0)
@@ -11,7 +11,6
11 #include <QSemaphore>
11 #include <QSemaphore>
12
12
13 #include "gresbstatusenquiry.h"
13 #include "gresbstatusenquiry.h"
14 #include "spwpacketreceiver.h"
15 #include "rmapoperations.h"
14 #include "rmapoperations.h"
16 #include "qipdialogbox.h"
15 #include "qipdialogbox.h"
17
16
@@ -36,13 +35,14 public slots:
36 void Open();
35 void Open();
37 void Close();
36 void Close();
38 int receiveSPWPacket(unsigned char requestID=0);
37 int receiveSPWPacket(unsigned char requestID=0);
39 void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
38 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
39 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
40 void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();}
40 void reTestSPWLink();
41 void reTestSPWLink();
42 //
41 void RMAPSendConnectionState(QAbstractSocket::SocketState socketState);
43 void RMAPSendConnectionState(QAbstractSocket::SocketState socketState);
42 void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState);
44 void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState);
43 void GRESBConnectionState(QAbstractSocket::SocketState socketState);
45 void GRESBConnectionState(QAbstractSocket::SocketState socketState);
44 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
45 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
46
46
47 private slots:
47 private slots:
48 int GRESBStatusQuery();
48 int GRESBStatusQuery();
@@ -50,8 +50,8 private slots:
50 private:
50 private:
51 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
51 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
52 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
52 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
53 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();}
53 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();}
54 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();}
54 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();}
55 int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link);
55 int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link);
56
56
57 unsigned char rmapTargetLogicalAddress ;
57 unsigned char rmapTargetLogicalAddress ;
@@ -61,12 +61,18 rmapplugin::rmapplugin(QWidget *parent)
61 connect(this->UI->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool)));
61 connect(this->UI->gresbBridge, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool)));
62 connect(this->UI->gresbBridge, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
62 connect(this->UI->gresbBridge, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
63 connect(this->UI->gresbBridge, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
63 connect(this->UI->gresbBridge, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
64 connect(this->UI->gresbBridge, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)),
65 this, SLOT(processCCSDSPacket(unsigned char*,uint)));
66 connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->gresbBridge, SLOT(ccsdsPacketIsProcessed()));
64
67
65 // Star Dundee
68 // Star Dundee
66 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
69 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
67 connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool)));
70 connect(this->UI->starDundee, SIGNAL(isOpen(bool)), this, SLOT(activatePlugin(bool)));
68 connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
71 connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
69 connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
72 connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
73 connect(this->UI->starDundee, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)),
74 this, SLOT(processCCSDSPacket(unsigned char*,uint)));
75 connect(this, SIGNAL(ccsdsPacketIsProcessed()), this->UI->starDundee, SLOT(ccsdsPacketIsProcessed()));
70
76
71 connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge)));
77 connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge)));
72 }
78 }
@@ -276,11 +282,35 void rmapplugin::appendToLog(QString tex
276 /////////////////////
282 /////////////////////
277 // INTERNAL FUNCTIONS
283 // INTERNAL FUNCTIONS
278
284
279 void rmapplugin::gresbSelection(bool flag)
285 void rmapplugin::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size) // SLOT
280 {
286 {
281 if (flag == true) UI->selection_GROUPBOX->setEnabled(false);
287 QString message;
282 if (flag == false) UI->selection_GROUPBOX->setEnabled(true);
288 unsigned int fine_time_value = 0;
289 fine_time_value = ((unsigned int) ccsdsPacket[7]<<24)
290 + ((unsigned int) ccsdsPacket[6]<<16)
291 + ((unsigned int) ccsdsPacket[5]<<8)
292 + ((unsigned int) ccsdsPacket[4]);
293 message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": ");
294 message.append("size "
295 + QString::number(size)
296 +" *** header "
297 + QString::number(ccsdsPacket[0], 16)
298 + " "
299 + QString::number(ccsdsPacket[1], 16)
300 + " "
301 + QString::number(ccsdsPacket[2], 16)
302 + " "
303 + QString::number(ccsdsPacket[3], 16)
304 + " *** coarse time "
305 + QString::number(fine_time_value));
306 //+ QString::number(ccsdsPacket[4], 16)
307 //+" "
308 //+ QString::number(ccsdsPacket[5], 16)
309 //+" "
310 //+ QString::number(ccsdsPacket[6], 16)
311 //+" "
312 //+ QString::number(ccsdsPacket[7], 16));
313 displayOnConsole(message);
314 emit ccsdsPacketIsProcessed();
283 }
315 }
284
316
285
286
@@ -31,7 +31,6
31 #include <QTime>
31 #include <QTime>
32 #include <ccsds.h>
32 #include <ccsds.h>
33 #include <QSemaphore>
33 #include <QSemaphore>
34 #include <spwpacketreceiver.h>
35
34
36 #include <lppmonplugin.h>
35 #include <lppmonplugin.h>
37
36
@@ -57,13 +56,13 public slots:
57 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
56 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
58 void openBridge();
57 void openBridge();
59 void closeBridge();
58 void closeBridge();
59 void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
60 //
60 //
61 void sendCCSDS();
61 void sendCCSDS();
62 void send_TC_LFR_UPDATE_TIME();
62 void send_TC_LFR_UPDATE_TIME();
63 void reset_TC_LFR_UPDATE_TIME();
63 void reset_TC_LFR_UPDATE_TIME();
64 void displayOnConsole(QString message) {this->UI->console->append(message);}
64 void displayOnConsole(QString message) {this->UI->console->append(message);}
65 //
65 //
66 void gresbSelection(bool flag);
67 void RMAP_write_reply_setText(QString text);
66 void RMAP_write_reply_setText(QString text);
68 void appendToLog(QString text);
67 void appendToLog(QString text);
69 //
68 //
@@ -71,6 +70,7 public slots:
71 void bridgeHasChanged(selectedBridge bridge) {currentBridge = bridge;}
70 void bridgeHasChanged(selectedBridge bridge) {currentBridge = bridge;}
72
71
73 signals:
72 signals:
73 void ccsdsPacketIsProcessed();
74
74
75 private:
75 private:
76 selectedBridge currentBridge;
76 selectedBridge currentBridge;
@@ -82,7 +82,6 private:
82 unsigned int rmapPacketSize;
82 unsigned int rmapPacketSize;
83 unsigned int time_COARSE;
83 unsigned int time_COARSE;
84 unsigned int time_FINE;
84 unsigned int time_FINE;
85 spwpacketreceiver* spwPacketReceiverOBJECT;
86 char timeCode;
85 char timeCode;
87 };
86 };
88
87
@@ -35,7 +35,6 HEADERS += \
35 rmapplugin.h \
35 rmapplugin.h \
36 rmapoperations.h \
36 rmapoperations.h \
37 ccsds.h \
37 ccsds.h \
38 spwpacketreceiver.h \
39 ../common_PLE/qipdialogbox.h \
38 ../common_PLE/qipdialogbox.h \
40 ../common_PLE/gresbstatusenquiry.h \
39 ../common_PLE/gresbstatusenquiry.h \
41 spectralmatricesdmasimulator.h \
40 spectralmatricesdmasimulator.h \
@@ -52,7 +51,6 SOURCES += \
52 rmappluginui.cpp \
51 rmappluginui.cpp \
53 rmapoperations.cpp \
52 rmapoperations.cpp \
54 ccsds.cpp \
53 ccsds.cpp \
55 spwpacketreceiver.cpp \
56 ../common_PLE/qipdialogbox.cpp \
54 ../common_PLE/qipdialogbox.cpp \
57 ../common_PLE/gresbstatusenquiry.cpp \
55 ../common_PLE/gresbstatusenquiry.cpp \
58 spectralmatricesdmasimulator.cpp \
56 spectralmatricesdmasimulator.cpp \
@@ -160,8 +160,8 rmapPluginUI::rmapPluginUI(QWidget *pare
160 mainLayout->addWidget(spwTabWidget);
160 mainLayout->addWidget(spwTabWidget);
161 setLayout(mainLayout);
161 setLayout(mainLayout);
162
162
163 //connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
164 connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear()));
163 connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear()));
164
165 // briges
165 // briges
166 connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
166 connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
167 connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
167 connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
@@ -6,12 +6,15 StarDundee::StarDundee(QWidget *parent)
6 QWidget(parent)
6 QWidget(parent)
7 {
7 {
8 // Packet receiver
8 // Packet receiver
9 timer = new QTimer;
9 rmapPacketSEMAPHORE = new QSemaphore;
10 rmapPacketSEMAPHORE = new QSemaphore;
10 ccsdsPacketSEMAPHORE = new QSemaphore;
11 ccsdsPacketSEMAPHORE = new QSemaphore;
11 rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH);
12 rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH);
12 ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH);
13 ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH);
13 spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) );
14 spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) );
14
15
16 starDundeeStatusQueryDialog = new QDialog;
17
15 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
18 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
16
19
17 rmapSourceLogicalAddress = 0x20;
20 rmapSourceLogicalAddress = 0x20;
@@ -20,6 +23,11 StarDundee::StarDundee(QWidget *parent)
20 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
23 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
21 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
24 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
22 sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: "));
25 sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: "));
26 starDundeeStatusQueryDialogLabel = new QLabel(tr("SpaceWire link not running"));
27
28 //*** QPUSHBUTTON ***//
29 starDundeeStatusQueryRetryButton = new QPushButton(tr("Retry"));
30 starDundeeStatusQueryAbortButton = new QPushButton(tr("Abort"));
23
31
24 usbDeviceNumber_SPINBOX = new QSpinBox;
32 usbDeviceNumber_SPINBOX = new QSpinBox;
25 usbDeviceNumber_SPINBOX->setRange(0,32);
33 usbDeviceNumber_SPINBOX->setRange(0,32);
@@ -31,6 +39,13 StarDundee::StarDundee(QWidget *parent)
31 sourceLogicalAddress_SPINBOX->setRange(0,254);
39 sourceLogicalAddress_SPINBOX->setRange(0,254);
32 sourceLogicalAddress_SPINBOX->setValue(32);
40 sourceLogicalAddress_SPINBOX->setValue(32);
33
41
42 // STAR DUNDEE STATUS QUERY DIALOG
43 starDundeeStatusQueryDialogLayout = new QGridLayout;
44 starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryDialogLabel, 0, 0, 1, 2);
45 starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryRetryButton, 1, 0, 0);
46 starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryAbortButton, 1, 1, 0);
47 starDundeeStatusQueryDialog->setLayout(starDundeeStatusQueryDialogLayout);
48
34 connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1);
49 connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1);
35 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
50 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
36 connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1);
51 connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1);
@@ -44,6 +59,12 StarDundee::StarDundee(QWidget *parent)
44 this->setLayout(connection_LAYOUT);
59 this->setLayout(connection_LAYOUT);
45
60
46 connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int)));
61 connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int)));
62
63 connect(starDundeeStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
64 connect(starDundeeStatusQueryAbortButton, SIGNAL(clicked()), starDundeeStatusQueryDialog, SLOT(reject()));
65
66 connect(this->timer, SIGNAL(timeout()), this, SLOT(receivePollingLoop()));
67 timer->start(100); // starts the periodical timer, perdio = 100ms
47 }
68 }
48
69
49 StarDundee::~StarDundee()
70 StarDundee::~StarDundee()
@@ -58,8 +79,6 void StarDundee::Open()
58 {
79 {
59 int status;
80 int status;
60 U32 statusControl;
81 U32 statusControl;
61 U32 routingTableEntry;
62 int tableEntry;
63
82
64 if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device
83 if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device
65 {
84 {
@@ -110,44 +129,9 void StarDundee::Open()
110 else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
129 else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
111 }
130 }
112
131
113 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 254 <=> 0xfe
132 setRoutingTableEntry(rmapTargetLogicalAddress, (1<<linkNumber_SPINBOX->value()));
114 tableEntry = rmapTargetLogicalAddress;
133 setRoutingTableEntry(sourceLogicalAddress_SPINBOX->value(), (1<<3));
115 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
134 //setRoutingTableEntry(33, (1<<3));
116 {
117 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
118 }
119 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
120 // Build the routing table entry to route out of port 1 with header deletion disabled and priority normal
121 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
122 (1<<linkNumber_SPINBOX->value()), // 0x02 = 0000 0010
123 0,
124 0);
125 // Set the routing table entry for logical address tableEntry
126 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
127 {
128 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
129 }
130 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
131
132 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 32 <=> 0x20
133 tableEntry = sourceLogicalAddress_SPINBOX->value();
134 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
135 {
136 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
137 }
138 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
139
140 // Build the routing table entry to route out of port 3 with header deletion disabled and priority normal
141 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
142 (1<<3), // 0x02 = 0000 0010
143 0,
144 0);
145 // Set the routing table entry for logical address tableEntry
146 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
147 {
148 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
149 }
150 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
151
135
152 emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes");
136 emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes");
153
137
@@ -158,7 +142,14 void StarDundee::Open()
158 while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire();
142 while (rmapPacketSEMAPHORE->available()!=0) rmapPacketSEMAPHORE->acquire();
159 while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire();
143 while (ccsdsPacketSEMAPHORE->available()!=0) ccsdsPacketSEMAPHORE->acquire();
160
144
161 emit isOpen(true);
145 if (getLinkStatus(linkNumber_SPINBOX->value()))
146 {
147 emit isOpen(true);
148 }
149 else
150 {
151
152 }
162 }
153 }
163
154
164 void StarDundee::Close()
155 void StarDundee::Close()
@@ -669,7 +660,10 int StarDundee::receiveSPWPacket(unsigne
669
660
670 if (requestID==1)
661 if (requestID==1)
671 {
662 {
672 if (rmapPacketSEMAPHORE->available()) return rmapPacketSize;
663 if (rmapPacketSEMAPHORE->available())
664 {
665 return rmapPacketSize;
666 }
673 }
667 }
674
668
675 //********************
669 //********************
@@ -677,13 +671,16 int StarDundee::receiveSPWPacket(unsigne
677 nbBytes = qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH); // maximum size of the packet to receive
671 nbBytes = qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH); // maximum size of the packet to receive
678 nPacketNum = 1;
672 nPacketNum = 1;
679 result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier);
673 result = USBSpaceWire_ReadPackets(hDevice, spwPacket, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier);
680 if (result != TRANSFER_SUCCESS) emit sendMessage("Error: Could not receive the packet");
674 if (result != TRANSFER_SUCCESS)
675 {
676 emit sendMessage("Error: Could not receive the packet");
677 return 0;
678 }
681 else
679 else
682 {
680 {
683 emit sendMessage("A packet of length " + QString::number(properties.len) + " has been successfully received");
681 packetLength = properties.len;
684 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
682 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
685 }
683 }
686 packetLength = properties.len;
687
684
688 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
685 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
689 {
686 {
@@ -692,7 +689,7 int StarDundee::receiveSPWPacket(unsigne
692 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
689 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
693 rmapPacketSize = packetLength;
690 rmapPacketSize = packetLength;
694 rmapPacketSEMAPHORE->release();
691 rmapPacketSEMAPHORE->release();
695 emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
692 emit appendToLog("RMAP packet of size " + QString::number(packetLength) + " received");
696 return packetLength;
693 return packetLength;
697
694
698 case 2: // 0x02 is the protocole identifier for CCSDS packets
695 case 2: // 0x02 is the protocole identifier for CCSDS packets
@@ -700,10 +697,38 int StarDundee::receiveSPWPacket(unsigne
700 for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i];
697 for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i];
701 ccsdsPacketSize = packetLength;
698 ccsdsPacketSize = packetLength;
702 ccsdsPacketSEMAPHORE->release();
699 ccsdsPacketSEMAPHORE->release();
700 emit appendToLog("CCSDS packet of size " + QString::number(packetLength) + " received");
703 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
701 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
704 return packetLength;
702 return packetLength;
705 }
703 }
706 return 0;
704 return 0;
707 }
705 }
708
706
707 void StarDundee::receivePollingLoop()
708 {
709 timer->blockSignals(true);
710 if (USBSpaceWire_WaitOnReadPacketAvailable(hDevice, 0)) receiveSPWPacket(0);
711 timer->blockSignals(false);
712 }
709
713
714 unsigned char StarDundee::setRoutingTableEntry(int tableEntry, U32 dwOutputPorts)
715 {
716 U32 routingTableEntry;
717 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET entryNumber
718 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
719 {
720 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
721 }
722 // Build the routing table entry
723 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
724 dwOutputPorts, // route out of port dwOutputPorts
725 0, // header deletion disabled
726 0); // priority normal
727 // Set the routing table entry for logical address tableEntry
728 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
729 {
730 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
731 }
732 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
733
734 }
@@ -2,14 +2,17
2 #define STARDUNDEE_H
2 #define STARDUNDEE_H
3
3
4 #include <QWidget>
4 #include <QWidget>
5 #include "spw_usb_api.h"
6 #include "spw_config_library.h"
7 #include <QPushButton>
5 #include <QPushButton>
8 #include <QGridLayout>
6 #include <QGridLayout>
9 #include <QSpinBox>
7 #include <QSpinBox>
10 #include <QLabel>
8 #include <QLabel>
11 #include <QSemaphore>
9 #include <QSemaphore>
10 #include <QTimer>
11 #include <QDialog>
12
12 #include "rmapoperations.h"
13 #include "rmapoperations.h"
14 #include "spw_usb_api.h"
15 #include "spw_config_library.h"
13
16
14 #define BWAIT_0 0
17 #define BWAIT_0 0
15 #define BWAIT_1 1
18 #define BWAIT_1 1
@@ -37,13 +40,18 public slots:
37 int receiveSPWPacket(unsigned char requestID);
40 int receiveSPWPacket(unsigned char requestID);
38 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
41 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
39 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
42 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
43 void ccsdsPacketIsProcessed() {ccsdsPacketSEMAPHORE->tryAcquire();}
44 void reTestSPWLink() {getLinkStatus(linkNumber_SPINBOX->value());}
45 //
40 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
46 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
47 void receivePollingLoop();
41
48
42 private:
49 private:
43 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
50 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
44 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
51 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
45 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();}
52 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->tryAcquire();}
46 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();}
53 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->tryAcquire();}
54 unsigned char setRoutingTableEntry(int tableEntry, U32 dwOutputPorts);
47
55
48 unsigned int getLinkStatus(unsigned char link);
56 unsigned int getLinkStatus(unsigned char link);
49 unsigned int GetRoutingTableEntry();
57 unsigned int GetRoutingTableEntry();
@@ -56,12 +64,21 private:
56 QLabel *usbDeviceNumber_LABEL;
64 QLabel *usbDeviceNumber_LABEL;
57 QLabel *linkNumber_LABEL;
65 QLabel *linkNumber_LABEL;
58 QLabel *sourceLogicalAddress_LABEL;
66 QLabel *sourceLogicalAddress_LABEL;
67 QLabel *starDundeeStatusQueryDialogLabel;
59
68
60 QSpinBox *usbDeviceNumber_SPINBOX;
69 QSpinBox *usbDeviceNumber_SPINBOX;
61 QSpinBox *linkNumber_SPINBOX;
70 QSpinBox *linkNumber_SPINBOX;
62 QSpinBox *sourceLogicalAddress_SPINBOX;
71 QSpinBox *sourceLogicalAddress_SPINBOX;
63
72
64 QGridLayout *connection_LAYOUT;
73 QGridLayout *connection_LAYOUT;
74 QGridLayout *starDundeeStatusQueryDialogLayout;
75
76 QDialog *starDundeeStatusQueryDialog;
77
78 QPushButton *starDundeeStatusQueryRetryButton;
79 QPushButton *starDundeeStatusQueryAbortButton;
80
81 QTimer *timer;
65
82
66 unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
83 unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
67 USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send
84 USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send
General Comments 0
You need to be logged in to leave comments. Login now