##// END OF EJS Templates
Minor changes
leroy -
r5:ead10fa095b7 default
parent child
Show More
@@ -1,6 +1,6
1 #############################################################################
1 #############################################################################
2 # Makefile for building: PAULs_LPPMON_PLUGINS
2 # Makefile for building: PAULs_LPPMON_PLUGINS
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Thu Nov 29 14:02:20 2012
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 07:51:52 2012
4 # Project: PAULs_LPPMON_PLUGINS.pro
4 # Project: PAULs_LPPMON_PLUGINS.pro
5 # Template: subdirs
5 # Template: subdirs
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
@@ -7,5 +7,4 unix:LPPMONCFG = /etc/lppmon
7 SUBDIRS = \
7 SUBDIRS = \
8 rmapplugin
8 rmapplugin
9
9
10
11 #include( $${LPPMONCFG}/lppmonplugin.prf)
10 #include( $${LPPMONCFG}/lppmonplugin.prf)
@@ -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-07T14:08:53. -->
3 <!-- Written by Qt Creator 2.4.1, 2012-12-10T08:03:59. -->
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 3 13:45:43 2012
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 10 07:51:52 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
@@ -54,6 +54,7 SOURCES = rmapplugin.cpp \
54 rmappluginpythonwrapper.cpp \
54 rmappluginpythonwrapper.cpp \
55 stardundee.cpp \
55 stardundee.cpp \
56 gresb.cpp \
56 gresb.cpp \
57 bridge.cpp \
57 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
58 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
58 moc/moc_rmapplugin.cpp \
59 moc/moc_rmapplugin.cpp \
59 moc/moc_spwpacketreceiver.cpp \
60 moc/moc_spwpacketreceiver.cpp \
@@ -63,6 +64,7 SOURCES = rmapplugin.cpp \
63 moc/moc_rmappluginpythonwrapper.cpp \
64 moc/moc_rmappluginpythonwrapper.cpp \
64 moc/moc_stardundee.cpp \
65 moc/moc_stardundee.cpp \
65 moc/moc_gresb.cpp \
66 moc/moc_gresb.cpp \
67 moc/moc_bridge.cpp \
66 moc/moc_genericPySysdriver.cpp \
68 moc/moc_genericPySysdriver.cpp \
67 moc/moc_lppmonplugin.cpp
69 moc/moc_lppmonplugin.cpp
68 OBJECTS = obj/rmapplugin.o \
70 OBJECTS = obj/rmapplugin.o \
@@ -76,6 +78,7 OBJECTS = obj/rmapplugin.o \
76 obj/rmappluginpythonwrapper.o \
78 obj/rmappluginpythonwrapper.o \
77 obj/stardundee.o \
79 obj/stardundee.o \
78 obj/gresb.o \
80 obj/gresb.o \
81 obj/bridge.o \
79 obj/lppmonplugininterface.o \
82 obj/lppmonplugininterface.o \
80 obj/moc_rmappluginui.o \
83 obj/moc_rmappluginui.o \
81 obj/moc_rmapplugin.o \
84 obj/moc_rmapplugin.o \
@@ -86,6 +89,7 OBJECTS = obj/rmapplugin.o \
86 obj/moc_rmappluginpythonwrapper.o \
89 obj/moc_rmappluginpythonwrapper.o \
87 obj/moc_stardundee.o \
90 obj/moc_stardundee.o \
88 obj/moc_gresb.o \
91 obj/moc_gresb.o \
92 obj/moc_bridge.o \
89 obj/moc_genericPySysdriver.o \
93 obj/moc_genericPySysdriver.o \
90 obj/moc_lppmonplugin.o
94 obj/moc_lppmonplugin.o
91 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
95 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
@@ -233,7 +237,7 qmake: FORCE
233
237
234 dist:
238 dist:
235 @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0
239 @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) 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 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 /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 /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
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
237
241
238
242
239 clean:compiler_clean
243 clean:compiler_clean
@@ -255,12 +259,13 mocclean: compiler_moc_header_clean comp
255
259
256 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
260 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
257
261
258 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_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
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
259 compiler_moc_header_clean:
263 compiler_moc_header_clean:
260 -$(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_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
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
261 moc/moc_rmappluginui.cpp: rmapoperations.h \
265 moc/moc_rmappluginui.cpp: rmapoperations.h \
262 spectralmatricesdmasimulator.h \
266 spectralmatricesdmasimulator.h \
263 stardundee.h \
267 stardundee.h \
268 gresb.h \
264 rmappluginui.h
269 rmappluginui.h
265 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
270 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
266
271
@@ -268,6 +273,7 moc/moc_rmapplugin.cpp: rmappluginui.h \
268 rmapoperations.h \
273 rmapoperations.h \
269 spectralmatricesdmasimulator.h \
274 spectralmatricesdmasimulator.h \
270 stardundee.h \
275 stardundee.h \
276 gresb.h \
271 ccsds.h \
277 ccsds.h \
272 spwpacketreceiver.h \
278 spwpacketreceiver.h \
273 rmapplugin.h
279 rmapplugin.h
@@ -288,12 +294,17 moc/moc_spectralmatricesdmasimulator.cpp
288 moc/moc_rmappluginpythonwrapper.cpp: rmappluginpythonwrapper.h
294 moc/moc_rmappluginpythonwrapper.cpp: rmappluginpythonwrapper.h
289 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp
295 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp
290
296
291 moc/moc_stardundee.cpp: stardundee.h
297 moc/moc_stardundee.cpp: rmapoperations.h \
298 stardundee.h
292 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
299 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
293
300
294 moc/moc_gresb.cpp: gresb.h
301 moc/moc_gresb.cpp: gresb.h
295 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp
302 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp
296
303
304 moc/moc_bridge.cpp: rmapoperations.h \
305 bridge.h
306 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) bridge.h -o moc/moc_bridge.cpp
307
297 moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h
308 moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h
298 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp
309 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp
299
310
@@ -324,6 +335,7 obj/rmapplugin.o: rmapplugin.cpp rmapplu
324 rmapoperations.h \
335 rmapoperations.h \
325 spectralmatricesdmasimulator.h \
336 spectralmatricesdmasimulator.h \
326 stardundee.h \
337 stardundee.h \
338 gresb.h \
327 ccsds.h \
339 ccsds.h \
328 spwpacketreceiver.h \
340 spwpacketreceiver.h \
329 rmappluginpythonwrapper.h
341 rmappluginpythonwrapper.h
@@ -334,6 +346,7 obj/rmappluginui.o: rmappluginui.cpp rma
334 rmapoperations.h \
346 rmapoperations.h \
335 spectralmatricesdmasimulator.h \
347 spectralmatricesdmasimulator.h \
336 stardundee.h \
348 stardundee.h \
349 gresb.h \
337 ccsds.h \
350 ccsds.h \
338 spwpacketreceiver.h
351 spwpacketreceiver.h
339 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
352 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
@@ -344,7 +357,8 obj/rmapoperations.o: rmapoperations.cpp
344 obj/ccsds.o: ccsds.cpp ccsds.h
357 obj/ccsds.o: ccsds.cpp ccsds.h
345 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp
358 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp
346
359
347 obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h
360 obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h \
361 rmapoperations.h
348 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp
362 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp
349
363
350 obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h
364 obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h
@@ -366,6 +380,10 obj/stardundee.o: stardundee.cpp stardun
366 obj/gresb.o: gresb.cpp gresb.h
380 obj/gresb.o: gresb.cpp gresb.h
367 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp
381 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp
368
382
383 obj/bridge.o: bridge.cpp bridge.h \
384 rmapoperations.h
385 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/bridge.o bridge.cpp
386
369 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
387 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
370 /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h
388 /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h
371 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/lppmonplugininterface.o /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp
389 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/lppmonplugininterface.o /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp
@@ -397,6 +415,9 obj/moc_stardundee.o: moc/moc_stardundee
397 obj/moc_gresb.o: moc/moc_gresb.cpp
415 obj/moc_gresb.o: moc/moc_gresb.cpp
398 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp
416 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp
399
417
418 obj/moc_bridge.o: moc/moc_bridge.cpp
419 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_bridge.o moc/moc_bridge.cpp
420
400 obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp
421 obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp
401 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp
422 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp
402
423
@@ -3,4 +3,154
3 bridge::bridge(QWidget *parent) :
3 bridge::bridge(QWidget *parent) :
4 QWidget(parent)
4 QWidget(parent)
5 {
5 {
6 // Packet receiver
7 rmapPacketSEMAPHORE = new QSemaphore;
8 ccsdsPacketSEMAPHORE = new QSemaphore;
9 rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH);
10 ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH);
11 spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) );
12
13 bridge_LAYOUT = new QGridLayout;
6 }
14 }
15
16 bridge::~bridge()
17 {
18 free(rmapPacket);
19 free(ccsdsPacket);
20 free(spwPacket);
21 }
22
23 unsigned int bridge::Write(unsigned int *Value, unsigned int count, unsigned int address)
24 {
25 unsigned int remainingCount = count;
26 unsigned int iOffset = 0;
27 QString console_message;
28 char* data;
29
30 if(rmapPacketSEMAPHORE->available()!=0)
31 {
32 emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped");
33 return 1;
34 }
35
36 emit this->RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable");
37
38 data = (char*) malloc(READ_WRITE_MAX_COUNTS*4);
39
40 emit appendToLog(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
41
42 while (remainingCount > READ_WRITE_MAX_COUNTS)
43 {
44 for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++)
45 {
46 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
47 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
48 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
49 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
50 }
51
52 console_message.sprintf("remainingCount: %d => ", remainingCount);
53 emit appendToLog(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16));
54
55 if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0)
56 {
57 emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
58 return 1;
59 }
60
61 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
62 address = address + READ_WRITE_MAX_COUNTS * 4;
63 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
64 }
65
66 if (remainingCount > 0)
67 {
68 for (unsigned int i = 0; i<remainingCount; i++)
69 {
70 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
71 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
72 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
73 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
74 }
75
76 console_message.sprintf("remainingCount: %d => ", remainingCount);
77 emit appendToLog(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16));
78
79 if (WriteBLOCK(data, remainingCount*4, address)==0)
80 {
81 emit appendToLog("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
82 return 1;
83 }
84 }
85
86 emit appendToLog(QString("*** STOP *** WRITE"));
87 free(data);
88 return count;
89 }
90
91 unsigned int bridge::Read(unsigned int *Value, unsigned int count, unsigned int address)
92 {
93 unsigned int remainingCount = count;
94 unsigned int iOffset = 0;
95 QString console_message;
96
97 if(rmapPacketSEMAPHORE->available()!=0)
98 {
99 emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped");
100 return 1;
101 }
102 emit appendToLog(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
103
104 while (remainingCount > READ_WRITE_MAX_COUNTS)
105 {
106 console_message.sprintf("remainingCount: %d => ", remainingCount);
107 emit appendToLog(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16));
108
109 if (this->ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0)
110 {
111 emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received");
112 return 1;
113 }
114
115 for(int i=0;i<READ_WRITE_MAX_COUNTS;i++)
116 {
117 Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
118 for(int j=1;j<4;j++)
119 {
120 Value[i+iOffset]= ((unsigned char) (rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH]))
121 + Value[i+iOffset]*256;
122 }
123 }
124
125 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
126 address = address + READ_WRITE_MAX_COUNTS * 4;
127 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
128 rmapPacketSEMAPHORE->acquire();
129 }
130
131 if (remainingCount > 0)
132 {
133 console_message.sprintf("remainingCount: %d => ", remainingCount);
134 emit appendToLog(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16));
135
136 if (this->ReadBLOCK(4*remainingCount, address)==0)
137 {
138 emit appendToLog("WARNING === in function READ of rmapplugin *** RMAP packet not received");
139 return 1;
140 }
141
142 for(unsigned int i=0;i<remainingCount;i++)
143 {
144 Value[i+iOffset] = (unsigned char) rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
145 for(int j=1;j<4;j++)
146 {
147 Value[i+iOffset]= ((unsigned char)(rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
148 }
149 }
150 rmapPacketSEMAPHORE->acquire();
151 }
152
153 emit appendToLog(QString("*** STOP *** READ "));
154 return count;
155 }
156
@@ -2,17 +2,53
2 #define BRIDGE_H
2 #define BRIDGE_H
3
3
4 #include <QWidget>
4 #include <QWidget>
5 #include <QSemaphore>
6 #include <QGridLayout>
7 #include "rmapoperations.h"
5
8
6 class bridge : public QWidget
9 class bridge : public QWidget
7 {
10 {
8 Q_OBJECT
11 Q_OBJECT
9 public:
12 public:
10 explicit bridge(QWidget *parent = 0);
13 explicit bridge(QWidget *parent = 0);
11
14 ~bridge();
15 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
16 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
17 virtual unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
18 virtual unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0) = 0;
19 virtual unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0) = 0;
20 virtual unsigned int getLinkStatus(unsigned char link) = 0;
21
22 unsigned char rmapTargetLogicalAddress ;
23 unsigned char rmapSourceLogicalAddress ;
24
25 RMAP_command_codes commandCode;
26
27 QGridLayout *bridge_LAYOUT;
28
29 QSemaphore *rmapPacketSEMAPHORE;
30 QSemaphore *ccsdsPacketSEMAPHORE;
31
32 char *spwPacket;
33 char* rmapPacket;
34 unsigned char *ccsdsPacket;
35
12 signals:
36 signals:
37 void sendMessage(QString message);
38 void isOpen(bool);
39 void RMAP_write_reply_setText(QString);
40 void appendToLog(QString);
41 void ccsdsPacketAvailable(unsigned char*, unsigned int);
13
42
14 public slots:
43 public slots:
15
44 unsigned int Open();
45 unsigned int Close();
46 virtual int receiveSPWPacket(unsigned char requestID) = 0;
47 void commandCodeHasChanged(RMAP_command_codes code) {this->commandCode = code;}
48 void targetHasChanged(int target) {rmapTargetLogicalAddress = (unsigned char) target;}
49 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
50
51 private:
16 };
52 };
17
53
18 #endif // BRIDGE_H
54 #endif // BRIDGE_H
@@ -19,6 +19,11 signals:
19 public slots:
19 public slots:
20
20
21 private:
21 private:
22 //*******************
23 // specific functions
24
25 //*****************
26 // specific members
22 QLabel *gresbBridgeIPLabel;
27 QLabel *gresbBridgeIPLabel;
23 QLabel *gresbVirtualLinkLabel;
28 QLabel *gresbVirtualLinkLabel;
24 QLabel *spwLinkLabel;
29 QLabel *spwLinkLabel;
@@ -18,10 +18,8 DEFINES += driver_can_be_child=0
18 DEFINES += driver_VID=0
18 DEFINES += driver_VID=0
19 DEFINES += driver_PID=0
19 DEFINES += driver_PID=0
20
20
21
22 QT += network
21 QT += network
23
22
24
25 LIBS += ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so \
23 LIBS += ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so \
26 ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so
24 ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so
27
25
@@ -72,4 +70,3 SOURCES += \
72
70
73
71
74
72
75
@@ -15,7 +15,7 StarDundee::StarDundee(QWidget *parent)
15 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
15 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
16
16
17 rmapSourceLogicalAddress = 0x20;
17 rmapSourceLogicalAddress = 0x20;
18 connection_LAYOUT = new QGridLayout;
18 bridge_LAYOUT = new QGridLayout;
19
19
20 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
20 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
21 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
21 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
@@ -31,17 +31,16 StarDundee::StarDundee(QWidget *parent)
31 sourceLogicalAddress_SPINBOX->setRange(0,254);
31 sourceLogicalAddress_SPINBOX->setRange(0,254);
32 sourceLogicalAddress_SPINBOX->setValue(32);
32 sourceLogicalAddress_SPINBOX->setValue(32);
33
33
34 connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1);
34 bridge_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1);
35 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
35 bridge_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
36 connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1);
36 bridge_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1);
37 connection_LAYOUT->addWidget(linkNumber_SPINBOX, 1, 1, 1, 1);
37 bridge_LAYOUT->addWidget(linkNumber_SPINBOX, 1, 1, 1, 1);
38 connection_LAYOUT->addWidget(sourceLogicalAddress_LABEL, 2, 0, 1, 1);
38 bridge_LAYOUT->addWidget(sourceLogicalAddress_LABEL, 2, 0, 1, 1);
39 connection_LAYOUT->addWidget(sourceLogicalAddress_SPINBOX, 2, 1, 1, 1);
39 bridge_LAYOUT->addWidget(sourceLogicalAddress_SPINBOX, 2, 1, 1, 1);
40 bridge_LAYOUT->setRowStretch(3, 1);
41 bridge_LAYOUT->setColumnStretch(2, 1);
40
42
41 connection_LAYOUT->setRowStretch(3, 1);
43 this->setLayout(bridge_LAYOUT);
42 connection_LAYOUT->setColumnStretch(2, 1);
43
44 this->setLayout(connection_LAYOUT);
45
44
46 connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int)));
45 connect(this->sourceLogicalAddress_SPINBOX, SIGNAL(valueChanged(int)), this, SLOT(sourceHasChanged(int)));
47 }
46 }
@@ -22,7 +22,6 public:
22 ~StarDundee();
22 ~StarDundee();
23 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
23 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
24 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
24 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
25 unsigned int WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address);
26 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
25 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
27 unsigned int getLinkStatus(unsigned char link);
26 unsigned int getLinkStatus(unsigned char link);
28
27
@@ -42,17 +41,33 public slots:
42 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
41 void sourceHasChanged(int target) {rmapSourceLogicalAddress = (unsigned char) target;}
43
42
44 private:
43 private:
45 unsigned int GetRoutingTableEntry();
44 //******************
45 // general functions
46 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
46 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
47 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
47 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
48 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();}
48 void acquireRMAPSemaphore() {rmapPacketSEMAPHORE->acquire();}
49 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();}
49 void acquireCCSDSSemaphore() {ccsdsPacketSEMAPHORE->acquire();}
50
50
51 //****************
52 // general members
51 unsigned char rmapTargetLogicalAddress ;
53 unsigned char rmapTargetLogicalAddress ;
52 unsigned char rmapSourceLogicalAddress ;
54 unsigned char rmapSourceLogicalAddress ;
55 RMAP_command_codes commandCode;
56 QGridLayout *bridge_LAYOUT;
57 QSemaphore *rmapPacketSEMAPHORE;
58 QSemaphore *ccsdsPacketSEMAPHORE;
59 char* rmapPacket;
60 unsigned char *ccsdsPacket;
61 char *spwPacket;
62 unsigned int rmapPacketSize;
63 unsigned int ccsdsPacketSize;
53
64
54 RMAP_command_codes commandCode;
65 //**************************
66 // specific member functions
67 unsigned int GetRoutingTableEntry();
55
68
69 //**************************
70 // specific member variables
56 QLabel *usbDeviceNumber_LABEL;
71 QLabel *usbDeviceNumber_LABEL;
57 QLabel *linkNumber_LABEL;
72 QLabel *linkNumber_LABEL;
58 QLabel *sourceLogicalAddress_LABEL;
73 QLabel *sourceLogicalAddress_LABEL;
@@ -61,22 +76,9 private:
61 QSpinBox *linkNumber_SPINBOX;
76 QSpinBox *linkNumber_SPINBOX;
62 QSpinBox *sourceLogicalAddress_SPINBOX;
77 QSpinBox *sourceLogicalAddress_SPINBOX;
63
78
64 QGridLayout *connection_LAYOUT;
79 USB_SPACEWIRE_ID pIdentifier; // unique identifier for the send/receive operations
65
66 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
68
69 star_device_handle hDevice; // Handle to the SpaceWire device
80 star_device_handle hDevice; // Handle to the SpaceWire device
70 USB_SPACEWIRE_STATUS result; // The result of the send operation
81 USB_SPACEWIRE_STATUS result; // The result of the send operation
71
72 // Packet receiver
73 QSemaphore *rmapPacketSEMAPHORE;
74 QSemaphore *ccsdsPacketSEMAPHORE;
75 char* rmapPacket; // The buffer to receive RMAP READ packets
76 unsigned char *ccsdsPacket;
77 char *spwPacket;
78 unsigned int rmapPacketSize;
79 unsigned int ccsdsPacketSize;
80 };
82 };
81
83
82 #endif // STARDUNDEE_H
84 #endif // STARDUNDEE_H
General Comments 0
You need to be logged in to leave comments. Login now