##// END OF EJS Templates
First version with the Star Dundee bridge operational
paul@pc-solar1.lab-lpp.local -
r1:45ff379330d3 default
parent child
Show More
@@ -1,142 +1,142
1 1 #############################################################################
2 2 # Makefile for building: PAULs_LPPMON_PLUGINS
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Thu Nov 29 09:03:10 2012
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Thu Nov 29 14:02:20 2012
4 4 # Project: PAULs_LPPMON_PLUGINS.pro
5 5 # Template: subdirs
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
7 7 #############################################################################
8 8
9 9 first: make_default
10 10 MAKEFILE = Makefile
11 11 QMAKE = /usr/bin/qmake-qt4
12 12 DEL_FILE = rm -f
13 13 CHK_DIR_EXISTS= test -d
14 14 MKDIR = mkdir -p
15 15 COPY = cp -f
16 16 COPY_FILE = $(COPY)
17 17 COPY_DIR = $(COPY) -r
18 18 INSTALL_FILE = install -m 644 -p
19 19 INSTALL_PROGRAM = install -m 755 -p
20 20 INSTALL_DIR = $(COPY_DIR)
21 21 DEL_FILE = rm -f
22 22 SYMLINK = ln -f -s
23 23 DEL_DIR = rmdir
24 24 MOVE = mv -f
25 25 CHK_DIR_EXISTS= test -d
26 26 MKDIR = mkdir -p
27 27 SUBTARGETS = \
28 28 sub-rmapplugin
29 29
30 30 rmapplugin/$(MAKEFILE):
31 31 @$(CHK_DIR_EXISTS) rmapplugin/ || $(MKDIR) rmapplugin/
32 32 cd rmapplugin/ && $(QMAKE) /opt/LPPMON_PLUGINS_PAUL/rmapplugin/rmapplugin.pro -spec /usr/lib64/qt4/mkspecs/linux-g++ -o $(MAKEFILE)
33 33 sub-rmapplugin-qmake_all: FORCE
34 34 @$(CHK_DIR_EXISTS) rmapplugin/ || $(MKDIR) rmapplugin/
35 35 cd rmapplugin/ && $(QMAKE) /opt/LPPMON_PLUGINS_PAUL/rmapplugin/rmapplugin.pro -spec /usr/lib64/qt4/mkspecs/linux-g++ -o $(MAKEFILE)
36 36 sub-rmapplugin: rmapplugin/$(MAKEFILE) FORCE
37 37 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE)
38 38 sub-rmapplugin-make_default-ordered: rmapplugin/$(MAKEFILE) FORCE
39 39 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE)
40 40 sub-rmapplugin-make_default: rmapplugin/$(MAKEFILE) FORCE
41 41 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE)
42 42 sub-rmapplugin-make_first-ordered: rmapplugin/$(MAKEFILE) FORCE
43 43 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) first
44 44 sub-rmapplugin-make_first: rmapplugin/$(MAKEFILE) FORCE
45 45 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) first
46 46 sub-rmapplugin-all-ordered: rmapplugin/$(MAKEFILE) FORCE
47 47 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) all
48 48 sub-rmapplugin-all: rmapplugin/$(MAKEFILE) FORCE
49 49 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) all
50 50 sub-rmapplugin-clean-ordered: rmapplugin/$(MAKEFILE) FORCE
51 51 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) clean
52 52 sub-rmapplugin-clean: rmapplugin/$(MAKEFILE) FORCE
53 53 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) clean
54 54 sub-rmapplugin-distclean-ordered: rmapplugin/$(MAKEFILE) FORCE
55 55 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) distclean
56 56 sub-rmapplugin-distclean: rmapplugin/$(MAKEFILE) FORCE
57 57 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) distclean
58 58 sub-rmapplugin-install_subtargets-ordered: rmapplugin/$(MAKEFILE) FORCE
59 59 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) install
60 60 sub-rmapplugin-install_subtargets: rmapplugin/$(MAKEFILE) FORCE
61 61 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) install
62 62 sub-rmapplugin-uninstall_subtargets-ordered: rmapplugin/$(MAKEFILE) FORCE
63 63 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) uninstall
64 64 sub-rmapplugin-uninstall_subtargets: rmapplugin/$(MAKEFILE) FORCE
65 65 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) uninstall
66 66
67 67 Makefile: PAULs_LPPMON_PLUGINS.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
68 68 /usr/lib64/qt4/mkspecs/common/linux.conf \
69 69 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
70 70 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
71 71 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
72 72 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
73 73 /usr/lib64/qt4/mkspecs/qconfig.pri \
74 74 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \
75 75 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
76 76 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
77 77 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
78 78 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
79 79 /usr/lib64/qt4/mkspecs/features/release.prf \
80 80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
81 81 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
82 82 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
83 83 /usr/lib64/qt4/mkspecs/features/qt.prf \
84 84 /usr/lib64/qt4/mkspecs/features/unix/thread.prf \
85 85 /usr/lib64/qt4/mkspecs/features/moc.prf \
86 86 /usr/lib64/qt4/mkspecs/features/resources.prf \
87 87 /usr/lib64/qt4/mkspecs/features/uic.prf \
88 88 /usr/lib64/qt4/mkspecs/features/yacc.prf \
89 89 /usr/lib64/qt4/mkspecs/features/lex.prf \
90 90 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
91 91 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
92 92 /usr/lib64/qt4/mkspecs/common/unix.conf:
93 93 /usr/lib64/qt4/mkspecs/common/linux.conf:
94 94 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
95 95 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
96 96 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
97 97 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
98 98 /usr/lib64/qt4/mkspecs/qconfig.pri:
99 99 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri:
100 100 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
101 101 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
102 102 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
103 103 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
104 104 /usr/lib64/qt4/mkspecs/features/release.prf:
105 105 /usr/lib64/qt4/mkspecs/features/default_post.prf:
106 106 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
107 107 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
108 108 /usr/lib64/qt4/mkspecs/features/qt.prf:
109 109 /usr/lib64/qt4/mkspecs/features/unix/thread.prf:
110 110 /usr/lib64/qt4/mkspecs/features/moc.prf:
111 111 /usr/lib64/qt4/mkspecs/features/resources.prf:
112 112 /usr/lib64/qt4/mkspecs/features/uic.prf:
113 113 /usr/lib64/qt4/mkspecs/features/yacc.prf:
114 114 /usr/lib64/qt4/mkspecs/features/lex.prf:
115 115 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
116 116 qmake: qmake_all FORCE
117 117 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
118 118
119 119 qmake_all: sub-rmapplugin-qmake_all FORCE
120 120
121 121 make_default: sub-rmapplugin-make_default-ordered FORCE
122 122 make_first: sub-rmapplugin-make_first-ordered FORCE
123 123 all: sub-rmapplugin-all-ordered FORCE
124 124 clean: sub-rmapplugin-clean-ordered FORCE
125 125 distclean: sub-rmapplugin-distclean-ordered FORCE
126 126 -$(DEL_FILE) Makefile
127 127 install_subtargets: sub-rmapplugin-install_subtargets-ordered FORCE
128 128 uninstall_subtargets: sub-rmapplugin-uninstall_subtargets-ordered FORCE
129 129
130 130 sub-rmapplugin-check_ordered: rmapplugin/$(MAKEFILE)
131 131 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) check
132 132 check: sub-rmapplugin-check_ordered
133 133
134 134 mocclean: compiler_moc_header_clean compiler_moc_source_clean
135 135
136 136 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
137 137 install: install_subtargets FORCE
138 138
139 139 uninstall: uninstall_subtargets FORCE
140 140
141 141 FORCE:
142 142
@@ -1,264 +1,264
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2012-11-29T13:08:48. -->
3 <!-- Written by Qt Creator 2.4.1, 2012-12-06T08:47:47. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 7 <value type="int">0</value>
8 8 </data>
9 9 <data>
10 10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 11 <valuemap type="QVariantMap">
12 12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 14 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 15 <value type="QString" key="language">Cpp</value>
16 16 <valuemap type="QVariantMap" key="value">
17 17 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 18 </valuemap>
19 19 </valuemap>
20 20 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 21 <value type="QString" key="language">QmlJS</value>
22 22 <valuemap type="QVariantMap" key="value">
23 23 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 24 </valuemap>
25 25 </valuemap>
26 26 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 27 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
28 28 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 29 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 30 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
31 31 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
32 32 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
33 33 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
34 34 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
35 35 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
36 36 <value type="int" key="EditorConfiguration.TabSize">8</value>
37 37 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
38 38 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
39 39 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
40 40 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
41 41 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
42 42 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
43 43 </valuemap>
44 44 </data>
45 45 <data>
46 46 <variable>ProjectExplorer.Project.PluginSettings</variable>
47 47 <valuemap type="QVariantMap"/>
48 48 </data>
49 49 <data>
50 50 <variable>ProjectExplorer.Project.Target.0</variable>
51 51 <valuemap type="QVariantMap">
52 52 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
53 53 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
54 54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
55 55 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
56 56 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
57 57 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
58 58 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
59 59 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
60 60 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
61 61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
62 62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
63 63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
64 64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
65 65 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
66 66 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
67 67 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
68 68 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
69 69 </valuemap>
70 70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
71 71 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
72 72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
73 73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
74 74 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
75 75 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
76 76 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
77 77 </valuemap>
78 78 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
79 79 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
80 80 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
81 81 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
82 82 </valuemap>
83 83 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
84 84 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
85 85 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
86 86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
87 87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
88 88 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
89 89 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
90 90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
91 91 </valuemap>
92 92 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
93 93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
94 94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
96 96 </valuemap>
97 97 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
98 98 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
99 99 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
100 100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
101 101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
102 102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
103 103 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
104 104 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
105 105 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
106 106 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
107 107 </valuemap>
108 108 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
109 109 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
110 110 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
111 111 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
112 112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
113 113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
115 115 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
116 116 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
117 117 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
118 118 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
119 119 </valuemap>
120 120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
121 121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
122 122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
123 123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
124 124 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
125 125 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
126 126 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
127 127 </valuemap>
128 128 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
129 129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
130 130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
131 131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
132 132 </valuemap>
133 133 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
134 134 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
135 135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
136 136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
137 137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
138 138 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
139 139 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
140 140 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
141 141 </valuemap>
142 142 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
143 143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
144 144 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145 145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
146 146 </valuemap>
147 147 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
148 148 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
149 149 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
150 150 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
151 151 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
152 152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
153 153 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
154 154 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
155 155 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
156 156 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
157 157 </valuemap>
158 158 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
159 159 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
160 160 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
161 161 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
162 162 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
163 163 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
164 164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
165 165 </valuemap>
166 166 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
167 167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
168 168 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
169 169 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
170 170 </valuemap>
171 171 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
172 172 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
173 173 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
174 174 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
175 175 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
176 176 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
177 177 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
178 178 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
179 179 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
180 180 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
181 181 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
182 182 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
183 183 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
184 184 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
185 185 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
186 186 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
187 187 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
188 188 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
189 189 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
190 190 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
191 191 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
192 192 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
193 193 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
194 194 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
195 195 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
196 196 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
197 197 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
198 198 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
199 199 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
200 200 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
201 201 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
202 202 <value type="int">0</value>
203 203 <value type="int">1</value>
204 204 <value type="int">2</value>
205 205 <value type="int">3</value>
206 206 <value type="int">4</value>
207 207 <value type="int">5</value>
208 208 <value type="int">6</value>
209 209 <value type="int">7</value>
210 210 <value type="int">8</value>
211 211 <value type="int">9</value>
212 212 <value type="int">10</value>
213 213 <value type="int">11</value>
214 214 <value type="int">12</value>
215 215 <value type="int">13</value>
216 216 <value type="int">14</value>
217 217 </valuelist>
218 218 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
219 219 <value type="int">0</value>
220 220 <value type="int">1</value>
221 221 <value type="int">2</value>
222 222 <value type="int">3</value>
223 223 <value type="int">4</value>
224 224 <value type="int">5</value>
225 225 <value type="int">6</value>
226 226 <value type="int">7</value>
227 227 <value type="int">8</value>
228 228 <value type="int">9</value>
229 229 <value type="int">10</value>
230 230 <value type="int">11</value>
231 231 <value type="int">12</value>
232 232 <value type="int">13</value>
233 233 <value type="int">14</value>
234 234 </valuelist>
235 235 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
236 236 <value type="int" key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase">2</value>
237 237 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">lppmon</value>
238 238 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
239 239 <valuelist type="QVariantList" key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"/>
240 240 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
241 241 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run lppmon</value>
242 242 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
243 243 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
244 244 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
245 245 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
246 246 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
247 247 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
248 248 </valuemap>
249 249 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
250 250 </valuemap>
251 251 </data>
252 252 <data>
253 253 <variable>ProjectExplorer.Project.TargetCount</variable>
254 254 <value type="int">1</value>
255 255 </data>
256 256 <data>
257 257 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
258 258 <value type="QString">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
259 259 </data>
260 260 <data>
261 261 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
262 262 <value type="int">10</value>
263 263 </data>
264 264 </qtcreator>
@@ -1,410 +1,428
1 1 #############################################################################
2 2 # Makefile for building: librmapplugin.so.1.0.0
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Thu Nov 29 09:38:20 2012
3 # Generated by qmake (2.01a) (Qt 4.8.3) on: Mon Dec 3 13:45:43 2012
4 4 # Project: rmapplugin.pro
5 5 # Template: lib
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
7 7 #############################################################################
8 8
9 9 ####### Compiler, tools and options
10 10
11 11 CC = gcc
12 12 CXX = g++
13 13 DEFINES = -DPLUGIN=rmapplugin -DPLUGINHEADER="\"rmapplugin.h\"" -Ddriver_Name="\"RMAPPlugin\"" -Ddriver_Author="\"Paul Leroy paul.leroy@lpp.polytechnique.fr\"" -Ddriver_Version="\"1.1.2\"" -Ddriver_Description="\"AHB bus controler, works with Gaisler's AHB plugn' play bus.\"" -Ddriver_can_be_root=1 -Ddriver_can_be_child=0 -Ddriver_VID=0 -Ddriver_PID=0 -DUNIXTRANSLATIONPATH -DLPPMON_PLUGINS_INSTALL_PATH="QDir::homePath()+\"/.lppmon/plugins\"" -DLPPMON_TRANSLATION_PATH="\"/etc/lppmon/translations\"" -DLPPMONPLUGIN_LIBRARY -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
14 14 CFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
15 15 CXXFLAGS = -pipe -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -O2 -I/usr/include/python2.7 -I/usr/include/python2.7 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include/QtGui -I/usr/include -I. -I../common_PLE -I../spw_usb_driver_v2.61/inc -I/usr/include/lppmon/pluginsInterface -I/usr/include/PythonQt -Imoc
17 17 LINK = g++
18 18 LFLAGS = -Wl,-O1 -Wl,-z,relro -shared -Wl,-soname,librmapplugin.so.1
19 LIBS = $(SUBLIBS) -L/usr/lib64 ../spw_usb_driver_v2.61/lib/libSpaceWireUSBAPI.so -ldl -lutil -lm -lpython2.7 -lPythonQt_QtAll -lPythonQt -lQtGui -lQtNetwork -lQtCore -lpthread
19 LIBS = $(SUBLIBS) -L/usr/lib64 ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so -ldl -lutil -lm -lpython2.7 -lPythonQt_QtAll -lPythonQt -lQtGui -lQtNetwork -lQtCore -lpthread
20 20 AR = ar cqs
21 21 RANLIB =
22 22 QMAKE = /usr/bin/qmake-qt4
23 23 TAR = tar -cf
24 24 COMPRESS = gzip -9f
25 25 COPY = cp -f
26 26 SED = sed
27 27 COPY_FILE = $(COPY)
28 28 COPY_DIR = $(COPY) -r
29 29 STRIP =
30 30 INSTALL_FILE = install -m 644 -p
31 31 INSTALL_DIR = $(COPY_DIR)
32 32 INSTALL_PROGRAM = install -m 755 -p
33 33 DEL_FILE = rm -f
34 34 SYMLINK = ln -f -s
35 35 DEL_DIR = rmdir
36 36 MOVE = mv -f
37 37 CHK_DIR_EXISTS= test -d
38 38 MKDIR = mkdir -p
39 39
40 40 ####### Output directory
41 41
42 42 OBJECTS_DIR = obj/
43 43
44 44 ####### Files
45 45
46 46 SOURCES = rmapplugin.cpp \
47 47 rmappluginui.cpp \
48 48 rmapoperations.cpp \
49 49 ccsds.cpp \
50 50 spwpacketreceiver.cpp \
51 51 ../common_PLE/qipdialogbox.cpp \
52 52 ../common_PLE/gresbstatusenquiry.cpp \
53 53 spectralmatricesdmasimulator.cpp \
54 54 rmappluginpythonwrapper.cpp \
55 55 stardundee.cpp \
56 gresb.cpp \
56 57 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
57 58 moc/moc_rmapplugin.cpp \
58 59 moc/moc_spwpacketreceiver.cpp \
59 60 moc/moc_qipdialogbox.cpp \
60 61 moc/moc_gresbstatusenquiry.cpp \
61 62 moc/moc_spectralmatricesdmasimulator.cpp \
62 63 moc/moc_rmappluginpythonwrapper.cpp \
63 64 moc/moc_stardundee.cpp \
65 moc/moc_gresb.cpp \
64 66 moc/moc_genericPySysdriver.cpp \
65 67 moc/moc_lppmonplugin.cpp
66 68 OBJECTS = obj/rmapplugin.o \
67 69 obj/rmappluginui.o \
68 70 obj/rmapoperations.o \
69 71 obj/ccsds.o \
70 72 obj/spwpacketreceiver.o \
71 73 obj/qipdialogbox.o \
72 74 obj/gresbstatusenquiry.o \
73 75 obj/spectralmatricesdmasimulator.o \
74 76 obj/rmappluginpythonwrapper.o \
75 77 obj/stardundee.o \
78 obj/gresb.o \
76 79 obj/lppmonplugininterface.o \
77 80 obj/moc_rmappluginui.o \
78 81 obj/moc_rmapplugin.o \
79 82 obj/moc_spwpacketreceiver.o \
80 83 obj/moc_qipdialogbox.o \
81 84 obj/moc_gresbstatusenquiry.o \
82 85 obj/moc_spectralmatricesdmasimulator.o \
83 86 obj/moc_rmappluginpythonwrapper.o \
84 87 obj/moc_stardundee.o \
88 obj/moc_gresb.o \
85 89 obj/moc_genericPySysdriver.o \
86 90 obj/moc_lppmonplugin.o
87 91 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
88 92 /usr/lib64/qt4/mkspecs/common/linux.conf \
89 93 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
90 94 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
91 95 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
92 96 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
93 97 /usr/lib64/qt4/mkspecs/qconfig.pri \
94 98 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \
95 99 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
96 100 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
97 101 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
98 102 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
99 103 /usr/lib64/qt4/mkspecs/features/release.prf \
100 104 /usr/lib64/qt4/mkspecs/features/default_post.prf \
101 105 /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf \
102 106 /usr/lib64/qt4/mkspecs/features/pythonqt.prf \
103 107 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
104 108 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
105 109 /usr/lib64/qt4/mkspecs/features/qt.prf \
106 110 /usr/lib64/qt4/mkspecs/features/unix/thread.prf \
107 111 /usr/lib64/qt4/mkspecs/features/moc.prf \
108 112 /usr/lib64/qt4/mkspecs/features/resources.prf \
109 113 /usr/lib64/qt4/mkspecs/features/uic.prf \
110 114 /usr/lib64/qt4/mkspecs/features/yacc.prf \
111 115 /usr/lib64/qt4/mkspecs/features/lex.prf \
112 116 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
113 117 rmapplugin.pro
114 118 QMAKE_TARGET = rmapplugin
115 119 DESTDIR = bin/
116 120 TARGET = librmapplugin.so.1.0.0
117 121 TARGETA = bin/librmapplugin.a
118 122 TARGETD = librmapplugin.so.1.0.0
119 123 TARGET0 = librmapplugin.so
120 124 TARGET1 = librmapplugin.so.1
121 125 TARGET2 = librmapplugin.so.1.0
122 126
123 127 first: all
124 128 ####### Implicit rules
125 129
126 130 .SUFFIXES: .o .c .cpp .cc .cxx .C
127 131
128 132 .cpp.o:
129 133 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
130 134
131 135 .cc.o:
132 136 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
133 137
134 138 .cxx.o:
135 139 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
136 140
137 141 .C.o:
138 142 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
139 143
140 144 .c.o:
141 145 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
142 146
143 147 ####### Build rules
144 148
145 149 all: Makefile bin/$(TARGET)
146 150
147 151 bin/$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP)
148 152 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
149 153 -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
150 154 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)
151 155 -ln -s $(TARGET) $(TARGET0)
152 156 -ln -s $(TARGET) $(TARGET1)
153 157 -ln -s $(TARGET) $(TARGET2)
154 158 -$(DEL_FILE) bin/$(TARGET)
155 159 -$(DEL_FILE) bin/$(TARGET0)
156 160 -$(DEL_FILE) bin/$(TARGET1)
157 161 -$(DEL_FILE) bin/$(TARGET2)
158 162 -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) bin/
159 163
160 164
161 165
162 166 staticlib: $(TARGETA)
163 167
164 168 $(TARGETA): $(OBJECTS) $(OBJCOMP)
165 169 -$(DEL_FILE) $(TARGETA)
166 170 $(AR) $(TARGETA) $(OBJECTS)
167 171
168 172 Makefile: rmapplugin.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
169 173 /usr/lib64/qt4/mkspecs/common/linux.conf \
170 174 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
171 175 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
172 176 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
173 177 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
174 178 /usr/lib64/qt4/mkspecs/qconfig.pri \
175 179 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \
176 180 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
177 181 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
178 182 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
179 183 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
180 184 /usr/lib64/qt4/mkspecs/features/release.prf \
181 185 /usr/lib64/qt4/mkspecs/features/default_post.prf \
182 186 /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf \
183 187 /usr/lib64/qt4/mkspecs/features/pythonqt.prf \
184 188 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
185 189 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
186 190 /usr/lib64/qt4/mkspecs/features/qt.prf \
187 191 /usr/lib64/qt4/mkspecs/features/unix/thread.prf \
188 192 /usr/lib64/qt4/mkspecs/features/moc.prf \
189 193 /usr/lib64/qt4/mkspecs/features/resources.prf \
190 194 /usr/lib64/qt4/mkspecs/features/uic.prf \
191 195 /usr/lib64/qt4/mkspecs/features/yacc.prf \
192 196 /usr/lib64/qt4/mkspecs/features/lex.prf \
193 197 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
194 198 /usr/lib64/libQtGui.prl \
195 199 /usr/lib64/libQtCore.prl \
196 200 /usr/lib64/libQtNetwork.prl
197 201 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
198 202 /usr/lib64/qt4/mkspecs/common/unix.conf:
199 203 /usr/lib64/qt4/mkspecs/common/linux.conf:
200 204 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
201 205 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
202 206 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
203 207 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
204 208 /usr/lib64/qt4/mkspecs/qconfig.pri:
205 209 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri:
206 210 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
207 211 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
208 212 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
209 213 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
210 214 /usr/lib64/qt4/mkspecs/features/release.prf:
211 215 /usr/lib64/qt4/mkspecs/features/default_post.prf:
212 216 /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf:
213 217 /usr/lib64/qt4/mkspecs/features/pythonqt.prf:
214 218 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
215 219 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
216 220 /usr/lib64/qt4/mkspecs/features/qt.prf:
217 221 /usr/lib64/qt4/mkspecs/features/unix/thread.prf:
218 222 /usr/lib64/qt4/mkspecs/features/moc.prf:
219 223 /usr/lib64/qt4/mkspecs/features/resources.prf:
220 224 /usr/lib64/qt4/mkspecs/features/uic.prf:
221 225 /usr/lib64/qt4/mkspecs/features/yacc.prf:
222 226 /usr/lib64/qt4/mkspecs/features/lex.prf:
223 227 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
224 228 /usr/lib64/libQtGui.prl:
225 229 /usr/lib64/libQtCore.prl:
226 230 /usr/lib64/libQtNetwork.prl:
227 231 qmake: FORCE
228 232 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
229 233
230 234 dist:
231 235 @$(CHK_DIR_EXISTS) obj/rmapplugin1.0.0 || $(MKDIR) obj/rmapplugin1.0.0
232 $(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 /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 /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 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
233 237
234 238
235 239 clean:compiler_clean
236 240 -$(DEL_FILE) $(OBJECTS)
237 241 -$(DEL_FILE) *~ core *.core
238 242
239 243
240 244 ####### Sub-libraries
241 245
242 246 distclean: clean
243 247 -$(DEL_FILE) bin/$(TARGET)
244 248 -$(DEL_FILE) bin/$(TARGET0) bin/$(TARGET1) bin/$(TARGET2) $(TARGETA)
245 249 -$(DEL_FILE) Makefile
246 250
247 251
248 252 check: first
249 253
250 254 mocclean: compiler_moc_header_clean compiler_moc_source_clean
251 255
252 256 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
253 257
254 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_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
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
255 259 compiler_moc_header_clean:
256 -$(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_genericPySysdriver.cpp moc/moc_lppmonplugin.cpp
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
257 261 moc/moc_rmappluginui.cpp: rmapoperations.h \
258 262 spectralmatricesdmasimulator.h \
263 stardundee.h \
259 264 rmappluginui.h
260 265 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
261 266
262 267 moc/moc_rmapplugin.cpp: rmappluginui.h \
263 268 rmapoperations.h \
264 269 spectralmatricesdmasimulator.h \
270 stardundee.h \
265 271 ccsds.h \
266 272 spwpacketreceiver.h \
267 273 rmapplugin.h
268 274 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp
269 275
270 276 moc/moc_spwpacketreceiver.cpp: spwpacketreceiver.h
271 277 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spwpacketreceiver.h -o moc/moc_spwpacketreceiver.cpp
272 278
273 279 moc/moc_qipdialogbox.cpp: ../common_PLE/qipdialogbox.h
274 280 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/qipdialogbox.h -o moc/moc_qipdialogbox.cpp
275 281
276 282 moc/moc_gresbstatusenquiry.cpp: ../common_PLE/gresbstatusenquiry.h
277 283 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/gresbstatusenquiry.h -o moc/moc_gresbstatusenquiry.cpp
278 284
279 285 moc/moc_spectralmatricesdmasimulator.cpp: spectralmatricesdmasimulator.h
280 286 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spectralmatricesdmasimulator.h -o moc/moc_spectralmatricesdmasimulator.cpp
281 287
282 288 moc/moc_rmappluginpythonwrapper.cpp: rmappluginpythonwrapper.h
283 289 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp
284 290
285 291 moc/moc_stardundee.cpp: stardundee.h
286 292 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
287 293
294 moc/moc_gresb.cpp: gresb.h
295 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) gresb.h -o moc/moc_gresb.cpp
296
288 297 moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h
289 298 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp
290 299
291 300 moc/moc_lppmonplugin.cpp: /usr/include/lppmonplugin.h
292 301 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/lppmonplugin.h -o moc/moc_lppmonplugin.cpp
293 302
294 303 compiler_rcc_make_all:
295 304 compiler_rcc_clean:
296 305 compiler_image_collection_make_all: qmake_image_collection.cpp
297 306 compiler_image_collection_clean:
298 307 -$(DEL_FILE) qmake_image_collection.cpp
299 308 compiler_moc_source_make_all:
300 309 compiler_moc_source_clean:
301 310 compiler_uic_make_all:
302 311 compiler_uic_clean:
303 312 compiler_yacc_decl_make_all:
304 313 compiler_yacc_decl_clean:
305 314 compiler_yacc_impl_make_all:
306 315 compiler_yacc_impl_clean:
307 316 compiler_lex_make_all:
308 317 compiler_lex_clean:
309 318 compiler_clean: compiler_moc_header_clean
310 319
311 320 ####### Compile
312 321
313 322 obj/rmapplugin.o: rmapplugin.cpp rmapplugin.h \
314 323 rmappluginui.h \
315 324 rmapoperations.h \
316 325 spectralmatricesdmasimulator.h \
326 stardundee.h \
317 327 ccsds.h \
318 328 spwpacketreceiver.h \
319 329 rmappluginpythonwrapper.h
320 330 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp
321 331
322 332 obj/rmappluginui.o: rmappluginui.cpp rmapplugin.h \
323 333 rmappluginui.h \
324 334 rmapoperations.h \
325 335 spectralmatricesdmasimulator.h \
336 stardundee.h \
326 337 ccsds.h \
327 338 spwpacketreceiver.h
328 339 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
329 340
330 341 obj/rmapoperations.o: rmapoperations.cpp rmapoperations.h
331 342 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapoperations.o rmapoperations.cpp
332 343
333 344 obj/ccsds.o: ccsds.cpp ccsds.h
334 345 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp
335 346
336 347 obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h
337 348 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp
338 349
339 350 obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h
340 351 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qipdialogbox.o ../common_PLE/qipdialogbox.cpp
341 352
342 353 obj/gresbstatusenquiry.o: ../common_PLE/gresbstatusenquiry.cpp ../common_PLE/gresbstatusenquiry.h
343 354 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresbstatusenquiry.o ../common_PLE/gresbstatusenquiry.cpp
344 355
345 356 obj/spectralmatricesdmasimulator.o: spectralmatricesdmasimulator.cpp spectralmatricesdmasimulator.h
346 357 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spectralmatricesdmasimulator.o spectralmatricesdmasimulator.cpp
347 358
348 359 obj/rmappluginpythonwrapper.o: rmappluginpythonwrapper.cpp rmappluginpythonwrapper.h
349 360 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginpythonwrapper.o rmappluginpythonwrapper.cpp
350 361
351 obj/stardundee.o: stardundee.cpp stardundee.h
362 obj/stardundee.o: stardundee.cpp stardundee.h \
363 rmapoperations.h
352 364 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp
353 365
366 obj/gresb.o: gresb.cpp gresb.h
367 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresb.o gresb.cpp
368
354 369 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
355 370 /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h
356 371 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/lppmonplugininterface.o /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp
357 372
358 373 obj/moc_rmappluginui.o: moc/moc_rmappluginui.cpp
359 374 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmappluginui.o moc/moc_rmappluginui.cpp
360 375
361 376 obj/moc_rmapplugin.o: moc/moc_rmapplugin.cpp
362 377 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmapplugin.o moc/moc_rmapplugin.cpp
363 378
364 379 obj/moc_spwpacketreceiver.o: moc/moc_spwpacketreceiver.cpp
365 380 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_spwpacketreceiver.o moc/moc_spwpacketreceiver.cpp
366 381
367 382 obj/moc_qipdialogbox.o: moc/moc_qipdialogbox.cpp
368 383 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_qipdialogbox.o moc/moc_qipdialogbox.cpp
369 384
370 385 obj/moc_gresbstatusenquiry.o: moc/moc_gresbstatusenquiry.cpp
371 386 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresbstatusenquiry.o moc/moc_gresbstatusenquiry.cpp
372 387
373 388 obj/moc_spectralmatricesdmasimulator.o: moc/moc_spectralmatricesdmasimulator.cpp
374 389 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_spectralmatricesdmasimulator.o moc/moc_spectralmatricesdmasimulator.cpp
375 390
376 391 obj/moc_rmappluginpythonwrapper.o: moc/moc_rmappluginpythonwrapper.cpp
377 392 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmappluginpythonwrapper.o moc/moc_rmappluginpythonwrapper.cpp
378 393
379 394 obj/moc_stardundee.o: moc/moc_stardundee.cpp
380 395 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_stardundee.o moc/moc_stardundee.cpp
381 396
397 obj/moc_gresb.o: moc/moc_gresb.cpp
398 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresb.o moc/moc_gresb.cpp
399
382 400 obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp
383 401 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp
384 402
385 403 obj/moc_lppmonplugin.o: moc/moc_lppmonplugin.cpp
386 404 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_lppmonplugin.o moc/moc_lppmonplugin.cpp
387 405
388 406 ####### Install
389 407
390 408 install_target: first FORCE
391 409 @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/ || $(MKDIR) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/
392 410 -$(INSTALL_PROGRAM) "bin/$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET)"
393 411 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET0)"
394 412 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET1)"
395 413 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET2)"
396 414
397 415 uninstall_target: FORCE
398 416 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET)"
399 417 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET0)"
400 418 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET1)"
401 419 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET2)"
402 420 -$(DEL_DIR) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/
403 421
404 422
405 423 install: install_target FORCE
406 424
407 425 uninstall: uninstall_target FORCE
408 426
409 427 FORCE:
410 428
@@ -1,95 +1,95
1 1 #include "rmapoperations.h"
2 2
3 3 RMAP::RMAP(RMAP_command_codes commandCode, char targetLogicalAddress, char initiatorLogicalAddress, int startAddress, int nbBytes, char* data)
4 4 {
5 5 char packetType; // 2 most Significant Bits
6 6 char command; // 4 bits
7 7 char replyAddressLength; // 2 Least Significant Bits
8 8 int SPWPacketSize;
9 9
10 10 // GRESB HEADER
11 11 if (data == NULL){
12 12 SPWPacketSize = sizeof(RMAPHeader) ;
13 13 dataCRC = 0x00;
14 14 }
15 15 else{
16 16 SPWPacketSize = sizeof(RMAPHeader) + nbBytes + 1 ; // SPW Packet = Header + Data + dataCRC
17 17 dataCRC = RMAPCalculateDataCRC(data, nbBytes);
18 18 }
19 GRESBHeader.GRESBProtocoleID = 0x00; // packets with protocole ID 0 have SpaceWire a packet as payload
19 GRESBHeader.GRESBProtocoleID = 0x00; // packets with protocole ID 0 have a SpaceWire packet as payload
20 20 GRESBHeader.SPWPacketSize2 = (SPWPacketSize>>16);
21 21 GRESBHeader.SPWPacketSize1 = (SPWPacketSize>>8);
22 22 GRESBHeader.SPWPacketSize0 = (SPWPacketSize);
23 23
24 24 // SPACEWIRE HEADER
25 25 packetType = (char) 0b01; // 0b01 for a command, 0b00 for a reply
26 26 command = (char) commandCode;
27 27 replyAddressLength = (char) 0b00; // RMAP command: number of bytes in the reply address field
28 28 // RMAP reply: copy of the reply address field of the command
29 29 switch (commandCode){
30 30 case writeSingle_noVer_noRep:
31 31 case writeSingle_noVer_Rep:
32 32 case writeSingle_ver_noRep:
33 33 case writeSingle_ver_rep:
34 34 if (nbBytes > 4) command = command + 1; // switch between Single and Incremental Read/Write operations
35 35 break;
36 36 default:
37 37 break;
38 38 }
39 39 RMAPHeader.targetLogicalAddress = targetLogicalAddress ;
40 40 RMAPHeader.protocolIdentifier = 0x01; // 0x01 is the protocole identifier for RMAP
41 41 RMAPHeader.instruction = (packetType<<6) + (command<<2) + (replyAddressLength);
42 42 RMAPHeader.key = 0; // used for command authorization
43 43 RMAPHeader.initiatorLogicalAddress = initiatorLogicalAddress; // 0 is the default address for the GRESB module
44 44 RMAPHeader.transactionIdentifier1 = 0x00;
45 45 RMAPHeader.transactionIdentifier0 = 0x01;
46 46 RMAPHeader.extendedAddress = 0x00;
47 47 RMAPHeader.address3 = (char) (startAddress>>24);
48 48 RMAPHeader.address2 = (char) (startAddress>>16);
49 49 RMAPHeader.address1 = (char) (startAddress>>8);
50 50 RMAPHeader.address0 = (char) (startAddress);
51 51 RMAPHeader.dataLength2 = (char) (nbBytes>>16);
52 52 RMAPHeader.dataLength1 = (char) (nbBytes>>8);
53 53 RMAPHeader.dataLength0 = (char) (nbBytes);
54 54 RMAPHeader.headerCRC = RMAPCalculateHeaderCRC();
55 55 }
56 56
57 57 unsigned char RMAP::RMAPCalculateCRC(unsigned char INCR, unsigned char INBYTE)
58 58 {
59 59 return RMAP_CRCTable[INCR ^ INBYTE];
60 60 }
61 61
62 62 unsigned char RMAP::RMAPCalculateHeaderCRC()
63 63 {
64 64 unsigned char INCR = 0;
65 65
66 66 INCR = RMAPCalculateCRC(INCR, RMAPHeader.targetLogicalAddress);
67 67 INCR = RMAPCalculateCRC(INCR, RMAPHeader.protocolIdentifier);
68 68 INCR = RMAPCalculateCRC(INCR, RMAPHeader.instruction);
69 69 INCR = RMAPCalculateCRC(INCR, RMAPHeader.key);
70 70 INCR = RMAPCalculateCRC(INCR, RMAPHeader.initiatorLogicalAddress);
71 71 INCR = RMAPCalculateCRC(INCR, RMAPHeader.transactionIdentifier1);
72 72 INCR = RMAPCalculateCRC(INCR, RMAPHeader.transactionIdentifier0);
73 73 INCR = RMAPCalculateCRC(INCR, RMAPHeader.extendedAddress);
74 74 INCR = RMAPCalculateCRC(INCR, RMAPHeader.address3);
75 75 INCR = RMAPCalculateCRC(INCR, RMAPHeader.address2);
76 76 INCR = RMAPCalculateCRC(INCR, RMAPHeader.address1);
77 77 INCR = RMAPCalculateCRC(INCR, RMAPHeader.address0);
78 78 INCR = RMAPCalculateCRC(INCR, RMAPHeader.dataLength2);
79 79 INCR = RMAPCalculateCRC(INCR, RMAPHeader.dataLength1);
80 80 INCR = RMAPCalculateCRC(INCR, RMAPHeader.dataLength0);
81 81
82 82 return(INCR);
83 83 }
84 84
85 85 unsigned char RMAP::RMAPCalculateDataCRC(char *data, int nbBytes)
86 86 {
87 87 unsigned char INCR = 0;
88 88
89 89 for (int k=0; k<nbBytes; k++)
90 90 {
91 91 INCR = RMAPCalculateCRC(INCR, data[k]);
92 92 }
93 93
94 94 return(INCR);
95 95 }
@@ -1,140 +1,148
1 1 #ifndef RMAPOPERATIONS_H
2 2 #define RMAPOPERATIONS_H
3 3
4 4 #include "qhexspinbox.h"
5 5
6 #define READ_WRITE_MAX_COUNTS 4096 // in words
7 #define RMAP_MAX_DATA_LENGTH 4*READ_WRITE_MAX_COUNTS // in bytes, shall be lower than the limit size of SPW packet of the GRESB bridge
8 #define RMAP_READ_REPLY_HEADER_LENGTH 12 // in bytes => ECSS
9 #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS
10 #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS
11 #define RMAP_MAX_PACKET_LENGTH RMAP_READ_REPLY_HEADER_LENGTH + RMAP_MAX_DATA_LENGTH + RMAP_DATA_CRC_LENGTH
12 #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
13
6 14 static const unsigned char RMAP_CRCTable[] = {
7 15 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75,
8 16 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b,
9 17 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69,
10 18 0x12, 0x83, 0xf1, 0x60, 0x15, 0x84, 0xf6, 0x67,
11 19 0x38, 0xa9, 0xdb, 0x4a, 0x3f, 0xae, 0xdc, 0x4d,
12 20 0x36, 0xa7, 0xd5, 0x44, 0x31, 0xa0, 0xd2, 0x43,
13 21 0x24, 0xb5, 0xc7, 0x56, 0x23, 0xb2, 0xc0, 0x51,
14 22 0x2a, 0xbb, 0xc9, 0x58, 0x2d, 0xbc, 0xce, 0x5f,
15 23 0x70, 0xe1, 0x93, 0x02, 0x77, 0xe6, 0x94, 0x05,
16 24 0x7e, 0xef, 0x9d, 0x0c, 0x79, 0xe8, 0x9a, 0x0b,
17 25 0x6c, 0xfd, 0x8f, 0x1e, 0x6b, 0xfa, 0x88, 0x19,
18 26 0x62, 0xf3, 0x81, 0x10, 0x65, 0xf4, 0x86, 0x17,
19 27 0x48, 0xd9, 0xab, 0x3a, 0x4f, 0xde, 0xac, 0x3d,
20 28 0x46, 0xd7, 0xa5, 0x34, 0x41, 0xd0, 0xa2, 0x33,
21 29 0x54, 0xc5, 0xb7, 0x26, 0x53, 0xc2, 0xb0, 0x21,
22 30 0x5a, 0xcb, 0xb9, 0x28, 0x5d, 0xcc, 0xbe, 0x2f,
23 31 0xe0, 0x71, 0x03, 0x92, 0xe7, 0x76, 0x04, 0x95,
24 32 0xee, 0x7f, 0x0d, 0x9c, 0xe9, 0x78, 0x0a, 0x9b,
25 33 0xfc, 0x6d, 0x1f, 0x8e, 0xfb, 0x6a, 0x18, 0x89,
26 34 0xf2, 0x63, 0x11, 0x80, 0xf5, 0x64, 0x16, 0x87,
27 35 0xd8, 0x49, 0x3b, 0xaa, 0xdf, 0x4e, 0x3c, 0xad,
28 36 0xd6, 0x47, 0x35, 0xa4, 0xd1, 0x40, 0x32, 0xa3,
29 37 0xc4, 0x55, 0x27, 0xb6, 0xc3, 0x52, 0x20, 0xb1,
30 38 0xca, 0x5b, 0x29, 0xb8, 0xcd, 0x5c, 0x2e, 0xbf,
31 39 0x90, 0x01, 0x73, 0xe2, 0x97, 0x06, 0x74, 0xe5,
32 40 0x9e, 0x0f, 0x7d, 0xec, 0x99, 0x08, 0x7a, 0xeb,
33 41 0x8c, 0x1d, 0x6f, 0xfe, 0x8b, 0x1a, 0x68, 0xf9,
34 42 0x82, 0x13, 0x61, 0xf0, 0x85, 0x14, 0x66, 0xf7,
35 43 0xa8, 0x39, 0x4b, 0xda, 0xaf, 0x3e, 0x4c, 0xdd,
36 44 0xa6, 0x37, 0x45, 0xd4, 0xa1, 0x30, 0x42, 0xd3,
37 45 0xb4, 0x25, 0x57, 0xc6, 0xb3, 0x22, 0x50, 0xc1,
38 46 0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf
39 47 };
40 48
41 49 enum RMAP_command_codes{
42 50 invalid0, //0000
43 51 invalid1, //0001
44 52 read_Single, //0010
45 53 read_Inc, //0011
46 54 invalid2, //0100
47 55 invalid3, //0101
48 56 invalid4, //0110
49 57 readModWri_Inc, //0111
50 58 writeSingle_noVer_noRep, //1000
51 59 writeInc_noVer_noRep, //1001
52 60 writeSingle_noVer_Rep, //1010
53 61 writeInc_noVer_Rep, //1011
54 62 writeSingle_ver_noRep, //1100
55 63 writeInc_ver_noRep, //1101
56 64 writeSingle_ver_rep, //1110
57 65 writeInc_ver_rep //1111
58 66 };
59 67
60 68 struct rmap_command_format_str
61 69 {
62 70 // char tagetSpaceWireAddress[]; // used for path addressing or regional addressing
63 71 char targetLogicalAddress;
64 72 char protocolIdentifier;
65 73 char instruction;
66 74 char key; // used for command authorization => check Gaisler GRSPW for compliance
67 75 //char replyAddress[]; // not needed if logical addressing is used (replyAddressLength = 0b00)
68 76 char initiatorLogicalAddress;
69 77 char transactionIdentifier1;
70 78 char transactionIdentifier0;
71 79 char extendedAddress;
72 80 char address3;
73 81 char address2;
74 82 char address1;
75 83 char address0;
76 84 unsigned char dataLength2;
77 85 unsigned char dataLength1;
78 86 unsigned char dataLength0;
79 87 char headerCRC;
80 88 };
81 89 typedef struct rmap_command_format_str rmap_command_format_t;
82 90
83 91 struct rmap_write_reply_str
84 92 {
85 93 unsigned char initiatorLogicalAddress;
86 94 unsigned char protocolIdentifier;
87 95 unsigned char instruction;
88 96 unsigned char status;
89 97 unsigned char targetLogicalAddress;
90 98 unsigned char transactionIdentifier1;
91 99 unsigned char transactionIdentifier2;
92 100 unsigned char headerCRC;
93 101 };
94 102 typedef struct rmap_write_reply_str rmap_write_reply_t;
95 103
96 104 struct rmap_read_reply_PcktHdr_str
97 105 {
98 106 //char replyAddress[]; // not needed if logical addressing is used
99 107 char initiatorLogicalAddress;
100 108 char protocolIdentifier;
101 109 char instruction;
102 110 char status;
103 111 char targetLogicalAddress;
104 112 char transactionIdentifier1;
105 113 char transactionIdentifier0;
106 114 char reserved;
107 115 unsigned char dataLength2;
108 116 unsigned char dataLength1;
109 117 unsigned char dataLength0;
110 118 char headerCRC;
111 119 };
112 120 typedef struct rmap_read_reply_PcktHdr_str rmap_read_reply_PcktHdr_t;
113 121
114 122 struct rmap_gresb_header_str
115 123 {
116 124 char GRESBProtocoleID;
117 125 unsigned char SPWPacketSize2;
118 126 unsigned char SPWPacketSize1;
119 127 unsigned char SPWPacketSize0;
120 128 };
121 129 typedef struct rmap_gresb_header_str rmap_gresb_header_str;
122 130
123 131 class RMAP
124 132 {
125 133 public:
126 134 RMAP(RMAP_command_codes commandCode,
127 135 char targetLogicalAddress,
128 136 char initiatorLogicalAddress,
129 137 int startAddress,
130 138 int nbBytes,
131 139 char *data);
132 140 unsigned char RMAPCalculateCRC(unsigned char INCR, unsigned char INBYTE); // ECSS-E-ST-50-52C
133 141 unsigned char RMAPCalculateHeaderCRC();
134 142 unsigned char RMAPCalculateDataCRC(char *data, int nbBytes);
135 143 rmap_gresb_header_str GRESBHeader;
136 144 rmap_command_format_t RMAPHeader;
137 145 char dataCRC;
138 146 };
139 147
140 148 #endif // RMAPOPERATIONS_H
@@ -1,817 +1,936
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the LPPMON Software
3 3 -- Copyright (C) 2012, Laboratory of Plasma Physics - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Paul LEROY
20 20 -- Mail : paul.leroy@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #include "rmapplugin.h"
23 23 #include <QHostAddress>
24 24 #include <QIODevice>
25 25 #include <QApplication>
26 26 #include <rmappluginpythonwrapper.h>
27 27
28 28 rmapplugin::rmapplugin(QWidget *parent)
29 29 :lppmonplugin(parent,false)
30 30 {
31 31 this->UI = new rmapPluginUI();
32 32 this->setWindowTitle(tr("RMAP and SPW Communication"));
33 33 this->setWidget((QWidget*)this->UI);
34 34 RMAPSend_SOCKET = new QTcpSocket;
35 35 RMAPReceive_SOCKET = new QTcpSocket;
36 36 GRESBStatusQuery_SOCKET = new QTcpSocket;
37 37 spwPacketReceiverOBJECT = new spwpacketreceiver;
38 38 spwPacketReceiverOBJECT->gresbReceptionSocket = RMAPReceive_SOCKET;
39 39 timeCode = 0;
40 40 time_COARSE = 0;
41 41 time_FINE = 0;
42 currentBridge = selectedBridgeIsUnknown;
42 43
43 44 /*Python wrapper*/
44 45 this->pyObject = new rmappluginPythonWrapper();
45 46 connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
46 47 connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
47 48 /*==============*/
48 49
49 connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(RMAP_CONNECT()));
50 connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(RMAP_DISCONNECT()));
50 //connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(RMAP_CONNECT()));
51 //connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(RMAP_DISCONNECT()));
52 connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(openBridge()));
53 connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(closeBridge()));
51 54 connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState)));
52 55 connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState)));
53 56 connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState)));
54 57 connect(UI->gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
55 58 connect(this->UI->spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery()));
56 59 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this->spwPacketReceiverOBJECT, SLOT(receiveSPWPacket()));
57 60
58 61 // CCSDS
59 62 connect(this->UI->sendCCSDSCommandButton, SIGNAL(clicked()), this, SLOT(sendCCSDS()));
60 63 connect(this->UI->send_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(send_TC_LFR_UPDATE_TIME()));
61 64 connect(this->UI->reset_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(reset_TC_LFR_UPDATE_TIME()));
62 65
63 66 // CONSOLE
64 67 connect(this->spwPacketReceiverOBJECT, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
65 68 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
66 69
67 70 // spectralMAtricesDMASimulator
68 71 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginRead(uint*,uint,uint)), this, SLOT(Read(uint*,uint,uint)));
69 72 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginWrite(uint*,uint,uint)), this, SLOT(Write(uint*,uint,uint)));
70 73 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
74
75 // GRESB
76 connect(this, SIGNAL(gresbIsOpen(bool)), this, SLOT(gresbSelection(bool)));
77
78 // Star Dundee
79 connect(this->UI->starDundee, SIGNAL(starDundeeIsOpen(bool)), this, SLOT(activatePluginViaStarDundee(bool)));
80 connect(this->UI->starDundee, SIGNAL(RMAP_write_reply_setText(QString)), this, SLOT(RMAP_write_reply_setText(QString)));
81 connect(this->UI->starDundee, SIGNAL(appendToLog(QString)), this, SLOT(appendToLog(QString)));
82
83 connect(this->UI, SIGNAL(bridgeHasChanged(selectedBridge)), this, SLOT(bridgeHasChanged(selectedBridge)));
71 84 }
72 85
73 86 rmapplugin::~rmapplugin()
74 87 {
75 88 if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost();
76 89 if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost();
77 90 if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost();
78 91 }
79 92
80 93 unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address)
81 94 {
95 unsigned int result;
96 switch(currentBridge)
97 {
98 case selectedBridgeIsGRESB :
99 result = WriteGRESB(Value, count, address);
100 break;
101 case selectedBridgeIsStarDundee :
102 result = this->WriteStarDundee(Value, count, address);
103 break;
104 default:
105 result = 1;
106 break;
107 }
108 return result;
109 }
110
111 unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address)
112 {
113 unsigned int result;
114 switch(currentBridge)
115 {
116 case selectedBridgeIsGRESB :
117 result = ReadGRESB(Value, count, address);
118 break;
119 case selectedBridgeIsStarDundee :
120 result = this->ReadStarDundee(Value, count, address);
121 break;
122 default:
123 result = 1;
124 break;
125 }
126 return result;
127 }
128
129 unsigned int rmapplugin::WriteGRESB(unsigned int *Value, unsigned int count, unsigned int address)
130 {
82 131 unsigned int remainingCount = count;
83 132 unsigned int iOffset = 0;
84 133 QString console_message;
85 134 char* data;
86 135
87 unsigned char command = 0x08; // initialize command at 0b00001000 for write
88
89 136 if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0)
90 137 {
91 138 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped");
92 139 return 1;
93 140 }
94 if (UI->RMAP_write_verify->isChecked()) command = command + (1<<2);
95 if (UI->RMAP_write_reply->isChecked()) command = command + (1<<1);
96 141
97 142 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: unavailable");
98 143
99 144 data = (char*) malloc(READ_WRITE_MAX_COUNTS*4);
100 145
101 146 APPENDTOLOG(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
102 147
103 148 while (remainingCount > READ_WRITE_MAX_COUNTS)
104 149 {
105 150 for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++)
106 151 {
107 152 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
108 153 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
109 154 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
110 155 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
111 156 }
112 157
113 158 console_message.sprintf("remainingCount: %d => ", remainingCount);
114 159 APPENDTOLOG(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16));
115 160
116 161 if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0)
117 162 {
118 163 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
119 164 return 1;
120 165 }
121 166
122 167 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
123 168 address = address + READ_WRITE_MAX_COUNTS * 4;
124 169 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
125 170 }
126 171
127 172 if (remainingCount > 0)
128 173 {
129 174 for (unsigned int i = 0; i<remainingCount; i++)
130 175 {
131 176 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
132 177 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
133 178 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
134 179 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
135 180 }
136 181
137 182 console_message.sprintf("remainingCount: %d => ", remainingCount);
138 183 APPENDTOLOG(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16));
139 184
140 185 if (WriteBLOCK(data, remainingCount*4, address)==0)
141 186 {
142 187 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
143 188 return 1;
144 189 }
145 190 }
146 191
147 192 APPENDTOLOG(QString("*** STOP *** WRITE"));
148 193 free(data);
149 194 return count;
150 195 }
151 196
152 unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address)
197 unsigned int rmapplugin::ReadGRESB(unsigned int *Value, unsigned int count, unsigned int address)
153 198 {
154 199 unsigned int remainingCount = count;
155 200 unsigned int iOffset = 0;
156 201 QString console_message;
157 202
158 203 if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0)
159 204 {
160 205 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped");
161 206 return 1;
162 207 }
163 208 APPENDTOLOG(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
164 209
165 210 while (remainingCount > READ_WRITE_MAX_COUNTS)
166 211 {
167 212 console_message.sprintf("remainingCount: %d => ", remainingCount);
168 213 APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16));
169 214
170 215 if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0)
171 216 {
172 217 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received");
173 218 return 1;
174 219 }
175 220
176 221 for(int i=0;i<READ_WRITE_MAX_COUNTS;i++)
177 222 {
178 223 Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
179 224 for(int j=1;j<4;j++)
180 225 {
181 226 Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
182 227 }
183 228 }
184 229
185 230 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
186 231 address = address + READ_WRITE_MAX_COUNTS * 4;
187 232 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
188 233 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
189 234 }
190 235
191 236 if (remainingCount > 0)
192 237 {
193 238 console_message.sprintf("remainingCount: %d => ", remainingCount);
194 239 APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16));
195 240
196 241 if (ReadBLOCK(4*remainingCount, address)==0)
197 242 {
198 243 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received");
199 244 return 1;
200 245 }
201 246
202 247 for(unsigned int i=0;i<remainingCount;i++)
203 248 {
204 249 Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
205 250 for(int j=1;j<4;j++)
206 251 {
207 252 Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
208 253 }
209 254 }
210 255 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
211 256 }
212 257
213 258 APPENDTOLOG(QString("*** STOP *** READ "));
214 259 return count;
215 260 }
216 261
217 unsigned int rmapplugin::ReadBLOCK(unsigned int nbBytes, unsigned int address)
218 {
219 int errorCode;
220 RMAP *RMAPCommand;
221 QTime RMAPTimeout;
222 unsigned int dataLength;
223 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
224 {
225 RMAP_DISCONNECT();
226 return 1;
227 }
228
229 if (nbBytes > 4)
230 {
231 RMAPCommand = new RMAP(read_Inc,
232 UI->rmapTargetLogicalAddressSpinBox->value(),
233 UI->rmapSourceLogicalAddressSpinBox->value(),
234 address,
235 nbBytes,
236 NULL);
237 }
238 else
239 {
240 RMAPCommand = new RMAP(read_Single,
241 UI->rmapTargetLogicalAddressSpinBox->value(),
242 UI->rmapSourceLogicalAddressSpinBox->value(),
243 address,
244 nbBytes,
245 NULL);
246 }
247
248 // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND
249 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4);
250 // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND
251 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader));
252 RMAPSend_SOCKET->waitForBytesWritten(100);
253 RMAPTimeout.start();
254 // write timeout
255 while(RMAPSend_SOCKET->bytesToWrite() > 0)
256 {
257 RMAPSend_SOCKET->waitForBytesWritten(100);
258 if(RMAPTimeout.elapsed()>1000)
259 {
260 APPENDTOLOG("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n");
261 return 0;
262 }
263 }
264
265 // RECEIVE THE INCOMING RMAP PACKET
266 errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1); // request ID 1 is for RMAP packet
267 if (errorCode<=0)
268 {
269 APPENDTOLOG("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
270 return 0;
271 }
272 dataLength = spwPacketReceiverOBJECT->rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH;
273 if(dataLength != nbBytes)
274 {
275 APPENDTOLOG("WARNING === in function READ of rmapplugin *** number of data received ("
276 +QString::number(dataLength)
277 +") not equal to number of data requested ("
278 +QString::number(READ_WRITE_MAX_COUNTS*4)
279 +")");
280 return 0;
281 }
282 return dataLength;
283 }
284
285 262 unsigned int rmapplugin::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address)
286 263 {
287 264 QTime RMAPTimeout;
288 265 RMAP *RMAPCommand;
289 266 int errorCode;
290 267 QString console_message;
291 268
292 269 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
293 270 {
294 271 RMAP_DISCONNECT();
295 272 return 1;
296 273 }
297 274
298 275 RMAPCommand = new RMAP(UI->getCommandCode(),
299 276 UI->rmapTargetLogicalAddressSpinBox->value(),
300 277 UI->rmapSourceLogicalAddressSpinBox->value(),
301 278 address,
302 279 nbBytes,
303 280 data);
304 281
305 282 // SEND GRESB HEADER
306 283 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4);
307 284 // SEND SPACEWIRE PACKET HEADER
308 285 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader));
309 286 // SEND DATA
310 287 RMAPSend_SOCKET->write( data, nbBytes);
311 288 // SEND DATA CRC
312 289 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1);
313 290 RMAPTimeout.start();
314 291 while(RMAPSend_SOCKET->bytesToWrite() > 0)
315 292 {
316 293 RMAPSend_SOCKET->waitForBytesWritten(100);
317 294 if(RMAPTimeout.elapsed()>1000)
318 295 {
319 296 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout");
320 297 return 0;
321 298 }
322 299 }
323 300
324 301 if (UI->RMAP_write_reply->isChecked())
325 302 {
326 303 // WAIT FOR THE RMAP REPLY PACKET
327 304 errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1);
328 305 if (errorCode<=0)
329 306 {
330 307 APPENDTOLOG("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
331 308 return 0;
332 309 }
333 310 if(spwPacketReceiverOBJECT->rmapPacketSize != 8)
334 311 {
335 312 console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n");
336 313 APPENDTOLOG(console_message);
337 314 return 0;
338 315 }
339 316 switch (spwPacketReceiverOBJECT->rmapPacket[3]) // byte 4 is the status byte in the reply
340 317 {
341 318 case 0:
342 319 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 0 Successfull");
343 320 break;
344 321 case 1:
345 322 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** General error code");
346 323 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 1 General error code");
347 324 break;
348 325 case 2:
349 326 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code");
350 327 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code");
351 328 break;
352 329 case 3:
353 330 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key");
354 331 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 3 Invalid key");
355 332 break;
356 333 case 4:
357 334 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC");
358 335 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 4 Invalid data CRC");
359 336 break;
360 337 case 5:
361 338 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP");
362 339 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 5 Early EOP");
363 340 break;
364 341 case 6:
365 342 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data");
366 343 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 6 Too much data");
367 344 break;
368 345 case 7:
369 346 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** EEP");
370 347 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 7 EEP");
371 348 break;
372 349 case 8:
373 350 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved");
374 351 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 8 Reserved");
375 352 break;
376 353 case 9:
377 354 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun");
378 355 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun");
379 356 break;
380 357 case 10:
381 358 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised");
382 359 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised");
383 360 break;
384 361 case 11:
385 362 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error");
386 363 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error");
387 364 break;
388 365 case 12:
389 366 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address");
390 367 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 12 Invalid target logical address");
391 368 break;
392 369 }
393 370 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
394 371 }
395 372 return nbBytes;
396 373 }
397 374
375 unsigned int rmapplugin::ReadBLOCK(unsigned int nbBytes, unsigned int address)
376 {
377 int errorCode;
378 RMAP *RMAPCommand;
379 QTime RMAPTimeout;
380 unsigned int dataLength;
381 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
382 {
383 RMAP_DISCONNECT();
384 return 1;
385 }
386
387 if (nbBytes > 4)
388 {
389 RMAPCommand = new RMAP(read_Inc,
390 UI->rmapTargetLogicalAddressSpinBox->value(),
391 UI->rmapSourceLogicalAddressSpinBox->value(),
392 address,
393 nbBytes,
394 NULL);
395 }
396 else
397 {
398 RMAPCommand = new RMAP(read_Single,
399 UI->rmapTargetLogicalAddressSpinBox->value(),
400 UI->rmapSourceLogicalAddressSpinBox->value(),
401 address,
402 nbBytes,
403 NULL);
404 }
405
406 // SEND THE GRESB HEADER FOR THE RMAP READ COMMAND
407 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4);
408 // SEND THE SPACEWIRE PACKET FOR THE RMAP READ COMMAND
409 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader));
410 RMAPSend_SOCKET->waitForBytesWritten(100);
411 RMAPTimeout.start();
412 // write timeout
413 while(RMAPSend_SOCKET->bytesToWrite() > 0)
414 {
415 RMAPSend_SOCKET->waitForBytesWritten(100);
416 if(RMAPTimeout.elapsed()>1000)
417 {
418 APPENDTOLOG("WARNING === in function READ of rmapplugin *** sending Read RMAP Command timeout\n");
419 return 0;
420 }
421 }
422
423 // RECEIVE THE INCOMING RMAP PACKET
424 errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1); // request ID 1 is for RMAP packet
425 if (errorCode<=0)
426 {
427 APPENDTOLOG("WARNING === in function ReadBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
428 return 0;
429 }
430 dataLength = spwPacketReceiverOBJECT->rmapPacketSize - RMAP_READ_REPLY_HEADER_LENGTH - RMAP_DATA_CRC_LENGTH;
431 if(dataLength != nbBytes)
432 {
433 APPENDTOLOG("WARNING === in function READ of rmapplugin *** number of data received ("
434 +QString::number(dataLength)
435 +") not equal to number of data requested ("
436 +QString::number(READ_WRITE_MAX_COUNTS*4)
437 +")");
438 return 0;
439 }
440 return dataLength;
441 }
442
443 unsigned int rmapplugin::WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address)
444 {
445 unsigned int result;
446 result = UI->starDundee->WriteStarDundee(Value, count, address);
447 return result;
448 }
449
450 unsigned int rmapplugin::ReadStarDundee(unsigned int *Value, unsigned int count, unsigned int address)
451 {
452 unsigned int result;
453 result = UI->starDundee->ReadStarDundee(Value, count, address);
454 return result;
455 }
456
398 457 ////////
399 458 // SLOTS
400 459
401 460 unsigned int rmapplugin::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) // SLOT
402 461 {
403 462 char protocoleIdentifier = 0x02;
404 463 char reserved = 0x00;
405 464 char gresbProtocole = 0x00;
406 465 unsigned char size[3];
407 466 unsigned int spwPacketSize = count + 4;
408 467 QTime SPWTimeout;
409 468
410 469 if (count>248)
411 470 {
412 471 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n");
413 472 return 1;
414 473 }
415 474
416 475 APPENDTOLOG(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)"));
417 476
418 477 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
419 478 {
420 479 RMAP_DISCONNECT();
421 480 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** SPW link not running\n");
422 481 return 1;
423 482 }
424 483
425 484 // SEND GRESB HEADER
426 485 size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16);
427 486 size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8);
428 487 size[2] = (unsigned char) ((unsigned int) spwPacketSize);
429 488 RMAPSend_SOCKET->write(&gresbProtocole, 1);
430 489 RMAPSend_SOCKET->write((char*) size, 3);
431 490 // SEND SPW HEADER
432 491 RMAPSend_SOCKET->write(&targetLogicalAddress, 1);
433 492 RMAPSend_SOCKET->write(&protocoleIdentifier, 1);
434 493 RMAPSend_SOCKET->write(&reserved, 1);
435 494 RMAPSend_SOCKET->write(&userApplication, 1);
436 495 // SEND CCSDS PACKET
437 496 RMAPSend_SOCKET->write(Value, count);
438 497 SPWTimeout.start();
439 498 while(RMAPSend_SOCKET->bytesToWrite() > 0)
440 499 {
441 500 RMAPSend_SOCKET->waitForBytesWritten(100);
442 501 if(SPWTimeout.elapsed()>1000)
443 502 {
444 503 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n");
445 504 return 1;
446 505 }
447 506 }
448 507
449 508 APPENDTOLOG(QString("*** CCSDS packet sent"));
450 509
451 510 return count;
452 511 }
453 512
454 513 void rmapplugin::sendCCSDS() // SLOT
455 514 {
456 515 unsigned int nbBYTES_application_data = 8;
457 516 unsigned int count;
458 517 char *tab;
459 518 unsigned char packetErrorControl1 = 0xaa;
460 519 unsigned char packetErrorControl0 = 0xbb;
461 520
462 521 ccsds_command = new ccsds(1, 0, 0, nbBYTES_application_data+12, 0, 0, 0, 0, 0); // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes
463 522 /* unsigned char data_field_header,
464 523 unsigned char processID,
465 524 unsigned int sequence_count,
466 525 unsigned int packet_length,
467 526 unsigned char acceptance,
468 527 unsigned int completion,
469 528 unsigned char service_type,
470 529 unsigned char service_subtype,
471 530 unsigned char sourceID*/
472 531
473 532 count = nbBYTES_application_data+12; // 12 is the size in bytes of the header
474 533 tab = (char*) malloc(count);
475 534 tab[0] = ccsds_command->ccsds_header->packetId1;
476 535 tab[1] = ccsds_command->ccsds_header->packetId0;
477 536 tab[2] = ccsds_command->ccsds_header->packetSequenceControl1;
478 537 tab[3] = ccsds_command->ccsds_header->packetSequenceControl0;
479 538 tab[4] = ccsds_command->ccsds_header->packetLength1;
480 539 tab[5] = ccsds_command->ccsds_header->packetLength0;
481 540 tab[6] = ccsds_command->ccsds_header->dataFieldHeader3;
482 541 tab[7] = ccsds_command->ccsds_header->dataFieldHeader2;
483 542 tab[8] = ccsds_command->ccsds_header->dataFieldHeader1;
484 543 tab[9] = ccsds_command->ccsds_header->dataFieldHeader0;
485 544 tab[10]=0x00;
486 545 tab[11]=0x00;
487 546 tab[12]=0x00;
488 547 tab[13]=0x00;
489 548 tab[14]=0x00;
490 549 tab[15]=0x00;
491 550 tab[nbBYTES_application_data+10] = packetErrorControl1;
492 551 tab[nbBYTES_application_data+11] = packetErrorControl0;
493 552
494 553 WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00);
495 554
496 555 free(tab);
497 556 }
498 557
499 558 void rmapplugin::send_TC_LFR_UPDATE_TIME()
500 559 {
501 560 unsigned int nbBYTES_application_data = 6; // Time at CUC format is on 48 bits / 6 bytes
502 561 unsigned int count;
503 562 char *tab;
504 563 unsigned char packetErrorControl1 = 0xaa;
505 564 unsigned char packetErrorControl0 = 0xbb;
506 565
507 566 ccsds_command = new ccsds(1, 11, 0, nbBYTES_application_data, 1, 1, 9, 129, 0);
508 567 /* unsigned char data_field_header,
509 568 unsigned char processID,
510 569 unsigned int sequence_count,
511 570 unsigned int packet_length,
512 571 unsigned char acceptance,
513 572 unsigned int completion,
514 573 unsigned char service_type,
515 574 unsigned char service_subtype,
516 575 unsigned char sourceID*/
517 576
518 577 count = nbBYTES_application_data+12; // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes
519 578 tab = (char*) malloc(count);
520 579 tab[0] = ccsds_command->ccsds_header->packetId1;
521 580 tab[1] = ccsds_command->ccsds_header->packetId0;
522 581 tab[2] = ccsds_command->ccsds_header->packetSequenceControl1;
523 582 tab[3] = ccsds_command->ccsds_header->packetSequenceControl0;
524 583 tab[4] = ccsds_command->ccsds_header->packetLength1;
525 584 tab[5] = ccsds_command->ccsds_header->packetLength0;
526 585 tab[6] = ccsds_command->ccsds_header->dataFieldHeader3;
527 586 tab[7] = ccsds_command->ccsds_header->dataFieldHeader2;
528 587 tab[8] = ccsds_command->ccsds_header->dataFieldHeader1;
529 588 tab[9] = ccsds_command->ccsds_header->dataFieldHeader0;
530 589 tab[10] = (unsigned char) (time_COARSE>>24);
531 590 tab[11] = (unsigned char) (time_COARSE>>18);
532 591 tab[12] = (unsigned char) (time_COARSE>>8);
533 592 tab[13] = (unsigned char) (time_COARSE);
534 593 tab[14] = (unsigned char) (time_FINE>>8);
535 594 tab[15] = (unsigned char) (time_FINE);
536 595 tab[nbBYTES_application_data+10] = packetErrorControl1;
537 596 tab[nbBYTES_application_data+11] = packetErrorControl0;
538 597
539 598 WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00);
540 599
541 600 time_COARSE = time_COARSE+1;
542 601
543 602 free(tab);
544 603 }
545 604
546 605 void rmapplugin::reset_TC_LFR_UPDATE_TIME()
547 606 {
548 607 time_COARSE = 0;
549 608 time_FINE = 0;
550 609 }
551 610
611 void rmapplugin::openBridge()
612 {
613 switch(currentBridge)
614 {
615 case selectedBridgeIsGRESB :
616 RMAP_CONNECT();
617 break;
618 case selectedBridgeIsStarDundee :
619 this->UI->starDundee->OpenStarDundee();
620 break;
621 default:
622 break;
623 }
624 }
625
626 void rmapplugin::closeBridge()
627 {
628 switch(currentBridge)
629 {
630 case selectedBridgeIsGRESB :
631 RMAP_DISCONNECT();
632 break;
633 case selectedBridgeIsStarDundee :
634 this->UI->starDundee->CloseStarDundee();
635 break;
636 default:
637 break;
638 }
639 }
640
552 641 void rmapplugin::RMAP_CONNECT() // SLOT
553 642 {
554 643 bool spwRunning = true;
555 644 RMAPSend_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
556 645 3000 + UI->gresbVirtualLinkSpinBox->value()*2,
557 646 QIODevice::WriteOnly);
558 647 RMAPReceive_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
559 648 3000 + UI->gresbVirtualLinkSpinBox->value()*2+1,
560 649 QIODevice::ReadOnly);
561 650 GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
562 651 3010,
563 652 QIODevice::ReadWrite);
564 653 GRESBStatusQuery_SOCKET->waitForConnected(10000);
565 654 RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket
566 655 // initialize SPW packet semaphores
567 656 while (spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->acquire();
568 657 while (spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->acquire();
569 658 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) != 0)
570 659 {
571 660 spwRunning = UI->gresbStatusQueryDialog->exec();
572 661 }
573 662 if (spwRunning == false) RMAP_DISCONNECT();
574 663 else
575 664 {
576 665 APPENDTOLOG(QString("SpaceWire running on virtual link ")+ QString::number(UI->spwLinkSpinBox->value()));
577 666 emit this->activateSig(true);
667 emit gresbIsOpen(true);
578 668 }
579 669 }
580 670
581 671 void rmapplugin::RMAP_DISCONNECT() // SLOT
582 672 {
583 673 RMAPSend_SOCKET->disconnectFromHost();
584 674 RMAPReceive_SOCKET->disconnectFromHost();
585 675 GRESBStatusQuery_SOCKET->disconnectFromHost();
586 676 emit this->activateSig(false);
677 emit gresbIsOpen(false);
587 678 }
588 679
589 680 void rmapplugin::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT
590 681 {
591 682 UI->rmapSendStateLabel->setText("");
592 683 QString socketMessage = "RMAP Send Socket State: ";
593 684 switch(socketState)
594 685 {
595 686 case QAbstractSocket::UnconnectedState :
596 687 socketMessage.append("0 => Unconnected");
597 688 UI->rmapOpenCommunicationButton->setEnabled(true);
598 689 UI->rmapCloseCommunicationButton->setEnabled(false);
599 690 emit this->activateSig(false);
600 691 break;
601 692 case 1:
602 693 socketMessage.append("1 => HostLookup");
603 694 break;
604 695 case 2:
605 696 socketMessage.append("2 => Connecting");
606 697 break;
607 698 case 3:
608 699 socketMessage.append("3 => Connected");
609 700 UI->rmapOpenCommunicationButton->setEnabled(false);
610 701 UI->rmapCloseCommunicationButton->setEnabled(true);
611 702 break;
612 703 case 4:
613 704 socketMessage.append("4 => Bound");
614 705 break;
615 706 case 5:
616 707 socketMessage.append("5 => Closing");
617 708 break;
618 709 case 6:
619 710 socketMessage.append("6 => Listening");
620 711 break;
621 712 }
622 713 UI->rmapSendStateLabel->setText(socketMessage);
623 714 APPENDTOLOG(socketMessage);
624 715 }
625 716
626 717 void rmapplugin::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT
627 718 {
628 719 UI->rmapReceiveStateLabel->setText("");
629 720 QString socketMessage = "RMAP Receive Socket State: ";
630 721 switch(socketState)
631 722 {
632 723 case QAbstractSocket::UnconnectedState :
633 724 socketMessage.append("0 => Unconnected");
634 725 break;
635 726 case 1:
636 727 socketMessage.append("1 => HostLookup");
637 728 break;
638 729 case 2:
639 730 socketMessage.append("2 => Connecting");
640 731 break;
641 732 case 3:
642 733 socketMessage.append("3 => Connected");
643 734 break;
644 735 case 4:
645 736 socketMessage.append("4 => Bound");
646 737 break;
647 738 case 5:
648 739 socketMessage.append("5 => Closing");
649 740 break;
650 741 case 6:
651 742 socketMessage.append("6 => Listening");
652 743 break;
653 744 }
654 745 UI->rmapReceiveStateLabel->setText(socketMessage);
655 746 APPENDTOLOG(socketMessage);
656 747 }
657 748
658 749 void rmapplugin::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT
659 750 {
660 751 UI->gresbStatusQueryLabel->setText("");
661 752 QString socketMessage = "GRESB status query socket (port 3010): ";
662 753 switch(socketState)
663 754 {
664 755 case QAbstractSocket::UnconnectedState :
665 756 socketMessage.append("0 => Unconnected");
666 757 break;
667 758 case 1:
668 759 socketMessage.append("1 => HostLookup");
669 760 break;
670 761 case 2:
671 762 socketMessage.append("2 => Connecting");
672 763 break;
673 764 case 3:
674 765 socketMessage.append("3 => Connected");
675 766 break;
676 767 case 4:
677 768 socketMessage.append("4 => Bound");
678 769 break;
679 770 case 5:
680 771 socketMessage.append("5 => Closing");
681 772 break;
682 773 case 6:
683 774 socketMessage.append("6 => Listening");
684 775 break;
685 776 }
686 777 UI->gresbStatusQueryLabel->setText(socketMessage);
687 778 }
688 779
689 780 void rmapplugin::reTestSPWLink() // SLOT
690 781 {
691 782 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 0)
692 783 {
693 784 UI->gresbStatusQueryDialog->accept();
694 785 }
695 786 }
696 787
697 788 int rmapplugin::GRESBStatusQuery() // SLOT
698 789 {
699 790 GRESBStatusQueryRequest(LinkStatus, 0);
700 791 GRESBStatusQueryRequest(LinkStatus, 1);
701 792 GRESBStatusQueryRequest(LinkStatus, 2);
702 793 GRESBStatusQueryRequest(LinkStatistics, 0);
703 794 GRESBStatusQueryRequest(LinkStatistics, 1);
704 795 GRESBStatusQueryRequest(LinkStatistics, 2);
705 796 return 0;
706 797 }
707 798
708 799 void rmapplugin::displayOnConsole(QString message)
709 800 {
710 801 this->UI->console->append(message);
711 802 }
712 803
804 void rmapplugin::activatePluginViaStarDundee(bool flag)
805 {
806 emit activateSig(flag);
807 }
808
809 void rmapplugin::RMAP_write_reply_setText(QString text)
810 {
811 this->UI->RMAP_write_reply->setText(text);
812 }
813
814 void rmapplugin::appendToLog(QString text)
815 {
816 APPENDTOLOG(text);
817 }
818
713 819 /////////////////////
714 820 // INTERNAL FUNCTIONS
715 821
716 822 int rmapplugin::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link)
717 823 {
718 824 gresb_status_query_t statusQueryCommand;
719 825 gresb_link_status_reply_t linkStatusReply;
720 826 gresb_link_statistics_reply_t linkStatisticsReply;
721 827 QTime statusQueryTimeout;
722 828 QString console_message;
723 829
724 830 statusQueryCommand.protocolIdentifier = (char) 0x02;
725 831 statusQueryCommand.reserved1 = (char) 0x00;
726 832 statusQueryCommand.reserved0 = (char) 0x00;
727 833 statusQueryCommand.option = (char) option;
728 834 statusQueryCommand.value3 = (char) 0x00;
729 835 statusQueryCommand.value2 = (char) 0x00;
730 836 statusQueryCommand.value1 = (char) 0x00;
731 837 statusQueryCommand.value0 = (char) link;
732 838
733 839 GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand));
734 840 GRESBStatusQuery_SOCKET->flush();
735 841 GRESBStatusQuery_SOCKET->waitForBytesWritten(1000);
736 842
737 843 statusQueryTimeout.start();
738 844 while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0)
739 845 {
740 846 GRESBStatusQuery_SOCKET->waitForBytesWritten(100);
741 847 if(statusQueryTimeout.elapsed()>1000)
742 848 {
743 849 APPENDTOLOG("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout");
744 850 return 1;
745 851 }
746 852 }
747 853
748 854 switch (option)
749 855 {
750 856 case LinkStatus:
751 857 {
752 858 statusQueryTimeout.start();
753 859 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply))
754 860 {
755 861 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
756 862 if(statusQueryTimeout.elapsed()>1000)
757 863 {
758 864 console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n");
759 865 APPENDTOLOG(console_message);
760 866 return 1;
761 867 }
762 868 }
763 869 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply));
764 870 console_message.sprintf("%x", linkStatusReply.byte0);
765 871 UI->spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message);
766 872 console_message.sprintf("%d", linkStatusReply.byte1);
767 873 UI->spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message);
768 874 if (linkStatusReply.byte0 == 0) return 1;
769 875 break;
770 876 }
771 877 case LinkStatistics:
772 878 {
773 879 statusQueryTimeout.start();
774 880 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply))
775 881 {
776 882 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
777 883 if(statusQueryTimeout.elapsed()>1000)
778 884 {
779 885 console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n");
780 886 APPENDTOLOG(console_message);
781 887 return 1;
782 888 }
783 889 }
784 890 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply));
785 891 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted));
786 892 UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message);
787 893 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted));
788 894 UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message);
789 895 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived));
790 896 UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message);
791 897 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived));
792 898 UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message);
793 899 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived));
794 900 UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message);
795 901 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived));
796 902 UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);
797 903 break;
798 904 }
799 905 case NodeAddressStatistics:
800 906 {
801 907 break;
802 908 }
803 909 case GetRoute:
804 910 {
805 911 break;
806 912 }
807 913 }
808 914 return 0;
809 915 }
810 916
811 917 int rmapplugin::charTab_TO_int(char *charTab)
812 918 {
813 919 int result = 0;
814 920 result = (charTab[0]<<24) +(charTab[1]<<16) +(charTab[2]<<8) + charTab[3];
815 921 return result;
816 922 }
817 923
924 void rmapplugin::gresbSelection(bool flag)
925 {
926 if (flag == true) UI->selection_GROUPBOX->setEnabled(false);
927 if (flag == false) UI->selection_GROUPBOX->setEnabled(true);
928 }
929
930 // SLOTS
931 void rmapplugin::bridgeHasChanged(selectedBridge bridge)
932 {
933 currentBridge = bridge;
934 }
935
936
@@ -1,95 +1,109
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the LPPMON Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef DRIVER1_H
23 23 #define DRIVER1_H
24 24 #include <rmappluginui.h>
25 25 #include <rmapoperations.h>
26 26 #include <QMenuBar>
27 27 #include <QMenu>
28 28 #include <QAction>
29 29 #include <QMainWindow>
30 30 #include <QTcpSocket>
31 31 #include <QTime>
32 32 #include <ccsds.h>
33 33 #include <QSemaphore>
34 34 #include <spwpacketreceiver.h>
35 35
36 36 #include <lppmonplugin.h>
37 37
38 38 #define APPENDTOLOG(message) this->UI->appendToLogFile(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": " + message)
39 39
40 40 #define READ_WRITE_MAX_COUNTS 4096 // in words
41 41 #define RMAP_MAX_DATA_LENGTH 4*READ_WRITE_MAX_COUNTS // in bytes, shall be lower than the limit size of SPW packet of the GRESB bridge
42 42 #define RMAP_READ_REPLY_HEADER_LENGTH 12 // in bytes => ECSS
43 43 #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS
44 44 #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS
45 45 #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
46 46
47 47 class rmapplugin : public lppmonplugin
48 48 {
49 49 Q_OBJECT
50 50 public:
51 51 explicit rmapplugin(QWidget *parent = 0);
52 52 ~rmapplugin();
53 53 int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link);
54 54 int charTab_TO_int(char *charTab);
55 unsigned int ReadGRESB(unsigned int *Value,unsigned int count,unsigned int address=0);
56 unsigned int WriteGRESB(unsigned int *Value,unsigned int count,unsigned int address=0);
57 unsigned int ReadStarDundee(unsigned int *Value, unsigned int count, unsigned int address=0);
58 unsigned int WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address=0);
55 59
56 60 public slots:
57 61 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
58 62 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
59 63 //
60 64 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
61 65 void sendCCSDS();
62 66 void send_TC_LFR_UPDATE_TIME();
63 67 void reset_TC_LFR_UPDATE_TIME();
64 68 int GRESBStatusQuery();
65 69 void displayOnConsole(QString message);
66 70 //
67 71 void RMAP_CONNECT();
68 72 void RMAP_DISCONNECT();
73 void openBridge();
74 void closeBridge();
69 75 int RMAPSendReadCommand();
70 76 int RMAPSendWriteCommand();
71 77 void reTestSPWLink();
72 78 //
73 79 void RMAPSendConnectionState(QAbstractSocket::SocketState socketState);
74 80 void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState);
75 81 void GRESBConnectionState(QAbstractSocket::SocketState socketState);
82 //
83 void gresbSelection(bool flag);
84 void activatePluginViaStarDundee(bool flag);
85 void RMAP_write_reply_setText(QString text);
86 void appendToLog(QString text);
87 void bridgeHasChanged(selectedBridge bridge);
76 88
77 89 signals:
78 90 void ccsdsPacketReadyRead(char *ccsdsPacket, unsigned int size);
91 void gresbIsOpen(bool);
79 92
80 93 private:
94 selectedBridge currentBridge;
81 95 rmapPluginUI* UI;
82 96 QTcpSocket* GRESBStatusQuery_SOCKET;
83 97 QTcpSocket* RMAPSend_SOCKET;
84 98 QTcpSocket* RMAPReceive_SOCKET;
85 99 ccsds* ccsds_command;
86 100 unsigned int rmapPacketSize;
87 101 unsigned int time_COARSE;
88 102 unsigned int time_FINE;
89 103 spwpacketreceiver* spwPacketReceiverOBJECT;
90 104 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
91 105 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
92 106 char timeCode;
93 107 };
94 108
95 109 #endif // DRIVER1_H
@@ -1,69 +1,73
1 1 #
2 2 # Project created by QtCreator 2011-09-20T08:15:30
3 3 #
4 4 #-------------------------------------------------
5 5
6 6 #include(/etc/lppmon/lppmonplugin.prf)
7 7 CONFIG += lppmonplugin
8 8 TARGET = rmapplugin
9 9
10 10 DEFINES += PLUGIN=rmapplugin
11 11 DEFINES += PLUGINHEADER="\"\\\"rmapplugin.h"\\\"\"
12 12 DEFINES += driver_Name="\"\\\"RMAPPlugin"\\\"\"
13 13 DEFINES += driver_Author="\"\\\"Paul Leroy paul.leroy@lpp.polytechnique.fr"\\\"\"
14 14 DEFINES += driver_Version="\"\\\"1.1.2"\\\"\"
15 15 DEFINES += driver_Description="\"\\\"AHB bus controler, works with Gaisler's AHB plugn' play bus."\\\"\"
16 16 DEFINES += driver_can_be_root=1
17 17 DEFINES += driver_can_be_child=0
18 18 DEFINES += driver_VID=0
19 19 DEFINES += driver_PID=0
20 20
21 21
22 22 QT += network
23 23
24 24
25 LIBS += ../spw_usb_driver_v2.61/lib/libSpaceWireUSBAPI.so
25 LIBS += ../spw_usb_driver_v2.61/lib/x86_64/libSpaceWireUSBAPI.so \
26 ../spw_usb_driver_v2.61/lib/x86_64/libConfigLibraryUSB.so
26 27
27 28
28 29 INCLUDEPATH += \
29 30 $${PWD} \
30 31 ../common_PLE \
31 32 ../spw_usb_driver_v2.61/inc
32 33
33 34
34 35 HEADERS += \
35 36 rmappluginui.h \
36 37 rmapplugin.h \
37 38 rmapoperations.h \
38 39 ccsds.h \
39 40 spwpacketreceiver.h \
40 41 ../common_PLE/qipdialogbox.h \
41 42 ../common_PLE/gresbstatusenquiry.h \
42 43 spectralmatricesdmasimulator.h \
43 44 rmappluginpythonwrapper.h \
44 45 stardundee.h \
45 ../spw_usb_driver_v2.61/inc/spw_usb_api.h
46 ../spw_usb_driver_v2.61/inc/spw_usb_api.h \
47 ../spw_usb_driver_v2.61/inc/spw_config_library.h \
48 gresb.h
46 49
47 50
48 51 SOURCES += \
49 52 rmapplugin.cpp \
50 53 rmappluginui.cpp \
51 54 rmapoperations.cpp \
52 55 ccsds.cpp \
53 56 spwpacketreceiver.cpp \
54 57 ../common_PLE/qipdialogbox.cpp \
55 58 ../common_PLE/gresbstatusenquiry.cpp \
56 59 spectralmatricesdmasimulator.cpp \
57 60 rmappluginpythonwrapper.cpp \
58 stardundee.cpp
61 stardundee.cpp \
62 gresb.cpp
59 63
60 64
61 65
62 66
63 67
64 68
65 69
66 70
67 71
68 72
69 73
@@ -1,240 +1,323
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the LPPMON Software
3 3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Alexis Jeandet
20 20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #include "rmapplugin.h"
23 23
24 24 rmapPluginUI::rmapPluginUI(QWidget *parent) :
25 25 QWidget(parent)
26 26 {
27 27 spectralMatricesDMASimulator = new SpectralMatricesDMASimulator;
28 28 spwTabWidget = new QTabWidget;
29 29 QWidget* spwTabWidgetPage0 = new QWidget;
30 30 QWidget* spwTabWidgetPage1 = new QWidget;
31 31 QWidget* spwTabWidgetPage2 = new QWidget;
32 32 QWidget* spwTabWidgetPage3 = new QWidget;
33 33 QWidget* spwTabWidgetPage4 = new QWidget;
34 34 QWidget* spwTabWidgetPage5 = new QWidget;
35 bridgeWidget = new QWidget;
35 36 mainLayout = new QVBoxLayout;
36 37 connectionLayout = new QGridLayout;
37 38 ccsdsLayout = new QVBoxLayout;
38 39 consoleLayout = new QVBoxLayout;
40 selectionLayout = new QVBoxLayout;
41 bridgeSelection_LAYOUT = new QGridLayout;
42 generalParameters_LAYOUT = new QGridLayout;
43
44 gresb_GROUPBOX = new QGroupBox(tr("GRESB bridge parameters"));
45 stardundee_GROUPBOX = new QGroupBox(tr("Star Dundee brick parameters"));
46 selection_GROUPBOX = new QGroupBox(tr("Bridge selection"));
47 generalParameters_GROUPBOX = new QGroupBox(tr("General parameters"));
39 48
40 49 //*** QLABEL ***//
41 50 gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: "));
42 51 gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: "));
43 52 spwLinkLabel = new QLabel(tr("GRESB SPW Link: "));
44 53 rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: "));
45 54 rmapTargetLogicalAddressLabel = new QLabel(tr("RMAP Target Logical Address: "));
46 55 rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection"));
47 56 rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection"));
48 57 logFileName = new QLabel;
49 58 gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection"));
50 59 gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running"));
51 60 sendCCSDSCommandLabel = new QLabel(tr("Address of the target"));
52 61
53 62 //*** QPUSHBUTTON ***//
54 63 rmapOpenCommunicationButton = new QPushButton(tr("Open RMAP Communication"));
55 64 rmapCloseCommunicationButton = new QPushButton(tr("Close RMAP Communication"));
65 rmapOpenCommunicationButton->setEnabled(false);
56 66 rmapCloseCommunicationButton->setEnabled(false);
57 67 logFileChooseButton = new QPushButton(tr("Choose file"));
58 68 gresbStatusQueryRetryButton = new QPushButton(tr("Retry"));
59 69 gresbStatusQueryAbortButton = new QPushButton(tr("Abort"));
60 70 sendCCSDSCommandButton = new QPushButton(tr("Send CCSDS Command"));
61 71 send_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("Send TC_LFR_UPDATE_TIME Packet"));
62 72 reset_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("reset the TC_LFR_UPDATE_TIME Packet coarse and fine times"));
63 73 clearConsoleButton = new QPushButton(tr("Clear"));
64 74
75 selectGRESB_BUTTON = new QRadioButton(tr("GRESB"));
76 selectStarDundee_BUTTON = new QRadioButton(tr("Star Dundee"));
77
65 78 //*** SPINBOX ***//
66 79 gresbVirtualLinkSpinBox = new QSpinBox;
67 80 rmapSourceLogicalAddressSpinBox = new QSpinBox;
68 81 rmapTargetLogicalAddressSpinBox = new QSpinBox;
69 82 spwLinkSpinBox = new QSpinBox;;
70 83 CCSDSTargetLogicalAddressSpinBox = new QSpinBox;
71 84 gresbVirtualLinkSpinBox->setRange(0, 4);
72 85 gresbVirtualLinkSpinBox->setValue(1);
73 86 rmapSourceLogicalAddressSpinBox->setRange(0, 255);
74 87 rmapSourceLogicalAddressSpinBox->setValue(33);
75 88 rmapTargetLogicalAddressSpinBox->setRange(0, 255);
76 89 rmapTargetLogicalAddressSpinBox->setValue(254);
77 90 spwLinkSpinBox->setRange(0, 2);
78 91 spwLinkSpinBox->setValue(0);
79 92 CCSDSTargetLogicalAddressSpinBox->setRange(0,255);
80 93 CCSDSTargetLogicalAddressSpinBox->setValue(254);
81 94
82 95 //*** MISC **//
83 96 starDundee = new StarDundee;
97 gresbBridge = new gresb;
84 98 console = new QTextEdit;
85 99 gresbBridgeIPDialogBox = new QIPDialogBox;
86 100 gresbStatusQueryDialog = new QDialog;
87 101 logEnableCheckBox = new QCheckBox(tr("Enable Logs"));
88 102 RMAP_write_verify = new QCheckBox(tr("data checked before write\nlimited to 4 bytes\nNOT IMPLEMENTED"));
89 103 RMAP_write_reply = new QCheckBox(tr("reply to the write command required\nlast reply status: unavailable"));
90 104 spwLinkStatusEnquiry = new gresbStatusEnquiry;
91 105 logFile = new QFile();
92 106
93 107 logFileEn = false;
94 108
95 109 connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0);
96 110 connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0);
97 111 connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0);
98 112 connectionLayout->addWidget(gresbVirtualLinkSpinBox, 1, 1, 0);
99 connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 2, 0, 0);
100 connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 2, 1, 0);
101 connectionLayout->addWidget(spwLinkLabel, 3, 0, 0);
102 connectionLayout->addWidget(spwLinkSpinBox, 3, 1, 0);
103 connectionLayout->addWidget(rmapTargetLogicalAddressLabel, 4, 0, 0);
104 connectionLayout->addWidget(rmapTargetLogicalAddressSpinBox, 4, 1, 0);
105 connectionLayout->addWidget(rmapOpenCommunicationButton, 5, 0, 1, 2);
106 connectionLayout->addWidget(rmapCloseCommunicationButton, 6, 0, 1, 2);
107 connectionLayout->addWidget(rmapSendStateLabel, 7, 0, 1, 2);
108 connectionLayout->addWidget(rmapReceiveStateLabel, 8, 0, 1, 2);
109 connectionLayout->addWidget(gresbStatusQueryLabel, 9, 0, 1, 2);
110 connectionLayout->addWidget(logEnableCheckBox, 10, 0, 0);
111 connectionLayout->addWidget(logFileChooseButton, 10, 1, 0);
112 connectionLayout->addWidget(RMAP_write_verify, 11, 0, 1, 2);
113 connectionLayout->addWidget(RMAP_write_reply, 12, 0, 1, 2);
113 connectionLayout->addWidget(spwLinkLabel, 2, 0, 0);
114 connectionLayout->addWidget(spwLinkSpinBox, 2, 1, 0);
115 connectionLayout->addWidget(rmapSourceLogicalAddressLabel, 3, 0, 0);
116 connectionLayout->addWidget(rmapSourceLogicalAddressSpinBox, 3, 1, 0);
117 connectionLayout->addWidget(rmapSendStateLabel, 4, 0, 1, 2);
118 connectionLayout->addWidget(rmapReceiveStateLabel, 5, 0, 1, 2);
119 connectionLayout->addWidget(gresbStatusQueryLabel, 6, 0, 1, 2);
120
121 connectionLayout->setRowStretch(7, 1);
122 connectionLayout->setColumnStretch(2, 1);
123
124 bridgeSelection_LAYOUT->addWidget(selectGRESB_BUTTON, 0, 0, 1, 1);
125 bridgeSelection_LAYOUT->addWidget(selectStarDundee_BUTTON, 0, 1, 1, 1);
126 bridgeSelection_LAYOUT->setRowStretch(1, 1);
127 bridgeSelection_LAYOUT->setColumnStretch(2, 1);
114 128
115 connectionLayout->setRowStretch(13, 1);
116 connectionLayout->setColumnStretch(2, 1);
129 generalParameters_LAYOUT->addWidget(logEnableCheckBox, 0, 0, 1, 1);
130 generalParameters_LAYOUT->addWidget(logFileChooseButton, 0, 1, 1, 1);
131 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressLabel, 1, 0, 0);
132 generalParameters_LAYOUT->addWidget(rmapTargetLogicalAddressSpinBox, 1, 1, 0);
133 generalParameters_LAYOUT->addWidget(rmapOpenCommunicationButton, 2, 0, 1, 2);
134 generalParameters_LAYOUT->addWidget(rmapCloseCommunicationButton, 3, 0, 1, 2);
135 generalParameters_LAYOUT->addWidget(RMAP_write_verify, 4, 0, 1, 2);
136 generalParameters_LAYOUT->addWidget(RMAP_write_reply, 5, 0, 1, 2);
137 generalParameters_LAYOUT->setRowStretch(6, 1);
138 generalParameters_LAYOUT->setColumnStretch(2, 1);
139
140 gresb_GROUPBOX->setLayout(connectionLayout);
141 gresb_GROUPBOX->setVisible(false);
142 stardundee_GROUPBOX->setLayout(starDundee->layout());
143 stardundee_GROUPBOX->setVisible(false);
144 selection_GROUPBOX->setLayout(bridgeSelection_LAYOUT);
145 generalParameters_GROUPBOX->setLayout(generalParameters_LAYOUT);
146 selectionLayout->addWidget(selection_GROUPBOX);
147 selectionLayout->addWidget(generalParameters_GROUPBOX);
148 selectionLayout->addWidget(gresb_GROUPBOX);
149 selectionLayout->addWidget(stardundee_GROUPBOX);
117 150
118 151 ccsdsLayout->addWidget(sendCCSDSCommandButton);
119 152 ccsdsLayout->addWidget(send_TC_LFR_UPDATE_TIME_Button);
120 153 ccsdsLayout->addWidget(reset_TC_LFR_UPDATE_TIME_Button);
121 154 ccsdsLayout->addWidget(sendCCSDSCommandLabel);
122 155 ccsdsLayout->addWidget(CCSDSTargetLogicalAddressSpinBox);
123 156
124 157 consoleLayout->addWidget(console);
125 158 consoleLayout->addWidget(clearConsoleButton);
126 159
127 160 connect(this->logFileChooseButton, SIGNAL(clicked()), this, SLOT(chooseLogFile()));
128 161 connect(this, SIGNAL(setLogFileName(QString)), this->logFileName, SLOT(setText(QString)));
129 162 connect(this->logEnableCheckBox, SIGNAL(stateChanged(int)), this, SLOT(logFileEnDisable(int)));
130 163
131 164 spwTabWidget->addTab(spwTabWidgetPage0, tr("connection"));
132 165 spwTabWidget->addTab(spwTabWidgetPage1, tr("ccsds"));
133 166 spwTabWidget->addTab(spwTabWidgetPage2, tr("status"));
134 167 spwTabWidget->addTab(spwTabWidgetPage3, tr("console"));
135 168 spwTabWidget->addTab(spwTabWidgetPage4, tr("DMA"));
136 spwTabWidget->addTab(spwTabWidgetPage5, tr("Star Dundee"));
137 spwTabWidgetPage0->setLayout(connectionLayout);
169 spwTabWidget->addTab(spwTabWidgetPage5, tr("gresb"));
170
171 spwTabWidgetPage0->setLayout(selectionLayout);
138 172 spwTabWidgetPage1->setLayout(ccsdsLayout);
139 173 spwTabWidgetPage2->setLayout(this->spwLinkStatusEnquiry->mainLayout);
140 174 spwTabWidgetPage3->setLayout(consoleLayout);
141 175 spwTabWidgetPage4->setLayout(spectralMatricesDMASimulator->mainLayout);
142 spwTabWidgetPage5->setLayout(starDundee->layout());
176 spwTabWidgetPage5->setLayout(gresbBridge->layout());
143 177 mainLayout->addWidget(spwTabWidget);
144 178 setLayout(mainLayout);
145 179
146 180 // GRESB STATUS QUERY DIALOG
147 181 gresbStatusQueryDialogLayout = new QGridLayout;
148 182 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2);
149 183 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0);
150 184 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0);
151 185 gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout);
152 186
153 187 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
154 188 connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear()));
189 connect(this->selectGRESB_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
190 connect(this->selectStarDundee_BUTTON, SIGNAL(clicked()), this, SLOT(selectionBetweenGresbAndStarDundee()));
191 connect(this->starDundee, SIGNAL(starDundeeIsOpen(bool)), this, SLOT(starDundeeIsOpen(bool)));
192
193 // command code
194 connect(this->RMAP_write_reply, SIGNAL(clicked()), this, SLOT(getCommandCode()));
195 connect(this->RMAP_write_verify, SIGNAL(clicked()), this, SLOT(getCommandCode()));
196 connect(this, SIGNAL(commandCodeHasChanged(RMAP_command_codes)), this->starDundee, SLOT(updateCommandCode(RMAP_command_codes)));
197
198 getCommandCode(); // init the command code value
155 199 }
156 200
157 201 void rmapPluginUI::connectPort()
158 202 {
159 203 //emit this->connectPortsig(ui->PortName->text(),ui->PortspeedSlider->value());
160 204 }
161 205
162 206 void rmapPluginUI::setConnected(bool connected)
163 207 {
164 208 /*if(connected == true)
165 209 {
166 210 ui->OpenPort->setText(tr("Close port"));
167 211 }
168 212 else
169 213 ui->OpenPort->setText(tr("Open port"));*/
170 214 }
171 215
172
173 216 rmapPluginUI::~rmapPluginUI()
174 217 {
175 218 //delete ui;
176 219 }
177 220
178 221 void rmapPluginUI::chooseLogFile()
179 222 {
180 223 if(this->logFile->isOpen())
181 224 this->logFile->close();
182 225 this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"),
183 226 QDir::homePath()
184 227 + "/"
185 228 + QDate::currentDate().toString()
186 229 + "_"
187 230 + QTime::currentTime().toString()
188 231 + "_rmapPluginUI.log",
189 232 tr("Log Files (*.txt *.log)")));
190 233 if(this->logFile->open(QIODevice::WriteOnly))
191 234 {
192 235 this->logFileStrm = new QTextStream(this->logFile);
193 236 emit this->setLogFileName(this->logFile->fileName());
194 237 }
195 238 }
196 239
197 240 void rmapPluginUI::logFileEnDisable(int state)
198 241 {
199 242 if(state==Qt::Checked)
200 243 {
201 244 this->logFileEn = true;
202 245 }
203 246 else if(state==Qt::Unchecked)
204 247 {
205 248 this->logFileEn = false;
206 249 }
207 250 }
208 251
209 252 bool rmapPluginUI::islogfileenable()
210 253 {
211 254 return this->logFileEn;
212 255 }
213 256
214 257 void rmapPluginUI::appendToLogFile(const QString & text)
215 258 {
216 259 if(this->logFileEn && this->logFile->isOpen())
217 260 {
218 261 *(this->logFileStrm) << text << endl;
219 262 }
220 263 }
221 264
222 265 void rmapPluginUI::closeEvent(QCloseEvent *event)
223 266 {
224 267 if(this->logFile->isOpen())
225 268 {
226 269 this->logFileStrm->flush();
227 270 this->logFile->waitForBytesWritten(3000);
228 271 this->logFile->close();
229 272 }
230 273 event->accept();
231 274 }
232 275
233 276 RMAP_command_codes rmapPluginUI::getCommandCode()
234 277 {
235 if (RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) return writeSingle_ver_rep;
236 if (RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) return writeSingle_ver_noRep;
237 if (!RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) return writeSingle_noVer_Rep;
238 if (!RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) return writeSingle_noVer_noRep;
239 else return invalid0;
278 RMAP_command_codes commandCode = invalid0;
279 if (RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_rep;
280 if (RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_ver_noRep;
281 if (!RMAP_write_verify->isChecked() and RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_Rep;
282 if (!RMAP_write_verify->isChecked() and !RMAP_write_reply->isChecked()) commandCode = writeSingle_noVer_noRep;
283 emit commandCodeHasChanged(commandCode);
284 return commandCode;
240 285 }
286
287 // SLOT
288
289 void rmapPluginUI::selectionBetweenGresbAndStarDundee() //SLOT
290 {
291 if (selectGRESB_BUTTON->isChecked())
292 {
293 gresb_GROUPBOX->setVisible(true);
294 stardundee_GROUPBOX->setVisible(false);
295 rmapOpenCommunicationButton->setEnabled(true);
296 emit bridgeHasChanged(selectedBridgeIsGRESB);
297 }
298 if (selectStarDundee_BUTTON->isChecked())
299 {
300 stardundee_GROUPBOX->setVisible(true);
301 gresb_GROUPBOX->setVisible(false);
302 rmapOpenCommunicationButton->setEnabled(true);
303 emit bridgeHasChanged(selectedBridgeIsStarDundee);
304 }
305 }
306
307 void rmapPluginUI::starDundeeIsOpen(bool flag)
308 {
309 if (flag == true)
310 {
311 selection_GROUPBOX->setEnabled(false);
312 this->rmapOpenCommunicationButton->setEnabled(false);
313 this->rmapCloseCommunicationButton->setEnabled(true);
314 }
315 if (flag == false)
316 {
317 selection_GROUPBOX->setEnabled(true);
318 this->rmapOpenCommunicationButton->setEnabled(true);
319 this->rmapCloseCommunicationButton->setEnabled(false);
320 }
321 }
322
323
@@ -1,129 +1,160
1 1 /*------------------------------------------------------------------------------
2 2 -- This file is a part of the LPPMON Software
3 3 -- Copyright (C) 20011, Laboratory of Plasma Physics - CNRS
4 4 --
5 5 -- This program is free software; you can redistribute it and/or modify
6 6 -- it under the terms of the GNU General Public License as published by
7 7 -- the Free Software Foundation; either version 3 of the License, or
8 8 -- (at your option) any later version.
9 9 --
10 10 -- This program is distributed in the hope that it will be useful,
11 11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 13 -- GNU General Public License for more details.
14 14 --
15 15 -- You should have received a copy of the GNU General Public License
16 16 -- along with this program; if not, write to the Free Software
17 17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 18 -------------------------------------------------------------------------------*/
19 19 /*-- Author : Paul Leroy
20 20 -- Mail : paul.leroy@lpp.polytechnique.fr
21 21 ----------------------------------------------------------------------------*/
22 22 #ifndef RMAPPLUGINUI_H
23 23 #define RMAPPLUGINUI_H
24 24
25 25 #include <QWidget>
26 26 #include <QPushButton>
27 27 #include <QLabel>
28 28 #include <QSlider>
29 29 #include <QSpinBox>
30 30 #include <QGridLayout>
31 31 #include <QCheckBox>
32 32 #include <QFile>
33 33 #include <QTextStream>
34 34 #include <QFileDialog>
35 35 #include <QDir>
36 36 #include <QDialog>
37 37 #include <QCloseEvent>
38 38 #include <QTabWidget>
39 39 #include "qipdialogbox.h"
40 40 #include <rmapoperations.h>
41 41 #include <gresbstatusenquiry.h>
42 42 #include <QTextEdit>
43 43 #include "spectralmatricesdmasimulator.h"
44 44 #include <stardundee.h>
45 #include <gresb.h>
46 #include <QRadioButton>
47 #include <QGroupBox>
48
49 enum selectedBridge{
50 selectedBridgeIsUnknown,
51 selectedBridgeIsGRESB,
52 selectedBridgeIsStarDundee
53 };
45 54
46 55 class rmapPluginUI : public QWidget
47 56 {
48 57 Q_OBJECT
49 58
50 59 public:
51 60 explicit rmapPluginUI(QWidget *parent = 0);
52 61 ~rmapPluginUI();
53 62
54 63 QPushButton* rmapOpenCommunicationButton;
55 64 QPushButton* rmapCloseCommunicationButton;
56 65 QPushButton* logFileChooseButton;
57 66 QPushButton* gresbStatusQueryRetryButton;
58 67 QPushButton* gresbStatusQueryAbortButton;
59 68 QPushButton* sendCCSDSCommandButton;
60 69 QPushButton* send_TC_LFR_UPDATE_TIME_Button;
61 70 QPushButton* reset_TC_LFR_UPDATE_TIME_Button;
62 71 QPushButton* clearConsoleButton;
63 72
73 QRadioButton* selectGRESB_BUTTON;
74 QRadioButton* selectStarDundee_BUTTON;
75
76 QGroupBox *selection_GROUPBOX;
77
64 78 QSpinBox* gresbVirtualLinkSpinBox;
65 79 QSpinBox* spwLinkSpinBox;
66 80 QSpinBox* rmapSourceLogicalAddressSpinBox;
67 81 QSpinBox* rmapTargetLogicalAddressSpinBox;
68 82 QSpinBox* CCSDSTargetLogicalAddressSpinBox;
69 83
70 84 QIPDialogBox* gresbBridgeIPDialogBox;
71 85
72 86 QCheckBox *logEnableCheckBox;
73 87 QCheckBox *RMAP_write_verify;
74 88 QCheckBox *RMAP_write_reply;
75 89
76 90 QLabel* rmapSendStateLabel;
77 91 QLabel* rmapReceiveStateLabel;
78 92 QLabel* gresbStatusQueryLabel;
79 93 QLabel* gresbStatusQueryDialogLabel;
80 94 QLabel* sendCCSDSCommandLabel;
81 95
82 96 QDialog* gresbStatusQueryDialog;
83 97
84 98 gresbStatusEnquiry* spwLinkStatusEnquiry;
85 99
86 100 SpectralMatricesDMASimulator *spectralMatricesDMASimulator;
87 101
88 102 QTextEdit* console;
89 103
90 104 StarDundee *starDundee;
91 105
106 gresb *gresbBridge;
107
92 108 bool islogfileenable();
93 109 void appendToLogFile(const QString & text);
94 110 void closeEvent(QCloseEvent *event);
95 RMAP_command_codes getCommandCode();
96 111
97 112 public slots:
98 113 void setConnected(bool connected);
99 114 void connectPort();
100 115 void chooseLogFile();
101 116 void logFileEnDisable(int state);
117 RMAP_command_codes getCommandCode();
118
119 private slots:
120 void selectionBetweenGresbAndStarDundee();
121 void starDundeeIsOpen(bool flag);
102 122
103 123 signals:
104 124 void connectPortsig(QString PortName,int baudrate);
105 125 void setLogFileName(QString FileName);
126 void commandCodeHasChanged(RMAP_command_codes commandCode);
127 void bridgeHasChanged(selectedBridge bridge);
106 128
107 129 private:
108 QLabel* gresbBridgeIPLabel;
109 QLabel* gresbVirtualLinkLabel;
110 QLabel* spwLinkLabel;
111 QLabel* rmapSourceLogicalAddressLabel;
112 QLabel* rmapTargetLogicalAddressLabel;
130 QLabel *gresbBridgeIPLabel;
131 QLabel *gresbVirtualLinkLabel;
132 QLabel *spwLinkLabel;
133 QLabel *rmapSourceLogicalAddressLabel;
134 QLabel *rmapTargetLogicalAddressLabel;
113 135 QLabel *logFileName;
114 136
115 QVBoxLayout* mainLayout;
116 QGridLayout* connectionLayout;
117 QVBoxLayout* ccsdsLayout;
118 QVBoxLayout* consoleLayout;
119 QGridLayout* gresbStatusQueryDialogLayout;
137 QGridLayout *bridgeSelection_LAYOUT;
138 QVBoxLayout *selectionLayout;
139 QVBoxLayout *mainLayout;
140 QGridLayout *connectionLayout;
141 QVBoxLayout *ccsdsLayout;
142 QVBoxLayout *consoleLayout;
143 QGridLayout *gresbStatusQueryDialogLayout;
144 QGridLayout *generalParameters_LAYOUT;
120 145
121 QTabWidget* spwTabWidget;
146 QTabWidget *spwTabWidget;
147
148 QWidget* bridgeWidget;
122 149
123 QFile* logFile;
124 QTextStream* logFileStrm;
150 QGroupBox *gresb_GROUPBOX;
151 QGroupBox *stardundee_GROUPBOX;
152 QGroupBox *generalParameters_GROUPBOX;
153
154 QFile *logFile;
155 QTextStream *logFileStrm;
125 156 bool logFileEn;
126 157
127 158 };
128 159
129 160 #endif // RMAPPLUGINUI_H
@@ -1,129 +1,130
1 1 #include "spwpacketreceiver.h"
2 2 #include <QTime>
3 #include "rmapoperations.h"
3 4
4 5 spwpacketreceiver::spwpacketreceiver(QObject *parent) :
5 6 QObject(parent)
6 7 {
7 8 rmapPacketSEMAPHORE = new QSemaphore;
8 9 ccsdsPacketSEMAPHORE = new QSemaphore;
9 10 rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH);
10 11 ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH);
11 12 spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) );
12 13 connect(this, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)), this, SLOT(processCCSDSPacket(unsigned char*,uint)));
13 14 }
14 15
15 16 spwpacketreceiver::~spwpacketreceiver()
16 17 {
17 18 free(rmapPacket);
18 19 free(ccsdsPacket);
19 20 free(spwPacket);
20 21 }
21 22
22 23 int spwpacketreceiver::receiveSPWPacket(unsigned char requestID) // SLOT
23 24 {
24 25 QTime spwPacketReceiverTimeout;
25 26 // GRESB HEADER
26 27 char RES_TR_EP; // 6 bits REserved + 1 bit TRuncated + 1 bit EP error end of packet
27 28 unsigned char packetLength2;
28 29 unsigned char packetLength1;
29 30 unsigned char packetLength0;
30 31 unsigned int packetLength;
31 32
32 33 if (requestID==1)
33 34 {
34 35 if (rmapPacketSEMAPHORE->available()) return rmapPacketSize;
35 36 }
36 37
37 38 gresbReceptionSocket->blockSignals(1); // block the signals of the socket during packet reception
38 39 // READ THE GRESB HEADER OF THE INCOMING PACKET
39 40 spwPacketReceiverTimeout.start();
40 41 while(gresbReceptionSocket->bytesAvailable() < 4)
41 42 {
42 43 gresbReceptionSocket->waitForReadyRead(100);
43 44 if(spwPacketReceiverTimeout.elapsed()>1000) return -1; // ERROR === read GRSEB header TIMEOUT
44 45 }
45 46 gresbReceptionSocket->read(&RES_TR_EP, 1);
46 47 gresbReceptionSocket->read( (char*) &packetLength2, 1);
47 48 gresbReceptionSocket->read( (char*) &packetLength1, 1);
48 49 gresbReceptionSocket->read( (char*) &packetLength0, 1);
49 50 packetLength = (packetLength2<<16) + (packetLength1<<8) + (packetLength0);
50 51 spwPacket = (char*) malloc(packetLength);
51 52
52 53 // READ THE SPW PACKET
53 54 while(gresbReceptionSocket->bytesAvailable() < packetLength)
54 55 {
55 56 gresbReceptionSocket->waitForReadyRead(100);
56 57 if(spwPacketReceiverTimeout.elapsed()>1000) return -2; // ERROR === read SPW packet TIMEOUT
57 58 }
58 59 gresbReceptionSocket->read( spwPacket, packetLength );
59 60 gresbReceptionSocket->blockSignals(0);
60 61
61 62 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
62 63 {
63 64 case 1: // 0x01 is the protocole identifier for RMAP packets
64 65 if (rmapPacketSEMAPHORE->available()!=0) return -3; // ERROR === previous RMAP packet not processed yet
65 66 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
66 67 rmapPacketSize = packetLength;
67 68 rmapPacketSEMAPHORE->release();
68 69 //emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
69 70 return packetLength;
70 71
71 72 case 2: // 0x02 is the protocole identifier for CCSDS packets
72 73 if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet
73 74 for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i];
74 75 ccsdsPacketSize = packetLength;
75 76 ccsdsPacketSEMAPHORE->release();
76 77 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
77 78 return packetLength;
78 79 }
79 80 return 0;
80 81 }
81 82
82 83 bool spwpacketreceiver::isRMAPPacketSemaphoreAvailable()
83 84 {
84 85 if (rmapPacketSEMAPHORE->available()!=0) return true;
85 86 return false;
86 87 }
87 88
88 89 void spwpacketreceiver::acquireRMAPSemaphore()
89 90 {
90 91 rmapPacketSEMAPHORE->acquire();
91 92 }
92 93
93 94 void spwpacketreceiver::acquireCCSDSSemaphore()
94 95 {
95 96 ccsdsPacketSEMAPHORE->acquire();
96 97 }
97 98
98 99 void spwpacketreceiver::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size)
99 100 {
100 101 QString message;
101 102 unsigned int fine_time_value = 0;
102 103 fine_time_value = ((unsigned int) ccsdsPacket[7]<<24)
103 104 + ((unsigned int) ccsdsPacket[6]<<16)
104 105 + ((unsigned int) ccsdsPacket[5]<<8)
105 106 + ((unsigned int) ccsdsPacket[4]);
106 107 message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": ");
107 108 message.append("size "
108 109 + QString::number(size)
109 110 +" *** header "
110 111 + QString::number(ccsdsPacket[0], 16)
111 112 + " "
112 113 + QString::number(ccsdsPacket[1], 16)
113 114 + " "
114 115 + QString::number(ccsdsPacket[2], 16)
115 116 + " "
116 117 + QString::number(ccsdsPacket[3], 16)
117 118 + " *** coarse time "
118 119 + QString::number(fine_time_value));
119 120 //+ QString::number(ccsdsPacket[4], 16)
120 121 //+" "
121 122 //+ QString::number(ccsdsPacket[5], 16)
122 123 //+" "
123 124 //+ QString::number(ccsdsPacket[6], 16)
124 125 //+" "
125 126 //+ QString::number(ccsdsPacket[7], 16));
126 127 ccsdsPacketSEMAPHORE->acquire();
127 128 emit sendMessage(message);
128 129 }
129 130
@@ -1,44 +1,36
1 1 #ifndef SPWPACKETRECEIVER_H
2 2 #define SPWPACKETRECEIVER_H
3 3
4 4 #include <QSemaphore>
5 5 #include <QTcpSocket>
6 6
7 #define READ_WRITE_MAX_COUNTS 4096 // in words
8 #define RMAP_MAX_DATA_LENGTH 4*READ_WRITE_MAX_COUNTS // in bytes, shall be lower than the limit size of SPW packet of the GRESB bridge
9 #define RMAP_READ_REPLY_HEADER_LENGTH 12 // in bytes => ECSS
10 #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS
11 #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS
12 #define RMAP_MAX_PACKET_LENGTH RMAP_READ_REPLY_HEADER_LENGTH + RMAP_MAX_DATA_LENGTH + RMAP_DATA_CRC_LENGTH
13 #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
14
15 7 class spwpacketreceiver : public QObject
16 8 {
17 9 Q_OBJECT
18 10 public:
19 11 explicit spwpacketreceiver(QObject *parent = 0);
20 12 ~spwpacketreceiver();
21 13 int fetchRMAPPacket();
22 14 void acquireRMAPSemaphore();
23 15 void acquireCCSDSSemaphore();
24 16 bool isRMAPPacketSemaphoreAvailable();
25 17
26 18 unsigned char* ccsdsPacket;
27 19 char* rmapPacket;
28 20 char* spwPacket;
29 21 unsigned int rmapPacketSize;
30 22 unsigned int ccsdsPacketSize;
31 23 QSemaphore* rmapPacketSEMAPHORE;
32 24 QSemaphore* ccsdsPacketSEMAPHORE;
33 25 QTcpSocket* gresbReceptionSocket;
34 26
35 27 public slots:
36 28 int receiveSPWPacket(unsigned char requestID = 0); // request ID by default is 0 for CCSDS
37 29 void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
38 30
39 31 signals:
40 32 void ccsdsPacketAvailable(unsigned char* ccsdsPacket, unsigned int size);
41 33 void sendMessage(QString message);
42 34 };
43 35
44 36 #endif // SPWPACKETRECEIVER_H
This diff has been collapsed as it changes many lines, (506 lines changed) Show them Hide them
@@ -1,55 +1,529
1 1 #include "stardundee.h"
2 #include <QTime>
3 #include <math.h>
2 4
3 5 StarDundee::StarDundee(QWidget *parent) :
4 6 QWidget(parent)
5 7 {
8 commandCode = invalid0; // initialization of the cmmand code for the RMAP transfers
9 rmapPacket = (unsigned char*) malloc(RMAP_MAX_PACKET_LENGTH);
10
11 rmapTargetLogicalAddress = 0xfe;
12 rmapSourceLogicalAddress = 0x20;
6 13 connection_LAYOUT = new QGridLayout;
7 14
8 openCommunication_BUTTON = new QPushButton(tr("Open communication link"));
9 closeCommunication_BUTTON = new QPushButton(tr("Close communication link"));
15 sendPacket_BUTTON = new QPushButton(tr("Send a packet"));
16 sendRMAPPacket_BUTTON = new QPushButton(tr("Write RMAP packet to the specified target"));
17 readRMAPPacket_BUTTON = new QPushButton(tr("Read RMAP packet from the specified target"));
18 getRoutingTableEntry_BUTTON = new QPushButton(tr("Get routing table entry (target logical address)"));
10 19
11 20 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
21 linkNumber_LABEL = new QLabel(tr("SpaceWire link number: "));
22 routingTableEntry_LABEL = new QLabel(tr("Target logical address: "));
23 sourceLogicalAddress_LABEL = new QLabel(tr("Source logical address: "));
12 24
13 25 usbDeviceNumber_SPINBOX = new QSpinBox;
14 26 usbDeviceNumber_SPINBOX->setRange(0,32);
15 27 usbDeviceNumber_SPINBOX->setValue(0);
28 linkNumber_SPINBOX = new QSpinBox;
29 linkNumber_SPINBOX->setRange(1,2);
30 linkNumber_SPINBOX->setValue(1);
31 routingTableEntry_SPINBOX = new QSpinBox;
32 routingTableEntry_SPINBOX->setRange(0, 254);
33 routingTableEntry_SPINBOX->setValue(254);
34 sourceLogicalAddress_SPINBOX = new QSpinBox;
35 sourceLogicalAddress_SPINBOX->setRange(0,254);
36 sourceLogicalAddress_SPINBOX->setValue(32);
16 37
17 closeCommunication_BUTTON->setEnabled(false);
38 sendPacket_BUTTON->setEnabled(false);
39 sendRMAPPacket_BUTTON->setEnabled(false);
40 readRMAPPacket_BUTTON->setEnabled(false);
41 getRoutingTableEntry_BUTTON->setEnabled(false);
18 42
19 connection_LAYOUT->addWidget(openCommunication_BUTTON, 0, 0, 1, 2);
20 connection_LAYOUT->addWidget(closeCommunication_BUTTON, 1, 0, 1, 2);
21 connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 2, 0, 1, 1);
22 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 2, 1, 1, 1);
43 connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1);
44 connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1);
45 connection_LAYOUT->addWidget(sendPacket_BUTTON, 1, 0, 1, 2);
46 connection_LAYOUT->addWidget(linkNumber_LABEL, 2, 0, 1, 1);
47 connection_LAYOUT->addWidget(linkNumber_SPINBOX, 2, 1, 1, 1);
48 connection_LAYOUT->addWidget(sourceLogicalAddress_LABEL, 3, 0, 1, 1);
49 connection_LAYOUT->addWidget(sourceLogicalAddress_SPINBOX, 3, 1, 1, 1);
50 connection_LAYOUT->addWidget(routingTableEntry_LABEL, 4, 0, 1, 1);
51 connection_LAYOUT->addWidget(routingTableEntry_SPINBOX, 4, 1, 1, 1);
52 connection_LAYOUT->addWidget(sendRMAPPacket_BUTTON, 5, 0, 1, 2);
53 connection_LAYOUT->addWidget(readRMAPPacket_BUTTON, 6, 0, 1, 2);
54 connection_LAYOUT->addWidget(getRoutingTableEntry_BUTTON, 7, 0, 1, 2);
55
56 connection_LAYOUT->setRowStretch(8, 1);
57 connection_LAYOUT->setColumnStretch(2, 1);
23 58
24 59 this->setLayout(connection_LAYOUT);
25 60
26 connect(this->openCommunication_BUTTON, SIGNAL(clicked()), this, SLOT(OpenStarDundee()));
27 connect(this->closeCommunication_BUTTON, SIGNAL(clicked()), this, SLOT(CloseStarDundee()));
61 connect(this->sendPacket_BUTTON, SIGNAL(clicked()), this, SLOT(SendPacket()));
62 connect(this->readRMAPPacket_BUTTON, SIGNAL(clicked()),this, SLOT(ReadRMAP()));
63 connect(this->sendRMAPPacket_BUTTON, SIGNAL(clicked()), this, SLOT(SendRMAP()));
64 connect(this->getRoutingTableEntry_BUTTON, SIGNAL(clicked()), this, SLOT(GetRoutingTableEntry()));
28 65 }
29 66
30 67 StarDundee::~StarDundee()
31 68 {
32 69 USBSpaceWire_Close(hDevice); // Close the device
33 70 }
34 71
35 72 unsigned int StarDundee::OpenStarDundee()
36 73 {
37 if (!USBSpaceWire_Open(&hDevice, 0)) // Open the first device
74 int status;
75 U32 statusControl;
76 U32 routingTableEntry;
77 int tableEntry;
78
79 if (!USBSpaceWire_Open(&hDevice, usbDeviceNumber_SPINBOX->value())) // Open the USB device
38 80 {
39 81 emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))");
40 82 return -1;
41 83 }
42 openCommunication_BUTTON->setEnabled(false);
43 closeCommunication_BUTTON->setEnabled(true);
44 emit sendMessage("stardundee *** Open *** USBSpaceWire_Open(&hDevice, 0)) successful");
84 emit sendMessage("stardundee *** Open *** USBSpaceWire_Open successful, device number: "
85 + QString::number(usbDeviceNumber_SPINBOX->value()));
86
87 USBSpaceWire_EnableNetworkMode(hDevice, 0); // deactivate the network mode
88 CFGSpaceWire_EnableRMAP(1); // Enable the use of RMAP
89 CFGSpaceWire_SetRMAPDestinationKey(0x20); // Set the destination key expected by STAR-Dundee devices
90
91 // Set the path and return path to the device
92 CFGSpaceWire_StackClear();
93 CFGSpaceWire_AddrStackPush(0);
94 CFGSpaceWire_AddrStackPush(254);
95 CFGSpaceWire_RetAddrStackPush(254);
96
97 // set the base transmit rate to 100 MHz
98 status = CFGSpaceWire_SetBrickBaseTransmitRate( hDevice, CFG_BRK_CLK_100_MHZ, CFG_BRK_DVDR_1, 0xff);
99 if (status != CFG_TRANSFER_SUCCESS)
100 {
101 emit sendMessage("ERROR CFGSpaceWire_SetBrickBaseTransmitRate");
102 }
103 else emit sendMessage("OK CFGSpaceWire_SetBrickBaseTransmitRate, base rate = 100 MHz");
104 // read the link status
105 if (CFGSpaceWire_GetLinkStatusControl(hDevice, linkNumber_SPINBOX->value(), &statusControl) != CFG_TRANSFER_SUCCESS)
106 {
107 emit sendMessage("Could not read link status control for link " + QString::number(linkNumber_SPINBOX->value()));
108 }
109 else
110 {
111 emit sendMessage("OK CFGSpaceWire_GetLinkStatusControl of link " + QString::number(linkNumber_SPINBOX->value()));
112
113 // Set the link status control register properties
114 CFGSpaceWire_LSEnableAutoStart(&statusControl, 1);
115 CFGSpaceWire_LSEnableStart(&statusControl, 1);
116 CFGSpaceWire_LSEnableDisabled(&statusControl, 0);
117 CFGSpaceWire_LSEnableTristate(&statusControl, 0);
118 CFGSpaceWire_LSSetOperatingSpeed(&statusControl, 9); // sets the link speed to ( 100 MHz / (9+1) ) = 10 MHz
119
120 // Set the link status control register
121 if (CFGSpaceWire_SetLinkStatusControl(hDevice, linkNumber_SPINBOX->value(), statusControl) != CFG_TRANSFER_SUCCESS)
122 {
123 emit sendMessage("Could not set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
124 }
125 else emit sendMessage("Set the link status control for link " + QString::number(linkNumber_SPINBOX->value()));
126 }
127
128 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 254 <=> 0xfe
129 tableEntry = routingTableEntry_SPINBOX->value();
130 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
131 {
132 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
133 }
134 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
135 // Build the routing table entry to route out of port 1 with header deletion disabled and priority normal
136 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
137 (1<<linkNumber_SPINBOX->value()), // 0x02 = 0000 0010
138 0,
139 0);
140 // Set the routing table entry for logical address tableEntry
141 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
142 {
143 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
144 }
145 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
146
147 // SET THE ROUTING TABLE ENTRY FOR LOGICAL ADDRESSING, TARGET 32 <=> 0x20
148 tableEntry = sourceLogicalAddress_SPINBOX->value();
149 if (CFGSpaceWire_ClearRoutingTableEntry(hDevice, tableEntry) != CFG_TRANSFER_SUCCESS)
150 {
151 emit sendMessage("Could not clear routing table entry " + QString::number(tableEntry));
152 }
153 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] cleared");
154
155 // Build the routing table entry to route out of port 3 with header deletion disabled and priority normal
156 CFGSpaceWire_RTBuildRoutingTableEntry(&routingTableEntry,
157 (1<<3), // 0x02 = 0000 0010
158 0,
159 0);
160 // Set the routing table entry for logical address tableEntry
161 if (CFGSpaceWire_SetRoutingTableEntry(hDevice, tableEntry, routingTableEntry) != CFG_TRANSFER_SUCCESS)
162 {
163 emit sendMessage("Could not set routing table entry [" + QString::number(tableEntry) + "]");
164 }
165 else emit sendMessage("Routing table entry [" + QString::number(tableEntry) + "] set" );
166
167 emit sendMessage("The driver's current send buffer size is " + QString::number(USBSpaceWire_GetDriverSendBufferSize(hDevice)) + " bytes");
168
169 sendPacket_BUTTON->setEnabled(true);
170 sendRMAPPacket_BUTTON->setEnabled(true);
171 readRMAPPacket_BUTTON->setEnabled(true);
172 getRoutingTableEntry_BUTTON->setEnabled(true);
173
174 USBSpaceWire_RegisterReceiveOnAllPorts(hDevice); // Register to receive on all ports
175
176 emit starDundeeIsOpen(true);
177
178 emit sendMessage("command code: " + QString::number(commandCode,16) );
179
45 180 return 1;
46 181 }
47 182
48 183 unsigned int StarDundee::CloseStarDundee()
49 184 {
50 185 USBSpaceWire_Close(hDevice); // Close the device
51 emit sendMessage("stardundee *** Close *** USBSpaceWire_Close(hDevice)");
52 openCommunication_BUTTON->setEnabled(true);
53 closeCommunication_BUTTON->setEnabled(false);
186 emit sendMessage("stardundee *** Close *** USBSpaceWire_Close, device: " + QString::number(usbDeviceNumber_SPINBOX->value()));
187 sendPacket_BUTTON->setEnabled(false);
188 sendRMAPPacket_BUTTON->setEnabled(false);
189 readRMAPPacket_BUTTON->setEnabled(false);
190 getRoutingTableEntry_BUTTON->setEnabled(false);
191
192 USBSpaceWire_UnregisterReceiveOnAllPorts(hDevice); // Stop receiving on all ports
193
194 emit starDundeeIsOpen(false);
195
196 return 1;
197 }
198
199 unsigned int StarDundee::GetRoutingTableEntry()
200 {
201 U32 routingTableEntry, outputPorts;
202 char enabled, delHead, priority;
203 int portNum;
204 int tableEntry;
205
206 tableEntry = routingTableEntry_SPINBOX->value();
207
208 // Set the path and return path to the device
209 CFGSpaceWire_StackClear();
210 CFGSpaceWire_AddrStackPush(0);
211 CFGSpaceWire_AddrStackPush(254);
212 CFGSpaceWire_RetAddrStackPush(254);
213
214 // Read the routing table entry
215 if (CFGSpaceWire_GetRoutingTableEntry(hDevice, tableEntry, &routingTableEntry) != CFG_TRANSFER_SUCCESS)
216 {
217 emit sendMessage("Could not read routing table entry [" + QString::number(tableEntry) + "]");
218 }
219 else
220 {
221 // Display the routing table entry properties
222 CFGSpaceWire_RTIsEnabled(routingTableEntry, &enabled);
223 CFGSpaceWire_RTIsDelHead(routingTableEntry, &delHead);
224 CFGSpaceWire_RTIsPriority(routingTableEntry, &priority);
225 CFGSpaceWire_RTGetOutputPorts(routingTableEntry, &outputPorts);
226 emit sendMessage("CFGSpaceWire_RTIsEnabled : " + QString::number(enabled));
227 emit sendMessage("CFGSpaceWire_RTIsDelHead : " + QString::number(delHead));
228 emit sendMessage("CFGSpaceWire_RTIsPriority : " + QString::number(priority));
229 emit sendMessage("CFGSpaceWire_RTGetOutputPorts : ");
230 for (portNum = 0; portNum < 32; portNum++)
231 {
232 if (outputPorts & (1 << portNum))
233 {
234 emit sendMessage(QString::number(portNum));
235 }
236 }
237 }
238
239 return 1;
240 }
241
242 unsigned int StarDundee::SendPacket()
243 {
244 U32 nBufferSize; // The amount of data, in bytes, to be transmitted.
245 char bWait; // If bWait is 0 then the transfer is started and the function returns immediately.
246 // If bWait is not 0 then the function will return only when the transfer is completed or an error is detected.
247
248 nBufferSize = 10;
249 bWait = 1;
250 // Send the packet and wait on it completing
251 result = USBSpaceWire_SendPacket(hDevice, pBuffer, nBufferSize, bWait, &pIdentifier);
252 if (result != TRANSFER_SUCCESS)
253 {
254 emit sendMessage("Error: Could not send the packet");
255 }
256 else emit sendMessage("The packet has been successfully sent");
257
258 // Free the send
259 USBSpaceWire_FreeSend(hDevice, pIdentifier);
260
261 return 1;
262 }
263
264 unsigned int StarDundee::SendRMAP()
265 {
266 unsigned int Value[4];
267 unsigned int count = 4;
268 unsigned int address = 0x40000000;
269 Value[0] = 0xabcd1234;
270 Value[1] = 0xbb;
271 Value[2] = 0xab;
272 Value[3] = 0xcd;
273 WriteStarDundee(Value, count, address);
274 return 1;
275 }
276
277 unsigned int StarDundee::ReadRMAP()
278 {
279 unsigned int Value[100000];
280 unsigned int count = 100000;
281 unsigned int address = 0x40000000;
282 unsigned int result;
283 result = ReadStarDundee(Value, count, address);
284 emit sendMessage("ReadRMAP, nbBytes: " + QString::number(result));
285 emit sendMessage("Value[0]: " + QString::number(Value[0], 16));
286 emit sendMessage("Value[1]: " + QString::number(Value[1], 16));
287 emit sendMessage("Value[2]: " + QString::number(Value[2], 16));
288 emit sendMessage("Value[3]: " + QString::number(Value[3], 16));
54 289 return 1;
55 290 }
291
292 unsigned int StarDundee::ReadStarDundee(unsigned int *Value, unsigned int count, unsigned int address)
293 {
294 RMAP *RMAPCommand;
295 rmap_read_reply_PcktHdr_t rmapReplyHeader;
296 USB_SPACEWIRE_STATUS result; // The result of the receive operation
297 USB_SPACEWIRE_PACKET_PROPERTIES properties; // The properties of the read
298 unsigned int nbBytes;
299 unsigned char* packet;
300 U32 nPacketNum;
301 unsigned int offset;
302 unsigned int i;
303
304 //**********************
305 // SEND THE READ COMMAND
306 nbBytes = 4 * count;
307 if (nbBytes > 4)
308 {
309 RMAPCommand = new RMAP(read_Inc, // build the command
310 rmapTargetLogicalAddress,
311 rmapSourceLogicalAddress,
312 address,
313 nbBytes,
314 NULL);
315 }
316 else
317 {
318 RMAPCommand = new RMAP(read_Single, // build the command
319 rmapTargetLogicalAddress,
320 rmapSourceLogicalAddress,
321 address,
322 nbBytes,
323 NULL);
324 }
325
326 result = USBSpaceWire_SendPacket(hDevice,
327 (unsigned char*) ((void*) &RMAPCommand->RMAPHeader),
328 sizeof(RMAPCommand->RMAPHeader),
329 BWAIT_1, &pIdentifier);
330 if (result != TRANSFER_SUCCESS) emit sendMessage("ERROR *** ReadStarDundee when sending the READ command ");
331 else emit sendMessage("OK *** ReadStarDundee when sending the READ command");
332
333 //*****************
334 // RECEIVE THE DATA
335 nbBytes = sizeof(rmapReplyHeader) + 4 * count + 1; // 1 is for the data CRC
336 packet = (unsigned char *) malloc(nbBytes);
337 nPacketNum = 1;
338 result = USBSpaceWire_ReadPackets(hDevice, packet, nbBytes, nPacketNum, BWAIT_1, &properties, &pIdentifier);
339 if (result != TRANSFER_SUCCESS) emit sendMessage("Error: Could not receive the packet");
340 else
341 {
342 emit sendMessage("A packet of length " + QString::number(properties.len) + " has been successfully received");
343 offset = sizeof(rmapReplyHeader);
344 for(i=0; i<count; i++)
345 {
346 Value[i] = packet[offset+3];
347 Value[i] = Value[i] + packet[offset+2] * pow(2, 8);
348 Value[i] = Value[i] + packet[offset+1] * pow(2, 16);
349 Value[i] = Value[i] + packet[offset+0] * pow(2, 24);
350 offset = offset + 4;
351 }
352 free(packet);
353 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
354 return count;
355 }
356
357 return 1;
358 }
359
360 unsigned int StarDundee::WriteStarDundee(unsigned int *Value, unsigned int count, unsigned int address)
361 {
362 RMAP *RMAPCommand;
363 unsigned char *data;
364 char *dataCHAR;
365 unsigned char *aux;
366 unsigned int offset;
367 U32 dataSize, headerSize, CRCSize, totalSize; // sizes in bytes
368 U32 nPacketNum;
369 USB_SPACEWIRE_PACKET_PROPERTIES properties; // The properties of the read
370 rmap_write_reply_t rmapReplyHeader;
371
372 dataSize = count * 4;
373 dataCHAR = (char *) malloc(dataSize);
374 for (unsigned int i = 0; i<count; i++)
375 {
376 dataCHAR[i*4+3] = (char) ((unsigned int) Value[i]);
377 dataCHAR[i*4+2] = (char) ((unsigned int) Value[i]>>8);
378 dataCHAR[i*4+1] = (char) ((unsigned int) Value[i]>>16);
379 dataCHAR[i*4+0] = (char) ((unsigned int) Value[i]>>24);
380 }
381
382 RMAPCommand = new RMAP(commandCode,
383 rmapTargetLogicalAddress,
384 rmapSourceLogicalAddress,
385 address,
386 dataSize,
387 dataCHAR);
388 free(dataCHAR);
389 headerSize = sizeof(RMAPCommand->RMAPHeader);
390 CRCSize = 1;
391
392 //*************************
393 // BUILD THE PACKET TO SEND
394 totalSize = headerSize + dataSize + CRCSize;
395 data = (unsigned char*) malloc( totalSize );
396 aux = (unsigned char*) ((void*) &RMAPCommand->RMAPHeader);
397 for(unsigned int i = 0; i<headerSize; i++) data[i] = aux[i];
398 offset = headerSize;
399 for(unsigned int i = 0; i<count; i++)
400 {
401 data[offset+3] = (unsigned char) (Value[i]);
402 data[offset+2] = (unsigned char) (Value[i]>>8);
403 data[offset+1] = (unsigned char) (Value[i]>>16);
404 data[offset] = (unsigned char) (Value[i]>>24);
405 offset = offset + 4;
406 }
407 data[offset] = RMAPCommand->dataCRC;
408
409 //************
410 // SEND THE PACKET
411 result = USBSpaceWire_SendPacket(hDevice,
412 data,
413 totalSize,
414 BWAIT_1, &pIdentifier);
415 if (result != TRANSFER_SUCCESS)
416 {
417 emit sendMessage("ERROR *** WriteStarDundee when sending packet of size "
418 + QString::number(totalSize) +", with code: " + QString::number(result));
419 USBSpaceWire_FreeSend(hDevice, pIdentifier);
420 free(data);
421 return 1;
422 }
423 else emit sendMessage("OK *** WriteStarDundee when sending packet of size " + QString::number(totalSize));
424
425 //**************
426 // Free the send
427 USBSpaceWire_FreeSend(hDevice, pIdentifier);
428 free(data);
429
430 if ( (commandCode == writeSingle_noVer_Rep) | (commandCode == writeInc_noVer_Rep) |
431 (commandCode == writeSingle_ver_rep) | (commandCode == writeInc_ver_rep) )
432 {
433 //***********************
434 // RECEIVE THE RMAP REPLY
435 totalSize = sizeof(rmapReplyHeader);
436 nPacketNum = 1;
437 result = USBSpaceWire_ReadPackets(hDevice, (char *) &rmapReplyHeader, totalSize, nPacketNum, BWAIT_1, &properties, &pIdentifier);
438 if (result != TRANSFER_SUCCESS)
439 {
440 emit sendMessage("Error: Could not receive the RMAP reply");
441 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
442 return 1;
443 }
444 else
445 {
446 emit sendMessage("An RMAP reply of length " + QString::number(properties.len) + " has been successfully received");
447 USBSpaceWire_FreeRead(hDevice, pIdentifier); // Free the receive
448 }
449 if(properties.len != 8)
450 {
451 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n");
452 return 1;
453 }
454 emit sendMessage("data CRC " + QString::number(RMAPCommand->dataCRC, 16) );
455 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.initiatorLogicalAddress, 16) );
456 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.protocolIdentifier, 16) );
457 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.instruction, 16) );
458 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.status, 16) );
459 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.targetLogicalAddress, 16) );
460 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.transactionIdentifier1, 16) );
461 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.transactionIdentifier2, 16) );
462 emit sendMessage("rmapReplyHeader " + QString::number(rmapReplyHeader.headerCRC, 16) );
463 switch (rmapReplyHeader.status) // byte 4 is the status byte in the reply
464 {
465 case 0:
466 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 0 Successfull");
467 break;
468 case 1:
469 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** General error code");
470 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 1 General error code");
471 break;
472 case 2:
473 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code");
474 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code");
475 break;
476 case 3:
477 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key");
478 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 3 Invalid key");
479 break;
480 case 4:
481 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC");
482 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 4 Invalid data CRC");
483 break;
484 case 5:
485 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP");
486 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 5 Early EOP");
487 break;
488 case 6:
489 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data");
490 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 6 Too much data");
491 break;
492 case 7:
493 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** EEP");
494 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 7 EEP");
495 break;
496 case 8:
497 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved");
498 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 8 Reserved");
499 break;
500 case 9:
501 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun");
502 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun");
503 break;
504 case 10:
505 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised");
506 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised");
507 break;
508 case 11:
509 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error");
510 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error");
511 break;
512 case 12:
513 emit appendToLog("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address");
514 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: 12 Invalid target logical address");
515 break;
516 }
517 }
518 else
519 emit RMAP_write_reply_setText("reply to the write command required\nlast reply status: unavailable");
520 return count;
521 }
522
523 //******
524 // SLOTS
525
526 void StarDundee::updateCommandCode(RMAP_command_codes code)
527 {
528 this->commandCode = code;
529 }
@@ -1,38 +1,72
1 1 #ifndef STARDUNDEE_H
2 2 #define STARDUNDEE_H
3 3
4 4 #include <QWidget>
5 5 #include "spw_usb_api.h"
6 #include "spw_config_library.h"
6 7 #include <QPushButton>
7 8 #include <QGridLayout>
8 9 #include <QSpinBox>
9 10 #include <QLabel>
11 #include "rmapoperations.h"
12
13 #define BWAIT_0 0
14 #define BWAIT_1 1
10 15
11 16 class StarDundee : public QWidget
12 17 {
13 18 Q_OBJECT
14 19 public:
15 20 explicit StarDundee(QWidget *parent = 0);
16 21 ~StarDundee();
17 star_device_handle hDevice;// Handle to the SpaceWire device
18 QGridLayout *connection_LAYOUT;
22 unsigned int WriteStarDundee(unsigned int *Value,unsigned int count,unsigned int address=0);
23 unsigned int ReadStarDundee(unsigned int *Value,unsigned int count,unsigned int address=0);
19 24
20 25 signals:
21 26 void sendMessage(QString message);
27 void starDundeeIsOpen(bool);
28 void RMAP_write_reply_setText(QString);
29 void appendToLog(QString);
22 30
23 31 public slots:
24 32 unsigned int OpenStarDundee();
25 33 unsigned int CloseStarDundee();
34 unsigned int SendPacket();
35 unsigned int SendRMAP();
36 unsigned int ReadRMAP();
37 unsigned int GetRoutingTableEntry();
38 void updateCommandCode(RMAP_command_codes code);
26 39
27 40 private:
41 char rmapTargetLogicalAddress ;
42 char rmapSourceLogicalAddress ;
28 43
29 QPushButton *openCommunication_BUTTON;
30 QPushButton *closeCommunication_BUTTON;
44 QPushButton *sendPacket_BUTTON;
45 QPushButton *sendRMAPPacket_BUTTON;
46 QPushButton *readRMAPPacket_BUTTON;
47 QPushButton *getRoutingTableEntry_BUTTON;
31 48
32 49 QLabel *usbDeviceNumber_LABEL;
50 QLabel *linkNumber_LABEL;
51 QLabel *routingTableEntry_LABEL;
52 QLabel *sourceLogicalAddress_LABEL;
33 53
34 54 QSpinBox *usbDeviceNumber_SPINBOX;
55 QSpinBox *linkNumber_SPINBOX;
56 QSpinBox *routingTableEntry_SPINBOX;
57 QSpinBox *sourceLogicalAddress_SPINBOX;
58
59 QGridLayout *connection_LAYOUT;
60
61 unsigned char pBuffer[10]; // Pointer to the start of the user buffer from which to transmit data
62 unsigned char* rmapPacket; // The buffer to receive RMAP READ packets
63 USB_SPACEWIRE_ID pIdentifier; // A pointer to a variable which will be set to contain a unique identifier for the send
64
65 RMAP_command_codes commandCode;
66
67 star_device_handle hDevice; // Handle to the SpaceWire device
68 USB_SPACEWIRE_STATUS result; // The result of the send operation
35 69
36 70 };
37 71
38 72 #endif // STARDUNDEE_H
General Comments 0
You need to be logged in to leave comments. Login now