##// END OF EJS Templates
Initial commit: rmapplugin fully operational with the GRESB Ethernet/SpaceWire bridge.
leroy -
r0:081a6eb3cced default
parent child
Show More
@@ -0,0 +1,9
1 syntax: glob
2 *.o
3 *.so
4 *.so.1
5 *.so.1.0
6 *.so.1.0.0
7 *~
8 *moc_*
9
@@ -0,0 +1,142
1 #############################################################################
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
4 # Project: PAULs_LPPMON_PLUGINS.pro
5 # Template: subdirs
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
7 #############################################################################
8
9 first: make_default
10 MAKEFILE = Makefile
11 QMAKE = /usr/bin/qmake-qt4
12 DEL_FILE = rm -f
13 CHK_DIR_EXISTS= test -d
14 MKDIR = mkdir -p
15 COPY = cp -f
16 COPY_FILE = $(COPY)
17 COPY_DIR = $(COPY) -r
18 INSTALL_FILE = install -m 644 -p
19 INSTALL_PROGRAM = install -m 755 -p
20 INSTALL_DIR = $(COPY_DIR)
21 DEL_FILE = rm -f
22 SYMLINK = ln -f -s
23 DEL_DIR = rmdir
24 MOVE = mv -f
25 CHK_DIR_EXISTS= test -d
26 MKDIR = mkdir -p
27 SUBTARGETS = \
28 sub-rmapplugin
29
30 rmapplugin/$(MAKEFILE):
31 @$(CHK_DIR_EXISTS) rmapplugin/ || $(MKDIR) rmapplugin/
32 cd rmapplugin/ && $(QMAKE) /opt/LPPMON_PLUGINS_PAUL/rmapplugin/rmapplugin.pro -spec /usr/lib64/qt4/mkspecs/linux-g++ -o $(MAKEFILE)
33 sub-rmapplugin-qmake_all: FORCE
34 @$(CHK_DIR_EXISTS) rmapplugin/ || $(MKDIR) rmapplugin/
35 cd rmapplugin/ && $(QMAKE) /opt/LPPMON_PLUGINS_PAUL/rmapplugin/rmapplugin.pro -spec /usr/lib64/qt4/mkspecs/linux-g++ -o $(MAKEFILE)
36 sub-rmapplugin: rmapplugin/$(MAKEFILE) FORCE
37 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE)
38 sub-rmapplugin-make_default-ordered: rmapplugin/$(MAKEFILE) FORCE
39 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE)
40 sub-rmapplugin-make_default: rmapplugin/$(MAKEFILE) FORCE
41 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE)
42 sub-rmapplugin-make_first-ordered: rmapplugin/$(MAKEFILE) FORCE
43 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) first
44 sub-rmapplugin-make_first: rmapplugin/$(MAKEFILE) FORCE
45 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) first
46 sub-rmapplugin-all-ordered: rmapplugin/$(MAKEFILE) FORCE
47 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) all
48 sub-rmapplugin-all: rmapplugin/$(MAKEFILE) FORCE
49 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) all
50 sub-rmapplugin-clean-ordered: rmapplugin/$(MAKEFILE) FORCE
51 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) clean
52 sub-rmapplugin-clean: rmapplugin/$(MAKEFILE) FORCE
53 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) clean
54 sub-rmapplugin-distclean-ordered: rmapplugin/$(MAKEFILE) FORCE
55 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) distclean
56 sub-rmapplugin-distclean: rmapplugin/$(MAKEFILE) FORCE
57 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) distclean
58 sub-rmapplugin-install_subtargets-ordered: rmapplugin/$(MAKEFILE) FORCE
59 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) install
60 sub-rmapplugin-install_subtargets: rmapplugin/$(MAKEFILE) FORCE
61 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) install
62 sub-rmapplugin-uninstall_subtargets-ordered: rmapplugin/$(MAKEFILE) FORCE
63 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) uninstall
64 sub-rmapplugin-uninstall_subtargets: rmapplugin/$(MAKEFILE) FORCE
65 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) uninstall
66
67 Makefile: PAULs_LPPMON_PLUGINS.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
68 /usr/lib64/qt4/mkspecs/common/linux.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
70 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
72 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
73 /usr/lib64/qt4/mkspecs/qconfig.pri \
74 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \
75 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
76 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
77 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
78 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
81 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
82 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
83 /usr/lib64/qt4/mkspecs/features/qt.prf \
84 /usr/lib64/qt4/mkspecs/features/unix/thread.prf \
85 /usr/lib64/qt4/mkspecs/features/moc.prf \
86 /usr/lib64/qt4/mkspecs/features/resources.prf \
87 /usr/lib64/qt4/mkspecs/features/uic.prf \
88 /usr/lib64/qt4/mkspecs/features/yacc.prf \
89 /usr/lib64/qt4/mkspecs/features/lex.prf \
90 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
91 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
92 /usr/lib64/qt4/mkspecs/common/unix.conf:
93 /usr/lib64/qt4/mkspecs/common/linux.conf:
94 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
95 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
96 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
97 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
98 /usr/lib64/qt4/mkspecs/qconfig.pri:
99 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri:
100 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
101 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
102 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
103 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
104 /usr/lib64/qt4/mkspecs/features/release.prf:
105 /usr/lib64/qt4/mkspecs/features/default_post.prf:
106 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
107 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
108 /usr/lib64/qt4/mkspecs/features/qt.prf:
109 /usr/lib64/qt4/mkspecs/features/unix/thread.prf:
110 /usr/lib64/qt4/mkspecs/features/moc.prf:
111 /usr/lib64/qt4/mkspecs/features/resources.prf:
112 /usr/lib64/qt4/mkspecs/features/uic.prf:
113 /usr/lib64/qt4/mkspecs/features/yacc.prf:
114 /usr/lib64/qt4/mkspecs/features/lex.prf:
115 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
116 qmake: qmake_all FORCE
117 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile PAULs_LPPMON_PLUGINS.pro
118
119 qmake_all: sub-rmapplugin-qmake_all FORCE
120
121 make_default: sub-rmapplugin-make_default-ordered FORCE
122 make_first: sub-rmapplugin-make_first-ordered FORCE
123 all: sub-rmapplugin-all-ordered FORCE
124 clean: sub-rmapplugin-clean-ordered FORCE
125 distclean: sub-rmapplugin-distclean-ordered FORCE
126 -$(DEL_FILE) Makefile
127 install_subtargets: sub-rmapplugin-install_subtargets-ordered FORCE
128 uninstall_subtargets: sub-rmapplugin-uninstall_subtargets-ordered FORCE
129
130 sub-rmapplugin-check_ordered: rmapplugin/$(MAKEFILE)
131 cd rmapplugin/ && $(MAKE) -f $(MAKEFILE) check
132 check: sub-rmapplugin-check_ordered
133
134 mocclean: compiler_moc_header_clean compiler_moc_source_clean
135
136 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
137 install: install_subtargets FORCE
138
139 uninstall: uninstall_subtargets FORCE
140
141 FORCE:
142
@@ -0,0 +1,11
1 TEMPLATE = subdirs
2 CONFIG += ordered
3
4 win32:LPPMONCFG = /opt/lppmon
5 unix:LPPMONCFG = /etc/lppmon
6
7 SUBDIRS = \
8 rmapplugin
9
10
11 #include( $${LPPMONCFG}/lppmonplugin.prf)
@@ -0,0 +1,264
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by Qt Creator 2.4.1, 2012-11-29T13:08:48. -->
4 <qtcreator>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
8 </data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <value type="QString" key="language">Cpp</value>
16 <valuemap type="QVariantMap" key="value">
17 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 </valuemap>
19 </valuemap>
20 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <value type="QString" key="language">QmlJS</value>
22 <valuemap type="QVariantMap" key="value">
23 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 </valuemap>
25 </valuemap>
26 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
28 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
31 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
32 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
33 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
34 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
35 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
36 <value type="int" key="EditorConfiguration.TabSize">8</value>
37 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
38 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
39 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
40 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
41 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
42 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
43 </valuemap>
44 </data>
45 <data>
46 <variable>ProjectExplorer.Project.PluginSettings</variable>
47 <valuemap type="QVariantMap"/>
48 </data>
49 <data>
50 <variable>ProjectExplorer.Project.Target.0</variable>
51 <valuemap type="QVariantMap">
52 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
53 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
55 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
56 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
58 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
59 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
65 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
66 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
67 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
69 </valuemap>
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
71 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
74 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
75 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
76 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
77 </valuemap>
78 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
79 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
80 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
81 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
82 </valuemap>
83 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
84 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
85 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
88 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
89 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
91 </valuemap>
92 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
96 </valuemap>
97 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
98 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
99 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
100 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
103 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
104 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
105 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
106 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
107 </valuemap>
108 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
109 <value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit./usr/bin/gdb</value>
110 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
111 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
115 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
116 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
117 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
118 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
119 </valuemap>
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
124 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
125 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
126 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
127 </valuemap>
128 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
132 </valuemap>
133 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
134 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
138 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
139 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
140 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
141 </valuemap>
142 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
144 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
146 </valuemap>
147 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
148 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
149 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
150 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
151 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
153 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
154 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/LPPMON_PLUGINS_PAUL</value>
155 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">1</value>
156 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
157 </valuemap>
158 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
159 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
160 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
161 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
162 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
163 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
165 </valuemap>
166 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
168 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
169 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
170 </valuemap>
171 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
172 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
173 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
174 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
175 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
176 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
177 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
178 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
179 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
180 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
181 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
182 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
183 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
184 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
185 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
186 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
187 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
188 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
189 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
190 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
191 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
192 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
193 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
194 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
196 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
197 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
198 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
199 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
200 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
201 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
202 <value type="int">0</value>
203 <value type="int">1</value>
204 <value type="int">2</value>
205 <value type="int">3</value>
206 <value type="int">4</value>
207 <value type="int">5</value>
208 <value type="int">6</value>
209 <value type="int">7</value>
210 <value type="int">8</value>
211 <value type="int">9</value>
212 <value type="int">10</value>
213 <value type="int">11</value>
214 <value type="int">12</value>
215 <value type="int">13</value>
216 <value type="int">14</value>
217 </valuelist>
218 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
219 <value type="int">0</value>
220 <value type="int">1</value>
221 <value type="int">2</value>
222 <value type="int">3</value>
223 <value type="int">4</value>
224 <value type="int">5</value>
225 <value type="int">6</value>
226 <value type="int">7</value>
227 <value type="int">8</value>
228 <value type="int">9</value>
229 <value type="int">10</value>
230 <value type="int">11</value>
231 <value type="int">12</value>
232 <value type="int">13</value>
233 <value type="int">14</value>
234 </valuelist>
235 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
236 <value type="int" key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase">2</value>
237 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">lppmon</value>
238 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
239 <valuelist type="QVariantList" key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges"/>
240 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
241 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run lppmon</value>
242 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
243 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
244 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
245 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
246 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
247 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
248 </valuemap>
249 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
250 </valuemap>
251 </data>
252 <data>
253 <variable>ProjectExplorer.Project.TargetCount</variable>
254 <value type="int">1</value>
255 </data>
256 <data>
257 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
258 <value type="QString">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
259 </data>
260 <data>
261 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
262 <value type="int">10</value>
263 </data>
264 </qtcreator>
@@ -0,0 +1,31
1 #include "gresbstatusenquiry.h"
2 #include <QTableWidgetItem>
3
4 gresbStatusEnquiry::gresbStatusEnquiry(QWidget *parent) :
5 QWidget(parent)
6 {
7 mainLayout = new QGridLayout;
8 readSPWStatusButton = new QPushButton(tr("Read SpaceWire Status"));
9 statusQueryTable = new QTableWidget(10, 3);
10 statusQueryTable->setHorizontalHeaderLabels(QStringList() << "link 0" << "link 1" << "link 2");
11 statusQueryTable->setVerticalHeaderLabels(QStringList() << "Running"
12 << "Clock divisor"
13 << "Received"
14 << "Packets"
15 << "Data (bytes)"
16 << "EEPs"
17 << "Truncated"
18 << "Transmitted"
19 << "Packets"
20 << "Data (bytes)");
21 for (int r = 0; r < 10; r++)
22 {
23 for (int c = 0; c < 3; c++)
24 {
25 statusQueryTable->setItem(r, c, new QTableWidgetItem("-"));
26 }
27 }
28 mainLayout->addWidget(statusQueryTable,0 , 0, 0);
29 mainLayout->addWidget(readSPWStatusButton,1, 0, 0);
30 setLayout(mainLayout);
31 }
@@ -0,0 +1,63
1 #ifndef GRESBSTATUSENQUIRY_H
2 #define GRESBSTATUSENQUIRY_H
3
4 #include <QWidget>
5 #include <QTableWidget>
6 #include <QGridLayout>
7 #include <QPushButton>
8 #include <gresbstatusqueryTYPES.h>
9
10 enum GresbStatusQueryOption{
11 LinkStatus,
12 LinkStatistics,
13 NodeAddressStatistics,
14 GetRoute};
15
16 struct gresb_status_query_str
17 {
18 char protocolIdentifier;
19 char reserved1;
20 char reserved0;
21 char option;
22 char value3;
23 char value2;
24 char value1;
25 char value0;
26 };
27 typedef gresb_status_query_str gresb_status_query_t;
28
29 struct gresb_link_status_reply_str
30 {
31 char byte3;
32 char byte2;
33 char byte1;
34 char byte0;
35 };
36 typedef gresb_link_status_reply_str gresb_link_status_reply_t;
37
38 struct gresb_link_statistics_reply_str
39 {
40 char numberOfPacketsReceived[4];
41 char sizeOfDataReceived[4];
42 char numberOfPacketsWithEEPReceived[4];
43 char numberOfTruncatedPacketsReceived[4];
44 char numberOfPacketsTransmitted[4];
45 char sizeOfDataTransmitted[4];
46 };
47 typedef gresb_link_statistics_reply_str gresb_link_statistics_reply_t;
48
49 class gresbStatusEnquiry : public QWidget
50 {
51 Q_OBJECT
52 public:
53 explicit gresbStatusEnquiry(QWidget *parent = 0);
54 QGridLayout* mainLayout;
55 QTableWidget* statusQueryTable;
56 QPushButton* readSPWStatusButton;
57
58 signals:
59
60 public slots:
61 };
62
63 #endif // GRESBSTATUSENQUIRY_H
@@ -0,0 +1,7
1 #ifndef GRESBSTATUSQUERY_H
2 #define GRESBSTATUSQUERY_H
3
4
5
6
7 #endif // GRESBSTATUSQUERY_H
@@ -0,0 +1,69
1 #include "qipdialogbox.h"
2 #include <QSpinBox>
3 #include <QHBoxLayout>
4 #include <QVBoxLayout>
5 #include <QLabel>
6 #include <QString>
7 #include <QLocale>
8
9 QIPDialogBox::QIPDialogBox(QWidget *parent) :
10 QWidget(parent)
11 {
12 //labelGRESBIP = new QLabel(tr("IP not set"));
13 QHBoxLayout *addressLayout = new QHBoxLayout;
14 QVBoxLayout *mainLayout = new QVBoxLayout;
15 addressPart1 = new QSpinBox;
16 addressPart2 = new QSpinBox;
17 addressPart3 = new QSpinBox;
18 addressPart4 = new QSpinBox;
19
20 addressPart1->setRange(0, 255);
21 addressPart1->setValue(129);
22 addressPart1->setButtonSymbols(QAbstractSpinBox::NoButtons);
23
24 addressPart2->setRange(0, 255);
25 addressPart2->setValue(104);
26 addressPart2->setButtonSymbols(QAbstractSpinBox::NoButtons);
27
28 addressPart3->setRange(0, 255);
29 addressPart3->setValue(27);
30 addressPart3->setButtonSymbols(QAbstractSpinBox::NoButtons);
31
32 addressPart4->setRange(0, 255);
33 addressPart4->setValue(113);
34 addressPart4->setButtonSymbols(QAbstractSpinBox::NoButtons);
35
36 valueChanged();
37
38 connect(addressPart1, SIGNAL(valueChanged(int)), this, SLOT(valueChanged()));
39 connect(addressPart2, SIGNAL(valueChanged(int)), this, SLOT(valueChanged()));
40 connect(addressPart3, SIGNAL(valueChanged(int)), this, SLOT(valueChanged()));
41 connect(addressPart4, SIGNAL(valueChanged(int)), this, SLOT(valueChanged()));
42
43 addressLayout->addWidget(addressPart1);
44 addressLayout->addWidget(addressPart2);
45 addressLayout->addWidget(addressPart3);
46 addressLayout->addWidget(addressPart4);
47 mainLayout->addLayout(addressLayout);
48 //mainLayout->addWidget(labelGRESBIP);
49
50 setLayout(mainLayout);
51 }
52
53 void QIPDialogBox::valueChanged() // SLOT
54 {
55 gresbIP = addressPart1->cleanText();
56 gresbIP.append(".");
57 gresbIP.append(addressPart2->cleanText());
58 gresbIP.append(".");
59 gresbIP.append(addressPart3->cleanText());
60 gresbIP.append(".");
61 gresbIP.append(addressPart4->cleanText());
62 //labelGRESBIP->setText("IP used for the gresb module: " + gresbIP);
63 }
64
65 QString QIPDialogBox::getGRESBIP()
66 {
67 return(gresbIP);
68 }
69
@@ -0,0 +1,30
1 #ifndef WIDGETADDRESS_H
2 #define WIDGETADDRESS_H
3
4 #include <QWidget>
5 #include <QSpinBox>
6 #include <QString>
7 #include <QLabel>
8
9 class QIPDialogBox : public QWidget
10 {
11 Q_OBJECT
12 public:
13 explicit QIPDialogBox(QWidget *parent = 0);
14 QString getGRESBIP();
15
16 signals:
17
18 public slots:
19 void valueChanged();
20
21 private:
22 QSpinBox *addressPart1;
23 QSpinBox *addressPart2;
24 QSpinBox *addressPart3;
25 QSpinBox *addressPart4;
26 //QLabel * labelGRESBIP;
27 QString gresbIP;
28 };
29
30 #endif // WIDGETADDRESS_H
@@ -0,0 +1,410
1 #############################################################################
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
4 # Project: rmapplugin.pro
5 # Template: lib
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
7 #############################################################################
8
9 ####### Compiler, tools and options
10
11 CC = gcc
12 CXX = g++
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 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 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 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 LINK = g++
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
20 AR = ar cqs
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
24 COMPRESS = gzip -9f
25 COPY = cp -f
26 SED = sed
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
29 STRIP =
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
39
40 ####### Output directory
41
42 OBJECTS_DIR = obj/
43
44 ####### Files
45
46 SOURCES = rmapplugin.cpp \
47 rmappluginui.cpp \
48 rmapoperations.cpp \
49 ccsds.cpp \
50 spwpacketreceiver.cpp \
51 ../common_PLE/qipdialogbox.cpp \
52 ../common_PLE/gresbstatusenquiry.cpp \
53 spectralmatricesdmasimulator.cpp \
54 rmappluginpythonwrapper.cpp \
55 stardundee.cpp \
56 /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp moc/moc_rmappluginui.cpp \
57 moc/moc_rmapplugin.cpp \
58 moc/moc_spwpacketreceiver.cpp \
59 moc/moc_qipdialogbox.cpp \
60 moc/moc_gresbstatusenquiry.cpp \
61 moc/moc_spectralmatricesdmasimulator.cpp \
62 moc/moc_rmappluginpythonwrapper.cpp \
63 moc/moc_stardundee.cpp \
64 moc/moc_genericPySysdriver.cpp \
65 moc/moc_lppmonplugin.cpp
66 OBJECTS = obj/rmapplugin.o \
67 obj/rmappluginui.o \
68 obj/rmapoperations.o \
69 obj/ccsds.o \
70 obj/spwpacketreceiver.o \
71 obj/qipdialogbox.o \
72 obj/gresbstatusenquiry.o \
73 obj/spectralmatricesdmasimulator.o \
74 obj/rmappluginpythonwrapper.o \
75 obj/stardundee.o \
76 obj/lppmonplugininterface.o \
77 obj/moc_rmappluginui.o \
78 obj/moc_rmapplugin.o \
79 obj/moc_spwpacketreceiver.o \
80 obj/moc_qipdialogbox.o \
81 obj/moc_gresbstatusenquiry.o \
82 obj/moc_spectralmatricesdmasimulator.o \
83 obj/moc_rmappluginpythonwrapper.o \
84 obj/moc_stardundee.o \
85 obj/moc_genericPySysdriver.o \
86 obj/moc_lppmonplugin.o
87 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
88 /usr/lib64/qt4/mkspecs/common/linux.conf \
89 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
90 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
91 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
92 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
93 /usr/lib64/qt4/mkspecs/qconfig.pri \
94 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \
95 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
96 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
97 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
98 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
99 /usr/lib64/qt4/mkspecs/features/release.prf \
100 /usr/lib64/qt4/mkspecs/features/default_post.prf \
101 /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf \
102 /usr/lib64/qt4/mkspecs/features/pythonqt.prf \
103 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
104 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
105 /usr/lib64/qt4/mkspecs/features/qt.prf \
106 /usr/lib64/qt4/mkspecs/features/unix/thread.prf \
107 /usr/lib64/qt4/mkspecs/features/moc.prf \
108 /usr/lib64/qt4/mkspecs/features/resources.prf \
109 /usr/lib64/qt4/mkspecs/features/uic.prf \
110 /usr/lib64/qt4/mkspecs/features/yacc.prf \
111 /usr/lib64/qt4/mkspecs/features/lex.prf \
112 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
113 rmapplugin.pro
114 QMAKE_TARGET = rmapplugin
115 DESTDIR = bin/
116 TARGET = librmapplugin.so.1.0.0
117 TARGETA = bin/librmapplugin.a
118 TARGETD = librmapplugin.so.1.0.0
119 TARGET0 = librmapplugin.so
120 TARGET1 = librmapplugin.so.1
121 TARGET2 = librmapplugin.so.1.0
122
123 first: all
124 ####### Implicit rules
125
126 .SUFFIXES: .o .c .cpp .cc .cxx .C
127
128 .cpp.o:
129 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
130
131 .cc.o:
132 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
133
134 .cxx.o:
135 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
136
137 .C.o:
138 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
139
140 .c.o:
141 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
142
143 ####### Build rules
144
145 all: Makefile bin/$(TARGET)
146
147 bin/$(TARGET): $(OBJECTS) $(SUBLIBS) $(OBJCOMP)
148 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
149 -$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)
150 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)
151 -ln -s $(TARGET) $(TARGET0)
152 -ln -s $(TARGET) $(TARGET1)
153 -ln -s $(TARGET) $(TARGET2)
154 -$(DEL_FILE) bin/$(TARGET)
155 -$(DEL_FILE) bin/$(TARGET0)
156 -$(DEL_FILE) bin/$(TARGET1)
157 -$(DEL_FILE) bin/$(TARGET2)
158 -$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) bin/
159
160
161
162 staticlib: $(TARGETA)
163
164 $(TARGETA): $(OBJECTS) $(OBJCOMP)
165 -$(DEL_FILE) $(TARGETA)
166 $(AR) $(TARGETA) $(OBJECTS)
167
168 Makefile: rmapplugin.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
169 /usr/lib64/qt4/mkspecs/common/linux.conf \
170 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
171 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
172 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
173 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
174 /usr/lib64/qt4/mkspecs/qconfig.pri \
175 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \
176 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
177 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
178 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
179 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
180 /usr/lib64/qt4/mkspecs/features/release.prf \
181 /usr/lib64/qt4/mkspecs/features/default_post.prf \
182 /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf \
183 /usr/lib64/qt4/mkspecs/features/pythonqt.prf \
184 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
185 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
186 /usr/lib64/qt4/mkspecs/features/qt.prf \
187 /usr/lib64/qt4/mkspecs/features/unix/thread.prf \
188 /usr/lib64/qt4/mkspecs/features/moc.prf \
189 /usr/lib64/qt4/mkspecs/features/resources.prf \
190 /usr/lib64/qt4/mkspecs/features/uic.prf \
191 /usr/lib64/qt4/mkspecs/features/yacc.prf \
192 /usr/lib64/qt4/mkspecs/features/lex.prf \
193 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
194 /usr/lib64/libQtGui.prl \
195 /usr/lib64/libQtCore.prl \
196 /usr/lib64/libQtNetwork.prl
197 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
198 /usr/lib64/qt4/mkspecs/common/unix.conf:
199 /usr/lib64/qt4/mkspecs/common/linux.conf:
200 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
201 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
202 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
203 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
204 /usr/lib64/qt4/mkspecs/qconfig.pri:
205 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri:
206 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
207 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
208 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
209 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
210 /usr/lib64/qt4/mkspecs/features/release.prf:
211 /usr/lib64/qt4/mkspecs/features/default_post.prf:
212 /usr/lib64/qt4/mkspecs/features/lppmonplugin.prf:
213 /usr/lib64/qt4/mkspecs/features/pythonqt.prf:
214 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
215 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
216 /usr/lib64/qt4/mkspecs/features/qt.prf:
217 /usr/lib64/qt4/mkspecs/features/unix/thread.prf:
218 /usr/lib64/qt4/mkspecs/features/moc.prf:
219 /usr/lib64/qt4/mkspecs/features/resources.prf:
220 /usr/lib64/qt4/mkspecs/features/uic.prf:
221 /usr/lib64/qt4/mkspecs/features/yacc.prf:
222 /usr/lib64/qt4/mkspecs/features/lex.prf:
223 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
224 /usr/lib64/libQtGui.prl:
225 /usr/lib64/libQtCore.prl:
226 /usr/lib64/libQtNetwork.prl:
227 qmake: FORCE
228 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile rmapplugin.pro
229
230 dist:
231 @$(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
233
234
235 clean:compiler_clean
236 -$(DEL_FILE) $(OBJECTS)
237 -$(DEL_FILE) *~ core *.core
238
239
240 ####### Sub-libraries
241
242 distclean: clean
243 -$(DEL_FILE) bin/$(TARGET)
244 -$(DEL_FILE) bin/$(TARGET0) bin/$(TARGET1) bin/$(TARGET2) $(TARGETA)
245 -$(DEL_FILE) Makefile
246
247
248 check: first
249
250 mocclean: compiler_moc_header_clean compiler_moc_source_clean
251
252 mocables: compiler_moc_header_make_all compiler_moc_source_make_all
253
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
255 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
257 moc/moc_rmappluginui.cpp: rmapoperations.h \
258 spectralmatricesdmasimulator.h \
259 rmappluginui.h
260 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginui.h -o moc/moc_rmappluginui.cpp
261
262 moc/moc_rmapplugin.cpp: rmappluginui.h \
263 rmapoperations.h \
264 spectralmatricesdmasimulator.h \
265 ccsds.h \
266 spwpacketreceiver.h \
267 rmapplugin.h
268 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmapplugin.h -o moc/moc_rmapplugin.cpp
269
270 moc/moc_spwpacketreceiver.cpp: spwpacketreceiver.h
271 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spwpacketreceiver.h -o moc/moc_spwpacketreceiver.cpp
272
273 moc/moc_qipdialogbox.cpp: ../common_PLE/qipdialogbox.h
274 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/qipdialogbox.h -o moc/moc_qipdialogbox.cpp
275
276 moc/moc_gresbstatusenquiry.cpp: ../common_PLE/gresbstatusenquiry.h
277 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) ../common_PLE/gresbstatusenquiry.h -o moc/moc_gresbstatusenquiry.cpp
278
279 moc/moc_spectralmatricesdmasimulator.cpp: spectralmatricesdmasimulator.h
280 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) spectralmatricesdmasimulator.h -o moc/moc_spectralmatricesdmasimulator.cpp
281
282 moc/moc_rmappluginpythonwrapper.cpp: rmappluginpythonwrapper.h
283 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) rmappluginpythonwrapper.h -o moc/moc_rmappluginpythonwrapper.cpp
284
285 moc/moc_stardundee.cpp: stardundee.h
286 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) stardundee.h -o moc/moc_stardundee.cpp
287
288 moc/moc_genericPySysdriver.cpp: /usr/include/genericPySysdriver.h
289 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/genericPySysdriver.h -o moc/moc_genericPySysdriver.cpp
290
291 moc/moc_lppmonplugin.cpp: /usr/include/lppmonplugin.h
292 /usr/lib64/qt4/bin/moc $(DEFINES) $(INCPATH) /usr/include/lppmonplugin.h -o moc/moc_lppmonplugin.cpp
293
294 compiler_rcc_make_all:
295 compiler_rcc_clean:
296 compiler_image_collection_make_all: qmake_image_collection.cpp
297 compiler_image_collection_clean:
298 -$(DEL_FILE) qmake_image_collection.cpp
299 compiler_moc_source_make_all:
300 compiler_moc_source_clean:
301 compiler_uic_make_all:
302 compiler_uic_clean:
303 compiler_yacc_decl_make_all:
304 compiler_yacc_decl_clean:
305 compiler_yacc_impl_make_all:
306 compiler_yacc_impl_clean:
307 compiler_lex_make_all:
308 compiler_lex_clean:
309 compiler_clean: compiler_moc_header_clean
310
311 ####### Compile
312
313 obj/rmapplugin.o: rmapplugin.cpp rmapplugin.h \
314 rmappluginui.h \
315 rmapoperations.h \
316 spectralmatricesdmasimulator.h \
317 ccsds.h \
318 spwpacketreceiver.h \
319 rmappluginpythonwrapper.h
320 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapplugin.o rmapplugin.cpp
321
322 obj/rmappluginui.o: rmappluginui.cpp rmapplugin.h \
323 rmappluginui.h \
324 rmapoperations.h \
325 spectralmatricesdmasimulator.h \
326 ccsds.h \
327 spwpacketreceiver.h
328 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginui.o rmappluginui.cpp
329
330 obj/rmapoperations.o: rmapoperations.cpp rmapoperations.h
331 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmapoperations.o rmapoperations.cpp
332
333 obj/ccsds.o: ccsds.cpp ccsds.h
334 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/ccsds.o ccsds.cpp
335
336 obj/spwpacketreceiver.o: spwpacketreceiver.cpp spwpacketreceiver.h
337 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spwpacketreceiver.o spwpacketreceiver.cpp
338
339 obj/qipdialogbox.o: ../common_PLE/qipdialogbox.cpp ../common_PLE/qipdialogbox.h
340 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/qipdialogbox.o ../common_PLE/qipdialogbox.cpp
341
342 obj/gresbstatusenquiry.o: ../common_PLE/gresbstatusenquiry.cpp ../common_PLE/gresbstatusenquiry.h
343 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/gresbstatusenquiry.o ../common_PLE/gresbstatusenquiry.cpp
344
345 obj/spectralmatricesdmasimulator.o: spectralmatricesdmasimulator.cpp spectralmatricesdmasimulator.h
346 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/spectralmatricesdmasimulator.o spectralmatricesdmasimulator.cpp
347
348 obj/rmappluginpythonwrapper.o: rmappluginpythonwrapper.cpp rmappluginpythonwrapper.h
349 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/rmappluginpythonwrapper.o rmappluginpythonwrapper.cpp
350
351 obj/stardundee.o: stardundee.cpp stardundee.h
352 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/stardundee.o stardundee.cpp
353
354 obj/lppmonplugininterface.o: /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp /usr/include/lppmon/pluginsInterface/lppmonplugininterface.h \
355 /usr/include/lppmon/pluginsInterface/lppmonplugininterface_global.h
356 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/lppmonplugininterface.o /usr/include/lppmon/pluginsInterface/lppmonplugininterface.cpp
357
358 obj/moc_rmappluginui.o: moc/moc_rmappluginui.cpp
359 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmappluginui.o moc/moc_rmappluginui.cpp
360
361 obj/moc_rmapplugin.o: moc/moc_rmapplugin.cpp
362 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmapplugin.o moc/moc_rmapplugin.cpp
363
364 obj/moc_spwpacketreceiver.o: moc/moc_spwpacketreceiver.cpp
365 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_spwpacketreceiver.o moc/moc_spwpacketreceiver.cpp
366
367 obj/moc_qipdialogbox.o: moc/moc_qipdialogbox.cpp
368 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_qipdialogbox.o moc/moc_qipdialogbox.cpp
369
370 obj/moc_gresbstatusenquiry.o: moc/moc_gresbstatusenquiry.cpp
371 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_gresbstatusenquiry.o moc/moc_gresbstatusenquiry.cpp
372
373 obj/moc_spectralmatricesdmasimulator.o: moc/moc_spectralmatricesdmasimulator.cpp
374 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_spectralmatricesdmasimulator.o moc/moc_spectralmatricesdmasimulator.cpp
375
376 obj/moc_rmappluginpythonwrapper.o: moc/moc_rmappluginpythonwrapper.cpp
377 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_rmappluginpythonwrapper.o moc/moc_rmappluginpythonwrapper.cpp
378
379 obj/moc_stardundee.o: moc/moc_stardundee.cpp
380 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_stardundee.o moc/moc_stardundee.cpp
381
382 obj/moc_genericPySysdriver.o: moc/moc_genericPySysdriver.cpp
383 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_genericPySysdriver.o moc/moc_genericPySysdriver.cpp
384
385 obj/moc_lppmonplugin.o: moc/moc_lppmonplugin.cpp
386 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o obj/moc_lppmonplugin.o moc/moc_lppmonplugin.cpp
387
388 ####### Install
389
390 install_target: first FORCE
391 @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/ || $(MKDIR) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/
392 -$(INSTALL_PROGRAM) "bin/$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET)"
393 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET0)"
394 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET1)"
395 -$(SYMLINK) "$(TARGET)" "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET2)"
396
397 uninstall_target: FORCE
398 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET)"
399 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET0)"
400 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET1)"
401 -$(DEL_FILE) "$(INSTALL_ROOT)/home/paul/.lppmon/plugins/$(TARGET2)"
402 -$(DEL_DIR) $(INSTALL_ROOT)/home/paul/.lppmon/plugins/
403
404
405 install: install_target FORCE
406
407 uninstall: uninstall_target FORCE
408
409 FORCE:
410
@@ -0,0 +1,37
1 #include "ccsds.h"
2
3 ccsds::ccsds(unsigned char data_field_header,
4 unsigned char processID,
5 unsigned int sequence_count,
6 unsigned int packet_length,
7 unsigned char acceptance,
8 unsigned int completion,
9 unsigned char service_type,
10 unsigned char service_subtype,
11 unsigned char sourceID)
12 {
13 unsigned int packetID = 0;
14 ccsds_header = new ccsds_telecommand_source_packet_hdr_t ;
15
16 packetID = packetID + (0b000<<13); // version number
17 packetID = packetID + (0b1<<12); // packet type
18 packetID = packetID + (data_field_header<<11); // data field header 1 if there is a datafield header
19 packetID = packetID + (processID<<4); // process ID 7 bits
20 packetID = packetID + (0b1100); // packet category '1100'
21
22 ccsds_header->packetId1 = (unsigned char) (packetID>>8);
23 ccsds_header->packetId0 = (unsigned char) (packetID);
24
25 ccsds_header->packetSequenceControl1 = (unsigned char) ((0b11<<6) + (sequence_count>>8));
26 ccsds_header->packetSequenceControl0 = (unsigned char) (sequence_count);
27
28 ccsds_header->packetLength1 = (unsigned char) (packet_length>>8);
29 ccsds_header->packetLength0 = (unsigned char) (packet_length);
30
31 ccsds_header->dataFieldHeader3 = ccsds_header->dataFieldHeader3 + (0b0001<<4);
32 ccsds_header->dataFieldHeader3 = ccsds_header->dataFieldHeader3 + (completion<<3);
33 ccsds_header->dataFieldHeader3 = ccsds_header->dataFieldHeader3 + (acceptance);
34 ccsds_header->dataFieldHeader2 = service_type;
35 ccsds_header->dataFieldHeader1 = service_subtype;
36 ccsds_header->dataFieldHeader0 = sourceID;
37 }
@@ -0,0 +1,48
1 #ifndef CCSDS_H
2 #define CCSDS_H
3
4 struct ccsds_telecommand_source_packet_hdr_str
5 {
6 unsigned char packetId1;
7 unsigned char packetId0;
8 unsigned char packetSequenceControl1;
9 unsigned char packetSequenceControl0;
10 unsigned char packetLength1;
11 unsigned char packetLength0;
12 unsigned char dataFieldHeader3;
13 unsigned char dataFieldHeader2;
14 unsigned char dataFieldHeader1;
15 unsigned char dataFieldHeader0;
16 };
17 typedef ccsds_telecommand_source_packet_hdr_str ccsds_telecommand_source_packet_hdr_t;
18
19 struct ccsdsSourcePacket_pachetHeader_str
20 {
21 unsigned char packetId1;
22 unsigned char packetId0;
23 unsigned char packetSequenceControl1;
24 unsigned char packetSequenceControl0;
25 unsigned char packetLength1;
26 unsigned char packetLength0;
27 };
28 typedef ccsdsSourcePacket_pachetHeader_str ccsdsSourcePacket_pachetHeader_t;
29
30 struct ccsdsTelemetrySourcePacket_dataFieldHeader_str
31 {
32 unsigned char spare_PUS_spare;
33 unsigned char serviceType;
34 unsigned char serviceSubtype;
35 unsigned char destinationID;
36 unsigned char SCTime[6];
37 };
38 typedef ccsdsTelemetrySourcePacket_dataFieldHeader_str ccsdsTelemetrySourcePacket_dataFieldHeader_t;
39
40 class ccsds
41 {
42 public:
43 ccsds(unsigned char data_field_header, unsigned char processID, unsigned int sequence_count, unsigned int packet_length, unsigned char acceptance, unsigned int completion,
44 unsigned char service_type, unsigned char service_subtype, unsigned char sourceID);
45 ccsds_telecommand_source_packet_hdr_t *ccsds_header;
46 };
47
48 #endif // CCSDS_H
@@ -0,0 +1,95
1 #include "rmapoperations.h"
2
3 RMAP::RMAP(RMAP_command_codes commandCode, char targetLogicalAddress, char initiatorLogicalAddress, int startAddress, int nbBytes, char* data)
4 {
5 char packetType; // 2 most Significant Bits
6 char command; // 4 bits
7 char replyAddressLength; // 2 Least Significant Bits
8 int SPWPacketSize;
9
10 // GRESB HEADER
11 if (data == NULL){
12 SPWPacketSize = sizeof(RMAPHeader) ;
13 dataCRC = 0x00;
14 }
15 else{
16 SPWPacketSize = sizeof(RMAPHeader) + nbBytes + 1 ; // SPW Packet = Header + Data + dataCRC
17 dataCRC = RMAPCalculateDataCRC(data, nbBytes);
18 }
19 GRESBHeader.GRESBProtocoleID = 0x00; // packets with protocole ID 0 have SpaceWire a packet as payload
20 GRESBHeader.SPWPacketSize2 = (SPWPacketSize>>16);
21 GRESBHeader.SPWPacketSize1 = (SPWPacketSize>>8);
22 GRESBHeader.SPWPacketSize0 = (SPWPacketSize);
23
24 // SPACEWIRE HEADER
25 packetType = (char) 0b01; // 0b01 for a command, 0b00 for a reply
26 command = (char) commandCode;
27 replyAddressLength = (char) 0b00; // RMAP command: number of bytes in the reply address field
28 // RMAP reply: copy of the reply address field of the command
29 switch (commandCode){
30 case writeSingle_noVer_noRep:
31 case writeSingle_noVer_Rep:
32 case writeSingle_ver_noRep:
33 case writeSingle_ver_rep:
34 if (nbBytes > 4) command = command + 1; // switch between Single and Incremental Read/Write operations
35 break;
36 default:
37 break;
38 }
39 RMAPHeader.targetLogicalAddress = targetLogicalAddress ;
40 RMAPHeader.protocolIdentifier = 0x01; // 0x01 is the protocole identifier for RMAP
41 RMAPHeader.instruction = (packetType<<6) + (command<<2) + (replyAddressLength);
42 RMAPHeader.key = 0; // used for command authorization
43 RMAPHeader.initiatorLogicalAddress = initiatorLogicalAddress; // 0 is the default address for the GRESB module
44 RMAPHeader.transactionIdentifier1 = 0x00;
45 RMAPHeader.transactionIdentifier0 = 0x01;
46 RMAPHeader.extendedAddress = 0x00;
47 RMAPHeader.address3 = (char) (startAddress>>24);
48 RMAPHeader.address2 = (char) (startAddress>>16);
49 RMAPHeader.address1 = (char) (startAddress>>8);
50 RMAPHeader.address0 = (char) (startAddress);
51 RMAPHeader.dataLength2 = (char) (nbBytes>>16);
52 RMAPHeader.dataLength1 = (char) (nbBytes>>8);
53 RMAPHeader.dataLength0 = (char) (nbBytes);
54 RMAPHeader.headerCRC = RMAPCalculateHeaderCRC();
55 }
56
57 unsigned char RMAP::RMAPCalculateCRC(unsigned char INCR, unsigned char INBYTE)
58 {
59 return RMAP_CRCTable[INCR ^ INBYTE];
60 }
61
62 unsigned char RMAP::RMAPCalculateHeaderCRC()
63 {
64 unsigned char INCR = 0;
65
66 INCR = RMAPCalculateCRC(INCR, RMAPHeader.targetLogicalAddress);
67 INCR = RMAPCalculateCRC(INCR, RMAPHeader.protocolIdentifier);
68 INCR = RMAPCalculateCRC(INCR, RMAPHeader.instruction);
69 INCR = RMAPCalculateCRC(INCR, RMAPHeader.key);
70 INCR = RMAPCalculateCRC(INCR, RMAPHeader.initiatorLogicalAddress);
71 INCR = RMAPCalculateCRC(INCR, RMAPHeader.transactionIdentifier1);
72 INCR = RMAPCalculateCRC(INCR, RMAPHeader.transactionIdentifier0);
73 INCR = RMAPCalculateCRC(INCR, RMAPHeader.extendedAddress);
74 INCR = RMAPCalculateCRC(INCR, RMAPHeader.address3);
75 INCR = RMAPCalculateCRC(INCR, RMAPHeader.address2);
76 INCR = RMAPCalculateCRC(INCR, RMAPHeader.address1);
77 INCR = RMAPCalculateCRC(INCR, RMAPHeader.address0);
78 INCR = RMAPCalculateCRC(INCR, RMAPHeader.dataLength2);
79 INCR = RMAPCalculateCRC(INCR, RMAPHeader.dataLength1);
80 INCR = RMAPCalculateCRC(INCR, RMAPHeader.dataLength0);
81
82 return(INCR);
83 }
84
85 unsigned char RMAP::RMAPCalculateDataCRC(char *data, int nbBytes)
86 {
87 unsigned char INCR = 0;
88
89 for (int k=0; k<nbBytes; k++)
90 {
91 INCR = RMAPCalculateCRC(INCR, data[k]);
92 }
93
94 return(INCR);
95 }
@@ -0,0 +1,140
1 #ifndef RMAPOPERATIONS_H
2 #define RMAPOPERATIONS_H
3
4 #include "qhexspinbox.h"
5
6 static const unsigned char RMAP_CRCTable[] = {
7 0x00, 0x91, 0xe3, 0x72, 0x07, 0x96, 0xe4, 0x75,
8 0x0e, 0x9f, 0xed, 0x7c, 0x09, 0x98, 0xea, 0x7b,
9 0x1c, 0x8d, 0xff, 0x6e, 0x1b, 0x8a, 0xf8, 0x69,
10 0x12, 0x83, 0xf1, 0x60, 0x15, 0x84, 0xf6, 0x67,
11 0x38, 0xa9, 0xdb, 0x4a, 0x3f, 0xae, 0xdc, 0x4d,
12 0x36, 0xa7, 0xd5, 0x44, 0x31, 0xa0, 0xd2, 0x43,
13 0x24, 0xb5, 0xc7, 0x56, 0x23, 0xb2, 0xc0, 0x51,
14 0x2a, 0xbb, 0xc9, 0x58, 0x2d, 0xbc, 0xce, 0x5f,
15 0x70, 0xe1, 0x93, 0x02, 0x77, 0xe6, 0x94, 0x05,
16 0x7e, 0xef, 0x9d, 0x0c, 0x79, 0xe8, 0x9a, 0x0b,
17 0x6c, 0xfd, 0x8f, 0x1e, 0x6b, 0xfa, 0x88, 0x19,
18 0x62, 0xf3, 0x81, 0x10, 0x65, 0xf4, 0x86, 0x17,
19 0x48, 0xd9, 0xab, 0x3a, 0x4f, 0xde, 0xac, 0x3d,
20 0x46, 0xd7, 0xa5, 0x34, 0x41, 0xd0, 0xa2, 0x33,
21 0x54, 0xc5, 0xb7, 0x26, 0x53, 0xc2, 0xb0, 0x21,
22 0x5a, 0xcb, 0xb9, 0x28, 0x5d, 0xcc, 0xbe, 0x2f,
23 0xe0, 0x71, 0x03, 0x92, 0xe7, 0x76, 0x04, 0x95,
24 0xee, 0x7f, 0x0d, 0x9c, 0xe9, 0x78, 0x0a, 0x9b,
25 0xfc, 0x6d, 0x1f, 0x8e, 0xfb, 0x6a, 0x18, 0x89,
26 0xf2, 0x63, 0x11, 0x80, 0xf5, 0x64, 0x16, 0x87,
27 0xd8, 0x49, 0x3b, 0xaa, 0xdf, 0x4e, 0x3c, 0xad,
28 0xd6, 0x47, 0x35, 0xa4, 0xd1, 0x40, 0x32, 0xa3,
29 0xc4, 0x55, 0x27, 0xb6, 0xc3, 0x52, 0x20, 0xb1,
30 0xca, 0x5b, 0x29, 0xb8, 0xcd, 0x5c, 0x2e, 0xbf,
31 0x90, 0x01, 0x73, 0xe2, 0x97, 0x06, 0x74, 0xe5,
32 0x9e, 0x0f, 0x7d, 0xec, 0x99, 0x08, 0x7a, 0xeb,
33 0x8c, 0x1d, 0x6f, 0xfe, 0x8b, 0x1a, 0x68, 0xf9,
34 0x82, 0x13, 0x61, 0xf0, 0x85, 0x14, 0x66, 0xf7,
35 0xa8, 0x39, 0x4b, 0xda, 0xaf, 0x3e, 0x4c, 0xdd,
36 0xa6, 0x37, 0x45, 0xd4, 0xa1, 0x30, 0x42, 0xd3,
37 0xb4, 0x25, 0x57, 0xc6, 0xb3, 0x22, 0x50, 0xc1,
38 0xba, 0x2b, 0x59, 0xc8, 0xbd, 0x2c, 0x5e, 0xcf
39 };
40
41 enum RMAP_command_codes{
42 invalid0, //0000
43 invalid1, //0001
44 read_Single, //0010
45 read_Inc, //0011
46 invalid2, //0100
47 invalid3, //0101
48 invalid4, //0110
49 readModWri_Inc, //0111
50 writeSingle_noVer_noRep, //1000
51 writeInc_noVer_noRep, //1001
52 writeSingle_noVer_Rep, //1010
53 writeInc_noVer_Rep, //1011
54 writeSingle_ver_noRep, //1100
55 writeInc_ver_noRep, //1101
56 writeSingle_ver_rep, //1110
57 writeInc_ver_rep //1111
58 };
59
60 struct rmap_command_format_str
61 {
62 // char tagetSpaceWireAddress[]; // used for path addressing or regional addressing
63 char targetLogicalAddress;
64 char protocolIdentifier;
65 char instruction;
66 char key; // used for command authorization => check Gaisler GRSPW for compliance
67 //char replyAddress[]; // not needed if logical addressing is used (replyAddressLength = 0b00)
68 char initiatorLogicalAddress;
69 char transactionIdentifier1;
70 char transactionIdentifier0;
71 char extendedAddress;
72 char address3;
73 char address2;
74 char address1;
75 char address0;
76 unsigned char dataLength2;
77 unsigned char dataLength1;
78 unsigned char dataLength0;
79 char headerCRC;
80 };
81 typedef struct rmap_command_format_str rmap_command_format_t;
82
83 struct rmap_write_reply_str
84 {
85 unsigned char initiatorLogicalAddress;
86 unsigned char protocolIdentifier;
87 unsigned char instruction;
88 unsigned char status;
89 unsigned char targetLogicalAddress;
90 unsigned char transactionIdentifier1;
91 unsigned char transactionIdentifier2;
92 unsigned char headerCRC;
93 };
94 typedef struct rmap_write_reply_str rmap_write_reply_t;
95
96 struct rmap_read_reply_PcktHdr_str
97 {
98 //char replyAddress[]; // not needed if logical addressing is used
99 char initiatorLogicalAddress;
100 char protocolIdentifier;
101 char instruction;
102 char status;
103 char targetLogicalAddress;
104 char transactionIdentifier1;
105 char transactionIdentifier0;
106 char reserved;
107 unsigned char dataLength2;
108 unsigned char dataLength1;
109 unsigned char dataLength0;
110 char headerCRC;
111 };
112 typedef struct rmap_read_reply_PcktHdr_str rmap_read_reply_PcktHdr_t;
113
114 struct rmap_gresb_header_str
115 {
116 char GRESBProtocoleID;
117 unsigned char SPWPacketSize2;
118 unsigned char SPWPacketSize1;
119 unsigned char SPWPacketSize0;
120 };
121 typedef struct rmap_gresb_header_str rmap_gresb_header_str;
122
123 class RMAP
124 {
125 public:
126 RMAP(RMAP_command_codes commandCode,
127 char targetLogicalAddress,
128 char initiatorLogicalAddress,
129 int startAddress,
130 int nbBytes,
131 char *data);
132 unsigned char RMAPCalculateCRC(unsigned char INCR, unsigned char INBYTE); // ECSS-E-ST-50-52C
133 unsigned char RMAPCalculateHeaderCRC();
134 unsigned char RMAPCalculateDataCRC(char *data, int nbBytes);
135 rmap_gresb_header_str GRESBHeader;
136 rmap_command_format_t RMAPHeader;
137 char dataCRC;
138 };
139
140 #endif // RMAPOPERATIONS_H
This diff has been collapsed as it changes many lines, (817 lines changed) Show them Hide them
@@ -0,0 +1,817
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
3 -- Copyright (C) 2012, Laboratory of Plasma Physics - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Paul LEROY
20 -- Mail : paul.leroy@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
22 #include "rmapplugin.h"
23 #include <QHostAddress>
24 #include <QIODevice>
25 #include <QApplication>
26 #include <rmappluginpythonwrapper.h>
27
28 rmapplugin::rmapplugin(QWidget *parent)
29 :lppmonplugin(parent,false)
30 {
31 this->UI = new rmapPluginUI();
32 this->setWindowTitle(tr("RMAP and SPW Communication"));
33 this->setWidget((QWidget*)this->UI);
34 RMAPSend_SOCKET = new QTcpSocket;
35 RMAPReceive_SOCKET = new QTcpSocket;
36 GRESBStatusQuery_SOCKET = new QTcpSocket;
37 spwPacketReceiverOBJECT = new spwpacketreceiver;
38 spwPacketReceiverOBJECT->gresbReceptionSocket = RMAPReceive_SOCKET;
39 timeCode = 0;
40 time_COARSE = 0;
41 time_FINE = 0;
42
43 /*Python wrapper*/
44 this->pyObject = new rmappluginPythonWrapper();
45 connect(this->pyObject,SIGNAL(ReadSig(uint*,uint,uint)),this,SLOT(Read(uint*,uint,uint)));
46 connect(this->pyObject,SIGNAL(WriteSig(uint*,uint,uint)),this,SLOT(Write(uint*,uint,uint)));
47 /*==============*/
48
49 connect(UI->rmapOpenCommunicationButton, SIGNAL(clicked()), this, SLOT(RMAP_CONNECT()));
50 connect(UI->rmapCloseCommunicationButton, SIGNAL(clicked()), this, SLOT(RMAP_DISCONNECT()));
51 connect(RMAPSend_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPSendConnectionState(QAbstractSocket::SocketState)));
52 connect(RMAPReceive_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(RMAPReceiveConnectionState(QAbstractSocket::SocketState)));
53 connect(GRESBStatusQuery_SOCKET, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(GRESBConnectionState(QAbstractSocket::SocketState)));
54 connect(UI->gresbStatusQueryRetryButton, SIGNAL(clicked()), this, SLOT(reTestSPWLink()));
55 connect(this->UI->spwLinkStatusEnquiry->readSPWStatusButton, SIGNAL(clicked()), this, SLOT(GRESBStatusQuery()));
56 connect(this->RMAPReceive_SOCKET, SIGNAL(readyRead()), this->spwPacketReceiverOBJECT, SLOT(receiveSPWPacket()));
57
58 // CCSDS
59 connect(this->UI->sendCCSDSCommandButton, SIGNAL(clicked()), this, SLOT(sendCCSDS()));
60 connect(this->UI->send_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(send_TC_LFR_UPDATE_TIME()));
61 connect(this->UI->reset_TC_LFR_UPDATE_TIME_Button, SIGNAL(clicked()), this, SLOT(reset_TC_LFR_UPDATE_TIME()));
62
63 // CONSOLE
64 connect(this->spwPacketReceiverOBJECT, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
65 connect(this->UI->starDundee, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
66
67 // spectralMAtricesDMASimulator
68 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginRead(uint*,uint,uint)), this, SLOT(Read(uint*,uint,uint)));
69 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(rmapplugginWrite(uint*,uint,uint)), this, SLOT(Write(uint*,uint,uint)));
70 connect(this->UI->spectralMatricesDMASimulator, SIGNAL(sendMessage(QString)), this, SLOT(displayOnConsole(QString)));
71 }
72
73 rmapplugin::~rmapplugin()
74 {
75 if (!RMAPSend_SOCKET->isOpen()) RMAPSend_SOCKET->disconnectFromHost();
76 if (!RMAPReceive_SOCKET->isOpen()) RMAPReceive_SOCKET->disconnectFromHost();
77 if (!GRESBStatusQuery_SOCKET->isOpen()) GRESBStatusQuery_SOCKET->disconnectFromHost();
78 }
79
80 unsigned int rmapplugin::Write(unsigned int *Value, unsigned int count, unsigned int address)
81 {
82 unsigned int remainingCount = count;
83 unsigned int iOffset = 0;
84 QString console_message;
85 char* data;
86
87 unsigned char command = 0x08; // initialize command at 0b00001000 for write
88
89 if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0)
90 {
91 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP request already running, WRITE access stopped");
92 return 1;
93 }
94 if (UI->RMAP_write_verify->isChecked()) command = command + (1<<2);
95 if (UI->RMAP_write_reply->isChecked()) command = command + (1<<1);
96
97 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: unavailable");
98
99 data = (char*) malloc(READ_WRITE_MAX_COUNTS*4);
100
101 APPENDTOLOG(QString("*** START *** WRITE ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
102
103 while (remainingCount > READ_WRITE_MAX_COUNTS)
104 {
105 for (int i = 0; i<READ_WRITE_MAX_COUNTS; i++)
106 {
107 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
108 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
109 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
110 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
111 }
112
113 console_message.sprintf("remainingCount: %d => ", remainingCount);
114 APPENDTOLOG(console_message + QString("Write ")+ QString::number(READ_WRITE_MAX_COUNTS*4) + QString(" byte(s) @0x")+ QString::number(address,16));
115
116 if(WriteBLOCK(data, READ_WRITE_MAX_COUNTS*4, address)==0)
117 {
118 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
119 return 1;
120 }
121
122 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
123 address = address + READ_WRITE_MAX_COUNTS * 4;
124 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
125 }
126
127 if (remainingCount > 0)
128 {
129 for (unsigned int i = 0; i<remainingCount; i++)
130 {
131 data[i*4+3] = (char) ((unsigned int) Value[i+iOffset]);
132 data[i*4+2] = (char) ((unsigned int) Value[i+iOffset]>>8);
133 data[i*4+1] = (char) ((unsigned int) Value[i+iOffset]>>16);
134 data[i*4+0] = (char) ((unsigned int) Value[i+iOffset]>>24);
135 }
136
137 console_message.sprintf("remainingCount: %d => ", remainingCount);
138 APPENDTOLOG(console_message + QString("Write ")+ QString::number(remainingCount*4) + QString(" byte(s) @0x")+ QString::number(address,16));
139
140 if (WriteBLOCK(data, remainingCount*4, address)==0)
141 {
142 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** RMAP write command failed");
143 return 1;
144 }
145 }
146
147 APPENDTOLOG(QString("*** STOP *** WRITE"));
148 free(data);
149 return count;
150 }
151
152 unsigned int rmapplugin::Read(unsigned int *Value, unsigned int count, unsigned int address)
153 {
154 unsigned int remainingCount = count;
155 unsigned int iOffset = 0;
156 QString console_message;
157
158 if(spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0)
159 {
160 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP request already running, READ access stopped");
161 return 1;
162 }
163 APPENDTOLOG(QString("*** START *** READ ")+ QString::number(count) + QString(" word(s) @0x")+ QString::number(address,16));
164
165 while (remainingCount > READ_WRITE_MAX_COUNTS)
166 {
167 console_message.sprintf("remainingCount: %d => ", remainingCount);
168 APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*READ_WRITE_MAX_COUNTS) + QString(" byte(s) @0x")+ QString::number(address,16));
169
170 if (ReadBLOCK(READ_WRITE_MAX_COUNTS*4, address)==0)
171 {
172 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received");
173 return 1;
174 }
175
176 for(int i=0;i<READ_WRITE_MAX_COUNTS;i++)
177 {
178 Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
179 for(int j=1;j<4;j++)
180 {
181 Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
182 }
183 }
184
185 remainingCount = remainingCount - READ_WRITE_MAX_COUNTS;
186 address = address + READ_WRITE_MAX_COUNTS * 4;
187 iOffset = iOffset + READ_WRITE_MAX_COUNTS;
188 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
189 }
190
191 if (remainingCount > 0)
192 {
193 console_message.sprintf("remainingCount: %d => ", remainingCount);
194 APPENDTOLOG(console_message + QString("Read ")+ QString::number(4*remainingCount) + QString(" byte(s) @0x")+ QString::number(address,16));
195
196 if (ReadBLOCK(4*remainingCount, address)==0)
197 {
198 APPENDTOLOG("WARNING === in function READ of rmapplugin *** RMAP packet not received");
199 return 1;
200 }
201
202 for(unsigned int i=0;i<remainingCount;i++)
203 {
204 Value[i+iOffset] = (unsigned char) spwPacketReceiverOBJECT->rmapPacket[i*4+RMAP_READ_REPLY_HEADER_LENGTH];
205 for(int j=1;j<4;j++)
206 {
207 Value[i+iOffset]= ((unsigned char)(spwPacketReceiverOBJECT->rmapPacket[i*4+j+RMAP_READ_REPLY_HEADER_LENGTH])) + Value[i+iOffset]*256;
208 }
209 }
210 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
211 }
212
213 APPENDTOLOG(QString("*** STOP *** READ "));
214 return count;
215 }
216
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 unsigned int rmapplugin::WriteBLOCK(char *data, unsigned int nbBytes, unsigned int address)
286 {
287 QTime RMAPTimeout;
288 RMAP *RMAPCommand;
289 int errorCode;
290 QString console_message;
291
292 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
293 {
294 RMAP_DISCONNECT();
295 return 1;
296 }
297
298 RMAPCommand = new RMAP(UI->getCommandCode(),
299 UI->rmapTargetLogicalAddressSpinBox->value(),
300 UI->rmapSourceLogicalAddressSpinBox->value(),
301 address,
302 nbBytes,
303 data);
304
305 // SEND GRESB HEADER
306 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->GRESBHeader), 4);
307 // SEND SPACEWIRE PACKET HEADER
308 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->RMAPHeader), sizeof(RMAPCommand->RMAPHeader));
309 // SEND DATA
310 RMAPSend_SOCKET->write( data, nbBytes);
311 // SEND DATA CRC
312 RMAPSend_SOCKET->write((char*) ((void*) &RMAPCommand->dataCRC), 1);
313 RMAPTimeout.start();
314 while(RMAPSend_SOCKET->bytesToWrite() > 0)
315 {
316 RMAPSend_SOCKET->waitForBytesWritten(100);
317 if(RMAPTimeout.elapsed()>1000)
318 {
319 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** sending Write RMAP Command timeout");
320 return 0;
321 }
322 }
323
324 if (UI->RMAP_write_reply->isChecked())
325 {
326 // WAIT FOR THE RMAP REPLY PACKET
327 errorCode = spwPacketReceiverOBJECT->receiveSPWPacket(1);
328 if (errorCode<=0)
329 {
330 APPENDTOLOG("WARNING === in function WriteBLOCK of rmapplugin *** RMAP packet reception failed with code " + QString::number(errorCode));
331 return 0;
332 }
333 if(spwPacketReceiverOBJECT->rmapPacketSize != 8)
334 {
335 console_message.sprintf("WARNING === in function WRITE (with reply) of rmapplugin *** write reply format not compliant\n");
336 APPENDTOLOG(console_message);
337 return 0;
338 }
339 switch (spwPacketReceiverOBJECT->rmapPacket[3]) // byte 4 is the status byte in the reply
340 {
341 case 0:
342 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 0 Successfull");
343 break;
344 case 1:
345 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** General error code");
346 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 1 General error code");
347 break;
348 case 2:
349 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Unused RMAP packet type or command code");
350 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 2 Unused RMAP packet type or command code");
351 break;
352 case 3:
353 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid key");
354 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 3 Invalid key");
355 break;
356 case 4:
357 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid data CRC");
358 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 4 Invalid data CRC");
359 break;
360 case 5:
361 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Early EOP");
362 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 5 Early EOP");
363 break;
364 case 6:
365 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Too much data");
366 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 6 Too much data");
367 break;
368 case 7:
369 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** EEP");
370 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 7 EEP");
371 break;
372 case 8:
373 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Reserved");
374 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 8 Reserved");
375 break;
376 case 9:
377 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Verify buffer overrun");
378 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 9 Verify buffer overrun");
379 break;
380 case 10:
381 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMAP command not implemented or not authorised");
382 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 10 RMAP command not implemented or not authorised");
383 break;
384 case 11:
385 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** RMW data length error");
386 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 11 RMAP RMW data length error");
387 break;
388 case 12:
389 APPENDTOLOG("WARNING === in function WRITE (with reply) of rmapplugin *** Invalid target logical address");
390 UI->RMAP_write_reply->setText("reply to the write command required\nlast reply status: 12 Invalid target logical address");
391 break;
392 }
393 spwPacketReceiverOBJECT->acquireRMAPSemaphore();
394 }
395 return nbBytes;
396 }
397
398 ////////
399 // SLOTS
400
401 unsigned int rmapplugin::WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication) // SLOT
402 {
403 char protocoleIdentifier = 0x02;
404 char reserved = 0x00;
405 char gresbProtocole = 0x00;
406 unsigned char size[3];
407 unsigned int spwPacketSize = count + 4;
408 QTime SPWTimeout;
409
410 if (count>248)
411 {
412 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** CCSDS packet size > 248 bytes\n");
413 return 1;
414 }
415
416 APPENDTOLOG(QString("*** START *** Send CCSDS packet of ")+ QString::number(count) + QString(" byte(s)"));
417
418 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 1)
419 {
420 RMAP_DISCONNECT();
421 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** SPW link not running\n");
422 return 1;
423 }
424
425 // SEND GRESB HEADER
426 size[0] = (unsigned char) ((unsigned int) spwPacketSize>>16);
427 size[1] = (unsigned char) ((unsigned int) spwPacketSize>>8);
428 size[2] = (unsigned char) ((unsigned int) spwPacketSize);
429 RMAPSend_SOCKET->write(&gresbProtocole, 1);
430 RMAPSend_SOCKET->write((char*) size, 3);
431 // SEND SPW HEADER
432 RMAPSend_SOCKET->write(&targetLogicalAddress, 1);
433 RMAPSend_SOCKET->write(&protocoleIdentifier, 1);
434 RMAPSend_SOCKET->write(&reserved, 1);
435 RMAPSend_SOCKET->write(&userApplication, 1);
436 // SEND CCSDS PACKET
437 RMAPSend_SOCKET->write(Value, count);
438 SPWTimeout.start();
439 while(RMAPSend_SOCKET->bytesToWrite() > 0)
440 {
441 RMAPSend_SOCKET->waitForBytesWritten(100);
442 if(SPWTimeout.elapsed()>1000)
443 {
444 APPENDTOLOG("WARNING === in function WRITE of rmapplugin *** sending CCSDS packet timeout\n");
445 return 1;
446 }
447 }
448
449 APPENDTOLOG(QString("*** CCSDS packet sent"));
450
451 return count;
452 }
453
454 void rmapplugin::sendCCSDS() // SLOT
455 {
456 unsigned int nbBYTES_application_data = 8;
457 unsigned int count;
458 char *tab;
459 unsigned char packetErrorControl1 = 0xaa;
460 unsigned char packetErrorControl0 = 0xbb;
461
462 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 /* unsigned char data_field_header,
464 unsigned char processID,
465 unsigned int sequence_count,
466 unsigned int packet_length,
467 unsigned char acceptance,
468 unsigned int completion,
469 unsigned char service_type,
470 unsigned char service_subtype,
471 unsigned char sourceID*/
472
473 count = nbBYTES_application_data+12; // 12 is the size in bytes of the header
474 tab = (char*) malloc(count);
475 tab[0] = ccsds_command->ccsds_header->packetId1;
476 tab[1] = ccsds_command->ccsds_header->packetId0;
477 tab[2] = ccsds_command->ccsds_header->packetSequenceControl1;
478 tab[3] = ccsds_command->ccsds_header->packetSequenceControl0;
479 tab[4] = ccsds_command->ccsds_header->packetLength1;
480 tab[5] = ccsds_command->ccsds_header->packetLength0;
481 tab[6] = ccsds_command->ccsds_header->dataFieldHeader3;
482 tab[7] = ccsds_command->ccsds_header->dataFieldHeader2;
483 tab[8] = ccsds_command->ccsds_header->dataFieldHeader1;
484 tab[9] = ccsds_command->ccsds_header->dataFieldHeader0;
485 tab[10]=0x00;
486 tab[11]=0x00;
487 tab[12]=0x00;
488 tab[13]=0x00;
489 tab[14]=0x00;
490 tab[15]=0x00;
491 tab[nbBYTES_application_data+10] = packetErrorControl1;
492 tab[nbBYTES_application_data+11] = packetErrorControl0;
493
494 WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00);
495
496 free(tab);
497 }
498
499 void rmapplugin::send_TC_LFR_UPDATE_TIME()
500 {
501 unsigned int nbBYTES_application_data = 6; // Time at CUC format is on 48 bits / 6 bytes
502 unsigned int count;
503 char *tab;
504 unsigned char packetErrorControl1 = 0xaa;
505 unsigned char packetErrorControl0 = 0xbb;
506
507 ccsds_command = new ccsds(1, 11, 0, nbBYTES_application_data, 1, 1, 9, 129, 0);
508 /* unsigned char data_field_header,
509 unsigned char processID,
510 unsigned int sequence_count,
511 unsigned int packet_length,
512 unsigned char acceptance,
513 unsigned int completion,
514 unsigned char service_type,
515 unsigned char service_subtype,
516 unsigned char sourceID*/
517
518 count = nbBYTES_application_data+12; // +12 => packet header 6 bytes + data field header 4 bytes + packet error control 2 bytes
519 tab = (char*) malloc(count);
520 tab[0] = ccsds_command->ccsds_header->packetId1;
521 tab[1] = ccsds_command->ccsds_header->packetId0;
522 tab[2] = ccsds_command->ccsds_header->packetSequenceControl1;
523 tab[3] = ccsds_command->ccsds_header->packetSequenceControl0;
524 tab[4] = ccsds_command->ccsds_header->packetLength1;
525 tab[5] = ccsds_command->ccsds_header->packetLength0;
526 tab[6] = ccsds_command->ccsds_header->dataFieldHeader3;
527 tab[7] = ccsds_command->ccsds_header->dataFieldHeader2;
528 tab[8] = ccsds_command->ccsds_header->dataFieldHeader1;
529 tab[9] = ccsds_command->ccsds_header->dataFieldHeader0;
530 tab[10] = (unsigned char) (time_COARSE>>24);
531 tab[11] = (unsigned char) (time_COARSE>>18);
532 tab[12] = (unsigned char) (time_COARSE>>8);
533 tab[13] = (unsigned char) (time_COARSE);
534 tab[14] = (unsigned char) (time_FINE>>8);
535 tab[15] = (unsigned char) (time_FINE);
536 tab[nbBYTES_application_data+10] = packetErrorControl1;
537 tab[nbBYTES_application_data+11] = packetErrorControl0;
538
539 WriteSPW(tab, count, UI->CCSDSTargetLogicalAddressSpinBox->value(), 0x00);
540
541 time_COARSE = time_COARSE+1;
542
543 free(tab);
544 }
545
546 void rmapplugin::reset_TC_LFR_UPDATE_TIME()
547 {
548 time_COARSE = 0;
549 time_FINE = 0;
550 }
551
552 void rmapplugin::RMAP_CONNECT() // SLOT
553 {
554 bool spwRunning = true;
555 RMAPSend_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
556 3000 + UI->gresbVirtualLinkSpinBox->value()*2,
557 QIODevice::WriteOnly);
558 RMAPReceive_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
559 3000 + UI->gresbVirtualLinkSpinBox->value()*2+1,
560 QIODevice::ReadOnly);
561 GRESBStatusQuery_SOCKET->connectToHost( QHostAddress(UI->gresbBridgeIPDialogBox->getGRESBIP()),
562 3010,
563 QIODevice::ReadWrite);
564 GRESBStatusQuery_SOCKET->waitForConnected(10000);
565 RMAPReceive_SOCKET->readAll(); // read all remaining data from the reception socket
566 // initialize SPW packet semaphores
567 while (spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->rmapPacketSEMAPHORE->acquire();
568 while (spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->available()!=0) spwPacketReceiverOBJECT->ccsdsPacketSEMAPHORE->acquire();
569 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) != 0)
570 {
571 spwRunning = UI->gresbStatusQueryDialog->exec();
572 }
573 if (spwRunning == false) RMAP_DISCONNECT();
574 else
575 {
576 APPENDTOLOG(QString("SpaceWire running on virtual link ")+ QString::number(UI->spwLinkSpinBox->value()));
577 emit this->activateSig(true);
578 }
579 }
580
581 void rmapplugin::RMAP_DISCONNECT() // SLOT
582 {
583 RMAPSend_SOCKET->disconnectFromHost();
584 RMAPReceive_SOCKET->disconnectFromHost();
585 GRESBStatusQuery_SOCKET->disconnectFromHost();
586 emit this->activateSig(false);
587 }
588
589 void rmapplugin::RMAPSendConnectionState(QAbstractSocket::SocketState socketState) // SLOT
590 {
591 UI->rmapSendStateLabel->setText("");
592 QString socketMessage = "RMAP Send Socket State: ";
593 switch(socketState)
594 {
595 case QAbstractSocket::UnconnectedState :
596 socketMessage.append("0 => Unconnected");
597 UI->rmapOpenCommunicationButton->setEnabled(true);
598 UI->rmapCloseCommunicationButton->setEnabled(false);
599 emit this->activateSig(false);
600 break;
601 case 1:
602 socketMessage.append("1 => HostLookup");
603 break;
604 case 2:
605 socketMessage.append("2 => Connecting");
606 break;
607 case 3:
608 socketMessage.append("3 => Connected");
609 UI->rmapOpenCommunicationButton->setEnabled(false);
610 UI->rmapCloseCommunicationButton->setEnabled(true);
611 break;
612 case 4:
613 socketMessage.append("4 => Bound");
614 break;
615 case 5:
616 socketMessage.append("5 => Closing");
617 break;
618 case 6:
619 socketMessage.append("6 => Listening");
620 break;
621 }
622 UI->rmapSendStateLabel->setText(socketMessage);
623 APPENDTOLOG(socketMessage);
624 }
625
626 void rmapplugin::RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState) // SLOT
627 {
628 UI->rmapReceiveStateLabel->setText("");
629 QString socketMessage = "RMAP Receive Socket State: ";
630 switch(socketState)
631 {
632 case QAbstractSocket::UnconnectedState :
633 socketMessage.append("0 => Unconnected");
634 break;
635 case 1:
636 socketMessage.append("1 => HostLookup");
637 break;
638 case 2:
639 socketMessage.append("2 => Connecting");
640 break;
641 case 3:
642 socketMessage.append("3 => Connected");
643 break;
644 case 4:
645 socketMessage.append("4 => Bound");
646 break;
647 case 5:
648 socketMessage.append("5 => Closing");
649 break;
650 case 6:
651 socketMessage.append("6 => Listening");
652 break;
653 }
654 UI->rmapReceiveStateLabel->setText(socketMessage);
655 APPENDTOLOG(socketMessage);
656 }
657
658 void rmapplugin::GRESBConnectionState(QAbstractSocket::SocketState socketState) // SLOT
659 {
660 UI->gresbStatusQueryLabel->setText("");
661 QString socketMessage = "GRESB status query socket (port 3010): ";
662 switch(socketState)
663 {
664 case QAbstractSocket::UnconnectedState :
665 socketMessage.append("0 => Unconnected");
666 break;
667 case 1:
668 socketMessage.append("1 => HostLookup");
669 break;
670 case 2:
671 socketMessage.append("2 => Connecting");
672 break;
673 case 3:
674 socketMessage.append("3 => Connected");
675 break;
676 case 4:
677 socketMessage.append("4 => Bound");
678 break;
679 case 5:
680 socketMessage.append("5 => Closing");
681 break;
682 case 6:
683 socketMessage.append("6 => Listening");
684 break;
685 }
686 UI->gresbStatusQueryLabel->setText(socketMessage);
687 }
688
689 void rmapplugin::reTestSPWLink() // SLOT
690 {
691 if (GRESBStatusQueryRequest(LinkStatus, UI->spwLinkSpinBox->value()) == 0)
692 {
693 UI->gresbStatusQueryDialog->accept();
694 }
695 }
696
697 int rmapplugin::GRESBStatusQuery() // SLOT
698 {
699 GRESBStatusQueryRequest(LinkStatus, 0);
700 GRESBStatusQueryRequest(LinkStatus, 1);
701 GRESBStatusQueryRequest(LinkStatus, 2);
702 GRESBStatusQueryRequest(LinkStatistics, 0);
703 GRESBStatusQueryRequest(LinkStatistics, 1);
704 GRESBStatusQueryRequest(LinkStatistics, 2);
705 return 0;
706 }
707
708 void rmapplugin::displayOnConsole(QString message)
709 {
710 this->UI->console->append(message);
711 }
712
713 /////////////////////
714 // INTERNAL FUNCTIONS
715
716 int rmapplugin::GRESBStatusQueryRequest(GresbStatusQueryOption option, char link)
717 {
718 gresb_status_query_t statusQueryCommand;
719 gresb_link_status_reply_t linkStatusReply;
720 gresb_link_statistics_reply_t linkStatisticsReply;
721 QTime statusQueryTimeout;
722 QString console_message;
723
724 statusQueryCommand.protocolIdentifier = (char) 0x02;
725 statusQueryCommand.reserved1 = (char) 0x00;
726 statusQueryCommand.reserved0 = (char) 0x00;
727 statusQueryCommand.option = (char) option;
728 statusQueryCommand.value3 = (char) 0x00;
729 statusQueryCommand.value2 = (char) 0x00;
730 statusQueryCommand.value1 = (char) 0x00;
731 statusQueryCommand.value0 = (char) link;
732
733 GRESBStatusQuery_SOCKET->write((char*) ((void*) &statusQueryCommand), sizeof(statusQueryCommand));
734 GRESBStatusQuery_SOCKET->flush();
735 GRESBStatusQuery_SOCKET->waitForBytesWritten(1000);
736
737 statusQueryTimeout.start();
738 while(GRESBStatusQuery_SOCKET->bytesToWrite() > 0)
739 {
740 GRESBStatusQuery_SOCKET->waitForBytesWritten(100);
741 if(statusQueryTimeout.elapsed()>1000)
742 {
743 APPENDTOLOG("WARNING === in function GRESBStatusQueryRequest of rmapplugin *** sending StatusQueryCommand timeout");
744 return 1;
745 }
746 }
747
748 switch (option)
749 {
750 case LinkStatus:
751 {
752 statusQueryTimeout.start();
753 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatusReply))
754 {
755 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
756 if(statusQueryTimeout.elapsed()>1000)
757 {
758 console_message.sprintf("GRESBStatusQueryRequest / LinkStatus => error timeout bytesAvailable()\n");
759 APPENDTOLOG(console_message);
760 return 1;
761 }
762 }
763 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatusReply), (int) sizeof(linkStatusReply));
764 console_message.sprintf("%x", linkStatusReply.byte0);
765 UI->spwLinkStatusEnquiry->statusQueryTable->item(0, link)->setText(console_message);
766 console_message.sprintf("%d", linkStatusReply.byte1);
767 UI->spwLinkStatusEnquiry->statusQueryTable->item(1, link)->setText(console_message);
768 if (linkStatusReply.byte0 == 0) return 1;
769 break;
770 }
771 case LinkStatistics:
772 {
773 statusQueryTimeout.start();
774 while(GRESBStatusQuery_SOCKET->bytesAvailable() < (int) sizeof(linkStatisticsReply))
775 {
776 GRESBStatusQuery_SOCKET->waitForReadyRead(100);
777 if(statusQueryTimeout.elapsed()>1000)
778 {
779 console_message.sprintf("GRESBStatusQueryRequest / LinkStatistics => error timeout bytesAvailable()\n");
780 APPENDTOLOG(console_message);
781 return 1;
782 }
783 }
784 GRESBStatusQuery_SOCKET->read((char*) ((void*) &linkStatisticsReply), sizeof(linkStatisticsReply));
785 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataTransmitted));
786 UI->spwLinkStatusEnquiry->statusQueryTable->item(9, link)->setText(console_message);
787 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsTransmitted));
788 UI->spwLinkStatusEnquiry->statusQueryTable->item(8, link)->setText(console_message);
789 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfTruncatedPacketsReceived));
790 UI->spwLinkStatusEnquiry->statusQueryTable->item(6, link)->setText(console_message);
791 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsWithEEPReceived));
792 UI->spwLinkStatusEnquiry->statusQueryTable->item(5, link)->setText(console_message);
793 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.sizeOfDataReceived));
794 UI->spwLinkStatusEnquiry->statusQueryTable->item(4, link)->setText(console_message);
795 console_message.sprintf("%d", charTab_TO_int(linkStatisticsReply.numberOfPacketsReceived));
796 UI->spwLinkStatusEnquiry->statusQueryTable->item(3, link)->setText(console_message);
797 break;
798 }
799 case NodeAddressStatistics:
800 {
801 break;
802 }
803 case GetRoute:
804 {
805 break;
806 }
807 }
808 return 0;
809 }
810
811 int rmapplugin::charTab_TO_int(char *charTab)
812 {
813 int result = 0;
814 result = (charTab[0]<<24) +(charTab[1]<<16) +(charTab[2]<<8) + charTab[3];
815 return result;
816 }
817
@@ -0,0 +1,95
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
22 #ifndef DRIVER1_H
23 #define DRIVER1_H
24 #include <rmappluginui.h>
25 #include <rmapoperations.h>
26 #include <QMenuBar>
27 #include <QMenu>
28 #include <QAction>
29 #include <QMainWindow>
30 #include <QTcpSocket>
31 #include <QTime>
32 #include <ccsds.h>
33 #include <QSemaphore>
34 #include <spwpacketreceiver.h>
35
36 #include <lppmonplugin.h>
37
38 #define APPENDTOLOG(message) this->UI->appendToLogFile(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": " + message)
39
40 #define READ_WRITE_MAX_COUNTS 4096 // in words
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 #define RMAP_READ_REPLY_HEADER_LENGTH 12 // in bytes => ECSS
43 #define RMAP_READ_COMMAND_HEADER_LENGTH 16 // in bytes => ECSS
44 #define RMAP_DATA_CRC_LENGTH 1 // in bytes => ECSS
45 #define CCSDS_MAX_PACKET_LENGTH 4412 // in bytes, specified in the LFR Software Requirements Specification
46
47 class rmapplugin : public lppmonplugin
48 {
49 Q_OBJECT
50 public:
51 explicit rmapplugin(QWidget *parent = 0);
52 ~rmapplugin();
53 int GRESBStatusQueryRequest(GresbStatusQueryOption option, char link);
54 int charTab_TO_int(char *charTab);
55
56 public slots:
57 unsigned int Write(unsigned int *Value,unsigned int count,unsigned int address=0);
58 unsigned int Read(unsigned int *Value,unsigned int count,unsigned int address=0);
59 //
60 unsigned int WriteSPW(char *Value, unsigned int count, char targetLogicalAddress, char userApplication);
61 void sendCCSDS();
62 void send_TC_LFR_UPDATE_TIME();
63 void reset_TC_LFR_UPDATE_TIME();
64 int GRESBStatusQuery();
65 void displayOnConsole(QString message);
66 //
67 void RMAP_CONNECT();
68 void RMAP_DISCONNECT();
69 int RMAPSendReadCommand();
70 int RMAPSendWriteCommand();
71 void reTestSPWLink();
72 //
73 void RMAPSendConnectionState(QAbstractSocket::SocketState socketState);
74 void RMAPReceiveConnectionState(QAbstractSocket::SocketState socketState);
75 void GRESBConnectionState(QAbstractSocket::SocketState socketState);
76
77 signals:
78 void ccsdsPacketReadyRead(char *ccsdsPacket, unsigned int size);
79
80 private:
81 rmapPluginUI* UI;
82 QTcpSocket* GRESBStatusQuery_SOCKET;
83 QTcpSocket* RMAPSend_SOCKET;
84 QTcpSocket* RMAPReceive_SOCKET;
85 ccsds* ccsds_command;
86 unsigned int rmapPacketSize;
87 unsigned int time_COARSE;
88 unsigned int time_FINE;
89 spwpacketreceiver* spwPacketReceiverOBJECT;
90 unsigned int WriteBLOCK(char *data,unsigned int nbBytes,unsigned int address=0);
91 unsigned int ReadBLOCK(unsigned int nbBytes,unsigned int address=0);
92 char timeCode;
93 };
94
95 #endif // DRIVER1_H
@@ -0,0 +1,69
1 #
2 # Project created by QtCreator 2011-09-20T08:15:30
3 #
4 #-------------------------------------------------
5
6 #include(/etc/lppmon/lppmonplugin.prf)
7 CONFIG += lppmonplugin
8 TARGET = rmapplugin
9
10 DEFINES += PLUGIN=rmapplugin
11 DEFINES += PLUGINHEADER="\"\\\"rmapplugin.h"\\\"\"
12 DEFINES += driver_Name="\"\\\"RMAPPlugin"\\\"\"
13 DEFINES += driver_Author="\"\\\"Paul Leroy paul.leroy@lpp.polytechnique.fr"\\\"\"
14 DEFINES += driver_Version="\"\\\"1.1.2"\\\"\"
15 DEFINES += driver_Description="\"\\\"AHB bus controler, works with Gaisler's AHB plugn' play bus."\\\"\"
16 DEFINES += driver_can_be_root=1
17 DEFINES += driver_can_be_child=0
18 DEFINES += driver_VID=0
19 DEFINES += driver_PID=0
20
21
22 QT += network
23
24
25 LIBS += ../spw_usb_driver_v2.61/lib/libSpaceWireUSBAPI.so
26
27
28 INCLUDEPATH += \
29 $${PWD} \
30 ../common_PLE \
31 ../spw_usb_driver_v2.61/inc
32
33
34 HEADERS += \
35 rmappluginui.h \
36 rmapplugin.h \
37 rmapoperations.h \
38 ccsds.h \
39 spwpacketreceiver.h \
40 ../common_PLE/qipdialogbox.h \
41 ../common_PLE/gresbstatusenquiry.h \
42 spectralmatricesdmasimulator.h \
43 rmappluginpythonwrapper.h \
44 stardundee.h \
45 ../spw_usb_driver_v2.61/inc/spw_usb_api.h
46
47
48 SOURCES += \
49 rmapplugin.cpp \
50 rmappluginui.cpp \
51 rmapoperations.cpp \
52 ccsds.cpp \
53 spwpacketreceiver.cpp \
54 ../common_PLE/qipdialogbox.cpp \
55 ../common_PLE/gresbstatusenquiry.cpp \
56 spectralmatricesdmasimulator.cpp \
57 rmappluginpythonwrapper.cpp \
58 stardundee.cpp
59
60
61
62
63
64
65
66
67
68
69
@@ -0,0 +1,19
1 #include "rmappluginpythonwrapper.h"
2 #include <math.h>
3
4 rmappluginPythonWrapper::rmappluginPythonWrapper(QObject *parent) :
5 genericPySysdriver(parent)
6 {
7 }
8
9
10 QList<QVariant> rmappluginPythonWrapper::getData()
11 {
12 QList<QVariant> data;
13 for (int i = 0; i<1024; i++)
14 {
15 QVariant t(1000*cos(0.1*i));
16 data.append(t);
17 }
18 return data;
19 }
@@ -0,0 +1,22
1 #ifndef RMAPPLUGINPYTHONWRAPPER_H
2 #define RMAPPLUGINPYTHONWRAPPER_H
3
4 #include <QObject>
5 #include <genericPySysdriver.h>
6 #include <QList>
7 #include <QVariant>
8
9 class rmappluginPythonWrapper : public genericPySysdriver
10 {
11 Q_OBJECT
12 public:
13 explicit rmappluginPythonWrapper(QObject *parent = 0);
14
15 signals:
16
17 public slots:
18 QList<QVariant> getData();
19
20 };
21
22 #endif // RMAPPLUGINPYTHONWRAPPER_H
@@ -0,0 +1,240
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
3 -- Copyright (C) 2011, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
22 #include "rmapplugin.h"
23
24 rmapPluginUI::rmapPluginUI(QWidget *parent) :
25 QWidget(parent)
26 {
27 spectralMatricesDMASimulator = new SpectralMatricesDMASimulator;
28 spwTabWidget = new QTabWidget;
29 QWidget* spwTabWidgetPage0 = new QWidget;
30 QWidget* spwTabWidgetPage1 = new QWidget;
31 QWidget* spwTabWidgetPage2 = new QWidget;
32 QWidget* spwTabWidgetPage3 = new QWidget;
33 QWidget* spwTabWidgetPage4 = new QWidget;
34 QWidget* spwTabWidgetPage5 = new QWidget;
35 mainLayout = new QVBoxLayout;
36 connectionLayout = new QGridLayout;
37 ccsdsLayout = new QVBoxLayout;
38 consoleLayout = new QVBoxLayout;
39
40 //*** QLABEL ***//
41 gresbBridgeIPLabel = new QLabel(tr("GRESB Bridge IP: "));
42 gresbVirtualLinkLabel = new QLabel(tr("GRESB Virtual Link: "));
43 spwLinkLabel = new QLabel(tr("GRESB SPW Link: "));
44 rmapSourceLogicalAddressLabel = new QLabel(tr("RMAP Source Logical Address: "));
45 rmapTargetLogicalAddressLabel = new QLabel(tr("RMAP Target Logical Address: "));
46 rmapSendStateLabel = new QLabel(tr("RMAP Send Socket State: waiting for connection"));
47 rmapReceiveStateLabel = new QLabel(tr("RMAP Receive Socket State: waiting for connection"));
48 logFileName = new QLabel;
49 gresbStatusQueryLabel = new QLabel(tr("GRESB status query socket (port 3010): waiting for connection"));
50 gresbStatusQueryDialogLabel = new QLabel(tr("sockets opened but SpaceWire link not running"));
51 sendCCSDSCommandLabel = new QLabel(tr("Address of the target"));
52
53 //*** QPUSHBUTTON ***//
54 rmapOpenCommunicationButton = new QPushButton(tr("Open RMAP Communication"));
55 rmapCloseCommunicationButton = new QPushButton(tr("Close RMAP Communication"));
56 rmapCloseCommunicationButton->setEnabled(false);
57 logFileChooseButton = new QPushButton(tr("Choose file"));
58 gresbStatusQueryRetryButton = new QPushButton(tr("Retry"));
59 gresbStatusQueryAbortButton = new QPushButton(tr("Abort"));
60 sendCCSDSCommandButton = new QPushButton(tr("Send CCSDS Command"));
61 send_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("Send TC_LFR_UPDATE_TIME Packet"));
62 reset_TC_LFR_UPDATE_TIME_Button = new QPushButton(tr("reset the TC_LFR_UPDATE_TIME Packet coarse and fine times"));
63 clearConsoleButton = new QPushButton(tr("Clear"));
64
65 //*** SPINBOX ***//
66 gresbVirtualLinkSpinBox = new QSpinBox;
67 rmapSourceLogicalAddressSpinBox = new QSpinBox;
68 rmapTargetLogicalAddressSpinBox = new QSpinBox;
69 spwLinkSpinBox = new QSpinBox;;
70 CCSDSTargetLogicalAddressSpinBox = new QSpinBox;
71 gresbVirtualLinkSpinBox->setRange(0, 4);
72 gresbVirtualLinkSpinBox->setValue(1);
73 rmapSourceLogicalAddressSpinBox->setRange(0, 255);
74 rmapSourceLogicalAddressSpinBox->setValue(33);
75 rmapTargetLogicalAddressSpinBox->setRange(0, 255);
76 rmapTargetLogicalAddressSpinBox->setValue(254);
77 spwLinkSpinBox->setRange(0, 2);
78 spwLinkSpinBox->setValue(0);
79 CCSDSTargetLogicalAddressSpinBox->setRange(0,255);
80 CCSDSTargetLogicalAddressSpinBox->setValue(254);
81
82 //*** MISC **//
83 starDundee = new StarDundee;
84 console = new QTextEdit;
85 gresbBridgeIPDialogBox = new QIPDialogBox;
86 gresbStatusQueryDialog = new QDialog;
87 logEnableCheckBox = new QCheckBox(tr("Enable Logs"));
88 RMAP_write_verify = new QCheckBox(tr("data checked before write\nlimited to 4 bytes\nNOT IMPLEMENTED"));
89 RMAP_write_reply = new QCheckBox(tr("reply to the write command required\nlast reply status: unavailable"));
90 spwLinkStatusEnquiry = new gresbStatusEnquiry;
91 logFile = new QFile();
92
93 logFileEn = false;
94
95 connectionLayout->addWidget(gresbBridgeIPLabel, 0, 0, 0);
96 connectionLayout->addWidget(gresbBridgeIPDialogBox, 0, 1, 0);
97 connectionLayout->addWidget(gresbVirtualLinkLabel, 1, 0, 0);
98 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);
114
115 connectionLayout->setRowStretch(13, 1);
116 connectionLayout->setColumnStretch(2, 1);
117
118 ccsdsLayout->addWidget(sendCCSDSCommandButton);
119 ccsdsLayout->addWidget(send_TC_LFR_UPDATE_TIME_Button);
120 ccsdsLayout->addWidget(reset_TC_LFR_UPDATE_TIME_Button);
121 ccsdsLayout->addWidget(sendCCSDSCommandLabel);
122 ccsdsLayout->addWidget(CCSDSTargetLogicalAddressSpinBox);
123
124 consoleLayout->addWidget(console);
125 consoleLayout->addWidget(clearConsoleButton);
126
127 connect(this->logFileChooseButton, SIGNAL(clicked()), this, SLOT(chooseLogFile()));
128 connect(this, SIGNAL(setLogFileName(QString)), this->logFileName, SLOT(setText(QString)));
129 connect(this->logEnableCheckBox, SIGNAL(stateChanged(int)), this, SLOT(logFileEnDisable(int)));
130
131 spwTabWidget->addTab(spwTabWidgetPage0, tr("connection"));
132 spwTabWidget->addTab(spwTabWidgetPage1, tr("ccsds"));
133 spwTabWidget->addTab(spwTabWidgetPage2, tr("status"));
134 spwTabWidget->addTab(spwTabWidgetPage3, tr("console"));
135 spwTabWidget->addTab(spwTabWidgetPage4, tr("DMA"));
136 spwTabWidget->addTab(spwTabWidgetPage5, tr("Star Dundee"));
137 spwTabWidgetPage0->setLayout(connectionLayout);
138 spwTabWidgetPage1->setLayout(ccsdsLayout);
139 spwTabWidgetPage2->setLayout(this->spwLinkStatusEnquiry->mainLayout);
140 spwTabWidgetPage3->setLayout(consoleLayout);
141 spwTabWidgetPage4->setLayout(spectralMatricesDMASimulator->mainLayout);
142 spwTabWidgetPage5->setLayout(starDundee->layout());
143 mainLayout->addWidget(spwTabWidget);
144 setLayout(mainLayout);
145
146 // GRESB STATUS QUERY DIALOG
147 gresbStatusQueryDialogLayout = new QGridLayout;
148 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryDialogLabel, 0, 0, 1, 2);
149 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryRetryButton, 1, 0, 0);
150 gresbStatusQueryDialogLayout->addWidget(gresbStatusQueryAbortButton, 1, 1, 0);
151 gresbStatusQueryDialog->setLayout(gresbStatusQueryDialogLayout);
152
153 connect(gresbStatusQueryAbortButton, SIGNAL(clicked()), gresbStatusQueryDialog, SLOT(reject()));
154 connect(this->clearConsoleButton, SIGNAL(clicked()), this->console, SLOT(clear()));
155 }
156
157 void rmapPluginUI::connectPort()
158 {
159 //emit this->connectPortsig(ui->PortName->text(),ui->PortspeedSlider->value());
160 }
161
162 void rmapPluginUI::setConnected(bool connected)
163 {
164 /*if(connected == true)
165 {
166 ui->OpenPort->setText(tr("Close port"));
167 }
168 else
169 ui->OpenPort->setText(tr("Open port"));*/
170 }
171
172
173 rmapPluginUI::~rmapPluginUI()
174 {
175 //delete ui;
176 }
177
178 void rmapPluginUI::chooseLogFile()
179 {
180 if(this->logFile->isOpen())
181 this->logFile->close();
182 this->logFile->setFileName(QFileDialog::getSaveFileName(this,tr("Open Log file"),
183 QDir::homePath()
184 + "/"
185 + QDate::currentDate().toString()
186 + "_"
187 + QTime::currentTime().toString()
188 + "_rmapPluginUI.log",
189 tr("Log Files (*.txt *.log)")));
190 if(this->logFile->open(QIODevice::WriteOnly))
191 {
192 this->logFileStrm = new QTextStream(this->logFile);
193 emit this->setLogFileName(this->logFile->fileName());
194 }
195 }
196
197 void rmapPluginUI::logFileEnDisable(int state)
198 {
199 if(state==Qt::Checked)
200 {
201 this->logFileEn = true;
202 }
203 else if(state==Qt::Unchecked)
204 {
205 this->logFileEn = false;
206 }
207 }
208
209 bool rmapPluginUI::islogfileenable()
210 {
211 return this->logFileEn;
212 }
213
214 void rmapPluginUI::appendToLogFile(const QString & text)
215 {
216 if(this->logFileEn && this->logFile->isOpen())
217 {
218 *(this->logFileStrm) << text << endl;
219 }
220 }
221
222 void rmapPluginUI::closeEvent(QCloseEvent *event)
223 {
224 if(this->logFile->isOpen())
225 {
226 this->logFileStrm->flush();
227 this->logFile->waitForBytesWritten(3000);
228 this->logFile->close();
229 }
230 event->accept();
231 }
232
233 RMAP_command_codes rmapPluginUI::getCommandCode()
234 {
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;
240 }
@@ -0,0 +1,129
1 /*------------------------------------------------------------------------------
2 -- This file is a part of the LPPMON Software
3 -- Copyright (C) 20011, Laboratory of Plasma Physics - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------*/
19 /*-- Author : Paul Leroy
20 -- Mail : paul.leroy@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------*/
22 #ifndef RMAPPLUGINUI_H
23 #define RMAPPLUGINUI_H
24
25 #include <QWidget>
26 #include <QPushButton>
27 #include <QLabel>
28 #include <QSlider>
29 #include <QSpinBox>
30 #include <QGridLayout>
31 #include <QCheckBox>
32 #include <QFile>
33 #include <QTextStream>
34 #include <QFileDialog>
35 #include <QDir>
36 #include <QDialog>
37 #include <QCloseEvent>
38 #include <QTabWidget>
39 #include "qipdialogbox.h"
40 #include <rmapoperations.h>
41 #include <gresbstatusenquiry.h>
42 #include <QTextEdit>
43 #include "spectralmatricesdmasimulator.h"
44 #include <stardundee.h>
45
46 class rmapPluginUI : public QWidget
47 {
48 Q_OBJECT
49
50 public:
51 explicit rmapPluginUI(QWidget *parent = 0);
52 ~rmapPluginUI();
53
54 QPushButton* rmapOpenCommunicationButton;
55 QPushButton* rmapCloseCommunicationButton;
56 QPushButton* logFileChooseButton;
57 QPushButton* gresbStatusQueryRetryButton;
58 QPushButton* gresbStatusQueryAbortButton;
59 QPushButton* sendCCSDSCommandButton;
60 QPushButton* send_TC_LFR_UPDATE_TIME_Button;
61 QPushButton* reset_TC_LFR_UPDATE_TIME_Button;
62 QPushButton* clearConsoleButton;
63
64 QSpinBox* gresbVirtualLinkSpinBox;
65 QSpinBox* spwLinkSpinBox;
66 QSpinBox* rmapSourceLogicalAddressSpinBox;
67 QSpinBox* rmapTargetLogicalAddressSpinBox;
68 QSpinBox* CCSDSTargetLogicalAddressSpinBox;
69
70 QIPDialogBox* gresbBridgeIPDialogBox;
71
72 QCheckBox *logEnableCheckBox;
73 QCheckBox *RMAP_write_verify;
74 QCheckBox *RMAP_write_reply;
75
76 QLabel* rmapSendStateLabel;
77 QLabel* rmapReceiveStateLabel;
78 QLabel* gresbStatusQueryLabel;
79 QLabel* gresbStatusQueryDialogLabel;
80 QLabel* sendCCSDSCommandLabel;
81
82 QDialog* gresbStatusQueryDialog;
83
84 gresbStatusEnquiry* spwLinkStatusEnquiry;
85
86 SpectralMatricesDMASimulator *spectralMatricesDMASimulator;
87
88 QTextEdit* console;
89
90 StarDundee *starDundee;
91
92 bool islogfileenable();
93 void appendToLogFile(const QString & text);
94 void closeEvent(QCloseEvent *event);
95 RMAP_command_codes getCommandCode();
96
97 public slots:
98 void setConnected(bool connected);
99 void connectPort();
100 void chooseLogFile();
101 void logFileEnDisable(int state);
102
103 signals:
104 void connectPortsig(QString PortName,int baudrate);
105 void setLogFileName(QString FileName);
106
107 private:
108 QLabel* gresbBridgeIPLabel;
109 QLabel* gresbVirtualLinkLabel;
110 QLabel* spwLinkLabel;
111 QLabel* rmapSourceLogicalAddressLabel;
112 QLabel* rmapTargetLogicalAddressLabel;
113 QLabel *logFileName;
114
115 QVBoxLayout* mainLayout;
116 QGridLayout* connectionLayout;
117 QVBoxLayout* ccsdsLayout;
118 QVBoxLayout* consoleLayout;
119 QGridLayout* gresbStatusQueryDialogLayout;
120
121 QTabWidget* spwTabWidget;
122
123 QFile* logFile;
124 QTextStream* logFileStrm;
125 bool logFileEn;
126
127 };
128
129 #endif // RMAPPLUGINUI_H
@@ -0,0 +1,133
1 #include "spectralmatricesdmasimulator.h"
2
3 SpectralMatricesDMASimulator::SpectralMatricesDMASimulator(QWidget *parent) :
4 QWidget(parent)
5 {
6 timer = new QTimer;
7 QString message;
8 count = SPECTRAL_MATRIX_SIZE;
9 unsigned int i = 0;
10
11 Value = (unsigned int*) malloc(count*sizeof(int));
12 for (i=0; i<count; i++){
13 Value[i] = i;
14 }
15 spectralMatrixCTRL = 0x00;
16 spectralMatrixAddress1 = 0x40000000;
17 spectralMatrixAddress2 = 0x40000004;
18 irqctrlForce = 0x00001000; // force irq 12
19 flagSendMatrix1 = true;
20
21 sendOneSpectralMatrix1Button = new QPushButton(tr("Send 1 Spectral Matrix at address 1"));
22 sendOneSpectralMatrix2Button = new QPushButton(tr("Send 1 Spectral Matrix at address 2"));
23 readMatrixAddress1Button = new QPushButton(tr("Read Spectral Matrix Address (1)"));
24 readMatrixAddress2Button = new QPushButton(tr("Read Spectral Matrix Address (2)"));
25 startSendingMatricesButton = new QPushButton(tr("Start sending matrices periodically"));
26 stopSendingMatricesButton = new QPushButton(tr("Stop sending matrices periodically"));
27 mainLayout = new QVBoxLayout;
28 mainLayout->addWidget(sendOneSpectralMatrix1Button);
29 mainLayout->addWidget(sendOneSpectralMatrix2Button);
30 mainLayout->addWidget(readMatrixAddress1Button);
31 mainLayout->addWidget(readMatrixAddress2Button);
32 mainLayout->addWidget(startSendingMatricesButton);
33 mainLayout->addWidget(stopSendingMatricesButton);
34 this->setLayout(mainLayout);
35
36 message.append("Address of the Spectral Matrix N°1: " + QString::number(spectralMatrixAddress1));
37 emit sendMessage(message);
38 message.append("Address of the Spectral Matrix N°2: " + QString::number(spectralMatrixAddress2));
39 emit sendMessage(message);
40
41 connect(this->sendOneSpectralMatrix1Button, SIGNAL(clicked()), this, SLOT(sendOneSpectralMatrix1SLOT()));
42 connect(this->sendOneSpectralMatrix2Button, SIGNAL(clicked()), this, SLOT(sendOneSpectralMatrix2SLOT()));
43 connect(this->readMatrixAddress1Button, SIGNAL(clicked()), this, SLOT(readMatrixAddress1SLOT()));
44 connect(this->readMatrixAddress2Button, SIGNAL(clicked()), this, SLOT(readMatrixAddress2SLOT()));
45 connect(this->timer, SIGNAL(timeout()), this, SLOT(sendOneSpectralMatrixSLOT()));
46 connect(this->startSendingMatricesButton, SIGNAL(clicked()), this, SLOT(startSendingMatricesSLOT()));
47 connect(this->stopSendingMatricesButton, SIGNAL(clicked()), this, SLOT(stopSendingMatricesSLOT()));
48 }
49
50 void SpectralMatricesDMASimulator::sendOneSpectralMatrix1SLOT()
51 {
52 emit(rmapplugginRead(&spectralMatrixAddress1, 1, APB_SPECTRAL_MATRICES_DMA1));
53 emit(rmapplugginWrite(Value, count, spectralMatrixAddress1));
54 emit(rmapplugginRead(&spectralMatrixCTRL, 1, APB_SPECTRAL_MATRICES_CTRL));
55 spectralMatrixCTRL = spectralMatrixCTRL | 0x00000001;
56 emit(rmapplugginWrite(&spectralMatrixCTRL, 1, APB_SPECTRAL_MATRICES_CTRL));
57 emit(rmapplugginWrite(&irqctrlForce, 1, APB_ADDRESS_IRQCTRL));
58 }
59
60 void SpectralMatricesDMASimulator::sendOneSpectralMatrix2SLOT()
61 {
62 emit(rmapplugginRead(&spectralMatrixAddress2, 1, APB_SPECTRAL_MATRICES_DMA2));
63 emit(rmapplugginWrite(Value, count, spectralMatrixAddress2));
64 emit(rmapplugginRead(&spectralMatrixCTRL, 1, APB_SPECTRAL_MATRICES_CTRL));
65 spectralMatrixCTRL = spectralMatrixCTRL | 0x00000002;
66 emit(rmapplugginWrite(&spectralMatrixCTRL, 1, APB_SPECTRAL_MATRICES_CTRL));
67 emit(rmapplugginWrite(&irqctrlForce, 1, APB_ADDRESS_IRQCTRL));
68 }
69
70 void SpectralMatricesDMASimulator::sendOneSpectralMatrixSLOT()
71 {
72 if (flagSendMatrix1 == true)
73 {
74 emit(rmapplugginRead(&spectralMatrixCTRL, 1, APB_SPECTRAL_MATRICES_CTRL));
75 if ( (spectralMatrixCTRL & 1) == 1) emit(sendMessage("ERROR matrix 1 not processed"));
76 //emit(rmapplugginWrite(Value, count, spectralMatrixAddress1));
77 spectralMatrixCTRL = spectralMatrixCTRL | 0x00000001; // sets the bit 0 of the ctrl register to 1
78 emit(rmapplugginWrite(&spectralMatrixCTRL, 1, APB_SPECTRAL_MATRICES_CTRL));
79 emit(rmapplugginWrite(&irqctrlForce, 1, APB_ADDRESS_IRQCTRL));
80 flagSendMatrix1 = false;
81 nbMatricesSent++;
82 if (nbMatricesSent==400) {
83 emit(sendMessage("400 matrices successfully sent"));
84 nbMatricesSent = 0;
85 }
86 }
87 else if (flagSendMatrix1 == false)
88 {
89 emit(rmapplugginRead(&spectralMatrixCTRL, 1, APB_SPECTRAL_MATRICES_CTRL));
90 if ( ( (spectralMatrixCTRL>>1) & 1 ) == 1 ) emit(sendMessage("ERROR matrix 2 not processed"));
91 //emit(rmapplugginWrite(Value, count, spectralMatrixAddress2));
92 spectralMatrixCTRL = spectralMatrixCTRL | 0x00000002; // sets the bit 1 of the ctrl register to 1
93 emit(rmapplugginWrite(&spectralMatrixCTRL, 1, APB_SPECTRAL_MATRICES_CTRL));
94 emit(rmapplugginWrite(&irqctrlForce, 1, APB_ADDRESS_IRQCTRL));
95 flagSendMatrix1 = true;
96 nbMatricesSent++;
97 if (nbMatricesSent==400) {
98 emit(sendMessage("400 matrices successfully sent"));
99 nbMatricesSent = 0;
100 }
101 }
102 }
103
104 void SpectralMatricesDMASimulator::readMatrixAddress1SLOT()
105 {
106 QString message;
107 emit(rmapplugginRead(&spectralMatrixAddress1, 1, APB_SPECTRAL_MATRICES_DMA1));
108 message.append("Address of the Spectral Matrix (1): "
109 + QString::number(spectralMatrixAddress1, 16));
110 emit sendMessage(message);
111 }
112
113 void SpectralMatricesDMASimulator::readMatrixAddress2SLOT()
114 {
115 QString message;
116 emit(rmapplugginRead(&spectralMatrixAddress2, 1, APB_SPECTRAL_MATRICES_DMA2));
117 message.append("Address of the Spectral Matrix (2): "
118 + QString::number(spectralMatrixAddress2, 16));
119 emit sendMessage(message);
120 }
121
122 void SpectralMatricesDMASimulator::startSendingMatricesSLOT()
123 {
124 nbMatricesSent = 0;
125 readMatrixAddress1SLOT();
126 readMatrixAddress2SLOT();
127 timer->start(40);
128 }
129
130 void SpectralMatricesDMASimulator::stopSendingMatricesSLOT()
131 {
132 timer->stop();
133 }
@@ -0,0 +1,60
1 #ifndef SPECTRALMATRICESDMASIMULATOR_H
2 #define SPECTRALMATRICESDMASIMULATOR_H
3
4 #define APB_SPECTRAL_MATRICES_CTRL 0x80000700
5 #define APB_SPECTRAL_MATRICES_DMA1 0x80000704
6 #define APB_SPECTRAL_MATRICES_DMA2 0x80000708
7 #define APB_ADDRESS_IRQCTRL 0x80000208
8
9 #include <QWidget>
10 #include <QPushButton>
11 #include <QVBoxLayout>
12 #include <QTimer>
13
14 #define SPECTRAL_MATRIX_SIZE 3840
15
16 class SpectralMatricesDMASimulator : public QWidget
17 {
18 Q_OBJECT
19 public:
20 explicit SpectralMatricesDMASimulator(QWidget *parent = 0);
21 QVBoxLayout *mainLayout;
22
23 signals:
24 void rmapplugginRead(unsigned int *Value, unsigned int count, unsigned int address);
25 void rmapplugginWrite(unsigned int *Value, unsigned int count, unsigned int address);
26 void sendMessage(QString message);
27
28 public slots:
29 void sendOneSpectralMatrixSLOT();
30 void sendOneSpectralMatrix1SLOT();
31 void sendOneSpectralMatrix2SLOT();
32 void startSendingMatricesSLOT();
33 void stopSendingMatricesSLOT();
34 void readMatrixAddress1SLOT();
35 void readMatrixAddress2SLOT();
36
37 private:
38 unsigned int *Value;
39 unsigned int count;
40 unsigned int address;
41 unsigned int spectralMatrixCTRL;
42 unsigned int spectralMatrixAddress1;
43 unsigned int spectralMatrixAddress2;
44 unsigned int irqctrlForce;
45 unsigned int nbMatricesSent;
46
47 QPushButton *sendOneSpectralMatrix1Button;
48 QPushButton *sendOneSpectralMatrix2Button;
49 QPushButton *sendSpectralMatricesPeriodicallyButton;
50 QPushButton *readMatrixAddress1Button;
51 QPushButton *readMatrixAddress2Button;
52 QPushButton *startSendingMatricesButton;
53 QPushButton *stopSendingMatricesButton;
54
55 bool flagSendMatrix1;
56
57 QTimer *timer;
58 };
59
60 #endif // SPECTRALMATRICESDMASIMULATOR_H
@@ -0,0 +1,129
1 #include "spwpacketreceiver.h"
2 #include <QTime>
3
4 spwpacketreceiver::spwpacketreceiver(QObject *parent) :
5 QObject(parent)
6 {
7 rmapPacketSEMAPHORE = new QSemaphore;
8 ccsdsPacketSEMAPHORE = new QSemaphore;
9 rmapPacket = (char*) malloc(RMAP_MAX_PACKET_LENGTH);
10 ccsdsPacket = (unsigned char*) malloc(CCSDS_MAX_PACKET_LENGTH);
11 spwPacket = (char*) malloc( qMax(RMAP_MAX_PACKET_LENGTH, CCSDS_MAX_PACKET_LENGTH) );
12 connect(this, SIGNAL(ccsdsPacketAvailable(unsigned char*,uint)), this, SLOT(processCCSDSPacket(unsigned char*,uint)));
13 }
14
15 spwpacketreceiver::~spwpacketreceiver()
16 {
17 free(rmapPacket);
18 free(ccsdsPacket);
19 free(spwPacket);
20 }
21
22 int spwpacketreceiver::receiveSPWPacket(unsigned char requestID) // SLOT
23 {
24 QTime spwPacketReceiverTimeout;
25 // GRESB HEADER
26 char RES_TR_EP; // 6 bits REserved + 1 bit TRuncated + 1 bit EP error end of packet
27 unsigned char packetLength2;
28 unsigned char packetLength1;
29 unsigned char packetLength0;
30 unsigned int packetLength;
31
32 if (requestID==1)
33 {
34 if (rmapPacketSEMAPHORE->available()) return rmapPacketSize;
35 }
36
37 gresbReceptionSocket->blockSignals(1); // block the signals of the socket during packet reception
38 // READ THE GRESB HEADER OF THE INCOMING PACKET
39 spwPacketReceiverTimeout.start();
40 while(gresbReceptionSocket->bytesAvailable() < 4)
41 {
42 gresbReceptionSocket->waitForReadyRead(100);
43 if(spwPacketReceiverTimeout.elapsed()>1000) return -1; // ERROR === read GRSEB header TIMEOUT
44 }
45 gresbReceptionSocket->read(&RES_TR_EP, 1);
46 gresbReceptionSocket->read( (char*) &packetLength2, 1);
47 gresbReceptionSocket->read( (char*) &packetLength1, 1);
48 gresbReceptionSocket->read( (char*) &packetLength0, 1);
49 packetLength = (packetLength2<<16) + (packetLength1<<8) + (packetLength0);
50 spwPacket = (char*) malloc(packetLength);
51
52 // READ THE SPW PACKET
53 while(gresbReceptionSocket->bytesAvailable() < packetLength)
54 {
55 gresbReceptionSocket->waitForReadyRead(100);
56 if(spwPacketReceiverTimeout.elapsed()>1000) return -2; // ERROR === read SPW packet TIMEOUT
57 }
58 gresbReceptionSocket->read( spwPacket, packetLength );
59 gresbReceptionSocket->blockSignals(0);
60
61 switch(spwPacket[1]) // byte 1 is the protocole identifier in the SPW packet
62 {
63 case 1: // 0x01 is the protocole identifier for RMAP packets
64 if (rmapPacketSEMAPHORE->available()!=0) return -3; // ERROR === previous RMAP packet not processed yet
65 for(unsigned int i=0; i<packetLength; i++) rmapPacket[i] = spwPacket[i];
66 rmapPacketSize = packetLength;
67 rmapPacketSEMAPHORE->release();
68 //emit sendMessage("RMAP packet of size " + QString::number(packetLength) + " received");
69 return packetLength;
70
71 case 2: // 0x02 is the protocole identifier for CCSDS packets
72 if (ccsdsPacketSEMAPHORE->available()!=0) return -4; // ERROR === previous CCSDS packet not processed yet
73 for(unsigned int i=0; i<packetLength; i++) ccsdsPacket[i] = spwPacket[i];
74 ccsdsPacketSize = packetLength;
75 ccsdsPacketSEMAPHORE->release();
76 emit(ccsdsPacketAvailable(ccsdsPacket, packetLength));
77 return packetLength;
78 }
79 return 0;
80 }
81
82 bool spwpacketreceiver::isRMAPPacketSemaphoreAvailable()
83 {
84 if (rmapPacketSEMAPHORE->available()!=0) return true;
85 return false;
86 }
87
88 void spwpacketreceiver::acquireRMAPSemaphore()
89 {
90 rmapPacketSEMAPHORE->acquire();
91 }
92
93 void spwpacketreceiver::acquireCCSDSSemaphore()
94 {
95 ccsdsPacketSEMAPHORE->acquire();
96 }
97
98 void spwpacketreceiver::processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size)
99 {
100 QString message;
101 unsigned int fine_time_value = 0;
102 fine_time_value = ((unsigned int) ccsdsPacket[7]<<24)
103 + ((unsigned int) ccsdsPacket[6]<<16)
104 + ((unsigned int) ccsdsPacket[5]<<8)
105 + ((unsigned int) ccsdsPacket[4]);
106 message.append(QTime::currentTime().toString() +":" + QString::number(QTime::currentTime().msec()) + ": ");
107 message.append("size "
108 + QString::number(size)
109 +" *** header "
110 + QString::number(ccsdsPacket[0], 16)
111 + " "
112 + QString::number(ccsdsPacket[1], 16)
113 + " "
114 + QString::number(ccsdsPacket[2], 16)
115 + " "
116 + QString::number(ccsdsPacket[3], 16)
117 + " *** coarse time "
118 + QString::number(fine_time_value));
119 //+ QString::number(ccsdsPacket[4], 16)
120 //+" "
121 //+ QString::number(ccsdsPacket[5], 16)
122 //+" "
123 //+ QString::number(ccsdsPacket[6], 16)
124 //+" "
125 //+ QString::number(ccsdsPacket[7], 16));
126 ccsdsPacketSEMAPHORE->acquire();
127 emit sendMessage(message);
128 }
129
@@ -0,0 +1,44
1 #ifndef SPWPACKETRECEIVER_H
2 #define SPWPACKETRECEIVER_H
3
4 #include <QSemaphore>
5 #include <QTcpSocket>
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 class spwpacketreceiver : public QObject
16 {
17 Q_OBJECT
18 public:
19 explicit spwpacketreceiver(QObject *parent = 0);
20 ~spwpacketreceiver();
21 int fetchRMAPPacket();
22 void acquireRMAPSemaphore();
23 void acquireCCSDSSemaphore();
24 bool isRMAPPacketSemaphoreAvailable();
25
26 unsigned char* ccsdsPacket;
27 char* rmapPacket;
28 char* spwPacket;
29 unsigned int rmapPacketSize;
30 unsigned int ccsdsPacketSize;
31 QSemaphore* rmapPacketSEMAPHORE;
32 QSemaphore* ccsdsPacketSEMAPHORE;
33 QTcpSocket* gresbReceptionSocket;
34
35 public slots:
36 int receiveSPWPacket(unsigned char requestID = 0); // request ID by default is 0 for CCSDS
37 void processCCSDSPacket(unsigned char *ccsdsPacket, unsigned int size);
38
39 signals:
40 void ccsdsPacketAvailable(unsigned char* ccsdsPacket, unsigned int size);
41 void sendMessage(QString message);
42 };
43
44 #endif // SPWPACKETRECEIVER_H
@@ -0,0 +1,55
1 #include "stardundee.h"
2
3 StarDundee::StarDundee(QWidget *parent) :
4 QWidget(parent)
5 {
6 connection_LAYOUT = new QGridLayout;
7
8 openCommunication_BUTTON = new QPushButton(tr("Open communication link"));
9 closeCommunication_BUTTON = new QPushButton(tr("Close communication link"));
10
11 usbDeviceNumber_LABEL = new QLabel(tr("USB device number: "));
12
13 usbDeviceNumber_SPINBOX = new QSpinBox;
14 usbDeviceNumber_SPINBOX->setRange(0,32);
15 usbDeviceNumber_SPINBOX->setValue(0);
16
17 closeCommunication_BUTTON->setEnabled(false);
18
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);
23
24 this->setLayout(connection_LAYOUT);
25
26 connect(this->openCommunication_BUTTON, SIGNAL(clicked()), this, SLOT(OpenStarDundee()));
27 connect(this->closeCommunication_BUTTON, SIGNAL(clicked()), this, SLOT(CloseStarDundee()));
28 }
29
30 StarDundee::~StarDundee()
31 {
32 USBSpaceWire_Close(hDevice); // Close the device
33 }
34
35 unsigned int StarDundee::OpenStarDundee()
36 {
37 if (!USBSpaceWire_Open(&hDevice, 0)) // Open the first device
38 {
39 emit sendMessage("stardundee *** Open *** ERROR: USBSpaceWire_Open(&hDevice, 0))");
40 return -1;
41 }
42 openCommunication_BUTTON->setEnabled(false);
43 closeCommunication_BUTTON->setEnabled(true);
44 emit sendMessage("stardundee *** Open *** USBSpaceWire_Open(&hDevice, 0)) successful");
45 return 1;
46 }
47
48 unsigned int StarDundee::CloseStarDundee()
49 {
50 USBSpaceWire_Close(hDevice); // Close the device
51 emit sendMessage("stardundee *** Close *** USBSpaceWire_Close(hDevice)");
52 openCommunication_BUTTON->setEnabled(true);
53 closeCommunication_BUTTON->setEnabled(false);
54 return 1;
55 }
@@ -0,0 +1,38
1 #ifndef STARDUNDEE_H
2 #define STARDUNDEE_H
3
4 #include <QWidget>
5 #include "spw_usb_api.h"
6 #include <QPushButton>
7 #include <QGridLayout>
8 #include <QSpinBox>
9 #include <QLabel>
10
11 class StarDundee : public QWidget
12 {
13 Q_OBJECT
14 public:
15 explicit StarDundee(QWidget *parent = 0);
16 ~StarDundee();
17 star_device_handle hDevice;// Handle to the SpaceWire device
18 QGridLayout *connection_LAYOUT;
19
20 signals:
21 void sendMessage(QString message);
22
23 public slots:
24 unsigned int OpenStarDundee();
25 unsigned int CloseStarDundee();
26
27 private:
28
29 QPushButton *openCommunication_BUTTON;
30 QPushButton *closeCommunication_BUTTON;
31
32 QLabel *usbDeviceNumber_LABEL;
33
34 QSpinBox *usbDeviceNumber_SPINBOX;
35
36 };
37
38 #endif // STARDUNDEE_H
This diff has been collapsed as it changes many lines, (690 lines changed) Show them Hide them
@@ -0,0 +1,690
1 /**
2 * \file rmap_packet_library.h
3 * \brief Declarations of the functions provided by the STAR-Dundee RMAP Packet
4 * Library.
5 * STAR-Dundee\n
6 * Unit 12, Dundee University Incubator\n
7 * James Lindsay Place\n
8 * Dundee Technopole\n
9 * Dundee, DD1 5JJ\n
10 * Scotland, UK\n
11 * e-mail: support@star-dundee.com
12 *
13 * This file contains the declarations of the functions provided by the
14 * STAR-Dundee RMAP Packet Library, along with constants and types used by the
15 * library. The RMAP Packet Library provides functions for building and
16 * interpreting RMAP packets.
17 *
18 * <b>IMPORTANT NOTE:</b>
19 * \note If you are experiencing compilation errors indicating that
20 * U8 is already defined, for example, please add the following
21 * line to your code prior to including this file:\n
22 * <code>\#define NO_STAR_TYPES</code>\n
23 * Alternatively you can compile your code with a flag of
24 * <code>-DNO_STAR_TYPES</code>.\n
25 * (Copied from star_dundee_types.h)
26 *
27 * \version 3.2 - June 19th 2012\n
28 * Fixed bug when checking a write command packet or read reply packet
29 * has a data length of 0.
30 * Updates to documentation.
31 *
32 * \version 3.1 - February 10th 2012\n
33 * Minor updates to packet types to avoid errors in static
34 * analysers.\n\n
35 *
36 * \version 3.0 - October 14th 2011\n
37 * Updated linking process on Windows.\n
38 * Updated library file name.\n\n
39 *
40 * \version 2.1 - August 22nd 2011\n
41 * Made minor improvements to the internal structure.\n\n
42 *
43 * \version 2.0 - October 28th 2009\n
44 * Changed internal architecture to minimise memory allocations.\n
45 * Restored __stdcall calling convention on Windows.\n
46 * Updated names to be consistent with terminology in latest RMAP
47 * standard.\n
48 * Added functions to calculate the length of different packet types
49 * and to fill a buffer with specific packets.\n\n
50 *
51 * \version 1.9 - July 29th 2009\n
52 * Fixed problem with byte ordering in return value of
53 * RMAP_GetAddress.\n
54 * Fixed bug when creating read and write reply packets, with a packet
55 * structure provided.\n\n
56 *
57 * \version 1.8 - February 26th 2009\n
58 * Updated the calling convention used in the function declaration to
59 * __stdcall on Windows.\n\n
60 *
61 * \version 1.7 - November 20th 2008\n
62 * Fixed problem with naming of RMAP_IsCRCValid in header file.\n
63 * Added function to calculate a CRC starting from a CRC seed
64 * value.\n\n
65 *
66 * \version 1.6 - October 29th 2007\n
67 * Added support for SpaceCube.\n\n
68 *
69 * \version 1.5 - March 23rd 2007\n
70 * Used star_dundee_types.h to represent integer values of 1, 2 and 4
71 * bytes in a cross-platform manner.\n
72 * Fixed problems encountered on big endian machines.\n\n
73 *
74 * \version 1.4 - March 19th 2007\n
75 * Improved freeing of memory following errors.\n\n
76 *
77 * \version 1.3 - November 7th 2006\n
78 * Updated to be multi-platform.\n
79 * Using new CRC table.\n
80 * Fixed error when checking the format of read-modify-write command
81 * packets, data length incorrect.\n
82 * Fixed error when identifying the start of the extended and normal
83 * read/write address.\n
84 * Fixed error when reading the data length in a read command.\n\n
85 *
86 * \version 1.2 - April 3rd 2006\n
87 * Fixed potential problems with RMAP_PACKET_STATUS enum being an
88 * undefined size (no change to this file required).\n\n
89 *
90 * \version 1.1 - March 9th 2006\n
91 * Added support for different byte alignment requirements.\n\n
92 *
93 * \version 1.0 - December 20th 2005\n
94 * Initial version.\n\n
95 *
96 * Copyright &copy; 2009 STAR-Dundee Ltd
97 */
98
99
100
101 #ifndef RMAP_PACKET_LIBRARY_H
102 #define RMAP_PACKET_LIBRARY_H
103
104
105
106 #include "star-dundee_types.h"
107
108
109
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113
114
115
116 #if defined(_WIN32) || defined(_WIN64)
117 #ifdef _WIN64
118 #define RMAPPACKETLIBRARY_CC
119 #else
120 #define RMAPPACKETLIBRARY_CC __stdcall
121 #endif
122 #else
123 #define RMAPPACKETLIBRARY_CC
124 #endif
125
126
127
128 typedef enum
129 {
130 RMAP_SUCCESS = 0x00,
131 RMAP_GENERAL_ERROR = 0x01,
132 RMAP_UNUSED_PACKET_TYPE_OR_COMMAND_CODE = 0x02,
133 RMAP_INVALID_KEY = 0x03,
134 RMAP_INVALID_DATA_CRC = 0x04,
135 RMAP_EARLY_EOP = 0x05,
136 RMAP_TOO_MUCH_DATA = 0x06,
137 RMAP_EEP = 0x07,
138 RMAP_VERIFY_BUFFER_OVERRUN = 0x09,
139 RMAP_COMMAND_NOT_IMPLEMENTED_OR_AUTHORISED = 0x0a,
140 RMAP_RMW_DATA_LENGTH_ERROR = 0x0b,
141 RMAP_INVALID_TARGET_LOGICAL_ADDRESS = 0x0c,
142 RMAP_INVALID_STATUS = 0xff
143 } RMAP_STATUS;
144
145
146
147 #define RMAP_PROTOCOL_IDENTIFIER 1
148
149 #define RMAP_RESERVED_BIT 0x80
150 #define RMAP_COMMAND_BIT 0x40
151 #define RMAP_WRITE_OPERATION_BIT 0x20
152 #define RMAP_VERIFY_BEFORE_WRITE_BIT 0x10
153 #define RMAP_REPLY_BIT 0x08
154 #define RMAP_INCREMENT_ADDRESS_BIT 0x04
155 #define RMAP_REPLY_ADDRESS_LENGTH_BITS 0x03
156
157
158
159 typedef enum
160 {
161 RMAP_WRITE_COMMAND = (RMAP_COMMAND_BIT |
162 RMAP_WRITE_OPERATION_BIT),
163 RMAP_WRITE_REPLY = (RMAP_WRITE_OPERATION_BIT),
164 RMAP_READ_COMMAND = (RMAP_COMMAND_BIT),
165 RMAP_READ_REPLY = (0),
166 RMAP_READ_MODIFY_WRITE_COMMAND = (RMAP_COMMAND_BIT |
167 RMAP_VERIFY_BEFORE_WRITE_BIT),
168 RMAP_READ_MODIFY_WRITE_REPLY = (RMAP_VERIFY_BEFORE_WRITE_BIT),
169 RMAP_INVALID_PACKET_TYPE = (0xff)
170 } RMAP_PACKET_TYPE;
171
172
173
174 typedef struct
175 {
176 RMAP_PACKET_TYPE packetType;
177 U8 *pTargetAddress;
178 unsigned long targetAddressLength;
179 U8 *pReplyAddress;
180 unsigned long replyAddressLength;
181 U8 *pProtocolIdentifier;
182 U8 *pInstruction;
183 char verifyBeforeWrite;
184 char acknowledge;
185 char incrementAddress;
186 U8 *pKey;
187 U16 *pTransactionIdentifier;
188 U32 *pReadWriteAddress;
189 U8 *pExtendedReadWriteAddress;
190 U8 *pStatus;
191 U8 *pHeader;
192 unsigned long headerLength;
193 U8 *pHeaderCRC;
194 U8 *pData;
195 void *pDataLength;
196 U32 dataLength;
197 U8 *pDataCRC;
198 U8 *pMask;
199 U8 maskLength;
200 U8 *pRawPacket;
201 unsigned long rawPacketLength;
202 } RMAP_PACKET;
203
204
205
206 /* Declarations of the functions provided by the RMAP Packet Library */
207
208 U32
209 RMAPPACKETLIBRARY_CC
210 RMAP_GetVersion(
211 void
212 );
213
214 U8
215 RMAPPACKETLIBRARY_CC
216 RMAP_CalculateCRC(
217 void *pBuffer,
218 unsigned long len
219 );
220
221 U8
222 RMAPPACKETLIBRARY_CC
223 RMAP_CalculateCRCWithSeed(
224 void *pBuffer,
225 unsigned long len,
226 U8 crc
227 );
228
229 char
230 RMAPPACKETLIBRARY_CC
231 RMAP_IsCRCValid(
232 void *pBuffer,
233 unsigned long len,
234 U8 crc
235 );
236
237 RMAP_STATUS
238 RMAPPACKETLIBRARY_CC
239 RMAP_CheckPacketValid(
240 void *pRawPacket,
241 unsigned long packetLength,
242 RMAP_PACKET *pPacketStruct,
243 char checkPacketTooLong
244 );
245
246 RMAP_PACKET_TYPE
247 RMAPPACKETLIBRARY_CC
248 RMAP_GetPacketType(
249 RMAP_PACKET *pPacketStruct
250 );
251
252 U8 *
253 RMAPPACKETLIBRARY_CC
254 RMAP_GetTargetAddress(
255 RMAP_PACKET *pPacketStruct,
256 unsigned long *pTargetAddressLength
257 );
258
259 char
260 RMAPPACKETLIBRARY_CC
261 RMAP_GetVerifyBeforeWrite(
262 RMAP_PACKET *pPacketStruct
263 );
264
265 char
266 RMAPPACKETLIBRARY_CC
267 RMAP_GetPerformAcknowledgement(
268 RMAP_PACKET *pPacketStruct
269 );
270
271 char
272 RMAPPACKETLIBRARY_CC
273 RMAP_GetIncrementAddress(
274 RMAP_PACKET *pPacketStruct
275 );
276
277 U8
278 RMAPPACKETLIBRARY_CC
279 RMAP_GetKey(
280 RMAP_PACKET *pPacketStruct
281 );
282
283 U8 *
284 RMAPPACKETLIBRARY_CC
285 RMAP_GetReplyAddress(
286 RMAP_PACKET *pPacketStruct,
287 unsigned long *pReplyAddressLength
288 );
289
290 U16
291 RMAPPACKETLIBRARY_CC
292 RMAP_GetTransactionID(
293 RMAP_PACKET *pPacketStruct
294 );
295
296 U32
297 RMAPPACKETLIBRARY_CC
298 RMAP_GetAddress(
299 RMAP_PACKET *pPacketStruct,
300 U8 *pExtendedAddress
301 );
302
303 U8 *
304 RMAPPACKETLIBRARY_CC
305 RMAP_GetData(
306 RMAP_PACKET *pPacketStruct,
307 U32 *pDataLength
308 );
309
310 U32
311 RMAPPACKETLIBRARY_CC
312 RMAP_GetReadLength(
313 RMAP_PACKET* pPacketStruct
314 );
315
316 RMAP_STATUS
317 RMAPPACKETLIBRARY_CC
318 RMAP_GetStatus(
319 RMAP_PACKET *pPacketStruct
320 );
321
322 U8
323 RMAPPACKETLIBRARY_CC
324 RMAP_GetHeaderCRC(
325 RMAP_PACKET *pPacketStruct
326 );
327
328 U8
329 RMAPPACKETLIBRARY_CC
330 RMAP_GetDataCRC(
331 RMAP_PACKET *pPacketStruct
332 );
333
334 U8 *
335 RMAPPACKETLIBRARY_CC
336 RMAP_GetMask(
337 RMAP_PACKET *pPacketStruct,
338 U8 *pMaskLength
339 );
340
341 unsigned long
342 RMAPPACKETLIBRARY_CC
343 RMAP_CalculateWriteCommandPacketLength(
344 unsigned long targetAddressLength,
345 unsigned long replyAddressLength,
346 U32 dataLength,
347 char alignment
348 );
349
350 char
351 RMAPPACKETLIBRARY_CC
352 RMAP_FillWriteCommandPacket(
353 U8 *pTargetAddress,
354 unsigned long targetAddressLength,
355 U8 *pReplyAddress,
356 unsigned long replyAddressLength,
357 char verifyBeforeWrite,
358 char acknowledge,
359 char incrementAddress,
360 U8 key,
361 U16 transactionIdentifier,
362 U32 writeAddress,
363 U8 extendedWriteAddress,
364 U8 *pData,
365 U32 dataLength,
366 unsigned long *pRawPacketLength,
367 RMAP_PACKET *pPacketStruct,
368 char alignment,
369 U8 *pRawPacket,
370 unsigned long rawPacketLength
371 );
372
373 void *
374 RMAPPACKETLIBRARY_CC
375 RMAP_BuildWriteCommandPacket(
376 U8 *pTargetAddress,
377 unsigned long targetAddressLength,
378 U8 *pReplyAddress,
379 unsigned long replyAddressLength,
380 char verifyBeforeWrite,
381 char acknowledge,
382 char incrementAddress,
383 U8 key,
384 U16 transactionIdentifier,
385 U32 writeAddress,
386 U8 extendedWriteAddress,
387 U8 *pData,
388 U32 dataLength,
389 unsigned long *pRawPacketLength,
390 RMAP_PACKET *pPacketStruct,
391 char alignment
392 );
393
394 void *
395 RMAPPACKETLIBRARY_CC
396 RMAP_BuildWriteRegisterPacket(
397 U8 *pTargetAddress,
398 unsigned long targetAddressLength,
399 U8 *pReplyAddress,
400 unsigned long replyAddressLength,
401 char verifyBeforeWrite,
402 char acknowledge,
403 char incrementAddress,
404 U8 key,
405 U16 transactionIdentifier,
406 U32 writeAddress,
407 U8 extendedWriteAddress,
408 U32 registerValue,
409 unsigned long *pRawPacketLength,
410 RMAP_PACKET *pPacketStruct,
411 char alignment
412 );
413
414 unsigned long
415 RMAPPACKETLIBRARY_CC
416 RMAP_CalculateWriteReplyPacketLength(
417 unsigned long initiatorAddressLength,
418 char alignment
419 );
420
421 char
422 RMAPPACKETLIBRARY_CC
423 RMAP_FillWriteReplyPacket(
424 U8 *pInitiatorAddress,
425 unsigned long initiatorAddressLength,
426 U8 targetAddress,
427 char verifyBeforeWrite,
428 char incrementAddress,
429 RMAP_STATUS status,
430 U16 transactionIdentifier,
431 unsigned long *pRawPacketLength,
432 RMAP_PACKET *pPacketStruct,
433 char alignment,
434 U8 *pRawPacket,
435 unsigned long rawPacketLength
436 );
437
438 void *
439 RMAPPACKETLIBRARY_CC
440 RMAP_BuildWriteReplyPacket(
441 U8 *pInitiatorAddress,
442 unsigned long initiatorAddressLength,
443 U8 targetAddress,
444 char verifyBeforeWrite,
445 char incrementAddress,
446 RMAP_STATUS status,
447 U16 transactionIdentifier,
448 unsigned long *pRawPacketLength,
449 RMAP_PACKET *pPacketStruct,
450 char alignment
451 );
452
453 unsigned long
454 RMAPPACKETLIBRARY_CC
455 RMAP_CalculateReadCommandPacketLength(
456 unsigned long targetAddressLength,
457 unsigned long replyAddressLength,
458 char alignment
459 );
460
461 char
462 RMAPPACKETLIBRARY_CC
463 RMAP_FillReadCommandPacket(
464 U8 *pTargetAddress,
465 unsigned long targetAddressLength,
466 U8 *pReplyAddress,
467 unsigned long replyAddressLength,
468 char incrementAddress,
469 U8 key,
470 U16 transactionIdentifier,
471 U32 readAddress,
472 U8 extendedReadAddress,
473 U32 dataLength,
474 unsigned long *pRawPacketLength,
475 RMAP_PACKET *pPacketStruct,
476 char alignment,
477 U8 *pRawPacket,
478 unsigned long rawPacketLength
479 );
480
481 void *
482 RMAPPACKETLIBRARY_CC
483 RMAP_BuildReadCommandPacket(
484 U8 *pTargetAddress,
485 unsigned long targetAddressLength,
486 U8 *pReplyAddress,
487 unsigned long replyAddressLength,
488 char incrementAddress,
489 U8 key,
490 U16 transactionIdentifier,
491 U32 readAddress,
492 U8 extendedReadAddress,
493 U32 dataLength,
494 unsigned long *pRawPacketLength,
495 RMAP_PACKET *pPacketStruct,
496 char alignment
497 );
498
499 void *
500 RMAPPACKETLIBRARY_CC
501 RMAP_BuildReadRegisterPacket(
502 U8 *pTargetAddress,
503 unsigned long targetAddressLength,
504 U8 *pReplyAddress,
505 unsigned long replyAddressLength,
506 char incrementAddress,
507 U8 key,
508 U16 transactionIdentifier,
509 U32 readAddress,
510 U8 extendedReadAddress,
511 unsigned long *pRawPacketLength,
512 RMAP_PACKET *pPacketStruct,
513 char alignment
514 );
515
516 unsigned long
517 RMAPPACKETLIBRARY_CC
518 RMAP_CalculateReadReplyPacketLength(
519 unsigned long initiatorAddressLength,
520 U32 dataLength,
521 char alignment
522 );
523
524 char
525 RMAPPACKETLIBRARY_CC
526 RMAP_FillReadReplyPacket(
527 U8 *pInitiatorAddress,
528 unsigned long initiatorAddressLength,
529 U8 targetAddress,
530 char incrementAddress,
531 RMAP_STATUS status,
532 U16 transactionIdentifier,
533 U8 *pData,
534 U32 dataLength,
535 unsigned long *pRawPacketLength,
536 RMAP_PACKET *pPacketStruct,
537 char alignment,
538 U8 *pRawPacket,
539 unsigned long rawPacketLength
540 );
541
542 void *
543 RMAPPACKETLIBRARY_CC
544 RMAP_BuildReadReplyPacket(
545 U8 *pInitiatorAddress,
546 unsigned long initiatorAddressLength,
547 U8 targetAddress,
548 char incrementAddress,
549 RMAP_STATUS status,
550 U16 transactionIdentifier,
551 U8 *pData,
552 U32 dataLength,
553 unsigned long *pRawPacketLength,
554 RMAP_PACKET *pPacketStruct,
555 char alignment
556 );
557
558 unsigned long
559 RMAPPACKETLIBRARY_CC
560 RMAP_CalculateReadModifyWriteCommandPacketLength(
561 unsigned long targetAddressLength,
562 unsigned long replyAddressLength,
563 U32 dataAndMaskLength,
564 char alignment
565 );
566
567 char
568 RMAPPACKETLIBRARY_CC
569 RMAP_FillReadModifyWriteCommandPacket(
570 U8 *pTargetAddress,
571 unsigned long targetAddressLength,
572 U8 *pReplyAddress,
573 unsigned long replyAddressLength,
574 U8 key,
575 U16 transactionIdentifier,
576 U32 readModifyWriteAddress,
577 U8 extendedReadModifyWriteAddress,
578 U8 dataAndMaskLength,
579 U8 *pData,
580 U8 *pMask,
581 unsigned long *pRawPacketLength,
582 RMAP_PACKET *pPacketStruct,
583 char alignment,
584 U8 *pRawPacket,
585 unsigned long rawPacketLength
586 );
587
588 void *
589 RMAPPACKETLIBRARY_CC
590 RMAP_BuildReadModifyWriteCommandPacket(
591 U8 *pTargetAddress,
592 unsigned long targetAddressLength,
593 U8 *pReplyAddress,
594 unsigned long replyAddressLength,
595 U8 key,
596 U16 transactionIdentifier,
597 U32 readModifyWriteAddress,
598 U8 extendedReadModifyWriteAddress,
599 U8 dataAndMaskLength,
600 U8 *pData,
601 U8 *mask,
602 unsigned long *pRawPacketLength,
603 RMAP_PACKET *pPacketStruct,
604 char alignment
605 );
606
607 void *
608 RMAPPACKETLIBRARY_CC
609 RMAP_BuildReadModifyWriteRegisterPacket(
610 U8 *pTargetAddress,
611 unsigned long targetAddressLength,
612 U8 *pReplyAddress,
613 unsigned long replyAddressLength,
614 U8 key,
615 U16 transactionIdentifier,
616 U32 readModifyWriteAddress,
617 U8 extendedReadModifyWriteAddress,
618 U32 registerValue,
619 U32 mask,
620 unsigned long *pRawPacketLength,
621 RMAP_PACKET *pPacketStruct,
622 char alignment
623 );
624
625 unsigned long
626 RMAPPACKETLIBRARY_CC
627 RMAP_CalculateReadModifyWriteReplyPacketLength(
628 unsigned long initiatorAddressLength,
629 U32 dataLength,
630 char alignment
631 );
632
633 char
634 RMAPPACKETLIBRARY_CC
635 RMAP_FillReadModifyWriteReplyPacket(
636 U8 *pInitiatorAddress,
637 unsigned long initiatorAddressLength,
638 U8 targetAddress,
639 RMAP_STATUS status,
640 U16 transactionIdentifier,
641 unsigned long dataLength,
642 U8 *pData,
643 unsigned long *pRawPacketLength,
644 RMAP_PACKET *pPacketStruct,
645 char alignment,
646 U8 *pRawPacket,
647 unsigned long rawPacketLength
648 );
649
650 void *
651 RMAPPACKETLIBRARY_CC
652 RMAP_BuildReadModifyWriteReplyPacket(
653 U8 *pInitiatorAddress,
654 unsigned long initiatorAddressLength,
655 U8 targetAddress,
656 RMAP_STATUS status,
657 U16 transactionIdentifier,
658 unsigned long dataLength,
659 U8 *pData,
660 unsigned long *pRawPacketLength,
661 RMAP_PACKET *pPacketStruct,
662 char alignment
663 );
664
665 void
666 RMAPPACKETLIBRARY_CC
667 RMAP_FreeBuffer(
668 void *pBuffer
669 );
670
671
672 /* Macros for accessing the version */
673
674 #define RMAP_GET_VERSION_MAJOR(versionInfo) (((version) & 0xff000000) >> 24)
675 #define RMAP_GET_VERSION_MINOR(versionInfo) (((version) & 0x00ff0000) >> 16)
676 #define RMAP_GET_VERSION_EDIT(versionInfo) (((version) & 0x0000ffc0) >> 6)
677 #define RMAP_GET_VERSION_PATCH(versionInfo) ((version) & 0x0000003f)
678
679
680
681 #ifdef __cplusplus
682 }
683 #endif
684
685
686
687 #endif /* RMAP_PACKET_LIBRARY_H */
688
689
690
@@ -0,0 +1,205
1 /******************************************************************************/
2 /* */
3 /* spacewire_usb.h */
4 /* */
5 /* Header file for all constants which may be used with the STAR-Dundee */
6 /* SpaceWire USB driver. */
7 /* */
8 /* Version 2.61, September 17th 2012 */
9 /* */
10 /* Version 2.61, 17/09/12 */
11 /* ====================== */
12 /* Added support for STAR Fire and WBS II. */
13 /* */
14 /* Version 2.60, 04/01/12 */
15 /* ====================== */
16 /* Added support for EGSE and SPLT. */
17 /* */
18 /* Version 2.59, 15/08/11 */
19 /* ====================== */
20 /* Added support for RTC. */
21 /* */
22 /* Version 2.58, 12/10/10 */
23 /* ===================== */
24 /* Added support for Link Analyser Mk2. */
25 /* */
26 /* Version 2.51 */
27 /* ============ */
28 /* Added use of star_dundee_types.h. */
29 /* */
30 /* Version 2.5 */
31 /* =========== */
32 /* Initial version, following change to new architecture. */
33 /* */
34 /* Copyright (2012), STAR-Dundee Ltd., */
35 /* STAR House, */
36 /* 166 Nethergate, */
37 /* Dundee, DD1 4EE, */
38 /* Scotland, UK. */
39 /* e-mail: support@star-dundee.com */
40 /* */
41 /******************************************************************************/
42
43
44
45 #ifndef SPACEWIRE_USB_H
46 #define SPACEWIRE_USB_H
47
48
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54
55 /* The types used by the API */
56 #include "star_dundee_types.h"
57
58
59 /* End of packet marker types */
60 #define SPACEWIRE_USB_EOP_CHAR ((U8)0x80)
61 #define SPACEWIRE_USB_EEP_CHAR ((U8)0x40)
62
63 /* The protocol byte used to identify LODI packets */
64 #define SPACEWIRE_USB_LODI_PROTOCOL (0xd1)
65
66
67
68 /* Possible results of read and send operations */
69 typedef enum
70 {
71 TRANSFER_NOT_STARTED = 0,
72 TRANSFER_STARTED = 1,
73 TRANSFER_SUCCESS = 2,
74 TRANSFER_ERROR_DISCONNECT = 3,
75 TRANSFER_ERROR_PARITY = 4,
76 TRANSFER_ERROR_UNKNOWN = 5,
77 TRANSFER_ERROR_TIMEOUT = 6,
78 TRANSFER_ERROR_LINK_NOT_STARTED = 7,
79 TRANSFER_ERROR_USER_BUFFER_LOCK_FAILED = 8,
80 TRANSFER_ERROR_LINK_ALREADY_IN_USE = 9,
81 TRANSFER_ERROR_RECEIVE_BUFFER_FULL = 0xa,
82 TRANSFER_ERROR_OUT_OF_MEMORY = 0xb,
83 TRANSFER_ERROR_NOT_FOUND = 0xc,
84 TRANSFER_ERROR_USB_ERROR = 0xd,
85 TRANSFER_ERROR_NOT_REGISTERED_TO_RECEIVE = 0xe
86 } USB_SPACEWIRE_STATUS, *PUSB_SPACEWIRE_STATUS;
87
88
89
90 /* Possible traffic types */
91 typedef enum
92 {
93 SPACEWIRE_TRAFFIC_UNKNOWN = -1,
94 SPACEWIRE_TRAFFIC_PACKET = 0,
95 SPACEWIRE_TRAFFIC_TIMECODE = 1,
96 SPACEWIRE_TRAFFIC_CONTROL = 2
97 } SPACEWIRE_TRAFFIC_TYPE, *PSPACEWIRE_TRAFFIC_TYPE;
98
99
100
101 /* The different end of packet marker types */
102 typedef enum
103 {
104 SPACEWIRE_USB_NO_EOP = 0,
105 SPACEWIRE_USB_EOP = SPACEWIRE_USB_EOP_CHAR,
106 SPACEWIRE_USB_EEP = SPACEWIRE_USB_EEP_CHAR
107 } USB_SPACEWIRE_EOP_TYPE, *PUSB_SPACEWIRE_EOP_TYPE;
108
109
110
111 /* Possible device types */
112 typedef enum
113 {
114 SPACEWIRE_DEVICE_UNKNOWN = -1,
115 SPACEWIRE_ROUTER_USB = 0,
116 SPACEWIRE_BRICK = 1,
117 SPACEWIRE_LINK_ANALYSER = 2,
118 SPACEWIRE_CONFORMANCE_TESTER = 3,
119 SPACEWIRE_TUNNEL_BRICK = 4,
120 SPACEWIRE_LINK_ANALYSER_MK2 = 5,
121 SPACEWIRE_RTC = 6,
122 SPACEWIRE_EGSE = 7,
123 SPACEWIRE_PHYSICAL_LAYER_TESTER = 8,
124 STAR_FIRE = 9,
125 WBS_II = 10
126 } SPACEWIRE_DEVICE_TYPE, *PSPACEWIRE_DEVICE_TYPE;
127
128
129
130
131 /* Structure used to store packet lengths and EOPs for a read request */
132 typedef struct
133 {
134 unsigned long len;
135 USB_SPACEWIRE_EOP_TYPE eop;
136 SPACEWIRE_TRAFFIC_TYPE type;
137 } USB_SPACEWIRE_PACKET_PROPERTIES, *PUSB_SPACEWIRE_PACKET_PROPERTIES;
138
139
140
141 /* The type of all send and receive identifiers */
142 typedef void * USB_SPACEWIRE_ID;
143
144
145
146 /* Structure used to represent the firmware version of a device */
147 typedef struct
148 {
149 U8 major;
150 U8 minor;
151 U16 edit;
152 U8 patch;
153 } SPACEWIRE_FIRMWARE_VERSION;
154
155
156 /* The product ID used by each STAR-Dundee SpaceWire device */
157
158 /** The product ID used by a device with no EEPROM */
159 #define SPACEWIRE_PRODUCT_ID_NO_EEPROM (0x8613)
160 /** The product ID used by an old device in the power check state */
161 #define SPACEWIRE_PRODUCT_ID_POWER_CHECK (0x461f)
162 /** The product ID used by an old device with no ID set */
163 #define SPACEWIRE_PRODUCT_ID_NO_ID (0x1002)
164 /** The product ID used by the SpaceWire Router-USB */
165 #define SPACEWIRE_PRODUCT_ID_ROUTER_USB (0x1011)
166 /** The product ID used by the SpaceWire-USB Brick */
167 #define SPACEWIRE_PRODUCT_ID_BRICK (0x1012)
168 /** The product ID used by the SpaceWire Link Analyser */
169 #define SPACEWIRE_PRODUCT_ID_LINK_ANALYSER (0x1013)
170 /** The product ID used by the SpaceWire Conformance Tester */
171 #define SPACEWIRE_PRODUCT_ID_CONFORMANCE_TESTER (0x1014)
172 /** The product ID used by the SpaceWire-IP Tunnel */
173 #define SPACEWIRE_PRODUCT_ID_TUNNEL_BRICK (0x1015)
174 /** The product ID used by the SpaceWire Router-USB with multiple channels */
175 #define SPACEWIRE_PRODUCT_ID_ROUTER_MULTIPLE_CHANNELS (0x1016)
176 /** The product ID used by the SpaceWire Router-USB II Rev 4 */
177 #define SPACEWIRE_PRODUCT_ID_ROUTER_USB_II_REV4 (0x1017)
178 /** The product ID used by the SpaceWire Link Analyser Mk2 */
179 #define SPACEWIRE_PRODUCT_ID_LINK_ANALYSER_MK2 (0x1018)
180 /** The product ID used by the SpaceWire RTC */
181 #define SPACEWIRE_PRODUCT_ID_RTC (0x1019)
182 /** The product ID used by the SpaceWire EGSE */
183 #define SPACEWIRE_PRODUCT_ID_EGSE (0x101a)
184 /** The product ID used by the SpaceWire SPLT */
185 #define SPACEWIRE_PRODUCT_ID_SPLT (0x101b)
186 /** The product ID used by the STAR Fire device */
187 #define SPACEWIRE_PRODUCT_ID_STAR_FIRE (0x101c)
188 /** The product ID used by the WBS II device */
189 #define SPACEWIRE_PRODUCT_ID_WBS_II (0x101d)
190 /** A product ID to be used by a future device */
191 #define SPACEWIRE_PRODUCT_ID_FUTURE_101E (0x101e)
192 /** A product ID to be used by a future device */
193 #define SPACEWIRE_PRODUCT_ID_FUTURE_101F (0x101f)
194
195
196 #ifdef __cplusplus
197 }
198 #endif
199
200
201
202 #endif /* SPACEWIRE_USB_H */
203
204
205
This diff has been collapsed as it changes many lines, (656 lines changed) Show them Hide them
@@ -0,0 +1,656
1 /******************************************************************************/
2 /* */
3 /* spw_config_library.h */
4 /* */
5 /* Declaration of the functions, and definition of macros provided by the */
6 /* SpaceWire Router Configuration Library for the SpaceWire USB and */
7 /* SpaceWire PCI drivers. */
8 /* */
9 /* Version 2.60 - January 5th 2012 */
10 /* */
11 /* Version 2.60 - 05/04/12 */
12 /* ======================= */
13 /* Updated declarations to replace CFGSpaceWire_EnableReadOnAllPorts */
14 /* with CFGSpaceWire_EnableReceiveOnAllPorts and */
15 /* CFGSpaceWire_IsReadingOnAllPortsEnabled with */
16 /* CFGSpaceWire_IsReceiveOnAllPortsEnabled. */
17 /* */
18 /* Version 2.54 - 10/12/10 */
19 /* ======================= */
20 /* Replaced CFGSpaceWire_RTOutputPorts with */
21 /* CFGSpaceWire_RTGetOutputPorts, which doesn't unnecessarily shift the */
22 /* output port bits and is consistent with */
23 /* CFGSpaceWire_RTBuildRoutingTableEntry. */
24 /* */
25 /* Version 2.53 - 26/02/09 */
26 /* ======================= */
27 /* Updated the calling convention used in the function declarations to */
28 /* __stdcall on Windows. */
29 /* */
30 /* Version 2.52, 04/11/08 */
31 /* ====================== */
32 /* Added support for precision transmit rate on new Router-USB. */
33 /* Added chip ID values. */
34 /* */
35 /* Version 2.51, 21/10/08 */
36 /* ====================== */
37 /* Updated to support Windows. */
38 /* */
39 /* Version 2.50, 08/11/06 */
40 /* ====================== */
41 /* Initial version, following change to new structure. */
42 /* */
43 /* Copyright (c) 2012, Stuart Mills, */
44 /* STAR-Dundee, */
45 /* c/o School of Computing, */
46 /* University of Dundee, */
47 /* Dundee, DD1 4HN, */
48 /* Scotland, UK. */
49 /* http://www.star-dundee.com */
50 /* e-mail: support@star-dundee.com */
51 /* */
52 /******************************************************************************/
53
54
55
56 #ifndef SPACEWIRE_ROUTER_LIBRARY
57 #define SPACEWIRE_ROUTER_LIBRARY
58
59
60 #include "star_dundee_types.h"
61
62
63 #ifdef __cplusplus
64 extern "C" {
65 #endif
66
67
68
69 #if defined(_WIN32) || defined(_WIN64)
70
71
72 /* Windows specifc functions and macros */
73
74 #ifdef ROUTERCONFIGURATIONLIBRARY_EXPORTS
75 #define ROUTER_CONFIG_LIBRARY __declspec(dllexport)
76 #else
77 #define ROUTER_CONFIG_LIBRARY __declspec(dllimport)
78 #endif
79
80 /* The calling convention to be used */
81 #ifdef _WIN64
82 #define ROUTER_CONFIG_CC
83 #else
84 #define ROUTER_CONFIG_CC __stdcall
85 #endif /* WIN64 */
86
87
88 #include "windows.h"
89
90
91 #else /* _WIN32 */
92
93
94 /* Linux specific functions and macros */
95
96 #define ROUTER_CONFIG_LIBRARY
97 #define ROUTER_CONFIG_CC
98
99
100 #endif /* _WIN32 */
101
102
103
104 /* Possible bit values */
105 #define BIT0 (0x00000001)
106 #define BIT1 (0x00000002)
107 #define BIT2 (0x00000004)
108 #define BIT3 (0x00000008)
109 #define BIT4 (0x00000010)
110 #define BIT5 (0x00000020)
111 #define BIT6 (0x00000040)
112 #define BIT7 (0x00000080)
113 #define BIT8 (0x00000100)
114 #define BIT9 (0x00000200)
115 #define BIT10 (0x00000400)
116 #define BIT11 (0x00000800)
117 #define BIT12 (0x00001000)
118 #define BIT13 (0x00002000)
119 #define BIT14 (0x00004000)
120 #define BIT15 (0x00008000)
121 #define BIT16 (0x00010000)
122 #define BIT17 (0x00020000)
123 #define BIT18 (0x00040000)
124 #define BIT19 (0x00080000)
125 #define BIT20 (0x00100000)
126 #define BIT21 (0x00200000)
127 #define BIT22 (0x00400000)
128 #define BIT23 (0x00800000)
129 #define BIT24 (0x01000000)
130 #define BIT25 (0x02000000)
131 #define BIT26 (0x04000000)
132 #define BIT27 (0x08000000)
133 #define BIT28 (0x10000000)
134 #define BIT29 (0x20000000)
135 #define BIT30 (0x40000000)
136 #define BIT31 (0x80000000)
137
138
139
140 /* Exported enums and structs */
141
142
143
144 /* Read write address errors */
145 typedef enum
146 {
147 CFG_TRANSFER_SUCCESS = 0x00,
148 CFG_TRANSMIT_PACKET_FAILURE = 0x01,
149 CFG_REPLY_PACKET_FAILURE = 0x02,
150 CFG_REPLY_PACKET_TOO_BIG = 0x03,
151 CFG_REPLY_PACKET_TOO_SMALL = 0x04,
152 CFG_REPLY_PACKET_NAK = 0x05,
153 CFG_REPLY_PACKET_CHECKSUM_ERROR = 0x06,
154 } CFG_SPACEWIRE_STATUS;
155
156
157
158 /* Length of port timeout */
159 typedef enum
160 {
161 CFG_PORT_TIMEOUT_100US = 0x0,
162 CFG_PORT_TIMEOUT_1MS = 0x1,
163 CFG_PORT_TIMEOUT_10MS = 0x2,
164 CFG_PORT_TIMEOUT_100MS = 0x3,
165 CFG_PORT_TIMEOUT_1S = 0x4,
166 } CFG_SPACEWIRE_PORT_TIMEOUT;
167
168
169
170 /* SpaceWire Port errors */
171 #define CFG_SPACEWIRE_NO_ERRORS (0)
172 #define CFG_SPACEWIRE_ERROR_ACTIVE (BIT0)
173 #define CFG_SPACEWIRE_PACKET_ADDRESS_ERROR (BIT1)
174 #define CFG_SPACEWIRE_PORT_TIMEOUT_ERROR (BIT2)
175 #define CFG_SPACEWIRE_DISCONNECT_ERROR (BIT3)
176 #define CFG_SPACEWIRE_PARITY_ERROR (BIT4)
177 #define CFG_SPACEWIRE_ESCAPE_ERROR (BIT5)
178 #define CFG_SPACEWIRE_CREDIT_ERROR (BIT6)
179 #define CFG_SPACEWIRE_CHARACTER_SEQUENCE_ERROR (BIT7)
180 #define CFG_SPACEWIRE_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \
181 BIT4 | BIT5 | BIT6 | BIT7)
182
183 /* Config Port errors */
184 #define CFG_CONFIG_NO_ERRORS (0)
185 #define CFG_CONFIG_ERROR_ACTIVE (BIT0)
186
187 /* Config Port errors (non-RMAP) */
188 #define CFG_CONFIG_PACKET_ADDRESS_ERROR (BIT1)
189 #define CFG_CONFIG_PORT_TIMEOUT_ERROR (BIT2)
190 #define CFG_CONFIG_CHECKSUM_ERROR (BIT3)
191 #define CFG_CONFIG_TOO_SHORT_ERROR (BIT4)
192 #define CFG_CONFIG_TOO_LONG_ERROR (BIT5)
193 #define CFG_CONFIG_PACKET_EEP_ERROR (BIT6)
194 #define CFG_CONFIG_PROTOCOL_BYTE_ERROR (BIT7)
195 #define CFG_CONFIG_INVALID_REGISTER_ERROR (BIT8)
196 #define CFG_CONFIG_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \
197 BIT4 | BIT5 | BIT6 | BIT7 | \
198 BIT8)
199
200 /* Config Port errors (RMAP) */
201 #define CFG_CONFIG_RMAP_PORT_TIMEOUT_ERROR (BIT1)
202 #define CFG_CONFIG_RMAP_INVALID_HEADER_CRC (BIT2)
203 #define CFG_CONFIG_RMAP_INVALID_DATA_CRC (BIT3)
204 #define CFG_CONFIG_RMAP_INVALID_DESTINATION_KEY (BIT4)
205 #define CFG_CONFIG_RMAP_COMMAND_NOT_IMPLEMENTED (BIT5)
206 #define CFG_CONFIG_RMAP_INVALID_DATA_LENGTH (BIT6)
207 #define CFG_CONFIG_RMAP_INVALID_RMW_DATA_LENGTH (BIT7)
208 #define CFG_CONFIG_RMAP_INVALID_DESTINATION_ADDRESS (BIT8)
209 #define CFG_CONFIG_RMAP_EARLY_EOP (BIT9)
210 #define CFG_CONFIG_RMAP_LATE_EOP (BIT10)
211 #define CFG_CONFIG_RMAP_EARLY_EEP (BIT11)
212 #define CFG_CONFIG_RMAP_LATE_EEP (BIT12)
213 #define CFG_CONFIG_RMAP_VERIFY_BUFFER_OVERRUN_ERROR (BIT13)
214 #define CFG_CONFIG_RMAP_INVALID_REGISTER_ADDRESS (BIT14)
215 #define CFG_CONFIG_RMAP_UNSUPPORTED_PROTOCOL_ERROR (BIT15)
216 #define CFG_CONFIG_RMAP_SOURCE_LOGICAL_ADDRESS_ERROR (BIT16)
217 #define CFG_CONFIG_RMAP_SOURCE_PATH_ADDRESS_ERROR (BIT17)
218 #define CFG_CONFIG_RMAP_CARGO_TOO_LARGE (BIT18)
219 #define CFG_CONFIG_RMAP_UNUSED_COMMAND_OR_PACKET_TYPE (BIT19)
220 #define CFG_CONFIG_RMAP_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \
221 BIT5 | BIT6 | BIT7 | BIT8 | BIT9 | \
222 BIT10 | BIT11 | BIT12 | BIT13 | \
223 BIT14 | BIT15 | BIT16 | BIT17 | \
224 BIT18 | BIT19)
225
226 /* External Port errors */
227 #define CFG_EXTERNAL_NO_ERRORS (0)
228 #define CFG_EXTERNAL_ERROR_ACTIVE (BIT0)
229 #define CFG_EXTERNAL_PACKET_ADDRESS_ERROR (BIT1)
230 #define CFG_EXTERNAL_PORT_TIMEOUT_ERROR (BIT2)
231 #define CFG_EXTERNAL_INPUT_BUFFER_EMPTY_ERROR (BIT3)
232 #define CFG_EXTERNAL_INPUT_BUFFER_FULL_ERROR (BIT4)
233 #define CFG_EXTERNAL_OUTPUT_BUFFER_EMPTY_ERROR (BIT5)
234 #define CFG_EXTERNAL_OUTPUT_BUFFER_FULL_ERROR (BIT6)
235 #define CFG_EXTERNAL_ERROR_BITS (BIT0 | BIT1 | BIT2 | BIT3 | \
236 BIT4 | BIT5 | BIT6)
237
238 /* SpaceWire Port interface state */
239 #define CFG_SPACEWIRE_ERROR_RESET (0)
240 #define CFG_SPACEWIRE_ERROR_WAIT (BIT0)
241 #define CFG_SPACEWIRE_READY (BIT1)
242 #define CFG_SPACEWIRE_STARTED (BIT1 | BIT0)
243 #define CFG_SPACEWIRE_CONNECTING (BIT2)
244 #define CFG_SPACEWIRE_RUN (BIT2 | BIT0)
245
246 /* Port type */
247 #define CFG_CONFIGURATION_PORT (0)
248 #define CFG_SPACEWIRE_SERIAL_PORT (BIT0)
249 #define CFG_SPACEWIRE_EXTERNAL_PORT (BIT1)
250
251 /* SpaceWire Port control bits */
252 #define CFG_SPACEWIRE_INTERFACE_STATE_START (8)
253 #define CFG_SPACEWIRE_INTERFACE_STATE (BIT8 | BIT9 | BIT10)
254 #define CFG_SPACEWIRE_RUNNING (BIT11)
255 #define CFG_SPACEWIRE_AUTOSTART (BIT12)
256 #define CFG_SPACEWIRE_START (BIT13)
257 #define CFG_SPACEWIRE_DISABLE (BIT14)
258 #define CFG_SPACEWIRE_TRISTATE (BIT15)
259 #define CFG_SPACEWIRE_RATE (BIT16 | BIT17 | BIT18 | \
260 BIT19 | BIT20 | BIT21 | BIT22)
261 #define CFG_SPACEWIRE_RATE_START (16)
262
263 /* Bits in the GAR Table */
264 #define CFG_GAR_OUTPUT_PORTS_START (1)
265 #define CFG_GAR_OUTPUT_PORTS (BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | \
266 BIT6 | BIT7 | BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | BIT13 | BIT14 | \
267 BIT15 | BIT16 | BIT17 | BIT18 | BIT19 | BIT20 | BIT21 | BIT22 | \
268 BIT23 | BIT24 | BIT25 | BIT26 | BIT27 | BIT28)
269 #define CFG_GAR_DEL_HEAD (BIT29)
270 #define CFG_GAR_PRIORITY (BIT30)
271 #define CFG_GAR_INVALID_ADDR (BIT31)
272
273 /* Bits in the router control register */
274 #define CFG_RC_TIMEOUT_ENABLE_START (0)
275 #define CFG_RC_TIMEOUT_ENABLE (BIT0)
276 #define CFG_RC_TIMEOUT_VALUE_START (1)
277 #define CFG_RC_TIMEOUT_VALUE (BIT1 | BIT2 | BIT3)
278 #define CFG_RC_DISABLE_ON_SILENCE (BIT4)
279 #define CFG_RC_DISABLE_ON_SILENCE_START (4)
280 #define CFG_RC_START_ON_REQUEST (BIT5)
281 #define CFG_RC_START_ON_REQUEST_START (5)
282 #define CFG_RC_SELF_ADDRESSING (BIT6)
283 #define CFG_RC_SELF_ADDRESSING_START (6)
284 #define CFG_RC_INTERFACE (BIT7)
285 #define CFG_RC_INTERFACE_START (7)
286 #define CFG_RC_INTERFACE_IDENT (BIT8)
287 #define CFG_RC_INTERFACE_IDENT_START (8)
288
289 /* The bits shared by all ports */
290 #define CFG_PORT_CONNECTION (BIT24 | BIT25 | BIT26 | BIT27 | BIT28)
291 #define CFG_PORT_CONNECTION_START (24)
292 #define CFG_PORT_TYPE (BIT29 | BIT30 | BIT31)
293 #define CFG_PORT_TYPE_START (29)
294
295 /* Network discovery register values */
296 #define CFG_NETD_TYPE (BIT0 | BIT1 | BIT2 | BIT3)
297 #define CFG_NETD_TYPE_START (0)
298 #define CFG_NETD_RETURN_PORT (BIT4 | BIT5 | BIT6 | BIT7)
299 #define CFG_NETD_RETURN_PORT_START (4)
300 #define CFG_NETD_RUNNING_PORTS (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \
301 BIT13 | BIT14 | BIT15 | BIT16 | BIT17 | BIT18 | BIT19 | BIT20 | \
302 BIT21 | BIT22 | BIT23 | BIT24 | BIT25 | BIT26 | BIT27 | BIT28 | \
303 BIT29 | BIT30 | BIT31)
304 #define CFG_NETD_RUNNING_PORTS_START (8)
305
306 /* Values in the ID register */
307 #define CFG_ID_VERSION (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \
308 BIT5 | BIT6 | BIT7)
309 #define CFG_ID_VERSION_START (0)
310 #define CFG_ID_CHIP (BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \
311 BIT13 | BIT14 | BIT15)
312 #define CFG_ID_CHIP_START (8)
313 #define CFG_ID_MANUFACTURER (BIT16 | BIT17 | BIT18 | BIT19 | \
314 BIT20 | BIT21 | BIT22 | BIT23)
315 #define CFG_ID_MANUFACTURER_START (16)
316
317 /* Values in the Time-Code register */
318 #define CFG_TC_VALUE (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | \
319 BIT5)
320 #define CFG_TC_VALUE_START (0)
321 #define CFG_TC_FLAGS (BIT6 | BIT7)
322 #define CFG_TC_FLAGS_START (6)
323
324 /* Values for the Router Base Clock Select */
325 #define CFG_RTR_CLK_100_MBITS (0)
326 #define CFG_RTR_CLK_200_MBITS (BIT0)
327
328 /* Values for the Brick Base Clock */
329 #define CFG_BRK_CLK_100_MHZ (0)
330 #define CFG_BRK_CLK_120_MHZ (BIT0)
331 #define CFG_BRK_CLK_140_MHZ (BIT1)
332 #define CFG_BRK_CLK_160_MHZ (BIT0 | BIT1)
333 #define CFG_BRK_CLK_180_MHZ (BIT2)
334 #define CFG_BRK_CLK_200_MHZ (BIT2 | BIT0)
335
336 /* Values for the Brick Base Divider */
337 #define CFG_BRK_DVDR_1 (0)
338 #define CFG_BRK_DVDR_2 (BIT0)
339 #define CFG_BRK_DVDR_4 (BIT1)
340
341 /* Values in the Tx register */
342 #define CFG_TX_BRICK_2MBITS (BIT27)
343 #define CFG_TX_BRICK_2MBITS_START (27)
344
345 /* Values in the Precision Transmit Rate register */
346 #define CFG_PT_ENABLE (BIT16)
347 #define CFG_PT_ENABLE_START (16)
348 #define CFG_PT_READY (BIT17)
349 #define CFG_PT_READY_START (17)
350 #define CFG_PT_IN_USE (BIT20)
351 #define CFG_PT_IN_USE_START (20)
352 #define CFG_PT_RATE_BITS (BIT0 | BIT1 | BIT2 | BIT3 | BIT4 | BIT5 | BIT6 | \
353 BIT7 | BIT8 | BIT9 | BIT10 | BIT11 | BIT12 | \
354 BIT13 | BIT14 | BIT15 )
355 #define CFG_PT_DIVIDER_CONSTANT ((double)(pow((double)2, (double)48) / (double)600))
356
357 /* Chip ID values */
358 #define CFG_CID_ROUTER_ASIC (0) /* SpaceWire Router ASIC and IP */
359 #define CFG_CID_ROUTER_USB (1) /* Original SpaceWire Router-USB */
360 #define CFG_CID_USB_BRICK (2) /* SpaceWire-USB Brick */
361 #define CFG_CID_FEIC (4) /* The FEIC chip */
362 #define CFG_CID_ROUTER_USB_2 (5) /* New SpaceWire Router-USB */
363 #define CFG_CID_PCI_MK2 (7) /* SpaceWire PCI Mk2 */
364 #define CFG_CID_PCI_EXPRESS (8) /* SpaceWire PCI Express */
365 #define CFG_CID_RTC (9) /* RTC Development Unit */
366 #define CFG_CID_CONFORMANCE_TESTER (10) /* SpaceWire Conformance Tester */
367 #define CFG_CID_EGSE (11) /* SpaceWire EGSE */
368 #define CFG_CID_STAR_FIRE (12) /* STAR Fire */
369 #define CFG_CID_WBS_MK2 (14) /* WBS Mk2 */
370
371
372 /* Addresses which can be read from and written to */
373 #define CFG_EXTENDED_ADDRESS (0x100)
374 #define CFG_ADDR_NET_DISC (CFG_EXTENDED_ADDRESS + 0)
375 #define CFG_ADDR_NET_DISC_IDENT (CFG_EXTENDED_ADDRESS + 1)
376 #define CFG_ADDR_ROUTER_CONTROL (CFG_EXTENDED_ADDRESS + 2)
377 #define CFG_ADDR_ERRORS (CFG_EXTENDED_ADDRESS + 3)
378 #define CFG_ADDR_TIMECODE (CFG_EXTENDED_ADDRESS + 4)
379 #define CFG_ADDR_IDS (CFG_EXTENDED_ADDRESS + 5)
380 #define CFG_ADDR_GP (CFG_EXTENDED_ADDRESS + 6)
381 #define CFG_ADDR_TICK (CFG_EXTENDED_ADDRESS + 7)
382 #define CFG_ADDR_TX_RATE (CFG_EXTENDED_ADDRESS + 8)
383 #define CFG_ADDR_PRECISION_1 (CFG_EXTENDED_ADDRESS + 0xC)
384 #define CFG_ADDR_PRECISION_2 (CFG_EXTENDED_ADDRESS + 0xD)
385
386
387 /* Exported functions */
388
389 /* Version information */
390 ROUTER_CONFIG_LIBRARY double ROUTER_CONFIG_CC CFGSpaceWire_GetAPIVersion(void);
391
392 /* Configuration address stack manipulation functions */
393 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_StackClear(void);
394 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_AddrStackPush(
395 U8 dwAddress);
396 ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_AddrStackPop(void);
397 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RetAddrStackPush(
398 U8 dwAddress);
399 ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_RetAddrStackPop(void);
400 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_SetProtocolByte(
401 U8 ProtocolByte);
402 ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_GetProtocolByte(void);
403
404 /* RMAP functions */
405 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_EnableRMAP(
406 char useRMAP);
407 ROUTER_CONFIG_LIBRARY char ROUTER_CONFIG_CC CFGSpaceWire_IsRMAPEnabled();
408 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_SetRMAPDestinationKey(
409 U8 destinationKey);
410 ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_GetRMAPDestinationKey();
411 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_SetRMAPAlignment(
412 U8 alignment);
413 ROUTER_CONFIG_LIBRARY U8 ROUTER_CONFIG_CC CFGSpaceWire_GetRMAPAlignment();
414 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC
415 CFGSpaceWire_EnableReceiveOnAllPorts(char enable);
416 ROUTER_CONFIG_LIBRARY char ROUTER_CONFIG_CC
417 CFGSpaceWire_IsReceiveOnAllPortsEnabled();
418
419 /* Ignoring replies to write commands functions */
420 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_IgnoreWriteReplies(
421 char ignore);
422 ROUTER_CONFIG_LIBRARY char ROUTER_CONFIG_CC
423 CFGSpaceWire_AreWriteRepliesIgnored();
424
425 /* Configuration address read and write functions */
426 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_ReadAddress(
427 star_device_handle hDevice, U32 dwAddress, U32 *dwData);
428 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_WriteAddress(
429 star_device_handle hDevice, U32 dwAddress, U32 dwData);
430
431 /* Router link functions */
432 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_StartLink(
433 star_device_handle hDevice, U32 dwLinkNum);
434 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_StopLink(
435 star_device_handle hDevice, U32 dwLinkNum);
436 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_TriStateLink(
437 star_device_handle hDevice, U32 dwLinkNum, char bEnabled);
438 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetLinkSpeed(
439 star_device_handle hDevice, U32 dwLinkNum, U32 dwSpeed);
440
441 /* Routing table functions */
442 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetRoutingTableEntry(
443 star_device_handle hDevice, U32 nLogicalAddress, U32 *dwRoutingTableEntry);
444 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetRoutingTableEntry(
445 star_device_handle hDevice, U32 nLogicalAddress, U32 dwRoutingTableEntry);
446 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_ClearRoutingTableEntry(
447 star_device_handle hDevice, U32 nLogicalAddress);
448 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTIsEnabled(
449 U32 dwRoutingTableEntry, char *bEnabled);
450 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTIsDelHead(
451 U32 dwRoutingTableEntry, char *bDelHead);
452 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTIsPriority(
453 U32 dwRoutingTableEntry, char *bPriority);
454 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTOutputPorts(
455 U32 dwRoutingTableEntry, U32 *dwOutputPorts);
456 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RTGetOutputPorts(
457 U32 dwRoutingTableEntry, U32 *dwOutputPorts);
458 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC
459 CFGSpaceWire_RTBuildRoutingTableEntry(U32 *dwRoutingTableEntry,
460 U32 dwOutputPorts, char bDelHead, char bPriority);
461
462 /* Link status control functions */
463 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetLinkStatusControl(
464 star_device_handle hDevice, U32 dwLinkNum, U32 *dwStatusControl);
465 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetLinkStatusControl(
466 star_device_handle hDevice, U32 dwLinkNum, U32 dwStatusControl);
467
468 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSErrorStatus(
469 U32 dwStatusControl, U32 *dwErrorStatus);
470 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSConfigErrorStatus(
471 U32 dwStatusControl, U32 *dwErrorStatus);
472 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSExternalErrorStatus(
473 U32 dwStatusControl, U32 *dwErrorStatus);
474 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSLinkState(
475 U32 dwStatusControl, U32 *dwLinkStatus);
476 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsLinkRunning(
477 U32 dwStatusControl, char *isLinkRunning);
478 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsAutoStart(
479 U32 dwStatusControl, char *isAutoStart);
480 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSEnableAutoStart(
481 U32 *dwStatusControl, char bEnabled);
482 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsStart(
483 U32 dwStatusControl, char *isStart);
484 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSEnableStart(
485 U32 *dwStatusControl, char bEnabled);
486 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsDisabled(
487 U32 dwStatusControl, char *isDisabled);
488 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSEnableDisabled(
489 U32 *dwStatusControl, char bEnabled);
490 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSIsTristate(
491 U32 dwStatusControl, char *isTristate);
492 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSEnableTristate(
493 U32 *dwStatusControl, char bEnabled);
494 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSOperatingSpeed(
495 U32 dwStatusControl, U32 *dwOperatingSpeed);
496 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSSetOperatingSpeed(
497 U32 *dwStatusControl, U32 dwOperatingSpeed);
498 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSOutputPortConnection(
499 U32 dwStatusControl, U32 *dwOutputPortConnection);
500 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_LSPortType(
501 U32 dwStatusControl, U32 *dwPortType);
502
503 /* Network discovery information retreival */
504 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
505 CFGSpaceWire_GetNetworkDiscoveryValue(star_device_handle hDevice,
506 U32 *dwNetworkDiscovery);
507 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_NDDeviceType(
508 U32 dwNetDisc, U32 *dwDeviceType);
509 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_NDReturnPort(
510 U32 dwNetDisc, U32 *dwReturnPort);
511 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_NDRunningLinks(
512 U32 dwNetDisc, U32 *dwRunningLinks);
513 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_NDNumberLinks(
514 U32 dwNetDisc, U32 *dwNumberLinks);
515 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetNumberLinks(
516 star_device_handle hDevice, U32 *dwNumLinks);
517
518 /* Router identity register functions */
519 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetNetworkID(
520 star_device_handle hDevice, U32 dwNetworkID);
521 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetNetworkID(
522 star_device_handle hDevice, U32 *dwNetworkID);
523
524 /* Router control register functions */
525 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetPortTimeout(
526 star_device_handle hDevice, char bEnabled,
527 CFG_SPACEWIRE_PORT_TIMEOUT timeout);
528 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetPortTimeout(
529 star_device_handle hDevice, char *bEnabled,
530 CFG_SPACEWIRE_PORT_TIMEOUT *timeout);
531 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_IsPortTimeoutEnabled(
532 star_device_handle hDevice, char *bEnabled);
533 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetAsInterface(
534 star_device_handle hDevice, char bEnabled, char bAddIdentifier);
535 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
536 CFGSpaceWire_GetRouterControlRegister(star_device_handle hDevice,
537 U32 *dwRouterCtrlReg);
538 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
539 CFGSpaceWire_SetRouterControlRegister(star_device_handle hDevice,
540 U32 dwRouterCtrlReg);
541 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetTimeoutEnabled(
542 U32 dwRouterCtrlReg, char *bEnabled);
543 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetTimeoutEnabled(
544 U32 *dwRouterCtrlReg, char bEnabled);
545 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetTimeoutSelection(
546 U32 dwRouterCtrlReg, U32 *dwSelection);
547 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetTimeoutSelection(
548 U32 *dwRouterCtrlReg, U32 dwSelection);
549 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetDisableOnSilence(
550 U32 dwRouterCtrlReg, char *bEnabled);
551 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetDisableOnSilence(
552 U32 *dwRouterCtrlReg, char bEnabled);
553 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetStartOnRequest(
554 U32 dwRouterCtrlReg, char *bEnabled);
555 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetStartOnRequest(
556 U32 *dwRouterCtrlReg, char bEnabled);
557 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetSelfAddressing(
558 U32 dwRouterCtrlReg, char *bEnabled);
559 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetSelfAddressing(
560 U32 *dwRouterCtrlReg, char bEnabled);
561 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCGetInterface(
562 U32 dwRouterCtrlReg, char *bEnabled);
563 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_RCSetInterface(
564 U32 *dwRouterCtrlReg, char bEnabled);
565 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC
566 CFGSpaceWire_RCGetInterfaceIdentifier(U32 dwRouterCtrlReg, char *bEnabled);
567 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC
568 CFGSpaceWire_RCSetInterfaceIdentifier(U32 *dwRouterCtrlReg, char bEnabled);
569
570 /* Error active register functions */
571 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetErrorStatus(
572 star_device_handle hDevice, U32 *dwErrorStatus);
573 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_ClearErrorStatus(
574 star_device_handle hDevice, U32 dwPorts);
575
576 /* Time-Code register functions */
577 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetTimecodeRegister(
578 star_device_handle hDevice, U32 *dwTimecodeReg);
579 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_TCGetValue(
580 U32 dwTimecodeReg, U32 *dwValue);
581 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_TCGetFlags(
582 U32 dwTimecodeReg, U32 *dwValue);
583
584 /* Manufacturer and Chip ID register functions */
585 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetIDRegister(
586 star_device_handle hDevice, U32 *dwIDs);
587 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_IDGetManufacturer(
588 U32 dwIDs, U32 *dwManufacturerID);
589 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_IDGetChipID(U32 dwIDs,
590 U32 *dwChipID);
591 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC CFGSpaceWire_IDGetVersion(U32 dwIDs,
592 U32 *dwVersion);
593
594 /* General purpose register functions */
595 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetGeneralPurposeStatus(
596 star_device_handle hDevice, U32 *dwGeneralPurposeStatus);
597 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetGeneralPurposeStatus(
598 star_device_handle hDevice, U32 dwGeneralPurposeStatus);
599
600 /* Tick enable register functions */
601 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_GetTickEnableStatus(
602 star_device_handle hDevice, U32 *dwTickEnableStatus);
603 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC CFGSpaceWire_SetTickEnableStatus(
604 star_device_handle hDevice, U32 dwTickEnableStatus);
605
606
607 /* Base Transmit Rate functions */
608 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
609 CFGSpaceWire_SetRouterBaseTransmitRate(star_device_handle hDevice,
610 U32 dwBaseClkSel);
611 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
612 CFGSpaceWire_GetRouterBaseTransmitRate(star_device_handle hDevice,
613 U32 *dwBaseClkSel);
614 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
615 CFGSpaceWire_SetBrickBaseTransmitRate(star_device_handle hDevice,
616 U32 dwBaseClk, U32 dwBaseDvdr, U32 dwEnableClk);
617 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
618 CFGSpaceWire_GetBrickBaseTransmitRate(star_device_handle hDevice,
619 U32 *dwBaseClk, U32 *dwBaseDvdr, U32 *dwEnableClk);
620 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
621 CFGSpaceWire_GetPrecisionTransmitRegister(star_device_handle hDevice,
622 U32 *dwPrecisionTransmit);
623 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
624 CFGSpaceWire_SetPrecisionTransmitRegister(star_device_handle hDevice,
625 U32 dwPrecisionTransmit);
626 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC
627 CFGSpaceWire_PTGetPrecisionTransmitEnabled(U32 dwPrecisionTransmit,
628 char *bEnabled);
629 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC
630 CFGSpaceWire_PTSetPrecisionTransmitEnabled(U32 *dwPrecisionTransmit,
631 char bEnabled);
632 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC
633 CFGSpaceWire_PTGetPrecisionTransmitReady(U32 dwPrecisionTransmit,
634 char *bEnabled);
635 ROUTER_CONFIG_LIBRARY void ROUTER_CONFIG_CC
636 CFGSpaceWire_PTGetPrecisionTransmitInUse(U32 dwPrecisionTransmit,
637 char *bEnabled);
638 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
639 CFGSpaceWire_GetPrecisionTransmitRate(star_device_handle hDevice,
640 double *PrecisionTransmitRate);
641 ROUTER_CONFIG_LIBRARY int ROUTER_CONFIG_CC
642 CFGSpaceWire_SetPrecisionTransmitRate(star_device_handle hDevice,
643 double PrecisionTransmitRate);
644
645
646
647 #ifdef __cplusplus
648 }
649 #endif
650
651
652
653 #endif /* SPACEWIRE_ROUTER_LIBRARY */
654
655
656
@@ -0,0 +1,326
1 /******************************************************************************/
2 /* */
3 /* spw_usb_api.h */
4 /* */
5 /* Declaration of the functions provided by the SpaceWire USB API Library */
6 /* for the SpaceWire USB devices. */
7 /* */
8 /* Version 2.61, September 21st 2012 */
9 /* */
10 /* Version 2.61, 21/09/12 */
11 /* ====================== */
12 /* Added support for STAR Fire and WBS II. */
13 /* */
14 /* Version 2.60, 04/01/12 */
15 /* ====================== */
16 /* Added support for EGSE and SPLT. */
17 /* */
18 /* Version 2.59, 15/08/11 */
19 /* ====================== */
20 /* Added support for RTC. */
21 /* */
22 /* Version 2.5, 12/10/10 */
23 /* ===================== */
24 /* Added support for Link Analyser Mk2. */
25 /* */
26 /* Version 1.5, 12/03/10 */
27 /* ===================== */
28 /* Added GetFirmwareVersionExtended and restored GetFirmwareVersion to */
29 /* its original form. */
30 /* */
31 /* Version 1.4, 03/03/10 */
32 /* ===================== */
33 /* Fixed bug waiting on a receive to complete. */
34 /* Added support for multiple send channels. */
35 /* Added functions to get serial number and product ID. */
36 /* */
37 /* Version 1.3, 26/2/09 */
38 /* ==================== */
39 /* Updated the calling convention used in the function declaration to */
40 /* __stdcall on Windows. */
41 /* */
42 /* Version 1.2, 21/1/09 */
43 /* ==================== */
44 /* Updated to compile on both Windows and Linux. */
45 /* */
46 /* Version 1.1, 8/10/06 */
47 /* ==================== */
48 /* Linux release. */
49 /* */
50 /* Version 1.0, 24/4/06 */
51 /* ==================== */
52 /* Initial version. */
53 /* */
54 /* Copyright (2012), STAR-Dundee Ltd., */
55 /* STAR House, */
56 /* 166 Nethergate, */
57 /* Dundee, DD1 4EE, */
58 /* Scotland, UK. */
59 /* e-mail: support@star-dundee.com */
60 /* */
61 /******************************************************************************/
62
63
64
65 #ifndef SPACEWIRE_USB_API_H
66 #define SPACEWIRE_USB_API_H
67
68
69
70
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74
75
76
77 #include "spacewire_usb.h"
78
79
80
81 #if defined(_WIN32) || defined(_WIN64)
82
83
84 /* Windows specifc functions and macros */
85
86 #ifdef SPACEWIREUSBAPI_EXPORTS
87 #define SPACEWIREUSB_API __declspec(dllexport)
88 #else
89 #define SPACEWIREUSB_API __declspec(dllimport)
90 #endif
91
92 #ifdef _WIN64
93 #define SPW_USB_API_CC
94 #else
95 #define SPW_USB_API_CC __stdcall
96 #endif /* WIN64 */
97
98
99 #include "windows.h"
100
101
102 #else /* _WIN32 */
103
104
105 /* Linux specific functions and macros */
106
107 #define SPACEWIREUSB_API
108 #define SPW_USB_API_CC
109
110
111 #endif /* _WIN32 */
112
113
114
115 /* Functions provided by the API */
116
117 /* General functions */
118 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_Open(
119 star_device_handle *phDevice, int nDeviceNum);
120 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_Close(
121 star_device_handle hDevice);
122 SPACEWIREUSB_API U8 SPW_USB_API_CC USBSpaceWire_CountDevices();
123 SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_ListDevices();
124 SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetDriverVersion();
125 SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetIFVersion();
126 SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetAPIVersion();
127 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetTimeout(
128 star_device_handle hDevice, double timeout);
129 SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetTimeout(
130 star_device_handle hDevice);
131 SPACEWIREUSB_API U8 SPW_USB_API_CC USBSpaceWire_GetSpaceWireAddress(
132 star_device_handle hDevice);
133 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetSpaceWireAddress(
134 star_device_handle hDevice, U8 address);
135 SPACEWIREUSB_API U16 SPW_USB_API_CC USBSpaceWire_GetFirmwareVersion(
136 star_device_handle hDevice);
137 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_GetFirmwareVersionExtended(
138 star_device_handle hDevice, SPACEWIRE_FIRMWARE_VERSION *pVersion);
139 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_ClearEndpoints(
140 star_device_handle hDevice);
141 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_ResetDevice(
142 star_device_handle hDevice);
143 SPACEWIREUSB_API SPACEWIRE_DEVICE_TYPE SPW_USB_API_CC
144 USBSpaceWire_GetDeviceType(star_device_handle hDevice);
145 SPACEWIREUSB_API SPACEWIRE_DEVICE_TYPE SPW_USB_API_CC
146 USBSpaceWire_GetUnopenedDeviceType(int deviceNum);
147 SPACEWIREUSB_API U16 SPW_USB_API_CC USBSpaceWire_GetDeviceProductID(
148 star_device_handle hDevice);
149 SPACEWIREUSB_API U16 SPW_USB_API_CC USBSpaceWire_GetUnopenedDeviceProductID(
150 int deviceNum);
151 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_EnableHeaderMode(
152 star_device_handle hDevice, char enable);
153 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_IsHeaderModeEnabled(
154 star_device_handle hDevice);
155 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_EnableNetworkMode(
156 star_device_handle hDevice, char enable);
157 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_IsNetworkModeEnabled(
158 star_device_handle hDevice);
159 SPACEWIREUSB_API double SPW_USB_API_CC USBSpaceWire_GetUSBVersion(
160 star_device_handle hDevice);
161 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_GetAPIString(char *str);
162 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_GetSerialNumber(
163 star_device_handle hDevice, U8 pSerialNumber[11]);
164
165 /* Receive functions */
166 SPACEWIREUSB_API unsigned long SPW_USB_API_CC
167 USBSpaceWire_GetDriverDroppedPackets(star_device_handle hDevice);
168 SPACEWIREUSB_API unsigned long SPW_USB_API_CC
169 USBSpaceWire_GetDriverDroppedBytes(star_device_handle hDevice);
170 SPACEWIREUSB_API unsigned long SPW_USB_API_CC USBSpaceWire_GetDroppedPackets(
171 star_device_handle hDevice);
172 SPACEWIREUSB_API unsigned long SPW_USB_API_CC USBSpaceWire_GetDroppedBytes(
173 star_device_handle hDevice);
174 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_RegisterReceiveOnPort(
175 star_device_handle hDevice, U8 port);
176 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_UnregisterReceiveOnPort(
177 star_device_handle hDevice, U8 port);
178 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_RegisterReceiveOnAllPorts(
179 star_device_handle hDevice);
180 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_UnregisterReceiveOnAllPorts(
181 star_device_handle hDevice);
182 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_ReadPackets(
183 star_device_handle hDevice, void *pBuffer, U32 nBufferSize,
184 U32 nPacketNum, char bWait, PUSB_SPACEWIRE_PACKET_PROPERTIES properties,
185 USB_SPACEWIRE_ID *identifier);
186 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_FreeRead(
187 star_device_handle hDevice, USB_SPACEWIRE_ID identifier);
188 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_FreeAllReads(
189 star_device_handle hDevice);
190 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_GetReadStatus(
191 star_device_handle hDevice, USB_SPACEWIRE_ID identifier);
192 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
193 USBSpaceWire_WaitOnReadCompleting(star_device_handle hDevice,
194 USB_SPACEWIRE_ID identifier, char bWaitIndefinitely);
195 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_EnableReadThrottling(
196 star_device_handle hDevice, char enable);
197 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_IsReadThrottling(
198 star_device_handle hDevice);
199 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetDriverReadBufferSize(
200 star_device_handle hDevice, unsigned long nBufferSize);
201 SPACEWIREUSB_API unsigned long SPW_USB_API_CC
202 USBSpaceWire_GetDriverReadBufferSize(star_device_handle hDevice);
203 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetDriverReadStructsNum(
204 star_device_handle hDevice, unsigned long nStructsNum);
205 SPACEWIREUSB_API unsigned long SPW_USB_API_CC
206 USBSpaceWire_GetDriverReadStructsNum(star_device_handle hDevice);
207 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_WaitOnReadPacketAvailable(
208 star_device_handle hDevice, double timeout);
209 SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_GetReadLength(
210 PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum);
211 SPACEWIREUSB_API USB_SPACEWIRE_EOP_TYPE SPW_USB_API_CC
212 USBSpaceWire_GetReadEOPStatus(PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties,
213 U32 nPacketNum);
214 SPACEWIREUSB_API SPACEWIRE_TRAFFIC_TYPE SPW_USB_API_CC
215 USBSpaceWire_GetReadTrafficType(
216 PUSB_SPACEWIRE_PACKET_PROPERTIES pProperties, U32 nPacketNum);
217
218 /* Send functions */
219 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_GetNumberOfSendChannels(
220 star_device_handle hDevice);
221 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_SendPacketTo(
222 star_device_handle hDevice, void *pBuffer, U32 nBufferSize,
223 U8 *pAddress, U32 nAddressLen, char bWait,
224 USB_SPACEWIRE_ID *identifier);
225 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
226 USBSpaceWire_SendPacketToOverChannel(star_device_handle hDevice, U8 channel,
227 void *pBuffer, U32 nBufferSize, U8 *pAddress, U32 nAddressLen,
228 char bWait, USB_SPACEWIRE_ID *identifier);
229 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
230 USBSpaceWire_SendMultiplePacketsTo(star_device_handle hDevice,
231 void *pBuffer, U32 nPacketSize, U32 nBufferSize, U8 *pAddress,
232 U32 nAddressLen, char bWait, USB_SPACEWIRE_ID *identifier);
233 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
234 USBSpaceWire_SendMultiplePacketsToOverChannel(star_device_handle hDevice,
235 U8 channel, void *pBuffer, U32 nPacketSize, U32 nBufferSize,
236 U8 *pAddress, U32 nAddressLen, char bWait,
237 USB_SPACEWIRE_ID *identifier);
238 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
239 USBSpaceWire_SendMultiplePacketLengthsTo(star_device_handle hDevice,
240 void **pBuffers, U32 *pPacketSizes, U32 nNumberOfPackets, U8 *pAddress,
241 U32 nAddressLen, char bWait, USB_SPACEWIRE_ID *identifier);
242 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
243 USBSpaceWire_SendMultiplePacketLengthsToOverChannel(
244 star_device_handle hDevice, U8 channel, void **pBuffers,
245 U32 *pPacketSizes, U32 nNumberOfPackets, U8 *pAddress, U32 nAddressLen,
246 char bWait, USB_SPACEWIRE_ID *identifier);
247 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_SendPacket(
248 star_device_handle hDevice, void *pBuffer, U32 nBufferSize, char bWait,
249 USB_SPACEWIRE_ID *identifier);
250 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
251 USBSpaceWire_SendPacketOverChannel(star_device_handle hDevice, U8 channel,
252 void *pBuffer, U32 nBufferSize, char bWait,
253 USB_SPACEWIRE_ID *identifier);
254 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
255 USBSpaceWire_SendMultiplePackets(star_device_handle hDevice, void *pBuffer,
256 U32 nPacketSize, U32 nBufferSize, char bWait,
257 USB_SPACEWIRE_ID *identifier);
258 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
259 USBSpaceWire_SendMultiplePacketsOverChannel(star_device_handle hDevice,
260 U8 channel, void *pBuffer, U32 nPacketSize, U32 nBufferSize, char bWait,
261 USB_SPACEWIRE_ID *identifier);
262 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
263 USBSpaceWire_SendMultiplePacketLengths(star_device_handle hDevice,
264 void **pBuffers, U32 *pPacketSizes, U32 nNumberOfPackets, char bWait,
265 USB_SPACEWIRE_ID *identifier);
266 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
267 USBSpaceWire_SendMultiplePacketLengthsOverChannel(
268 star_device_handle hDevice, U8 channel, void **pBuffers,
269 U32 *pPacketSizes, U32 nNumberOfPackets, char bWait,
270 USB_SPACEWIRE_ID *identifier);
271 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_FreeSend(
272 star_device_handle hDevice, USB_SPACEWIRE_ID identifier);
273 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_FreeAllSends(
274 star_device_handle hDevice);
275 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC USBSpaceWire_GetSendStatus(
276 star_device_handle hDevice, USB_SPACEWIRE_ID identifier);
277 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
278 USBSpaceWire_WaitOnSendCompleting(star_device_handle hDevice,
279 USB_SPACEWIRE_ID identifier, char bWaitIndefinitely);
280 SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_GetSendSize(
281 star_device_handle hDevice, USB_SPACEWIRE_ID identifier);
282 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_SetDriverSendBufferSize(
283 star_device_handle hDevice, U32 nBufferSize);
284 SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_GetDriverSendBufferSize(
285 star_device_handle hDevice);
286 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_EnableSendEEPs(
287 star_device_handle hDevice, char enable);
288 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_IsSendEEPsEnabled(
289 star_device_handle hDevice);
290 SPACEWIREUSB_API USB_SPACEWIRE_STATUS SPW_USB_API_CC
291 USBSpaceWire_TunnelSendTraffic(star_device_handle hDevice,
292 SPACEWIRE_TRAFFIC_TYPE type, void *pBuffer, U32 nBufferSize,
293 USB_SPACEWIRE_EOP_TYPE eop, U8 port, char bWait,
294 USB_SPACEWIRE_ID *identifier);
295
296 /* Time-code functions */
297 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_PerformTickIn(
298 star_device_handle hDevice, U8 timein);
299 SPACEWIREUSB_API char SPW_USB_API_CC
300 USBSpaceWire_TC_EnableExternalTimecodeSelection(star_device_handle hDevice,
301 char enable);
302 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_Reset(
303 star_device_handle hDevice);
304 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_EnableAutoTickIn(
305 star_device_handle hDevice, char enableAutoTickIns, char enableAllPorts);
306 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_SetAutoTickInFrequency(
307 star_device_handle hDevice, U32 frequency);
308 SPACEWIREUSB_API char SPW_USB_API_CC USBSpaceWire_TC_StartReadingTimecodes(
309 star_device_handle hDevice, void *arg, void (*callbackfunc)(
310 star_device_handle hDevice, U8 timecode, void *arg));
311 SPACEWIREUSB_API void SPW_USB_API_CC USBSpaceWire_TC_StopReadingTimecodes(
312 star_device_handle hDevice);
313 SPACEWIREUSB_API U32 SPW_USB_API_CC USBSpaceWire_TC_GetClockFrequency(
314 star_device_handle hDevice);
315
316
317
318 #ifdef __cplusplus
319 }
320 #endif
321
322
323
324 #endif /* SPACEWIRE_USB_API_H */
325
326
@@ -0,0 +1,161
1 /**
2 * \file star-dundee_types.h
3 * \brief Definitions of STAR-Dundee commonly used types.
4 * \author Stuart Mills\n
5 * STAR-Dundee\n
6 * c/o School of Computing\n
7 * University of Dundee\n
8 * Dundee, DD1 4HN\n
9 * Scotland, UK\n
10 * e-mail: support@star-dundee.com
11 *
12 * This file contains the definitions of common types used by STAR-Dundee
13 * software drivers and APIs.
14 *
15 * <b>IMPORTANT NOTE:</b>
16 * \note If you are experiencing compilation errors indicating that
17 * U8 is already defined, for example, please add the following
18 * line to your code prior to including this file:\n
19 * <code>\#define NO_STAR_TYPES</code>\n
20 * Alternatively you can compile your code with a flag of
21 * <code>-DNO_STAR_TYPES</code>.\n
22 *
23 * \version 1.1 - August 22nd 2011\n
24 * Removed star_device_handle, not required by STAR-System.\n\n
25 *
26 * \version 1.0 - March 22nd 2007\n
27 * Initial version.\n\n
28 *
29 * Copyright &copy; 2009 STAR-Dundee Ltd
30 */
31
32
33 /**
34 * \defgroup STARDundeeTypes STAR-Dundee Types
35 * This section contains the definitions of types used in STAR-Dundee software
36 * drivers and APIs.
37 */
38
39 /**
40 * \def TRUE
41 * \ingroup STARDundeeTypes
42 * A value that can be used to represent the boolean value of true.
43 */
44
45 /**
46 * \def FALSE
47 * \ingroup STARDundeeTypes
48 * A value that can be used to represent the boolean value of false.
49 */
50
51 /**
52 * \typedef U8
53 * \ingroup STARDundeeTypes
54 * A type that can be used to represent an unsigned 8-bit number.
55 */
56
57 /**
58 * \typedef U16
59 * \ingroup STARDundeeTypes
60 * A type that can be used to represent an unsigned 16-bit number.
61 */
62
63 /**
64 * \typedef U32
65 * \ingroup STARDundeeTypes
66 * A type that can be used to represent an unsigned 32-bit number.
67 */
68
69 /**
70 * \typedef REGISTER
71 * \ingroup STARDundeeTypes
72 * A type that can be used to represent a 4-byte register.
73 */
74
75
76 #ifndef STAR_DUNDEE_TYPES
77 #define STAR_DUNDEE_TYPES
78
79 /* Define TRUE and FALSE */
80 #ifndef TRUE
81 #define TRUE 1
82 #endif
83 #ifndef FALSE
84 #define FALSE 0
85 #endif
86
87 #ifndef NO_STAR_TYPES
88
89 #if (defined(__linux__) || defined(LINUX) || defined(__LINUX__) || \
90 defined(__CYGWIN__)) && defined(__KERNEL__)
91
92 #include <linux/types.h>
93
94 /* Define U8, U16 and U32 in the Linux kernel */
95 #ifndef U8
96 typedef u8 U8;
97 #endif
98 #ifndef U16
99 typedef u16 U16;
100 #endif
101 #ifndef U32
102 typedef u32 U32;
103 #endif
104
105 #else
106
107 #include <limits.h>
108
109 /* Define U8 */
110 #ifndef U8
111 #if (UCHAR_MAX == 0xff)
112 typedef unsigned char U8;
113 #elif (UINT_MAX == 0xff)
114 typedef unsigned int U8;
115 #else
116 #error "No valid definition of U8 available"
117 #endif
118 #endif
119
120 /* Define U16 */
121 #ifndef U16
122 #if (USHRT_MAX == 0xffff)
123 typedef unsigned short U16;
124 #elif (UINT_MAX == 0xffff)
125 typedef unsigned int U16;
126 #elif (UCHAR_MAX == 0xffff)
127 typedef unsigned char U16;
128 #else
129 #error "No valid definition of U16 available"
130 #endif
131 #endif
132
133 /* Define U32 */
134 #ifndef U32
135 #if (UINT_MAX == 0xffffffff)
136 typedef unsigned int U32;
137 #elif (ULONG_MAX == 0xffffffff)
138 typedef unsigned long U32;
139 #elif (USHRT_MAX == 0xffffffff)
140 typedef unsigned short U32;
141 #elif (UCHAR_MAX == 0xffffffff)
142 typedef unsigned char U32;
143 #else
144 #error "No valid definition of U32 available"
145 #endif
146 #endif
147
148 #endif /* Linux kernel test */
149
150
151 #endif /* NO_STAR_TYPES */
152
153 /* Define REGISTER */
154 #ifndef REGISTER
155 typedef U32 REGISTER;
156 #endif
157
158
159 #endif /* STAR_DUNDEE_TYPES */
160
161
@@ -0,0 +1,97
1 /******************************************************************************/
2 /* */
3 /* star_dundee_types.h */
4 /* */
5 /* This file contains the definitions of common types used by STAR-Dundee */
6 /* drivers and APIs. */
7 /* */
8 /* IMPORTANT NOTE: If you are experiencing compilation errors indicating */
9 /* that U8 is already defined, for example, please add the */
10 /* following line to your code prior to including this */
11 /* file: */
12 /* #define NO_STAR_TYPES */
13 /* Alternatively you can compile your code with a flag of */
14 /* -DNO_STAR_TYPES. */
15 /* */
16 /* Version 1.0, March 22nd 2007 */
17 /* */
18 /* Version 1.0 - March 22nd 2007 */
19 /* =========== */
20 /* Initial version. */
21 /* */
22 /* Copyright (2012), STAR-Dundee Ltd., */
23 /* STAR House, */
24 /* 166 Nethergate, */
25 /* Dundee, DD1 4EE, */
26 /* Scotland, UK. */
27 /* e-mail: support@star-dundee.com */
28 /* */
29 /******************************************************************************/
30
31
32
33 #ifndef STAR_DUNDEE_TYPES
34 #define STAR_DUNDEE_TYPES
35
36
37 typedef void *star_device_handle;
38
39
40 #ifndef NO_STAR_TYPES
41
42 #if (defined(__linux__) || defined(LINUX) || defined(__LINUX__)) && \
43 defined(__KERNEL__)
44
45 #include <linux/types.h>
46
47 /* Define U8, U16 and U32 in the Linux kernel */
48 typedef u8 U8;
49 typedef u16 U16;
50 typedef u32 U32;
51
52 #else
53
54 #include <limits.h>
55
56 /* Define U8 */
57 #if (UCHAR_MAX == 0xff)
58 typedef unsigned char U8;
59 #elif (UINT_MAX == 0xff)
60 typedef unsigned int U8;
61 #else
62 #error "No valid definition of U8 available"
63 #endif
64
65 /* Define U16 */
66 #if (USHRT_MAX == 0xffff)
67 typedef unsigned short U16;
68 #elif (UINT_MAX == 0xffff)
69 typedef unsigned int U16;
70 #elif (UCHAR_MAX == 0xffff)
71 typedef unsigned char U16;
72 #else
73 #error "No valid definition of U16 available"
74 #endif
75
76 /* Define U32 */
77 #if (UINT_MAX == 0xffffffff)
78 typedef unsigned int U32;
79 #elif (ULONG_MAX == 0xffffffff)
80 typedef unsigned long U32;
81 #elif (USHRT_MAX == 0xffffffff)
82 typedef unsigned short U32;
83 #elif (UCHAR_MAX == 0xffffffff)
84 typedef unsigned char U32;
85 #else
86 #error "No valid definition of U32 available"
87 #endif
88
89 #endif /* Linux kernel test */
90
91
92 #endif /* NO_STAR_TYPES */
93
94
95 #endif /* STAR_DUNDEE_TYPES */
96
97
1 NO CONTENT: new file 100755, binary diff hidden
NO CONTENT: new file 100755, binary diff hidden
1 NO CONTENT: new file 100755, binary diff hidden
NO CONTENT: new file 100755, binary diff hidden
General Comments 0
You need to be logged in to leave comments. Login now